Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

drivers/net/can/pch_can.c
ae64438be192 ("can: dev: fix skb drop check")
1dd1b521be85 ("can: remove obsolete PCH CAN driver")
https://lore.kernel.org/all/20221110102509.1f7d63cc@canb.auug.org.au/

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+4411 -2219
+5
CREDITS
··· 918 918 S: K1N 6Z9 919 919 S: CANADA 920 920 921 + N: Vivien Didelot 922 + E: vivien.didelot@gmail.com 923 + D: DSA framework and MV88E6XXX driver 924 + S: Montreal, Quebec, Canada 925 + 921 926 N: Jeff Dike 922 927 E: jdike@karaya.com 923 928 W: http://user-mode-linux.sourceforge.net
+8
Documentation/arm64/booting.rst
··· 340 340 - SMCR_EL2.LEN must be initialised to the same value for all CPUs the 341 341 kernel will execute on. 342 342 343 + - HWFGRTR_EL2.nTPIDR2_EL0 (bit 55) must be initialised to 0b01. 344 + 345 + - HWFGWTR_EL2.nTPIDR2_EL0 (bit 55) must be initialised to 0b01. 346 + 347 + - HWFGRTR_EL2.nSMPRI_EL1 (bit 54) must be initialised to 0b01. 348 + 349 + - HWFGWTR_EL2.nSMPRI_EL1 (bit 54) must be initialised to 0b01. 350 + 343 351 For CPUs with the Scalable Matrix Extension FA64 feature (FEAT_SME_FA64) 344 352 345 353 - If EL3 is present:
+37 -1
Documentation/arm64/cpu-feature-registers.rst
··· 92 92 93 93 The infrastructure emulates only the following system register space:: 94 94 95 - Op0=3, Op1=0, CRn=0, CRm=0,4,5,6,7 95 + Op0=3, Op1=0, CRn=0, CRm=0,2,3,4,5,6,7 96 96 97 97 (See Table C5-6 'System instruction encodings for non-Debug System 98 98 register accesses' in ARMv8 ARM DDI 0487A.h, for the list of ··· 291 291 | RPRES | [7-4] | y | 292 292 +------------------------------+---------+---------+ 293 293 | WFXT | [3-0] | y | 294 + +------------------------------+---------+---------+ 295 + 296 + 10) MVFR0_EL1 - AArch32 Media and VFP Feature Register 0 297 + 298 + +------------------------------+---------+---------+ 299 + | Name | bits | visible | 300 + +------------------------------+---------+---------+ 301 + | FPDP | [11-8] | y | 302 + +------------------------------+---------+---------+ 303 + 304 + 11) MVFR1_EL1 - AArch32 Media and VFP Feature Register 1 305 + 306 + +------------------------------+---------+---------+ 307 + | Name | bits | visible | 308 + +------------------------------+---------+---------+ 309 + | SIMDFMAC | [31-28] | y | 310 + +------------------------------+---------+---------+ 311 + | SIMDSP | [19-16] | y | 312 + +------------------------------+---------+---------+ 313 + | SIMDInt | [15-12] | y | 314 + +------------------------------+---------+---------+ 315 + | SIMDLS | [11-8] | y | 316 + +------------------------------+---------+---------+ 317 + 318 + 12) ID_ISAR5_EL1 - AArch32 Instruction Set Attribute Register 5 319 + 320 + +------------------------------+---------+---------+ 321 + | Name | bits | visible | 322 + +------------------------------+---------+---------+ 323 + | CRC32 | [19-16] | y | 324 + +------------------------------+---------+---------+ 325 + | SHA2 | [15-12] | y | 326 + +------------------------------+---------+---------+ 327 + | SHA1 | [11-8] | y | 328 + +------------------------------+---------+---------+ 329 + | AES | [7-4] | y | 294 330 +------------------------------+---------+---------+ 295 331 296 332
+21 -8
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
··· 15 15 16 16 properties: 17 17 compatible: 18 - enum: 19 - - qcom,sfpb-mutex 20 - - qcom,tcsr-mutex 18 + oneOf: 19 + - enum: 20 + - qcom,sfpb-mutex 21 + - qcom,tcsr-mutex 22 + - items: 23 + - enum: 24 + - qcom,apq8084-tcsr-mutex 25 + - qcom,ipq6018-tcsr-mutex 26 + - qcom,msm8226-tcsr-mutex 27 + - qcom,msm8994-tcsr-mutex 28 + - const: qcom,tcsr-mutex 29 + - items: 30 + - enum: 31 + - qcom,msm8974-tcsr-mutex 32 + - const: qcom,tcsr-mutex 33 + - const: syscon 21 34 22 35 reg: 23 36 maxItems: 1 ··· 47 34 48 35 examples: 49 36 - | 50 - tcsr_mutex: hwlock@1f40000 { 51 - compatible = "qcom,tcsr-mutex"; 52 - reg = <0x01f40000 0x40000>; 53 - #hwlock-cells = <1>; 54 - }; 37 + hwlock@1f40000 { 38 + compatible = "qcom,tcsr-mutex"; 39 + reg = <0x01f40000 0x40000>; 40 + #hwlock-cells = <1>; 41 + }; 55 42 ...
+1 -1
Documentation/devicetree/bindings/net/engleder,tsnep.yaml
··· 47 47 48 48 nvmem-cells: true 49 49 50 - nvmem-cells-names: true 50 + nvmem-cell-names: true 51 51 52 52 phy-connection-type: 53 53 enum:
+3
Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml
··· 81 81 82 82 power-supply: true 83 83 84 + power-domains: 85 + maxItems: 1 86 + 84 87 resets: 85 88 description: | 86 89 A number of phandles to resets that need to be asserted during
+1
Documentation/driver-api/driver-model/devres.rst
··· 279 279 devm_gpio_request_one() 280 280 281 281 I2C 282 + devm_i2c_add_adapter() 282 283 devm_i2c_new_dummy_device() 283 284 284 285 IIO
+10
Documentation/kbuild/reproducible-builds.rst
··· 119 119 kernel versions by including an arbitrary string of "salt" in it. 120 120 This is specified by the Kconfig symbol ``CONFIG_BUILD_SALT``. 121 121 122 + Git 123 + --- 124 + 125 + Uncommitted changes or different commit ids in git can also lead 126 + to different compilation results. For example, after executing 127 + ``git reset HEAD^``, even if the code is the same, the 128 + ``include/config/kernel.release`` generated during compilation 129 + will be different, which will eventually lead to binary differences. 130 + See ``scripts/setlocalversion`` for details. 131 + 122 132 .. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp 123 133 .. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST: kbuild.html#kbuild-build-user-kbuild-build-host 124 134 .. _KCFLAGS: kbuild.html#kcflags
+9 -11
MAINTAINERS
··· 3985 3985 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 3986 3986 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3987 3987 S: Maintained 3988 - T: git git://github.com/broadcom/stblinux.git 3988 + T: git https://github.com/broadcom/stblinux.git 3989 3989 F: Documentation/devicetree/bindings/arm/bcm/brcm,bcmbca.yaml 3990 3990 F: arch/arm64/boot/dts/broadcom/bcmbca/* 3991 3991 N: bcmbca ··· 4010 4010 L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) 4011 4011 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 4012 4012 S: Maintained 4013 - T: git git://github.com/broadcom/stblinux.git 4013 + T: git https://github.com/broadcom/stblinux.git 4014 4014 F: Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml 4015 4015 F: drivers/pci/controller/pcie-brcmstb.c 4016 4016 F: drivers/staging/vc04_services ··· 4024 4024 M: Scott Branden <sbranden@broadcom.com> 4025 4025 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4026 4026 S: Maintained 4027 - T: git git://github.com/broadcom/mach-bcm 4027 + T: git https://github.com/broadcom/mach-bcm 4028 4028 F: arch/arm/mach-bcm/ 4029 4029 N: bcm281* 4030 4030 N: bcm113* ··· 4089 4089 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4090 4090 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 4091 4091 S: Maintained 4092 - T: git git://github.com/broadcom/stblinux.git 4092 + T: git https://github.com/broadcom/stblinux.git 4093 4093 F: Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml 4094 4094 F: arch/arm/boot/dts/bcm7*.dts* 4095 4095 F: arch/arm/include/asm/hardware/cache-b15-rac.h ··· 4122 4122 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4123 4123 L: linux-mips@vger.kernel.org 4124 4124 S: Maintained 4125 - T: git git://github.com/broadcom/stblinux.git 4125 + T: git https://github.com/broadcom/stblinux.git 4126 4126 F: arch/mips/bmips/* 4127 4127 F: arch/mips/boot/dts/brcm/bcm*.dts* 4128 4128 F: arch/mips/include/asm/mach-bmips/* ··· 4263 4263 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4264 4264 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 4265 4265 S: Maintained 4266 - T: git git://github.com/broadcom/stblinux.git 4266 + T: git https://github.com/broadcom/stblinux.git 4267 4267 F: arch/arm64/boot/dts/broadcom/northstar2/* 4268 4268 F: arch/arm64/boot/dts/broadcom/stingray/* 4269 4269 F: drivers/clk/bcm/clk-ns* ··· 4333 4333 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4334 4334 L: linux-pm@vger.kernel.org 4335 4335 S: Maintained 4336 - T: git git://github.com/broadcom/stblinux.git 4336 + T: git https://github.com/broadcom/stblinux.git 4337 4337 F: drivers/soc/bcm/bcm63xx/bcm-pmb.c 4338 4338 F: include/dt-bindings/soc/bcm-pmb.h 4339 4339 ··· 8604 8604 F: include/uapi/asm-generic/ 8605 8605 8606 8606 GENERIC PHY FRAMEWORK 8607 - M: Kishon Vijay Abraham I <kishon@ti.com> 8608 8607 M: Vinod Koul <vkoul@kernel.org> 8608 + M: Kishon Vijay Abraham I <kishon@kernel.org> 8609 8609 L: linux-phy@lists.infradead.org 8610 8610 S: Supported 8611 8611 Q: https://patchwork.kernel.org/project/linux-phy/list/ ··· 9219 9219 F: drivers/i2c/busses/i2c-hisi.c 9220 9220 9221 9221 HISILICON LPC BUS DRIVER 9222 - M: john.garry@huawei.com 9222 + M: Jay Fang <f.fangjian@huawei.com> 9223 9223 S: Maintained 9224 9224 W: http://www.hisilicon.com 9225 9225 F: Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml ··· 12229 12229 12230 12230 MARVELL 88E6XXX ETHERNET SWITCH FABRIC DRIVER 12231 12231 M: Andrew Lunn <andrew@lunn.ch> 12232 - M: Vivien Didelot <vivien.didelot@gmail.com> 12233 12232 L: netdev@vger.kernel.org 12234 12233 S: Maintained 12235 12234 F: Documentation/devicetree/bindings/net/dsa/marvell.txt ··· 14327 14328 14328 14329 NETWORKING [DSA] 14329 14330 M: Andrew Lunn <andrew@lunn.ch> 14330 - M: Vivien Didelot <vivien.didelot@gmail.com> 14331 14331 M: Florian Fainelli <f.fainelli@gmail.com> 14332 14332 M: Vladimir Oltean <olteanv@gmail.com> 14333 14333 S: Maintained
+2 -2
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 1 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc3 5 + EXTRAVERSION = -rc4 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION* ··· 1218 1218 cmd_ar_vmlinux.a = \ 1219 1219 rm -f $@; \ 1220 1220 $(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \ 1221 - $(AR) mPiT $$($(AR) t $@ | head -n1) $@ $$($(AR) t $@ | grep -F --file=$(srctree)/scripts/head-object-list.txt) 1221 + $(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt) 1222 1222 1223 1223 targets += vmlinux.a 1224 1224 vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt autoksyms_recursive FORCE
+4
arch/arm/boot/dts/imx6q-yapp4-crux.dts
··· 33 33 status = "okay"; 34 34 }; 35 35 36 + &reg_pu { 37 + regulator-always-on; 38 + }; 39 + 36 40 &reg_usb_h1_vbus { 37 41 status = "okay"; 38 42 };
+1 -1
arch/arm/boot/dts/imx6qdl-gw5910.dtsi
··· 29 29 30 30 user-pb { 31 31 label = "user_pb"; 32 - gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>; 32 + gpios = <&gsc_gpio 2 GPIO_ACTIVE_LOW>; 33 33 linux,code = <BTN_0>; 34 34 }; 35 35
+1 -1
arch/arm/boot/dts/imx6qdl-gw5913.dtsi
··· 26 26 27 27 user-pb { 28 28 label = "user_pb"; 29 - gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>; 29 + gpios = <&gsc_gpio 2 GPIO_ACTIVE_LOW>; 30 30 linux,code = <BTN_0>; 31 31 }; 32 32
+4
arch/arm/boot/dts/imx6qp-yapp4-crux-plus.dts
··· 33 33 status = "okay"; 34 34 }; 35 35 36 + &reg_pu { 37 + regulator-always-on; 38 + }; 39 + 36 40 &reg_usb_h1_vbus { 37 41 status = "okay"; 38 42 };
+8
arch/arm/boot/dts/ste-href.dtsi
··· 24 24 polling-delay = <0>; 25 25 polling-delay-passive = <0>; 26 26 thermal-sensors = <&bat_therm>; 27 + 28 + trips { 29 + battery-crit-hi { 30 + temperature = <70000>; 31 + hysteresis = <2000>; 32 + type = "critical"; 33 + }; 34 + }; 27 35 }; 28 36 }; 29 37
+8
arch/arm/boot/dts/ste-snowball.dts
··· 28 28 polling-delay = <0>; 29 29 polling-delay-passive = <0>; 30 30 thermal-sensors = <&bat_therm>; 31 + 32 + trips { 33 + battery-crit-hi { 34 + temperature = <70000>; 35 + hysteresis = <2000>; 36 + type = "critical"; 37 + }; 38 + }; 31 39 }; 32 40 }; 33 41
+8
arch/arm/boot/dts/ste-ux500-samsung-codina-tmo.dts
··· 44 44 polling-delay = <0>; 45 45 polling-delay-passive = <0>; 46 46 thermal-sensors = <&bat_therm>; 47 + 48 + trips { 49 + battery-crit-hi { 50 + temperature = <70000>; 51 + hysteresis = <2000>; 52 + type = "critical"; 53 + }; 54 + }; 47 55 }; 48 56 }; 49 57
+8
arch/arm/boot/dts/ste-ux500-samsung-codina.dts
··· 57 57 polling-delay = <0>; 58 58 polling-delay-passive = <0>; 59 59 thermal-sensors = <&bat_therm>; 60 + 61 + trips { 62 + battery-crit-hi { 63 + temperature = <70000>; 64 + hysteresis = <2000>; 65 + type = "critical"; 66 + }; 67 + }; 60 68 }; 61 69 }; 62 70
+8
arch/arm/boot/dts/ste-ux500-samsung-gavini.dts
··· 30 30 polling-delay = <0>; 31 31 polling-delay-passive = <0>; 32 32 thermal-sensors = <&bat_therm>; 33 + 34 + trips { 35 + battery-crit-hi { 36 + temperature = <70000>; 37 + hysteresis = <2000>; 38 + type = "critical"; 39 + }; 40 + }; 33 41 }; 34 42 }; 35 43
+8
arch/arm/boot/dts/ste-ux500-samsung-golden.dts
··· 35 35 polling-delay = <0>; 36 36 polling-delay-passive = <0>; 37 37 thermal-sensors = <&bat_therm>; 38 + 39 + trips { 40 + battery-crit-hi { 41 + temperature = <70000>; 42 + hysteresis = <2000>; 43 + type = "critical"; 44 + }; 45 + }; 38 46 }; 39 47 }; 40 48
+8
arch/arm/boot/dts/ste-ux500-samsung-janice.dts
··· 30 30 polling-delay = <0>; 31 31 polling-delay-passive = <0>; 32 32 thermal-sensors = <&bat_therm>; 33 + 34 + trips { 35 + battery-crit-hi { 36 + temperature = <70000>; 37 + hysteresis = <2000>; 38 + type = "critical"; 39 + }; 40 + }; 33 41 }; 34 42 }; 35 43
+8
arch/arm/boot/dts/ste-ux500-samsung-kyle.dts
··· 34 34 polling-delay = <0>; 35 35 polling-delay-passive = <0>; 36 36 thermal-sensors = <&bat_therm>; 37 + 38 + trips { 39 + battery-crit-hi { 40 + temperature = <70000>; 41 + hysteresis = <2000>; 42 + type = "critical"; 43 + }; 44 + }; 37 45 }; 38 46 }; 39 47
+8
arch/arm/boot/dts/ste-ux500-samsung-skomer.dts
··· 30 30 polling-delay = <0>; 31 31 polling-delay-passive = <0>; 32 32 thermal-sensors = <&bat_therm>; 33 + 34 + trips { 35 + battery-crit-hi { 36 + temperature = <70000>; 37 + hysteresis = <2000>; 38 + type = "critical"; 39 + }; 40 + }; 33 41 }; 34 42 }; 35 43
+14
arch/arm64/boot/dts/arm/juno-base.dtsi
··· 751 751 polling-delay = <1000>; 752 752 polling-delay-passive = <100>; 753 753 thermal-sensors = <&scpi_sensors0 0>; 754 + trips { 755 + pmic_crit0: trip0 { 756 + temperature = <90000>; 757 + hysteresis = <2000>; 758 + type = "critical"; 759 + }; 760 + }; 754 761 }; 755 762 756 763 soc { 757 764 polling-delay = <1000>; 758 765 polling-delay-passive = <100>; 759 766 thermal-sensors = <&scpi_sensors0 3>; 767 + trips { 768 + soc_crit0: trip0 { 769 + temperature = <80000>; 770 + hysteresis = <2000>; 771 + type = "critical"; 772 + }; 773 + }; 760 774 }; 761 775 762 776 big_cluster_thermal_zone: big-cluster {
+6
arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
··· 779 779 little-endian; 780 780 #address-cells = <1>; 781 781 #size-cells = <0>; 782 + clock-frequency = <2500000>; 783 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 784 + QORIQ_CLK_PLL_DIV(1)>; 782 785 status = "disabled"; 783 786 }; 784 787 ··· 791 788 little-endian; 792 789 #address-cells = <1>; 793 790 #size-cells = <0>; 791 + clock-frequency = <2500000>; 792 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 793 + QORIQ_CLK_PLL_DIV(1)>; 794 794 status = "disabled"; 795 795 }; 796 796
+6
arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi
··· 532 532 little-endian; 533 533 #address-cells = <1>; 534 534 #size-cells = <0>; 535 + clock-frequency = <2500000>; 536 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 537 + QORIQ_CLK_PLL_DIV(2)>; 535 538 status = "disabled"; 536 539 }; 537 540 ··· 544 541 little-endian; 545 542 #address-cells = <1>; 546 543 #size-cells = <0>; 544 + clock-frequency = <2500000>; 545 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 546 + QORIQ_CLK_PLL_DIV(2)>; 547 547 status = "disabled"; 548 548 }; 549 549
+6
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
··· 1385 1385 #address-cells = <1>; 1386 1386 #size-cells = <0>; 1387 1387 little-endian; 1388 + clock-frequency = <2500000>; 1389 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 1390 + QORIQ_CLK_PLL_DIV(2)>; 1388 1391 status = "disabled"; 1389 1392 }; 1390 1393 ··· 1398 1395 little-endian; 1399 1396 #address-cells = <1>; 1400 1397 #size-cells = <0>; 1398 + clock-frequency = <2500000>; 1399 + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL 1400 + QORIQ_CLK_PLL_DIV(2)>; 1401 1401 status = "disabled"; 1402 1402 }; 1403 1403
+9 -9
arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi
··· 38 38 interrupts = <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>; 39 39 reg = <0x5b010000 0x10000>; 40 40 clocks = <&sdhc0_lpcg IMX_LPCG_CLK_4>, 41 - <&sdhc0_lpcg IMX_LPCG_CLK_5>, 42 - <&sdhc0_lpcg IMX_LPCG_CLK_0>; 43 - clock-names = "ipg", "per", "ahb"; 41 + <&sdhc0_lpcg IMX_LPCG_CLK_0>, 42 + <&sdhc0_lpcg IMX_LPCG_CLK_5>; 43 + clock-names = "ipg", "ahb", "per"; 44 44 power-domains = <&pd IMX_SC_R_SDHC_0>; 45 45 status = "disabled"; 46 46 }; ··· 49 49 interrupts = <GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH>; 50 50 reg = <0x5b020000 0x10000>; 51 51 clocks = <&sdhc1_lpcg IMX_LPCG_CLK_4>, 52 - <&sdhc1_lpcg IMX_LPCG_CLK_5>, 53 - <&sdhc1_lpcg IMX_LPCG_CLK_0>; 54 - clock-names = "ipg", "per", "ahb"; 52 + <&sdhc1_lpcg IMX_LPCG_CLK_0>, 53 + <&sdhc1_lpcg IMX_LPCG_CLK_5>; 54 + clock-names = "ipg", "ahb", "per"; 55 55 power-domains = <&pd IMX_SC_R_SDHC_1>; 56 56 fsl,tuning-start-tap = <20>; 57 57 fsl,tuning-step = <2>; ··· 62 62 interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH>; 63 63 reg = <0x5b030000 0x10000>; 64 64 clocks = <&sdhc2_lpcg IMX_LPCG_CLK_4>, 65 - <&sdhc2_lpcg IMX_LPCG_CLK_5>, 66 - <&sdhc2_lpcg IMX_LPCG_CLK_0>; 67 - clock-names = "ipg", "per", "ahb"; 65 + <&sdhc2_lpcg IMX_LPCG_CLK_0>, 66 + <&sdhc2_lpcg IMX_LPCG_CLK_5>; 67 + clock-names = "ipg", "ahb", "per"; 68 68 power-domains = <&pd IMX_SC_R_SDHC_2>; 69 69 status = "disabled"; 70 70 };
+8 -8
arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts
··· 250 250 /* SODIMM 96 */ 251 251 MX8MM_IOMUXC_SAI1_RXD2_GPIO4_IO4 0x1c4 252 252 /* CPLD_D[7] */ 253 - MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x1c4 253 + MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x184 254 254 /* CPLD_D[6] */ 255 - MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x1c4 255 + MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x184 256 256 /* CPLD_D[5] */ 257 - MX8MM_IOMUXC_SAI1_TXC_GPIO4_IO11 0x1c4 257 + MX8MM_IOMUXC_SAI1_TXC_GPIO4_IO11 0x184 258 258 /* CPLD_D[4] */ 259 - MX8MM_IOMUXC_SAI1_TXD0_GPIO4_IO12 0x1c4 259 + MX8MM_IOMUXC_SAI1_TXD0_GPIO4_IO12 0x184 260 260 /* CPLD_D[3] */ 261 - MX8MM_IOMUXC_SAI1_TXD1_GPIO4_IO13 0x1c4 261 + MX8MM_IOMUXC_SAI1_TXD1_GPIO4_IO13 0x184 262 262 /* CPLD_D[2] */ 263 - MX8MM_IOMUXC_SAI1_TXD2_GPIO4_IO14 0x1c4 263 + MX8MM_IOMUXC_SAI1_TXD2_GPIO4_IO14 0x184 264 264 /* CPLD_D[1] */ 265 - MX8MM_IOMUXC_SAI1_TXD3_GPIO4_IO15 0x1c4 265 + MX8MM_IOMUXC_SAI1_TXD3_GPIO4_IO15 0x184 266 266 /* CPLD_D[0] */ 267 - MX8MM_IOMUXC_SAI1_TXD4_GPIO4_IO16 0x1c4 267 + MX8MM_IOMUXC_SAI1_TXD4_GPIO4_IO16 0x184 268 268 /* KBD_intK */ 269 269 MX8MM_IOMUXC_SAI2_MCLK_GPIO4_IO27 0x1c4 270 270 /* DISP_reset */
+4 -4
arch/arm64/boot/dts/freescale/imx8mm.dtsi
··· 276 276 assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>; 277 277 assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>; 278 278 clock-names = "main_clk"; 279 + power-domains = <&pgc_otg1>; 279 280 }; 280 281 281 282 usbphynop2: usbphynop2 { ··· 286 285 assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>; 287 286 assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>; 288 287 clock-names = "main_clk"; 288 + power-domains = <&pgc_otg2>; 289 289 }; 290 290 291 291 soc: soc@0 { ··· 676 674 pgc_otg1: power-domain@2 { 677 675 #power-domain-cells = <0>; 678 676 reg = <IMX8MM_POWER_DOMAIN_OTG1>; 679 - power-domains = <&pgc_hsiomix>; 680 677 }; 681 678 682 679 pgc_otg2: power-domain@3 { 683 680 #power-domain-cells = <0>; 684 681 reg = <IMX8MM_POWER_DOMAIN_OTG2>; 685 - power-domains = <&pgc_hsiomix>; 686 682 }; 687 683 688 684 pgc_gpumix: power-domain@4 { ··· 1186 1186 assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>; 1187 1187 phys = <&usbphynop1>; 1188 1188 fsl,usbmisc = <&usbmisc1 0>; 1189 - power-domains = <&pgc_otg1>; 1189 + power-domains = <&pgc_hsiomix>; 1190 1190 status = "disabled"; 1191 1191 }; 1192 1192 ··· 1206 1206 assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>; 1207 1207 phys = <&usbphynop2>; 1208 1208 fsl,usbmisc = <&usbmisc2 0>; 1209 - power-domains = <&pgc_otg2>; 1209 + power-domains = <&pgc_hsiomix>; 1210 1210 status = "disabled"; 1211 1211 }; 1212 1212
+2 -2
arch/arm64/boot/dts/freescale/imx8mn.dtsi
··· 662 662 pgc_otg1: power-domain@1 { 663 663 #power-domain-cells = <0>; 664 664 reg = <IMX8MN_POWER_DOMAIN_OTG1>; 665 - power-domains = <&pgc_hsiomix>; 666 665 }; 667 666 668 667 pgc_gpumix: power-domain@2 { ··· 1075 1076 assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>; 1076 1077 phys = <&usbphynop1>; 1077 1078 fsl,usbmisc = <&usbmisc1 0>; 1078 - power-domains = <&pgc_otg1>; 1079 + power-domains = <&pgc_hsiomix>; 1079 1080 status = "disabled"; 1080 1081 }; 1081 1082 ··· 1174 1175 assigned-clocks = <&clk IMX8MN_CLK_USB_PHY_REF>; 1175 1176 assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>; 1176 1177 clock-names = "main_clk"; 1178 + power-domains = <&pgc_otg1>; 1177 1179 }; 1178 1180 };
+10 -10
arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
··· 354 354 "SODIMM_82", 355 355 "SODIMM_70", 356 356 "SODIMM_72"; 357 - 358 - ctrl-sleep-moci-hog { 359 - gpio-hog; 360 - /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */ 361 - gpios = <29 GPIO_ACTIVE_HIGH>; 362 - line-name = "CTRL_SLEEP_MOCI#"; 363 - output-high; 364 - pinctrl-names = "default"; 365 - pinctrl-0 = <&pinctrl_ctrl_sleep_moci>; 366 - }; 367 357 }; 368 358 369 359 &gpio3 { ··· 422 432 "SODIMM_256", 423 433 "SODIMM_48", 424 434 "SODIMM_44"; 435 + 436 + ctrl-sleep-moci-hog { 437 + gpio-hog; 438 + /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */ 439 + gpios = <29 GPIO_ACTIVE_HIGH>; 440 + line-name = "CTRL_SLEEP_MOCI#"; 441 + output-high; 442 + pinctrl-names = "default"; 443 + pinctrl-0 = <&pinctrl_ctrl_sleep_moci>; 444 + }; 425 445 }; 426 446 427 447 /* On-module I2C */
+6 -5
arch/arm64/boot/dts/freescale/imx93.dtsi
··· 451 451 clocks = <&clk IMX93_CLK_GPIO2_GATE>, 452 452 <&clk IMX93_CLK_GPIO2_GATE>; 453 453 clock-names = "gpio", "port"; 454 - gpio-ranges = <&iomuxc 0 32 32>; 454 + gpio-ranges = <&iomuxc 0 4 30>; 455 455 }; 456 456 457 457 gpio3: gpio@43820080 { ··· 465 465 clocks = <&clk IMX93_CLK_GPIO3_GATE>, 466 466 <&clk IMX93_CLK_GPIO3_GATE>; 467 467 clock-names = "gpio", "port"; 468 - gpio-ranges = <&iomuxc 0 64 32>; 468 + gpio-ranges = <&iomuxc 0 84 8>, <&iomuxc 8 66 18>, 469 + <&iomuxc 26 34 2>, <&iomuxc 28 0 4>; 469 470 }; 470 471 471 472 gpio4: gpio@43830080 { ··· 480 479 clocks = <&clk IMX93_CLK_GPIO4_GATE>, 481 480 <&clk IMX93_CLK_GPIO4_GATE>; 482 481 clock-names = "gpio", "port"; 483 - gpio-ranges = <&iomuxc 0 96 32>; 482 + gpio-ranges = <&iomuxc 0 38 28>, <&iomuxc 28 36 2>; 484 483 }; 485 484 486 485 gpio1: gpio@47400080 { ··· 494 493 clocks = <&clk IMX93_CLK_GPIO1_GATE>, 495 494 <&clk IMX93_CLK_GPIO1_GATE>; 496 495 clock-names = "gpio", "port"; 497 - gpio-ranges = <&iomuxc 0 0 32>; 496 + gpio-ranges = <&iomuxc 0 92 16>; 498 497 }; 499 498 500 499 s4muap: mailbox@47520000 { ··· 502 501 reg = <0x47520000 0x10000>; 503 502 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, 504 503 <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>; 505 - interrupt-names = "txirq", "rxirq"; 504 + interrupt-names = "tx", "rx"; 506 505 #mbox-cells = <2>; 507 506 }; 508 507
+8
arch/arm64/include/asm/efi.h
··· 14 14 15 15 #ifdef CONFIG_EFI 16 16 extern void efi_init(void); 17 + 18 + bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg); 17 19 #else 18 20 #define efi_init() 21 + 22 + static inline 23 + bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) 24 + { 25 + return false; 26 + } 19 27 #endif 20 28 21 29 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
+33 -9
arch/arm64/kernel/cpufeature.c
··· 428 428 ARM64_FTR_END, 429 429 }; 430 430 431 + static const struct arm64_ftr_bits ftr_mvfr0[] = { 432 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPROUND_SHIFT, 4, 0), 433 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPSHVEC_SHIFT, 4, 0), 434 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPSQRT_SHIFT, 4, 0), 435 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPDIVIDE_SHIFT, 4, 0), 436 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPTRAP_SHIFT, 4, 0), 437 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPDP_SHIFT, 4, 0), 438 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_FPSP_SHIFT, 4, 0), 439 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR0_SIMD_SHIFT, 4, 0), 440 + ARM64_FTR_END, 441 + }; 442 + 443 + static const struct arm64_ftr_bits ftr_mvfr1[] = { 444 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_SIMDFMAC_SHIFT, 4, 0), 445 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_FPHP_SHIFT, 4, 0), 446 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_SIMDHP_SHIFT, 4, 0), 447 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_SIMDSP_SHIFT, 4, 0), 448 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_SIMDINT_SHIFT, 4, 0), 449 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_SIMDLS_SHIFT, 4, 0), 450 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_FPDNAN_SHIFT, 4, 0), 451 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR1_FPFTZ_SHIFT, 4, 0), 452 + ARM64_FTR_END, 453 + }; 454 + 431 455 static const struct arm64_ftr_bits ftr_mvfr2[] = { 432 456 ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR2_FPMISC_SHIFT, 4, 0), 433 457 ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, MVFR2_SIMDMISC_SHIFT, 4, 0), ··· 482 458 483 459 static const struct arm64_ftr_bits ftr_id_isar5[] = { 484 460 ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_RDM_SHIFT, 4, 0), 485 - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_CRC32_SHIFT, 4, 0), 486 - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_SHA2_SHIFT, 4, 0), 487 - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_SHA1_SHIFT, 4, 0), 488 - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_AES_SHIFT, 4, 0), 461 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_CRC32_SHIFT, 4, 0), 462 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_SHA2_SHIFT, 4, 0), 463 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_SHA1_SHIFT, 4, 0), 464 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_AES_SHIFT, 4, 0), 489 465 ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_ISAR5_SEVL_SHIFT, 4, 0), 490 466 ARM64_FTR_END, 491 467 }; ··· 598 574 * Common ftr bits for a 32bit register with all hidden, strict 599 575 * attributes, with 4bit feature fields and a default safe value of 600 576 * 0. Covers the following 32bit registers: 601 - * id_isar[1-4], id_mmfr[1-3], id_pfr1, mvfr[0-1] 577 + * id_isar[1-3], id_mmfr[1-3] 602 578 */ 603 579 static const struct arm64_ftr_bits ftr_generic_32bits[] = { 604 580 ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, 28, 4, 0), ··· 669 645 ARM64_FTR_REG(SYS_ID_ISAR6_EL1, ftr_id_isar6), 670 646 671 647 /* Op1 = 0, CRn = 0, CRm = 3 */ 672 - ARM64_FTR_REG(SYS_MVFR0_EL1, ftr_generic_32bits), 673 - ARM64_FTR_REG(SYS_MVFR1_EL1, ftr_generic_32bits), 648 + ARM64_FTR_REG(SYS_MVFR0_EL1, ftr_mvfr0), 649 + ARM64_FTR_REG(SYS_MVFR1_EL1, ftr_mvfr1), 674 650 ARM64_FTR_REG(SYS_MVFR2_EL1, ftr_mvfr2), 675 651 ARM64_FTR_REG(SYS_ID_PFR2_EL1, ftr_id_pfr2), 676 652 ARM64_FTR_REG(SYS_ID_DFR1_EL1, ftr_id_dfr1), ··· 3363 3339 3364 3340 /* 3365 3341 * We emulate only the following system register space. 3366 - * Op0 = 0x3, CRn = 0x0, Op1 = 0x0, CRm = [0, 4 - 7] 3342 + * Op0 = 0x3, CRn = 0x0, Op1 = 0x0, CRm = [0, 2 - 7] 3367 3343 * See Table C5-6 System instruction encodings for System register accesses, 3368 3344 * ARMv8 ARM(ARM DDI 0487A.f) for more details. 3369 3345 */ ··· 3373 3349 sys_reg_CRn(id) == 0x0 && 3374 3350 sys_reg_Op1(id) == 0x0 && 3375 3351 (sys_reg_CRm(id) == 0 || 3376 - ((sys_reg_CRm(id) >= 4) && (sys_reg_CRm(id) <= 7)))); 3352 + ((sys_reg_CRm(id) >= 2) && (sys_reg_CRm(id) <= 7)))); 3377 3353 } 3378 3354 3379 3355 /*
+31 -2
arch/arm64/kernel/efi-rt-wrapper.S
··· 6 6 #include <linux/linkage.h> 7 7 8 8 SYM_FUNC_START(__efi_rt_asm_wrapper) 9 - stp x29, x30, [sp, #-32]! 9 + stp x29, x30, [sp, #-112]! 10 10 mov x29, sp 11 11 12 12 /* ··· 15 15 * (such as UEFI) should never touch it. 16 16 */ 17 17 stp x1, x18, [sp, #16] 18 + 19 + /* 20 + * Preserve all callee saved registers and record the stack pointer 21 + * value in a per-CPU variable so we can recover from synchronous 22 + * exceptions occurring while running the firmware routines. 23 + */ 24 + stp x19, x20, [sp, #32] 25 + stp x21, x22, [sp, #48] 26 + stp x23, x24, [sp, #64] 27 + stp x25, x26, [sp, #80] 28 + stp x27, x28, [sp, #96] 29 + 30 + adr_this_cpu x8, __efi_rt_asm_recover_sp, x9 31 + str x29, [x8] 18 32 19 33 /* 20 34 * We are lucky enough that no EFI runtime services take more than ··· 45 31 46 32 ldp x1, x2, [sp, #16] 47 33 cmp x2, x18 48 - ldp x29, x30, [sp], #32 34 + ldp x29, x30, [sp], #112 49 35 b.ne 0f 50 36 ret 51 37 0: ··· 59 45 mov x18, x2 60 46 b efi_handle_corrupted_x18 // tail call 61 47 SYM_FUNC_END(__efi_rt_asm_wrapper) 48 + 49 + SYM_FUNC_START(__efi_rt_asm_recover) 50 + ldr_this_cpu x8, __efi_rt_asm_recover_sp, x9 51 + mov sp, x8 52 + 53 + ldp x0, x18, [sp, #16] 54 + ldp x19, x20, [sp, #32] 55 + ldp x21, x22, [sp, #48] 56 + ldp x23, x24, [sp, #64] 57 + ldp x25, x26, [sp, #80] 58 + ldp x27, x28, [sp, #96] 59 + ldp x29, x30, [sp], #112 60 + 61 + b efi_handle_runtime_exception 62 + SYM_FUNC_END(__efi_rt_asm_recover)
+26
arch/arm64/kernel/efi.c
··· 9 9 10 10 #include <linux/efi.h> 11 11 #include <linux/init.h> 12 + #include <linux/percpu.h> 12 13 13 14 #include <asm/efi.h> 14 15 ··· 128 127 { 129 128 pr_err_ratelimited(FW_BUG "register x18 corrupted by EFI %s\n", f); 130 129 return s; 130 + } 131 + 132 + asmlinkage DEFINE_PER_CPU(u64, __efi_rt_asm_recover_sp); 133 + 134 + asmlinkage efi_status_t __efi_rt_asm_recover(void); 135 + 136 + asmlinkage efi_status_t efi_handle_runtime_exception(const char *f) 137 + { 138 + pr_err(FW_BUG "Synchronous exception occurred in EFI runtime service %s()\n", f); 139 + clear_bit(EFI_RUNTIME_SERVICES, &efi.flags); 140 + return EFI_ABORTED; 141 + } 142 + 143 + bool efi_runtime_fixup_exception(struct pt_regs *regs, const char *msg) 144 + { 145 + /* Check whether the exception occurred while running the firmware */ 146 + if (current_work() != &efi_rts_work.work || regs->pc >= TASK_SIZE_64) 147 + return false; 148 + 149 + pr_err(FW_BUG "Unable to handle %s in EFI runtime service\n", msg); 150 + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 151 + dump_stack(); 152 + 153 + regs->pc = (u64)__efi_rt_asm_recover; 154 + return true; 131 155 }
+2 -1
arch/arm64/kernel/entry-common.c
··· 329 329 __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 0); 330 330 } 331 331 332 - static bool cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) 332 + static __always_inline bool 333 + cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) 333 334 { 334 335 if (!__this_cpu_read(__in_cortex_a76_erratum_1463225_wa)) 335 336 return false;
+2 -1
arch/arm64/kvm/hyp/exception.c
··· 13 13 #include <hyp/adjust_pc.h> 14 14 #include <linux/kvm_host.h> 15 15 #include <asm/kvm_emulate.h> 16 + #include <asm/kvm_mmu.h> 16 17 17 18 #if !defined (__KVM_NVHE_HYPERVISOR__) && !defined (__KVM_VHE_HYPERVISOR__) 18 19 #error Hypervisor code only! ··· 116 115 new |= (old & PSR_C_BIT); 117 116 new |= (old & PSR_V_BIT); 118 117 119 - if (kvm_has_mte(vcpu->kvm)) 118 + if (kvm_has_mte(kern_hyp_va(vcpu->kvm))) 120 119 new |= PSR_TCO_BIT; 121 120 122 121 new |= (old & PSR_DIT_BIT);
+20
arch/arm64/kvm/hyp/include/hyp/switch.h
··· 87 87 88 88 vcpu->arch.mdcr_el2_host = read_sysreg(mdcr_el2); 89 89 write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); 90 + 91 + if (cpus_have_final_cap(ARM64_SME)) { 92 + sysreg_clear_set_s(SYS_HFGRTR_EL2, 93 + HFGxTR_EL2_nSMPRI_EL1_MASK | 94 + HFGxTR_EL2_nTPIDR2_EL0_MASK, 95 + 0); 96 + sysreg_clear_set_s(SYS_HFGWTR_EL2, 97 + HFGxTR_EL2_nSMPRI_EL1_MASK | 98 + HFGxTR_EL2_nTPIDR2_EL0_MASK, 99 + 0); 100 + } 90 101 } 91 102 92 103 static inline void __deactivate_traps_common(struct kvm_vcpu *vcpu) ··· 107 96 write_sysreg(0, hstr_el2); 108 97 if (kvm_arm_support_pmu_v3()) 109 98 write_sysreg(0, pmuserenr_el0); 99 + 100 + if (cpus_have_final_cap(ARM64_SME)) { 101 + sysreg_clear_set_s(SYS_HFGRTR_EL2, 0, 102 + HFGxTR_EL2_nSMPRI_EL1_MASK | 103 + HFGxTR_EL2_nTPIDR2_EL0_MASK); 104 + sysreg_clear_set_s(SYS_HFGWTR_EL2, 0, 105 + HFGxTR_EL2_nSMPRI_EL1_MASK | 106 + HFGxTR_EL2_nTPIDR2_EL0_MASK); 107 + } 110 108 } 111 109 112 110 static inline void ___activate_traps(struct kvm_vcpu *vcpu)
+1 -1
arch/arm64/kvm/hyp/nvhe/mem_protect.c
··· 516 516 if (!kvm_pte_valid(pte)) 517 517 return PKVM_NOPAGE; 518 518 519 - return pkvm_getstate(kvm_pgtable_stage2_pte_prot(pte)); 519 + return pkvm_getstate(kvm_pgtable_hyp_pte_prot(pte)); 520 520 } 521 521 522 522 static int __hyp_check_page_state_range(u64 addr, u64 size,
-26
arch/arm64/kvm/hyp/nvhe/switch.c
··· 55 55 write_sysreg(val, cptr_el2); 56 56 write_sysreg(__this_cpu_read(kvm_hyp_vector), vbar_el2); 57 57 58 - if (cpus_have_final_cap(ARM64_SME)) { 59 - val = read_sysreg_s(SYS_HFGRTR_EL2); 60 - val &= ~(HFGxTR_EL2_nTPIDR2_EL0_MASK | 61 - HFGxTR_EL2_nSMPRI_EL1_MASK); 62 - write_sysreg_s(val, SYS_HFGRTR_EL2); 63 - 64 - val = read_sysreg_s(SYS_HFGWTR_EL2); 65 - val &= ~(HFGxTR_EL2_nTPIDR2_EL0_MASK | 66 - HFGxTR_EL2_nSMPRI_EL1_MASK); 67 - write_sysreg_s(val, SYS_HFGWTR_EL2); 68 - } 69 - 70 58 if (cpus_have_final_cap(ARM64_WORKAROUND_SPECULATIVE_AT)) { 71 59 struct kvm_cpu_context *ctxt = &vcpu->arch.ctxt; 72 60 ··· 97 109 __deactivate_traps_common(vcpu); 98 110 99 111 write_sysreg(this_cpu_ptr(&kvm_init_params)->hcr_el2, hcr_el2); 100 - 101 - if (cpus_have_final_cap(ARM64_SME)) { 102 - u64 val; 103 - 104 - val = read_sysreg_s(SYS_HFGRTR_EL2); 105 - val |= HFGxTR_EL2_nTPIDR2_EL0_MASK | 106 - HFGxTR_EL2_nSMPRI_EL1_MASK; 107 - write_sysreg_s(val, SYS_HFGRTR_EL2); 108 - 109 - val = read_sysreg_s(SYS_HFGWTR_EL2); 110 - val |= HFGxTR_EL2_nTPIDR2_EL0_MASK | 111 - HFGxTR_EL2_nSMPRI_EL1_MASK; 112 - write_sysreg_s(val, SYS_HFGWTR_EL2); 113 - } 114 112 115 113 cptr = CPTR_EL2_DEFAULT; 116 114 if (vcpu_has_sve(vcpu) && (vcpu->arch.fp_state == FP_STATE_GUEST_OWNED))
-8
arch/arm64/kvm/hyp/vhe/switch.c
··· 63 63 __activate_traps_fpsimd32(vcpu); 64 64 } 65 65 66 - if (cpus_have_final_cap(ARM64_SME)) 67 - write_sysreg(read_sysreg(sctlr_el2) & ~SCTLR_ELx_ENTP2, 68 - sctlr_el2); 69 - 70 66 write_sysreg(val, cpacr_el1); 71 67 72 68 write_sysreg(__this_cpu_read(kvm_hyp_vector), vbar_el1); ··· 83 87 * the host. 84 88 */ 85 89 asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT)); 86 - 87 - if (cpus_have_final_cap(ARM64_SME)) 88 - write_sysreg(read_sysreg(sctlr_el2) | SCTLR_ELx_ENTP2, 89 - sctlr_el2); 90 90 91 91 write_sysreg(CPACR_EL1_DEFAULT, cpacr_el1); 92 92
+4
arch/arm64/mm/fault.c
··· 30 30 #include <asm/bug.h> 31 31 #include <asm/cmpxchg.h> 32 32 #include <asm/cpufeature.h> 33 + #include <asm/efi.h> 33 34 #include <asm/exception.h> 34 35 #include <asm/daifflags.h> 35 36 #include <asm/debug-monitors.h> ··· 391 390 392 391 msg = "paging request"; 393 392 } 393 + 394 + if (efi_runtime_fixup_exception(regs, msg)) 395 + return; 394 396 395 397 die_kernel_fault(msg, addr, esr, regs); 396 398 }
+19 -8
arch/x86/coco/tdx/tdx.c
··· 34 34 #define VE_GET_PORT_NUM(e) ((e) >> 16) 35 35 #define VE_IS_IO_STRING(e) ((e) & BIT(4)) 36 36 37 + #define ATTR_SEPT_VE_DISABLE BIT(28) 38 + 37 39 /* 38 40 * Wrapper for standard use of __tdx_hypercall with no output aside from 39 41 * return code. ··· 100 98 panic("TDCALL %lld failed (Buggy TDX module!)\n", fn); 101 99 } 102 100 103 - static u64 get_cc_mask(void) 101 + static void tdx_parse_tdinfo(u64 *cc_mask) 104 102 { 105 103 struct tdx_module_output out; 106 104 unsigned int gpa_width; 105 + u64 td_attr; 107 106 108 107 /* 109 108 * TDINFO TDX module call is used to get the TD execution environment ··· 112 109 * information, etc. More details about the ABI can be found in TDX 113 110 * Guest-Host-Communication Interface (GHCI), section 2.4.2 TDCALL 114 111 * [TDG.VP.INFO]. 115 - * 116 - * The GPA width that comes out of this call is critical. TDX guests 117 - * can not meaningfully run without it. 118 112 */ 119 113 tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out); 120 - 121 - gpa_width = out.rcx & GENMASK(5, 0); 122 114 123 115 /* 124 116 * The highest bit of a guest physical address is the "sharing" bit. 125 117 * Set it for shared pages and clear it for private pages. 118 + * 119 + * The GPA width that comes out of this call is critical. TDX guests 120 + * can not meaningfully run without it. 126 121 */ 127 - return BIT_ULL(gpa_width - 1); 122 + gpa_width = out.rcx & GENMASK(5, 0); 123 + *cc_mask = BIT_ULL(gpa_width - 1); 124 + 125 + /* 126 + * The kernel can not handle #VE's when accessing normal kernel 127 + * memory. Ensure that no #VE will be delivered for accesses to 128 + * TD-private memory. Only VMM-shared memory (MMIO) will #VE. 129 + */ 130 + td_attr = out.rdx; 131 + if (!(td_attr & ATTR_SEPT_VE_DISABLE)) 132 + panic("TD misconfiguration: SEPT_VE_DISABLE attibute must be set.\n"); 128 133 } 129 134 130 135 /* ··· 769 758 setup_force_cpu_cap(X86_FEATURE_TDX_GUEST); 770 759 771 760 cc_set_vendor(CC_VENDOR_INTEL); 772 - cc_mask = get_cc_mask(); 761 + tdx_parse_tdinfo(&cc_mask); 773 762 cc_set_mask(cc_mask); 774 763 775 764 /*
+1
arch/x86/events/intel/core.c
··· 4911 4911 INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 5, 0x00000000), 4912 4912 INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 6, 0x00000000), 4913 4913 INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 7, 0x00000000), 4914 + INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 11, 0x00000000), 4914 4915 INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_L, 3, 0x0000007c), 4915 4916 INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE, 3, 0x0000007c), 4916 4917 INTEL_CPU_DESC(INTEL_FAM6_KABYLAKE, 9, 0x0000004e),
+14 -4
arch/x86/events/intel/ds.c
··· 982 982 INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), /* SLOTS */ 983 983 984 984 INTEL_PLD_CONSTRAINT(0x1cd, 0xff), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ 985 - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), /* MEM_INST_RETIRED.LOAD */ 986 - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x2d0, 0xf), /* MEM_INST_RETIRED.STORE */ 985 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ 986 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ 987 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ 988 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ 989 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ 990 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ 991 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ 987 992 988 993 INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), /* MEM_LOAD_*_RETIRED.* */ 989 994 ··· 1009 1004 INTEL_FLAGS_EVENT_CONSTRAINT(0xc0, 0xfe), 1010 1005 INTEL_PLD_CONSTRAINT(0x1cd, 0xfe), 1011 1006 INTEL_PSD_CONSTRAINT(0x2cd, 0x1), 1012 - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), 1013 - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x2d0, 0xf), 1007 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ 1008 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ 1009 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ 1010 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ 1011 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ 1012 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ 1013 + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ 1014 1014 1015 1015 INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), 1016 1016
+1 -5
arch/x86/events/rapl.c
··· 619 619 case RAPL_UNIT_QUIRK_INTEL_HSW: 620 620 rapl_hw_unit[PERF_RAPL_RAM] = 16; 621 621 break; 622 - /* 623 - * SPR shares the same DRAM domain energy unit as HSW, plus it 624 - * also has a fixed energy unit for Psys domain. 625 - */ 622 + /* SPR uses a fixed energy unit for Psys domain. */ 626 623 case RAPL_UNIT_QUIRK_INTEL_SPR: 627 - rapl_hw_unit[PERF_RAPL_RAM] = 16; 628 624 rapl_hw_unit[PERF_RAPL_PSYS] = 0; 629 625 break; 630 626 default:
+10 -1
arch/x86/include/asm/intel-family.h
··· 107 107 108 108 #define INTEL_FAM6_SAPPHIRERAPIDS_X 0x8F /* Golden Cove */ 109 109 110 + #define INTEL_FAM6_EMERALDRAPIDS_X 0xCF 111 + 112 + #define INTEL_FAM6_GRANITERAPIDS_X 0xAD 113 + #define INTEL_FAM6_GRANITERAPIDS_D 0xAE 114 + 110 115 #define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */ 111 116 #define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */ 112 117 #define INTEL_FAM6_ALDERLAKE_N 0xBE ··· 123 118 #define INTEL_FAM6_METEORLAKE 0xAC 124 119 #define INTEL_FAM6_METEORLAKE_L 0xAA 125 120 126 - /* "Small Core" Processors (Atom) */ 121 + /* "Small Core" Processors (Atom/E-Core) */ 127 122 128 123 #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */ 129 124 #define INTEL_FAM6_ATOM_BONNELL_MID 0x26 /* Silverthorne, Lincroft */ ··· 149 144 #define INTEL_FAM6_ATOM_TREMONT_D 0x86 /* Jacobsville */ 150 145 #define INTEL_FAM6_ATOM_TREMONT 0x96 /* Elkhart Lake */ 151 146 #define INTEL_FAM6_ATOM_TREMONT_L 0x9C /* Jasper Lake */ 147 + 148 + #define INTEL_FAM6_SIERRAFOREST_X 0xAF 149 + 150 + #define INTEL_FAM6_GRANDRIDGE 0xB6 152 151 153 152 /* Xeon Phi */ 154 153
+1 -1
arch/x86/include/asm/syscall_wrapper.h
··· 6 6 #ifndef _ASM_X86_SYSCALL_WRAPPER_H 7 7 #define _ASM_X86_SYSCALL_WRAPPER_H 8 8 9 - struct pt_regs; 9 + #include <asm/ptrace.h> 10 10 11 11 extern long __x64_sys_ni_syscall(const struct pt_regs *regs); 12 12 extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);
+1 -1
arch/x86/kvm/cpuid.c
··· 1338 1338 if (sanity_check_entries(entries, cpuid->nent, type)) 1339 1339 return -EINVAL; 1340 1340 1341 - array.entries = kvcalloc(sizeof(struct kvm_cpuid_entry2), cpuid->nent, GFP_KERNEL); 1341 + array.entries = kvcalloc(cpuid->nent, sizeof(struct kvm_cpuid_entry2), GFP_KERNEL); 1342 1342 if (!array.entries) 1343 1343 return -ENOMEM; 1344 1344
+3 -16
arch/x86/kvm/vmx/capabilities.h
··· 24 24 #define PMU_CAP_FW_WRITES (1ULL << 13) 25 25 #define PMU_CAP_LBR_FMT 0x3f 26 26 27 - #define DEBUGCTLMSR_LBR_MASK (DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI) 28 - 29 27 struct nested_vmx_msrs { 30 28 /* 31 29 * We only store the "true" versions of the VMX capability MSRs. We ··· 398 400 static inline u64 vmx_get_perf_capabilities(void) 399 401 { 400 402 u64 perf_cap = PMU_CAP_FW_WRITES; 403 + struct x86_pmu_lbr lbr; 401 404 u64 host_perf_cap = 0; 402 405 403 406 if (!enable_pmu) ··· 407 408 if (boot_cpu_has(X86_FEATURE_PDCM)) 408 409 rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap); 409 410 410 - perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT; 411 + if (x86_perf_get_lbr(&lbr) >= 0 && lbr.nr) 412 + perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT; 411 413 412 414 if (vmx_pebs_supported()) { 413 415 perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK; ··· 417 417 } 418 418 419 419 return perf_cap; 420 - } 421 - 422 - static inline u64 vmx_supported_debugctl(void) 423 - { 424 - u64 debugctl = 0; 425 - 426 - if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) 427 - debugctl |= DEBUGCTLMSR_BUS_LOCK_DETECT; 428 - 429 - if (vmx_get_perf_capabilities() & PMU_CAP_LBR_FMT) 430 - debugctl |= DEBUGCTLMSR_LBR_MASK; 431 - 432 - return debugctl; 433 420 } 434 421 435 422 static inline bool cpu_has_notify_vmexit(void)
+11 -7
arch/x86/kvm/vmx/vmx.c
··· 2021 2021 return (unsigned long)data; 2022 2022 } 2023 2023 2024 - static u64 vcpu_supported_debugctl(struct kvm_vcpu *vcpu) 2024 + static u64 vmx_get_supported_debugctl(struct kvm_vcpu *vcpu, bool host_initiated) 2025 2025 { 2026 - u64 debugctl = vmx_supported_debugctl(); 2026 + u64 debugctl = 0; 2027 2027 2028 - if (!intel_pmu_lbr_is_enabled(vcpu)) 2029 - debugctl &= ~DEBUGCTLMSR_LBR_MASK; 2028 + if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT) && 2029 + (host_initiated || guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT))) 2030 + debugctl |= DEBUGCTLMSR_BUS_LOCK_DETECT; 2030 2031 2031 - if (!guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT)) 2032 - debugctl &= ~DEBUGCTLMSR_BUS_LOCK_DETECT; 2032 + if ((vmx_get_perf_capabilities() & PMU_CAP_LBR_FMT) && 2033 + (host_initiated || intel_pmu_lbr_is_enabled(vcpu))) 2034 + debugctl |= DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI; 2033 2035 2034 2036 return debugctl; 2035 2037 } ··· 2105 2103 vmcs_writel(GUEST_SYSENTER_ESP, data); 2106 2104 break; 2107 2105 case MSR_IA32_DEBUGCTLMSR: { 2108 - u64 invalid = data & ~vcpu_supported_debugctl(vcpu); 2106 + u64 invalid; 2107 + 2108 + invalid = data & ~vmx_get_supported_debugctl(vcpu, msr_info->host_initiated); 2109 2109 if (invalid & (DEBUGCTLMSR_BTF|DEBUGCTLMSR_LBR)) { 2110 2110 if (report_ignored_msrs) 2111 2111 vcpu_unimpl(vcpu, "%s: BTF|LBR in IA32_DEBUGCTLMSR 0x%llx, nop\n",
+3
arch/x86/kvm/x86.c
··· 10404 10404 kvm->arch.apicv_inhibit_reasons = new; 10405 10405 if (new) { 10406 10406 unsigned long gfn = gpa_to_gfn(APIC_DEFAULT_PHYS_BASE); 10407 + int idx = srcu_read_lock(&kvm->srcu); 10408 + 10407 10409 kvm_zap_gfn_range(kvm, gfn, gfn+1); 10410 + srcu_read_unlock(&kvm->srcu, idx); 10408 10411 } 10409 10412 } else { 10410 10413 kvm->arch.apicv_inhibit_reasons = new;
+1 -1
arch/x86/xen/pmu.c
··· 302 302 static bool pmu_msr_chk_emulated(unsigned int msr, uint64_t *val, bool is_read, 303 303 bool *emul) 304 304 { 305 - int type, index; 305 + int type, index = 0; 306 306 307 307 if (is_amd_pmu_msr(msr)) 308 308 *emul = xen_amd_pmu_emulate(msr, val, is_read);
+6 -17
arch/x86/xen/setup.c
··· 910 910 911 911 void xen_enable_sysenter(void) 912 912 { 913 - int ret; 914 - unsigned sysenter_feature; 915 - 916 - sysenter_feature = X86_FEATURE_SYSENTER32; 917 - 918 - if (!boot_cpu_has(sysenter_feature)) 919 - return; 920 - 921 - ret = register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat); 922 - if(ret != 0) 923 - setup_clear_cpu_cap(sysenter_feature); 913 + if (cpu_feature_enabled(X86_FEATURE_SYSENTER32) && 914 + register_callback(CALLBACKTYPE_sysenter, xen_entry_SYSENTER_compat)) 915 + setup_clear_cpu_cap(X86_FEATURE_SYSENTER32); 924 916 } 925 917 926 918 void xen_enable_syscall(void) ··· 926 934 mechanism for syscalls. */ 927 935 } 928 936 929 - if (boot_cpu_has(X86_FEATURE_SYSCALL32)) { 930 - ret = register_callback(CALLBACKTYPE_syscall32, 931 - xen_entry_SYSCALL_compat); 932 - if (ret != 0) 933 - setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); 934 - } 937 + if (cpu_feature_enabled(X86_FEATURE_SYSCALL32) && 938 + register_callback(CALLBACKTYPE_syscall32, xen_entry_SYSCALL_compat)) 939 + setup_clear_cpu_cap(X86_FEATURE_SYSCALL32); 935 940 } 936 941 937 942 static void __init xen_pvmmu_arch_setup(void)
+2 -3
block/blk-mq.c
··· 1262 1262 (!blk_queue_nomerges(rq->q) && 1263 1263 blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) { 1264 1264 blk_mq_flush_plug_list(plug, false); 1265 + last = NULL; 1265 1266 trace_block_plug(rq->q); 1266 1267 } 1267 1268 ··· 4194 4193 return 0; 4195 4194 4196 4195 err_hctxs: 4197 - xa_destroy(&q->hctx_table); 4198 - q->nr_hw_queues = 0; 4199 - blk_mq_sysfs_deinit(q); 4196 + blk_mq_release(q); 4200 4197 err_poll: 4201 4198 blk_stat_free_callback(q->poll_cb); 4202 4199 q->poll_cb = NULL;
+1
block/genhd.c
··· 527 527 bdi_unregister(disk->bdi); 528 528 out_unregister_queue: 529 529 blk_unregister_queue(disk); 530 + rq_qos_exit(disk->queue); 530 531 out_put_slave_dir: 531 532 kobject_put(disk->slave_dir); 532 533 out_put_holder_dir:
+1
drivers/acpi/numa/srat.c
··· 327 327 pr_warn("ACPI NUMA: Failed to add memblk for CFMWS node %d [mem %#llx-%#llx]\n", 328 328 node, start, end); 329 329 } 330 + node_set(node, numa_nodes_parsed); 330 331 331 332 /* Set the next available fake_pxm value */ 332 333 (*fake_pxm)++;
+32 -9
drivers/acpi/video_detect.c
··· 646 646 }, 647 647 648 648 /* 649 + * Models which have nvidia-ec-wmi support, but should not use it. 650 + * Note this indicates a likely firmware bug on these models and should 651 + * be revisited if/when Linux gets support for dynamic mux mode. 652 + */ 653 + { 654 + .callback = video_detect_force_native, 655 + /* Dell G15 5515 */ 656 + .matches = { 657 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 658 + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), 659 + }, 660 + }, 661 + 662 + /* 649 663 * Desktops which falsely report a backlight and which our heuristics 650 664 * for this do not catch. 651 665 */ ··· 684 670 685 671 static bool google_cros_ec_present(void) 686 672 { 687 - return acpi_dev_found("GOOG0004"); 673 + return acpi_dev_found("GOOG0004") || acpi_dev_found("GOOG000C"); 688 674 } 689 675 690 676 /* ··· 732 718 if (apple_gmux_present()) 733 719 return acpi_backlight_apple_gmux; 734 720 721 + /* Chromebooks should always prefer native backlight control. */ 722 + if (google_cros_ec_present() && native_available) 723 + return acpi_backlight_native; 724 + 735 725 /* On systems with ACPI video use either native or ACPI video. */ 736 726 if (video_caps & ACPI_VIDEO_BACKLIGHT) { 737 727 /* ··· 753 735 return acpi_backlight_video; 754 736 } 755 737 756 - /* 757 - * Chromebooks that don't have backlight handle in ACPI table 758 - * are supposed to use native backlight if it's available. 759 - */ 760 - if (google_cros_ec_present() && native_available) 761 - return acpi_backlight_native; 762 - 763 738 /* No ACPI video (old hw), use vendor specific fw methods. */ 764 739 return acpi_backlight_vendor; 765 740 } ··· 765 754 766 755 bool acpi_video_backlight_use_native(void) 767 756 { 768 - return __acpi_video_get_backlight_type(true) == acpi_backlight_native; 757 + /* 758 + * Call __acpi_video_get_backlight_type() to let it know that 759 + * a native backlight is available. 760 + */ 761 + __acpi_video_get_backlight_type(true); 762 + 763 + /* 764 + * For now just always return true. There is a whole bunch of laptop 765 + * models where (video_caps & ACPI_VIDEO_BACKLIGHT) is false causing 766 + * __acpi_video_get_backlight_type() to return vendor, while these 767 + * models only have a native backlight control. 768 + */ 769 + return true; 769 770 } 770 771 EXPORT_SYMBOL(acpi_video_backlight_use_native);
+6
drivers/acpi/x86/utils.c
··· 219 219 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"), 220 220 } 221 221 }, 222 + { 223 + .matches = { 224 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 225 + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 16 5625"), 226 + } 227 + }, 222 228 {} 223 229 }; 224 230
+3 -2
drivers/ata/pata_legacy.c
··· 315 315 outb(inb(0x1F4) & 0x07, 0x1F4); 316 316 317 317 rt = inb(0x1F3); 318 - rt &= 0x07 << (3 * adev->devno); 318 + rt &= ~(0x07 << (3 * !adev->devno)); 319 319 if (pio) 320 - rt |= (1 + 3 * pio) << (3 * adev->devno); 320 + rt |= (1 + 3 * pio) << (3 * !adev->devno); 321 + outb(rt, 0x1F3); 321 322 322 323 udelay(100); 323 324 outb(inb(0x1F2) | 0x01, 0x1F2);
+2 -2
drivers/ata/pata_palmld.c
··· 63 63 64 64 /* remap drive's physical memory address */ 65 65 mem = devm_platform_ioremap_resource(pdev, 0); 66 - if (!mem) 67 - return -ENOMEM; 66 + if (IS_ERR(mem)) 67 + return PTR_ERR(mem); 68 68 69 69 /* request and activate power and reset GPIOs */ 70 70 lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
+6
drivers/block/Kconfig
··· 408 408 definition isn't finalized yet, and might change according to future 409 409 requirement, so mark is as experimental now. 410 410 411 + Say Y if you want to get better performance because task_work_add() 412 + can be used in IO path for replacing io_uring cmd, which will become 413 + shared between IO tasks and ubq daemon, meantime task_work_add() can 414 + can handle batch more effectively, but task_work_add() isn't exported 415 + for module, so ublk has to be built to kernel. 416 + 411 417 source "drivers/block/rnbd/Kconfig" 412 418 413 419 endif # BLK_DEV
+68 -47
drivers/block/ublk_drv.c
··· 57 57 #define UBLK_PARAM_TYPE_ALL (UBLK_PARAM_TYPE_BASIC | UBLK_PARAM_TYPE_DISCARD) 58 58 59 59 struct ublk_rq_data { 60 - struct callback_head work; 60 + union { 61 + struct callback_head work; 62 + struct llist_node node; 63 + }; 61 64 }; 62 65 63 66 struct ublk_uring_cmd_pdu { 64 - struct request *req; 67 + struct ublk_queue *ubq; 65 68 }; 66 69 67 70 /* ··· 121 118 unsigned long flags; 122 119 struct task_struct *ubq_daemon; 123 120 char *io_cmd_buf; 121 + 122 + struct llist_head io_cmds; 124 123 125 124 unsigned long io_addr; /* mapped vm address */ 126 125 unsigned int max_io_sz; ··· 769 764 static void ublk_rq_task_work_cb(struct io_uring_cmd *cmd) 770 765 { 771 766 struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); 767 + struct ublk_queue *ubq = pdu->ubq; 768 + struct llist_node *io_cmds = llist_del_all(&ubq->io_cmds); 769 + struct ublk_rq_data *data; 772 770 773 - __ublk_rq_task_work(pdu->req); 771 + llist_for_each_entry(data, io_cmds, node) 772 + __ublk_rq_task_work(blk_mq_rq_from_pdu(data)); 774 773 } 775 774 776 775 static void ublk_rq_task_work_fn(struct callback_head *work) ··· 784 775 struct request *req = blk_mq_rq_from_pdu(data); 785 776 786 777 __ublk_rq_task_work(req); 778 + } 779 + 780 + static void ublk_submit_cmd(struct ublk_queue *ubq, const struct request *rq) 781 + { 782 + struct ublk_io *io = &ubq->ios[rq->tag]; 783 + 784 + /* 785 + * If the check pass, we know that this is a re-issued request aborted 786 + * previously in monitor_work because the ubq_daemon(cmd's task) is 787 + * PF_EXITING. We cannot call io_uring_cmd_complete_in_task() anymore 788 + * because this ioucmd's io_uring context may be freed now if no inflight 789 + * ioucmd exists. Otherwise we may cause null-deref in ctx->fallback_work. 790 + * 791 + * Note: monitor_work sets UBLK_IO_FLAG_ABORTED and ends this request(releasing 792 + * the tag). Then the request is re-started(allocating the tag) and we are here. 793 + * Since releasing/allocating a tag implies smp_mb(), finding UBLK_IO_FLAG_ABORTED 794 + * guarantees that here is a re-issued request aborted previously. 795 + */ 796 + if (unlikely(io->flags & UBLK_IO_FLAG_ABORTED)) { 797 + struct llist_node *io_cmds = llist_del_all(&ubq->io_cmds); 798 + struct ublk_rq_data *data; 799 + 800 + llist_for_each_entry(data, io_cmds, node) 801 + __ublk_abort_rq(ubq, blk_mq_rq_from_pdu(data)); 802 + } else { 803 + struct io_uring_cmd *cmd = io->cmd; 804 + struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); 805 + 806 + pdu->ubq = ubq; 807 + io_uring_cmd_complete_in_task(cmd, ublk_rq_task_work_cb); 808 + } 809 + } 810 + 811 + static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq, 812 + bool last) 813 + { 814 + struct ublk_rq_data *data = blk_mq_rq_to_pdu(rq); 815 + 816 + if (ublk_can_use_task_work(ubq)) { 817 + enum task_work_notify_mode notify_mode = last ? 818 + TWA_SIGNAL_NO_IPI : TWA_NONE; 819 + 820 + if (task_work_add(ubq->ubq_daemon, &data->work, notify_mode)) 821 + __ublk_abort_rq(ubq, rq); 822 + } else { 823 + if (llist_add(&data->node, &ubq->io_cmds)) 824 + ublk_submit_cmd(ubq, rq); 825 + } 787 826 } 788 827 789 828 static blk_status_t ublk_queue_rq(struct blk_mq_hw_ctx *hctx, ··· 845 788 res = ublk_setup_iod(ubq, rq); 846 789 if (unlikely(res != BLK_STS_OK)) 847 790 return BLK_STS_IOERR; 791 + 848 792 /* With recovery feature enabled, force_abort is set in 849 793 * ublk_stop_dev() before calling del_gendisk(). We have to 850 794 * abort all requeued and new rqs here to let del_gendisk() ··· 861 803 blk_mq_start_request(bd->rq); 862 804 863 805 if (unlikely(ubq_daemon_is_dying(ubq))) { 864 - fail: 865 806 __ublk_abort_rq(ubq, rq); 866 807 return BLK_STS_OK; 867 808 } 868 809 869 - if (ublk_can_use_task_work(ubq)) { 870 - struct ublk_rq_data *data = blk_mq_rq_to_pdu(rq); 871 - enum task_work_notify_mode notify_mode = bd->last ? 872 - TWA_SIGNAL_NO_IPI : TWA_NONE; 873 - 874 - if (task_work_add(ubq->ubq_daemon, &data->work, notify_mode)) 875 - goto fail; 876 - } else { 877 - struct ublk_io *io = &ubq->ios[rq->tag]; 878 - struct io_uring_cmd *cmd = io->cmd; 879 - struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); 880 - 881 - /* 882 - * If the check pass, we know that this is a re-issued request aborted 883 - * previously in monitor_work because the ubq_daemon(cmd's task) is 884 - * PF_EXITING. We cannot call io_uring_cmd_complete_in_task() anymore 885 - * because this ioucmd's io_uring context may be freed now if no inflight 886 - * ioucmd exists. Otherwise we may cause null-deref in ctx->fallback_work. 887 - * 888 - * Note: monitor_work sets UBLK_IO_FLAG_ABORTED and ends this request(releasing 889 - * the tag). Then the request is re-started(allocating the tag) and we are here. 890 - * Since releasing/allocating a tag implies smp_mb(), finding UBLK_IO_FLAG_ABORTED 891 - * guarantees that here is a re-issued request aborted previously. 892 - */ 893 - if ((io->flags & UBLK_IO_FLAG_ABORTED)) 894 - goto fail; 895 - 896 - pdu->req = rq; 897 - io_uring_cmd_complete_in_task(cmd, ublk_rq_task_work_cb); 898 - } 810 + ublk_queue_cmd(ubq, rq, bd->last); 899 811 900 812 return BLK_STS_OK; 901 813 } ··· 1192 1164 } 1193 1165 1194 1166 static void ublk_handle_need_get_data(struct ublk_device *ub, int q_id, 1195 - int tag, struct io_uring_cmd *cmd) 1167 + int tag) 1196 1168 { 1197 1169 struct ublk_queue *ubq = ublk_get_queue(ub, q_id); 1198 1170 struct request *req = blk_mq_tag_to_rq(ub->tag_set.tags[q_id], tag); 1199 1171 1200 - if (ublk_can_use_task_work(ubq)) { 1201 - struct ublk_rq_data *data = blk_mq_rq_to_pdu(req); 1202 - 1203 - /* should not fail since we call it just in ubq->ubq_daemon */ 1204 - task_work_add(ubq->ubq_daemon, &data->work, TWA_SIGNAL_NO_IPI); 1205 - } else { 1206 - struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); 1207 - 1208 - pdu->req = req; 1209 - io_uring_cmd_complete_in_task(cmd, ublk_rq_task_work_cb); 1210 - } 1172 + ublk_queue_cmd(ubq, req, true); 1211 1173 } 1212 1174 1213 1175 static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) ··· 1285 1267 io->addr = ub_cmd->addr; 1286 1268 io->cmd = cmd; 1287 1269 io->flags |= UBLK_IO_FLAG_ACTIVE; 1288 - ublk_handle_need_get_data(ub, ub_cmd->q_id, ub_cmd->tag, cmd); 1270 + ublk_handle_need_get_data(ub, ub_cmd->q_id, ub_cmd->tag); 1289 1271 break; 1290 1272 default: 1291 1273 goto out; ··· 1675 1657 * (features) to handle. 1676 1658 */ 1677 1659 ub->dev_info.flags &= UBLK_F_ALL; 1660 + 1661 + if (!IS_BUILTIN(CONFIG_BLK_DEV_UBLK)) 1662 + ub->dev_info.flags |= UBLK_F_URING_CMD_COMP_IN_TASK; 1678 1663 1679 1664 /* We are not ready to support zero copy */ 1680 1665 ub->dev_info.flags &= ~UBLK_F_SUPPORT_ZERO_COPY;
+62 -3
drivers/clk/clk-renesas-pcie.c
··· 90 90 .n_yes_ranges = ARRAY_SIZE(rs9_writeable_ranges), 91 91 }; 92 92 93 + static int rs9_regmap_i2c_write(void *context, 94 + unsigned int reg, unsigned int val) 95 + { 96 + struct i2c_client *i2c = context; 97 + const u8 data[3] = { reg, 1, val }; 98 + const int count = ARRAY_SIZE(data); 99 + int ret; 100 + 101 + ret = i2c_master_send(i2c, data, count); 102 + if (ret == count) 103 + return 0; 104 + else if (ret < 0) 105 + return ret; 106 + else 107 + return -EIO; 108 + } 109 + 110 + static int rs9_regmap_i2c_read(void *context, 111 + unsigned int reg, unsigned int *val) 112 + { 113 + struct i2c_client *i2c = context; 114 + struct i2c_msg xfer[2]; 115 + u8 txdata = reg; 116 + u8 rxdata[2]; 117 + int ret; 118 + 119 + xfer[0].addr = i2c->addr; 120 + xfer[0].flags = 0; 121 + xfer[0].len = 1; 122 + xfer[0].buf = (void *)&txdata; 123 + 124 + xfer[1].addr = i2c->addr; 125 + xfer[1].flags = I2C_M_RD; 126 + xfer[1].len = 2; 127 + xfer[1].buf = (void *)rxdata; 128 + 129 + ret = i2c_transfer(i2c->adapter, xfer, 2); 130 + if (ret < 0) 131 + return ret; 132 + if (ret != 2) 133 + return -EIO; 134 + 135 + /* 136 + * Byte 0 is transfer length, which is always 1 due 137 + * to BCP register programming to 1 in rs9_probe(), 138 + * ignore it and use data from Byte 1. 139 + */ 140 + *val = rxdata[1]; 141 + return 0; 142 + } 143 + 93 144 static const struct regmap_config rs9_regmap_config = { 94 145 .reg_bits = 8, 95 146 .val_bits = 8, 96 - .cache_type = REGCACHE_FLAT, 97 - .max_register = 0x8, 147 + .cache_type = REGCACHE_NONE, 148 + .max_register = RS9_REG_BCP, 98 149 .rd_table = &rs9_readable_table, 99 150 .wr_table = &rs9_writeable_table, 151 + .reg_write = rs9_regmap_i2c_write, 152 + .reg_read = rs9_regmap_i2c_read, 100 153 }; 101 154 102 155 static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx) ··· 295 242 return ret; 296 243 } 297 244 298 - rs9->regmap = devm_regmap_init_i2c(client, &rs9_regmap_config); 245 + rs9->regmap = devm_regmap_init(&client->dev, NULL, 246 + client, &rs9_regmap_config); 299 247 if (IS_ERR(rs9->regmap)) 300 248 return dev_err_probe(&client->dev, PTR_ERR(rs9->regmap), 301 249 "Failed to allocate register map\n"); 250 + 251 + /* Always read back 1 Byte via I2C */ 252 + ret = regmap_write(rs9->regmap, RS9_REG_BCP, 1); 253 + if (ret < 0) 254 + return ret; 302 255 303 256 /* Register clock */ 304 257 for (i = 0; i < rs9->chip_info->num_clks; i++) {
+5 -1
drivers/clk/clk.c
··· 1459 1459 { 1460 1460 struct clk_core *parent; 1461 1461 1462 - if (WARN_ON(!core || !req)) 1462 + if (WARN_ON(!req)) 1463 1463 return; 1464 1464 1465 1465 memset(req, 0, sizeof(*req)); 1466 + req->max_rate = ULONG_MAX; 1467 + 1468 + if (!core) 1469 + return; 1466 1470 1467 1471 req->rate = rate; 1468 1472 clk_core_get_boundaries(core, &req->min_rate, &req->max_rate);
+3 -1
drivers/clk/mediatek/clk-mt8195-topckgen.c
··· 1270 1270 hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref", mfg_fast_parents, 1271 1271 ARRAY_SIZE(mfg_fast_parents), CLK_SET_RATE_PARENT, 1272 1272 (base + 0x250), 8, 1, 0, &mt8195_clk_lock); 1273 - if (IS_ERR(hw)) 1273 + if (IS_ERR(hw)) { 1274 + r = PTR_ERR(hw); 1274 1275 goto unregister_muxes; 1276 + } 1275 1277 top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw; 1276 1278 1277 1279 r = clk_mt8195_reg_mfg_mux_notifier(&pdev->dev,
+1
drivers/clk/qcom/gcc-sc7280.c
··· 3467 3467 regmap_update_bits(regmap, 0x28004, BIT(0), BIT(0)); 3468 3468 regmap_update_bits(regmap, 0x28014, BIT(0), BIT(0)); 3469 3469 regmap_update_bits(regmap, 0x71004, BIT(0), BIT(0)); 3470 + regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13)); 3470 3471 3471 3472 ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, 3472 3473 ARRAY_SIZE(gcc_dfs_clocks));
+1
drivers/clk/qcom/gpucc-sc7280.c
··· 463 463 */ 464 464 regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0)); 465 465 regmap_update_bits(regmap, 0x1098, BIT(0), BIT(0)); 466 + regmap_update_bits(regmap, 0x1098, BIT(13), BIT(13)); 466 467 467 468 return qcom_cc_really_probe(pdev, &gpu_cc_sc7280_desc, regmap); 468 469 }
+9 -4
drivers/clk/renesas/r8a779g0-cpg-mssr.c
··· 47 47 CLK_S0_VIO, 48 48 CLK_S0_VC, 49 49 CLK_S0_HSC, 50 + CLK_SASYNCPER, 50 51 CLK_SV_VIP, 51 52 CLK_SV_IR, 52 53 CLK_SDSRC, ··· 85 84 DEF_FIXED(".s0_vio", CLK_S0_VIO, CLK_PLL1_DIV2, 2, 1), 86 85 DEF_FIXED(".s0_vc", CLK_S0_VC, CLK_PLL1_DIV2, 2, 1), 87 86 DEF_FIXED(".s0_hsc", CLK_S0_HSC, CLK_PLL1_DIV2, 2, 1), 87 + DEF_FIXED(".sasyncper", CLK_SASYNCPER, CLK_PLL5_DIV4, 3, 1), 88 88 DEF_FIXED(".sv_vip", CLK_SV_VIP, CLK_PLL1, 5, 1), 89 89 DEF_FIXED(".sv_ir", CLK_SV_IR, CLK_PLL1, 5, 1), 90 90 DEF_BASE(".sdsrc", CLK_SDSRC, CLK_TYPE_GEN4_SDSRC, CLK_PLL5), ··· 130 128 DEF_FIXED("s0d4_hsc", R8A779G0_CLK_S0D4_HSC, CLK_S0_HSC, 4, 1), 131 129 DEF_FIXED("cl16m_hsc", R8A779G0_CLK_CL16M_HSC, CLK_S0_HSC, 48, 1), 132 130 DEF_FIXED("s0d2_cc", R8A779G0_CLK_S0D2_CC, CLK_S0, 2, 1), 131 + DEF_FIXED("sasyncperd1",R8A779G0_CLK_SASYNCPERD1, CLK_SASYNCPER,1, 1), 132 + DEF_FIXED("sasyncperd2",R8A779G0_CLK_SASYNCPERD2, CLK_SASYNCPER,2, 1), 133 + DEF_FIXED("sasyncperd4",R8A779G0_CLK_SASYNCPERD4, CLK_SASYNCPER,4, 1), 133 134 DEF_FIXED("svd1_ir", R8A779G0_CLK_SVD1_IR, CLK_SV_IR, 1, 1), 134 135 DEF_FIXED("svd2_ir", R8A779G0_CLK_SVD2_IR, CLK_SV_IR, 2, 1), 135 136 DEF_FIXED("svd1_vip", R8A779G0_CLK_SVD1_VIP, CLK_SV_VIP, 1, 1), ··· 158 153 DEF_MOD("avb0", 211, R8A779G0_CLK_S0D4_HSC), 159 154 DEF_MOD("avb1", 212, R8A779G0_CLK_S0D4_HSC), 160 155 DEF_MOD("avb2", 213, R8A779G0_CLK_S0D4_HSC), 161 - DEF_MOD("hscif0", 514, R8A779G0_CLK_S0D3_PER), 162 - DEF_MOD("hscif1", 515, R8A779G0_CLK_S0D3_PER), 163 - DEF_MOD("hscif2", 516, R8A779G0_CLK_S0D3_PER), 164 - DEF_MOD("hscif3", 517, R8A779G0_CLK_S0D3_PER), 156 + DEF_MOD("hscif0", 514, R8A779G0_CLK_SASYNCPERD1), 157 + DEF_MOD("hscif1", 515, R8A779G0_CLK_SASYNCPERD1), 158 + DEF_MOD("hscif2", 516, R8A779G0_CLK_SASYNCPERD1), 159 + DEF_MOD("hscif3", 517, R8A779G0_CLK_SASYNCPERD1), 165 160 DEF_MOD("i2c0", 518, R8A779G0_CLK_S0D6_PER), 166 161 DEF_MOD("i2c1", 519, R8A779G0_CLK_S0D6_PER), 167 162 DEF_MOD("i2c2", 520, R8A779G0_CLK_S0D6_PER),
+3 -1
drivers/clk/sifive/Kconfig
··· 2 2 3 3 menuconfig CLK_SIFIVE 4 4 bool "SiFive SoC driver support" 5 - depends on RISCV || COMPILE_TEST 5 + depends on SOC_SIFIVE || COMPILE_TEST 6 + default SOC_SIFIVE 6 7 help 7 8 SoC drivers for SiFive Linux-capable SoCs. 8 9 ··· 11 10 12 11 config CLK_SIFIVE_PRCI 13 12 bool "PRCI driver for SiFive SoCs" 13 + default SOC_SIFIVE 14 14 select RESET_CONTROLLER 15 15 select RESET_SIMPLE 16 16 select CLK_ANALOGBITS_WRPLL_CLN28HPC
+1 -1
drivers/cxl/core/mbox.c
··· 174 174 }; 175 175 int rc; 176 176 177 - if (out_size > cxlds->payload_size) 177 + if (in_size > cxlds->payload_size || out_size > cxlds->payload_size) 178 178 return -E2BIG; 179 179 180 180 rc = cxlds->mbox_send(cxlds, &mbox_cmd);
+2
drivers/cxl/core/pmem.c
··· 188 188 { 189 189 struct cxl_nvdimm *cxl_nvd = to_cxl_nvdimm(dev); 190 190 191 + xa_destroy(&cxl_nvd->pmem_regions); 191 192 kfree(cxl_nvd); 192 193 } 193 194 ··· 231 230 232 231 dev = &cxl_nvd->dev; 233 232 cxl_nvd->cxlmd = cxlmd; 233 + xa_init(&cxl_nvd->pmem_regions); 234 234 device_initialize(dev); 235 235 lockdep_set_class(&dev->mutex, &cxl_nvdimm_key); 236 236 device_set_pm_not_required(dev);
+9 -2
drivers/cxl/core/port.c
··· 811 811 static int add_dport(struct cxl_port *port, struct cxl_dport *new) 812 812 { 813 813 struct cxl_dport *dup; 814 + int rc; 814 815 815 816 device_lock_assert(&port->dev); 816 817 dup = find_dport(port, new->port_id); ··· 822 821 dev_name(dup->dport)); 823 822 return -EBUSY; 824 823 } 825 - return xa_insert(&port->dports, (unsigned long)new->dport, new, 826 - GFP_KERNEL); 824 + 825 + rc = xa_insert(&port->dports, (unsigned long)new->dport, new, 826 + GFP_KERNEL); 827 + if (rc) 828 + return rc; 829 + 830 + port->nr_dports++; 831 + return 0; 827 832 } 828 833 829 834 /*
+85 -28
drivers/cxl/core/region.c
··· 174 174 iter = to_cxl_port(iter->dev.parent)) { 175 175 cxl_rr = cxl_rr_load(iter, cxlr); 176 176 cxld = cxl_rr->decoder; 177 - rc = cxld->commit(cxld); 177 + if (cxld->commit) 178 + rc = cxld->commit(cxld); 178 179 if (rc) 179 180 break; 180 181 } ··· 658 657 xa_for_each(&port->regions, index, iter) { 659 658 struct cxl_region_params *ip = &iter->region->params; 660 659 660 + if (!ip->res) 661 + continue; 662 + 661 663 if (ip->res->start > p->res->start) { 662 664 dev_dbg(&cxlr->dev, 663 665 "%s: HPA order violation %s:%pr vs %pr\n", ··· 690 686 return cxl_rr; 691 687 } 692 688 693 - static void free_region_ref(struct cxl_region_ref *cxl_rr) 689 + static void cxl_rr_free_decoder(struct cxl_region_ref *cxl_rr) 694 690 { 695 - struct cxl_port *port = cxl_rr->port; 696 691 struct cxl_region *cxlr = cxl_rr->region; 697 692 struct cxl_decoder *cxld = cxl_rr->decoder; 693 + 694 + if (!cxld) 695 + return; 698 696 699 697 dev_WARN_ONCE(&cxlr->dev, cxld->region != cxlr, "region mismatch\n"); 700 698 if (cxld->region == cxlr) { 701 699 cxld->region = NULL; 702 700 put_device(&cxlr->dev); 703 701 } 702 + } 704 703 704 + static void free_region_ref(struct cxl_region_ref *cxl_rr) 705 + { 706 + struct cxl_port *port = cxl_rr->port; 707 + struct cxl_region *cxlr = cxl_rr->region; 708 + 709 + cxl_rr_free_decoder(cxl_rr); 705 710 xa_erase(&port->regions, (unsigned long)cxlr); 706 711 xa_destroy(&cxl_rr->endpoints); 707 712 kfree(cxl_rr); ··· 738 725 get_device(&cxlr->dev); 739 726 } 740 727 728 + return 0; 729 + } 730 + 731 + static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *cxlr, 732 + struct cxl_endpoint_decoder *cxled, 733 + struct cxl_region_ref *cxl_rr) 734 + { 735 + struct cxl_decoder *cxld; 736 + 737 + if (port == cxled_to_port(cxled)) 738 + cxld = &cxled->cxld; 739 + else 740 + cxld = cxl_region_find_decoder(port, cxlr); 741 + if (!cxld) { 742 + dev_dbg(&cxlr->dev, "%s: no decoder available\n", 743 + dev_name(&port->dev)); 744 + return -EBUSY; 745 + } 746 + 747 + if (cxld->region) { 748 + dev_dbg(&cxlr->dev, "%s: %s already attached to %s\n", 749 + dev_name(&port->dev), dev_name(&cxld->dev), 750 + dev_name(&cxld->region->dev)); 751 + return -EBUSY; 752 + } 753 + 754 + cxl_rr->decoder = cxld; 741 755 return 0; 742 756 } 743 757 ··· 834 794 cxl_rr->nr_targets++; 835 795 nr_targets_inc = true; 836 796 } 837 - 838 - /* 839 - * The decoder for @cxlr was allocated when the region was first 840 - * attached to @port. 841 - */ 842 - cxld = cxl_rr->decoder; 843 797 } else { 844 798 cxl_rr = alloc_region_ref(port, cxlr); 845 799 if (IS_ERR(cxl_rr)) { ··· 844 810 } 845 811 nr_targets_inc = true; 846 812 847 - if (port == cxled_to_port(cxled)) 848 - cxld = &cxled->cxld; 849 - else 850 - cxld = cxl_region_find_decoder(port, cxlr); 851 - if (!cxld) { 852 - dev_dbg(&cxlr->dev, "%s: no decoder available\n", 853 - dev_name(&port->dev)); 813 + rc = cxl_rr_alloc_decoder(port, cxlr, cxled, cxl_rr); 814 + if (rc) 854 815 goto out_erase; 855 - } 856 - 857 - if (cxld->region) { 858 - dev_dbg(&cxlr->dev, "%s: %s already attached to %s\n", 859 - dev_name(&port->dev), dev_name(&cxld->dev), 860 - dev_name(&cxld->region->dev)); 861 - rc = -EBUSY; 862 - goto out_erase; 863 - } 864 - 865 - cxl_rr->decoder = cxld; 866 816 } 817 + cxld = cxl_rr->decoder; 867 818 868 819 rc = cxl_rr_ep_add(cxl_rr, cxled); 869 820 if (rc) { ··· 990 971 if (cxl_rr->nr_targets_set) { 991 972 int i, distance; 992 973 993 - distance = p->nr_targets / cxl_rr->nr_targets; 974 + /* 975 + * Passthrough ports impose no distance requirements between 976 + * peers 977 + */ 978 + if (port->nr_dports == 1) 979 + distance = 0; 980 + else 981 + distance = p->nr_targets / cxl_rr->nr_targets; 994 982 for (i = 0; i < cxl_rr->nr_targets_set; i++) 995 983 if (ep->dport == cxlsd->target[i]) { 996 984 rc = check_last_peer(cxled, ep, cxl_rr, ··· 1534 1508 1535 1509 static void cxl_region_release(struct device *dev) 1536 1510 { 1511 + struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(dev->parent); 1537 1512 struct cxl_region *cxlr = to_cxl_region(dev); 1513 + int id = atomic_read(&cxlrd->region_id); 1514 + 1515 + /* 1516 + * Try to reuse the recently idled id rather than the cached 1517 + * next id to prevent the region id space from increasing 1518 + * unnecessarily. 1519 + */ 1520 + if (cxlr->id < id) 1521 + if (atomic_try_cmpxchg(&cxlrd->region_id, &id, cxlr->id)) { 1522 + memregion_free(id); 1523 + goto out; 1524 + } 1538 1525 1539 1526 memregion_free(cxlr->id); 1527 + out: 1528 + put_device(dev->parent); 1540 1529 kfree(cxlr); 1541 1530 } 1542 1531 ··· 1579 1538 static void unregister_region(void *dev) 1580 1539 { 1581 1540 struct cxl_region *cxlr = to_cxl_region(dev); 1541 + struct cxl_region_params *p = &cxlr->params; 1542 + int i; 1582 1543 1583 1544 device_del(dev); 1545 + 1546 + /* 1547 + * Now that region sysfs is shutdown, the parameter block is now 1548 + * read-only, so no need to hold the region rwsem to access the 1549 + * region parameters. 1550 + */ 1551 + for (i = 0; i < p->interleave_ways; i++) 1552 + detach_target(cxlr, i); 1553 + 1584 1554 cxl_region_iomem_release(cxlr); 1585 1555 put_device(dev); 1586 1556 } ··· 1613 1561 device_initialize(dev); 1614 1562 lockdep_set_class(&dev->mutex, &cxl_region_key); 1615 1563 dev->parent = &cxlrd->cxlsd.cxld.dev; 1564 + /* 1565 + * Keep root decoder pinned through cxl_region_release to fixup 1566 + * region id allocations 1567 + */ 1568 + get_device(dev->parent); 1616 1569 device_set_pm_not_required(dev); 1617 1570 dev->bus = &cxl_bus_type; 1618 1571 dev->type = &cxl_region_type;
+3 -1
drivers/cxl/cxl.h
··· 423 423 struct device dev; 424 424 struct cxl_memdev *cxlmd; 425 425 struct cxl_nvdimm_bridge *bridge; 426 - struct cxl_pmem_region *region; 426 + struct xarray pmem_regions; 427 427 }; 428 428 429 429 struct cxl_pmem_region_mapping { ··· 457 457 * @regions: cxl_region_ref instances, regions mapped by this port 458 458 * @parent_dport: dport that points to this port in the parent 459 459 * @decoder_ida: allocator for decoder ids 460 + * @nr_dports: number of entries in @dports 460 461 * @hdm_end: track last allocated HDM decoder instance for allocation ordering 461 462 * @commit_end: cursor to track highest committed decoder for commit ordering 462 463 * @component_reg_phys: component register capability base address (optional) ··· 476 475 struct xarray regions; 477 476 struct cxl_dport *parent_dport; 478 477 struct ida decoder_ida; 478 + int nr_dports; 479 479 int hdm_end; 480 480 int commit_end; 481 481 resource_size_t component_reg_phys;
+68 -39
drivers/cxl/pmem.c
··· 30 30 struct cxl_nvdimm *cxl_nvd = nvdimm_provider_data(nvdimm); 31 31 struct cxl_nvdimm_bridge *cxl_nvb = cxl_nvd->bridge; 32 32 struct cxl_pmem_region *cxlr_pmem; 33 + unsigned long index; 33 34 34 35 device_lock(&cxl_nvb->dev); 35 - cxlr_pmem = cxl_nvd->region; 36 36 dev_set_drvdata(&cxl_nvd->dev, NULL); 37 - cxl_nvd->region = NULL; 38 - device_unlock(&cxl_nvb->dev); 37 + xa_for_each(&cxl_nvd->pmem_regions, index, cxlr_pmem) { 38 + get_device(&cxlr_pmem->dev); 39 + device_unlock(&cxl_nvb->dev); 39 40 40 - if (cxlr_pmem) { 41 41 device_release_driver(&cxlr_pmem->dev); 42 42 put_device(&cxlr_pmem->dev); 43 + 44 + device_lock(&cxl_nvb->dev); 43 45 } 46 + device_unlock(&cxl_nvb->dev); 44 47 45 48 nvdimm_delete(nvdimm); 46 49 cxl_nvd->bridge = NULL; ··· 110 107 111 108 *cmd = (struct nd_cmd_get_config_size) { 112 109 .config_size = cxlds->lsa_size, 113 - .max_xfer = cxlds->payload_size, 110 + .max_xfer = cxlds->payload_size - sizeof(struct cxl_mbox_set_lsa), 114 111 }; 115 112 116 113 return 0; ··· 151 148 return -EINVAL; 152 149 153 150 /* 4-byte status follows the input data in the payload */ 154 - if (struct_size(cmd, in_buf, cmd->in_length) + 4 > buf_len) 151 + if (size_add(struct_size(cmd, in_buf, cmd->in_length), 4) > buf_len) 155 152 return -EINVAL; 156 153 157 154 set_lsa = ··· 369 366 370 367 static void unregister_nvdimm_region(void *nd_region) 371 368 { 372 - struct cxl_nvdimm_bridge *cxl_nvb; 373 - struct cxl_pmem_region *cxlr_pmem; 374 - int i; 369 + nvdimm_region_delete(nd_region); 370 + } 375 371 376 - cxlr_pmem = nd_region_provider_data(nd_region); 377 - cxl_nvb = cxlr_pmem->bridge; 372 + static int cxl_nvdimm_add_region(struct cxl_nvdimm *cxl_nvd, 373 + struct cxl_pmem_region *cxlr_pmem) 374 + { 375 + int rc; 376 + 377 + rc = xa_insert(&cxl_nvd->pmem_regions, (unsigned long)cxlr_pmem, 378 + cxlr_pmem, GFP_KERNEL); 379 + if (rc) 380 + return rc; 381 + 382 + get_device(&cxlr_pmem->dev); 383 + return 0; 384 + } 385 + 386 + static void cxl_nvdimm_del_region(struct cxl_nvdimm *cxl_nvd, 387 + struct cxl_pmem_region *cxlr_pmem) 388 + { 389 + /* 390 + * It is possible this is called without a corresponding 391 + * cxl_nvdimm_add_region for @cxlr_pmem 392 + */ 393 + cxlr_pmem = xa_erase(&cxl_nvd->pmem_regions, (unsigned long)cxlr_pmem); 394 + if (cxlr_pmem) 395 + put_device(&cxlr_pmem->dev); 396 + } 397 + 398 + static void release_mappings(void *data) 399 + { 400 + int i; 401 + struct cxl_pmem_region *cxlr_pmem = data; 402 + struct cxl_nvdimm_bridge *cxl_nvb = cxlr_pmem->bridge; 403 + 378 404 device_lock(&cxl_nvb->dev); 379 405 for (i = 0; i < cxlr_pmem->nr_mappings; i++) { 380 406 struct cxl_pmem_region_mapping *m = &cxlr_pmem->mapping[i]; 381 407 struct cxl_nvdimm *cxl_nvd = m->cxl_nvd; 382 408 383 - if (cxl_nvd->region) { 384 - put_device(&cxlr_pmem->dev); 385 - cxl_nvd->region = NULL; 386 - } 409 + cxl_nvdimm_del_region(cxl_nvd, cxlr_pmem); 387 410 } 388 411 device_unlock(&cxl_nvb->dev); 389 - 390 - nvdimm_region_delete(nd_region); 391 412 } 392 413 393 414 static void cxlr_pmem_remove_resource(void *res) ··· 449 422 if (!cxl_nvb->nvdimm_bus) { 450 423 dev_dbg(dev, "nvdimm bus not found\n"); 451 424 rc = -ENXIO; 452 - goto err; 425 + goto out_nvb; 453 426 } 454 427 455 428 memset(&mappings, 0, sizeof(mappings)); ··· 458 431 res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL); 459 432 if (!res) { 460 433 rc = -ENOMEM; 461 - goto err; 434 + goto out_nvb; 462 435 } 463 436 464 437 res->name = "Persistent Memory"; ··· 469 442 470 443 rc = insert_resource(&iomem_resource, res); 471 444 if (rc) 472 - goto err; 445 + goto out_nvb; 473 446 474 447 rc = devm_add_action_or_reset(dev, cxlr_pmem_remove_resource, res); 475 448 if (rc) 476 - goto err; 449 + goto out_nvb; 477 450 478 451 ndr_desc.res = res; 479 452 ndr_desc.provider_data = cxlr_pmem; ··· 489 462 nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); 490 463 if (!nd_set) { 491 464 rc = -ENOMEM; 492 - goto err; 465 + goto out_nvb; 493 466 } 494 467 495 468 ndr_desc.memregion = cxlr->id; ··· 499 472 info = kmalloc_array(cxlr_pmem->nr_mappings, sizeof(*info), GFP_KERNEL); 500 473 if (!info) { 501 474 rc = -ENOMEM; 502 - goto err; 475 + goto out_nvb; 503 476 } 477 + 478 + rc = devm_add_action_or_reset(dev, release_mappings, cxlr_pmem); 479 + if (rc) 480 + goto out_nvd; 504 481 505 482 for (i = 0; i < cxlr_pmem->nr_mappings; i++) { 506 483 struct cxl_pmem_region_mapping *m = &cxlr_pmem->mapping[i]; ··· 517 486 dev_dbg(dev, "[%d]: %s: no cxl_nvdimm found\n", i, 518 487 dev_name(&cxlmd->dev)); 519 488 rc = -ENODEV; 520 - goto err; 489 + goto out_nvd; 521 490 } 522 491 523 492 /* safe to drop ref now with bridge lock held */ ··· 529 498 dev_dbg(dev, "[%d]: %s: no nvdimm found\n", i, 530 499 dev_name(&cxlmd->dev)); 531 500 rc = -ENODEV; 532 - goto err; 501 + goto out_nvd; 533 502 } 534 - cxl_nvd->region = cxlr_pmem; 535 - get_device(&cxlr_pmem->dev); 503 + 504 + /* 505 + * Pin the region per nvdimm device as those may be released 506 + * out-of-order with respect to the region, and a single nvdimm 507 + * maybe associated with multiple regions 508 + */ 509 + rc = cxl_nvdimm_add_region(cxl_nvd, cxlr_pmem); 510 + if (rc) 511 + goto out_nvd; 536 512 m->cxl_nvd = cxl_nvd; 537 513 mappings[i] = (struct nd_mapping_desc) { 538 514 .nvdimm = nvdimm, ··· 565 527 nvdimm_pmem_region_create(cxl_nvb->nvdimm_bus, &ndr_desc); 566 528 if (!cxlr_pmem->nd_region) { 567 529 rc = -ENOMEM; 568 - goto err; 530 + goto out_nvd; 569 531 } 570 532 571 533 rc = devm_add_action_or_reset(dev, unregister_nvdimm_region, 572 534 cxlr_pmem->nd_region); 573 - out: 535 + out_nvd: 574 536 kfree(info); 537 + out_nvb: 575 538 device_unlock(&cxl_nvb->dev); 576 539 put_device(&cxl_nvb->dev); 577 540 578 541 return rc; 579 - 580 - err: 581 - dev_dbg(dev, "failed to create nvdimm region\n"); 582 - for (i--; i >= 0; i--) { 583 - nvdimm = mappings[i].nvdimm; 584 - cxl_nvd = nvdimm_provider_data(nvdimm); 585 - put_device(&cxl_nvd->region->dev); 586 - cxl_nvd->region = NULL; 587 - } 588 - goto out; 589 542 } 590 543 591 544 static struct cxl_driver cxl_pmem_region_driver = {
+11
drivers/firmware/arm_scmi/bus.c
··· 216 216 device_unregister(&scmi_dev->dev); 217 217 } 218 218 219 + void scmi_device_link_add(struct device *consumer, struct device *supplier) 220 + { 221 + struct device_link *link; 222 + 223 + link = device_link_add(consumer, supplier, DL_FLAG_AUTOREMOVE_CONSUMER); 224 + 225 + WARN_ON(!link); 226 + } 227 + 219 228 void scmi_set_handle(struct scmi_device *scmi_dev) 220 229 { 221 230 scmi_dev->handle = scmi_handle_get(&scmi_dev->dev); 231 + if (scmi_dev->handle) 232 + scmi_device_link_add(&scmi_dev->dev, scmi_dev->handle->dev); 222 233 } 223 234 224 235 int scmi_protocol_register(const struct scmi_protocol *proto)
+4 -1
drivers/firmware/arm_scmi/common.h
··· 97 97 struct scmi_revision_info * 98 98 scmi_revision_area_get(const struct scmi_protocol_handle *ph); 99 99 int scmi_handle_put(const struct scmi_handle *handle); 100 + void scmi_device_link_add(struct device *consumer, struct device *supplier); 100 101 struct scmi_handle *scmi_handle_get(struct device *dev); 101 102 void scmi_set_handle(struct scmi_device *scmi_dev); 102 103 void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph, ··· 118 117 * 119 118 * @dev: Reference to device in the SCMI hierarchy corresponding to this 120 119 * channel 120 + * @rx_timeout_ms: The configured RX timeout in milliseconds. 121 121 * @handle: Pointer to SCMI entity handle 122 122 * @no_completion_irq: Flag to indicate that this channel has no completion 123 123 * interrupt mechanism for synchronous commands. ··· 128 126 */ 129 127 struct scmi_chan_info { 130 128 struct device *dev; 129 + unsigned int rx_timeout_ms; 131 130 struct scmi_handle *handle; 132 131 bool no_completion_irq; 133 132 void *transport_info; ··· 235 232 struct scmi_shared_mem; 236 233 237 234 void shmem_tx_prepare(struct scmi_shared_mem __iomem *shmem, 238 - struct scmi_xfer *xfer); 235 + struct scmi_xfer *xfer, struct scmi_chan_info *cinfo); 239 236 u32 shmem_read_header(struct scmi_shared_mem __iomem *shmem); 240 237 void shmem_fetch_response(struct scmi_shared_mem __iomem *shmem, 241 238 struct scmi_xfer *xfer);
+27 -14
drivers/firmware/arm_scmi/driver.c
··· 2013 2013 return -ENOMEM; 2014 2014 2015 2015 cinfo->dev = dev; 2016 + cinfo->rx_timeout_ms = info->desc->max_rx_timeout_ms; 2016 2017 2017 2018 ret = info->desc->ops->chan_setup(cinfo, info->dev, tx); 2018 2019 if (ret) ··· 2045 2044 { 2046 2045 int ret = scmi_chan_setup(info, dev, prot_id, true); 2047 2046 2048 - if (!ret) /* Rx is optional, hence no error check */ 2049 - scmi_chan_setup(info, dev, prot_id, false); 2047 + if (!ret) { 2048 + /* Rx is optional, report only memory errors */ 2049 + ret = scmi_chan_setup(info, dev, prot_id, false); 2050 + if (ret && ret != -ENOMEM) 2051 + ret = 0; 2052 + } 2050 2053 2051 2054 return ret; 2052 2055 } ··· 2278 2273 sdev = scmi_get_protocol_device(child, info, 2279 2274 id_table->protocol_id, 2280 2275 id_table->name); 2281 - /* Set handle if not already set: device existed */ 2282 - if (sdev && !sdev->handle) 2283 - sdev->handle = 2284 - scmi_handle_get_from_info_unlocked(info); 2276 + if (sdev) { 2277 + /* Set handle if not already set: device existed */ 2278 + if (!sdev->handle) 2279 + sdev->handle = 2280 + scmi_handle_get_from_info_unlocked(info); 2281 + /* Relink consumer and suppliers */ 2282 + if (sdev->handle) 2283 + scmi_device_link_add(&sdev->dev, 2284 + sdev->handle->dev); 2285 + } 2285 2286 } else { 2286 2287 dev_err(info->dev, 2287 2288 "Failed. SCMI protocol %d not active.\n", ··· 2486 2475 2487 2476 static int scmi_remove(struct platform_device *pdev) 2488 2477 { 2489 - int ret = 0, id; 2478 + int ret, id; 2490 2479 struct scmi_info *info = platform_get_drvdata(pdev); 2491 2480 struct device_node *child; 2492 2481 2493 2482 mutex_lock(&scmi_list_mutex); 2494 2483 if (info->users) 2495 - ret = -EBUSY; 2496 - else 2497 - list_del(&info->node); 2484 + dev_warn(&pdev->dev, 2485 + "Still active SCMI users will be forcibly unbound.\n"); 2486 + list_del(&info->node); 2498 2487 mutex_unlock(&scmi_list_mutex); 2499 - 2500 - if (ret) 2501 - return ret; 2502 2488 2503 2489 scmi_notification_exit(&info->handle); 2504 2490 ··· 2508 2500 idr_destroy(&info->active_protocols); 2509 2501 2510 2502 /* Safe to free channels since no more users */ 2511 - return scmi_cleanup_txrx_channels(info); 2503 + ret = scmi_cleanup_txrx_channels(info); 2504 + if (ret) 2505 + dev_warn(&pdev->dev, "Failed to cleanup SCMI channels.\n"); 2506 + 2507 + return 0; 2512 2508 } 2513 2509 2514 2510 static ssize_t protocol_version_show(struct device *dev, ··· 2583 2571 static struct platform_driver scmi_driver = { 2584 2572 .driver = { 2585 2573 .name = "arm-scmi", 2574 + .suppress_bind_attrs = true, 2586 2575 .of_match_table = scmi_of_match, 2587 2576 .dev_groups = versions_groups, 2588 2577 },
+1 -1
drivers/firmware/arm_scmi/mailbox.c
··· 36 36 { 37 37 struct scmi_mailbox *smbox = client_to_scmi_mailbox(cl); 38 38 39 - shmem_tx_prepare(smbox->shmem, m); 39 + shmem_tx_prepare(smbox->shmem, m, smbox->cinfo); 40 40 } 41 41 42 42 static void rx_callback(struct mbox_client *cl, void *m)
+1 -1
drivers/firmware/arm_scmi/optee.c
··· 498 498 msg_tx_prepare(channel->req.msg, xfer); 499 499 ret = invoke_process_msg_channel(channel, msg_command_size(xfer)); 500 500 } else { 501 - shmem_tx_prepare(channel->req.shmem, xfer); 501 + shmem_tx_prepare(channel->req.shmem, xfer, cinfo); 502 502 ret = invoke_process_smt_channel(channel); 503 503 } 504 504
+27 -4
drivers/firmware/arm_scmi/shmem.c
··· 5 5 * Copyright (C) 2019 ARM Ltd. 6 6 */ 7 7 8 + #include <linux/ktime.h> 8 9 #include <linux/io.h> 9 10 #include <linux/processor.h> 10 11 #include <linux/types.h> 12 + 13 + #include <asm-generic/bug.h> 11 14 12 15 #include "common.h" 13 16 ··· 33 30 }; 34 31 35 32 void shmem_tx_prepare(struct scmi_shared_mem __iomem *shmem, 36 - struct scmi_xfer *xfer) 33 + struct scmi_xfer *xfer, struct scmi_chan_info *cinfo) 37 34 { 35 + ktime_t stop; 36 + 38 37 /* 39 38 * Ideally channel must be free by now unless OS timeout last 40 39 * request and platform continued to process the same, wait 41 40 * until it releases the shared memory, otherwise we may endup 42 - * overwriting its response with new message payload or vice-versa 41 + * overwriting its response with new message payload or vice-versa. 42 + * Giving up anyway after twice the expected channel timeout so as 43 + * not to bail-out on intermittent issues where the platform is 44 + * occasionally a bit slower to answer. 45 + * 46 + * Note that after a timeout is detected we bail-out and carry on but 47 + * the transport functionality is probably permanently compromised: 48 + * this is just to ease debugging and avoid complete hangs on boot 49 + * due to a misbehaving SCMI firmware. 43 50 */ 44 - spin_until_cond(ioread32(&shmem->channel_status) & 45 - SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE); 51 + stop = ktime_add_ms(ktime_get(), 2 * cinfo->rx_timeout_ms); 52 + spin_until_cond((ioread32(&shmem->channel_status) & 53 + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE) || 54 + ktime_after(ktime_get(), stop)); 55 + if (!(ioread32(&shmem->channel_status) & 56 + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE)) { 57 + WARN_ON_ONCE(1); 58 + dev_err(cinfo->dev, 59 + "Timeout waiting for a free TX channel !\n"); 60 + return; 61 + } 62 + 46 63 /* Mark channel busy + clear error */ 47 64 iowrite32(0x0, &shmem->channel_status); 48 65 iowrite32(xfer->hdr.poll_completion ? 0 : SCMI_SHMEM_FLAG_INTR_ENABLED,
+1 -1
drivers/firmware/arm_scmi/smc.c
··· 188 188 */ 189 189 smc_channel_lock_acquire(scmi_info, xfer); 190 190 191 - shmem_tx_prepare(scmi_info->shmem, xfer); 191 + shmem_tx_prepare(scmi_info->shmem, xfer, cinfo); 192 192 193 193 arm_smccc_1_1_invoke(scmi_info->func_id, 0, 0, 0, 0, 0, 0, 0, &res); 194 194
+16 -10
drivers/firmware/arm_scmi/virtio.c
··· 148 148 { 149 149 unsigned long flags; 150 150 DECLARE_COMPLETION_ONSTACK(vioch_shutdown_done); 151 - void *deferred_wq = NULL; 152 151 153 152 /* 154 153 * Prepare to wait for the last release if not already released ··· 161 162 162 163 vioch->shutdown_done = &vioch_shutdown_done; 163 164 virtio_break_device(vioch->vqueue->vdev); 164 - if (!vioch->is_rx && vioch->deferred_tx_wq) { 165 - deferred_wq = vioch->deferred_tx_wq; 165 + if (!vioch->is_rx && vioch->deferred_tx_wq) 166 166 /* Cannot be kicked anymore after this...*/ 167 167 vioch->deferred_tx_wq = NULL; 168 - } 169 168 spin_unlock_irqrestore(&vioch->lock, flags); 170 - 171 - if (deferred_wq) 172 - destroy_workqueue(deferred_wq); 173 169 174 170 scmi_vio_channel_release(vioch); 175 171 ··· 410 416 return vioch && !vioch->cinfo; 411 417 } 412 418 419 + static void scmi_destroy_tx_workqueue(void *deferred_tx_wq) 420 + { 421 + destroy_workqueue(deferred_tx_wq); 422 + } 423 + 413 424 static int virtio_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, 414 425 bool tx) 415 426 { ··· 429 430 430 431 /* Setup a deferred worker for polling. */ 431 432 if (tx && !vioch->deferred_tx_wq) { 433 + int ret; 434 + 432 435 vioch->deferred_tx_wq = 433 436 alloc_workqueue(dev_name(&scmi_vdev->dev), 434 437 WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS, 435 438 0); 436 439 if (!vioch->deferred_tx_wq) 437 440 return -ENOMEM; 441 + 442 + ret = devm_add_action_or_reset(dev, scmi_destroy_tx_workqueue, 443 + vioch->deferred_tx_wq); 444 + if (ret) 445 + return ret; 438 446 439 447 INIT_WORK(&vioch->deferred_tx_work, 440 448 scmi_vio_deferred_tx_worker); ··· 450 444 for (i = 0; i < vioch->max_msg; i++) { 451 445 struct scmi_vio_msg *msg; 452 446 453 - msg = devm_kzalloc(cinfo->dev, sizeof(*msg), GFP_KERNEL); 447 + msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); 454 448 if (!msg) 455 449 return -ENOMEM; 456 450 457 451 if (tx) { 458 - msg->request = devm_kzalloc(cinfo->dev, 452 + msg->request = devm_kzalloc(dev, 459 453 VIRTIO_SCMI_MAX_PDU_SIZE, 460 454 GFP_KERNEL); 461 455 if (!msg->request) ··· 464 458 refcount_set(&msg->users, 1); 465 459 } 466 460 467 - msg->input = devm_kzalloc(cinfo->dev, VIRTIO_SCMI_MAX_PDU_SIZE, 461 + msg->input = devm_kzalloc(dev, VIRTIO_SCMI_MAX_PDU_SIZE, 468 462 GFP_KERNEL); 469 463 if (!msg->input) 470 464 return -ENOMEM;
+1 -1
drivers/firmware/efi/efi.c
··· 611 611 612 612 seed = early_memremap(efi_rng_seed, sizeof(*seed)); 613 613 if (seed != NULL) { 614 - size = READ_ONCE(seed->size); 614 + size = min(seed->size, EFI_RANDOM_SEED_SIZE); 615 615 early_memunmap(seed, sizeof(*seed)); 616 616 } else { 617 617 pr_err("Could not map UEFI random seed!\n");
+6 -1
drivers/firmware/efi/libstub/random.c
··· 75 75 if (status != EFI_SUCCESS) 76 76 return status; 77 77 78 - status = efi_bs_call(allocate_pool, EFI_RUNTIME_SERVICES_DATA, 78 + /* 79 + * Use EFI_ACPI_RECLAIM_MEMORY here so that it is guaranteed that the 80 + * allocation will survive a kexec reboot (although we refresh the seed 81 + * beforehand) 82 + */ 83 + status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY, 79 84 sizeof(*seed) + EFI_RANDOM_SEED_SIZE, 80 85 (void **)&seed); 81 86 if (status != EFI_SUCCESS)
+1 -1
drivers/firmware/efi/tpm.c
··· 97 97 goto out_calc; 98 98 } 99 99 100 - memblock_reserve((unsigned long)final_tbl, 100 + memblock_reserve(efi.tpm_final_log, 101 101 tbl_size + sizeof(*final_tbl)); 102 102 efi_tpm_final_log_size = tbl_size; 103 103
+20 -48
drivers/firmware/efi/vars.c
··· 21 21 22 22 static DEFINE_SEMAPHORE(efivars_lock); 23 23 24 - static efi_status_t check_var_size(u32 attributes, unsigned long size) 24 + static efi_status_t check_var_size(bool nonblocking, u32 attributes, 25 + unsigned long size) 25 26 { 26 27 const struct efivar_operations *fops; 28 + efi_status_t status; 27 29 28 30 fops = __efivars->ops; 29 31 30 32 if (!fops->query_variable_store) 33 + status = EFI_UNSUPPORTED; 34 + else 35 + status = fops->query_variable_store(attributes, size, 36 + nonblocking); 37 + if (status == EFI_UNSUPPORTED) 31 38 return (size <= SZ_64K) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES; 32 - 33 - return fops->query_variable_store(attributes, size, false); 34 - } 35 - 36 - static 37 - efi_status_t check_var_size_nonblocking(u32 attributes, unsigned long size) 38 - { 39 - const struct efivar_operations *fops; 40 - 41 - fops = __efivars->ops; 42 - 43 - if (!fops->query_variable_store) 44 - return (size <= SZ_64K) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES; 45 - 46 - return fops->query_variable_store(attributes, size, true); 39 + return status; 47 40 } 48 41 49 42 /** ··· 189 196 EXPORT_SYMBOL_NS_GPL(efivar_get_next_variable, EFIVAR); 190 197 191 198 /* 192 - * efivar_set_variable_blocking() - local helper function for set_variable 193 - * 194 - * Must be called with efivars_lock held. 195 - */ 196 - static efi_status_t 197 - efivar_set_variable_blocking(efi_char16_t *name, efi_guid_t *vendor, 198 - u32 attr, unsigned long data_size, void *data) 199 - { 200 - efi_status_t status; 201 - 202 - if (data_size > 0) { 203 - status = check_var_size(attr, data_size + 204 - ucs2_strsize(name, 1024)); 205 - if (status != EFI_SUCCESS) 206 - return status; 207 - } 208 - return __efivars->ops->set_variable(name, vendor, attr, data_size, data); 209 - } 210 - 211 - /* 212 199 * efivar_set_variable_locked() - set a variable identified by name/vendor 213 200 * 214 201 * Must be called with efivars_lock held. If @nonblocking is set, it will use ··· 201 228 efi_set_variable_t *setvar; 202 229 efi_status_t status; 203 230 204 - if (!nonblocking) 205 - return efivar_set_variable_blocking(name, vendor, attr, 206 - data_size, data); 231 + if (data_size > 0) { 232 + status = check_var_size(nonblocking, attr, 233 + data_size + ucs2_strsize(name, 1024)); 234 + if (status != EFI_SUCCESS) 235 + return status; 236 + } 207 237 208 238 /* 209 239 * If no _nonblocking variant exists, the ordinary one 210 240 * is assumed to be non-blocking. 211 241 */ 212 - setvar = __efivars->ops->set_variable_nonblocking ?: 213 - __efivars->ops->set_variable; 242 + setvar = __efivars->ops->set_variable_nonblocking; 243 + if (!setvar || !nonblocking) 244 + setvar = __efivars->ops->set_variable; 214 245 215 - if (data_size > 0) { 216 - status = check_var_size_nonblocking(attr, data_size + 217 - ucs2_strsize(name, 1024)); 218 - if (status != EFI_SUCCESS) 219 - return status; 220 - } 221 246 return setvar(name, vendor, attr, data_size, data); 222 247 } 223 248 EXPORT_SYMBOL_NS_GPL(efivar_set_variable_locked, EFIVAR); ··· 235 264 if (efivar_lock()) 236 265 return EFI_ABORTED; 237 266 238 - status = efivar_set_variable_blocking(name, vendor, attr, data_size, data); 267 + status = efivar_set_variable_locked(name, vendor, attr, data_size, 268 + data, false); 239 269 efivar_unlock(); 240 270 return status; 241 271 }
+7
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
··· 706 706 707 707 void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle) 708 708 { 709 + /* Temporary workaround to fix issues observed in some 710 + * compute applications when GFXOFF is enabled on GFX11. 711 + */ 712 + if (IP_VERSION_MAJ(adev->ip_versions[GC_HWIP][0]) == 11) { 713 + pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled"); 714 + amdgpu_gfx_off_ctrl(adev, idle); 715 + } 709 716 amdgpu_dpm_switch_power_profile(adev, 710 717 PP_SMC_POWER_PROFILE_COMPUTE, 711 718 !idle);
+10 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 4060 4060 * at suspend time. 4061 4061 * 4062 4062 */ 4063 - static void amdgpu_device_evict_resources(struct amdgpu_device *adev) 4063 + static int amdgpu_device_evict_resources(struct amdgpu_device *adev) 4064 4064 { 4065 + int ret; 4066 + 4065 4067 /* No need to evict vram on APUs for suspend to ram or s2idle */ 4066 4068 if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU)) 4067 - return; 4069 + return 0; 4068 4070 4069 - if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM)) 4071 + ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM); 4072 + if (ret) 4070 4073 DRM_WARN("evicting device resources failed\n"); 4071 - 4074 + return ret; 4072 4075 } 4073 4076 4074 4077 /* ··· 4121 4118 if (!adev->in_s0ix) 4122 4119 amdgpu_amdkfd_suspend(adev, adev->in_runpm); 4123 4120 4124 - amdgpu_device_evict_resources(adev); 4121 + r = amdgpu_device_evict_resources(adev); 4122 + if (r) 4123 + return r; 4125 4124 4126 4125 amdgpu_fence_driver_hw_fini(adev); 4127 4126
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 2201 2201 pm_runtime_forbid(dev->dev); 2202 2202 } 2203 2203 2204 - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) { 2204 + if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2) && 2205 + !amdgpu_sriov_vf(adev)) { 2205 2206 bool need_to_reset_gpu = false; 2206 2207 2207 2208 if (adev->gmc.xgmi.num_physical_nodes > 1) {
+6 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 337 337 fw_info->feature = adev->psp.cap_feature_version; 338 338 break; 339 339 case AMDGPU_INFO_FW_MES_KIQ: 340 - fw_info->ver = adev->mes.ucode_fw_version[0]; 341 - fw_info->feature = 0; 340 + fw_info->ver = adev->mes.kiq_version & AMDGPU_MES_VERSION_MASK; 341 + fw_info->feature = (adev->mes.kiq_version & AMDGPU_MES_FEAT_VERSION_MASK) 342 + >> AMDGPU_MES_FEAT_VERSION_SHIFT; 342 343 break; 343 344 case AMDGPU_INFO_FW_MES: 344 - fw_info->ver = adev->mes.ucode_fw_version[1]; 345 - fw_info->feature = 0; 345 + fw_info->ver = adev->mes.sched_version & AMDGPU_MES_VERSION_MASK; 346 + fw_info->feature = (adev->mes.sched_version & AMDGPU_MES_FEAT_VERSION_MASK) 347 + >> AMDGPU_MES_FEAT_VERSION_SHIFT; 346 348 break; 347 349 case AMDGPU_INFO_FW_IMU: 348 350 fw_info->ver = adev->gfx.imu_fw_version;
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
··· 500 500 501 501 adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base; 502 502 503 + adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true; 504 + 503 505 r = amdgpu_display_modeset_create_props(adev); 504 506 if (r) 505 507 return r;
+397 -395
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
··· 2495 2495 0xbf9f0000, 0x00000000, 2496 2496 }; 2497 2497 static const uint32_t cwsr_trap_gfx11_hex[] = { 2498 - 0xbfa00001, 0xbfa0021e, 2498 + 0xbfa00001, 0xbfa00221, 2499 2499 0xb0804006, 0xb8f8f802, 2500 2500 0x9178ff78, 0x00020006, 2501 - 0xb8fbf803, 0xbf0d9f6d, 2502 - 0xbfa20006, 0x8b6eff78, 2503 - 0x00002000, 0xbfa10009, 2504 - 0x8b6eff6d, 0x00ff0000, 2505 - 0xbfa2001e, 0x8b6eff7b, 2506 - 0x00000400, 0xbfa20041, 2507 - 0xbf830010, 0xb8fbf803, 2508 - 0xbfa0fffa, 0x8b6eff7b, 2509 - 0x00000900, 0xbfa20015, 2510 - 0x8b6eff7b, 0x000071ff, 2511 - 0xbfa10008, 0x8b6fff7b, 2512 - 0x00007080, 0xbfa10001, 2513 - 0xbeee1287, 0xb8eff801, 2514 - 0x846e8c6e, 0x8b6e6f6e, 2515 - 0xbfa2000a, 0x8b6eff6d, 2516 - 0x00ff0000, 0xbfa20007, 2517 - 0xb8eef801, 0x8b6eff6e, 2518 - 0x00000800, 0xbfa20003, 2501 + 0xb8fbf803, 0xbf0d9e6d, 2502 + 0xbfa10001, 0xbfbd0000, 2503 + 0xbf0d9f6d, 0xbfa20006, 2504 + 0x8b6eff78, 0x00002000, 2505 + 0xbfa10009, 0x8b6eff6d, 2506 + 0x00ff0000, 0xbfa2001e, 2519 2507 0x8b6eff7b, 0x00000400, 2520 - 0xbfa20026, 0xbefa4d82, 2521 - 0xbf89fc07, 0x84fa887a, 2522 - 0xf4005bbd, 0xf8000010, 2523 - 0xbf89fc07, 0x846e976e, 2524 - 0x9177ff77, 0x00800000, 2525 - 0x8c776e77, 0xf4045bbd, 2526 - 0xf8000000, 0xbf89fc07, 2527 - 0xf4045ebd, 0xf8000008, 2528 - 0xbf89fc07, 0x8bee6e6e, 2529 - 0xbfa10001, 0xbe80486e, 2530 - 0x8b6eff6d, 0x01ff0000, 2531 - 0xbfa20005, 0x8c78ff78, 2532 - 0x00002000, 0x80ec886c, 2533 - 0x82ed806d, 0xbfa00005, 2534 - 0x8b6eff6d, 0x01000000, 2535 - 0xbfa20002, 0x806c846c, 2536 - 0x826d806d, 0x8b6dff6d, 2537 - 0x0000ffff, 0x8bfe7e7e, 2538 - 0x8bea6a6a, 0xb978f802, 2539 - 0xbe804a6c, 0x8b6dff6d, 2540 - 0x0000ffff, 0xbefa0080, 2541 - 0xb97a0283, 0xbeee007e, 2542 - 0xbeef007f, 0xbefe0180, 2543 - 0xbefe4d84, 0xbf89fc07, 2544 - 0x8b7aff7f, 0x04000000, 2545 - 0x847a857a, 0x8c6d7a6d, 2546 - 0xbefa007e, 0x8b7bff7f, 2547 - 0x0000ffff, 0xbefe00c1, 2548 - 0xbeff00c1, 0xdca6c000, 2549 - 0x007a0000, 0x7e000280, 2550 - 0xbefe007a, 0xbeff007b, 2551 - 0xb8fb02dc, 0x847b997b, 2552 - 0xb8fa3b05, 0x807a817a, 2553 - 0xbf0d997b, 0xbfa20002, 2554 - 0x847a897a, 0xbfa00001, 2555 - 0x847a8a7a, 0xb8fb1e06, 2556 - 0x847b8a7b, 0x807a7b7a, 2508 + 0xbfa20041, 0xbf830010, 2509 + 0xb8fbf803, 0xbfa0fffa, 2510 + 0x8b6eff7b, 0x00000900, 2511 + 0xbfa20015, 0x8b6eff7b, 2512 + 0x000071ff, 0xbfa10008, 2513 + 0x8b6fff7b, 0x00007080, 2514 + 0xbfa10001, 0xbeee1287, 2515 + 0xb8eff801, 0x846e8c6e, 2516 + 0x8b6e6f6e, 0xbfa2000a, 2517 + 0x8b6eff6d, 0x00ff0000, 2518 + 0xbfa20007, 0xb8eef801, 2519 + 0x8b6eff6e, 0x00000800, 2520 + 0xbfa20003, 0x8b6eff7b, 2521 + 0x00000400, 0xbfa20026, 2522 + 0xbefa4d82, 0xbf89fc07, 2523 + 0x84fa887a, 0xf4005bbd, 2524 + 0xf8000010, 0xbf89fc07, 2525 + 0x846e976e, 0x9177ff77, 2526 + 0x00800000, 0x8c776e77, 2527 + 0xf4045bbd, 0xf8000000, 2528 + 0xbf89fc07, 0xf4045ebd, 2529 + 0xf8000008, 0xbf89fc07, 2530 + 0x8bee6e6e, 0xbfa10001, 2531 + 0xbe80486e, 0x8b6eff6d, 2532 + 0x01ff0000, 0xbfa20005, 2533 + 0x8c78ff78, 0x00002000, 2534 + 0x80ec886c, 0x82ed806d, 2535 + 0xbfa00005, 0x8b6eff6d, 2536 + 0x01000000, 0xbfa20002, 2537 + 0x806c846c, 0x826d806d, 2538 + 0x8b6dff6d, 0x0000ffff, 2539 + 0x8bfe7e7e, 0x8bea6a6a, 2540 + 0xb978f802, 0xbe804a6c, 2541 + 0x8b6dff6d, 0x0000ffff, 2542 + 0xbefa0080, 0xb97a0283, 2543 + 0xbeee007e, 0xbeef007f, 2544 + 0xbefe0180, 0xbefe4d84, 2545 + 0xbf89fc07, 0x8b7aff7f, 2546 + 0x04000000, 0x847a857a, 2547 + 0x8c6d7a6d, 0xbefa007e, 2557 2548 0x8b7bff7f, 0x0000ffff, 2558 - 0x807aff7a, 0x00000200, 2559 - 0x807a7e7a, 0x827b807b, 2560 - 0xd7610000, 0x00010870, 2561 - 0xd7610000, 0x00010a71, 2562 - 0xd7610000, 0x00010c72, 2563 - 0xd7610000, 0x00010e73, 2564 - 0xd7610000, 0x00011074, 2565 - 0xd7610000, 0x00011275, 2566 - 0xd7610000, 0x00011476, 2567 - 0xd7610000, 0x00011677, 2568 - 0xd7610000, 0x00011a79, 2569 - 0xd7610000, 0x00011c7e, 2570 - 0xd7610000, 0x00011e7f, 2571 - 0xbefe00ff, 0x00003fff, 2572 - 0xbeff0080, 0xdca6c040, 2573 - 0x007a0000, 0xd760007a, 2574 - 0x00011d00, 0xd760007b, 2575 - 0x00011f00, 0xbefe007a, 2576 - 0xbeff007b, 0xbef4007e, 2577 - 0x8b75ff7f, 0x0000ffff, 2578 - 0x8c75ff75, 0x00040000, 2579 - 0xbef60080, 0xbef700ff, 2580 - 0x10807fac, 0xbef1007d, 2581 - 0xbef00080, 0xb8f302dc, 2582 - 0x84739973, 0xbefe00c1, 2583 - 0x857d9973, 0x8b7d817d, 2584 - 0xbf06817d, 0xbfa20002, 2585 - 0xbeff0080, 0xbfa00002, 2586 - 0xbeff00c1, 0xbfa00009, 2549 + 0xbefe00c1, 0xbeff00c1, 2550 + 0xdca6c000, 0x007a0000, 2551 + 0x7e000280, 0xbefe007a, 2552 + 0xbeff007b, 0xb8fb02dc, 2553 + 0x847b997b, 0xb8fa3b05, 2554 + 0x807a817a, 0xbf0d997b, 2555 + 0xbfa20002, 0x847a897a, 2556 + 0xbfa00001, 0x847a8a7a, 2557 + 0xb8fb1e06, 0x847b8a7b, 2558 + 0x807a7b7a, 0x8b7bff7f, 2559 + 0x0000ffff, 0x807aff7a, 2560 + 0x00000200, 0x807a7e7a, 2561 + 0x827b807b, 0xd7610000, 2562 + 0x00010870, 0xd7610000, 2563 + 0x00010a71, 0xd7610000, 2564 + 0x00010c72, 0xd7610000, 2565 + 0x00010e73, 0xd7610000, 2566 + 0x00011074, 0xd7610000, 2567 + 0x00011275, 0xd7610000, 2568 + 0x00011476, 0xd7610000, 2569 + 0x00011677, 0xd7610000, 2570 + 0x00011a79, 0xd7610000, 2571 + 0x00011c7e, 0xd7610000, 2572 + 0x00011e7f, 0xbefe00ff, 2573 + 0x00003fff, 0xbeff0080, 2574 + 0xdca6c040, 0x007a0000, 2575 + 0xd760007a, 0x00011d00, 2576 + 0xd760007b, 0x00011f00, 2577 + 0xbefe007a, 0xbeff007b, 2578 + 0xbef4007e, 0x8b75ff7f, 2579 + 0x0000ffff, 0x8c75ff75, 2580 + 0x00040000, 0xbef60080, 2581 + 0xbef700ff, 0x10807fac, 2582 + 0xbef1007d, 0xbef00080, 2583 + 0xb8f302dc, 0x84739973, 2584 + 0xbefe00c1, 0x857d9973, 2585 + 0x8b7d817d, 0xbf06817d, 2586 + 0xbfa20002, 0xbeff0080, 2587 + 0xbfa00002, 0xbeff00c1, 2588 + 0xbfa00009, 0xbef600ff, 2589 + 0x01000000, 0xe0685080, 2590 + 0x701d0100, 0xe0685100, 2591 + 0x701d0200, 0xe0685180, 2592 + 0x701d0300, 0xbfa00008, 2587 2593 0xbef600ff, 0x01000000, 2588 - 0xe0685080, 0x701d0100, 2589 - 0xe0685100, 0x701d0200, 2590 - 0xe0685180, 0x701d0300, 2591 - 0xbfa00008, 0xbef600ff, 2592 - 0x01000000, 0xe0685100, 2593 - 0x701d0100, 0xe0685200, 2594 - 0x701d0200, 0xe0685300, 2595 - 0x701d0300, 0xb8f03b05, 2596 - 0x80708170, 0xbf0d9973, 2597 - 0xbfa20002, 0x84708970, 2598 - 0xbfa00001, 0x84708a70, 2599 - 0xb8fa1e06, 0x847a8a7a, 2600 - 0x80707a70, 0x8070ff70, 2601 - 0x00000200, 0xbef600ff, 2602 - 0x01000000, 0x7e000280, 2603 - 0x7e020280, 0x7e040280, 2604 - 0xbefd0080, 0xd7610002, 2605 - 0x0000fa71, 0x807d817d, 2606 - 0xd7610002, 0x0000fa6c, 2607 - 0x807d817d, 0x917aff6d, 2608 - 0x80000000, 0xd7610002, 2609 - 0x0000fa7a, 0x807d817d, 2610 - 0xd7610002, 0x0000fa6e, 2611 - 0x807d817d, 0xd7610002, 2612 - 0x0000fa6f, 0x807d817d, 2613 - 0xd7610002, 0x0000fa78, 2614 - 0x807d817d, 0xb8faf803, 2615 - 0xd7610002, 0x0000fa7a, 2616 - 0x807d817d, 0xd7610002, 2617 - 0x0000fa7b, 0x807d817d, 2618 - 0xb8f1f801, 0xd7610002, 2619 - 0x0000fa71, 0x807d817d, 2620 - 0xb8f1f814, 0xd7610002, 2621 - 0x0000fa71, 0x807d817d, 2622 - 0xb8f1f815, 0xd7610002, 2623 - 0x0000fa71, 0x807d817d, 2624 - 0xbefe00ff, 0x0000ffff, 2625 - 0xbeff0080, 0xe0685000, 2626 - 0x701d0200, 0xbefe00c1, 2594 + 0xe0685100, 0x701d0100, 2595 + 0xe0685200, 0x701d0200, 2596 + 0xe0685300, 0x701d0300, 2627 2597 0xb8f03b05, 0x80708170, 2628 2598 0xbf0d9973, 0xbfa20002, 2629 2599 0x84708970, 0xbfa00001, 2630 2600 0x84708a70, 0xb8fa1e06, 2631 2601 0x847a8a7a, 0x80707a70, 2602 + 0x8070ff70, 0x00000200, 2632 2603 0xbef600ff, 0x01000000, 2633 - 0xbef90080, 0xbefd0080, 2634 - 0xbf800000, 0xbe804100, 2635 - 0xbe824102, 0xbe844104, 2636 - 0xbe864106, 0xbe884108, 2637 - 0xbe8a410a, 0xbe8c410c, 2638 - 0xbe8e410e, 0xd7610002, 2639 - 0x0000f200, 0x80798179, 2640 - 0xd7610002, 0x0000f201, 2641 - 0x80798179, 0xd7610002, 2642 - 0x0000f202, 0x80798179, 2643 - 0xd7610002, 0x0000f203, 2644 - 0x80798179, 0xd7610002, 2645 - 0x0000f204, 0x80798179, 2646 - 0xd7610002, 0x0000f205, 2647 - 0x80798179, 0xd7610002, 2648 - 0x0000f206, 0x80798179, 2649 - 0xd7610002, 0x0000f207, 2650 - 0x80798179, 0xd7610002, 2651 - 0x0000f208, 0x80798179, 2652 - 0xd7610002, 0x0000f209, 2653 - 0x80798179, 0xd7610002, 2654 - 0x0000f20a, 0x80798179, 2655 - 0xd7610002, 0x0000f20b, 2656 - 0x80798179, 0xd7610002, 2657 - 0x0000f20c, 0x80798179, 2658 - 0xd7610002, 0x0000f20d, 2659 - 0x80798179, 0xd7610002, 2660 - 0x0000f20e, 0x80798179, 2661 - 0xd7610002, 0x0000f20f, 2662 - 0x80798179, 0xbf06a079, 2663 - 0xbfa10006, 0xe0685000, 2664 - 0x701d0200, 0x8070ff70, 2665 - 0x00000080, 0xbef90080, 2666 - 0x7e040280, 0x807d907d, 2667 - 0xbf0aff7d, 0x00000060, 2668 - 0xbfa2ffbc, 0xbe804100, 2669 - 0xbe824102, 0xbe844104, 2670 - 0xbe864106, 0xbe884108, 2671 - 0xbe8a410a, 0xd7610002, 2672 - 0x0000f200, 0x80798179, 2673 - 0xd7610002, 0x0000f201, 2674 - 0x80798179, 0xd7610002, 2675 - 0x0000f202, 0x80798179, 2676 - 0xd7610002, 0x0000f203, 2677 - 0x80798179, 0xd7610002, 2678 - 0x0000f204, 0x80798179, 2679 - 0xd7610002, 0x0000f205, 2680 - 0x80798179, 0xd7610002, 2681 - 0x0000f206, 0x80798179, 2682 - 0xd7610002, 0x0000f207, 2683 - 0x80798179, 0xd7610002, 2684 - 0x0000f208, 0x80798179, 2685 - 0xd7610002, 0x0000f209, 2686 - 0x80798179, 0xd7610002, 2687 - 0x0000f20a, 0x80798179, 2688 - 0xd7610002, 0x0000f20b, 2689 - 0x80798179, 0xe0685000, 2690 - 0x701d0200, 0xbefe00c1, 2691 - 0x857d9973, 0x8b7d817d, 2692 - 0xbf06817d, 0xbfa20002, 2693 - 0xbeff0080, 0xbfa00001, 2694 - 0xbeff00c1, 0xb8fb4306, 2695 - 0x8b7bc17b, 0xbfa10044, 2696 - 0xbfbd0000, 0x8b7aff6d, 2697 - 0x80000000, 0xbfa10040, 2698 - 0x847b867b, 0x847b827b, 2699 - 0xbef6007b, 0xb8f03b05, 2604 + 0x7e000280, 0x7e020280, 2605 + 0x7e040280, 0xbefd0080, 2606 + 0xd7610002, 0x0000fa71, 2607 + 0x807d817d, 0xd7610002, 2608 + 0x0000fa6c, 0x807d817d, 2609 + 0x917aff6d, 0x80000000, 2610 + 0xd7610002, 0x0000fa7a, 2611 + 0x807d817d, 0xd7610002, 2612 + 0x0000fa6e, 0x807d817d, 2613 + 0xd7610002, 0x0000fa6f, 2614 + 0x807d817d, 0xd7610002, 2615 + 0x0000fa78, 0x807d817d, 2616 + 0xb8faf803, 0xd7610002, 2617 + 0x0000fa7a, 0x807d817d, 2618 + 0xd7610002, 0x0000fa7b, 2619 + 0x807d817d, 0xb8f1f801, 2620 + 0xd7610002, 0x0000fa71, 2621 + 0x807d817d, 0xb8f1f814, 2622 + 0xd7610002, 0x0000fa71, 2623 + 0x807d817d, 0xb8f1f815, 2624 + 0xd7610002, 0x0000fa71, 2625 + 0x807d817d, 0xbefe00ff, 2626 + 0x0000ffff, 0xbeff0080, 2627 + 0xe0685000, 0x701d0200, 2628 + 0xbefe00c1, 0xb8f03b05, 2700 2629 0x80708170, 0xbf0d9973, 2701 2630 0xbfa20002, 0x84708970, 2702 2631 0xbfa00001, 0x84708a70, 2703 2632 0xb8fa1e06, 0x847a8a7a, 2704 - 0x80707a70, 0x8070ff70, 2705 - 0x00000200, 0x8070ff70, 2706 - 0x00000080, 0xbef600ff, 2707 - 0x01000000, 0xd71f0000, 2708 - 0x000100c1, 0xd7200000, 2709 - 0x000200c1, 0x16000084, 2710 - 0x857d9973, 0x8b7d817d, 2711 - 0xbf06817d, 0xbefd0080, 2712 - 0xbfa20012, 0xbe8300ff, 2713 - 0x00000080, 0xbf800000, 2714 - 0xbf800000, 0xbf800000, 2715 - 0xd8d80000, 0x01000000, 2716 - 0xbf890000, 0xe0685000, 2717 - 0x701d0100, 0x807d037d, 2718 - 0x80700370, 0xd5250000, 2719 - 0x0001ff00, 0x00000080, 2720 - 0xbf0a7b7d, 0xbfa2fff4, 2721 - 0xbfa00011, 0xbe8300ff, 2722 - 0x00000100, 0xbf800000, 2723 - 0xbf800000, 0xbf800000, 2724 - 0xd8d80000, 0x01000000, 2725 - 0xbf890000, 0xe0685000, 2726 - 0x701d0100, 0x807d037d, 2727 - 0x80700370, 0xd5250000, 2728 - 0x0001ff00, 0x00000100, 2729 - 0xbf0a7b7d, 0xbfa2fff4, 2633 + 0x80707a70, 0xbef600ff, 2634 + 0x01000000, 0xbef90080, 2635 + 0xbefd0080, 0xbf800000, 2636 + 0xbe804100, 0xbe824102, 2637 + 0xbe844104, 0xbe864106, 2638 + 0xbe884108, 0xbe8a410a, 2639 + 0xbe8c410c, 0xbe8e410e, 2640 + 0xd7610002, 0x0000f200, 2641 + 0x80798179, 0xd7610002, 2642 + 0x0000f201, 0x80798179, 2643 + 0xd7610002, 0x0000f202, 2644 + 0x80798179, 0xd7610002, 2645 + 0x0000f203, 0x80798179, 2646 + 0xd7610002, 0x0000f204, 2647 + 0x80798179, 0xd7610002, 2648 + 0x0000f205, 0x80798179, 2649 + 0xd7610002, 0x0000f206, 2650 + 0x80798179, 0xd7610002, 2651 + 0x0000f207, 0x80798179, 2652 + 0xd7610002, 0x0000f208, 2653 + 0x80798179, 0xd7610002, 2654 + 0x0000f209, 0x80798179, 2655 + 0xd7610002, 0x0000f20a, 2656 + 0x80798179, 0xd7610002, 2657 + 0x0000f20b, 0x80798179, 2658 + 0xd7610002, 0x0000f20c, 2659 + 0x80798179, 0xd7610002, 2660 + 0x0000f20d, 0x80798179, 2661 + 0xd7610002, 0x0000f20e, 2662 + 0x80798179, 0xd7610002, 2663 + 0x0000f20f, 0x80798179, 2664 + 0xbf06a079, 0xbfa10006, 2665 + 0xe0685000, 0x701d0200, 2666 + 0x8070ff70, 0x00000080, 2667 + 0xbef90080, 0x7e040280, 2668 + 0x807d907d, 0xbf0aff7d, 2669 + 0x00000060, 0xbfa2ffbc, 2670 + 0xbe804100, 0xbe824102, 2671 + 0xbe844104, 0xbe864106, 2672 + 0xbe884108, 0xbe8a410a, 2673 + 0xd7610002, 0x0000f200, 2674 + 0x80798179, 0xd7610002, 2675 + 0x0000f201, 0x80798179, 2676 + 0xd7610002, 0x0000f202, 2677 + 0x80798179, 0xd7610002, 2678 + 0x0000f203, 0x80798179, 2679 + 0xd7610002, 0x0000f204, 2680 + 0x80798179, 0xd7610002, 2681 + 0x0000f205, 0x80798179, 2682 + 0xd7610002, 0x0000f206, 2683 + 0x80798179, 0xd7610002, 2684 + 0x0000f207, 0x80798179, 2685 + 0xd7610002, 0x0000f208, 2686 + 0x80798179, 0xd7610002, 2687 + 0x0000f209, 0x80798179, 2688 + 0xd7610002, 0x0000f20a, 2689 + 0x80798179, 0xd7610002, 2690 + 0x0000f20b, 0x80798179, 2691 + 0xe0685000, 0x701d0200, 2730 2692 0xbefe00c1, 0x857d9973, 2731 2693 0x8b7d817d, 0xbf06817d, 2732 - 0xbfa20004, 0xbef000ff, 2733 - 0x00000200, 0xbeff0080, 2734 - 0xbfa00003, 0xbef000ff, 2735 - 0x00000400, 0xbeff00c1, 2736 - 0xb8fb3b05, 0x807b817b, 2737 - 0x847b827b, 0x857d9973, 2694 + 0xbfa20002, 0xbeff0080, 2695 + 0xbfa00001, 0xbeff00c1, 2696 + 0xb8fb4306, 0x8b7bc17b, 2697 + 0xbfa10044, 0xbfbd0000, 2698 + 0x8b7aff6d, 0x80000000, 2699 + 0xbfa10040, 0x847b867b, 2700 + 0x847b827b, 0xbef6007b, 2701 + 0xb8f03b05, 0x80708170, 2702 + 0xbf0d9973, 0xbfa20002, 2703 + 0x84708970, 0xbfa00001, 2704 + 0x84708a70, 0xb8fa1e06, 2705 + 0x847a8a7a, 0x80707a70, 2706 + 0x8070ff70, 0x00000200, 2707 + 0x8070ff70, 0x00000080, 2708 + 0xbef600ff, 0x01000000, 2709 + 0xd71f0000, 0x000100c1, 2710 + 0xd7200000, 0x000200c1, 2711 + 0x16000084, 0x857d9973, 2738 2712 0x8b7d817d, 0xbf06817d, 2739 - 0xbfa20017, 0xbef600ff, 2713 + 0xbefd0080, 0xbfa20012, 2714 + 0xbe8300ff, 0x00000080, 2715 + 0xbf800000, 0xbf800000, 2716 + 0xbf800000, 0xd8d80000, 2717 + 0x01000000, 0xbf890000, 2718 + 0xe0685000, 0x701d0100, 2719 + 0x807d037d, 0x80700370, 2720 + 0xd5250000, 0x0001ff00, 2721 + 0x00000080, 0xbf0a7b7d, 2722 + 0xbfa2fff4, 0xbfa00011, 2723 + 0xbe8300ff, 0x00000100, 2724 + 0xbf800000, 0xbf800000, 2725 + 0xbf800000, 0xd8d80000, 2726 + 0x01000000, 0xbf890000, 2727 + 0xe0685000, 0x701d0100, 2728 + 0x807d037d, 0x80700370, 2729 + 0xd5250000, 0x0001ff00, 2730 + 0x00000100, 0xbf0a7b7d, 2731 + 0xbfa2fff4, 0xbefe00c1, 2732 + 0x857d9973, 0x8b7d817d, 2733 + 0xbf06817d, 0xbfa20004, 2734 + 0xbef000ff, 0x00000200, 2735 + 0xbeff0080, 0xbfa00003, 2736 + 0xbef000ff, 0x00000400, 2737 + 0xbeff00c1, 0xb8fb3b05, 2738 + 0x807b817b, 0x847b827b, 2739 + 0x857d9973, 0x8b7d817d, 2740 + 0xbf06817d, 0xbfa20017, 2741 + 0xbef600ff, 0x01000000, 2742 + 0xbefd0084, 0xbf0a7b7d, 2743 + 0xbfa10037, 0x7e008700, 2744 + 0x7e028701, 0x7e048702, 2745 + 0x7e068703, 0xe0685000, 2746 + 0x701d0000, 0xe0685080, 2747 + 0x701d0100, 0xe0685100, 2748 + 0x701d0200, 0xe0685180, 2749 + 0x701d0300, 0x807d847d, 2750 + 0x8070ff70, 0x00000200, 2751 + 0xbf0a7b7d, 0xbfa2ffef, 2752 + 0xbfa00025, 0xbef600ff, 2740 2753 0x01000000, 0xbefd0084, 2741 - 0xbf0a7b7d, 0xbfa10037, 2754 + 0xbf0a7b7d, 0xbfa10011, 2742 2755 0x7e008700, 0x7e028701, 2743 2756 0x7e048702, 0x7e068703, 2744 2757 0xe0685000, 0x701d0000, 2745 - 0xe0685080, 0x701d0100, 2746 - 0xe0685100, 0x701d0200, 2747 - 0xe0685180, 0x701d0300, 2758 + 0xe0685100, 0x701d0100, 2759 + 0xe0685200, 0x701d0200, 2760 + 0xe0685300, 0x701d0300, 2748 2761 0x807d847d, 0x8070ff70, 2749 - 0x00000200, 0xbf0a7b7d, 2750 - 0xbfa2ffef, 0xbfa00025, 2751 - 0xbef600ff, 0x01000000, 2752 - 0xbefd0084, 0xbf0a7b7d, 2753 - 0xbfa10011, 0x7e008700, 2754 - 0x7e028701, 0x7e048702, 2755 - 0x7e068703, 0xe0685000, 2756 - 0x701d0000, 0xe0685100, 2757 - 0x701d0100, 0xe0685200, 2758 - 0x701d0200, 0xe0685300, 2759 - 0x701d0300, 0x807d847d, 2760 - 0x8070ff70, 0x00000400, 2761 - 0xbf0a7b7d, 0xbfa2ffef, 2762 - 0xb8fb1e06, 0x8b7bc17b, 2763 - 0xbfa1000c, 0x847b837b, 2764 - 0x807b7d7b, 0xbefe00c1, 2765 - 0xbeff0080, 0x7e008700, 2766 - 0xe0685000, 0x701d0000, 2767 - 0x807d817d, 0x8070ff70, 2768 - 0x00000080, 0xbf0a7b7d, 2769 - 0xbfa2fff8, 0xbfa00146, 2770 - 0xbef4007e, 0x8b75ff7f, 2771 - 0x0000ffff, 0x8c75ff75, 2772 - 0x00040000, 0xbef60080, 2773 - 0xbef700ff, 0x10807fac, 2774 - 0xb8f202dc, 0x84729972, 2775 - 0x8b6eff7f, 0x04000000, 2776 - 0xbfa1003a, 0xbefe00c1, 2777 - 0x857d9972, 0x8b7d817d, 2778 - 0xbf06817d, 0xbfa20002, 2779 - 0xbeff0080, 0xbfa00001, 2780 - 0xbeff00c1, 0xb8ef4306, 2781 - 0x8b6fc16f, 0xbfa1002f, 2782 - 0x846f866f, 0x846f826f, 2783 - 0xbef6006f, 0xb8f83b05, 2784 - 0x80788178, 0xbf0d9972, 2785 - 0xbfa20002, 0x84788978, 2786 - 0xbfa00001, 0x84788a78, 2787 - 0xb8ee1e06, 0x846e8a6e, 2788 - 0x80786e78, 0x8078ff78, 2789 - 0x00000200, 0x8078ff78, 2790 - 0x00000080, 0xbef600ff, 2791 - 0x01000000, 0x857d9972, 2792 - 0x8b7d817d, 0xbf06817d, 2793 - 0xbefd0080, 0xbfa2000c, 2794 - 0xe0500000, 0x781d0000, 2795 - 0xbf8903f7, 0xdac00000, 2796 - 0x00000000, 0x807dff7d, 2797 - 0x00000080, 0x8078ff78, 2798 - 0x00000080, 0xbf0a6f7d, 2799 - 0xbfa2fff5, 0xbfa0000b, 2800 - 0xe0500000, 0x781d0000, 2801 - 0xbf8903f7, 0xdac00000, 2802 - 0x00000000, 0x807dff7d, 2803 - 0x00000100, 0x8078ff78, 2804 - 0x00000100, 0xbf0a6f7d, 2805 - 0xbfa2fff5, 0xbef80080, 2762 + 0x00000400, 0xbf0a7b7d, 2763 + 0xbfa2ffef, 0xb8fb1e06, 2764 + 0x8b7bc17b, 0xbfa1000c, 2765 + 0x847b837b, 0x807b7d7b, 2766 + 0xbefe00c1, 0xbeff0080, 2767 + 0x7e008700, 0xe0685000, 2768 + 0x701d0000, 0x807d817d, 2769 + 0x8070ff70, 0x00000080, 2770 + 0xbf0a7b7d, 0xbfa2fff8, 2771 + 0xbfa00146, 0xbef4007e, 2772 + 0x8b75ff7f, 0x0000ffff, 2773 + 0x8c75ff75, 0x00040000, 2774 + 0xbef60080, 0xbef700ff, 2775 + 0x10807fac, 0xb8f202dc, 2776 + 0x84729972, 0x8b6eff7f, 2777 + 0x04000000, 0xbfa1003a, 2806 2778 0xbefe00c1, 0x857d9972, 2807 2779 0x8b7d817d, 0xbf06817d, 2808 2780 0xbfa20002, 0xbeff0080, 2809 2781 0xbfa00001, 0xbeff00c1, 2810 - 0xb8ef3b05, 0x806f816f, 2811 - 0x846f826f, 0x857d9972, 2812 - 0x8b7d817d, 0xbf06817d, 2813 - 0xbfa20024, 0xbef600ff, 2814 - 0x01000000, 0xbeee0078, 2815 - 0x8078ff78, 0x00000200, 2816 - 0xbefd0084, 0xbf0a6f7d, 2817 - 0xbfa10050, 0xe0505000, 2818 - 0x781d0000, 0xe0505080, 2819 - 0x781d0100, 0xe0505100, 2820 - 0x781d0200, 0xe0505180, 2821 - 0x781d0300, 0xbf8903f7, 2822 - 0x7e008500, 0x7e028501, 2823 - 0x7e048502, 0x7e068503, 2824 - 0x807d847d, 0x8078ff78, 2825 - 0x00000200, 0xbf0a6f7d, 2826 - 0xbfa2ffee, 0xe0505000, 2827 - 0x6e1d0000, 0xe0505080, 2828 - 0x6e1d0100, 0xe0505100, 2829 - 0x6e1d0200, 0xe0505180, 2830 - 0x6e1d0300, 0xbf8903f7, 2831 - 0xbfa00034, 0xbef600ff, 2832 - 0x01000000, 0xbeee0078, 2833 - 0x8078ff78, 0x00000400, 2834 - 0xbefd0084, 0xbf0a6f7d, 2835 - 0xbfa10012, 0xe0505000, 2836 - 0x781d0000, 0xe0505100, 2837 - 0x781d0100, 0xe0505200, 2838 - 0x781d0200, 0xe0505300, 2839 - 0x781d0300, 0xbf8903f7, 2840 - 0x7e008500, 0x7e028501, 2841 - 0x7e048502, 0x7e068503, 2842 - 0x807d847d, 0x8078ff78, 2843 - 0x00000400, 0xbf0a6f7d, 2844 - 0xbfa2ffee, 0xb8ef1e06, 2845 - 0x8b6fc16f, 0xbfa1000e, 2846 - 0x846f836f, 0x806f7d6f, 2847 - 0xbefe00c1, 0xbeff0080, 2848 - 0xe0505000, 0x781d0000, 2849 - 0xbf8903f7, 0x7e008500, 2850 - 0x807d817d, 0x8078ff78, 2851 - 0x00000080, 0xbf0a6f7d, 2852 - 0xbfa2fff7, 0xbeff00c1, 2853 - 0xe0505000, 0x6e1d0000, 2854 - 0xe0505100, 0x6e1d0100, 2855 - 0xe0505200, 0x6e1d0200, 2856 - 0xe0505300, 0x6e1d0300, 2857 - 0xbf8903f7, 0xb8f83b05, 2858 - 0x80788178, 0xbf0d9972, 2859 - 0xbfa20002, 0x84788978, 2860 - 0xbfa00001, 0x84788a78, 2861 - 0xb8ee1e06, 0x846e8a6e, 2862 - 0x80786e78, 0x8078ff78, 2863 - 0x00000200, 0x80f8ff78, 2864 - 0x00000050, 0xbef600ff, 2865 - 0x01000000, 0xbefd00ff, 2866 - 0x0000006c, 0x80f89078, 2867 - 0xf428403a, 0xf0000000, 2868 - 0xbf89fc07, 0x80fd847d, 2869 - 0xbf800000, 0xbe804300, 2870 - 0xbe824302, 0x80f8a078, 2871 - 0xf42c403a, 0xf0000000, 2872 - 0xbf89fc07, 0x80fd887d, 2873 - 0xbf800000, 0xbe804300, 2874 - 0xbe824302, 0xbe844304, 2875 - 0xbe864306, 0x80f8c078, 2876 - 0xf430403a, 0xf0000000, 2877 - 0xbf89fc07, 0x80fd907d, 2878 - 0xbf800000, 0xbe804300, 2879 - 0xbe824302, 0xbe844304, 2880 - 0xbe864306, 0xbe884308, 2881 - 0xbe8a430a, 0xbe8c430c, 2882 - 0xbe8e430e, 0xbf06807d, 2883 - 0xbfa1fff0, 0xb980f801, 2884 - 0x00000000, 0xbfbd0000, 2782 + 0xb8ef4306, 0x8b6fc16f, 2783 + 0xbfa1002f, 0x846f866f, 2784 + 0x846f826f, 0xbef6006f, 2885 2785 0xb8f83b05, 0x80788178, 2886 2786 0xbf0d9972, 0xbfa20002, 2887 2787 0x84788978, 0xbfa00001, 2888 2788 0x84788a78, 0xb8ee1e06, 2889 2789 0x846e8a6e, 0x80786e78, 2890 2790 0x8078ff78, 0x00000200, 2791 + 0x8078ff78, 0x00000080, 2891 2792 0xbef600ff, 0x01000000, 2892 - 0xf4205bfa, 0xf0000000, 2893 - 0x80788478, 0xf4205b3a, 2793 + 0x857d9972, 0x8b7d817d, 2794 + 0xbf06817d, 0xbefd0080, 2795 + 0xbfa2000c, 0xe0500000, 2796 + 0x781d0000, 0xbf8903f7, 2797 + 0xdac00000, 0x00000000, 2798 + 0x807dff7d, 0x00000080, 2799 + 0x8078ff78, 0x00000080, 2800 + 0xbf0a6f7d, 0xbfa2fff5, 2801 + 0xbfa0000b, 0xe0500000, 2802 + 0x781d0000, 0xbf8903f7, 2803 + 0xdac00000, 0x00000000, 2804 + 0x807dff7d, 0x00000100, 2805 + 0x8078ff78, 0x00000100, 2806 + 0xbf0a6f7d, 0xbfa2fff5, 2807 + 0xbef80080, 0xbefe00c1, 2808 + 0x857d9972, 0x8b7d817d, 2809 + 0xbf06817d, 0xbfa20002, 2810 + 0xbeff0080, 0xbfa00001, 2811 + 0xbeff00c1, 0xb8ef3b05, 2812 + 0x806f816f, 0x846f826f, 2813 + 0x857d9972, 0x8b7d817d, 2814 + 0xbf06817d, 0xbfa20024, 2815 + 0xbef600ff, 0x01000000, 2816 + 0xbeee0078, 0x8078ff78, 2817 + 0x00000200, 0xbefd0084, 2818 + 0xbf0a6f7d, 0xbfa10050, 2819 + 0xe0505000, 0x781d0000, 2820 + 0xe0505080, 0x781d0100, 2821 + 0xe0505100, 0x781d0200, 2822 + 0xe0505180, 0x781d0300, 2823 + 0xbf8903f7, 0x7e008500, 2824 + 0x7e028501, 0x7e048502, 2825 + 0x7e068503, 0x807d847d, 2826 + 0x8078ff78, 0x00000200, 2827 + 0xbf0a6f7d, 0xbfa2ffee, 2828 + 0xe0505000, 0x6e1d0000, 2829 + 0xe0505080, 0x6e1d0100, 2830 + 0xe0505100, 0x6e1d0200, 2831 + 0xe0505180, 0x6e1d0300, 2832 + 0xbf8903f7, 0xbfa00034, 2833 + 0xbef600ff, 0x01000000, 2834 + 0xbeee0078, 0x8078ff78, 2835 + 0x00000400, 0xbefd0084, 2836 + 0xbf0a6f7d, 0xbfa10012, 2837 + 0xe0505000, 0x781d0000, 2838 + 0xe0505100, 0x781d0100, 2839 + 0xe0505200, 0x781d0200, 2840 + 0xe0505300, 0x781d0300, 2841 + 0xbf8903f7, 0x7e008500, 2842 + 0x7e028501, 0x7e048502, 2843 + 0x7e068503, 0x807d847d, 2844 + 0x8078ff78, 0x00000400, 2845 + 0xbf0a6f7d, 0xbfa2ffee, 2846 + 0xb8ef1e06, 0x8b6fc16f, 2847 + 0xbfa1000e, 0x846f836f, 2848 + 0x806f7d6f, 0xbefe00c1, 2849 + 0xbeff0080, 0xe0505000, 2850 + 0x781d0000, 0xbf8903f7, 2851 + 0x7e008500, 0x807d817d, 2852 + 0x8078ff78, 0x00000080, 2853 + 0xbf0a6f7d, 0xbfa2fff7, 2854 + 0xbeff00c1, 0xe0505000, 2855 + 0x6e1d0000, 0xe0505100, 2856 + 0x6e1d0100, 0xe0505200, 2857 + 0x6e1d0200, 0xe0505300, 2858 + 0x6e1d0300, 0xbf8903f7, 2859 + 0xb8f83b05, 0x80788178, 2860 + 0xbf0d9972, 0xbfa20002, 2861 + 0x84788978, 0xbfa00001, 2862 + 0x84788a78, 0xb8ee1e06, 2863 + 0x846e8a6e, 0x80786e78, 2864 + 0x8078ff78, 0x00000200, 2865 + 0x80f8ff78, 0x00000050, 2866 + 0xbef600ff, 0x01000000, 2867 + 0xbefd00ff, 0x0000006c, 2868 + 0x80f89078, 0xf428403a, 2869 + 0xf0000000, 0xbf89fc07, 2870 + 0x80fd847d, 0xbf800000, 2871 + 0xbe804300, 0xbe824302, 2872 + 0x80f8a078, 0xf42c403a, 2873 + 0xf0000000, 0xbf89fc07, 2874 + 0x80fd887d, 0xbf800000, 2875 + 0xbe804300, 0xbe824302, 2876 + 0xbe844304, 0xbe864306, 2877 + 0x80f8c078, 0xf430403a, 2878 + 0xf0000000, 0xbf89fc07, 2879 + 0x80fd907d, 0xbf800000, 2880 + 0xbe804300, 0xbe824302, 2881 + 0xbe844304, 0xbe864306, 2882 + 0xbe884308, 0xbe8a430a, 2883 + 0xbe8c430c, 0xbe8e430e, 2884 + 0xbf06807d, 0xbfa1fff0, 2885 + 0xb980f801, 0x00000000, 2886 + 0xbfbd0000, 0xb8f83b05, 2887 + 0x80788178, 0xbf0d9972, 2888 + 0xbfa20002, 0x84788978, 2889 + 0xbfa00001, 0x84788a78, 2890 + 0xb8ee1e06, 0x846e8a6e, 2891 + 0x80786e78, 0x8078ff78, 2892 + 0x00000200, 0xbef600ff, 2893 + 0x01000000, 0xf4205bfa, 2894 2894 0xf0000000, 0x80788478, 2895 - 0xf4205b7a, 0xf0000000, 2896 - 0x80788478, 0xf4205c3a, 2895 + 0xf4205b3a, 0xf0000000, 2896 + 0x80788478, 0xf4205b7a, 2897 2897 0xf0000000, 0x80788478, 2898 - 0xf4205c7a, 0xf0000000, 2899 - 0x80788478, 0xf4205eba, 2898 + 0xf4205c3a, 0xf0000000, 2899 + 0x80788478, 0xf4205c7a, 2900 2900 0xf0000000, 0x80788478, 2901 - 0xf4205efa, 0xf0000000, 2902 - 0x80788478, 0xf4205e7a, 2901 + 0xf4205eba, 0xf0000000, 2902 + 0x80788478, 0xf4205efa, 2903 2903 0xf0000000, 0x80788478, 2904 - 0xf4205cfa, 0xf0000000, 2905 - 0x80788478, 0xf4205bba, 2904 + 0xf4205e7a, 0xf0000000, 2905 + 0x80788478, 0xf4205cfa, 2906 2906 0xf0000000, 0x80788478, 2907 - 0xbf89fc07, 0xb96ef814, 2908 2907 0xf4205bba, 0xf0000000, 2909 2908 0x80788478, 0xbf89fc07, 2910 - 0xb96ef815, 0xbefd006f, 2911 - 0xbefe0070, 0xbeff0071, 2912 - 0x8b6f7bff, 0x000003ff, 2913 - 0xb96f4803, 0x8b6f7bff, 2914 - 0xfffff800, 0x856f8b6f, 2915 - 0xb96fa2c3, 0xb973f801, 2916 - 0xb8ee3b05, 0x806e816e, 2917 - 0xbf0d9972, 0xbfa20002, 2918 - 0x846e896e, 0xbfa00001, 2919 - 0x846e8a6e, 0xb8ef1e06, 2920 - 0x846f8a6f, 0x806e6f6e, 2921 - 0x806eff6e, 0x00000200, 2922 - 0x806e746e, 0x826f8075, 2923 - 0x8b6fff6f, 0x0000ffff, 2924 - 0xf4085c37, 0xf8000050, 2925 - 0xf4085d37, 0xf8000060, 2926 - 0xf4005e77, 0xf8000074, 2927 - 0xbf89fc07, 0x8b6dff6d, 2928 - 0x0000ffff, 0x8bfe7e7e, 2929 - 0x8bea6a6a, 0xb8eef802, 2930 - 0xbf0d866e, 0xbfa20002, 2931 - 0xb97af802, 0xbe80486c, 2932 - 0xb97af802, 0xbe804a6c, 2933 - 0xbfb00000, 0xbf9f0000, 2909 + 0xb96ef814, 0xf4205bba, 2910 + 0xf0000000, 0x80788478, 2911 + 0xbf89fc07, 0xb96ef815, 2912 + 0xbefd006f, 0xbefe0070, 2913 + 0xbeff0071, 0x8b6f7bff, 2914 + 0x000003ff, 0xb96f4803, 2915 + 0x8b6f7bff, 0xfffff800, 2916 + 0x856f8b6f, 0xb96fa2c3, 2917 + 0xb973f801, 0xb8ee3b05, 2918 + 0x806e816e, 0xbf0d9972, 2919 + 0xbfa20002, 0x846e896e, 2920 + 0xbfa00001, 0x846e8a6e, 2921 + 0xb8ef1e06, 0x846f8a6f, 2922 + 0x806e6f6e, 0x806eff6e, 2923 + 0x00000200, 0x806e746e, 2924 + 0x826f8075, 0x8b6fff6f, 2925 + 0x0000ffff, 0xf4085c37, 2926 + 0xf8000050, 0xf4085d37, 2927 + 0xf8000060, 0xf4005e77, 2928 + 0xf8000074, 0xbf89fc07, 2929 + 0x8b6dff6d, 0x0000ffff, 2930 + 0x8bfe7e7e, 0x8bea6a6a, 2931 + 0xb8eef802, 0xbf0d866e, 2932 + 0xbfa20002, 0xb97af802, 2933 + 0xbe80486c, 0xb97af802, 2934 + 0xbe804a6c, 0xbfb00000, 2934 2935 0xbf9f0000, 0xbf9f0000, 2935 2936 0xbf9f0000, 0xbf9f0000, 2937 + 0xbf9f0000, 0x00000000, 2936 2938 };
+6
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
··· 186 186 s_getreg_b32 s_save_trapsts, hwreg(HW_REG_TRAPSTS) 187 187 188 188 #if SW_SA_TRAP 189 + // If ttmp1[30] is set then issue s_barrier to unblock dependent waves. 190 + s_bitcmp1_b32 s_save_pc_hi, 30 191 + s_cbranch_scc0 L_TRAP_NO_BARRIER 192 + s_barrier 193 + 194 + L_TRAP_NO_BARRIER: 189 195 // If ttmp1[31] is set then trap may occur early. 190 196 // Spin wait until SAVECTX exception is raised. 191 197 s_bitcmp1_b32 s_save_pc_hi, 31
+1 -3
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 973 973 out_unlock_svms: 974 974 mutex_unlock(&p->svms.lock); 975 975 out_unref_process: 976 + pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); 976 977 kfd_unref_process(p); 977 978 out_mmput: 978 979 mmput(mm); 979 - 980 - pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); 981 - 982 980 return r ? VM_FAULT_SIGBUS : 0; 983 981 } 984 982
+3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 1549 1549 1550 1550 adev->dm.dc->debug.visual_confirm = amdgpu_dc_visual_confirm; 1551 1551 1552 + /* TODO: Remove after DP2 receiver gets proper support of Cable ID feature */ 1553 + adev->dm.dc->debug.ignore_cable_id = true; 1554 + 1552 1555 r = dm_dmub_hw_init(adev); 1553 1556 if (r) { 1554 1557 DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r);
+7 -4
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
··· 157 157 struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base); 158 158 unsigned int num_levels; 159 159 struct clk_limit_num_entries *num_entries_per_clk = &clk_mgr_base->bw_params->clk_table.num_entries_per_clk; 160 + unsigned int i; 160 161 161 162 memset(&(clk_mgr_base->clks), 0, sizeof(struct dc_clocks)); 162 163 clk_mgr_base->clks.p_state_change_support = true; ··· 206 205 clk_mgr->dpm_present = true; 207 206 208 207 if (clk_mgr_base->ctx->dc->debug.min_disp_clk_khz) { 209 - unsigned int i; 210 - 211 208 for (i = 0; i < num_levels; i++) 212 209 if (clk_mgr_base->bw_params->clk_table.entries[i].dispclk_mhz 213 210 < khz_to_mhz_ceil(clk_mgr_base->ctx->dc->debug.min_disp_clk_khz)) 214 211 clk_mgr_base->bw_params->clk_table.entries[i].dispclk_mhz 215 212 = khz_to_mhz_ceil(clk_mgr_base->ctx->dc->debug.min_disp_clk_khz); 216 213 } 214 + for (i = 0; i < num_levels; i++) 215 + if (clk_mgr_base->bw_params->clk_table.entries[i].dispclk_mhz > 1950) 216 + clk_mgr_base->bw_params->clk_table.entries[i].dispclk_mhz = 1950; 217 217 218 218 if (clk_mgr_base->ctx->dc->debug.min_dpp_clk_khz) { 219 - unsigned int i; 220 - 221 219 for (i = 0; i < num_levels; i++) 222 220 if (clk_mgr_base->bw_params->clk_table.entries[i].dppclk_mhz 223 221 < khz_to_mhz_ceil(clk_mgr_base->ctx->dc->debug.min_dpp_clk_khz)) ··· 668 668 dcn32_init_single_clock(clk_mgr, PPCLK_UCLK, 669 669 &clk_mgr_base->bw_params->clk_table.entries[0].memclk_mhz, 670 670 &num_entries_per_clk->num_memclk_levels); 671 + 672 + /* memclk must have at least one level */ 673 + num_entries_per_clk->num_memclk_levels = num_entries_per_clk->num_memclk_levels ? num_entries_per_clk->num_memclk_levels : 1; 671 674 672 675 dcn32_init_single_clock(clk_mgr, PPCLK_FCLK, 673 676 &clk_mgr_base->bw_params->clk_table.entries[0].fclk_mhz,
+1
drivers/gpu/drm/amd/display/dc/dc.h
··· 852 852 bool enable_double_buffered_dsc_pg_support; 853 853 bool enable_dp_dig_pixel_rate_div_policy; 854 854 enum lttpr_mode lttpr_mode_override; 855 + unsigned int dsc_delay_factor_wa_x1000; 855 856 }; 856 857 857 858 struct gpu_info_soc_bounding_box_v1_0;
+4
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c
··· 623 623 hubp->att.size.bits.width = attr->width; 624 624 hubp->att.size.bits.height = attr->height; 625 625 hubp->att.cur_ctl.bits.mode = attr->color_format; 626 + 627 + hubp->cur_rect.w = attr->width; 628 + hubp->cur_rect.h = attr->height; 629 + 626 630 hubp->att.cur_ctl.bits.pitch = hw_pitch; 627 631 hubp->att.cur_ctl.bits.line_per_chunk = lpc; 628 632 hubp->att.cur_ctl.bits.cur_2x_magnify = attr->attribute_flags.bits.ENABLE_MAGNIFICATION;
+1 -1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
··· 847 847 .num_ddc = 5, 848 848 .num_vmid = 16, 849 849 .num_mpc_3dlut = 2, 850 - .num_dsc = 3, 850 + .num_dsc = 4, 851 851 }; 852 852 853 853 static const struct dc_plane_cap plane_cap = {
+1
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
··· 1228 1228 pipes[pipe_cnt].pipe.src.dcc = false; 1229 1229 pipes[pipe_cnt].pipe.src.dcc_rate = 1; 1230 1230 pipes[pipe_cnt].pipe.dest.synchronized_vblank_all_planes = synchronized_vblank; 1231 + pipes[pipe_cnt].pipe.dest.synchronize_timings = synchronized_vblank; 1231 1232 pipes[pipe_cnt].pipe.dest.hblank_start = timing->h_total - timing->h_front_porch; 1232 1233 pipes[pipe_cnt].pipe.dest.hblank_end = pipes[pipe_cnt].pipe.dest.hblank_start 1233 1234 - timing->h_addressable
+3 -1
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
··· 2359 2359 2360 2360 if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes) 2361 2361 dcn3_2_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes; 2362 - 2363 2362 } 2363 + 2364 + /* DML DSC delay factor workaround */ 2365 + dcn3_2_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0; 2364 2366 2365 2367 /* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */ 2366 2368 dcn3_2_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+6 -4
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
··· 364 364 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) { 365 365 v->DSCDelay[k] = dml32_DSCDelayRequirement(mode_lib->vba.DSCEnabled[k], 366 366 mode_lib->vba.ODMCombineEnabled[k], mode_lib->vba.DSCInputBitPerComponent[k], 367 - mode_lib->vba.OutputBpp[k], mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k], 367 + mode_lib->vba.OutputBppPerState[mode_lib->vba.VoltageLevel][k], 368 + mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k], 368 369 mode_lib->vba.NumberOfDSCSlices[k], mode_lib->vba.OutputFormat[k], 369 370 mode_lib->vba.Output[k], mode_lib->vba.PixelClock[k], 370 - mode_lib->vba.PixelClockBackEnd[k]); 371 + mode_lib->vba.PixelClockBackEnd[k], mode_lib->vba.ip.dsc_delay_factor_wa); 371 372 } 372 373 373 374 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) ··· 1628 1627 && !mode_lib->vba.MSOOrODMSplitWithNonDPLink 1629 1628 && !mode_lib->vba.NotEnoughLanesForMSO 1630 1629 && mode_lib->vba.LinkCapacitySupport[i] == true && !mode_lib->vba.P2IWith420 1631 - && !mode_lib->vba.DSCOnlyIfNecessaryWithBPP 1630 + //&& !mode_lib->vba.DSCOnlyIfNecessaryWithBPP 1632 1631 && !mode_lib->vba.DSC422NativeNotSupported 1633 1632 && !mode_lib->vba.MPCCombineMethodIncompatible 1634 1633 && mode_lib->vba.ODMCombine2To1SupportCheckOK[i] == true ··· 2476 2475 mode_lib->vba.OutputBppPerState[i][k], mode_lib->vba.HActive[k], 2477 2476 mode_lib->vba.HTotal[k], mode_lib->vba.NumberOfDSCSlices[k], 2478 2477 mode_lib->vba.OutputFormat[k], mode_lib->vba.Output[k], 2479 - mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k]); 2478 + mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k], 2479 + mode_lib->vba.ip.dsc_delay_factor_wa); 2480 2480 } 2481 2481 2482 2482 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
+4 -3
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
··· 1726 1726 enum output_format_class OutputFormat, 1727 1727 enum output_encoder_class Output, 1728 1728 double PixelClock, 1729 - double PixelClockBackEnd) 1729 + double PixelClockBackEnd, 1730 + double dsc_delay_factor_wa) 1730 1731 { 1731 1732 unsigned int DSCDelayRequirement_val; 1732 1733 ··· 1747 1746 } 1748 1747 1749 1748 DSCDelayRequirement_val = DSCDelayRequirement_val + (HTotal - HActive) * 1750 - dml_ceil(DSCDelayRequirement_val / HActive, 1); 1749 + dml_ceil((double)DSCDelayRequirement_val / HActive, 1); 1751 1750 1752 1751 DSCDelayRequirement_val = DSCDelayRequirement_val * PixelClock / PixelClockBackEnd; 1753 1752 ··· 1765 1764 dml_print("DML::%s: DSCDelayRequirement_val = %d\n", __func__, DSCDelayRequirement_val); 1766 1765 #endif 1767 1766 1768 - return DSCDelayRequirement_val; 1767 + return dml_ceil(DSCDelayRequirement_val * dsc_delay_factor_wa, 1); 1769 1768 } 1770 1769 1771 1770 void dml32_CalculateSurfaceSizeInMall(
+2 -1
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
··· 327 327 enum output_format_class OutputFormat, 328 328 enum output_encoder_class Output, 329 329 double PixelClock, 330 - double PixelClockBackEnd); 330 + double PixelClockBackEnd, 331 + double dsc_delay_factor_wa); 331 332 332 333 void dml32_CalculateSurfaceSizeInMall( 333 334 unsigned int NumberOfActiveSurfaces,
+2 -2
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c
··· 291 291 292 292 dml_print("DML_DLG: %s: vready_after_vcount0 = %d\n", __func__, dlg_regs->vready_after_vcount0); 293 293 294 - dst_x_after_scaler = get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); 295 - dst_y_after_scaler = get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); 294 + dst_x_after_scaler = dml_ceil(get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx), 1); 295 + dst_y_after_scaler = dml_ceil(get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx), 1); 296 296 297 297 // do some adjustment on the dst_after scaler to account for odm combine mode 298 298 dml_print("DML_DLG: %s: input dst_x_after_scaler = %d\n", __func__, dst_x_after_scaler);
+9 -6
drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c
··· 29 29 #include "dcn321_fpu.h" 30 30 #include "dcn32/dcn32_resource.h" 31 31 #include "dcn321/dcn321_resource.h" 32 + #include "dml/dcn32/display_mode_vba_util_32.h" 32 33 33 34 #define DCN3_2_DEFAULT_DET_SIZE 256 34 35 ··· 120 119 }, 121 120 }, 122 121 .num_states = 1, 123 - .sr_exit_time_us = 12.36, 124 - .sr_enter_plus_exit_time_us = 16.72, 122 + .sr_exit_time_us = 19.95, 123 + .sr_enter_plus_exit_time_us = 24.36, 125 124 .sr_exit_z8_time_us = 285.0, 126 125 .sr_enter_plus_exit_z8_time_us = 320, 127 126 .writeback_latency_us = 12.0, 128 127 .round_trip_ping_latency_dcfclk_cycles = 263, 129 - .urgent_latency_pixel_data_only_us = 4.0, 130 - .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, 131 - .urgent_latency_vm_data_only_us = 4.0, 128 + .urgent_latency_pixel_data_only_us = 9.35, 129 + .urgent_latency_pixel_mixed_with_vm_data_us = 9.35, 130 + .urgent_latency_vm_data_only_us = 9.35, 132 131 .fclk_change_latency_us = 20, 133 132 .usr_retraining_latency_us = 2, 134 133 .smn_latency_us = 2, ··· 539 538 540 539 if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes) 541 540 dcn3_21_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes; 542 - 543 541 } 542 + 543 + /* DML DSC delay factor workaround */ 544 + dcn3_21_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0; 544 545 545 546 /* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */ 546 547 dcn3_21_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+3
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h
··· 364 364 unsigned int max_num_dp2p0_outputs; 365 365 unsigned int max_num_dp2p0_streams; 366 366 unsigned int VBlankNomDefaultUS; 367 + 368 + /* DM workarounds */ 369 + double dsc_delay_factor_wa; // TODO: Remove after implementing root cause fix 367 370 }; 368 371 369 372 struct _vcs_dpi_display_xfc_params_st {
+1 -1
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c
··· 625 625 mode_lib->vba.skip_dio_check[mode_lib->vba.NumberOfActivePlanes] = 626 626 dout->is_virtual; 627 627 628 - if (!dout->dsc_enable) 628 + if (dout->dsc_enable) 629 629 mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = dout->output_bpp; 630 630 else 631 631 mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = 0.0;
+47 -19
drivers/gpu/drm/drm_format_helper.c
··· 807 807 return false; 808 808 } 809 809 810 + static const uint32_t conv_from_xrgb8888[] = { 811 + DRM_FORMAT_XRGB8888, 812 + DRM_FORMAT_ARGB8888, 813 + DRM_FORMAT_XRGB2101010, 814 + DRM_FORMAT_ARGB2101010, 815 + DRM_FORMAT_RGB565, 816 + DRM_FORMAT_RGB888, 817 + }; 818 + 819 + static const uint32_t conv_from_rgb565_888[] = { 820 + DRM_FORMAT_XRGB8888, 821 + DRM_FORMAT_ARGB8888, 822 + }; 823 + 824 + static bool is_conversion_supported(uint32_t from, uint32_t to) 825 + { 826 + switch (from) { 827 + case DRM_FORMAT_XRGB8888: 828 + case DRM_FORMAT_ARGB8888: 829 + return is_listed_fourcc(conv_from_xrgb8888, ARRAY_SIZE(conv_from_xrgb8888), to); 830 + case DRM_FORMAT_RGB565: 831 + case DRM_FORMAT_RGB888: 832 + return is_listed_fourcc(conv_from_rgb565_888, ARRAY_SIZE(conv_from_rgb565_888), to); 833 + case DRM_FORMAT_XRGB2101010: 834 + return to == DRM_FORMAT_ARGB2101010; 835 + case DRM_FORMAT_ARGB2101010: 836 + return to == DRM_FORMAT_XRGB2101010; 837 + default: 838 + return false; 839 + } 840 + } 841 + 810 842 /** 811 843 * drm_fb_build_fourcc_list - Filters a list of supported color formats against 812 844 * the device's native formats ··· 859 827 * be handed over to drm_universal_plane_init() et al. Native formats 860 828 * will go before emulated formats. Other heuristics might be applied 861 829 * to optimize the order. Formats near the beginning of the list are 862 - * usually preferred over formats near the end of the list. 830 + * usually preferred over formats near the end of the list. Formats 831 + * without conversion helpers will be skipped. New drivers should only 832 + * pass in XRGB8888 and avoid exposing additional emulated formats. 863 833 * 864 834 * Returns: 865 835 * The number of color-formats 4CC codes returned in @fourccs_out. ··· 873 839 { 874 840 u32 *fourccs = fourccs_out; 875 841 const u32 *fourccs_end = fourccs_out + nfourccs_out; 876 - bool found_native = false; 842 + uint32_t native_format = 0; 877 843 size_t i; 878 844 879 845 /* ··· 892 858 893 859 drm_dbg_kms(dev, "adding native format %p4cc\n", &fourcc); 894 860 895 - if (!found_native) 896 - found_native = is_listed_fourcc(driver_fourccs, driver_nfourccs, fourcc); 861 + /* 862 + * There should only be one native format with the current API. 863 + * This API needs to be refactored to correctly support arbitrary 864 + * sets of native formats, since it needs to report which native 865 + * format to use for each emulated format. 866 + */ 867 + if (!native_format) 868 + native_format = fourcc; 897 869 *fourccs = fourcc; 898 870 ++fourccs; 899 - } 900 - 901 - /* 902 - * The plane's atomic_update helper converts the framebuffer's color format 903 - * to a native format when copying to device memory. 904 - * 905 - * If there is not a single format supported by both, device and 906 - * driver, the native formats are likely not supported by the conversion 907 - * helpers. Therefore *only* support the native formats and add a 908 - * conversion helper ASAP. 909 - */ 910 - if (!found_native) { 911 - drm_warn(dev, "Format conversion helpers required to add extra formats.\n"); 912 - goto out; 913 871 } 914 872 915 873 /* ··· 916 890 } else if (fourccs == fourccs_end) { 917 891 drm_warn(dev, "Ignoring emulated format %p4cc\n", &fourcc); 918 892 continue; /* end of available output buffer */ 893 + } else if (!is_conversion_supported(fourcc, native_format)) { 894 + drm_dbg_kms(dev, "Unsupported emulated format %p4cc\n", &fourcc); 895 + continue; /* format is not supported for conversion */ 919 896 } 920 897 921 898 drm_dbg_kms(dev, "adding emulated format %p4cc\n", &fourcc); ··· 927 898 ++fourccs; 928 899 } 929 900 930 - out: 931 901 return fourccs - fourccs_out; 932 902 } 933 903 EXPORT_SYMBOL(drm_fb_build_fourcc_list);
+1
drivers/gpu/drm/i915/Makefile
··· 282 282 display/intel_ddi.o \ 283 283 display/intel_ddi_buf_trans.o \ 284 284 display/intel_display_trace.o \ 285 + display/intel_dkl_phy.o \ 285 286 display/intel_dp.o \ 286 287 display/intel_dp_aux.o \ 287 288 display/intel_dp_aux_backlight.o \
+28 -40
drivers/gpu/drm/i915/display/intel_ddi.c
··· 43 43 #include "intel_de.h" 44 44 #include "intel_display_power.h" 45 45 #include "intel_display_types.h" 46 + #include "intel_dkl_phy.h" 46 47 #include "intel_dp.h" 47 48 #include "intel_dp_link_training.h" 48 49 #include "intel_dp_mst.h" ··· 1263 1262 for (ln = 0; ln < 2; ln++) { 1264 1263 int level; 1265 1264 1266 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 1267 - HIP_INDEX_VAL(tc_port, ln)); 1268 - 1269 - intel_de_write(dev_priv, DKL_TX_PMD_LANE_SUS(tc_port), 0); 1265 + intel_dkl_phy_write(dev_priv, DKL_TX_PMD_LANE_SUS(tc_port), ln, 0); 1270 1266 1271 1267 level = intel_ddi_level(encoder, crtc_state, 2*ln+0); 1272 1268 1273 - intel_de_rmw(dev_priv, DKL_TX_DPCNTL0(tc_port), 1274 - DKL_TX_PRESHOOT_COEFF_MASK | 1275 - DKL_TX_DE_EMPAHSIS_COEFF_MASK | 1276 - DKL_TX_VSWING_CONTROL_MASK, 1277 - DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) | 1278 - DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) | 1279 - DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing)); 1269 + intel_dkl_phy_rmw(dev_priv, DKL_TX_DPCNTL0(tc_port), ln, 1270 + DKL_TX_PRESHOOT_COEFF_MASK | 1271 + DKL_TX_DE_EMPAHSIS_COEFF_MASK | 1272 + DKL_TX_VSWING_CONTROL_MASK, 1273 + DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) | 1274 + DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) | 1275 + DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing)); 1280 1276 1281 1277 level = intel_ddi_level(encoder, crtc_state, 2*ln+1); 1282 1278 1283 - intel_de_rmw(dev_priv, DKL_TX_DPCNTL1(tc_port), 1284 - DKL_TX_PRESHOOT_COEFF_MASK | 1285 - DKL_TX_DE_EMPAHSIS_COEFF_MASK | 1286 - DKL_TX_VSWING_CONTROL_MASK, 1287 - DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) | 1288 - DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) | 1289 - DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing)); 1279 + intel_dkl_phy_rmw(dev_priv, DKL_TX_DPCNTL1(tc_port), ln, 1280 + DKL_TX_PRESHOOT_COEFF_MASK | 1281 + DKL_TX_DE_EMPAHSIS_COEFF_MASK | 1282 + DKL_TX_VSWING_CONTROL_MASK, 1283 + DKL_TX_PRESHOOT_COEFF(trans->entries[level].dkl.preshoot) | 1284 + DKL_TX_DE_EMPHASIS_COEFF(trans->entries[level].dkl.de_emphasis) | 1285 + DKL_TX_VSWING_CONTROL(trans->entries[level].dkl.vswing)); 1290 1286 1291 - intel_de_rmw(dev_priv, DKL_TX_DPCNTL2(tc_port), 1292 - DKL_TX_DP20BITMODE, 0); 1287 + intel_dkl_phy_rmw(dev_priv, DKL_TX_DPCNTL2(tc_port), ln, 1288 + DKL_TX_DP20BITMODE, 0); 1293 1289 1294 1290 if (IS_ALDERLAKE_P(dev_priv)) { 1295 1291 u32 val; ··· 1304 1306 val |= DKL_TX_DPCNTL2_CFG_LOADGENSELECT_TX2(0); 1305 1307 } 1306 1308 1307 - intel_de_rmw(dev_priv, DKL_TX_DPCNTL2(tc_port), 1308 - DKL_TX_DPCNTL2_CFG_LOADGENSELECT_TX1_MASK | 1309 - DKL_TX_DPCNTL2_CFG_LOADGENSELECT_TX2_MASK, 1310 - val); 1309 + intel_dkl_phy_rmw(dev_priv, DKL_TX_DPCNTL2(tc_port), ln, 1310 + DKL_TX_DPCNTL2_CFG_LOADGENSELECT_TX1_MASK | 1311 + DKL_TX_DPCNTL2_CFG_LOADGENSELECT_TX2_MASK, 1312 + val); 1311 1313 } 1312 1314 } 1313 1315 } ··· 2017 2019 return; 2018 2020 2019 2021 if (DISPLAY_VER(dev_priv) >= 12) { 2020 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 2021 - HIP_INDEX_VAL(tc_port, 0x0)); 2022 - ln0 = intel_de_read(dev_priv, DKL_DP_MODE(tc_port)); 2023 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 2024 - HIP_INDEX_VAL(tc_port, 0x1)); 2025 - ln1 = intel_de_read(dev_priv, DKL_DP_MODE(tc_port)); 2022 + ln0 = intel_dkl_phy_read(dev_priv, DKL_DP_MODE(tc_port), 0); 2023 + ln1 = intel_dkl_phy_read(dev_priv, DKL_DP_MODE(tc_port), 1); 2026 2024 } else { 2027 2025 ln0 = intel_de_read(dev_priv, MG_DP_MODE(0, tc_port)); 2028 2026 ln1 = intel_de_read(dev_priv, MG_DP_MODE(1, tc_port)); ··· 2079 2085 } 2080 2086 2081 2087 if (DISPLAY_VER(dev_priv) >= 12) { 2082 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 2083 - HIP_INDEX_VAL(tc_port, 0x0)); 2084 - intel_de_write(dev_priv, DKL_DP_MODE(tc_port), ln0); 2085 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 2086 - HIP_INDEX_VAL(tc_port, 0x1)); 2087 - intel_de_write(dev_priv, DKL_DP_MODE(tc_port), ln1); 2088 + intel_dkl_phy_write(dev_priv, DKL_DP_MODE(tc_port), 0, ln0); 2089 + intel_dkl_phy_write(dev_priv, DKL_DP_MODE(tc_port), 1, ln1); 2088 2090 } else { 2089 2091 intel_de_write(dev_priv, MG_DP_MODE(0, tc_port), ln0); 2090 2092 intel_de_write(dev_priv, MG_DP_MODE(1, tc_port), ln1); ··· 3084 3094 enum tc_port tc_port = intel_port_to_tc(i915, encoder->port); 3085 3095 int ln; 3086 3096 3087 - for (ln = 0; ln < 2; ln++) { 3088 - intel_de_write(i915, HIP_INDEX_REG(tc_port), HIP_INDEX_VAL(tc_port, ln)); 3089 - intel_de_rmw(i915, DKL_PCS_DW5(tc_port), DKL_PCS_DW5_CORE_SOFTRESET, 0); 3090 - } 3097 + for (ln = 0; ln < 2; ln++) 3098 + intel_dkl_phy_rmw(i915, DKL_PCS_DW5(tc_port), ln, DKL_PCS_DW5_CORE_SOFTRESET, 0); 3091 3099 } 3092 3100 3093 3101 static void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp,
+8
drivers/gpu/drm/i915/display/intel_display_core.h
··· 316 316 } dbuf; 317 317 318 318 struct { 319 + /* 320 + * dkl.phy_lock protects against concurrent access of the 321 + * Dekel TypeC PHYs. 322 + */ 323 + spinlock_t phy_lock; 324 + } dkl; 325 + 326 + struct { 319 327 /* VLV/CHV/BXT/GLK DSI MMIO register base address */ 320 328 u32 mmio_base; 321 329 } dsi;
+3 -4
drivers/gpu/drm/i915/display/intel_display_power_well.c
··· 12 12 #include "intel_de.h" 13 13 #include "intel_display_power_well.h" 14 14 #include "intel_display_types.h" 15 + #include "intel_dkl_phy.h" 15 16 #include "intel_dmc.h" 16 17 #include "intel_dpio_phy.h" 17 18 #include "intel_dpll.h" ··· 530 529 enum tc_port tc_port; 531 530 532 531 tc_port = TGL_AUX_PW_TO_TC_PORT(i915_power_well_instance(power_well)->hsw.idx); 533 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 534 - HIP_INDEX_VAL(tc_port, 0x2)); 535 532 536 - if (intel_de_wait_for_set(dev_priv, DKL_CMN_UC_DW_27(tc_port), 537 - DKL_CMN_UC_DW27_UC_HEALTH, 1)) 533 + if (wait_for(intel_dkl_phy_read(dev_priv, DKL_CMN_UC_DW_27(tc_port), 2) & 534 + DKL_CMN_UC_DW27_UC_HEALTH, 1)) 538 535 drm_warn(&dev_priv->drm, 539 536 "Timeout waiting TC uC health\n"); 540 537 }
+109
drivers/gpu/drm/i915/display/intel_dkl_phy.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright © 2022 Intel Corporation 4 + */ 5 + 6 + #include "i915_drv.h" 7 + #include "i915_reg.h" 8 + 9 + #include "intel_de.h" 10 + #include "intel_display.h" 11 + #include "intel_dkl_phy.h" 12 + 13 + static void 14 + dkl_phy_set_hip_idx(struct drm_i915_private *i915, i915_reg_t reg, int idx) 15 + { 16 + enum tc_port tc_port = DKL_REG_TC_PORT(reg); 17 + 18 + drm_WARN_ON(&i915->drm, tc_port < TC_PORT_1 || tc_port >= I915_MAX_TC_PORTS); 19 + 20 + intel_de_write(i915, 21 + HIP_INDEX_REG(tc_port), 22 + HIP_INDEX_VAL(tc_port, idx)); 23 + } 24 + 25 + /** 26 + * intel_dkl_phy_read - read a Dekel PHY register 27 + * @i915: i915 device instance 28 + * @reg: Dekel PHY register 29 + * @ln: lane instance of @reg 30 + * 31 + * Read the @reg Dekel PHY register. 32 + * 33 + * Returns the read value. 34 + */ 35 + u32 36 + intel_dkl_phy_read(struct drm_i915_private *i915, i915_reg_t reg, int ln) 37 + { 38 + u32 val; 39 + 40 + spin_lock(&i915->display.dkl.phy_lock); 41 + 42 + dkl_phy_set_hip_idx(i915, reg, ln); 43 + val = intel_de_read(i915, reg); 44 + 45 + spin_unlock(&i915->display.dkl.phy_lock); 46 + 47 + return val; 48 + } 49 + 50 + /** 51 + * intel_dkl_phy_write - write a Dekel PHY register 52 + * @i915: i915 device instance 53 + * @reg: Dekel PHY register 54 + * @ln: lane instance of @reg 55 + * @val: value to write 56 + * 57 + * Write @val to the @reg Dekel PHY register. 58 + */ 59 + void 60 + intel_dkl_phy_write(struct drm_i915_private *i915, i915_reg_t reg, int ln, u32 val) 61 + { 62 + spin_lock(&i915->display.dkl.phy_lock); 63 + 64 + dkl_phy_set_hip_idx(i915, reg, ln); 65 + intel_de_write(i915, reg, val); 66 + 67 + spin_unlock(&i915->display.dkl.phy_lock); 68 + } 69 + 70 + /** 71 + * intel_dkl_phy_rmw - read-modify-write a Dekel PHY register 72 + * @i915: i915 device instance 73 + * @reg: Dekel PHY register 74 + * @ln: lane instance of @reg 75 + * @clear: mask to clear 76 + * @set: mask to set 77 + * 78 + * Read the @reg Dekel PHY register, clearing then setting the @clear/@set bits in it, and writing 79 + * this value back to the register if the value differs from the read one. 80 + */ 81 + void 82 + intel_dkl_phy_rmw(struct drm_i915_private *i915, i915_reg_t reg, int ln, u32 clear, u32 set) 83 + { 84 + spin_lock(&i915->display.dkl.phy_lock); 85 + 86 + dkl_phy_set_hip_idx(i915, reg, ln); 87 + intel_de_rmw(i915, reg, clear, set); 88 + 89 + spin_unlock(&i915->display.dkl.phy_lock); 90 + } 91 + 92 + /** 93 + * intel_dkl_phy_posting_read - do a posting read from a Dekel PHY register 94 + * @i915: i915 device instance 95 + * @reg: Dekel PHY register 96 + * @ln: lane instance of @reg 97 + * 98 + * Read the @reg Dekel PHY register without returning the read value. 99 + */ 100 + void 101 + intel_dkl_phy_posting_read(struct drm_i915_private *i915, i915_reg_t reg, int ln) 102 + { 103 + spin_lock(&i915->display.dkl.phy_lock); 104 + 105 + dkl_phy_set_hip_idx(i915, reg, ln); 106 + intel_de_posting_read(i915, reg); 107 + 108 + spin_unlock(&i915->display.dkl.phy_lock); 109 + }
+24
drivers/gpu/drm/i915/display/intel_dkl_phy.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2022 Intel Corporation 4 + */ 5 + 6 + #ifndef __INTEL_DKL_PHY_H__ 7 + #define __INTEL_DKL_PHY_H__ 8 + 9 + #include <linux/types.h> 10 + 11 + #include "i915_reg_defs.h" 12 + 13 + struct drm_i915_private; 14 + 15 + u32 16 + intel_dkl_phy_read(struct drm_i915_private *i915, i915_reg_t reg, int ln); 17 + void 18 + intel_dkl_phy_write(struct drm_i915_private *i915, i915_reg_t reg, int ln, u32 val); 19 + void 20 + intel_dkl_phy_rmw(struct drm_i915_private *i915, i915_reg_t reg, int ln, u32 clear, u32 set); 21 + void 22 + intel_dkl_phy_posting_read(struct drm_i915_private *i915, i915_reg_t reg, int ln); 23 + 24 + #endif /* __INTEL_DKL_PHY_H__ */
+1 -1
drivers/gpu/drm/i915/display/intel_dp.c
··· 5276 5276 encoder->devdata, IS_ERR(edid) ? NULL : edid); 5277 5277 5278 5278 intel_panel_add_edid_fixed_modes(intel_connector, 5279 - intel_connector->panel.vbt.drrs_type != DRRS_TYPE_NONE, 5279 + intel_connector->panel.vbt.drrs_type != DRRS_TYPE_NONE || 5280 5280 intel_vrr_is_capable(intel_connector)); 5281 5281 5282 5282 /* MSO requires information from the EDID */
+27 -32
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
··· 25 25 26 26 #include "intel_de.h" 27 27 #include "intel_display_types.h" 28 + #include "intel_dkl_phy.h" 28 29 #include "intel_dpio_phy.h" 29 30 #include "intel_dpll.h" 30 31 #include "intel_dpll_mgr.h" ··· 3509 3508 * All registers read here have the same HIP_INDEX_REG even though 3510 3509 * they are on different building blocks 3511 3510 */ 3512 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 3513 - HIP_INDEX_VAL(tc_port, 0x2)); 3514 - 3515 - hw_state->mg_refclkin_ctl = intel_de_read(dev_priv, 3516 - DKL_REFCLKIN_CTL(tc_port)); 3511 + hw_state->mg_refclkin_ctl = intel_dkl_phy_read(dev_priv, 3512 + DKL_REFCLKIN_CTL(tc_port), 2); 3517 3513 hw_state->mg_refclkin_ctl &= MG_REFCLKIN_CTL_OD_2_MUX_MASK; 3518 3514 3519 3515 hw_state->mg_clktop2_hsclkctl = 3520 - intel_de_read(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port)); 3516 + intel_dkl_phy_read(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port), 2); 3521 3517 hw_state->mg_clktop2_hsclkctl &= 3522 3518 MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL_MASK | 3523 3519 MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL_MASK | ··· 3522 3524 MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_MASK; 3523 3525 3524 3526 hw_state->mg_clktop2_coreclkctl1 = 3525 - intel_de_read(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port)); 3527 + intel_dkl_phy_read(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port), 2); 3526 3528 hw_state->mg_clktop2_coreclkctl1 &= 3527 3529 MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO_MASK; 3528 3530 3529 - hw_state->mg_pll_div0 = intel_de_read(dev_priv, DKL_PLL_DIV0(tc_port)); 3531 + hw_state->mg_pll_div0 = intel_dkl_phy_read(dev_priv, DKL_PLL_DIV0(tc_port), 2); 3530 3532 val = DKL_PLL_DIV0_MASK; 3531 3533 if (dev_priv->display.vbt.override_afc_startup) 3532 3534 val |= DKL_PLL_DIV0_AFC_STARTUP_MASK; 3533 3535 hw_state->mg_pll_div0 &= val; 3534 3536 3535 - hw_state->mg_pll_div1 = intel_de_read(dev_priv, DKL_PLL_DIV1(tc_port)); 3537 + hw_state->mg_pll_div1 = intel_dkl_phy_read(dev_priv, DKL_PLL_DIV1(tc_port), 2); 3536 3538 hw_state->mg_pll_div1 &= (DKL_PLL_DIV1_IREF_TRIM_MASK | 3537 3539 DKL_PLL_DIV1_TDC_TARGET_CNT_MASK); 3538 3540 3539 - hw_state->mg_pll_ssc = intel_de_read(dev_priv, DKL_PLL_SSC(tc_port)); 3541 + hw_state->mg_pll_ssc = intel_dkl_phy_read(dev_priv, DKL_PLL_SSC(tc_port), 2); 3540 3542 hw_state->mg_pll_ssc &= (DKL_PLL_SSC_IREF_NDIV_RATIO_MASK | 3541 3543 DKL_PLL_SSC_STEP_LEN_MASK | 3542 3544 DKL_PLL_SSC_STEP_NUM_MASK | 3543 3545 DKL_PLL_SSC_EN); 3544 3546 3545 - hw_state->mg_pll_bias = intel_de_read(dev_priv, DKL_PLL_BIAS(tc_port)); 3547 + hw_state->mg_pll_bias = intel_dkl_phy_read(dev_priv, DKL_PLL_BIAS(tc_port), 2); 3546 3548 hw_state->mg_pll_bias &= (DKL_PLL_BIAS_FRAC_EN_H | 3547 3549 DKL_PLL_BIAS_FBDIV_FRAC_MASK); 3548 3550 3549 3551 hw_state->mg_pll_tdc_coldst_bias = 3550 - intel_de_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port)); 3552 + intel_dkl_phy_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port), 2); 3551 3553 hw_state->mg_pll_tdc_coldst_bias &= (DKL_PLL_TDC_SSC_STEP_SIZE_MASK | 3552 3554 DKL_PLL_TDC_FEED_FWD_GAIN_MASK); 3553 3555 ··· 3735 3737 * All registers programmed here have the same HIP_INDEX_REG even 3736 3738 * though on different building block 3737 3739 */ 3738 - intel_de_write(dev_priv, HIP_INDEX_REG(tc_port), 3739 - HIP_INDEX_VAL(tc_port, 0x2)); 3740 - 3741 3740 /* All the registers are RMW */ 3742 - val = intel_de_read(dev_priv, DKL_REFCLKIN_CTL(tc_port)); 3741 + val = intel_dkl_phy_read(dev_priv, DKL_REFCLKIN_CTL(tc_port), 2); 3743 3742 val &= ~MG_REFCLKIN_CTL_OD_2_MUX_MASK; 3744 3743 val |= hw_state->mg_refclkin_ctl; 3745 - intel_de_write(dev_priv, DKL_REFCLKIN_CTL(tc_port), val); 3744 + intel_dkl_phy_write(dev_priv, DKL_REFCLKIN_CTL(tc_port), 2, val); 3746 3745 3747 - val = intel_de_read(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port)); 3746 + val = intel_dkl_phy_read(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port), 2); 3748 3747 val &= ~MG_CLKTOP2_CORECLKCTL1_A_DIVRATIO_MASK; 3749 3748 val |= hw_state->mg_clktop2_coreclkctl1; 3750 - intel_de_write(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port), val); 3749 + intel_dkl_phy_write(dev_priv, DKL_CLKTOP2_CORECLKCTL1(tc_port), 2, val); 3751 3750 3752 - val = intel_de_read(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port)); 3751 + val = intel_dkl_phy_read(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port), 2); 3753 3752 val &= ~(MG_CLKTOP2_HSCLKCTL_TLINEDRV_CLKSEL_MASK | 3754 3753 MG_CLKTOP2_HSCLKCTL_CORE_INPUTSEL_MASK | 3755 3754 MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_MASK | 3756 3755 MG_CLKTOP2_HSCLKCTL_DSDIV_RATIO_MASK); 3757 3756 val |= hw_state->mg_clktop2_hsclkctl; 3758 - intel_de_write(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port), val); 3757 + intel_dkl_phy_write(dev_priv, DKL_CLKTOP2_HSCLKCTL(tc_port), 2, val); 3759 3758 3760 3759 val = DKL_PLL_DIV0_MASK; 3761 3760 if (dev_priv->display.vbt.override_afc_startup) 3762 3761 val |= DKL_PLL_DIV0_AFC_STARTUP_MASK; 3763 - intel_de_rmw(dev_priv, DKL_PLL_DIV0(tc_port), val, 3764 - hw_state->mg_pll_div0); 3762 + intel_dkl_phy_rmw(dev_priv, DKL_PLL_DIV0(tc_port), 2, val, 3763 + hw_state->mg_pll_div0); 3765 3764 3766 - val = intel_de_read(dev_priv, DKL_PLL_DIV1(tc_port)); 3765 + val = intel_dkl_phy_read(dev_priv, DKL_PLL_DIV1(tc_port), 2); 3767 3766 val &= ~(DKL_PLL_DIV1_IREF_TRIM_MASK | 3768 3767 DKL_PLL_DIV1_TDC_TARGET_CNT_MASK); 3769 3768 val |= hw_state->mg_pll_div1; 3770 - intel_de_write(dev_priv, DKL_PLL_DIV1(tc_port), val); 3769 + intel_dkl_phy_write(dev_priv, DKL_PLL_DIV1(tc_port), 2, val); 3771 3770 3772 - val = intel_de_read(dev_priv, DKL_PLL_SSC(tc_port)); 3771 + val = intel_dkl_phy_read(dev_priv, DKL_PLL_SSC(tc_port), 2); 3773 3772 val &= ~(DKL_PLL_SSC_IREF_NDIV_RATIO_MASK | 3774 3773 DKL_PLL_SSC_STEP_LEN_MASK | 3775 3774 DKL_PLL_SSC_STEP_NUM_MASK | 3776 3775 DKL_PLL_SSC_EN); 3777 3776 val |= hw_state->mg_pll_ssc; 3778 - intel_de_write(dev_priv, DKL_PLL_SSC(tc_port), val); 3777 + intel_dkl_phy_write(dev_priv, DKL_PLL_SSC(tc_port), 2, val); 3779 3778 3780 - val = intel_de_read(dev_priv, DKL_PLL_BIAS(tc_port)); 3779 + val = intel_dkl_phy_read(dev_priv, DKL_PLL_BIAS(tc_port), 2); 3781 3780 val &= ~(DKL_PLL_BIAS_FRAC_EN_H | 3782 3781 DKL_PLL_BIAS_FBDIV_FRAC_MASK); 3783 3782 val |= hw_state->mg_pll_bias; 3784 - intel_de_write(dev_priv, DKL_PLL_BIAS(tc_port), val); 3783 + intel_dkl_phy_write(dev_priv, DKL_PLL_BIAS(tc_port), 2, val); 3785 3784 3786 - val = intel_de_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port)); 3785 + val = intel_dkl_phy_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port), 2); 3787 3786 val &= ~(DKL_PLL_TDC_SSC_STEP_SIZE_MASK | 3788 3787 DKL_PLL_TDC_FEED_FWD_GAIN_MASK); 3789 3788 val |= hw_state->mg_pll_tdc_coldst_bias; 3790 - intel_de_write(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port), val); 3789 + intel_dkl_phy_write(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port), 2, val); 3791 3790 3792 - intel_de_posting_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port)); 3791 + intel_dkl_phy_posting_read(dev_priv, DKL_PLL_TDC_COLDST_BIAS(tc_port), 2); 3793 3792 } 3794 3793 3795 3794 static void icl_pll_power_enable(struct drm_i915_private *dev_priv,
+1 -2
drivers/gpu/drm/i915/display/intel_lvds.c
··· 972 972 973 973 /* Try EDID first */ 974 974 intel_panel_add_edid_fixed_modes(intel_connector, 975 - intel_connector->panel.vbt.drrs_type != DRRS_TYPE_NONE, 976 - false); 975 + intel_connector->panel.vbt.drrs_type != DRRS_TYPE_NONE); 977 976 978 977 /* Failed to get EDID, what about VBT? */ 979 978 if (!intel_panel_preferred_fixed_mode(intel_connector))
+2 -2
drivers/gpu/drm/i915/display/intel_panel.c
··· 254 254 } 255 255 256 256 void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, 257 - bool has_drrs, bool has_vrr) 257 + bool use_alt_fixed_modes) 258 258 { 259 259 intel_panel_add_edid_preferred_mode(connector); 260 - if (intel_panel_preferred_fixed_mode(connector) && (has_drrs || has_vrr)) 260 + if (intel_panel_preferred_fixed_mode(connector) && use_alt_fixed_modes) 261 261 intel_panel_add_edid_alt_fixed_modes(connector); 262 262 intel_panel_destroy_probed_modes(connector); 263 263 }
+1 -1
drivers/gpu/drm/i915/display/intel_panel.h
··· 44 44 int intel_panel_compute_config(struct intel_connector *connector, 45 45 struct drm_display_mode *adjusted_mode); 46 46 void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, 47 - bool has_drrs, bool has_vrr); 47 + bool use_alt_fixed_modes); 48 48 void intel_panel_add_vbt_lfp_fixed_mode(struct intel_connector *connector); 49 49 void intel_panel_add_vbt_sdvo_fixed_mode(struct intel_connector *connector); 50 50 void intel_panel_add_encoder_fixed_mode(struct intel_connector *connector,
+39 -25
drivers/gpu/drm/i915/display/intel_sdvo.c
··· 2747 2747 if (!intel_sdvo_connector) 2748 2748 return false; 2749 2749 2750 - if (device == 0) { 2751 - intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS0; 2750 + if (device == 0) 2752 2751 intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS0; 2753 - } else if (device == 1) { 2754 - intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS1; 2752 + else if (device == 1) 2755 2753 intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS1; 2756 - } 2757 2754 2758 2755 intel_connector = &intel_sdvo_connector->base; 2759 2756 connector = &intel_connector->base; ··· 2805 2808 encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; 2806 2809 connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; 2807 2810 2808 - intel_sdvo->controlled_output |= type; 2809 2811 intel_sdvo_connector->output_flag = type; 2810 2812 2811 2813 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { ··· 2845 2849 encoder->encoder_type = DRM_MODE_ENCODER_DAC; 2846 2850 connector->connector_type = DRM_MODE_CONNECTOR_VGA; 2847 2851 2848 - if (device == 0) { 2849 - intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB0; 2852 + if (device == 0) 2850 2853 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB0; 2851 - } else if (device == 1) { 2852 - intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB1; 2854 + else if (device == 1) 2853 2855 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1; 2854 - } 2855 2856 2856 2857 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { 2857 2858 kfree(intel_sdvo_connector); ··· 2878 2885 encoder->encoder_type = DRM_MODE_ENCODER_LVDS; 2879 2886 connector->connector_type = DRM_MODE_CONNECTOR_LVDS; 2880 2887 2881 - if (device == 0) { 2882 - intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS0; 2888 + if (device == 0) 2883 2889 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS0; 2884 - } else if (device == 1) { 2885 - intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS1; 2890 + else if (device == 1) 2886 2891 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; 2887 - } 2888 2892 2889 2893 if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { 2890 2894 kfree(intel_sdvo_connector); ··· 2900 2910 intel_panel_add_vbt_sdvo_fixed_mode(intel_connector); 2901 2911 2902 2912 if (!intel_panel_preferred_fixed_mode(intel_connector)) { 2913 + mutex_lock(&i915->drm.mode_config.mutex); 2914 + 2903 2915 intel_ddc_get_modes(connector, &intel_sdvo->ddc); 2904 - intel_panel_add_edid_fixed_modes(intel_connector, false, false); 2916 + intel_panel_add_edid_fixed_modes(intel_connector, false); 2917 + 2918 + mutex_unlock(&i915->drm.mode_config.mutex); 2905 2919 } 2906 2920 2907 2921 intel_panel_init(intel_connector); ··· 2920 2926 return false; 2921 2927 } 2922 2928 2929 + static u16 intel_sdvo_filter_output_flags(u16 flags) 2930 + { 2931 + flags &= SDVO_OUTPUT_MASK; 2932 + 2933 + /* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/ 2934 + if (!(flags & SDVO_OUTPUT_TMDS0)) 2935 + flags &= ~SDVO_OUTPUT_TMDS1; 2936 + 2937 + if (!(flags & SDVO_OUTPUT_RGB0)) 2938 + flags &= ~SDVO_OUTPUT_RGB1; 2939 + 2940 + if (!(flags & SDVO_OUTPUT_LVDS0)) 2941 + flags &= ~SDVO_OUTPUT_LVDS1; 2942 + 2943 + return flags; 2944 + } 2945 + 2923 2946 static bool 2924 2947 intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags) 2925 2948 { 2926 - /* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/ 2949 + struct drm_i915_private *i915 = to_i915(intel_sdvo->base.base.dev); 2950 + 2951 + flags = intel_sdvo_filter_output_flags(flags); 2952 + 2953 + intel_sdvo->controlled_output = flags; 2954 + 2955 + intel_sdvo_select_ddc_bus(i915, intel_sdvo); 2927 2956 2928 2957 if (flags & SDVO_OUTPUT_TMDS0) 2929 2958 if (!intel_sdvo_dvi_init(intel_sdvo, 0)) 2930 2959 return false; 2931 2960 2932 - if ((flags & SDVO_TMDS_MASK) == SDVO_TMDS_MASK) 2961 + if (flags & SDVO_OUTPUT_TMDS1) 2933 2962 if (!intel_sdvo_dvi_init(intel_sdvo, 1)) 2934 2963 return false; 2935 2964 ··· 2973 2956 if (!intel_sdvo_analog_init(intel_sdvo, 0)) 2974 2957 return false; 2975 2958 2976 - if ((flags & SDVO_RGB_MASK) == SDVO_RGB_MASK) 2959 + if (flags & SDVO_OUTPUT_RGB1) 2977 2960 if (!intel_sdvo_analog_init(intel_sdvo, 1)) 2978 2961 return false; 2979 2962 ··· 2981 2964 if (!intel_sdvo_lvds_init(intel_sdvo, 0)) 2982 2965 return false; 2983 2966 2984 - if ((flags & SDVO_LVDS_MASK) == SDVO_LVDS_MASK) 2967 + if (flags & SDVO_OUTPUT_LVDS1) 2985 2968 if (!intel_sdvo_lvds_init(intel_sdvo, 1)) 2986 2969 return false; 2987 2970 2988 - if ((flags & SDVO_OUTPUT_MASK) == 0) { 2971 + if (flags == 0) { 2989 2972 unsigned char bytes[2]; 2990 2973 2991 - intel_sdvo->controlled_output = 0; 2992 2974 memcpy(bytes, &intel_sdvo->caps.output_flags, 2); 2993 2975 DRM_DEBUG_KMS("%s: Unknown SDVO output type (0x%02x%02x)\n", 2994 2976 SDVO_NAME(intel_sdvo), ··· 3398 3382 * cloning for SDVO encoders. 3399 3383 */ 3400 3384 intel_sdvo->base.cloneable = 0; 3401 - 3402 - intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo); 3403 3385 3404 3386 /* Set the input timing to the screen. Assume always input 0. */ 3405 3387 if (!intel_sdvo_set_target_input(intel_sdvo))
+4 -15
drivers/gpu/drm/i915/gem/i915_gem_internal.c
··· 6 6 7 7 #include <linux/scatterlist.h> 8 8 #include <linux/slab.h> 9 - #include <linux/swiotlb.h> 10 9 11 10 #include "i915_drv.h" 12 11 #include "i915_gem.h" ··· 37 38 struct scatterlist *sg; 38 39 unsigned int sg_page_sizes; 39 40 unsigned int npages; 40 - int max_order; 41 + int max_order = MAX_ORDER; 42 + unsigned int max_segment; 41 43 gfp_t gfp; 42 44 43 - max_order = MAX_ORDER; 44 - #ifdef CONFIG_SWIOTLB 45 - if (is_swiotlb_active(obj->base.dev->dev)) { 46 - unsigned int max_segment; 47 - 48 - max_segment = swiotlb_max_segment(); 49 - if (max_segment) { 50 - max_segment = max_t(unsigned int, max_segment, 51 - PAGE_SIZE) >> PAGE_SHIFT; 52 - max_order = min(max_order, ilog2(max_segment)); 53 - } 54 - } 55 - #endif 45 + max_segment = i915_sg_segment_size(i915->drm.dev) >> PAGE_SHIFT; 46 + max_order = min(max_order, get_order(max_segment)); 56 47 57 48 gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE; 58 49 if (IS_I965GM(i915) || IS_I965G(i915)) {
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_shmem.c
··· 194 194 struct intel_memory_region *mem = obj->mm.region; 195 195 struct address_space *mapping = obj->base.filp->f_mapping; 196 196 const unsigned long page_count = obj->base.size / PAGE_SIZE; 197 - unsigned int max_segment = i915_sg_segment_size(); 197 + unsigned int max_segment = i915_sg_segment_size(i915->drm.dev); 198 198 struct sg_table *st; 199 199 struct sgt_iter sgt_iter; 200 200 struct page *page;
+2 -2
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
··· 189 189 struct drm_i915_private *i915 = container_of(bdev, typeof(*i915), bdev); 190 190 struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM]; 191 191 struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); 192 - const unsigned int max_segment = i915_sg_segment_size(); 192 + const unsigned int max_segment = i915_sg_segment_size(i915->drm.dev); 193 193 const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT; 194 194 struct file *filp = i915_tt->filp; 195 195 struct sgt_iter sgt_iter; ··· 538 538 ret = sg_alloc_table_from_pages_segment(st, 539 539 ttm->pages, ttm->num_pages, 540 540 0, (unsigned long)ttm->num_pages << PAGE_SHIFT, 541 - i915_sg_segment_size(), GFP_KERNEL); 541 + i915_sg_segment_size(i915_tt->dev), GFP_KERNEL); 542 542 if (ret) { 543 543 st->sgl = NULL; 544 544 return ERR_PTR(ret);
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
··· 129 129 static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) 130 130 { 131 131 const unsigned long num_pages = obj->base.size >> PAGE_SHIFT; 132 - unsigned int max_segment = i915_sg_segment_size(); 132 + unsigned int max_segment = i915_sg_segment_size(obj->base.dev->dev); 133 133 struct sg_table *st; 134 134 unsigned int sg_page_sizes; 135 135 struct page **pvec;
+1
drivers/gpu/drm/i915/i915_driver.c
··· 353 353 mutex_init(&dev_priv->display.wm.wm_mutex); 354 354 mutex_init(&dev_priv->display.pps.mutex); 355 355 mutex_init(&dev_priv->display.hdcp.comp_mutex); 356 + spin_lock_init(&dev_priv->display.dkl.phy_lock); 356 357 357 358 i915_memcpy_init_early(dev_priv); 358 359 intel_runtime_pm_init_early(&dev_priv->runtime_pm);
+3
drivers/gpu/drm/i915/i915_reg.h
··· 7420 7420 #define _DKL_PHY5_BASE 0x16C000 7421 7421 #define _DKL_PHY6_BASE 0x16D000 7422 7422 7423 + #define DKL_REG_TC_PORT(__reg) \ 7424 + (TC_PORT_1 + ((__reg).reg - _DKL_PHY1_BASE) / (_DKL_PHY2_BASE - _DKL_PHY1_BASE)) 7425 + 7423 7426 /* DEKEL PHY MMIO Address = Phy base + (internal address & ~index_mask) */ 7424 7427 #define _DKL_PCS_DW5 0x14 7425 7428 #define DKL_PCS_DW5(tc_port) _MMIO(_PORT(tc_port, _DKL_PHY1_BASE, \
+20 -12
drivers/gpu/drm/i915/i915_scatterlist.h
··· 9 9 10 10 #include <linux/pfn.h> 11 11 #include <linux/scatterlist.h> 12 - #include <linux/swiotlb.h> 12 + #include <linux/dma-mapping.h> 13 + #include <xen/xen.h> 13 14 14 15 #include "i915_gem.h" 15 16 ··· 128 127 return page_sizes; 129 128 } 130 129 131 - static inline unsigned int i915_sg_segment_size(void) 130 + static inline unsigned int i915_sg_segment_size(struct device *dev) 132 131 { 133 - unsigned int size = swiotlb_max_segment(); 132 + size_t max = min_t(size_t, UINT_MAX, dma_max_mapping_size(dev)); 134 133 135 - if (size == 0) 136 - size = UINT_MAX; 137 - 138 - size = rounddown(size, PAGE_SIZE); 139 - /* swiotlb_max_segment_size can return 1 byte when it means one page. */ 140 - if (size < PAGE_SIZE) 141 - size = PAGE_SIZE; 142 - 143 - return size; 134 + /* 135 + * For Xen PV guests pages aren't contiguous in DMA (machine) address 136 + * space. The DMA API takes care of that both in dma_alloc_* (by 137 + * calling into the hypervisor to make the pages contiguous) and in 138 + * dma_map_* (by bounce buffering). But i915 abuses ignores the 139 + * coherency aspects of the DMA API and thus can't cope with bounce 140 + * buffering actually happening, so add a hack here to force small 141 + * allocations and mappings when running in PV mode on Xen. 142 + * 143 + * Note this will still break if bounce buffering is required for other 144 + * reasons, like confidential computing hypervisors or PCIe root ports 145 + * with addressing limitations. 146 + */ 147 + if (xen_pv_domain()) 148 + max = PAGE_SIZE; 149 + return round_down(max, PAGE_SIZE); 144 150 } 145 151 146 152 bool i915_sg_trim(struct sg_table *orig_st);
-1
drivers/gpu/drm/imx/Kconfig
··· 4 4 select DRM_KMS_HELPER 5 5 select VIDEOMODE_HELPERS 6 6 select DRM_GEM_DMA_HELPER 7 - select DRM_KMS_HELPER 8 7 depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM || COMPILE_TEST) 9 8 depends on IMX_IPUV3_CORE 10 9 help
+3 -2
drivers/gpu/drm/imx/imx-tve.c
··· 218 218 return ret; 219 219 } 220 220 221 - static int imx_tve_connector_mode_valid(struct drm_connector *connector, 222 - struct drm_display_mode *mode) 221 + static enum drm_mode_status 222 + imx_tve_connector_mode_valid(struct drm_connector *connector, 223 + struct drm_display_mode *mode) 223 224 { 224 225 struct imx_tve *tve = con_to_tve(connector); 225 226 unsigned long rate;
+19 -7
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
··· 752 752 static void dw_mipi_dsi_rockchip_set_lcdsel(struct dw_mipi_dsi_rockchip *dsi, 753 753 int mux) 754 754 { 755 - if (dsi->cdata->lcdsel_grf_reg < 0) 755 + if (dsi->cdata->lcdsel_grf_reg) 756 756 regmap_write(dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg, 757 757 mux ? dsi->cdata->lcdsel_lit : dsi->cdata->lcdsel_big); 758 758 } ··· 1051 1051 if (ret) { 1052 1052 DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", 1053 1053 ret); 1054 - return ret; 1054 + goto out; 1055 1055 } 1056 1056 1057 1057 second = dw_mipi_dsi_rockchip_find_second(dsi); 1058 - if (IS_ERR(second)) 1059 - return PTR_ERR(second); 1058 + if (IS_ERR(second)) { 1059 + ret = PTR_ERR(second); 1060 + goto out; 1061 + } 1060 1062 if (second) { 1061 1063 ret = component_add(second, &dw_mipi_dsi_rockchip_ops); 1062 1064 if (ret) { 1063 1065 DRM_DEV_ERROR(second, 1064 1066 "Failed to register component: %d\n", 1065 1067 ret); 1066 - return ret; 1068 + goto out; 1067 1069 } 1068 1070 } 1069 1071 1070 1072 return 0; 1073 + 1074 + out: 1075 + mutex_lock(&dsi->usage_mutex); 1076 + dsi->usage_mode = DW_DSI_USAGE_IDLE; 1077 + mutex_unlock(&dsi->usage_mutex); 1078 + return ret; 1071 1079 } 1072 1080 1073 1081 static int dw_mipi_dsi_rockchip_host_detach(void *priv_data, ··· 1643 1635 static const struct rockchip_dw_dsi_chip_data rk3568_chip_data[] = { 1644 1636 { 1645 1637 .reg = 0xfe060000, 1646 - .lcdsel_grf_reg = -1, 1647 1638 .lanecfg1_grf_reg = RK3568_GRF_VO_CON2, 1648 1639 .lanecfg1 = HIWORD_UPDATE(0, RK3568_DSI0_SKEWCALHS | 1649 1640 RK3568_DSI0_FORCETXSTOPMODE | ··· 1652 1645 }, 1653 1646 { 1654 1647 .reg = 0xfe070000, 1655 - .lcdsel_grf_reg = -1, 1656 1648 .lanecfg1_grf_reg = RK3568_GRF_VO_CON3, 1657 1649 .lanecfg1 = HIWORD_UPDATE(0, RK3568_DSI1_SKEWCALHS | 1658 1650 RK3568_DSI1_FORCETXSTOPMODE | ··· 1687 1681 .of_match_table = dw_mipi_dsi_rockchip_dt_ids, 1688 1682 .pm = &dw_mipi_dsi_rockchip_pm_ops, 1689 1683 .name = "dw-mipi-dsi-rockchip", 1684 + /* 1685 + * For dual-DSI display, one DSI pokes at the other DSI's 1686 + * drvdata in dw_mipi_dsi_rockchip_find_second(). This is not 1687 + * safe for asynchronous probe. 1688 + */ 1689 + .probe_type = PROBE_FORCE_SYNCHRONOUS, 1690 1690 }, 1691 1691 };
+2 -1
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
··· 565 565 566 566 ret = rockchip_hdmi_parse_dt(hdmi); 567 567 if (ret) { 568 - DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); 568 + if (ret != -EPROBE_DEFER) 569 + DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); 569 570 return ret; 570 571 } 571 572
+4 -1
drivers/gpu/drm/rockchip/rockchip_drm_gem.c
··· 364 364 { 365 365 struct rockchip_gem_object *rk_obj; 366 366 struct drm_gem_object *obj; 367 + bool is_framebuffer; 367 368 int ret; 368 369 369 - rk_obj = rockchip_gem_create_object(drm, size, false); 370 + is_framebuffer = drm->fb_helper && file_priv == drm->fb_helper->client.file; 371 + 372 + rk_obj = rockchip_gem_create_object(drm, size, is_framebuffer); 370 373 if (IS_ERR(rk_obj)) 371 374 return ERR_CAST(rk_obj); 372 375
+8 -2
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
··· 877 877 { 878 878 struct vop2_video_port *vp = to_vop2_video_port(crtc); 879 879 struct vop2 *vop2 = vp->vop2; 880 + struct drm_crtc_state *old_crtc_state; 880 881 int ret; 881 882 882 883 vop2_lock(vop2); 884 + 885 + old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); 886 + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, false); 883 887 884 888 drm_crtc_vblank_off(crtc); 885 889 ··· 1000 996 static void vop2_plane_atomic_disable(struct drm_plane *plane, 1001 997 struct drm_atomic_state *state) 1002 998 { 1003 - struct drm_plane_state *old_pstate = drm_atomic_get_old_plane_state(state, plane); 999 + struct drm_plane_state *old_pstate = NULL; 1004 1000 struct vop2_win *win = to_vop2_win(plane); 1005 1001 struct vop2 *vop2 = win->vop2; 1006 1002 1007 1003 drm_dbg(vop2->drm, "%s disable\n", win->data->name); 1008 1004 1009 - if (!old_pstate->crtc) 1005 + if (state) 1006 + old_pstate = drm_atomic_get_old_plane_state(state, plane); 1007 + if (old_pstate && !old_pstate->crtc) 1010 1008 return; 1011 1009 1012 1010 vop2_win_disable(win);
-1
drivers/hwmon/pmbus/pmbus.h
··· 467 467 #define PMBUS_REGULATOR_STEP(_name, _id, _voltages, _step) \ 468 468 [_id] = { \ 469 469 .name = (_name # _id), \ 470 - .supply_name = "vin", \ 471 470 .id = (_id), \ 472 471 .of_match = of_match_ptr(_name # _id), \ 473 472 .regulators_node = of_match_ptr("regulators"), \
+103 -13
drivers/hwmon/scmi-hwmon.c
··· 20 20 const struct scmi_sensor_info **info[hwmon_max]; 21 21 }; 22 22 23 + struct scmi_thermal_sensor { 24 + const struct scmi_protocol_handle *ph; 25 + const struct scmi_sensor_info *info; 26 + }; 27 + 23 28 static inline u64 __pow10(u8 x) 24 29 { 25 30 u64 r = 1; ··· 69 64 return 0; 70 65 } 71 66 72 - static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, 73 - u32 attr, int channel, long *val) 67 + static int scmi_hwmon_read_scaled_value(const struct scmi_protocol_handle *ph, 68 + const struct scmi_sensor_info *sensor, 69 + long *val) 74 70 { 75 71 int ret; 76 72 u64 value; 77 - const struct scmi_sensor_info *sensor; 78 - struct scmi_sensors *scmi_sensors = dev_get_drvdata(dev); 79 73 80 - sensor = *(scmi_sensors->info[type] + channel); 81 - ret = sensor_ops->reading_get(scmi_sensors->ph, sensor->id, &value); 74 + ret = sensor_ops->reading_get(ph, sensor->id, &value); 82 75 if (ret) 83 76 return ret; 84 77 ··· 85 82 *val = value; 86 83 87 84 return ret; 85 + } 86 + 87 + static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, 88 + u32 attr, int channel, long *val) 89 + { 90 + const struct scmi_sensor_info *sensor; 91 + struct scmi_sensors *scmi_sensors = dev_get_drvdata(dev); 92 + 93 + sensor = *(scmi_sensors->info[type] + channel); 94 + 95 + return scmi_hwmon_read_scaled_value(scmi_sensors->ph, sensor, val); 88 96 } 89 97 90 98 static int ··· 136 122 .info = NULL, 137 123 }; 138 124 125 + static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, 126 + int *temp) 127 + { 128 + int ret; 129 + long value; 130 + struct scmi_thermal_sensor *th_sensor = tz->devdata; 131 + 132 + ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info, 133 + &value); 134 + if (!ret) 135 + *temp = value; 136 + 137 + return ret; 138 + } 139 + 140 + static const struct thermal_zone_device_ops scmi_hwmon_thermal_ops = { 141 + .get_temp = scmi_hwmon_thermal_get_temp, 142 + }; 143 + 139 144 static int scmi_hwmon_add_chan_info(struct hwmon_channel_info *scmi_hwmon_chan, 140 145 struct device *dev, int num, 141 146 enum hwmon_sensor_types type, u32 config) ··· 182 149 }; 183 150 184 151 static u32 hwmon_attributes[hwmon_max] = { 185 - [hwmon_chip] = HWMON_C_REGISTER_TZ, 186 152 [hwmon_temp] = HWMON_T_INPUT | HWMON_T_LABEL, 187 153 [hwmon_in] = HWMON_I_INPUT | HWMON_I_LABEL, 188 154 [hwmon_curr] = HWMON_C_INPUT | HWMON_C_LABEL, 189 155 [hwmon_power] = HWMON_P_INPUT | HWMON_P_LABEL, 190 156 [hwmon_energy] = HWMON_E_INPUT | HWMON_E_LABEL, 191 157 }; 158 + 159 + static int scmi_thermal_sensor_register(struct device *dev, 160 + const struct scmi_protocol_handle *ph, 161 + const struct scmi_sensor_info *sensor) 162 + { 163 + struct scmi_thermal_sensor *th_sensor; 164 + struct thermal_zone_device *tzd; 165 + 166 + th_sensor = devm_kzalloc(dev, sizeof(*th_sensor), GFP_KERNEL); 167 + if (!th_sensor) 168 + return -ENOMEM; 169 + 170 + th_sensor->ph = ph; 171 + th_sensor->info = sensor; 172 + 173 + /* 174 + * Try to register a temperature sensor with the Thermal Framework: 175 + * skip sensors not defined as part of any thermal zone (-ENODEV) but 176 + * report any other errors related to misconfigured zones/sensors. 177 + */ 178 + tzd = devm_thermal_of_zone_register(dev, th_sensor->info->id, th_sensor, 179 + &scmi_hwmon_thermal_ops); 180 + if (IS_ERR(tzd)) { 181 + devm_kfree(dev, th_sensor); 182 + 183 + if (PTR_ERR(tzd) != -ENODEV) 184 + return PTR_ERR(tzd); 185 + 186 + dev_dbg(dev, "Sensor '%s' not attached to any thermal zone.\n", 187 + sensor->name); 188 + } else { 189 + dev_dbg(dev, "Sensor '%s' attached to thermal zone ID:%d\n", 190 + sensor->name, tzd->id); 191 + } 192 + 193 + return 0; 194 + } 192 195 193 196 static int scmi_hwmon_probe(struct scmi_device *sdev) 194 197 { ··· 233 164 enum hwmon_sensor_types type; 234 165 struct scmi_sensors *scmi_sensors; 235 166 const struct scmi_sensor_info *sensor; 236 - int nr_count[hwmon_max] = {0}, nr_types = 0; 167 + int nr_count[hwmon_max] = {0}, nr_types = 0, nr_count_temp = 0; 237 168 const struct hwmon_chip_info *chip_info; 238 169 struct device *hwdev, *dev = &sdev->dev; 239 170 struct hwmon_channel_info *scmi_hwmon_chan; ··· 277 208 } 278 209 } 279 210 280 - if (nr_count[hwmon_temp]) { 281 - nr_count[hwmon_chip]++; 282 - nr_types++; 283 - } 211 + if (nr_count[hwmon_temp]) 212 + nr_count_temp = nr_count[hwmon_temp]; 284 213 285 214 scmi_hwmon_chan = devm_kcalloc(dev, nr_types, sizeof(*scmi_hwmon_chan), 286 215 GFP_KERNEL); ··· 329 262 hwdev = devm_hwmon_device_register_with_info(dev, "scmi_sensors", 330 263 scmi_sensors, chip_info, 331 264 NULL); 265 + if (IS_ERR(hwdev)) 266 + return PTR_ERR(hwdev); 332 267 333 - return PTR_ERR_OR_ZERO(hwdev); 268 + for (i = 0; i < nr_count_temp; i++) { 269 + int ret; 270 + 271 + sensor = *(scmi_sensors->info[hwmon_temp] + i); 272 + if (!sensor) 273 + continue; 274 + 275 + /* 276 + * Warn on any misconfiguration related to thermal zones but 277 + * bail out of probing only on memory errors. 278 + */ 279 + ret = scmi_thermal_sensor_register(dev, ph, sensor); 280 + if (ret) { 281 + if (ret == -ENOMEM) 282 + return ret; 283 + dev_warn(dev, 284 + "Thermal zone misconfigured for %s. err=%d\n", 285 + sensor->name, ret); 286 + } 287 + } 288 + 289 + return 0; 334 290 } 335 291 336 292 static const struct scmi_device_id scmi_id_table[] = {
+32 -10
drivers/hwspinlock/qcom_hwspinlock.c
··· 22 22 struct qcom_hwspinlock_of_data { 23 23 u32 offset; 24 24 u32 stride; 25 + const struct regmap_config *regmap_config; 25 26 }; 26 27 27 28 static int qcom_hwspinlock_trylock(struct hwspinlock *lock) ··· 74 73 .stride = 0x4, 75 74 }; 76 75 77 - /* All modern platform has offset 0 and stride of 4k */ 76 + static const struct regmap_config tcsr_msm8226_mutex_config = { 77 + .reg_bits = 32, 78 + .reg_stride = 4, 79 + .val_bits = 32, 80 + .max_register = 0x1000, 81 + .fast_io = true, 82 + }; 83 + 84 + static const struct qcom_hwspinlock_of_data of_msm8226_tcsr_mutex = { 85 + .offset = 0, 86 + .stride = 0x80, 87 + .regmap_config = &tcsr_msm8226_mutex_config, 88 + }; 89 + 90 + static const struct regmap_config tcsr_mutex_config = { 91 + .reg_bits = 32, 92 + .reg_stride = 4, 93 + .val_bits = 32, 94 + .max_register = 0x20000, 95 + .fast_io = true, 96 + }; 97 + 78 98 static const struct qcom_hwspinlock_of_data of_tcsr_mutex = { 79 99 .offset = 0, 80 100 .stride = 0x1000, 101 + .regmap_config = &tcsr_mutex_config, 81 102 }; 82 103 83 104 static const struct of_device_id qcom_hwspinlock_of_match[] = { 84 105 { .compatible = "qcom,sfpb-mutex", .data = &of_sfpb_mutex }, 85 106 { .compatible = "qcom,tcsr-mutex", .data = &of_tcsr_mutex }, 107 + { .compatible = "qcom,apq8084-tcsr-mutex", .data = &of_msm8226_tcsr_mutex }, 108 + { .compatible = "qcom,ipq6018-tcsr-mutex", .data = &of_msm8226_tcsr_mutex }, 109 + { .compatible = "qcom,msm8226-tcsr-mutex", .data = &of_msm8226_tcsr_mutex }, 110 + { .compatible = "qcom,msm8974-tcsr-mutex", .data = &of_msm8226_tcsr_mutex }, 111 + { .compatible = "qcom,msm8994-tcsr-mutex", .data = &of_msm8226_tcsr_mutex }, 86 112 { } 87 113 }; 88 114 MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match); ··· 145 117 return regmap; 146 118 } 147 119 148 - static const struct regmap_config tcsr_mutex_config = { 149 - .reg_bits = 32, 150 - .reg_stride = 4, 151 - .val_bits = 32, 152 - .max_register = 0x40000, 153 - .fast_io = true, 154 - }; 155 - 156 120 static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev, 157 121 u32 *offset, u32 *stride) 158 122 { ··· 153 133 void __iomem *base; 154 134 155 135 data = of_device_get_match_data(dev); 136 + if (!data->regmap_config) 137 + return ERR_PTR(-EINVAL); 156 138 157 139 *offset = data->offset; 158 140 *stride = data->stride; ··· 163 141 if (IS_ERR(base)) 164 142 return ERR_CAST(base); 165 143 166 - return devm_regmap_init_mmio(dev, base, &tcsr_mutex_config); 144 + return devm_regmap_init_mmio(dev, base, data->regmap_config); 167 145 } 168 146 169 147 static int qcom_hwspinlock_probe(struct platform_device *pdev)
+1
drivers/i2c/busses/i2c-i801.c
··· 1243 1243 */ 1244 1244 { "Latitude 5480", 0x29 }, 1245 1245 { "Vostro V131", 0x1d }, 1246 + { "Vostro 5568", 0x29 }, 1246 1247 }; 1247 1248 1248 1249 static void register_dell_lis3lv02d_i2c_device(struct i801_priv *priv)
+1
drivers/i2c/busses/i2c-piix4.c
··· 1080 1080 "", &piix4_main_adapters[0]); 1081 1081 if (retval < 0) 1082 1082 return retval; 1083 + piix4_adapter_count = 1; 1083 1084 } 1084 1085 1085 1086 /* Check for auxiliary SMBus on some AMD chipsets */
+10 -6
drivers/i2c/busses/i2c-tegra.c
··· 284 284 struct dma_chan *tx_dma_chan; 285 285 struct dma_chan *rx_dma_chan; 286 286 unsigned int dma_buf_size; 287 + struct device *dma_dev; 287 288 dma_addr_t dma_phys; 288 289 void *dma_buf; 289 290 ··· 421 420 static void tegra_i2c_release_dma(struct tegra_i2c_dev *i2c_dev) 422 421 { 423 422 if (i2c_dev->dma_buf) { 424 - dma_free_coherent(i2c_dev->dev, i2c_dev->dma_buf_size, 423 + dma_free_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size, 425 424 i2c_dev->dma_buf, i2c_dev->dma_phys); 426 425 i2c_dev->dma_buf = NULL; 427 426 } ··· 473 472 474 473 i2c_dev->tx_dma_chan = chan; 475 474 475 + WARN_ON(i2c_dev->tx_dma_chan->device != i2c_dev->rx_dma_chan->device); 476 + i2c_dev->dma_dev = chan->device->dev; 477 + 476 478 i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len + 477 479 I2C_PACKET_HEADER_SIZE; 478 480 479 - dma_buf = dma_alloc_coherent(i2c_dev->dev, i2c_dev->dma_buf_size, 481 + dma_buf = dma_alloc_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size, 480 482 &dma_phys, GFP_KERNEL | __GFP_NOWARN); 481 483 if (!dma_buf) { 482 484 dev_err(i2c_dev->dev, "failed to allocate DMA buffer\n"); ··· 1276 1272 1277 1273 if (i2c_dev->dma_mode) { 1278 1274 if (i2c_dev->msg_read) { 1279 - dma_sync_single_for_device(i2c_dev->dev, 1275 + dma_sync_single_for_device(i2c_dev->dma_dev, 1280 1276 i2c_dev->dma_phys, 1281 1277 xfer_size, DMA_FROM_DEVICE); 1282 1278 ··· 1284 1280 if (err) 1285 1281 return err; 1286 1282 } else { 1287 - dma_sync_single_for_cpu(i2c_dev->dev, 1283 + dma_sync_single_for_cpu(i2c_dev->dma_dev, 1288 1284 i2c_dev->dma_phys, 1289 1285 xfer_size, DMA_TO_DEVICE); 1290 1286 } ··· 1297 1293 memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE, 1298 1294 msg->buf, msg->len); 1299 1295 1300 - dma_sync_single_for_device(i2c_dev->dev, 1296 + dma_sync_single_for_device(i2c_dev->dma_dev, 1301 1297 i2c_dev->dma_phys, 1302 1298 xfer_size, DMA_TO_DEVICE); 1303 1299 ··· 1348 1344 } 1349 1345 1350 1346 if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) { 1351 - dma_sync_single_for_cpu(i2c_dev->dev, 1347 + dma_sync_single_for_cpu(i2c_dev->dma_dev, 1352 1348 i2c_dev->dma_phys, 1353 1349 xfer_size, DMA_FROM_DEVICE); 1354 1350
+1 -1
drivers/net/can/at91_can.c
··· 452 452 unsigned int mb, prio; 453 453 u32 reg_mid, reg_mcr; 454 454 455 - if (can_dropped_invalid_skb(dev, skb)) 455 + if (can_dev_dropped_skb(dev, skb)) 456 456 return NETDEV_TX_OK; 457 457 458 458 mb = get_tx_next_mb(priv);
+1 -1
drivers/net/can/c_can/c_can_main.c
··· 457 457 struct c_can_tx_ring *tx_ring = &priv->tx; 458 458 u32 idx, obj, cmd = IF_COMM_TX; 459 459 460 - if (can_dropped_invalid_skb(dev, skb)) 460 + if (can_dev_dropped_skb(dev, skb)) 461 461 return NETDEV_TX_OK; 462 462 463 463 if (c_can_tx_busy(priv, tx_ring))
+1 -1
drivers/net/can/can327.c
··· 813 813 struct can327 *elm = netdev_priv(dev); 814 814 struct can_frame *frame = (struct can_frame *)skb->data; 815 815 816 - if (can_dropped_invalid_skb(dev, skb)) 816 + if (can_dev_dropped_skb(dev, skb)) 817 817 return NETDEV_TX_OK; 818 818 819 819 /* We shouldn't get here after a hardware fault:
+1 -1
drivers/net/can/cc770/cc770.c
··· 429 429 struct cc770_priv *priv = netdev_priv(dev); 430 430 unsigned int mo = obj2msgobj(CC770_OBJ_TX); 431 431 432 - if (can_dropped_invalid_skb(dev, skb)) 432 + if (can_dev_dropped_skb(dev, skb)) 433 433 return NETDEV_TX_OK; 434 434 435 435 netif_stop_queue(dev);
+1 -1
drivers/net/can/ctucanfd/ctucanfd_base.c
··· 600 600 bool ok; 601 601 unsigned long flags; 602 602 603 - if (can_dropped_invalid_skb(ndev, skb)) 603 + if (can_dev_dropped_skb(ndev, skb)) 604 604 return NETDEV_TX_OK; 605 605 606 606 if (unlikely(!CTU_CAN_FD_TXTNF(priv))) {
+1 -9
drivers/net/can/dev/skb.c
··· 5 5 */ 6 6 7 7 #include <linux/can/dev.h> 8 - #include <linux/can/netlink.h> 9 8 #include <linux/module.h> 10 9 11 10 #define MOD_DESC "CAN device driver interface" ··· 336 337 /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ 337 338 bool can_dropped_invalid_skb(struct net_device *dev, struct sk_buff *skb) 338 339 { 339 - struct can_priv *priv = netdev_priv(dev); 340 - 341 340 switch (ntohs(skb->protocol)) { 342 341 case ETH_P_CAN: 343 342 if (!can_is_can_skb(skb)) ··· 356 359 goto inval_skb; 357 360 } 358 361 359 - if (!can_skb_headroom_valid(dev, skb)) { 362 + if (!can_skb_headroom_valid(dev, skb)) 360 363 goto inval_skb; 361 - } else if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) { 362 - netdev_info_once(dev, 363 - "interface in listen only mode, dropping skb\n"); 364 - goto inval_skb; 365 - } 366 364 367 365 return false; 368 366
+1 -1
drivers/net/can/flexcan/flexcan-core.c
··· 742 742 u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | ((can_fd_len2dlc(cfd->len)) << 16); 743 743 int i; 744 744 745 - if (can_dropped_invalid_skb(dev, skb)) 745 + if (can_dev_dropped_skb(dev, skb)) 746 746 return NETDEV_TX_OK; 747 747 748 748 netif_stop_queue(dev);
+1 -1
drivers/net/can/grcan.c
··· 1345 1345 unsigned long flags; 1346 1346 u32 oneshotmode = priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT; 1347 1347 1348 - if (can_dropped_invalid_skb(dev, skb)) 1348 + if (can_dev_dropped_skb(dev, skb)) 1349 1349 return NETDEV_TX_OK; 1350 1350 1351 1351 /* Trying to transmit in silent mode will generate error interrupts, but
+1 -1
drivers/net/can/ifi_canfd/ifi_canfd.c
··· 860 860 u32 txst, txid, txdlc; 861 861 int i; 862 862 863 - if (can_dropped_invalid_skb(ndev, skb)) 863 + if (can_dev_dropped_skb(ndev, skb)) 864 864 return NETDEV_TX_OK; 865 865 866 866 /* Check if the TX buffer is full */
+1 -1
drivers/net/can/janz-ican3.c
··· 1693 1693 void __iomem *desc_addr; 1694 1694 unsigned long flags; 1695 1695 1696 - if (can_dropped_invalid_skb(ndev, skb)) 1696 + if (can_dev_dropped_skb(ndev, skb)) 1697 1697 return NETDEV_TX_OK; 1698 1698 1699 1699 spin_lock_irqsave(&mod->lock, flags);
+1 -1
drivers/net/can/kvaser_pciefd.c
··· 772 772 int nwords; 773 773 u8 count; 774 774 775 - if (can_dropped_invalid_skb(netdev, skb)) 775 + if (can_dev_dropped_skb(netdev, skb)) 776 776 return NETDEV_TX_OK; 777 777 778 778 nwords = kvaser_pciefd_prepare_tx_packet(&packet, can, skb);
+1 -1
drivers/net/can/m_can/m_can.c
··· 1731 1731 { 1732 1732 struct m_can_classdev *cdev = netdev_priv(dev); 1733 1733 1734 - if (can_dropped_invalid_skb(dev, skb)) 1734 + if (can_dev_dropped_skb(dev, skb)) 1735 1735 return NETDEV_TX_OK; 1736 1736 1737 1737 if (cdev->is_peripheral) {
+1 -1
drivers/net/can/mscan/mscan.c
··· 191 191 int i, rtr, buf_id; 192 192 u32 can_id; 193 193 194 - if (can_dropped_invalid_skb(dev, skb)) 194 + if (can_dev_dropped_skb(dev, skb)) 195 195 return NETDEV_TX_OK; 196 196 197 197 out_8(&regs->cantier, 0);
+1 -1
drivers/net/can/peak_canfd/peak_canfd.c
··· 651 651 int room_left; 652 652 u8 len; 653 653 654 - if (can_dropped_invalid_skb(ndev, skb)) 654 + if (can_dev_dropped_skb(ndev, skb)) 655 655 return NETDEV_TX_OK; 656 656 657 657 msg_size = ALIGN(sizeof(*msg) + cf->len, 4);
+1 -1
drivers/net/can/rcar/rcar_can.c
··· 590 590 struct can_frame *cf = (struct can_frame *)skb->data; 591 591 u32 data, i; 592 592 593 - if (can_dropped_invalid_skb(ndev, skb)) 593 + if (can_dev_dropped_skb(ndev, skb)) 594 594 return NETDEV_TX_OK; 595 595 596 596 if (cf->can_id & CAN_EFF_FLAG) /* Extended frame format */
+5 -10
drivers/net/can/rcar/rcar_canfd.c
··· 81 81 82 82 /* RSCFDnCFDGERFL / RSCFDnGERFL */ 83 83 #define RCANFD_GERFL_EEF0_7 GENMASK(23, 16) 84 - #define RCANFD_GERFL_EEF1 BIT(17) 85 - #define RCANFD_GERFL_EEF0 BIT(16) 84 + #define RCANFD_GERFL_EEF(ch) BIT(16 + (ch)) 86 85 #define RCANFD_GERFL_CMPOF BIT(3) /* CAN FD only */ 87 86 #define RCANFD_GERFL_THLES BIT(2) 88 87 #define RCANFD_GERFL_MES BIT(1) ··· 89 90 90 91 #define RCANFD_GERFL_ERR(gpriv, x) \ 91 92 ((x) & (reg_v3u(gpriv, RCANFD_GERFL_EEF0_7, \ 92 - RCANFD_GERFL_EEF0 | RCANFD_GERFL_EEF1) | \ 93 + RCANFD_GERFL_EEF(0) | RCANFD_GERFL_EEF(1)) | \ 93 94 RCANFD_GERFL_MES | \ 94 95 ((gpriv)->fdmode ? RCANFD_GERFL_CMPOF : 0))) 95 96 ··· 935 936 u32 ridx = ch + RCANFD_RFFIFO_IDX; 936 937 937 938 gerfl = rcar_canfd_read(priv->base, RCANFD_GERFL); 938 - if ((gerfl & RCANFD_GERFL_EEF0) && (ch == 0)) { 939 - netdev_dbg(ndev, "Ch0: ECC Error flag\n"); 940 - stats->tx_dropped++; 941 - } 942 - if ((gerfl & RCANFD_GERFL_EEF1) && (ch == 1)) { 943 - netdev_dbg(ndev, "Ch1: ECC Error flag\n"); 939 + if (gerfl & RCANFD_GERFL_EEF(ch)) { 940 + netdev_dbg(ndev, "Ch%u: ECC Error flag\n", ch); 944 941 stats->tx_dropped++; 945 942 } 946 943 if (gerfl & RCANFD_GERFL_MES) { ··· 1476 1481 unsigned long flags; 1477 1482 u32 ch = priv->channel; 1478 1483 1479 - if (can_dropped_invalid_skb(ndev, skb)) 1484 + if (can_dev_dropped_skb(ndev, skb)) 1480 1485 return NETDEV_TX_OK; 1481 1486 1482 1487 if (cf->can_id & CAN_EFF_FLAG) {
+1 -1
drivers/net/can/sja1000/sja1000.c
··· 291 291 u8 cmd_reg_val = 0x00; 292 292 int i; 293 293 294 - if (can_dropped_invalid_skb(dev, skb)) 294 + if (can_dev_dropped_skb(dev, skb)) 295 295 return NETDEV_TX_OK; 296 296 297 297 netif_stop_queue(dev);
+1 -1
drivers/net/can/slcan/slcan-core.c
··· 594 594 { 595 595 struct slcan *sl = netdev_priv(dev); 596 596 597 - if (can_dropped_invalid_skb(dev, skb)) 597 + if (can_dev_dropped_skb(dev, skb)) 598 598 return NETDEV_TX_OK; 599 599 600 600 spin_lock(&sl->lock);
+1 -1
drivers/net/can/softing/softing_main.c
··· 60 60 struct can_frame *cf = (struct can_frame *)skb->data; 61 61 uint8_t buf[DPRAM_TX_SIZE]; 62 62 63 - if (can_dropped_invalid_skb(dev, skb)) 63 + if (can_dev_dropped_skb(dev, skb)) 64 64 return NETDEV_TX_OK; 65 65 66 66 spin_lock(&card->spin);
+1 -1
drivers/net/can/spi/hi311x.c
··· 373 373 return NETDEV_TX_BUSY; 374 374 } 375 375 376 - if (can_dropped_invalid_skb(net, skb)) 376 + if (can_dev_dropped_skb(net, skb)) 377 377 return NETDEV_TX_OK; 378 378 379 379 netif_stop_queue(net);
+1 -1
drivers/net/can/spi/mcp251x.c
··· 789 789 return NETDEV_TX_BUSY; 790 790 } 791 791 792 - if (can_dropped_invalid_skb(net, skb)) 792 + if (can_dev_dropped_skb(net, skb)) 793 793 return NETDEV_TX_OK; 794 794 795 795 netif_stop_queue(net);
+1 -1
drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c
··· 172 172 u8 tx_head; 173 173 int err; 174 174 175 - if (can_dropped_invalid_skb(ndev, skb)) 175 + if (can_dev_dropped_skb(ndev, skb)) 176 176 return NETDEV_TX_OK; 177 177 178 178 if (mcp251xfd_tx_busy(priv, tx_ring))
+1 -1
drivers/net/can/sun4i_can.c
··· 429 429 canid_t id; 430 430 int i; 431 431 432 - if (can_dropped_invalid_skb(dev, skb)) 432 + if (can_dev_dropped_skb(dev, skb)) 433 433 return NETDEV_TX_OK; 434 434 435 435 netif_stop_queue(dev);
+1 -1
drivers/net/can/ti_hecc.c
··· 470 470 u32 mbxno, mbx_mask, data; 471 471 unsigned long flags; 472 472 473 - if (can_dropped_invalid_skb(ndev, skb)) 473 + if (can_dev_dropped_skb(ndev, skb)) 474 474 return NETDEV_TX_OK; 475 475 476 476 mbxno = get_tx_head_mb(priv);
+1 -1
drivers/net/can/usb/ems_usb.c
··· 747 747 size_t size = CPC_HEADER_SIZE + CPC_MSG_HEADER_LEN 748 748 + sizeof(struct cpc_can_msg); 749 749 750 - if (can_dropped_invalid_skb(netdev, skb)) 750 + if (can_dev_dropped_skb(netdev, skb)) 751 751 return NETDEV_TX_OK; 752 752 753 753 /* create a URB, and a buffer for it, and copy the data to the URB */
+1 -1
drivers/net/can/usb/esd_usb.c
··· 725 725 int ret = NETDEV_TX_OK; 726 726 size_t size = sizeof(struct esd_usb_msg); 727 727 728 - if (can_dropped_invalid_skb(netdev, skb)) 728 + if (can_dev_dropped_skb(netdev, skb)) 729 729 return NETDEV_TX_OK; 730 730 731 731 /* create a URB, and a buffer for it, and copy the data to the URB */
+1 -1
drivers/net/can/usb/etas_es58x/es58x_core.c
··· 1913 1913 unsigned int frame_len; 1914 1914 int ret; 1915 1915 1916 - if (can_dropped_invalid_skb(netdev, skb)) { 1916 + if (can_dev_dropped_skb(netdev, skb)) { 1917 1917 if (priv->tx_urb) 1918 1918 goto xmit_commit; 1919 1919 return NETDEV_TX_OK;
+1 -1
drivers/net/can/usb/gs_usb.c
··· 728 728 unsigned int idx; 729 729 struct gs_tx_context *txc; 730 730 731 - if (can_dropped_invalid_skb(netdev, skb)) 731 + if (can_dev_dropped_skb(netdev, skb)) 732 732 return NETDEV_TX_OK; 733 733 734 734 /* find an empty context to keep track of transmission */
+1 -1
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 653 653 unsigned int i; 654 654 unsigned long flags; 655 655 656 - if (can_dropped_invalid_skb(netdev, skb)) 656 + if (can_dev_dropped_skb(netdev, skb)) 657 657 return NETDEV_TX_OK; 658 658 659 659 urb = usb_alloc_urb(0, GFP_ATOMIC);
+1 -1
drivers/net/can/usb/mcba_usb.c
··· 311 311 .cmd_id = MBCA_CMD_TRANSMIT_MESSAGE_EV 312 312 }; 313 313 314 - if (can_dropped_invalid_skb(netdev, skb)) 314 + if (can_dev_dropped_skb(netdev, skb)) 315 315 return NETDEV_TX_OK; 316 316 317 317 ctx = mcba_usb_get_free_ctx(priv, cf);
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb_core.c
··· 351 351 int i, err; 352 352 size_t size = dev->adapter->tx_buffer_size; 353 353 354 - if (can_dropped_invalid_skb(netdev, skb)) 354 + if (can_dev_dropped_skb(netdev, skb)) 355 355 return NETDEV_TX_OK; 356 356 357 357 for (i = 0; i < PCAN_USB_MAX_TX_URBS; i++)
+1 -1
drivers/net/can/usb/ucan.c
··· 1121 1121 struct can_frame *cf = (struct can_frame *)skb->data; 1122 1122 1123 1123 /* check skb */ 1124 - if (can_dropped_invalid_skb(netdev, skb)) 1124 + if (can_dev_dropped_skb(netdev, skb)) 1125 1125 return NETDEV_TX_OK; 1126 1126 1127 1127 /* allocate a context and slow down tx path, if fifo state is low */
+1 -1
drivers/net/can/usb/usb_8dev.c
··· 602 602 int i, err; 603 603 size_t size = sizeof(struct usb_8dev_tx_msg); 604 604 605 - if (can_dropped_invalid_skb(netdev, skb)) 605 + if (can_dev_dropped_skb(netdev, skb)) 606 606 return NETDEV_TX_OK; 607 607 608 608 /* create a URB, and a buffer for it, and copy the data to the URB */
+1 -1
drivers/net/can/xilinx_can.c
··· 743 743 struct xcan_priv *priv = netdev_priv(ndev); 744 744 int ret; 745 745 746 - if (can_dropped_invalid_skb(ndev, skb)) 746 + if (can_dev_dropped_skb(ndev, skb)) 747 747 return NETDEV_TX_OK; 748 748 749 749 if (priv->devtype.flags & XCAN_FLAG_TX_MAILBOXES)
+3 -1
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
··· 1004 1004 1005 1005 xgene_enet_napi_enable(pdata); 1006 1006 ret = xgene_enet_register_irq(ndev); 1007 - if (ret) 1007 + if (ret) { 1008 + xgene_enet_napi_disable(pdata); 1008 1009 return ret; 1010 + } 1009 1011 1010 1012 if (ndev->phydev) { 1011 1013 phy_start(ndev->phydev);
+2
drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
··· 570 570 571 571 ret = aq_mss_set_egress_sakey_record(hw, &key_rec, sa_idx); 572 572 573 + memzero_explicit(&key_rec, sizeof(key_rec)); 573 574 return ret; 574 575 } 575 576 ··· 900 899 901 900 ret = aq_mss_set_ingress_sakey_record(hw, &sa_key_record, sa_idx); 902 901 902 + memzero_explicit(&sa_key_record, sizeof(sa_key_record)); 903 903 return ret; 904 904 } 905 905
+11 -7
drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c
··· 757 757 u16 table_index) 758 758 { 759 759 u16 packed_record[18]; 760 + int ret; 760 761 761 762 if (table_index >= NUMROWS_INGRESSSAKEYRECORD) 762 763 return -EINVAL; ··· 790 789 791 790 packed_record[16] = rec->key_len & 0x3; 792 791 793 - return set_raw_ingress_record(hw, packed_record, 18, 2, 794 - ROWOFFSET_INGRESSSAKEYRECORD + 795 - table_index); 792 + ret = set_raw_ingress_record(hw, packed_record, 18, 2, 793 + ROWOFFSET_INGRESSSAKEYRECORD + 794 + table_index); 795 + 796 + memzero_explicit(packed_record, sizeof(packed_record)); 797 + return ret; 796 798 } 797 799 798 800 int aq_mss_set_ingress_sakey_record(struct aq_hw_s *hw, ··· 1743 1739 ret = set_raw_egress_record(hw, packed_record, 8, 2, 1744 1740 ROWOFFSET_EGRESSSAKEYRECORD + table_index); 1745 1741 if (unlikely(ret)) 1746 - return ret; 1742 + goto clear_key; 1747 1743 ret = set_raw_egress_record(hw, packed_record + 8, 8, 2, 1748 1744 ROWOFFSET_EGRESSSAKEYRECORD + table_index - 1749 1745 32); 1750 - if (unlikely(ret)) 1751 - return ret; 1752 1746 1753 - return 0; 1747 + clear_key: 1748 + memzero_explicit(packed_record, sizeof(packed_record)); 1749 + return ret; 1754 1750 } 1755 1751 1756 1752 int aq_mss_set_egress_sakey_record(struct aq_hw_s *hw,
+1 -1
drivers/net/ethernet/broadcom/Kconfig
··· 77 77 select BCM7XXX_PHY 78 78 select MDIO_BCM_UNIMAC 79 79 select DIMLIB 80 - select BROADCOM_PHY if ARCH_BCM2835 80 + select BROADCOM_PHY if (ARCH_BCM2835 && PTP_1588_CLOCK_OPTIONAL) 81 81 help 82 82 This driver supports the built-in Ethernet MACs found in the 83 83 Broadcom BCM7xxx Set Top Box family chipset.
+45 -9
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 10015 10015 return -ENODEV; 10016 10016 } 10017 10017 10018 - int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset) 10018 + static void bnxt_clear_reservations(struct bnxt *bp, bool fw_reset) 10019 10019 { 10020 10020 struct bnxt_hw_resc *hw_resc = &bp->hw_resc; 10021 - int rc; 10022 10021 10023 10022 if (!BNXT_NEW_RM(bp)) 10024 - return 0; /* no resource reservations required */ 10025 - 10026 - rc = bnxt_hwrm_func_resc_qcaps(bp, true); 10027 - if (rc) 10028 - netdev_err(bp->dev, "resc_qcaps failed\n"); 10023 + return; /* no resource reservations required */ 10029 10024 10030 10025 hw_resc->resv_cp_rings = 0; 10031 10026 hw_resc->resv_stat_ctxs = 0; ··· 10033 10038 bp->tx_nr_rings = 0; 10034 10039 bp->rx_nr_rings = 0; 10035 10040 } 10041 + } 10042 + 10043 + int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset) 10044 + { 10045 + int rc; 10046 + 10047 + if (!BNXT_NEW_RM(bp)) 10048 + return 0; /* no resource reservations required */ 10049 + 10050 + rc = bnxt_hwrm_func_resc_qcaps(bp, true); 10051 + if (rc) 10052 + netdev_err(bp->dev, "resc_qcaps failed\n"); 10053 + 10054 + bnxt_clear_reservations(bp, fw_reset); 10036 10055 10037 10056 return rc; 10038 10057 } ··· 12937 12928 rcu_read_lock(); 12938 12929 hlist_for_each_entry_rcu(fltr, head, hash) { 12939 12930 if (bnxt_fltr_match(fltr, new_fltr)) { 12931 + rc = fltr->sw_id; 12940 12932 rcu_read_unlock(); 12941 - rc = 0; 12942 12933 goto err_free; 12943 12934 } 12944 12935 } ··· 13944 13935 pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT; 13945 13936 struct net_device *netdev = pci_get_drvdata(pdev); 13946 13937 struct bnxt *bp = netdev_priv(netdev); 13947 - int err = 0, off; 13938 + int retry = 0; 13939 + int err = 0; 13940 + int off; 13948 13941 13949 13942 netdev_info(bp->dev, "PCI Slot Reset\n"); 13950 13943 ··· 13974 13963 pci_restore_state(pdev); 13975 13964 pci_save_state(pdev); 13976 13965 13966 + bnxt_inv_fw_health_reg(bp); 13967 + bnxt_try_map_fw_health_reg(bp); 13968 + 13969 + /* In some PCIe AER scenarios, firmware may take up to 13970 + * 10 seconds to become ready in the worst case. 13971 + */ 13972 + do { 13973 + err = bnxt_try_recover_fw(bp); 13974 + if (!err) 13975 + break; 13976 + retry++; 13977 + } while (retry < BNXT_FW_SLOT_RESET_RETRY); 13978 + 13979 + if (err) { 13980 + dev_err(&pdev->dev, "Firmware not ready\n"); 13981 + goto reset_exit; 13982 + } 13983 + 13977 13984 err = bnxt_hwrm_func_reset(bp); 13978 13985 if (!err) 13979 13986 result = PCI_ERS_RESULT_RECOVERED; 13987 + 13988 + bnxt_ulp_irq_stop(bp); 13989 + bnxt_clear_int_mode(bp); 13990 + err = bnxt_init_int_mode(bp); 13991 + bnxt_ulp_irq_restart(bp, err); 13980 13992 } 13981 13993 13994 + reset_exit: 13995 + bnxt_clear_reservations(bp, true); 13982 13996 rtnl_unlock(); 13983 13997 13984 13998 return result;
+1
drivers/net/ethernet/broadcom/bnxt/bnxt.h
··· 1621 1621 1622 1622 #define BNXT_FW_RETRY 5 1623 1623 #define BNXT_FW_IF_RETRY 10 1624 + #define BNXT_FW_SLOT_RESET_RETRY 4 1624 1625 1625 1626 enum board_idx { 1626 1627 BCM57301,
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 162 162 } 163 163 164 164 reset_coalesce: 165 - if (netif_running(dev)) { 165 + if (test_bit(BNXT_STATE_OPEN, &bp->state)) { 166 166 if (update_stats) { 167 167 rc = bnxt_close_nic(bp, true, false); 168 168 if (!rc)
+2 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
··· 476 476 memset(ctx->resp, 0, PAGE_SIZE); 477 477 478 478 req_type = le16_to_cpu(ctx->req->req_type); 479 - if (BNXT_NO_FW_ACCESS(bp) && req_type != HWRM_FUNC_RESET) { 479 + if (BNXT_NO_FW_ACCESS(bp) && 480 + (req_type != HWRM_FUNC_RESET && req_type != HWRM_VER_GET)) { 480 481 netdev_dbg(bp->dev, "hwrm req_type 0x%x skipped, FW channel down\n", 481 482 req_type); 482 483 goto exit;
+1
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
··· 1301 1301 if (ret < 0) { 1302 1302 CH_ERR(adap, "failed to bind qsets, err %d\n", ret); 1303 1303 t3_intr_disable(adap); 1304 + quiesce_rx(adap); 1304 1305 free_irq_resources(adap); 1305 1306 err = ret; 1306 1307 goto out;
+1 -1
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
··· 858 858 */ 859 859 err = t4vf_update_port_info(pi); 860 860 if (err < 0) 861 - return err; 861 + goto err_unwind; 862 862 863 863 /* 864 864 * Note that this interface is up and start everything up ...
+9
drivers/net/ethernet/freescale/fman/mac.c
··· 331 331 return err; 332 332 } 333 333 334 + static int mac_remove(struct platform_device *pdev) 335 + { 336 + struct mac_device *mac_dev = platform_get_drvdata(pdev); 337 + 338 + platform_device_unregister(mac_dev->priv->eth_dev); 339 + return 0; 340 + } 341 + 334 342 static struct platform_driver mac_driver = { 335 343 .driver = { 336 344 .name = KBUILD_MODNAME, 337 345 .of_match_table = mac_match, 338 346 }, 339 347 .probe = mac_probe, 348 + .remove = mac_remove, 340 349 }; 341 350 342 351 builtin_platform_driver(mac_driver);
+5 -3
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 12984 12984 static int hclge_get_dscp_prio(struct hnae3_handle *h, u8 dscp, u8 *tc_mode, 12985 12985 u8 *priority) 12986 12986 { 12987 + struct hclge_vport *vport = hclge_get_vport(h); 12988 + 12987 12989 if (dscp >= HNAE3_MAX_DSCP) 12988 12990 return -EINVAL; 12989 12991 12990 12992 if (tc_mode) 12991 - *tc_mode = h->kinfo.tc_map_mode; 12993 + *tc_mode = vport->nic.kinfo.tc_map_mode; 12992 12994 if (priority) 12993 - *priority = h->kinfo.dscp_prio[dscp] == HNAE3_PRIO_ID_INVALID ? 0 : 12994 - h->kinfo.dscp_prio[dscp]; 12995 + *priority = vport->nic.kinfo.dscp_prio[dscp] == HNAE3_PRIO_ID_INVALID ? 0 : 12996 + vport->nic.kinfo.dscp_prio[dscp]; 12995 12997 12996 12998 return 0; 12997 12999 }
+2 -1
drivers/net/ethernet/ibm/ibmveth.c
··· 1749 1749 kobject_uevent(kobj, KOBJ_ADD); 1750 1750 } 1751 1751 1752 - rc = netif_set_real_num_tx_queues(netdev, ibmveth_real_max_tx_queues()); 1752 + rc = netif_set_real_num_tx_queues(netdev, min(num_online_cpus(), 1753 + IBMVETH_DEFAULT_QUEUES)); 1753 1754 if (rc) { 1754 1755 netdev_dbg(netdev, "failed to set number of tx queues rc=%d\n", 1755 1756 rc);
+1
drivers/net/ethernet/ibm/ibmveth.h
··· 100 100 #define IBMVETH_MAX_BUF_SIZE (1024 * 128) 101 101 #define IBMVETH_MAX_TX_BUF_SIZE (1024 * 64) 102 102 #define IBMVETH_MAX_QUEUES 16U 103 + #define IBMVETH_DEFAULT_QUEUES 8U 103 104 104 105 static int pool_size[] = { 512, 1024 * 2, 1024 * 16, 1024 * 32, 1024 * 64 }; 105 106 static int pool_count[] = { 256, 512, 256, 256, 256 };
+2
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
··· 2438 2438 list_for_each_entry(f, &adapter->vlan_filter_list, list) { 2439 2439 if (f->is_new_vlan) { 2440 2440 f->is_new_vlan = false; 2441 + if (!f->vlan.vid) 2442 + continue; 2441 2443 if (f->vlan.tpid == ETH_P_8021Q) 2442 2444 set_bit(f->vlan.vid, 2443 2445 adapter->vsi.active_cvlans);
+1 -1
drivers/net/ethernet/intel/ice/ice_base.c
··· 958 958 * associated to the queue to schedule NAPI handler 959 959 */ 960 960 q_vector = ring->q_vector; 961 - if (q_vector) 961 + if (q_vector && !(vsi->vf && ice_is_vf_disabled(vsi->vf))) 962 962 ice_trigger_sw_intr(hw, q_vector); 963 963 964 964 status = ice_dis_vsi_txq(vsi->port_info, txq_meta->vsi_idx,
+25
drivers/net/ethernet/intel/ice/ice_lib.c
··· 2240 2240 } 2241 2241 2242 2242 /** 2243 + * ice_vsi_is_rx_queue_active 2244 + * @vsi: the VSI being configured 2245 + * 2246 + * Return true if at least one queue is active. 2247 + */ 2248 + bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi) 2249 + { 2250 + struct ice_pf *pf = vsi->back; 2251 + struct ice_hw *hw = &pf->hw; 2252 + int i; 2253 + 2254 + ice_for_each_rxq(vsi, i) { 2255 + u32 rx_reg; 2256 + int pf_q; 2257 + 2258 + pf_q = vsi->rxq_map[i]; 2259 + rx_reg = rd32(hw, QRX_CTRL(pf_q)); 2260 + if (rx_reg & QRX_CTRL_QENA_STAT_M) 2261 + return true; 2262 + } 2263 + 2264 + return false; 2265 + } 2266 + 2267 + /** 2243 2268 * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not 2244 2269 * @vsi: VSI to check whether or not VLAN pruning is enabled. 2245 2270 *
+1
drivers/net/ethernet/intel/ice/ice_lib.h
··· 129 129 bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f); 130 130 void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f); 131 131 void ice_init_feature_support(struct ice_pf *pf); 132 + bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi); 132 133 #endif /* !_ICE_LIB_H_ */
+4 -1
drivers/net/ethernet/intel/ice/ice_vf_lib.c
··· 576 576 return -EINVAL; 577 577 } 578 578 ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id); 579 - ice_vsi_stop_all_rx_rings(vsi); 579 + 580 + if (ice_vsi_is_rx_queue_active(vsi)) 581 + ice_vsi_stop_all_rx_rings(vsi); 582 + 580 583 dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n", 581 584 vf->vf_id); 582 585 return 0;
+1
drivers/net/ethernet/marvell/mv643xx_eth.c
··· 2482 2482 for (i = 0; i < mp->rxq_count; i++) 2483 2483 rxq_deinit(mp->rxq + i); 2484 2484 out: 2485 + napi_disable(&mp->napi); 2485 2486 free_irq(dev->irq, dev); 2486 2487 2487 2488 return err;
+2
drivers/net/ethernet/marvell/octeontx2/Kconfig
··· 32 32 tristate "Marvell OcteonTX2 NIC Physical Function driver" 33 33 select OCTEONTX2_MBOX 34 34 select NET_DEVLINK 35 + depends on MACSEC || !MACSEC 35 36 depends on (64BIT && COMPILE_TEST) || ARM64 36 37 select DIMLIB 37 38 depends on PCI 38 39 depends on PTP_1588_CLOCK_OPTIONAL 40 + depends on MACSEC || !MACSEC 39 41 help 40 42 This driver supports Marvell's OcteonTX2 NIC physical function. 41 43
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
··· 898 898 } 899 899 900 900 sq->head = 0; 901 + sq->cons_head = 0; 901 902 sq->sqe_per_sqb = (pfvf->hw.sqb_size / sq->sqe_size) - 1; 902 903 sq->num_sqbs = (qset->sqe_cnt + sq->sqe_per_sqb) / sq->sqe_per_sqb; 903 904 /* Set SQE threshold to 10% of total SQEs */
+105 -30
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
··· 15 15 #include <net/ip.h> 16 16 #include <linux/bpf.h> 17 17 #include <linux/bpf_trace.h> 18 + #include <linux/bitfield.h> 18 19 19 20 #include "otx2_reg.h" 20 21 #include "otx2_common.h" ··· 1172 1171 } 1173 1172 EXPORT_SYMBOL(otx2_set_real_num_queues); 1174 1173 1174 + static char *nix_sqoperr_e_str[NIX_SQOPERR_MAX] = { 1175 + "NIX_SQOPERR_OOR", 1176 + "NIX_SQOPERR_CTX_FAULT", 1177 + "NIX_SQOPERR_CTX_POISON", 1178 + "NIX_SQOPERR_DISABLED", 1179 + "NIX_SQOPERR_SIZE_ERR", 1180 + "NIX_SQOPERR_OFLOW", 1181 + "NIX_SQOPERR_SQB_NULL", 1182 + "NIX_SQOPERR_SQB_FAULT", 1183 + "NIX_SQOPERR_SQE_SZ_ZERO", 1184 + }; 1185 + 1186 + static char *nix_mnqerr_e_str[NIX_MNQERR_MAX] = { 1187 + "NIX_MNQERR_SQ_CTX_FAULT", 1188 + "NIX_MNQERR_SQ_CTX_POISON", 1189 + "NIX_MNQERR_SQB_FAULT", 1190 + "NIX_MNQERR_SQB_POISON", 1191 + "NIX_MNQERR_TOTAL_ERR", 1192 + "NIX_MNQERR_LSO_ERR", 1193 + "NIX_MNQERR_CQ_QUERY_ERR", 1194 + "NIX_MNQERR_MAX_SQE_SIZE_ERR", 1195 + "NIX_MNQERR_MAXLEN_ERR", 1196 + "NIX_MNQERR_SQE_SIZEM1_ZERO", 1197 + }; 1198 + 1199 + static char *nix_snd_status_e_str[NIX_SND_STATUS_MAX] = { 1200 + "NIX_SND_STATUS_GOOD", 1201 + "NIX_SND_STATUS_SQ_CTX_FAULT", 1202 + "NIX_SND_STATUS_SQ_CTX_POISON", 1203 + "NIX_SND_STATUS_SQB_FAULT", 1204 + "NIX_SND_STATUS_SQB_POISON", 1205 + "NIX_SND_STATUS_HDR_ERR", 1206 + "NIX_SND_STATUS_EXT_ERR", 1207 + "NIX_SND_STATUS_JUMP_FAULT", 1208 + "NIX_SND_STATUS_JUMP_POISON", 1209 + "NIX_SND_STATUS_CRC_ERR", 1210 + "NIX_SND_STATUS_IMM_ERR", 1211 + "NIX_SND_STATUS_SG_ERR", 1212 + "NIX_SND_STATUS_MEM_ERR", 1213 + "NIX_SND_STATUS_INVALID_SUBDC", 1214 + "NIX_SND_STATUS_SUBDC_ORDER_ERR", 1215 + "NIX_SND_STATUS_DATA_FAULT", 1216 + "NIX_SND_STATUS_DATA_POISON", 1217 + "NIX_SND_STATUS_NPC_DROP_ACTION", 1218 + "NIX_SND_STATUS_LOCK_VIOL", 1219 + "NIX_SND_STATUS_NPC_UCAST_CHAN_ERR", 1220 + "NIX_SND_STATUS_NPC_MCAST_CHAN_ERR", 1221 + "NIX_SND_STATUS_NPC_MCAST_ABORT", 1222 + "NIX_SND_STATUS_NPC_VTAG_PTR_ERR", 1223 + "NIX_SND_STATUS_NPC_VTAG_SIZE_ERR", 1224 + "NIX_SND_STATUS_SEND_STATS_ERR", 1225 + }; 1226 + 1175 1227 static irqreturn_t otx2_q_intr_handler(int irq, void *data) 1176 1228 { 1177 1229 struct otx2_nic *pf = data; ··· 1258 1204 1259 1205 /* SQ */ 1260 1206 for (qidx = 0; qidx < pf->hw.tot_tx_queues; qidx++) { 1207 + u64 sq_op_err_dbg, mnq_err_dbg, snd_err_dbg; 1208 + u8 sq_op_err_code, mnq_err_code, snd_err_code; 1209 + 1210 + /* Below debug registers captures first errors corresponding to 1211 + * those registers. We don't have to check against SQ qid as 1212 + * these are fatal errors. 1213 + */ 1214 + 1261 1215 ptr = otx2_get_regaddr(pf, NIX_LF_SQ_OP_INT); 1262 1216 val = otx2_atomic64_add((qidx << 44), ptr); 1263 1217 otx2_write64(pf, NIX_LF_SQ_OP_INT, (qidx << 44) | 1264 1218 (val & NIX_SQINT_BITS)); 1265 1219 1266 - if (!(val & (NIX_SQINT_BITS | BIT_ULL(42)))) 1267 - continue; 1268 - 1269 1220 if (val & BIT_ULL(42)) { 1270 1221 netdev_err(pf->netdev, "SQ%lld: error reading NIX_LF_SQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n", 1271 1222 qidx, otx2_read64(pf, NIX_LF_ERR_INT)); 1272 - } else { 1273 - if (val & BIT_ULL(NIX_SQINT_LMT_ERR)) { 1274 - netdev_err(pf->netdev, "SQ%lld: LMT store error NIX_LF_SQ_OP_ERR_DBG:0x%llx", 1275 - qidx, 1276 - otx2_read64(pf, 1277 - NIX_LF_SQ_OP_ERR_DBG)); 1278 - otx2_write64(pf, NIX_LF_SQ_OP_ERR_DBG, 1279 - BIT_ULL(44)); 1280 - } 1281 - if (val & BIT_ULL(NIX_SQINT_MNQ_ERR)) { 1282 - netdev_err(pf->netdev, "SQ%lld: Meta-descriptor enqueue error NIX_LF_MNQ_ERR_DGB:0x%llx\n", 1283 - qidx, 1284 - otx2_read64(pf, NIX_LF_MNQ_ERR_DBG)); 1285 - otx2_write64(pf, NIX_LF_MNQ_ERR_DBG, 1286 - BIT_ULL(44)); 1287 - } 1288 - if (val & BIT_ULL(NIX_SQINT_SEND_ERR)) { 1289 - netdev_err(pf->netdev, "SQ%lld: Send error, NIX_LF_SEND_ERR_DBG 0x%llx", 1290 - qidx, 1291 - otx2_read64(pf, 1292 - NIX_LF_SEND_ERR_DBG)); 1293 - otx2_write64(pf, NIX_LF_SEND_ERR_DBG, 1294 - BIT_ULL(44)); 1295 - } 1296 - if (val & BIT_ULL(NIX_SQINT_SQB_ALLOC_FAIL)) 1297 - netdev_err(pf->netdev, "SQ%lld: SQB allocation failed", 1298 - qidx); 1223 + goto done; 1299 1224 } 1225 + 1226 + sq_op_err_dbg = otx2_read64(pf, NIX_LF_SQ_OP_ERR_DBG); 1227 + if (!(sq_op_err_dbg & BIT(44))) 1228 + goto chk_mnq_err_dbg; 1229 + 1230 + sq_op_err_code = FIELD_GET(GENMASK(7, 0), sq_op_err_dbg); 1231 + netdev_err(pf->netdev, "SQ%lld: NIX_LF_SQ_OP_ERR_DBG(%llx) err=%s\n", 1232 + qidx, sq_op_err_dbg, nix_sqoperr_e_str[sq_op_err_code]); 1233 + 1234 + otx2_write64(pf, NIX_LF_SQ_OP_ERR_DBG, BIT_ULL(44)); 1235 + 1236 + if (sq_op_err_code == NIX_SQOPERR_SQB_NULL) 1237 + goto chk_mnq_err_dbg; 1238 + 1239 + /* Err is not NIX_SQOPERR_SQB_NULL, call aq function to read SQ structure. 1240 + * TODO: But we are in irq context. How to call mbox functions which does sleep 1241 + */ 1242 + 1243 + chk_mnq_err_dbg: 1244 + mnq_err_dbg = otx2_read64(pf, NIX_LF_MNQ_ERR_DBG); 1245 + if (!(mnq_err_dbg & BIT(44))) 1246 + goto chk_snd_err_dbg; 1247 + 1248 + mnq_err_code = FIELD_GET(GENMASK(7, 0), mnq_err_dbg); 1249 + netdev_err(pf->netdev, "SQ%lld: NIX_LF_MNQ_ERR_DBG(%llx) err=%s\n", 1250 + qidx, mnq_err_dbg, nix_mnqerr_e_str[mnq_err_code]); 1251 + otx2_write64(pf, NIX_LF_MNQ_ERR_DBG, BIT_ULL(44)); 1252 + 1253 + chk_snd_err_dbg: 1254 + snd_err_dbg = otx2_read64(pf, NIX_LF_SEND_ERR_DBG); 1255 + if (snd_err_dbg & BIT(44)) { 1256 + snd_err_code = FIELD_GET(GENMASK(7, 0), snd_err_dbg); 1257 + netdev_err(pf->netdev, "SQ%lld: NIX_LF_SND_ERR_DBG:0x%llx err=%s\n", 1258 + qidx, snd_err_dbg, nix_snd_status_e_str[snd_err_code]); 1259 + otx2_write64(pf, NIX_LF_SEND_ERR_DBG, BIT_ULL(44)); 1260 + } 1261 + 1262 + done: 1263 + /* Print values and reset */ 1264 + if (val & BIT_ULL(NIX_SQINT_SQB_ALLOC_FAIL)) 1265 + netdev_err(pf->netdev, "SQ%lld: SQB allocation failed", 1266 + qidx); 1300 1267 1301 1268 schedule_work(&pf->reset_task); 1302 1269 }
+57
drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h
··· 281 281 BIT_ULL(NIX_SQINT_SEND_ERR) | \ 282 282 BIT_ULL(NIX_SQINT_SQB_ALLOC_FAIL)) 283 283 284 + enum nix_sqoperr_e { 285 + NIX_SQOPERR_OOR = 0, 286 + NIX_SQOPERR_CTX_FAULT = 1, 287 + NIX_SQOPERR_CTX_POISON = 2, 288 + NIX_SQOPERR_DISABLED = 3, 289 + NIX_SQOPERR_SIZE_ERR = 4, 290 + NIX_SQOPERR_OFLOW = 5, 291 + NIX_SQOPERR_SQB_NULL = 6, 292 + NIX_SQOPERR_SQB_FAULT = 7, 293 + NIX_SQOPERR_SQE_SZ_ZERO = 8, 294 + NIX_SQOPERR_MAX, 295 + }; 296 + 297 + enum nix_mnqerr_e { 298 + NIX_MNQERR_SQ_CTX_FAULT = 0, 299 + NIX_MNQERR_SQ_CTX_POISON = 1, 300 + NIX_MNQERR_SQB_FAULT = 2, 301 + NIX_MNQERR_SQB_POISON = 3, 302 + NIX_MNQERR_TOTAL_ERR = 4, 303 + NIX_MNQERR_LSO_ERR = 5, 304 + NIX_MNQERR_CQ_QUERY_ERR = 6, 305 + NIX_MNQERR_MAX_SQE_SIZE_ERR = 7, 306 + NIX_MNQERR_MAXLEN_ERR = 8, 307 + NIX_MNQERR_SQE_SIZEM1_ZERO = 9, 308 + NIX_MNQERR_MAX, 309 + }; 310 + 311 + enum nix_snd_status_e { 312 + NIX_SND_STATUS_GOOD = 0x0, 313 + NIX_SND_STATUS_SQ_CTX_FAULT = 0x1, 314 + NIX_SND_STATUS_SQ_CTX_POISON = 0x2, 315 + NIX_SND_STATUS_SQB_FAULT = 0x3, 316 + NIX_SND_STATUS_SQB_POISON = 0x4, 317 + NIX_SND_STATUS_HDR_ERR = 0x5, 318 + NIX_SND_STATUS_EXT_ERR = 0x6, 319 + NIX_SND_STATUS_JUMP_FAULT = 0x7, 320 + NIX_SND_STATUS_JUMP_POISON = 0x8, 321 + NIX_SND_STATUS_CRC_ERR = 0x9, 322 + NIX_SND_STATUS_IMM_ERR = 0x10, 323 + NIX_SND_STATUS_SG_ERR = 0x11, 324 + NIX_SND_STATUS_MEM_ERR = 0x12, 325 + NIX_SND_STATUS_INVALID_SUBDC = 0x13, 326 + NIX_SND_STATUS_SUBDC_ORDER_ERR = 0x14, 327 + NIX_SND_STATUS_DATA_FAULT = 0x15, 328 + NIX_SND_STATUS_DATA_POISON = 0x16, 329 + NIX_SND_STATUS_NPC_DROP_ACTION = 0x17, 330 + NIX_SND_STATUS_LOCK_VIOL = 0x18, 331 + NIX_SND_STATUS_NPC_UCAST_CHAN_ERR = 0x19, 332 + NIX_SND_STATUS_NPC_MCAST_CHAN_ERR = 0x20, 333 + NIX_SND_STATUS_NPC_MCAST_ABORT = 0x21, 334 + NIX_SND_STATUS_NPC_VTAG_PTR_ERR = 0x22, 335 + NIX_SND_STATUS_NPC_VTAG_SIZE_ERR = 0x23, 336 + NIX_SND_STATUS_SEND_MEM_FAULT = 0x24, 337 + NIX_SND_STATUS_SEND_STATS_ERR = 0x25, 338 + NIX_SND_STATUS_MAX, 339 + }; 340 + 284 341 #endif /* OTX2_STRUCT_H */
+19 -13
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
··· 441 441 struct otx2_cq_queue *cq, int budget) 442 442 { 443 443 int tx_pkts = 0, tx_bytes = 0, qidx; 444 + struct otx2_snd_queue *sq; 444 445 struct nix_cqe_tx_s *cqe; 445 446 int processed_cqe = 0; 446 447 ··· 452 451 return 0; 453 452 454 453 process_cqe: 454 + qidx = cq->cq_idx - pfvf->hw.rx_queues; 455 + sq = &pfvf->qset.sq[qidx]; 456 + 455 457 while (likely(processed_cqe < budget) && cq->pend_cqe) { 456 458 cqe = (struct nix_cqe_tx_s *)otx2_get_next_cqe(cq); 457 459 if (unlikely(!cqe)) { ··· 462 458 return 0; 463 459 break; 464 460 } 461 + 465 462 if (cq->cq_type == CQ_XDP) { 466 - qidx = cq->cq_idx - pfvf->hw.rx_queues; 467 - otx2_xdp_snd_pkt_handler(pfvf, &pfvf->qset.sq[qidx], 468 - cqe); 463 + otx2_xdp_snd_pkt_handler(pfvf, sq, cqe); 469 464 } else { 470 - otx2_snd_pkt_handler(pfvf, cq, 471 - &pfvf->qset.sq[cq->cint_idx], 472 - cqe, budget, &tx_pkts, &tx_bytes); 465 + otx2_snd_pkt_handler(pfvf, cq, sq, cqe, budget, 466 + &tx_pkts, &tx_bytes); 473 467 } 468 + 474 469 cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID; 475 470 processed_cqe++; 476 471 cq->pend_cqe--; 472 + 473 + sq->cons_head++; 474 + sq->cons_head &= (sq->sqe_cnt - 1); 477 475 } 478 476 479 477 /* Free CQEs to HW */ ··· 1078 1072 { 1079 1073 struct netdev_queue *txq = netdev_get_tx_queue(netdev, qidx); 1080 1074 struct otx2_nic *pfvf = netdev_priv(netdev); 1081 - int offset, num_segs, free_sqe; 1075 + int offset, num_segs, free_desc; 1082 1076 struct nix_sqe_hdr_s *sqe_hdr; 1083 1077 1084 - /* Check if there is room for new SQE. 1085 - * 'Num of SQBs freed to SQ's pool - SQ's Aura count' 1086 - * will give free SQE count. 1078 + /* Check if there is enough room between producer 1079 + * and consumer index. 1087 1080 */ 1088 - free_sqe = (sq->num_sqbs - *sq->aura_fc_addr) * sq->sqe_per_sqb; 1081 + free_desc = (sq->cons_head - sq->head - 1 + sq->sqe_cnt) & (sq->sqe_cnt - 1); 1082 + if (free_desc < sq->sqe_thresh) 1083 + return false; 1089 1084 1090 - if (free_sqe < sq->sqe_thresh || 1091 - free_sqe < otx2_get_sqe_count(pfvf, skb)) 1085 + if (free_desc < otx2_get_sqe_count(pfvf, skb)) 1092 1086 return false; 1093 1087 1094 1088 num_segs = skb_shinfo(skb)->nr_frags + 1;
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
··· 79 79 struct otx2_snd_queue { 80 80 u8 aura_id; 81 81 u16 head; 82 + u16 cons_head; 82 83 u16 sqe_size; 83 84 u32 sqe_cnt; 84 85 u16 num_sqbs;
+6 -1
drivers/net/ethernet/marvell/prestera/prestera_rxtx.c
··· 776 776 int prestera_rxtx_switch_init(struct prestera_switch *sw) 777 777 { 778 778 struct prestera_rxtx *rxtx; 779 + int err; 779 780 780 781 rxtx = kzalloc(sizeof(*rxtx), GFP_KERNEL); 781 782 if (!rxtx) ··· 784 783 785 784 sw->rxtx = rxtx; 786 785 787 - return prestera_sdma_switch_init(sw); 786 + err = prestera_sdma_switch_init(sw); 787 + if (err) 788 + kfree(rxtx); 789 + 790 + return err; 788 791 } 789 792 790 793 void prestera_rxtx_switch_fini(struct prestera_switch *sw)
+2
drivers/net/ethernet/mediatek/mtk_star_emac.c
··· 1026 1026 return 0; 1027 1027 1028 1028 err_free_irq: 1029 + napi_disable(&priv->rx_napi); 1030 + napi_disable(&priv->tx_napi); 1029 1031 free_irq(ndev->irq, ndev); 1030 1032 err_free_skbs: 1031 1033 mtk_star_free_rx_skbs(priv);
+8 -3
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 1770 1770 struct mlx5_cmd *cmd = &dev->cmd; 1771 1771 int i; 1772 1772 1773 - for (i = 0; i < cmd->max_reg_cmds; i++) 1774 - while (down_trylock(&cmd->sem)) 1773 + for (i = 0; i < cmd->max_reg_cmds; i++) { 1774 + while (down_trylock(&cmd->sem)) { 1775 1775 mlx5_cmd_trigger_completions(dev); 1776 + cond_resched(); 1777 + } 1778 + } 1776 1779 1777 - while (down_trylock(&cmd->pages_sem)) 1780 + while (down_trylock(&cmd->pages_sem)) { 1778 1781 mlx5_cmd_trigger_completions(dev); 1782 + cond_resched(); 1783 + } 1779 1784 1780 1785 /* Unlock cmdif */ 1781 1786 up(&cmd->pages_sem);
+31
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
··· 164 164 return err; 165 165 } 166 166 167 + static int 168 + mlx5_esw_bridge_changeupper_validate_netdev(void *ptr) 169 + { 170 + struct net_device *dev = netdev_notifier_info_to_dev(ptr); 171 + struct netdev_notifier_changeupper_info *info = ptr; 172 + struct net_device *upper = info->upper_dev; 173 + struct net_device *lower; 174 + struct list_head *iter; 175 + 176 + if (!netif_is_bridge_master(upper) || !netif_is_lag_master(dev)) 177 + return 0; 178 + 179 + netdev_for_each_lower_dev(dev, lower, iter) { 180 + struct mlx5_core_dev *mdev; 181 + struct mlx5e_priv *priv; 182 + 183 + if (!mlx5e_eswitch_rep(lower)) 184 + continue; 185 + 186 + priv = netdev_priv(lower); 187 + mdev = priv->mdev; 188 + if (!mlx5_lag_is_active(mdev)) 189 + return -EAGAIN; 190 + if (!mlx5_lag_is_shared_fdb(mdev)) 191 + return -EOPNOTSUPP; 192 + } 193 + 194 + return 0; 195 + } 196 + 167 197 static int mlx5_esw_bridge_switchdev_port_event(struct notifier_block *nb, 168 198 unsigned long event, void *ptr) 169 199 { ··· 201 171 202 172 switch (event) { 203 173 case NETDEV_PRECHANGEUPPER: 174 + err = mlx5_esw_bridge_changeupper_validate_netdev(ptr); 204 175 break; 205 176 206 177 case NETDEV_CHANGEUPPER:
+32 -60
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c
··· 6 6 #include "en/tc_priv.h" 7 7 #include "mlx5_core.h" 8 8 9 - /* Must be aligned with enum flow_action_id. */ 10 9 static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = { 11 - &mlx5e_tc_act_accept, 12 - &mlx5e_tc_act_drop, 13 - &mlx5e_tc_act_trap, 14 - &mlx5e_tc_act_goto, 15 - &mlx5e_tc_act_mirred, 16 - &mlx5e_tc_act_mirred, 17 - &mlx5e_tc_act_redirect_ingress, 18 - NULL, /* FLOW_ACTION_MIRRED_INGRESS, */ 19 - &mlx5e_tc_act_vlan, 20 - &mlx5e_tc_act_vlan, 21 - &mlx5e_tc_act_vlan_mangle, 22 - &mlx5e_tc_act_tun_encap, 23 - &mlx5e_tc_act_tun_decap, 24 - &mlx5e_tc_act_pedit, 25 - &mlx5e_tc_act_pedit, 26 - &mlx5e_tc_act_csum, 27 - NULL, /* FLOW_ACTION_MARK, */ 28 - &mlx5e_tc_act_ptype, 29 - NULL, /* FLOW_ACTION_PRIORITY, */ 30 - NULL, /* FLOW_ACTION_WAKE, */ 31 - NULL, /* FLOW_ACTION_QUEUE, */ 32 - &mlx5e_tc_act_sample, 33 - &mlx5e_tc_act_police, 34 - &mlx5e_tc_act_ct, 35 - NULL, /* FLOW_ACTION_CT_METADATA, */ 36 - &mlx5e_tc_act_mpls_push, 37 - &mlx5e_tc_act_mpls_pop, 38 - NULL, /* FLOW_ACTION_MPLS_MANGLE, */ 39 - NULL, /* FLOW_ACTION_GATE, */ 40 - NULL, /* FLOW_ACTION_PPPOE_PUSH, */ 41 - NULL, /* FLOW_ACTION_JUMP, */ 42 - NULL, /* FLOW_ACTION_PIPE, */ 43 - &mlx5e_tc_act_vlan, 44 - &mlx5e_tc_act_vlan, 10 + [FLOW_ACTION_ACCEPT] = &mlx5e_tc_act_accept, 11 + [FLOW_ACTION_DROP] = &mlx5e_tc_act_drop, 12 + [FLOW_ACTION_TRAP] = &mlx5e_tc_act_trap, 13 + [FLOW_ACTION_GOTO] = &mlx5e_tc_act_goto, 14 + [FLOW_ACTION_REDIRECT] = &mlx5e_tc_act_mirred, 15 + [FLOW_ACTION_MIRRED] = &mlx5e_tc_act_mirred, 16 + [FLOW_ACTION_REDIRECT_INGRESS] = &mlx5e_tc_act_redirect_ingress, 17 + [FLOW_ACTION_VLAN_PUSH] = &mlx5e_tc_act_vlan, 18 + [FLOW_ACTION_VLAN_POP] = &mlx5e_tc_act_vlan, 19 + [FLOW_ACTION_VLAN_MANGLE] = &mlx5e_tc_act_vlan_mangle, 20 + [FLOW_ACTION_TUNNEL_ENCAP] = &mlx5e_tc_act_tun_encap, 21 + [FLOW_ACTION_TUNNEL_DECAP] = &mlx5e_tc_act_tun_decap, 22 + [FLOW_ACTION_MANGLE] = &mlx5e_tc_act_pedit, 23 + [FLOW_ACTION_ADD] = &mlx5e_tc_act_pedit, 24 + [FLOW_ACTION_CSUM] = &mlx5e_tc_act_csum, 25 + [FLOW_ACTION_PTYPE] = &mlx5e_tc_act_ptype, 26 + [FLOW_ACTION_SAMPLE] = &mlx5e_tc_act_sample, 27 + [FLOW_ACTION_POLICE] = &mlx5e_tc_act_police, 28 + [FLOW_ACTION_CT] = &mlx5e_tc_act_ct, 29 + [FLOW_ACTION_MPLS_PUSH] = &mlx5e_tc_act_mpls_push, 30 + [FLOW_ACTION_MPLS_POP] = &mlx5e_tc_act_mpls_pop, 31 + [FLOW_ACTION_VLAN_PUSH_ETH] = &mlx5e_tc_act_vlan, 32 + [FLOW_ACTION_VLAN_POP_ETH] = &mlx5e_tc_act_vlan, 45 33 }; 46 34 47 - /* Must be aligned with enum flow_action_id. */ 48 35 static struct mlx5e_tc_act *tc_acts_nic[NUM_FLOW_ACTIONS] = { 49 - &mlx5e_tc_act_accept, 50 - &mlx5e_tc_act_drop, 51 - NULL, /* FLOW_ACTION_TRAP, */ 52 - &mlx5e_tc_act_goto, 53 - &mlx5e_tc_act_mirred_nic, 54 - NULL, /* FLOW_ACTION_MIRRED, */ 55 - NULL, /* FLOW_ACTION_REDIRECT_INGRESS, */ 56 - NULL, /* FLOW_ACTION_MIRRED_INGRESS, */ 57 - NULL, /* FLOW_ACTION_VLAN_PUSH, */ 58 - NULL, /* FLOW_ACTION_VLAN_POP, */ 59 - NULL, /* FLOW_ACTION_VLAN_MANGLE, */ 60 - NULL, /* FLOW_ACTION_TUNNEL_ENCAP, */ 61 - NULL, /* FLOW_ACTION_TUNNEL_DECAP, */ 62 - &mlx5e_tc_act_pedit, 63 - &mlx5e_tc_act_pedit, 64 - &mlx5e_tc_act_csum, 65 - &mlx5e_tc_act_mark, 66 - NULL, /* FLOW_ACTION_PTYPE, */ 67 - NULL, /* FLOW_ACTION_PRIORITY, */ 68 - NULL, /* FLOW_ACTION_WAKE, */ 69 - NULL, /* FLOW_ACTION_QUEUE, */ 70 - NULL, /* FLOW_ACTION_SAMPLE, */ 71 - NULL, /* FLOW_ACTION_POLICE, */ 72 - &mlx5e_tc_act_ct, 36 + [FLOW_ACTION_ACCEPT] = &mlx5e_tc_act_accept, 37 + [FLOW_ACTION_DROP] = &mlx5e_tc_act_drop, 38 + [FLOW_ACTION_GOTO] = &mlx5e_tc_act_goto, 39 + [FLOW_ACTION_REDIRECT] = &mlx5e_tc_act_mirred_nic, 40 + [FLOW_ACTION_MANGLE] = &mlx5e_tc_act_pedit, 41 + [FLOW_ACTION_ADD] = &mlx5e_tc_act_pedit, 42 + [FLOW_ACTION_CSUM] = &mlx5e_tc_act_csum, 43 + [FLOW_ACTION_MARK] = &mlx5e_tc_act_mark, 44 + [FLOW_ACTION_CT] = &mlx5e_tc_act_ct, 73 45 }; 74 46 75 47 /**
+23 -1
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
··· 11 11 12 12 #define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg *)NULL)->inline_hdr.start)) 13 13 14 + /* IPSEC inline data includes: 15 + * 1. ESP trailer: up to 255 bytes of padding, 1 byte for pad length, 1 byte for 16 + * next header. 17 + * 2. ESP authentication data: 16 bytes for ICV. 18 + */ 19 + #define MLX5E_MAX_TX_IPSEC_DS DIV_ROUND_UP(sizeof(struct mlx5_wqe_inline_seg) + \ 20 + 255 + 1 + 1 + 16, MLX5_SEND_WQE_DS) 21 + 22 + /* 366 should be big enough to cover all L2, L3 and L4 headers with possible 23 + * encapsulations. 24 + */ 25 + #define MLX5E_MAX_TX_INLINE_DS DIV_ROUND_UP(366 - INL_HDR_START_SZ + VLAN_HLEN, \ 26 + MLX5_SEND_WQE_DS) 27 + 28 + /* Sync the calculation with mlx5e_sq_calc_wqe_attr. */ 29 + #define MLX5E_MAX_TX_WQEBBS DIV_ROUND_UP(MLX5E_TX_WQE_EMPTY_DS_COUNT + \ 30 + MLX5E_MAX_TX_INLINE_DS + \ 31 + MLX5E_MAX_TX_IPSEC_DS + \ 32 + MAX_SKB_FRAGS + 1, \ 33 + MLX5_SEND_WQEBB_NUM_DS) 34 + 14 35 #define MLX5E_RX_ERR_CQE(cqe) (get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND) 15 36 16 37 static inline ··· 445 424 446 425 static inline u16 mlx5e_stop_room_for_wqe(struct mlx5_core_dev *mdev, u16 wqe_size) 447 426 { 427 + WARN_ON_ONCE(PAGE_SIZE / MLX5_SEND_WQE_BB < mlx5e_get_max_sq_wqebbs(mdev)); 428 + 448 429 /* A WQE must not cross the page boundary, hence two conditions: 449 430 * 1. Its size must not exceed the page size. 450 431 * 2. If the WQE size is X, and the space remaining in a page is less ··· 458 435 WARN_ONCE(wqe_size > mlx5e_get_max_sq_wqebbs(mdev), 459 436 "wqe_size %u is greater than max SQ WQEBBs %u", 460 437 wqe_size, mlx5e_get_max_sq_wqebbs(mdev)); 461 - 462 438 463 439 return MLX5E_STOP_ROOM(wqe_size); 464 440 }
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
··· 117 117 xdpi.page.rq = rq; 118 118 119 119 dma_addr = page_pool_get_dma_addr(page) + (xdpf->data - (void *)xdpf); 120 - dma_sync_single_for_device(sq->pdev, dma_addr, xdptxd.len, DMA_TO_DEVICE); 120 + dma_sync_single_for_device(sq->pdev, dma_addr, xdptxd.len, DMA_BIDIRECTIONAL); 121 121 122 122 if (unlikely(xdp_frame_has_frags(xdpf))) { 123 123 sinfo = xdp_get_shared_info_from_frame(xdpf); ··· 131 131 skb_frag_off(frag); 132 132 len = skb_frag_size(frag); 133 133 dma_sync_single_for_device(sq->pdev, addr, len, 134 - DMA_TO_DEVICE); 134 + DMA_BIDIRECTIONAL); 135 135 } 136 136 } 137 137
+7
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5693 5693 mlx5e_fs_set_state_destroy(priv->fs, 5694 5694 !test_bit(MLX5E_STATE_DESTROYING, &priv->state)); 5695 5695 5696 + /* Validate the max_wqe_size_sq capability. */ 5697 + if (WARN_ON_ONCE(mlx5e_get_max_sq_wqebbs(priv->mdev) < MLX5E_MAX_TX_WQEBBS)) { 5698 + mlx5_core_warn(priv->mdev, "MLX5E: Max SQ WQEBBs firmware capability: %u, needed %lu\n", 5699 + mlx5e_get_max_sq_wqebbs(priv->mdev), MLX5E_MAX_TX_WQEBBS); 5700 + return -EIO; 5701 + } 5702 + 5696 5703 /* max number of channels may have changed */ 5697 5704 max_nch = mlx5e_calc_max_nch(priv->mdev, priv->netdev, profile); 5698 5705 if (priv->channels.params.num_channels > max_nch) {
+14 -13
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 266 266 267 267 addr = page_pool_get_dma_addr(au->page); 268 268 /* Non-XSK always uses PAGE_SIZE. */ 269 - dma_sync_single_for_device(rq->pdev, addr, PAGE_SIZE, DMA_FROM_DEVICE); 269 + dma_sync_single_for_device(rq->pdev, addr, PAGE_SIZE, rq->buff.map_dir); 270 270 return true; 271 271 } 272 272 ··· 282 282 return -ENOMEM; 283 283 284 284 /* Non-XSK always uses PAGE_SIZE. */ 285 - addr = dma_map_page_attrs(rq->pdev, au->page, 0, PAGE_SIZE, 286 - rq->buff.map_dir, DMA_ATTR_SKIP_CPU_SYNC); 285 + addr = dma_map_page(rq->pdev, au->page, 0, PAGE_SIZE, rq->buff.map_dir); 287 286 if (unlikely(dma_mapping_error(rq->pdev, addr))) { 288 287 page_pool_recycle_direct(rq->page_pool, au->page); 289 288 au->page = NULL; ··· 426 427 { 427 428 dma_addr_t addr = page_pool_get_dma_addr(au->page); 428 429 429 - dma_sync_single_for_cpu(rq->pdev, addr + frag_offset, len, DMA_FROM_DEVICE); 430 + dma_sync_single_for_cpu(rq->pdev, addr + frag_offset, len, 431 + rq->buff.map_dir); 430 432 page_ref_inc(au->page); 431 433 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 432 434 au->page, frag_offset, len, truesize); 433 435 } 434 436 435 437 static inline void 436 - mlx5e_copy_skb_header(struct device *pdev, struct sk_buff *skb, 438 + mlx5e_copy_skb_header(struct mlx5e_rq *rq, struct sk_buff *skb, 437 439 struct page *page, dma_addr_t addr, 438 440 int offset_from, int dma_offset, u32 headlen) 439 441 { ··· 442 442 /* Aligning len to sizeof(long) optimizes memcpy performance */ 443 443 unsigned int len = ALIGN(headlen, sizeof(long)); 444 444 445 - dma_sync_single_for_cpu(pdev, addr + dma_offset, len, DMA_FROM_DEVICE); 445 + dma_sync_single_for_cpu(rq->pdev, addr + dma_offset, len, 446 + rq->buff.map_dir); 446 447 skb_copy_to_linear_data(skb, from, len); 447 448 } 448 449 ··· 1539 1538 1540 1539 addr = page_pool_get_dma_addr(au->page); 1541 1540 dma_sync_single_range_for_cpu(rq->pdev, addr, wi->offset, 1542 - frag_size, DMA_FROM_DEVICE); 1541 + frag_size, rq->buff.map_dir); 1543 1542 net_prefetch(data); 1544 1543 1545 1544 prog = rcu_dereference(rq->xdp_prog); ··· 1588 1587 1589 1588 addr = page_pool_get_dma_addr(au->page); 1590 1589 dma_sync_single_range_for_cpu(rq->pdev, addr, wi->offset, 1591 - rq->buff.frame0_sz, DMA_FROM_DEVICE); 1590 + rq->buff.frame0_sz, rq->buff.map_dir); 1592 1591 net_prefetchw(va); /* xdp_frame data area */ 1593 1592 net_prefetch(va + rx_headroom); 1594 1593 ··· 1609 1608 1610 1609 addr = page_pool_get_dma_addr(au->page); 1611 1610 dma_sync_single_for_cpu(rq->pdev, addr + wi->offset, 1612 - frag_consumed_bytes, DMA_FROM_DEVICE); 1611 + frag_consumed_bytes, rq->buff.map_dir); 1613 1612 1614 1613 if (!xdp_buff_has_frags(&xdp)) { 1615 1614 /* Init on the first fragment to avoid cold cache access ··· 1906 1905 mlx5e_fill_skb_data(skb, rq, au, byte_cnt, frag_offset); 1907 1906 /* copy header */ 1908 1907 addr = page_pool_get_dma_addr(head_au->page); 1909 - mlx5e_copy_skb_header(rq->pdev, skb, head_au->page, addr, 1908 + mlx5e_copy_skb_header(rq, skb, head_au->page, addr, 1910 1909 head_offset, head_offset, headlen); 1911 1910 /* skb linear part was allocated with headlen and aligned to long */ 1912 1911 skb->tail += headlen; ··· 1940 1939 1941 1940 addr = page_pool_get_dma_addr(au->page); 1942 1941 dma_sync_single_range_for_cpu(rq->pdev, addr, head_offset, 1943 - frag_size, DMA_FROM_DEVICE); 1942 + frag_size, rq->buff.map_dir); 1944 1943 net_prefetch(data); 1945 1944 1946 1945 prog = rcu_dereference(rq->xdp_prog); ··· 1988 1987 1989 1988 if (likely(frag_size <= BIT(MLX5E_SHAMPO_LOG_MAX_HEADER_ENTRY_SIZE))) { 1990 1989 /* build SKB around header */ 1991 - dma_sync_single_range_for_cpu(rq->pdev, head->addr, 0, frag_size, DMA_FROM_DEVICE); 1990 + dma_sync_single_range_for_cpu(rq->pdev, head->addr, 0, frag_size, rq->buff.map_dir); 1992 1991 prefetchw(hdr); 1993 1992 prefetch(data); 1994 1993 skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size, 0); ··· 2010 2009 } 2011 2010 2012 2011 prefetchw(skb->data); 2013 - mlx5e_copy_skb_header(rq->pdev, skb, head->page, head->addr, 2012 + mlx5e_copy_skb_header(rq, skb, head->page, head->addr, 2014 2013 head_offset + rx_headroom, 2015 2014 rx_headroom, head_size); 2016 2015 /* skb linear part was allocated with headlen and aligned to long */
+6 -8
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 3633 3633 attr2->action = 0; 3634 3634 attr2->flags = 0; 3635 3635 attr2->parse_attr = parse_attr; 3636 - attr2->esw_attr->out_count = 0; 3637 - attr2->esw_attr->split_count = 0; 3638 3636 attr2->dest_chain = 0; 3639 3637 attr2->dest_ft = NULL; 3638 + 3639 + if (ns_type == MLX5_FLOW_NAMESPACE_FDB) { 3640 + attr2->esw_attr->out_count = 0; 3641 + attr2->esw_attr->split_count = 0; 3642 + } 3643 + 3640 3644 return attr2; 3641 3645 } 3642 3646 ··· 4759 4755 act->police.avrate || act->police.overhead) { 4760 4756 NL_SET_ERR_MSG_MOD(extack, 4761 4757 "Offload not supported when peakrate/avrate/overhead is configured"); 4762 - return -EOPNOTSUPP; 4763 - } 4764 - 4765 - if (act->police.rate_pkt_ps) { 4766 - NL_SET_ERR_MSG_MOD(extack, 4767 - "QoS offload not support packets per second"); 4768 4758 return -EOPNOTSUPP; 4769 4759 } 4770 4760
+5
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 305 305 u16 ds_cnt_inl = 0; 306 306 u16 ds_cnt_ids = 0; 307 307 308 + /* Sync the calculation with MLX5E_MAX_TX_WQEBBS. */ 309 + 308 310 if (attr->insz) 309 311 ds_cnt_ids = DIV_ROUND_UP(sizeof(struct mlx5_wqe_inline_seg) + attr->insz, 310 312 MLX5_SEND_WQE_DS); ··· 319 317 inl += VLAN_HLEN; 320 318 321 319 ds_cnt_inl = DIV_ROUND_UP(inl, MLX5_SEND_WQE_DS); 320 + if (WARN_ON_ONCE(ds_cnt_inl > MLX5E_MAX_TX_INLINE_DS)) 321 + netdev_warn(skb->dev, "ds_cnt_inl = %u > max %u\n", ds_cnt_inl, 322 + (u16)MLX5E_MAX_TX_INLINE_DS); 322 323 ds_cnt += ds_cnt_inl; 323 324 } 324 325
+8 -6
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 1387 1387 esw->mode == MLX5_ESWITCH_LEGACY ? "LEGACY" : "OFFLOADS", 1388 1388 esw->esw_funcs.num_vfs, esw->enabled_vports); 1389 1389 1390 - esw->fdb_table.flags &= ~MLX5_ESW_FDB_CREATED; 1391 - if (esw->mode == MLX5_ESWITCH_OFFLOADS) 1392 - esw_offloads_disable(esw); 1393 - else if (esw->mode == MLX5_ESWITCH_LEGACY) 1394 - esw_legacy_disable(esw); 1395 - mlx5_esw_acls_ns_cleanup(esw); 1390 + if (esw->fdb_table.flags & MLX5_ESW_FDB_CREATED) { 1391 + esw->fdb_table.flags &= ~MLX5_ESW_FDB_CREATED; 1392 + if (esw->mode == MLX5_ESWITCH_OFFLOADS) 1393 + esw_offloads_disable(esw); 1394 + else if (esw->mode == MLX5_ESWITCH_LEGACY) 1395 + esw_legacy_disable(esw); 1396 + mlx5_esw_acls_ns_cleanup(esw); 1397 + } 1396 1398 1397 1399 if (esw->mode == MLX5_ESWITCH_OFFLOADS) 1398 1400 devl_rate_nodes_destroy(devlink);
+3 -15
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 2310 2310 static int esw_offloads_start(struct mlx5_eswitch *esw, 2311 2311 struct netlink_ext_ack *extack) 2312 2312 { 2313 - int err, err1; 2313 + int err; 2314 2314 2315 2315 esw->mode = MLX5_ESWITCH_OFFLOADS; 2316 2316 err = mlx5_eswitch_enable_locked(esw, esw->dev->priv.sriov.num_vfs); ··· 2318 2318 NL_SET_ERR_MSG_MOD(extack, 2319 2319 "Failed setting eswitch to offloads"); 2320 2320 esw->mode = MLX5_ESWITCH_LEGACY; 2321 - err1 = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS); 2322 - if (err1) { 2323 - NL_SET_ERR_MSG_MOD(extack, 2324 - "Failed setting eswitch back to legacy"); 2325 - } 2326 2321 mlx5_rescan_drivers(esw->dev); 2327 2322 } 2328 2323 if (esw->offloads.inline_mode == MLX5_INLINE_MODE_NONE) { ··· 3384 3389 static int esw_offloads_stop(struct mlx5_eswitch *esw, 3385 3390 struct netlink_ext_ack *extack) 3386 3391 { 3387 - int err, err1; 3392 + int err; 3388 3393 3389 3394 esw->mode = MLX5_ESWITCH_LEGACY; 3390 3395 err = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS); 3391 - if (err) { 3396 + if (err) 3392 3397 NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy"); 3393 - esw->mode = MLX5_ESWITCH_OFFLOADS; 3394 - err1 = mlx5_eswitch_enable_locked(esw, MLX5_ESWITCH_IGNORE_NUM_VFS); 3395 - if (err1) { 3396 - NL_SET_ERR_MSG_MOD(extack, 3397 - "Failed setting eswitch back to offloads"); 3398 - } 3399 - } 3400 3398 3401 3399 return err; 3402 3400 }
+8 -6
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
··· 30 30 sizeof(dest->vport.num), hash); 31 31 hash = jhash((const void *)&dest->vport.vhca_id, 32 32 sizeof(dest->vport.num), hash); 33 - if (dest->vport.pkt_reformat) 34 - hash = jhash(dest->vport.pkt_reformat, 35 - sizeof(*dest->vport.pkt_reformat), 33 + if (flow_act->pkt_reformat) 34 + hash = jhash(flow_act->pkt_reformat, 35 + sizeof(*flow_act->pkt_reformat), 36 36 hash); 37 37 return hash; 38 38 } ··· 53 53 if (ret) 54 54 return ret; 55 55 56 - return dest1->vport.pkt_reformat && dest2->vport.pkt_reformat ? 57 - memcmp(dest1->vport.pkt_reformat, dest2->vport.pkt_reformat, 58 - sizeof(*dest1->vport.pkt_reformat)) : 0; 56 + if (flow_act1->pkt_reformat && flow_act2->pkt_reformat) 57 + return memcmp(flow_act1->pkt_reformat, flow_act2->pkt_reformat, 58 + sizeof(*flow_act1->pkt_reformat)); 59 + 60 + return !(flow_act1->pkt_reformat == flow_act2->pkt_reformat); 59 61 } 60 62 61 63 static int
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
··· 152 152 mlx5_unload_one(dev); 153 153 if (mlx5_health_wait_pci_up(dev)) 154 154 mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n"); 155 - mlx5_load_one(dev, false); 155 + else 156 + mlx5_load_one(dev, false); 156 157 devlink_remote_reload_actions_performed(priv_to_devlink(dev), 0, 157 158 BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | 158 159 BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE));
+20 -9
drivers/net/ethernet/neterion/s2io.c
··· 7128 7128 if (ret) { 7129 7129 DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", 7130 7130 dev->name); 7131 - s2io_reset(sp); 7132 - free_rx_buffers(sp); 7133 - return -ENOMEM; 7131 + ret = -ENOMEM; 7132 + goto err_fill_buff; 7134 7133 } 7135 7134 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, 7136 7135 ring->rx_bufs_left); ··· 7167 7168 /* Enable Rx Traffic and interrupts on the NIC */ 7168 7169 if (start_nic(sp)) { 7169 7170 DBG_PRINT(ERR_DBG, "%s: Starting NIC failed\n", dev->name); 7170 - s2io_reset(sp); 7171 - free_rx_buffers(sp); 7172 - return -ENODEV; 7171 + ret = -ENODEV; 7172 + goto err_out; 7173 7173 } 7174 7174 7175 7175 /* Add interrupt service routine */ 7176 7176 if (s2io_add_isr(sp) != 0) { 7177 7177 if (sp->config.intr_type == MSI_X) 7178 7178 s2io_rem_isr(sp); 7179 - s2io_reset(sp); 7180 - free_rx_buffers(sp); 7181 - return -ENODEV; 7179 + ret = -ENODEV; 7180 + goto err_out; 7182 7181 } 7183 7182 7184 7183 timer_setup(&sp->alarm_timer, s2io_alarm_handle, 0); ··· 7196 7199 } 7197 7200 7198 7201 return 0; 7202 + 7203 + err_out: 7204 + if (config->napi) { 7205 + if (config->intr_type == MSI_X) { 7206 + for (i = 0; i < sp->config.rx_ring_num; i++) 7207 + napi_disable(&sp->mac_control.rings[i].napi); 7208 + } else { 7209 + napi_disable(&sp->napi); 7210 + } 7211 + } 7212 + err_fill_buff: 7213 + s2io_reset(sp); 7214 + free_rx_buffers(sp); 7215 + return ret; 7199 7216 } 7200 7217 7201 7218 /**
+1
drivers/net/ethernet/ni/nixge.c
··· 900 900 err_rx_irq: 901 901 free_irq(priv->tx_irq, ndev); 902 902 err_tx_irq: 903 + napi_disable(&priv->napi); 903 904 phy_stop(phy); 904 905 phy_disconnect(phy); 905 906 tasklet_kill(&priv->dma_err_tasklet);
+9 -2
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 629 629 { 630 630 plat->rx_queues_to_use = 8; 631 631 plat->tx_queues_to_use = 8; 632 - plat->clk_ptp_rate = 200000000; 633 632 plat->use_phy_wol = 1; 634 633 635 634 plat->safety_feat_cfg->tsoee = 1; ··· 653 654 plat->serdes_powerup = intel_serdes_powerup; 654 655 plat->serdes_powerdown = intel_serdes_powerdown; 655 656 657 + plat->clk_ptp_rate = 204800000; 658 + 656 659 return ehl_common_data(pdev, plat); 657 660 } 658 661 ··· 667 666 { 668 667 plat->bus_id = 1; 669 668 plat->phy_interface = PHY_INTERFACE_MODE_RGMII; 669 + 670 + plat->clk_ptp_rate = 204800000; 670 671 671 672 return ehl_common_data(pdev, plat); 672 673 } ··· 685 682 intel_priv->is_pse = true; 686 683 plat->bus_id = 2; 687 684 plat->addr64 = 32; 685 + 686 + plat->clk_ptp_rate = 200000000; 688 687 689 688 intel_mgbe_pse_crossts_adj(intel_priv, EHL_PSE_ART_MHZ); 690 689 ··· 727 722 plat->bus_id = 3; 728 723 plat->addr64 = 32; 729 724 725 + plat->clk_ptp_rate = 200000000; 726 + 730 727 intel_mgbe_pse_crossts_adj(intel_priv, EHL_PSE_ART_MHZ); 731 728 732 729 return ehl_common_data(pdev, plat); ··· 764 757 { 765 758 plat->rx_queues_to_use = 6; 766 759 plat->tx_queues_to_use = 4; 767 - plat->clk_ptp_rate = 200000000; 760 + plat->clk_ptp_rate = 204800000; 768 761 plat->speed_mode_2500 = intel_speed_mode_2500; 769 762 770 763 plat->safety_feat_cfg->tsoee = 1;
+31 -8
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
··· 75 75 plat->mdio_bus_data = devm_kzalloc(&pdev->dev, 76 76 sizeof(*plat->mdio_bus_data), 77 77 GFP_KERNEL); 78 - if (!plat->mdio_bus_data) 79 - return -ENOMEM; 78 + if (!plat->mdio_bus_data) { 79 + ret = -ENOMEM; 80 + goto err_put_node; 81 + } 80 82 plat->mdio_bus_data->needs_reset = true; 81 83 } 82 84 83 85 plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg), GFP_KERNEL); 84 - if (!plat->dma_cfg) 85 - return -ENOMEM; 86 + if (!plat->dma_cfg) { 87 + ret = -ENOMEM; 88 + goto err_put_node; 89 + } 86 90 87 91 /* Enable pci device */ 88 92 ret = pci_enable_device(pdev); 89 93 if (ret) { 90 94 dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n", __func__); 91 - return ret; 95 + goto err_put_node; 92 96 } 93 97 94 98 /* Get the base address of device */ ··· 101 97 continue; 102 98 ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); 103 99 if (ret) 104 - return ret; 100 + goto err_disable_device; 105 101 break; 106 102 } 107 103 ··· 112 108 phy_mode = device_get_phy_mode(&pdev->dev); 113 109 if (phy_mode < 0) { 114 110 dev_err(&pdev->dev, "phy_mode not found\n"); 115 - return phy_mode; 111 + ret = phy_mode; 112 + goto err_disable_device; 116 113 } 117 114 118 115 plat->phy_interface = phy_mode; ··· 130 125 if (res.irq < 0) { 131 126 dev_err(&pdev->dev, "IRQ macirq not found\n"); 132 127 ret = -ENODEV; 128 + goto err_disable_msi; 133 129 } 134 130 135 131 res.wol_irq = of_irq_get_byname(np, "eth_wake_irq"); ··· 143 137 if (res.lpi_irq < 0) { 144 138 dev_err(&pdev->dev, "IRQ eth_lpi not found\n"); 145 139 ret = -ENODEV; 140 + goto err_disable_msi; 146 141 } 147 142 148 - return stmmac_dvr_probe(&pdev->dev, plat, &res); 143 + ret = stmmac_dvr_probe(&pdev->dev, plat, &res); 144 + if (ret) 145 + goto err_disable_msi; 146 + 147 + return ret; 148 + 149 + err_disable_msi: 150 + pci_disable_msi(pdev); 151 + err_disable_device: 152 + pci_disable_device(pdev); 153 + err_put_node: 154 + of_node_put(plat->mdio_node); 155 + return ret; 149 156 } 150 157 151 158 static void loongson_dwmac_remove(struct pci_dev *pdev) 152 159 { 160 + struct net_device *ndev = dev_get_drvdata(&pdev->dev); 161 + struct stmmac_priv *priv = netdev_priv(ndev); 153 162 int i; 154 163 164 + of_node_put(priv->plat->mdio_node); 155 165 stmmac_dvr_remove(&pdev->dev); 156 166 157 167 for (i = 0; i < PCI_STD_NUM_BARS; i++) { ··· 177 155 break; 178 156 } 179 157 158 + pci_disable_msi(pdev); 180 159 pci_disable_device(pdev); 181 160 } 182 161
+3 -5
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
··· 272 272 if (ret) 273 273 return ret; 274 274 275 - devm_add_action_or_reset(dwmac->dev, 276 - (void(*)(void *))clk_disable_unprepare, 277 - dwmac->rgmii_tx_clk); 278 - 279 - return 0; 275 + return devm_add_action_or_reset(dwmac->dev, 276 + (void(*)(void *))clk_disable_unprepare, 277 + clk); 280 278 } 281 279 282 280 static int meson8b_init_rgmii_delays(struct meson8b_dwmac *dwmac)
-1
drivers/net/ethernet/sunplus/spl2sw_driver.c
··· 287 287 if (ret) { 288 288 dev_err(&pdev->dev, "Failed to register net device \"%s\"!\n", 289 289 ndev->name); 290 - free_netdev(ndev); 291 290 *r_ndev = NULL; 292 291 return ret; 293 292 }
+1 -1
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 2858 2858 if (ret < 0) 2859 2859 return ret; 2860 2860 2861 - am65_cpsw_nuss_phylink_cleanup(common); 2862 2861 am65_cpsw_unregister_devlink(common); 2863 2862 am65_cpsw_unregister_notifiers(common); 2864 2863 ··· 2865 2866 * dma_deconfigure(dev) before devres_release_all(dev) 2866 2867 */ 2867 2868 am65_cpsw_nuss_cleanup_ndev(common); 2869 + am65_cpsw_nuss_phylink_cleanup(common); 2868 2870 2869 2871 of_platform_device_destroy(common->mdio_dev, NULL); 2870 2872
+2
drivers/net/ethernet/ti/cpsw.c
··· 854 854 855 855 err_cleanup: 856 856 if (!cpsw->usage_count) { 857 + napi_disable(&cpsw->napi_rx); 858 + napi_disable(&cpsw->napi_tx); 857 859 cpdma_ctlr_stop(cpsw->dma); 858 860 cpsw_destroy_xdp_rxqs(cpsw); 859 861 }
+4 -1
drivers/net/ethernet/tundra/tsi108_eth.c
··· 1290 1290 1291 1291 data->rxring = dma_alloc_coherent(&data->pdev->dev, rxring_size, 1292 1292 &data->rxdma, GFP_KERNEL); 1293 - if (!data->rxring) 1293 + if (!data->rxring) { 1294 + free_irq(data->irq_num, dev); 1294 1295 return -ENOMEM; 1296 + } 1295 1297 1296 1298 data->txring = dma_alloc_coherent(&data->pdev->dev, txring_size, 1297 1299 &data->txdma, GFP_KERNEL); 1298 1300 if (!data->txring) { 1301 + free_irq(data->irq_num, dev); 1299 1302 dma_free_coherent(&data->pdev->dev, rxring_size, data->rxring, 1300 1303 data->rxdma); 1301 1304 return -ENOMEM;
+1 -1
drivers/net/hamradio/bpqether.c
··· 533 533 if (!net_eq(dev_net(dev), &init_net)) 534 534 return NOTIFY_DONE; 535 535 536 - if (!dev_is_ethdev(dev)) 536 + if (!dev_is_ethdev(dev) && !bpq_get_ax25_dev(dev)) 537 537 return NOTIFY_DONE; 538 538 539 539 switch (event) {
+17 -33
drivers/net/macsec.c
··· 1413 1413 return NULL; 1414 1414 } 1415 1415 1416 - static struct macsec_rx_sc *create_rx_sc(struct net_device *dev, sci_t sci) 1416 + static struct macsec_rx_sc *create_rx_sc(struct net_device *dev, sci_t sci, 1417 + bool active) 1417 1418 { 1418 1419 struct macsec_rx_sc *rx_sc; 1419 1420 struct macsec_dev *macsec; ··· 1438 1437 } 1439 1438 1440 1439 rx_sc->sci = sci; 1441 - rx_sc->active = true; 1440 + rx_sc->active = active; 1442 1441 refcount_set(&rx_sc->refcnt, 1); 1443 1442 1444 1443 secy = &macsec_priv(dev)->secy; ··· 1839 1838 secy->key_len); 1840 1839 1841 1840 err = macsec_offload(ops->mdo_add_rxsa, &ctx); 1841 + memzero_explicit(ctx.sa.key, secy->key_len); 1842 1842 if (err) 1843 1843 goto cleanup; 1844 1844 } ··· 1878 1876 struct macsec_rx_sc *rx_sc; 1879 1877 struct nlattr *tb_rxsc[MACSEC_RXSC_ATTR_MAX + 1]; 1880 1878 struct macsec_secy *secy; 1881 - bool was_active; 1879 + bool active = true; 1882 1880 int ret; 1883 1881 1884 1882 if (!attrs[MACSEC_ATTR_IFINDEX]) ··· 1900 1898 secy = &macsec_priv(dev)->secy; 1901 1899 sci = nla_get_sci(tb_rxsc[MACSEC_RXSC_ATTR_SCI]); 1902 1900 1903 - rx_sc = create_rx_sc(dev, sci); 1901 + if (tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]) 1902 + active = nla_get_u8(tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]); 1903 + 1904 + rx_sc = create_rx_sc(dev, sci, active); 1904 1905 if (IS_ERR(rx_sc)) { 1905 1906 rtnl_unlock(); 1906 1907 return PTR_ERR(rx_sc); 1907 1908 } 1908 - 1909 - was_active = rx_sc->active; 1910 - if (tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]) 1911 - rx_sc->active = !!nla_get_u8(tb_rxsc[MACSEC_RXSC_ATTR_ACTIVE]); 1912 1909 1913 1910 if (macsec_is_offloaded(netdev_priv(dev))) { 1914 1911 const struct macsec_ops *ops; ··· 1932 1931 return 0; 1933 1932 1934 1933 cleanup: 1935 - rx_sc->active = was_active; 1934 + del_rx_sc(secy, sci); 1935 + free_rx_sc(rx_sc); 1936 1936 rtnl_unlock(); 1937 1937 return ret; 1938 1938 } ··· 2082 2080 secy->key_len); 2083 2081 2084 2082 err = macsec_offload(ops->mdo_add_txsa, &ctx); 2083 + memzero_explicit(ctx.sa.key, secy->key_len); 2085 2084 if (err) 2086 2085 goto cleanup; 2087 2086 } ··· 2573 2570 struct macsec_tx_sc *tx_sc = &secy->tx_sc; 2574 2571 int i; 2575 2572 2576 - if (secy->n_rx_sc > 0) 2573 + if (secy->rx_sc) 2577 2574 return true; 2578 2575 2579 2576 for (i = 0; i < MACSEC_NUM_AN; i++) ··· 2656 2653 ret = macsec_offload(func, &ctx); 2657 2654 if (ret) 2658 2655 goto rollback; 2659 - 2660 - /* Force features update, since they are different for SW MACSec and 2661 - * HW offloading cases. 2662 - */ 2663 - netdev_update_features(dev); 2664 2656 2665 2657 rtnl_unlock(); 2666 2658 return 0; ··· 3430 3432 return ret; 3431 3433 } 3432 3434 3433 - #define SW_MACSEC_FEATURES \ 3435 + #define MACSEC_FEATURES \ 3434 3436 (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST) 3435 - 3436 - /* If h/w offloading is enabled, use real device features save for 3437 - * VLAN_FEATURES - they require additional ops 3438 - * HW_MACSEC - no reason to report it 3439 - */ 3440 - #define REAL_DEV_FEATURES(dev) \ 3441 - ((dev)->features & ~(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC)) 3442 3437 3443 3438 static int macsec_dev_init(struct net_device *dev) 3444 3439 { ··· 3449 3458 return err; 3450 3459 } 3451 3460 3452 - if (macsec_is_offloaded(macsec)) { 3453 - dev->features = REAL_DEV_FEATURES(real_dev); 3454 - } else { 3455 - dev->features = real_dev->features & SW_MACSEC_FEATURES; 3456 - dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE; 3457 - } 3461 + dev->features = real_dev->features & MACSEC_FEATURES; 3462 + dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE; 3458 3463 3459 3464 dev->needed_headroom = real_dev->needed_headroom + 3460 3465 MACSEC_NEEDED_HEADROOM; ··· 3482 3495 struct macsec_dev *macsec = macsec_priv(dev); 3483 3496 struct net_device *real_dev = macsec->real_dev; 3484 3497 3485 - if (macsec_is_offloaded(macsec)) 3486 - return REAL_DEV_FEATURES(real_dev); 3487 - 3488 - features &= (real_dev->features & SW_MACSEC_FEATURES) | 3498 + features &= (real_dev->features & MACSEC_FEATURES) | 3489 3499 NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES; 3490 3500 features |= NETIF_F_LLTX; 3491 3501
+3 -1
drivers/net/macvlan.c
··· 1533 1533 /* the macvlan port may be freed by macvlan_uninit when fail to register. 1534 1534 * so we destroy the macvlan port only when it's valid. 1535 1535 */ 1536 - if (create && macvlan_port_get_rtnl(lowerdev)) 1536 + if (create && macvlan_port_get_rtnl(lowerdev)) { 1537 + macvlan_flush_sources(port, vlan); 1537 1538 macvlan_port_destroy(port->dev); 1539 + } 1538 1540 return err; 1539 1541 } 1540 1542 EXPORT_SYMBOL_GPL(macvlan_common_newlink);
+1
drivers/net/phy/mscc/mscc_macsec.c
··· 632 632 633 633 list_del(&flow->list); 634 634 clear_bit(flow->index, bitmap); 635 + memzero_explicit(flow->key, sizeof(flow->key)); 635 636 kfree(flow); 636 637 } 637 638
+13 -5
drivers/net/tun.c
··· 1967 1967 skb_headlen(skb)); 1968 1968 1969 1969 if (unlikely(headlen > skb_headlen(skb))) { 1970 + WARN_ON_ONCE(1); 1971 + err = -ENOMEM; 1970 1972 dev_core_stats_rx_dropped_inc(tun->dev); 1973 + napi_busy: 1971 1974 napi_free_frags(&tfile->napi); 1972 1975 rcu_read_unlock(); 1973 1976 mutex_unlock(&tfile->napi_mutex); 1974 - WARN_ON(1); 1975 - return -ENOMEM; 1977 + return err; 1976 1978 } 1977 1979 1978 - local_bh_disable(); 1979 - napi_gro_frags(&tfile->napi); 1980 - local_bh_enable(); 1980 + if (likely(napi_schedule_prep(&tfile->napi))) { 1981 + local_bh_disable(); 1982 + napi_gro_frags(&tfile->napi); 1983 + napi_complete(&tfile->napi); 1984 + local_bh_enable(); 1985 + } else { 1986 + err = -EBUSY; 1987 + goto napi_busy; 1988 + } 1981 1989 mutex_unlock(&tfile->napi_mutex); 1982 1990 } else if (tfile->napi_enabled) { 1983 1991 struct sk_buff_head *queue = &tfile->sk.sk_write_queue;
+2 -1
drivers/net/wan/lapbether.c
··· 325 325 326 326 err = lapb_register(dev, &lapbeth_callbacks); 327 327 if (err != LAPB_OK) { 328 + napi_disable(&lapbeth->napi); 328 329 pr_err("lapb_register error: %d\n", err); 329 330 return -ENODEV; 330 331 } ··· 447 446 if (dev_net(dev) != &init_net) 448 447 return NOTIFY_DONE; 449 448 450 - if (!dev_is_ethdev(dev)) 449 + if (!dev_is_ethdev(dev) && !lapbeth_get_x25_dev(dev)) 451 450 return NOTIFY_DONE; 452 451 453 452 switch (event) {
+1 -1
drivers/net/wireless/ath/ath11k/qmi.h
··· 27 27 #define ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 52 28 28 #define ATH11K_QMI_CALDB_SIZE 0x480000 29 29 #define ATH11K_QMI_BDF_EXT_STR_LENGTH 0x20 30 - #define ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT 3 30 + #define ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT 5 31 31 32 32 #define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035 33 33 #define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037
+1 -5
drivers/net/wireless/ath/ath11k/reg.c
··· 287 287 goto err; 288 288 } 289 289 290 - rtnl_lock(); 291 - wiphy_lock(ar->hw->wiphy); 292 - ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy); 293 - wiphy_unlock(ar->hw->wiphy); 294 - rtnl_unlock(); 290 + ret = regulatory_set_wiphy_regd(ar->hw->wiphy, regd_copy); 295 291 296 292 kfree(regd_copy); 297 293
+4
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
··· 228 228 brcmf_fweh_event_name(event->code), event->code, 229 229 event->emsg.ifidx, event->emsg.bsscfgidx, 230 230 event->emsg.addr); 231 + if (event->emsg.bsscfgidx >= BRCMF_MAX_IFS) { 232 + bphy_err(drvr, "invalid bsscfg index: %u\n", event->emsg.bsscfgidx); 233 + goto event_free; 234 + } 231 235 232 236 /* convert event message */ 233 237 emsg_be = &event->emsg;
+14 -4
drivers/net/wireless/cisco/airo.c
··· 5232 5232 return -1; 5233 5233 } 5234 5234 5235 - static int set_wep_key(struct airo_info *ai, u16 index, const char *key, 5235 + static int set_wep_key(struct airo_info *ai, u16 index, const u8 *key, 5236 5236 u16 keylen, int perm, int lock) 5237 5237 { 5238 5238 static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; ··· 5283 5283 struct net_device *dev = pde_data(inode); 5284 5284 struct airo_info *ai = dev->ml_priv; 5285 5285 int i, rc; 5286 - char key[16]; 5286 + u8 key[16]; 5287 5287 u16 index = 0; 5288 5288 int j = 0; 5289 5289 ··· 5311 5311 } 5312 5312 5313 5313 for (i = 0; i < 16*3 && data->wbuffer[i+j]; i++) { 5314 + int val; 5315 + 5316 + if (i % 3 == 2) 5317 + continue; 5318 + 5319 + val = hex_to_bin(data->wbuffer[i+j]); 5320 + if (val < 0) { 5321 + airo_print_err(ai->dev->name, "WebKey passed invalid key hex"); 5322 + return; 5323 + } 5314 5324 switch(i%3) { 5315 5325 case 0: 5316 - key[i/3] = hex_to_bin(data->wbuffer[i+j])<<4; 5326 + key[i/3] = (u8)val << 4; 5317 5327 break; 5318 5328 case 1: 5319 - key[i/3] |= hex_to_bin(data->wbuffer[i+j]); 5329 + key[i/3] |= (u8)val; 5320 5330 break; 5321 5331 } 5322 5332 }
+5
drivers/net/wireless/mac80211_hwsim.c
··· 910 910 struct hwsim_vif_priv *vp = (void *)vif->drv_priv; 911 911 struct sk_buff *skb; 912 912 struct ieee80211_hdr *hdr; 913 + struct ieee80211_tx_info *cb; 913 914 914 915 if (!vp->assoc) 915 916 return; ··· 931 930 memcpy(hdr->addr1, vp->bssid, ETH_ALEN); 932 931 memcpy(hdr->addr2, mac, ETH_ALEN); 933 932 memcpy(hdr->addr3, vp->bssid, ETH_ALEN); 933 + 934 + cb = IEEE80211_SKB_CB(skb); 935 + cb->control.rates[0].count = 1; 936 + cb->control.rates[1].idx = -1; 934 937 935 938 rcu_read_lock(); 936 939 mac80211_hwsim_tx_frame(data->hw, skb,
+4 -4
drivers/net/wireless/ralink/rt2x00/rt2400pci.c
··· 1023 1023 { 1024 1024 u32 reg, reg2; 1025 1025 unsigned int i; 1026 - char put_to_sleep; 1027 - char bbp_state; 1028 - char rf_state; 1026 + bool put_to_sleep; 1027 + u8 bbp_state; 1028 + u8 rf_state; 1029 1029 1030 1030 put_to_sleep = (state != STATE_AWAKE); 1031 1031 ··· 1561 1561 { 1562 1562 struct hw_mode_spec *spec = &rt2x00dev->spec; 1563 1563 struct channel_info *info; 1564 - char *tx_power; 1564 + u8 *tx_power; 1565 1565 unsigned int i; 1566 1566 1567 1567 /*
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2400pci.h
··· 939 939 #define DEFAULT_TXPOWER 39 940 940 941 941 #define __CLAMP_TX(__txpower) \ 942 - clamp_t(char, (__txpower), MIN_TXPOWER, MAX_TXPOWER) 942 + clamp_t(u8, (__txpower), MIN_TXPOWER, MAX_TXPOWER) 943 943 944 944 #define TXPOWER_FROM_DEV(__txpower) \ 945 945 ((__CLAMP_TX(__txpower) - MAX_TXPOWER) + MIN_TXPOWER)
+4 -4
drivers/net/wireless/ralink/rt2x00/rt2500pci.c
··· 1176 1176 { 1177 1177 u32 reg, reg2; 1178 1178 unsigned int i; 1179 - char put_to_sleep; 1180 - char bbp_state; 1181 - char rf_state; 1179 + bool put_to_sleep; 1180 + u8 bbp_state; 1181 + u8 rf_state; 1182 1182 1183 1183 put_to_sleep = (state != STATE_AWAKE); 1184 1184 ··· 1856 1856 { 1857 1857 struct hw_mode_spec *spec = &rt2x00dev->spec; 1858 1858 struct channel_info *info; 1859 - char *tx_power; 1859 + u8 *tx_power; 1860 1860 unsigned int i; 1861 1861 1862 1862 /*
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2500pci.h
··· 1219 1219 (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) 1220 1220 1221 1221 #define TXPOWER_TO_DEV(__txpower) \ 1222 - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1222 + clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1223 1223 1224 1224 #endif /* RT2500PCI_H */
+4 -4
drivers/net/wireless/ralink/rt2x00/rt2500usb.c
··· 984 984 u16 reg; 985 985 u16 reg2; 986 986 unsigned int i; 987 - char put_to_sleep; 988 - char bbp_state; 989 - char rf_state; 987 + bool put_to_sleep; 988 + u8 bbp_state; 989 + u8 rf_state; 990 990 991 991 put_to_sleep = (state != STATE_AWAKE); 992 992 ··· 1663 1663 { 1664 1664 struct hw_mode_spec *spec = &rt2x00dev->spec; 1665 1665 struct channel_info *info; 1666 - char *tx_power; 1666 + u8 *tx_power; 1667 1667 unsigned int i; 1668 1668 1669 1669 /*
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2500usb.h
··· 839 839 (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) 840 840 841 841 #define TXPOWER_TO_DEV(__txpower) \ 842 - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) 842 + clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER) 843 843 844 844 #endif /* RT2500USB_H */
+30 -30
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
··· 3372 3372 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { 3373 3373 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { 3374 3374 /* r55/r59 value array of channel 1~14 */ 3375 - static const char r55_bt_rev[] = {0x83, 0x83, 3375 + static const u8 r55_bt_rev[] = {0x83, 0x83, 3376 3376 0x83, 0x73, 0x73, 0x63, 0x53, 0x53, 3377 3377 0x53, 0x43, 0x43, 0x43, 0x43, 0x43}; 3378 - static const char r59_bt_rev[] = {0x0e, 0x0e, 3378 + static const u8 r59_bt_rev[] = {0x0e, 0x0e, 3379 3379 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09, 3380 3380 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}; 3381 3381 ··· 3384 3384 rt2800_rfcsr_write(rt2x00dev, 59, 3385 3385 r59_bt_rev[idx]); 3386 3386 } else { 3387 - static const char r59_bt[] = {0x8b, 0x8b, 0x8b, 3387 + static const u8 r59_bt[] = {0x8b, 0x8b, 0x8b, 3388 3388 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89, 3389 3389 0x88, 0x88, 0x86, 0x85, 0x84}; 3390 3390 ··· 3392 3392 } 3393 3393 } else { 3394 3394 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { 3395 - static const char r55_nonbt_rev[] = {0x23, 0x23, 3395 + static const u8 r55_nonbt_rev[] = {0x23, 0x23, 3396 3396 0x23, 0x23, 0x13, 0x13, 0x03, 0x03, 3397 3397 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; 3398 - static const char r59_nonbt_rev[] = {0x07, 0x07, 3398 + static const u8 r59_nonbt_rev[] = {0x07, 0x07, 3399 3399 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 3400 3400 0x07, 0x07, 0x06, 0x05, 0x04, 0x04}; 3401 3401 ··· 3406 3406 } else if (rt2x00_rt(rt2x00dev, RT5390) || 3407 3407 rt2x00_rt(rt2x00dev, RT5392) || 3408 3408 rt2x00_rt(rt2x00dev, RT6352)) { 3409 - static const char r59_non_bt[] = {0x8f, 0x8f, 3409 + static const u8 r59_non_bt[] = {0x8f, 0x8f, 3410 3410 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, 3411 3411 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; 3412 3412 3413 3413 rt2800_rfcsr_write(rt2x00dev, 59, 3414 3414 r59_non_bt[idx]); 3415 3415 } else if (rt2x00_rt(rt2x00dev, RT5350)) { 3416 - static const char r59_non_bt[] = {0x0b, 0x0b, 3416 + static const u8 r59_non_bt[] = {0x0b, 0x0b, 3417 3417 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 3418 3418 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06}; 3419 3419 ··· 4035 4035 rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); 4036 4036 } 4037 4037 4038 - static char rt2800_txpower_to_dev(struct rt2x00_dev *rt2x00dev, 4038 + static s8 rt2800_txpower_to_dev(struct rt2x00_dev *rt2x00dev, 4039 4039 unsigned int channel, 4040 - char txpower) 4040 + s8 txpower) 4041 4041 { 4042 4042 if (rt2x00_rt(rt2x00dev, RT3593) || 4043 4043 rt2x00_rt(rt2x00dev, RT3883)) 4044 4044 txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC); 4045 4045 4046 4046 if (channel <= 14) 4047 - return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); 4047 + return clamp_t(s8, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); 4048 4048 4049 4049 if (rt2x00_rt(rt2x00dev, RT3593) || 4050 4050 rt2x00_rt(rt2x00dev, RT3883)) 4051 - return clamp_t(char, txpower, MIN_A_TXPOWER_3593, 4051 + return clamp_t(s8, txpower, MIN_A_TXPOWER_3593, 4052 4052 MAX_A_TXPOWER_3593); 4053 4053 else 4054 - return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); 4054 + return clamp_t(s8, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); 4055 4055 } 4056 4056 4057 4057 static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, ··· 8530 8530 u8 bytevalue = 0; 8531 8531 int rcalcode; 8532 8532 u8 r_cal_code = 0; 8533 - char d1 = 0, d2 = 0; 8533 + s8 d1 = 0, d2 = 0; 8534 8534 u8 rfvalue; 8535 8535 u32 MAC_RF_BYPASS0, MAC_RF_CONTROL0, MAC_PWR_PIN_CFG; 8536 8536 u32 maccfg; ··· 8591 8591 if (bytevalue > 128) 8592 8592 d1 = bytevalue - 256; 8593 8593 else 8594 - d1 = (char)bytevalue; 8594 + d1 = (s8)bytevalue; 8595 8595 rt2800_bbp_write(rt2x00dev, 22, 0x0); 8596 8596 rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x01); 8597 8597 ··· 8601 8601 if (bytevalue > 128) 8602 8602 d2 = bytevalue - 256; 8603 8603 else 8604 - d2 = (char)bytevalue; 8604 + d2 = (s8)bytevalue; 8605 8605 rt2800_bbp_write(rt2x00dev, 22, 0x0); 8606 8606 8607 8607 rcalcode = rt2800_calcrcalibrationcode(rt2x00dev, d1, d2); ··· 8703 8703 static u32 rt2800_do_sqrt_accumulation(u32 si) 8704 8704 { 8705 8705 u32 root, root_pre, bit; 8706 - char i; 8706 + s8 i; 8707 8707 8708 8708 bit = 1 << 15; 8709 8709 root = 0; ··· 9330 9330 u8 alc_idx, u8 dc_result[][RF_ALC_NUM][2]) 9331 9331 { 9332 9332 u32 p0 = 0, p1 = 0, pf = 0; 9333 - char idx0 = 0, idx1 = 0; 9333 + s8 idx0 = 0, idx1 = 0; 9334 9334 u8 idxf[] = {0x00, 0x00}; 9335 9335 u8 ibit = 0x20; 9336 9336 u8 iorq; 9337 - char bidx; 9337 + s8 bidx; 9338 9338 9339 9339 rt2800_bbp_write(rt2x00dev, 158, 0xb0); 9340 9340 rt2800_bbp_write(rt2x00dev, 159, 0x80); ··· 9384 9384 static void rt2800_iq_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 *ges, u8 *pes) 9385 9385 { 9386 9386 u32 p0 = 0, p1 = 0, pf = 0; 9387 - char perr = 0, gerr = 0, iq_err = 0; 9388 - char pef = 0, gef = 0; 9389 - char psta, pend; 9390 - char gsta, gend; 9387 + s8 perr = 0, gerr = 0, iq_err = 0; 9388 + s8 pef = 0, gef = 0; 9389 + s8 psta, pend; 9390 + s8 gsta, gend; 9391 9391 9392 9392 u8 ibit = 0x20; 9393 9393 u8 first_search = 0x00, touch_neg_max = 0x00; 9394 - char idx0 = 0, idx1 = 0; 9394 + s8 idx0 = 0, idx1 = 0; 9395 9395 u8 gop; 9396 9396 u8 bbp = 0; 9397 - char bidx; 9397 + s8 bidx; 9398 9398 9399 9399 for (bidx = 5; bidx >= 1; bidx--) { 9400 9400 for (gop = 0; gop < 2; gop++) { ··· 10043 10043 return 0; 10044 10044 } 10045 10045 10046 - static char rt2800_lp_tx_filter_bw_cal(struct rt2x00_dev *rt2x00dev) 10046 + static s8 rt2800_lp_tx_filter_bw_cal(struct rt2x00_dev *rt2x00dev) 10047 10047 { 10048 10048 unsigned int cnt; 10049 10049 u8 bbp_val; 10050 - char cal_val; 10050 + s8 cal_val; 10051 10051 10052 10052 rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x82); 10053 10053 ··· 10079 10079 u8 rx_filter_target_20m = 0x27, rx_filter_target_40m = 0x31; 10080 10080 int loop = 0, is_ht40, cnt; 10081 10081 u8 bbp_val, rf_val; 10082 - char cal_r32_init, cal_r32_val, cal_diff; 10082 + s8 cal_r32_init, cal_r32_val, cal_diff; 10083 10083 u8 saverfb5r00, saverfb5r01, saverfb5r03, saverfb5r04, saverfb5r05; 10084 10084 u8 saverfb5r06, saverfb5r07; 10085 10085 u8 saverfb5r08, saverfb5r17, saverfb5r18, saverfb5r19, saverfb5r20; ··· 11550 11550 { 11551 11551 struct hw_mode_spec *spec = &rt2x00dev->spec; 11552 11552 struct channel_info *info; 11553 - char *default_power1; 11554 - char *default_power2; 11555 - char *default_power3; 11553 + s8 *default_power1; 11554 + s8 *default_power2; 11555 + s8 *default_power3; 11556 11556 unsigned int i, tx_chains, rx_chains; 11557 11557 u32 reg; 11558 11558
+4 -4
drivers/net/wireless/ralink/rt2x00/rt2800lib.h
··· 32 32 struct rt2800_drv_data { 33 33 u8 calibration_bw20; 34 34 u8 calibration_bw40; 35 - char rx_calibration_bw20; 36 - char rx_calibration_bw40; 37 - char tx_calibration_bw20; 38 - char tx_calibration_bw40; 35 + s8 rx_calibration_bw20; 36 + s8 rx_calibration_bw40; 37 + s8 tx_calibration_bw20; 38 + s8 tx_calibration_bw40; 39 39 u8 bbp25; 40 40 u8 bbp26; 41 41 u8 txmixer_gain_24g;
+3 -3
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
··· 117 117 const u16 buffer_length) 118 118 { 119 119 int status = 0; 120 - unsigned char *tb; 120 + u8 *tb; 121 121 u16 off, len, bsize; 122 122 123 123 mutex_lock(&rt2x00dev->csr_mutex); 124 124 125 - tb = (char *)buffer; 125 + tb = (u8 *)buffer; 126 126 off = offset; 127 127 len = buffer_length; 128 128 while (len && !status) { ··· 215 215 rd->cr.wLength = cpu_to_le16(sizeof(u32)); 216 216 217 217 usb_fill_control_urb(urb, usb_dev, usb_rcvctrlpipe(usb_dev, 0), 218 - (unsigned char *)(&rd->cr), &rd->reg, sizeof(rd->reg), 218 + (u8 *)(&rd->cr), &rd->reg, sizeof(rd->reg), 219 219 rt2x00usb_register_read_async_cb, rd); 220 220 usb_anchor_urb(urb, rt2x00dev->anchor); 221 221 if (usb_submit_urb(urb, GFP_ATOMIC) < 0) {
+2 -2
drivers/net/wireless/ralink/rt2x00/rt61pci.c
··· 1709 1709 { 1710 1710 u32 reg, reg2; 1711 1711 unsigned int i; 1712 - char put_to_sleep; 1712 + bool put_to_sleep; 1713 1713 1714 1714 put_to_sleep = (state != STATE_AWAKE); 1715 1715 ··· 2656 2656 { 2657 2657 struct hw_mode_spec *spec = &rt2x00dev->spec; 2658 2658 struct channel_info *info; 2659 - char *tx_power; 2659 + u8 *tx_power; 2660 2660 unsigned int i; 2661 2661 2662 2662 /*
+1 -1
drivers/net/wireless/ralink/rt2x00/rt61pci.h
··· 1484 1484 (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) 1485 1485 1486 1486 #define TXPOWER_TO_DEV(__txpower) \ 1487 - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1487 + clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1488 1488 1489 1489 #endif /* RT61PCI_H */
+2 -2
drivers/net/wireless/ralink/rt2x00/rt73usb.c
··· 1378 1378 { 1379 1379 u32 reg, reg2; 1380 1380 unsigned int i; 1381 - char put_to_sleep; 1381 + bool put_to_sleep; 1382 1382 1383 1383 put_to_sleep = (state != STATE_AWAKE); 1384 1384 ··· 2090 2090 { 2091 2091 struct hw_mode_spec *spec = &rt2x00dev->spec; 2092 2092 struct channel_info *info; 2093 - char *tx_power; 2093 + u8 *tx_power; 2094 2094 unsigned int i; 2095 2095 2096 2096 /*
+1 -1
drivers/net/wireless/ralink/rt2x00/rt73usb.h
··· 1063 1063 (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) 1064 1064 1065 1065 #define TXPOWER_TO_DEV(__txpower) \ 1066 - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1066 + clamp_t(u8, __txpower, MIN_TXPOWER, MAX_TXPOWER) 1067 1067 1068 1068 #endif /* RT73USB_H */
+1 -1
drivers/net/wwan/Kconfig
··· 94 94 95 95 config IOSM 96 96 tristate "IOSM Driver for Intel M.2 WWAN Device" 97 - depends on INTEL_IOMMU 97 + depends on PCI 98 98 select NET_DEVLINK 99 99 select RELAY if WWAN_DEBUGFS 100 100 help
+1
drivers/net/wwan/iosm/iosm_ipc_coredump.c
··· 2 2 /* 3 3 * Copyright (C) 2020-2021 Intel Corporation. 4 4 */ 5 + #include <linux/vmalloc.h> 5 6 6 7 #include "iosm_ipc_coredump.h" 7 8
+1
drivers/net/wwan/iosm/iosm_ipc_devlink.c
··· 2 2 /* 3 3 * Copyright (C) 2020-2021 Intel Corporation. 4 4 */ 5 + #include <linux/vmalloc.h> 5 6 6 7 #include "iosm_ipc_chnl_cfg.h" 7 8 #include "iosm_ipc_coredump.h"
+8
drivers/net/wwan/iosm/iosm_ipc_imem_ops.c
··· 91 91 } 92 92 93 93 ipc_chnl_cfg_get(&chnl_cfg, ipc_imem->nr_of_channels); 94 + 95 + if (ipc_imem->mmio->mux_protocol == MUX_AGGREGATION && 96 + ipc_imem->nr_of_channels == IPC_MEM_IP_CHL_ID_0) { 97 + chnl_cfg.ul_nr_of_entries = IPC_MEM_MAX_TDS_MUX_AGGR_UL; 98 + chnl_cfg.dl_nr_of_entries = IPC_MEM_MAX_TDS_MUX_AGGR_DL; 99 + chnl_cfg.dl_buf_size = IPC_MEM_MAX_ADB_BUF_SIZE; 100 + } 101 + 94 102 ipc_imem_channel_init(ipc_imem, IPC_CTYPE_WWAN, chnl_cfg, 95 103 IRQ_MOD_OFF); 96 104
+1
drivers/net/wwan/iosm/iosm_ipc_mux.h
··· 10 10 11 11 #define IPC_MEM_MAX_UL_DG_ENTRIES 100 12 12 #define IPC_MEM_MAX_TDS_MUX_AGGR_UL 60 13 + #define IPC_MEM_MAX_TDS_MUX_AGGR_DL 60 13 14 14 15 #define IPC_MEM_MAX_ADB_BUF_SIZE (16 * 1024) 15 16 #define IPC_MEM_MAX_UL_ADB_BUF_SIZE IPC_MEM_MAX_ADB_BUF_SIZE
+15 -3
drivers/net/wwan/iosm/iosm_ipc_pcie.c
··· 232 232 */ 233 233 static enum ipc_pcie_sleep_state ipc_pcie_read_bios_cfg(struct device *dev) 234 234 { 235 + enum ipc_pcie_sleep_state sleep_state = IPC_PCIE_D0L12; 235 236 union acpi_object *object; 236 237 acpi_handle handle_acpi; 237 238 ··· 243 242 } 244 243 245 244 object = acpi_evaluate_dsm(handle_acpi, &wwan_acpi_guid, 0, 3, NULL); 245 + if (!object) 246 + goto default_ret; 246 247 247 - if (object && object->integer.value == 3) 248 - return IPC_PCIE_D3L2; 248 + if (object->integer.value == 3) 249 + sleep_state = IPC_PCIE_D3L2; 250 + 251 + kfree(object); 249 252 250 253 default_ret: 251 - return IPC_PCIE_D0L12; 254 + return sleep_state; 252 255 } 253 256 254 257 static int ipc_pcie_probe(struct pci_dev *pci, 255 258 const struct pci_device_id *pci_id) 256 259 { 257 260 struct iosm_pcie *ipc_pcie = kzalloc(sizeof(*ipc_pcie), GFP_KERNEL); 261 + int ret; 258 262 259 263 pr_debug("Probing device 0x%X from the vendor 0x%X", pci_id->device, 260 264 pci_id->vendor); ··· 290 284 * ipc_imem_mount() 291 285 */ 292 286 goto pci_enable_fail; 287 + } 288 + 289 + ret = dma_set_mask(ipc_pcie->dev, DMA_BIT_MASK(64)); 290 + if (ret) { 291 + dev_err(ipc_pcie->dev, "Could not set PCI DMA mask: %d", ret); 292 + return ret; 293 293 } 294 294 295 295 ipc_pcie_config_aspm(ipc_pcie);
+7 -36
drivers/net/wwan/iosm/iosm_ipc_wwan.c
··· 40 40 * @ipc_imem: Pointer to imem data-struct 41 41 * @sub_netlist: List of active netdevs 42 42 * @dev: Pointer device structure 43 - * @if_mutex: Mutex used for add and remove interface id 44 43 */ 45 44 struct iosm_wwan { 46 45 struct iosm_imem *ipc_imem; 47 46 struct iosm_netdev_priv __rcu *sub_netlist[IP_MUX_SESSION_END + 1]; 48 47 struct device *dev; 49 - struct mutex if_mutex; /* Mutex used for add and remove interface id */ 50 48 }; 51 49 52 50 /* Bring-up the wwan net link */ ··· 53 55 struct iosm_netdev_priv *priv = wwan_netdev_drvpriv(netdev); 54 56 struct iosm_wwan *ipc_wwan = priv->ipc_wwan; 55 57 int if_id = priv->if_id; 56 - int ret; 57 58 58 59 if (if_id < IP_MUX_SESSION_START || 59 60 if_id >= ARRAY_SIZE(ipc_wwan->sub_netlist)) 60 61 return -EINVAL; 61 - 62 - mutex_lock(&ipc_wwan->if_mutex); 63 62 64 63 /* get channel id */ 65 64 priv->ch_id = ipc_imem_sys_wwan_open(ipc_wwan->ipc_imem, if_id); ··· 65 70 dev_err(ipc_wwan->dev, 66 71 "cannot connect wwan0 & id %d to the IPC mem layer", 67 72 if_id); 68 - ret = -ENODEV; 69 - goto out; 73 + return -ENODEV; 70 74 } 71 75 72 76 /* enable tx path, DL data may follow */ ··· 74 80 dev_dbg(ipc_wwan->dev, "Channel id %d allocated to if_id %d", 75 81 priv->ch_id, priv->if_id); 76 82 77 - ret = 0; 78 - out: 79 - mutex_unlock(&ipc_wwan->if_mutex); 80 - return ret; 83 + return 0; 81 84 } 82 85 83 86 /* Bring-down the wwan net link */ ··· 84 93 85 94 netif_stop_queue(netdev); 86 95 87 - mutex_lock(&priv->ipc_wwan->if_mutex); 88 96 ipc_imem_sys_wwan_close(priv->ipc_wwan->ipc_imem, priv->if_id, 89 97 priv->ch_id); 90 98 priv->ch_id = -1; 91 - mutex_unlock(&priv->ipc_wwan->if_mutex); 92 99 93 100 return 0; 94 101 } ··· 157 168 iosm_dev->max_mtu = ETH_MAX_MTU; 158 169 159 170 iosm_dev->flags = IFF_POINTOPOINT | IFF_NOARP; 171 + iosm_dev->needs_free_netdev = true; 160 172 161 173 iosm_dev->netdev_ops = &ipc_inm_ops; 162 174 } ··· 179 189 priv->netdev = dev; 180 190 priv->ipc_wwan = ipc_wwan; 181 191 182 - mutex_lock(&ipc_wwan->if_mutex); 183 - if (rcu_access_pointer(ipc_wwan->sub_netlist[if_id])) { 184 - err = -EBUSY; 185 - goto out_unlock; 186 - } 192 + if (rcu_access_pointer(ipc_wwan->sub_netlist[if_id])) 193 + return -EBUSY; 187 194 188 195 err = register_netdevice(dev); 189 196 if (err) 190 - goto out_unlock; 197 + return err; 191 198 192 199 rcu_assign_pointer(ipc_wwan->sub_netlist[if_id], priv); 193 - mutex_unlock(&ipc_wwan->if_mutex); 194 - 195 200 netif_device_attach(dev); 196 201 197 202 return 0; 198 - 199 - out_unlock: 200 - mutex_unlock(&ipc_wwan->if_mutex); 201 - return err; 202 203 } 203 204 204 205 static void ipc_wwan_dellink(void *ctxt, struct net_device *dev, ··· 203 222 if_id >= ARRAY_SIZE(ipc_wwan->sub_netlist))) 204 223 return; 205 224 206 - mutex_lock(&ipc_wwan->if_mutex); 207 - 208 225 if (WARN_ON(rcu_access_pointer(ipc_wwan->sub_netlist[if_id]) != priv)) 209 - goto unlock; 226 + return; 210 227 211 228 RCU_INIT_POINTER(ipc_wwan->sub_netlist[if_id], NULL); 212 229 /* unregistering includes synchronize_net() */ 213 230 unregister_netdevice_queue(dev, head); 214 - 215 - unlock: 216 - mutex_unlock(&ipc_wwan->if_mutex); 217 231 } 218 232 219 233 static const struct wwan_ops iosm_wwan_ops = { ··· 299 323 ipc_wwan->dev = dev; 300 324 ipc_wwan->ipc_imem = ipc_imem; 301 325 302 - mutex_init(&ipc_wwan->if_mutex); 303 - 304 326 /* WWAN core will create a netdev for the default IP MUX channel */ 305 327 if (wwan_register_ops(ipc_wwan->dev, &iosm_wwan_ops, ipc_wwan, 306 328 IP_MUX_SESSION_DEFAULT)) { 307 - mutex_destroy(&ipc_wwan->if_mutex); 308 329 kfree(ipc_wwan); 309 330 return NULL; 310 331 } ··· 313 340 { 314 341 /* This call will remove all child netdev(s) */ 315 342 wwan_unregister_ops(ipc_wwan->dev); 316 - 317 - mutex_destroy(&ipc_wwan->if_mutex); 318 343 319 344 kfree(ipc_wwan); 320 345 }
+1
drivers/net/wwan/mhi_wwan_mbim.c
··· 582 582 ndev->min_mtu = ETH_MIN_MTU; 583 583 ndev->max_mtu = MHI_MAX_BUF_SZ - ndev->needed_headroom; 584 584 ndev->tx_queue_len = 1000; 585 + ndev->needs_free_netdev = true; 585 586 } 586 587 587 588 static const struct wwan_ops mhi_mbim_wwan_ops = {
+1 -1
drivers/phy/qualcomm/phy-qcom-qmp-combo.c
··· 2240 2240 static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy) 2241 2241 { 2242 2242 const struct qmp_phy_cfg *cfg = qphy->cfg; 2243 - void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb; 2243 + void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs; 2244 2244 void __iomem *pcs_misc = qphy->pcs_misc; 2245 2245 2246 2246 /* Disable i/o clamp_n on resume for normal mode */
+2 -1
drivers/phy/ralink/phy-mt7621-pci.c
··· 280 280 } 281 281 282 282 static const struct soc_device_attribute mt7621_pci_quirks_match[] = { 283 - { .soc_id = "mt7621", .revision = "E2" } 283 + { .soc_id = "mt7621", .revision = "E2" }, 284 + { /* sentinel */ } 284 285 }; 285 286 286 287 static const struct regmap_config mt7621_pci_phy_regmap_config = {
+2
drivers/phy/st/phy-stm32-usbphyc.c
··· 710 710 ret = of_property_read_u32(child, "reg", &index); 711 711 if (ret || index > usbphyc->nphys) { 712 712 dev_err(&phy->dev, "invalid reg property: %d\n", ret); 713 + if (!ret) 714 + ret = -EINVAL; 713 715 goto put_child; 714 716 } 715 717
+2 -2
drivers/phy/sunplus/phy-sunplus-usb2.c
··· 256 256 usbphy->moon4_res_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "moon4"); 257 257 usbphy->moon4_regs = devm_ioremap(&pdev->dev, usbphy->moon4_res_mem->start, 258 258 resource_size(usbphy->moon4_res_mem)); 259 - if (IS_ERR(usbphy->moon4_regs)) 260 - return PTR_ERR(usbphy->moon4_regs); 259 + if (!usbphy->moon4_regs) 260 + return -ENOMEM; 261 261 262 262 usbphy->phy_clk = devm_clk_get(&pdev->dev, NULL); 263 263 if (IS_ERR(usbphy->phy_clk))
+16 -4
drivers/phy/tegra/xusb.c
··· 1461 1461 1462 1462 void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) 1463 1463 { 1464 - struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 1465 - struct tegra_xusb_padctl *padctl = lane->pad->padctl; 1464 + struct tegra_xusb_lane *lane; 1465 + struct tegra_xusb_padctl *padctl; 1466 + 1467 + if (!phy) 1468 + return; 1469 + 1470 + lane = phy_get_drvdata(phy); 1471 + padctl = lane->pad->padctl; 1466 1472 1467 1473 if (padctl->soc->ops->utmi_pad_power_on) 1468 1474 padctl->soc->ops->utmi_pad_power_on(phy); ··· 1477 1471 1478 1472 void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) 1479 1473 { 1480 - struct tegra_xusb_lane *lane = phy_get_drvdata(phy); 1481 - struct tegra_xusb_padctl *padctl = lane->pad->padctl; 1474 + struct tegra_xusb_lane *lane; 1475 + struct tegra_xusb_padctl *padctl; 1476 + 1477 + if (!phy) 1478 + return; 1479 + 1480 + lane = phy_get_drvdata(phy); 1481 + padctl = lane->pad->padctl; 1482 1482 1483 1483 if (padctl->soc->ops->utmi_pad_power_down) 1484 1484 padctl->soc->ops->utmi_pad_power_down(phy);
+10 -2
drivers/platform/x86/hp-wmi.c
··· 1300 1300 wwan_rfkill = NULL; 1301 1301 rfkill2_count = 0; 1302 1302 1303 - if (hp_wmi_rfkill_setup(device)) 1304 - hp_wmi_rfkill2_setup(device); 1303 + /* 1304 + * In pre-2009 BIOS, command 1Bh return 0x4 to indicate that 1305 + * BIOS no longer controls the power for the wireless 1306 + * devices. All features supported by this command will no 1307 + * longer be supported. 1308 + */ 1309 + if (!hp_wmi_bios_2009_later()) { 1310 + if (hp_wmi_rfkill_setup(device)) 1311 + hp_wmi_rfkill2_setup(device); 1312 + } 1305 1313 1306 1314 err = hp_wmi_hwmon_init(); 1307 1315
+24 -1
drivers/platform/x86/ideapad-laptop.c
··· 1533 1533 {} 1534 1534 }; 1535 1535 1536 + static const struct dmi_system_id no_touchpad_switch_list[] = { 1537 + { 1538 + .ident = "Lenovo Yoga 3 Pro 1370", 1539 + .matches = { 1540 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1541 + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3"), 1542 + }, 1543 + }, 1544 + { 1545 + .ident = "ZhaoYang K4e-IML", 1546 + .matches = { 1547 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1548 + DMI_MATCH(DMI_PRODUCT_VERSION, "ZhaoYang K4e-IML"), 1549 + }, 1550 + }, 1551 + {} 1552 + }; 1553 + 1536 1554 static void ideapad_check_features(struct ideapad_private *priv) 1537 1555 { 1538 1556 acpi_handle handle = priv->adev->handle; ··· 1559 1541 priv->features.hw_rfkill_switch = dmi_check_system(hw_rfkill_list); 1560 1542 1561 1543 /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ 1562 - priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1); 1544 + if (acpi_dev_present("ELAN0634", NULL, -1)) 1545 + priv->features.touchpad_ctrl_via_ec = 0; 1546 + else if (dmi_check_system(no_touchpad_switch_list)) 1547 + priv->features.touchpad_ctrl_via_ec = 0; 1548 + else 1549 + priv->features.touchpad_ctrl_via_ec = 1; 1563 1550 1564 1551 if (!read_ec_data(handle, VPCCMD_R_FAN, &val)) 1565 1552 priv->features.fan_mode = true;
+3
drivers/platform/x86/intel/hid.c
··· 27 27 {"INTC1051", 0}, 28 28 {"INTC1054", 0}, 29 29 {"INTC1070", 0}, 30 + {"INTC1076", 0}, 31 + {"INTC1077", 0}, 32 + {"INTC1078", 0}, 30 33 {"", 0}, 31 34 }; 32 35 MODULE_DEVICE_TABLE(acpi, intel_hid_ids);
+30 -1
drivers/platform/x86/intel/pmt/class.c
··· 9 9 */ 10 10 11 11 #include <linux/kernel.h> 12 + #include <linux/io-64-nonatomic-lo-hi.h> 12 13 #include <linux/module.h> 13 14 #include <linux/mm.h> 14 15 #include <linux/pci.h> ··· 20 19 #define PMT_XA_START 0 21 20 #define PMT_XA_MAX INT_MAX 22 21 #define PMT_XA_LIMIT XA_LIMIT(PMT_XA_START, PMT_XA_MAX) 22 + #define GUID_SPR_PUNIT 0x9956f43f 23 23 24 24 bool intel_pmt_is_early_client_hw(struct device *dev) 25 25 { ··· 34 32 return !!(ivdev->info->quirks & VSEC_QUIRK_EARLY_HW); 35 33 } 36 34 EXPORT_SYMBOL_GPL(intel_pmt_is_early_client_hw); 35 + 36 + static inline int 37 + pmt_memcpy64_fromio(void *to, const u64 __iomem *from, size_t count) 38 + { 39 + int i, remain; 40 + u64 *buf = to; 41 + 42 + if (!IS_ALIGNED((unsigned long)from, 8)) 43 + return -EFAULT; 44 + 45 + for (i = 0; i < count/8; i++) 46 + buf[i] = readq(&from[i]); 47 + 48 + /* Copy any remaining bytes */ 49 + remain = count % 8; 50 + if (remain) { 51 + u64 tmp = readq(&from[i]); 52 + 53 + memcpy(&buf[i], &tmp, remain); 54 + } 55 + 56 + return count; 57 + } 37 58 38 59 /* 39 60 * sysfs ··· 79 54 if (count > entry->size - off) 80 55 count = entry->size - off; 81 56 82 - memcpy_fromio(buf, entry->base + off, count); 57 + if (entry->guid == GUID_SPR_PUNIT) 58 + /* PUNIT on SPR only supports aligned 64-bit read */ 59 + count = pmt_memcpy64_fromio(buf, entry->base + off, count); 60 + else 61 + memcpy_fromio(buf, entry->base + off, count); 83 62 84 63 return count; 85 64 }
+6 -9
drivers/platform/x86/p2sb.c
··· 19 19 #define P2SBC 0xe0 20 20 #define P2SBC_HIDE BIT(8) 21 21 22 + #define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1) 23 + 22 24 static const struct x86_cpu_id p2sb_cpu_ids[] = { 23 25 X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, PCI_DEVFN(13, 0)), 24 - X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, PCI_DEVFN(31, 1)), 25 - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_D, PCI_DEVFN(31, 1)), 26 - X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, PCI_DEVFN(31, 1)), 27 - X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, PCI_DEVFN(31, 1)), 28 - X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, PCI_DEVFN(31, 1)), 29 - X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, PCI_DEVFN(31, 1)), 30 26 {} 31 27 }; 32 28 33 29 static int p2sb_get_devfn(unsigned int *devfn) 34 30 { 31 + unsigned int fn = P2SB_DEVFN_DEFAULT; 35 32 const struct x86_cpu_id *id; 36 33 37 34 id = x86_match_cpu(p2sb_cpu_ids); 38 - if (!id) 39 - return -ENODEV; 35 + if (id) 36 + fn = (unsigned int)id->driver_data; 40 37 41 - *devfn = (unsigned int)id->driver_data; 38 + *devfn = fn; 42 39 return 0; 43 40 } 44 41
+25
drivers/platform/x86/touchscreen_dmi.c
··· 770 770 .properties = predia_basic_props, 771 771 }; 772 772 773 + static const struct property_entry rca_cambio_w101_v2_props[] = { 774 + PROPERTY_ENTRY_U32("touchscreen-min-x", 4), 775 + PROPERTY_ENTRY_U32("touchscreen-min-y", 20), 776 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1644), 777 + PROPERTY_ENTRY_U32("touchscreen-size-y", 874), 778 + PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 779 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rca-cambio-w101-v2.fw"), 780 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 781 + { } 782 + }; 783 + 784 + static const struct ts_dmi_data rca_cambio_w101_v2_data = { 785 + .acpi_name = "MSSL1680:00", 786 + .properties = rca_cambio_w101_v2_props, 787 + }; 788 + 773 789 static const struct property_entry rwc_nanote_p8_props[] = { 774 790 PROPERTY_ENTRY_U32("touchscreen-min-y", 46), 775 791 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728), ··· 1423 1407 /* Note 105b is Foxcon's USB/PCI vendor id */ 1424 1408 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), 1425 1409 DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), 1410 + }, 1411 + }, 1412 + { 1413 + /* RCA Cambio W101 v2 */ 1414 + /* https://github.com/onitake/gsl-firmware/discussions/193 */ 1415 + .driver_data = (void *)&rca_cambio_w101_v2_data, 1416 + .matches = { 1417 + DMI_MATCH(DMI_SYS_VENDOR, "RCA"), 1418 + DMI_MATCH(DMI_PRODUCT_NAME, "W101SA23T1"), 1426 1419 }, 1427 1420 }, 1428 1421 {
+15 -2
drivers/soc/imx/imx93-pd.c
··· 135 135 136 136 ret = pm_genpd_init(&domain->genpd, NULL, domain->init_off); 137 137 if (ret) 138 - return ret; 138 + goto err_clk_unprepare; 139 139 140 140 platform_set_drvdata(pdev, domain); 141 141 142 - return of_genpd_add_provider_simple(np, &domain->genpd); 142 + ret = of_genpd_add_provider_simple(np, &domain->genpd); 143 + if (ret) 144 + goto err_genpd_remove; 145 + 146 + return 0; 147 + 148 + err_genpd_remove: 149 + pm_genpd_remove(&domain->genpd); 150 + 151 + err_clk_unprepare: 152 + if (!domain->init_off) 153 + clk_bulk_disable_unprepare(domain->num_clks, domain->clks); 154 + 155 + return ret; 143 156 } 144 157 145 158 static const struct of_device_id imx93_pd_ids[] = {
+1
drivers/soundwire/intel.c
··· 1513 1513 1514 1514 bus->link_id = auxdev->id; 1515 1515 bus->dev_num_ida_min = INTEL_DEV_NUM_IDA_MIN; 1516 + bus->clk_stop_timeout = 1; 1516 1517 1517 1518 sdw_cdns_probe(cdns); 1518 1519
+9
drivers/soundwire/qcom.c
··· 344 344 if (swrm_wait_for_wr_fifo_avail(swrm)) 345 345 return SDW_CMD_FAIL_OTHER; 346 346 347 + if (cmd_id == SWR_BROADCAST_CMD_ID) 348 + reinit_completion(&swrm->broadcast); 349 + 347 350 /* Its assumed that write is okay as we do not get any status back */ 348 351 swrm->reg_write(swrm, SWRM_CMD_FIFO_WR_CMD, val); 349 352 ··· 379 376 u32 cmd_data, cmd_id, val, retry_attempt = 0; 380 377 381 378 val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr); 379 + 380 + /* 381 + * Check for outstanding cmd wrt. write fifo depth to avoid 382 + * overflow as read will also increase write fifo cnt. 383 + */ 384 + swrm_wait_for_wr_fifo_avail(swrm); 382 385 383 386 /* wait for FIFO RD to complete to avoid overflow */ 384 387 usleep_range(100, 105);
+34 -20
fs/btrfs/backref.c
··· 289 289 struct prelim_ref *ref, *next_ref; 290 290 291 291 rbtree_postorder_for_each_entry_safe(ref, next_ref, 292 - &preftree->root.rb_root, rbnode) 292 + &preftree->root.rb_root, rbnode) { 293 + free_inode_elem_list(ref->inode_list); 293 294 free_pref(ref); 295 + } 294 296 295 297 preftree->root = RB_ROOT_CACHED; 296 298 preftree->count = 0; ··· 650 648 return (struct extent_inode_elem *)(uintptr_t)node->aux; 651 649 } 652 650 651 + static void free_leaf_list(struct ulist *ulist) 652 + { 653 + struct ulist_node *node; 654 + struct ulist_iterator uiter; 655 + 656 + ULIST_ITER_INIT(&uiter); 657 + while ((node = ulist_next(ulist, &uiter))) 658 + free_inode_elem_list(unode_aux_to_inode_list(node)); 659 + 660 + ulist_free(ulist); 661 + } 662 + 653 663 /* 654 664 * We maintain three separate rbtrees: one for direct refs, one for 655 665 * indirect refs which have a key, and one for indirect refs which do not ··· 776 762 cond_resched(); 777 763 } 778 764 out: 779 - ulist_free(parents); 765 + /* 766 + * We may have inode lists attached to refs in the parents ulist, so we 767 + * must free them before freeing the ulist and its refs. 768 + */ 769 + free_leaf_list(parents); 780 770 return ret; 781 771 } 782 772 ··· 1386 1368 if (ret < 0) 1387 1369 goto out; 1388 1370 ref->inode_list = eie; 1371 + /* 1372 + * We transferred the list ownership to the ref, 1373 + * so set to NULL to avoid a double free in case 1374 + * an error happens after this. 1375 + */ 1376 + eie = NULL; 1389 1377 } 1390 1378 ret = ulist_add_merge_ptr(refs, ref->parent, 1391 1379 ref->inode_list, ··· 1417 1393 eie->next = ref->inode_list; 1418 1394 } 1419 1395 eie = NULL; 1396 + /* 1397 + * We have transferred the inode list ownership from 1398 + * this ref to the ref we added to the 'refs' ulist. 1399 + * So set this ref's inode list to NULL to avoid 1400 + * use-after-free when our caller uses it or double 1401 + * frees in case an error happens before we return. 1402 + */ 1403 + ref->inode_list = NULL; 1420 1404 } 1421 1405 cond_resched(); 1422 1406 } ··· 1439 1407 if (ret < 0) 1440 1408 free_inode_elem_list(eie); 1441 1409 return ret; 1442 - } 1443 - 1444 - static void free_leaf_list(struct ulist *blocks) 1445 - { 1446 - struct ulist_node *node = NULL; 1447 - struct extent_inode_elem *eie; 1448 - struct ulist_iterator uiter; 1449 - 1450 - ULIST_ITER_INIT(&uiter); 1451 - while ((node = ulist_next(blocks, &uiter))) { 1452 - if (!node->aux) 1453 - continue; 1454 - eie = unode_aux_to_inode_list(node); 1455 - free_inode_elem_list(eie); 1456 - node->aux = 0; 1457 - } 1458 - 1459 - ulist_free(blocks); 1460 1410 } 1461 1411 1462 1412 /*
+16
fs/btrfs/ctree.c
··· 114 114 } 115 115 116 116 /* 117 + * We want the transaction abort to print stack trace only for errors where the 118 + * cause could be a bug, eg. due to ENOSPC, and not for common errors that are 119 + * caused by external factors. 120 + */ 121 + bool __cold abort_should_print_stack(int errno) 122 + { 123 + switch (errno) { 124 + case -EIO: 125 + case -EROFS: 126 + case -ENOMEM: 127 + return false; 128 + } 129 + return true; 130 + } 131 + 132 + /* 117 133 * safely gets a reference on the root node of a tree. A lock 118 134 * is not taken, so a concurrent writer may put a different node 119 135 * at the root of the tree. See btrfs_lock_root_node for the
+11 -5
fs/btrfs/ctree.h
··· 3462 3462 ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from, 3463 3463 const struct btrfs_ioctl_encoded_io_args *encoded); 3464 3464 3465 - ssize_t btrfs_dio_rw(struct kiocb *iocb, struct iov_iter *iter, size_t done_before); 3465 + ssize_t btrfs_dio_read(struct kiocb *iocb, struct iov_iter *iter, 3466 + size_t done_before); 3467 + struct iomap_dio *btrfs_dio_write(struct kiocb *iocb, struct iov_iter *iter, 3468 + size_t done_before); 3466 3469 3467 3470 extern const struct dentry_operations btrfs_dentry_operations; 3468 3471 ··· 3796 3793 const char *function, 3797 3794 unsigned int line, int errno, bool first_hit); 3798 3795 3796 + bool __cold abort_should_print_stack(int errno); 3797 + 3799 3798 /* 3800 3799 * Call btrfs_abort_transaction as early as possible when an error condition is 3801 - * detected, that way the exact line number is reported. 3800 + * detected, that way the exact stack trace is reported for some errors. 3802 3801 */ 3803 3802 #define btrfs_abort_transaction(trans, errno) \ 3804 3803 do { \ ··· 3809 3804 if (!test_and_set_bit(BTRFS_FS_STATE_TRANS_ABORTED, \ 3810 3805 &((trans)->fs_info->fs_state))) { \ 3811 3806 first = true; \ 3812 - if ((errno) != -EIO && (errno) != -EROFS) { \ 3813 - WARN(1, KERN_DEBUG \ 3807 + if (WARN(abort_should_print_stack(errno), \ 3808 + KERN_DEBUG \ 3814 3809 "BTRFS: Transaction aborted (error %d)\n", \ 3815 - (errno)); \ 3810 + (errno))) { \ 3811 + /* Stack trace printed. */ \ 3816 3812 } else { \ 3817 3813 btrfs_debug((trans)->fs_info, \ 3818 3814 "Transaction aborted (error %d)", \
+3 -1
fs/btrfs/disk-io.c
··· 2551 2551 fs_info->dev_root = root; 2552 2552 } 2553 2553 /* Initialize fs_info for all devices in any case */ 2554 - btrfs_init_devices_late(fs_info); 2554 + ret = btrfs_init_devices_late(fs_info); 2555 + if (ret) 2556 + goto out; 2555 2557 2556 2558 /* 2557 2559 * This tree can share blocks with some other fs tree during relocation
+22 -7
fs/btrfs/file.c
··· 1598 1598 write_bytes); 1599 1599 else 1600 1600 btrfs_check_nocow_unlock(BTRFS_I(inode)); 1601 + 1602 + if (nowait && ret == -ENOSPC) 1603 + ret = -EAGAIN; 1601 1604 break; 1602 1605 } 1603 1606 1604 1607 release_bytes = reserve_bytes; 1605 1608 again: 1606 1609 ret = balance_dirty_pages_ratelimited_flags(inode->i_mapping, bdp_flags); 1607 - if (ret) 1610 + if (ret) { 1611 + btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes); 1608 1612 break; 1613 + } 1609 1614 1610 1615 /* 1611 1616 * This is going to setup the pages array with the number of ··· 1770 1765 loff_t endbyte; 1771 1766 ssize_t err; 1772 1767 unsigned int ilock_flags = 0; 1768 + struct iomap_dio *dio; 1773 1769 1774 1770 if (iocb->ki_flags & IOCB_NOWAIT) 1775 1771 ilock_flags |= BTRFS_ILOCK_TRY; ··· 1831 1825 * So here we disable page faults in the iov_iter and then retry if we 1832 1826 * got -EFAULT, faulting in the pages before the retry. 1833 1827 */ 1834 - again: 1835 1828 from->nofault = true; 1836 - err = btrfs_dio_rw(iocb, from, written); 1829 + dio = btrfs_dio_write(iocb, from, written); 1837 1830 from->nofault = false; 1831 + 1832 + /* 1833 + * iomap_dio_complete() will call btrfs_sync_file() if we have a dsync 1834 + * iocb, and that needs to lock the inode. So unlock it before calling 1835 + * iomap_dio_complete() to avoid a deadlock. 1836 + */ 1837 + btrfs_inode_unlock(inode, ilock_flags); 1838 + 1839 + if (IS_ERR_OR_NULL(dio)) 1840 + err = PTR_ERR_OR_ZERO(dio); 1841 + else 1842 + err = iomap_dio_complete(dio); 1838 1843 1839 1844 /* No increment (+=) because iomap returns a cumulative value. */ 1840 1845 if (err > 0) ··· 1872 1855 } else { 1873 1856 fault_in_iov_iter_readable(from, left); 1874 1857 prev_left = left; 1875 - goto again; 1858 + goto relock; 1876 1859 } 1877 1860 } 1878 - 1879 - btrfs_inode_unlock(inode, ilock_flags); 1880 1861 1881 1862 /* 1882 1863 * If 'err' is -ENOTBLK or we have not written all data, then it means ··· 4050 4035 */ 4051 4036 pagefault_disable(); 4052 4037 to->nofault = true; 4053 - ret = btrfs_dio_rw(iocb, to, read); 4038 + ret = btrfs_dio_read(iocb, to, read); 4054 4039 to->nofault = false; 4055 4040 pagefault_enable(); 4056 4041
+12 -4
fs/btrfs/inode.c
··· 7980 7980 */ 7981 7981 status = BLK_STS_RESOURCE; 7982 7982 dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS); 7983 - if (!dip) 7983 + if (!dip->csums) 7984 7984 goto out_err; 7985 7985 7986 7986 status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums); ··· 8078 8078 .bio_set = &btrfs_dio_bioset, 8079 8079 }; 8080 8080 8081 - ssize_t btrfs_dio_rw(struct kiocb *iocb, struct iov_iter *iter, size_t done_before) 8081 + ssize_t btrfs_dio_read(struct kiocb *iocb, struct iov_iter *iter, size_t done_before) 8082 8082 { 8083 8083 struct btrfs_dio_data data; 8084 8084 8085 8085 return iomap_dio_rw(iocb, iter, &btrfs_dio_iomap_ops, &btrfs_dio_ops, 8086 - IOMAP_DIO_PARTIAL | IOMAP_DIO_NOSYNC, 8087 - &data, done_before); 8086 + IOMAP_DIO_PARTIAL, &data, done_before); 8087 + } 8088 + 8089 + struct iomap_dio *btrfs_dio_write(struct kiocb *iocb, struct iov_iter *iter, 8090 + size_t done_before) 8091 + { 8092 + struct btrfs_dio_data data; 8093 + 8094 + return __iomap_dio_rw(iocb, iter, &btrfs_dio_iomap_ops, &btrfs_dio_ops, 8095 + IOMAP_DIO_PARTIAL, &data, done_before); 8088 8096 } 8089 8097 8090 8098 static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+1 -8
fs/btrfs/scrub.c
··· 2672 2672 u8 csum[BTRFS_CSUM_SIZE]; 2673 2673 u32 blocksize; 2674 2674 2675 - /* 2676 - * Block size determines how many scrub_block will be allocated. Here 2677 - * we use BTRFS_STRIPE_LEN (64KiB) as default limit, so we won't 2678 - * allocate too many scrub_block, while still won't cause too large 2679 - * bios for large extents. 2680 - */ 2681 2675 if (flags & BTRFS_EXTENT_FLAG_DATA) { 2682 2676 if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) 2683 2677 blocksize = map->stripe_len; 2684 2678 else 2685 - blocksize = BTRFS_STRIPE_LEN; 2679 + blocksize = sctx->fs_info->sectorsize; 2686 2680 spin_lock(&sctx->stat_lock); 2687 2681 sctx->stat.data_extents_scrubbed++; 2688 2682 sctx->stat.data_bytes_scrubbed += len; ··· 3911 3917 3912 3918 if (sctx->is_dev_replace && btrfs_is_zoned(fs_info)) { 3913 3919 if (!test_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags)) { 3914 - spin_unlock(&cache->lock); 3915 3920 btrfs_put_block_group(cache); 3916 3921 goto skip; 3917 3922 }
+1 -1
fs/btrfs/tests/btrfs-tests.c
··· 200 200 201 201 void btrfs_free_dummy_root(struct btrfs_root *root) 202 202 { 203 - if (!root) 203 + if (IS_ERR_OR_NULL(root)) 204 204 return; 205 205 /* Will be freed by btrfs_free_fs_roots */ 206 206 if (WARN_ON(test_bit(BTRFS_ROOT_IN_RADIX, &root->state)))
+19 -17
fs/btrfs/tests/qgroup-tests.c
··· 225 225 */ 226 226 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, false); 227 227 if (ret) { 228 - ulist_free(old_roots); 229 228 test_err("couldn't find old roots: %d", ret); 230 229 return ret; 231 230 } 232 231 233 232 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, 234 233 BTRFS_FS_TREE_OBJECTID); 235 - if (ret) 234 + if (ret) { 235 + ulist_free(old_roots); 236 236 return ret; 237 + } 237 238 238 239 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); 239 240 if (ret) { 240 241 ulist_free(old_roots); 241 - ulist_free(new_roots); 242 242 test_err("couldn't find old roots: %d", ret); 243 243 return ret; 244 244 } ··· 250 250 return ret; 251 251 } 252 252 253 + /* btrfs_qgroup_account_extent() always frees the ulists passed to it. */ 254 + old_roots = NULL; 255 + new_roots = NULL; 256 + 253 257 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID, 254 258 nodesize, nodesize)) { 255 259 test_err("qgroup counts didn't match expected values"); 256 260 return -EINVAL; 257 261 } 258 - old_roots = NULL; 259 - new_roots = NULL; 260 262 261 263 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, false); 262 264 if (ret) { 263 - ulist_free(old_roots); 264 265 test_err("couldn't find old roots: %d", ret); 265 266 return ret; 266 267 } 267 268 268 269 ret = remove_extent_item(root, nodesize, nodesize); 269 - if (ret) 270 + if (ret) { 271 + ulist_free(old_roots); 270 272 return -EINVAL; 273 + } 271 274 272 275 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); 273 276 if (ret) { 274 277 ulist_free(old_roots); 275 - ulist_free(new_roots); 276 278 test_err("couldn't find old roots: %d", ret); 277 279 return ret; 278 280 } ··· 324 322 325 323 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, false); 326 324 if (ret) { 327 - ulist_free(old_roots); 328 325 test_err("couldn't find old roots: %d", ret); 329 326 return ret; 330 327 } 331 328 332 329 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, 333 330 BTRFS_FS_TREE_OBJECTID); 334 - if (ret) 331 + if (ret) { 332 + ulist_free(old_roots); 335 333 return ret; 334 + } 336 335 337 336 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); 338 337 if (ret) { 339 338 ulist_free(old_roots); 340 - ulist_free(new_roots); 341 339 test_err("couldn't find old roots: %d", ret); 342 340 return ret; 343 341 } ··· 357 355 358 356 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, false); 359 357 if (ret) { 360 - ulist_free(old_roots); 361 358 test_err("couldn't find old roots: %d", ret); 362 359 return ret; 363 360 } 364 361 365 362 ret = add_tree_ref(root, nodesize, nodesize, 0, 366 363 BTRFS_FIRST_FREE_OBJECTID); 367 - if (ret) 364 + if (ret) { 365 + ulist_free(old_roots); 368 366 return ret; 367 + } 369 368 370 369 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); 371 370 if (ret) { 372 371 ulist_free(old_roots); 373 - ulist_free(new_roots); 374 372 test_err("couldn't find old roots: %d", ret); 375 373 return ret; 376 374 } ··· 396 394 397 395 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, false); 398 396 if (ret) { 399 - ulist_free(old_roots); 400 397 test_err("couldn't find old roots: %d", ret); 401 398 return ret; 402 399 } 403 400 404 401 ret = remove_extent_ref(root, nodesize, nodesize, 0, 405 402 BTRFS_FIRST_FREE_OBJECTID); 406 - if (ret) 403 + if (ret) { 404 + ulist_free(old_roots); 407 405 return ret; 406 + } 408 407 409 408 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); 410 409 if (ret) { 411 410 ulist_free(old_roots); 412 - ulist_free(new_roots); 413 411 test_err("couldn't find old roots: %d", ret); 414 412 return ret; 415 413 }
+29 -10
fs/btrfs/volumes.c
··· 1011 1011 rcu_assign_pointer(device->name, name); 1012 1012 } 1013 1013 1014 + if (orig_dev->zone_info) { 1015 + struct btrfs_zoned_device_info *zone_info; 1016 + 1017 + zone_info = btrfs_clone_dev_zone_info(orig_dev); 1018 + if (!zone_info) { 1019 + btrfs_free_device(device); 1020 + ret = -ENOMEM; 1021 + goto error; 1022 + } 1023 + device->zone_info = zone_info; 1024 + } 1025 + 1014 1026 list_add(&device->dev_list, &fs_devices->devices); 1015 1027 device->fs_devices = fs_devices; 1016 1028 fs_devices->num_devices++; ··· 6930 6918 static bool dev_args_match_device(const struct btrfs_dev_lookup_args *args, 6931 6919 const struct btrfs_device *device) 6932 6920 { 6933 - ASSERT((args->devid != (u64)-1) || args->missing); 6921 + if (args->missing) { 6922 + if (test_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state) && 6923 + !device->bdev) 6924 + return true; 6925 + return false; 6926 + } 6934 6927 6935 - if ((args->devid != (u64)-1) && device->devid != args->devid) 6928 + if (device->devid != args->devid) 6936 6929 return false; 6937 6930 if (args->uuid && memcmp(device->uuid, args->uuid, BTRFS_UUID_SIZE) != 0) 6938 6931 return false; 6939 - if (!args->missing) 6940 - return true; 6941 - if (test_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &device->dev_state) && 6942 - !device->bdev) 6943 - return true; 6944 - return false; 6932 + return true; 6945 6933 } 6946 6934 6947 6935 /* ··· 7756 7744 return ret; 7757 7745 } 7758 7746 7759 - void btrfs_init_devices_late(struct btrfs_fs_info *fs_info) 7747 + int btrfs_init_devices_late(struct btrfs_fs_info *fs_info) 7760 7748 { 7761 7749 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices, *seed_devs; 7762 7750 struct btrfs_device *device; 7751 + int ret = 0; 7763 7752 7764 7753 fs_devices->fs_info = fs_info; 7765 7754 ··· 7769 7756 device->fs_info = fs_info; 7770 7757 7771 7758 list_for_each_entry(seed_devs, &fs_devices->seed_list, seed_list) { 7772 - list_for_each_entry(device, &seed_devs->devices, dev_list) 7759 + list_for_each_entry(device, &seed_devs->devices, dev_list) { 7773 7760 device->fs_info = fs_info; 7761 + ret = btrfs_get_dev_zone_info(device, false); 7762 + if (ret) 7763 + break; 7764 + } 7774 7765 7775 7766 seed_devs->fs_info = fs_info; 7776 7767 } 7777 7768 mutex_unlock(&fs_devices->device_list_mutex); 7769 + 7770 + return ret; 7778 7771 } 7779 7772 7780 7773 static u64 btrfs_dev_stats_value(const struct extent_buffer *eb,
+1 -1
fs/btrfs/volumes.h
··· 671 671 void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index); 672 672 int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info, 673 673 struct btrfs_ioctl_get_dev_stats *stats); 674 - void btrfs_init_devices_late(struct btrfs_fs_info *fs_info); 674 + int btrfs_init_devices_late(struct btrfs_fs_info *fs_info); 675 675 int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info); 676 676 int btrfs_run_dev_stats(struct btrfs_trans_handle *trans); 677 677 void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_device *srcdev);
+40
fs/btrfs/zoned.c
··· 639 639 device->zone_info = NULL; 640 640 } 641 641 642 + struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev) 643 + { 644 + struct btrfs_zoned_device_info *zone_info; 645 + 646 + zone_info = kmemdup(orig_dev->zone_info, sizeof(*zone_info), GFP_KERNEL); 647 + if (!zone_info) 648 + return NULL; 649 + 650 + zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL); 651 + if (!zone_info->seq_zones) 652 + goto out; 653 + 654 + bitmap_copy(zone_info->seq_zones, orig_dev->zone_info->seq_zones, 655 + zone_info->nr_zones); 656 + 657 + zone_info->empty_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL); 658 + if (!zone_info->empty_zones) 659 + goto out; 660 + 661 + bitmap_copy(zone_info->empty_zones, orig_dev->zone_info->empty_zones, 662 + zone_info->nr_zones); 663 + 664 + zone_info->active_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL); 665 + if (!zone_info->active_zones) 666 + goto out; 667 + 668 + bitmap_copy(zone_info->active_zones, orig_dev->zone_info->active_zones, 669 + zone_info->nr_zones); 670 + zone_info->zone_cache = NULL; 671 + 672 + return zone_info; 673 + 674 + out: 675 + bitmap_free(zone_info->seq_zones); 676 + bitmap_free(zone_info->empty_zones); 677 + bitmap_free(zone_info->active_zones); 678 + kfree(zone_info); 679 + return NULL; 680 + } 681 + 642 682 int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos, 643 683 struct blk_zone *zone) 644 684 {
+11
fs/btrfs/zoned.h
··· 36 36 int btrfs_get_dev_zone_info_all_devices(struct btrfs_fs_info *fs_info); 37 37 int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache); 38 38 void btrfs_destroy_dev_zone_info(struct btrfs_device *device); 39 + struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev); 39 40 int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info); 40 41 int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info); 41 42 int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw, ··· 103 102 } 104 103 105 104 static inline void btrfs_destroy_dev_zone_info(struct btrfs_device *device) { } 105 + 106 + /* 107 + * In case the kernel is compiled without CONFIG_BLK_DEV_ZONED we'll never call 108 + * into btrfs_clone_dev_zone_info() so it's safe to return NULL here. 109 + */ 110 + static inline struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info( 111 + struct btrfs_device *orig_dev) 112 + { 113 + return NULL; 114 + } 106 115 107 116 static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info) 108 117 {
+25 -1
fs/cifs/cifsfs.c
··· 1143 1143 .fiemap = cifs_fiemap, 1144 1144 }; 1145 1145 1146 + const char *cifs_get_link(struct dentry *dentry, struct inode *inode, 1147 + struct delayed_call *done) 1148 + { 1149 + char *target_path; 1150 + 1151 + target_path = kmalloc(PATH_MAX, GFP_KERNEL); 1152 + if (!target_path) 1153 + return ERR_PTR(-ENOMEM); 1154 + 1155 + spin_lock(&inode->i_lock); 1156 + if (likely(CIFS_I(inode)->symlink_target)) { 1157 + strscpy(target_path, CIFS_I(inode)->symlink_target, PATH_MAX); 1158 + } else { 1159 + kfree(target_path); 1160 + target_path = ERR_PTR(-EOPNOTSUPP); 1161 + } 1162 + spin_unlock(&inode->i_lock); 1163 + 1164 + if (!IS_ERR(target_path)) 1165 + set_delayed_call(done, kfree_link, target_path); 1166 + 1167 + return target_path; 1168 + } 1169 + 1146 1170 const struct inode_operations cifs_symlink_inode_ops = { 1147 - .get_link = simple_get_link, 1171 + .get_link = cifs_get_link, 1148 1172 .permission = cifs_permission, 1149 1173 .listxattr = cifs_listxattr, 1150 1174 };
-5
fs/cifs/inode.c
··· 215 215 kfree(cifs_i->symlink_target); 216 216 cifs_i->symlink_target = fattr->cf_symlink_target; 217 217 fattr->cf_symlink_target = NULL; 218 - 219 - if (unlikely(!cifs_i->symlink_target)) 220 - inode->i_link = ERR_PTR(-EOPNOTSUPP); 221 - else 222 - inode->i_link = cifs_i->symlink_target; 223 218 } 224 219 spin_unlock(&inode->i_lock); 225 220
+5 -1
fs/cifs/misc.c
··· 400 400 { 401 401 struct smb_hdr *buf = (struct smb_hdr *)buffer; 402 402 struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; 403 + struct TCP_Server_Info *pserver; 403 404 struct cifs_ses *ses; 404 405 struct cifs_tcon *tcon; 405 406 struct cifsInodeInfo *pCifsInode; ··· 465 464 if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) 466 465 return false; 467 466 467 + /* If server is a channel, select the primary channel */ 468 + pserver = CIFS_SERVER_IS_CHAN(srv) ? srv->primary_server : srv; 469 + 468 470 /* look up tcon based on tid & uid */ 469 471 spin_lock(&cifs_tcp_ses_lock); 470 - list_for_each_entry(ses, &srv->smb_ses_list, smb_ses_list) { 472 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 471 473 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 472 474 if (tcon->tid != buf->Tid) 473 475 continue;
+45 -36
fs/cifs/smb2misc.c
··· 135 135 int 136 136 smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *server) 137 137 { 138 + struct TCP_Server_Info *pserver; 138 139 struct smb2_hdr *shdr = (struct smb2_hdr *)buf; 139 140 struct smb2_pdu *pdu = (struct smb2_pdu *)shdr; 140 141 int hdr_size = sizeof(struct smb2_hdr); ··· 143 142 int command; 144 143 __u32 calc_len; /* calculated length */ 145 144 __u64 mid; 145 + 146 + /* If server is a channel, select the primary channel */ 147 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 146 148 147 149 /* 148 150 * Add function to do table lookup of StructureSize by command ··· 159 155 160 156 /* decrypt frame now that it is completely read in */ 161 157 spin_lock(&cifs_tcp_ses_lock); 162 - list_for_each_entry(iter, &server->smb_ses_list, smb_ses_list) { 158 + list_for_each_entry(iter, &pserver->smb_ses_list, smb_ses_list) { 163 159 if (iter->Suid == le64_to_cpu(thdr->SessionId)) { 164 160 ses = iter; 165 161 break; ··· 612 608 } 613 609 614 610 static bool 615 - smb2_is_valid_lease_break(char *buffer) 611 + smb2_is_valid_lease_break(char *buffer, struct TCP_Server_Info *server) 616 612 { 617 613 struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer; 618 - struct TCP_Server_Info *server; 614 + struct TCP_Server_Info *pserver; 619 615 struct cifs_ses *ses; 620 616 struct cifs_tcon *tcon; 621 617 struct cifs_pending_open *open; 622 618 623 619 cifs_dbg(FYI, "Checking for lease break\n"); 624 620 621 + /* If server is a channel, select the primary channel */ 622 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 623 + 625 624 /* look up tcon based on tid & uid */ 626 625 spin_lock(&cifs_tcp_ses_lock); 627 - list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { 628 - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 629 - list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 630 - spin_lock(&tcon->open_file_lock); 631 - cifs_stats_inc( 632 - &tcon->stats.cifs_stats.num_oplock_brks); 633 - if (smb2_tcon_has_lease(tcon, rsp)) { 634 - spin_unlock(&tcon->open_file_lock); 635 - spin_unlock(&cifs_tcp_ses_lock); 636 - return true; 637 - } 638 - open = smb2_tcon_find_pending_open_lease(tcon, 639 - rsp); 640 - if (open) { 641 - __u8 lease_key[SMB2_LEASE_KEY_SIZE]; 642 - struct tcon_link *tlink; 643 - 644 - tlink = cifs_get_tlink(open->tlink); 645 - memcpy(lease_key, open->lease_key, 646 - SMB2_LEASE_KEY_SIZE); 647 - spin_unlock(&tcon->open_file_lock); 648 - spin_unlock(&cifs_tcp_ses_lock); 649 - smb2_queue_pending_open_break(tlink, 650 - lease_key, 651 - rsp->NewLeaseState); 652 - return true; 653 - } 626 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 627 + list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 628 + spin_lock(&tcon->open_file_lock); 629 + cifs_stats_inc( 630 + &tcon->stats.cifs_stats.num_oplock_brks); 631 + if (smb2_tcon_has_lease(tcon, rsp)) { 654 632 spin_unlock(&tcon->open_file_lock); 633 + spin_unlock(&cifs_tcp_ses_lock); 634 + return true; 635 + } 636 + open = smb2_tcon_find_pending_open_lease(tcon, 637 + rsp); 638 + if (open) { 639 + __u8 lease_key[SMB2_LEASE_KEY_SIZE]; 640 + struct tcon_link *tlink; 655 641 656 - if (cached_dir_lease_break(tcon, rsp->LeaseKey)) { 657 - spin_unlock(&cifs_tcp_ses_lock); 658 - return true; 659 - } 642 + tlink = cifs_get_tlink(open->tlink); 643 + memcpy(lease_key, open->lease_key, 644 + SMB2_LEASE_KEY_SIZE); 645 + spin_unlock(&tcon->open_file_lock); 646 + spin_unlock(&cifs_tcp_ses_lock); 647 + smb2_queue_pending_open_break(tlink, 648 + lease_key, 649 + rsp->NewLeaseState); 650 + return true; 651 + } 652 + spin_unlock(&tcon->open_file_lock); 653 + 654 + if (cached_dir_lease_break(tcon, rsp->LeaseKey)) { 655 + spin_unlock(&cifs_tcp_ses_lock); 656 + return true; 660 657 } 661 658 } 662 659 } ··· 676 671 smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) 677 672 { 678 673 struct smb2_oplock_break *rsp = (struct smb2_oplock_break *)buffer; 674 + struct TCP_Server_Info *pserver; 679 675 struct cifs_ses *ses; 680 676 struct cifs_tcon *tcon; 681 677 struct cifsInodeInfo *cinode; ··· 690 684 if (rsp->StructureSize != 691 685 smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) { 692 686 if (le16_to_cpu(rsp->StructureSize) == 44) 693 - return smb2_is_valid_lease_break(buffer); 687 + return smb2_is_valid_lease_break(buffer, server); 694 688 else 695 689 return false; 696 690 } 697 691 698 692 cifs_dbg(FYI, "oplock level 0x%x\n", rsp->OplockLevel); 699 693 694 + /* If server is a channel, select the primary channel */ 695 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 696 + 700 697 /* look up tcon based on tid & uid */ 701 698 spin_lock(&cifs_tcp_ses_lock); 702 - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 699 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 703 700 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 704 701 705 702 spin_lock(&tcon->open_file_lock);
+18 -12
fs/cifs/smb2ops.c
··· 2302 2302 smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server) 2303 2303 { 2304 2304 struct smb2_hdr *shdr = (struct smb2_hdr *)buf; 2305 + struct TCP_Server_Info *pserver; 2305 2306 struct cifs_ses *ses; 2306 2307 struct cifs_tcon *tcon; 2307 2308 2308 2309 if (shdr->Status != STATUS_NETWORK_NAME_DELETED) 2309 2310 return; 2310 2311 2312 + /* If server is a channel, select the primary channel */ 2313 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 2314 + 2311 2315 spin_lock(&cifs_tcp_ses_lock); 2312 - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 2316 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 2313 2317 list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { 2314 2318 if (tcon->tid == le32_to_cpu(shdr->Id.SyncId.TreeId)) { 2315 2319 spin_lock(&tcon->tc_lock); ··· 4268 4264 static int 4269 4265 smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key) 4270 4266 { 4267 + struct TCP_Server_Info *pserver; 4271 4268 struct cifs_ses *ses; 4272 4269 u8 *ses_enc_key; 4273 4270 4271 + /* If server is a channel, select the primary channel */ 4272 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 4273 + 4274 4274 spin_lock(&cifs_tcp_ses_lock); 4275 - list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { 4276 - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 4277 - if (ses->Suid == ses_id) { 4278 - spin_lock(&ses->ses_lock); 4279 - ses_enc_key = enc ? ses->smb3encryptionkey : 4280 - ses->smb3decryptionkey; 4281 - memcpy(key, ses_enc_key, SMB3_ENC_DEC_KEY_SIZE); 4282 - spin_unlock(&ses->ses_lock); 4283 - spin_unlock(&cifs_tcp_ses_lock); 4284 - return 0; 4285 - } 4275 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 4276 + if (ses->Suid == ses_id) { 4277 + spin_lock(&ses->ses_lock); 4278 + ses_enc_key = enc ? ses->smb3encryptionkey : 4279 + ses->smb3decryptionkey; 4280 + memcpy(key, ses_enc_key, SMB3_ENC_DEC_KEY_SIZE); 4281 + spin_unlock(&ses->ses_lock); 4282 + spin_unlock(&cifs_tcp_ses_lock); 4283 + return 0; 4286 4284 } 4287 4285 } 4288 4286 spin_unlock(&cifs_tcp_ses_lock);
+12 -7
fs/cifs/smb2transport.c
··· 77 77 int smb2_get_sign_key(__u64 ses_id, struct TCP_Server_Info *server, u8 *key) 78 78 { 79 79 struct cifs_chan *chan; 80 + struct TCP_Server_Info *pserver; 80 81 struct cifs_ses *ses = NULL; 81 - struct TCP_Server_Info *it = NULL; 82 82 int i; 83 83 int rc = 0; 84 84 85 85 spin_lock(&cifs_tcp_ses_lock); 86 86 87 - list_for_each_entry(it, &cifs_tcp_ses_list, tcp_ses_list) { 88 - list_for_each_entry(ses, &it->smb_ses_list, smb_ses_list) { 89 - if (ses->Suid == ses_id) 90 - goto found; 91 - } 87 + /* If server is a channel, select the primary channel */ 88 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 89 + 90 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 91 + if (ses->Suid == ses_id) 92 + goto found; 92 93 } 93 94 cifs_server_dbg(VFS, "%s: Could not find session 0x%llx\n", 94 95 __func__, ses_id); ··· 137 136 static struct cifs_ses * 138 137 smb2_find_smb_ses_unlocked(struct TCP_Server_Info *server, __u64 ses_id) 139 138 { 139 + struct TCP_Server_Info *pserver; 140 140 struct cifs_ses *ses; 141 141 142 - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { 142 + /* If server is a channel, select the primary channel */ 143 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 144 + 145 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 143 146 if (ses->Suid != ses_id) 144 147 continue; 145 148 ++ses->ses_count;
+3 -2
fs/ext4/fast_commit.c
··· 1521 1521 struct ext4_iloc iloc; 1522 1522 int inode_len, ino, ret, tag = tl->fc_tag; 1523 1523 struct ext4_extent_header *eh; 1524 + size_t off_gen = offsetof(struct ext4_inode, i_generation); 1524 1525 1525 1526 memcpy(&fc_inode, val, sizeof(fc_inode)); 1526 1527 ··· 1549 1548 raw_inode = ext4_raw_inode(&iloc); 1550 1549 1551 1550 memcpy(raw_inode, raw_fc_inode, offsetof(struct ext4_inode, i_block)); 1552 - memcpy(&raw_inode->i_generation, &raw_fc_inode->i_generation, 1553 - inode_len - offsetof(struct ext4_inode, i_generation)); 1551 + memcpy((u8 *)raw_inode + off_gen, (u8 *)raw_fc_inode + off_gen, 1552 + inode_len - off_gen); 1554 1553 if (le32_to_cpu(raw_inode->i_flags) & EXT4_EXTENTS_FL) { 1555 1554 eh = (struct ext4_extent_header *)(&raw_inode->i_block[0]); 1556 1555 if (eh->eh_magic != EXT4_EXT_MAGIC) {
+1 -2
fs/ext4/ioctl.c
··· 145 145 if (ext4_has_metadata_csum(sb) && 146 146 es->s_checksum != ext4_superblock_csum(sb, es)) { 147 147 ext4_msg(sb, KERN_ERR, "Invalid checksum for backup " 148 - "superblock %llu\n", sb_block); 148 + "superblock %llu", sb_block); 149 149 unlock_buffer(bh); 150 - err = -EFSBADCRC; 151 150 goto out_bh; 152 151 } 153 152 func(es, arg);
+2 -1
fs/ext4/migrate.c
··· 424 424 * already is extent-based, error out. 425 425 */ 426 426 if (!ext4_has_feature_extents(inode->i_sb) || 427 - (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 427 + ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) || 428 + ext4_has_inline_data(inode)) 428 429 return -EINVAL; 429 430 430 431 if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
+9 -1
fs/ext4/namei.c
··· 2259 2259 memset(de, 0, len); /* wipe old data */ 2260 2260 de = (struct ext4_dir_entry_2 *) data2; 2261 2261 top = data2 + len; 2262 - while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) 2262 + while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) { 2263 + if (ext4_check_dir_entry(dir, NULL, de, bh2, data2, len, 2264 + (data2 + (blocksize - csum_size) - 2265 + (char *) de))) { 2266 + brelse(bh2); 2267 + brelse(bh); 2268 + return -EFSCORRUPTED; 2269 + } 2263 2270 de = de2; 2271 + } 2264 2272 de->rec_len = ext4_rec_len_to_disk(data2 + (blocksize - csum_size) - 2265 2273 (char *) de, blocksize); 2266 2274
+5
fs/ext4/resize.c
··· 1158 1158 while (group < sbi->s_groups_count) { 1159 1159 struct buffer_head *bh; 1160 1160 ext4_fsblk_t backup_block; 1161 + struct ext4_super_block *es; 1161 1162 1162 1163 /* Out of journal space, and can't get more - abort - so sad */ 1163 1164 err = ext4_resize_ensure_credits_batch(handle, 1); ··· 1187 1186 memcpy(bh->b_data, data, size); 1188 1187 if (rest) 1189 1188 memset(bh->b_data + size, 0, rest); 1189 + es = (struct ext4_super_block *) bh->b_data; 1190 + es->s_block_group_nr = cpu_to_le16(group); 1191 + if (ext4_has_metadata_csum(sb)) 1192 + es->s_checksum = ext4_superblock_csum(sb, es); 1190 1193 set_buffer_uptodate(bh); 1191 1194 unlock_buffer(bh); 1192 1195 err = ext4_handle_dirty_metadata(handle, NULL, bh);
+1 -1
fs/ext4/super.c
··· 4881 4881 flush_work(&sbi->s_error_work); 4882 4882 jbd2_journal_destroy(sbi->s_journal); 4883 4883 sbi->s_journal = NULL; 4884 - return err; 4884 + return -EINVAL; 4885 4885 } 4886 4886 4887 4887 static int ext4_journal_data_mode_check(struct super_block *sb)
+4
fs/fuse/file.c
··· 3001 3001 goto out; 3002 3002 } 3003 3003 3004 + err = file_modified(file); 3005 + if (err) 3006 + goto out; 3007 + 3004 3008 if (!(mode & FALLOC_FL_KEEP_SIZE)) 3005 3009 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); 3006 3010
+9 -1
fs/fuse/readdir.c
··· 77 77 goto unlock; 78 78 79 79 addr = kmap_local_page(page); 80 - if (!offset) 80 + if (!offset) { 81 81 clear_page(addr); 82 + SetPageUptodate(page); 83 + } 82 84 memcpy(addr + offset, dirent, reclen); 83 85 kunmap_local(addr); 84 86 fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen; ··· 518 516 519 517 page = find_get_page_flags(file->f_mapping, index, 520 518 FGP_ACCESSED | FGP_LOCK); 519 + /* Page gone missing, then re-added to cache, but not initialized? */ 520 + if (page && !PageUptodate(page)) { 521 + unlock_page(page); 522 + put_page(page); 523 + page = NULL; 524 + } 521 525 spin_lock(&fi->rdc.lock); 522 526 if (!page) { 523 527 /*
+3
fs/userfaultfd.c
··· 1630 1630 NULL_VM_UFFD_CTX, anon_vma_name(vma)); 1631 1631 if (prev) { 1632 1632 vma = prev; 1633 + mas_pause(&mas); 1633 1634 goto next; 1634 1635 } 1635 1636 if (vma->vm_start < start) { 1636 1637 ret = split_vma(mm, vma, start, 1); 1637 1638 if (ret) 1638 1639 break; 1640 + mas_pause(&mas); 1639 1641 } 1640 1642 if (vma->vm_end > end) { 1641 1643 ret = split_vma(mm, vma, end, 0); 1642 1644 if (ret) 1643 1645 break; 1646 + mas_pause(&mas); 1644 1647 } 1645 1648 next: 1646 1649 /*
+15
fs/xfs/libxfs/xfs_ag.h
··· 133 133 return true; 134 134 } 135 135 136 + static inline bool 137 + xfs_verify_agbext( 138 + struct xfs_perag *pag, 139 + xfs_agblock_t agbno, 140 + xfs_agblock_t len) 141 + { 142 + if (agbno + len <= agbno) 143 + return false; 144 + 145 + if (!xfs_verify_agbno(pag, agbno)) 146 + return false; 147 + 148 + return xfs_verify_agbno(pag, agbno + len - 1); 149 + } 150 + 136 151 /* 137 152 * Verify that an AG inode number pointer neither points outside the AG 138 153 * nor points at static metadata.
+1 -5
fs/xfs/libxfs/xfs_alloc.c
··· 263 263 goto out_bad_rec; 264 264 265 265 /* check for valid extent range, including overflow */ 266 - if (!xfs_verify_agbno(pag, *bno)) 267 - goto out_bad_rec; 268 - if (*bno > *bno + *len) 269 - goto out_bad_rec; 270 - if (!xfs_verify_agbno(pag, *bno + *len - 1)) 266 + if (!xfs_verify_agbext(pag, *bno, *len)) 271 267 goto out_bad_rec; 272 268 273 269 return 0;
+7 -2
fs/xfs/libxfs/xfs_dir2_leaf.c
··· 146 146 xfs_dir2_leaf_tail_t *ltp; 147 147 int stale; 148 148 int i; 149 + bool isleaf1 = (hdr->magic == XFS_DIR2_LEAF1_MAGIC || 150 + hdr->magic == XFS_DIR3_LEAF1_MAGIC); 149 151 150 152 ltp = xfs_dir2_leaf_tail_p(geo, leaf); 151 153 ··· 160 158 return __this_address; 161 159 162 160 /* Leaves and bests don't overlap in leaf format. */ 163 - if ((hdr->magic == XFS_DIR2_LEAF1_MAGIC || 164 - hdr->magic == XFS_DIR3_LEAF1_MAGIC) && 161 + if (isleaf1 && 165 162 (char *)&hdr->ents[hdr->count] > (char *)xfs_dir2_leaf_bests_p(ltp)) 166 163 return __this_address; 167 164 ··· 176 175 } 177 176 if (hdr->ents[i].address == cpu_to_be32(XFS_DIR2_NULL_DATAPTR)) 178 177 stale++; 178 + if (isleaf1 && xfs_dir2_dataptr_to_db(geo, 179 + be32_to_cpu(hdr->ents[i].address)) >= 180 + be32_to_cpu(ltp->bestcount)) 181 + return __this_address; 179 182 } 180 183 if (hdr->stale != stale) 181 184 return __this_address;
+1 -21
fs/xfs/libxfs/xfs_format.h
··· 1564 1564 #define RMAPBT_UNUSED_OFFSET_BITLEN 7 1565 1565 #define RMAPBT_OFFSET_BITLEN 54 1566 1566 1567 - #define XFS_RMAP_ATTR_FORK (1 << 0) 1568 - #define XFS_RMAP_BMBT_BLOCK (1 << 1) 1569 - #define XFS_RMAP_UNWRITTEN (1 << 2) 1570 - #define XFS_RMAP_KEY_FLAGS (XFS_RMAP_ATTR_FORK | \ 1571 - XFS_RMAP_BMBT_BLOCK) 1572 - #define XFS_RMAP_REC_FLAGS (XFS_RMAP_UNWRITTEN) 1573 - struct xfs_rmap_irec { 1574 - xfs_agblock_t rm_startblock; /* extent start block */ 1575 - xfs_extlen_t rm_blockcount; /* extent length */ 1576 - uint64_t rm_owner; /* extent owner */ 1577 - uint64_t rm_offset; /* offset within the owner */ 1578 - unsigned int rm_flags; /* state flags */ 1579 - }; 1580 - 1581 1567 /* 1582 1568 * Key structure 1583 1569 * ··· 1612 1626 * on the startblock. This speeds up mount time deletion of stale 1613 1627 * staging extents because they're all at the right side of the tree. 1614 1628 */ 1615 - #define XFS_REFC_COW_START ((xfs_agblock_t)(1U << 31)) 1629 + #define XFS_REFC_COWFLAG (1U << 31) 1616 1630 #define REFCNTBT_COWFLAG_BITLEN 1 1617 1631 #define REFCNTBT_AGBLOCK_BITLEN 31 1618 1632 ··· 1624 1638 1625 1639 struct xfs_refcount_key { 1626 1640 __be32 rc_startblock; /* starting block number */ 1627 - }; 1628 - 1629 - struct xfs_refcount_irec { 1630 - xfs_agblock_t rc_startblock; /* starting block number */ 1631 - xfs_extlen_t rc_blockcount; /* count of free blocks */ 1632 - xfs_nlink_t rc_refcount; /* number of inodes linked here */ 1633 1641 }; 1634 1642 1635 1643 #define MAXREFCOUNT ((xfs_nlink_t)~0U)
+54 -6
fs/xfs/libxfs/xfs_log_format.h
··· 613 613 uint16_t efi_size; /* size of this item */ 614 614 uint32_t efi_nextents; /* # extents to free */ 615 615 uint64_t efi_id; /* efi identifier */ 616 - xfs_extent_t efi_extents[1]; /* array of extents to free */ 616 + xfs_extent_t efi_extents[]; /* array of extents to free */ 617 617 } xfs_efi_log_format_t; 618 + 619 + static inline size_t 620 + xfs_efi_log_format_sizeof( 621 + unsigned int nr) 622 + { 623 + return sizeof(struct xfs_efi_log_format) + 624 + nr * sizeof(struct xfs_extent); 625 + } 618 626 619 627 typedef struct xfs_efi_log_format_32 { 620 628 uint16_t efi_type; /* efi log item type */ 621 629 uint16_t efi_size; /* size of this item */ 622 630 uint32_t efi_nextents; /* # extents to free */ 623 631 uint64_t efi_id; /* efi identifier */ 624 - xfs_extent_32_t efi_extents[1]; /* array of extents to free */ 632 + xfs_extent_32_t efi_extents[]; /* array of extents to free */ 625 633 } __attribute__((packed)) xfs_efi_log_format_32_t; 634 + 635 + static inline size_t 636 + xfs_efi_log_format32_sizeof( 637 + unsigned int nr) 638 + { 639 + return sizeof(struct xfs_efi_log_format_32) + 640 + nr * sizeof(struct xfs_extent_32); 641 + } 626 642 627 643 typedef struct xfs_efi_log_format_64 { 628 644 uint16_t efi_type; /* efi log item type */ 629 645 uint16_t efi_size; /* size of this item */ 630 646 uint32_t efi_nextents; /* # extents to free */ 631 647 uint64_t efi_id; /* efi identifier */ 632 - xfs_extent_64_t efi_extents[1]; /* array of extents to free */ 648 + xfs_extent_64_t efi_extents[]; /* array of extents to free */ 633 649 } xfs_efi_log_format_64_t; 650 + 651 + static inline size_t 652 + xfs_efi_log_format64_sizeof( 653 + unsigned int nr) 654 + { 655 + return sizeof(struct xfs_efi_log_format_64) + 656 + nr * sizeof(struct xfs_extent_64); 657 + } 634 658 635 659 /* 636 660 * This is the structure used to lay out an efd log item in the ··· 666 642 uint16_t efd_size; /* size of this item */ 667 643 uint32_t efd_nextents; /* # of extents freed */ 668 644 uint64_t efd_efi_id; /* id of corresponding efi */ 669 - xfs_extent_t efd_extents[1]; /* array of extents freed */ 645 + xfs_extent_t efd_extents[]; /* array of extents freed */ 670 646 } xfs_efd_log_format_t; 647 + 648 + static inline size_t 649 + xfs_efd_log_format_sizeof( 650 + unsigned int nr) 651 + { 652 + return sizeof(struct xfs_efd_log_format) + 653 + nr * sizeof(struct xfs_extent); 654 + } 671 655 672 656 typedef struct xfs_efd_log_format_32 { 673 657 uint16_t efd_type; /* efd log item type */ 674 658 uint16_t efd_size; /* size of this item */ 675 659 uint32_t efd_nextents; /* # of extents freed */ 676 660 uint64_t efd_efi_id; /* id of corresponding efi */ 677 - xfs_extent_32_t efd_extents[1]; /* array of extents freed */ 661 + xfs_extent_32_t efd_extents[]; /* array of extents freed */ 678 662 } __attribute__((packed)) xfs_efd_log_format_32_t; 663 + 664 + static inline size_t 665 + xfs_efd_log_format32_sizeof( 666 + unsigned int nr) 667 + { 668 + return sizeof(struct xfs_efd_log_format_32) + 669 + nr * sizeof(struct xfs_extent_32); 670 + } 679 671 680 672 typedef struct xfs_efd_log_format_64 { 681 673 uint16_t efd_type; /* efd log item type */ 682 674 uint16_t efd_size; /* size of this item */ 683 675 uint32_t efd_nextents; /* # of extents freed */ 684 676 uint64_t efd_efi_id; /* id of corresponding efi */ 685 - xfs_extent_64_t efd_extents[1]; /* array of extents freed */ 677 + xfs_extent_64_t efd_extents[]; /* array of extents freed */ 686 678 } xfs_efd_log_format_64_t; 679 + 680 + static inline size_t 681 + xfs_efd_log_format64_sizeof( 682 + unsigned int nr) 683 + { 684 + return sizeof(struct xfs_efd_log_format_64) + 685 + nr * sizeof(struct xfs_extent_64); 686 + } 687 687 688 688 /* 689 689 * RUI/RUD (reverse mapping) log format definitions
+199 -87
fs/xfs/libxfs/xfs_refcount.c
··· 46 46 int 47 47 xfs_refcount_lookup_le( 48 48 struct xfs_btree_cur *cur, 49 + enum xfs_refc_domain domain, 49 50 xfs_agblock_t bno, 50 51 int *stat) 51 52 { 52 - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno, 53 + trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, 54 + xfs_refcount_encode_startblock(bno, domain), 53 55 XFS_LOOKUP_LE); 54 56 cur->bc_rec.rc.rc_startblock = bno; 55 57 cur->bc_rec.rc.rc_blockcount = 0; 58 + cur->bc_rec.rc.rc_domain = domain; 56 59 return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat); 57 60 } 58 61 ··· 66 63 int 67 64 xfs_refcount_lookup_ge( 68 65 struct xfs_btree_cur *cur, 66 + enum xfs_refc_domain domain, 69 67 xfs_agblock_t bno, 70 68 int *stat) 71 69 { 72 - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno, 70 + trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, 71 + xfs_refcount_encode_startblock(bno, domain), 73 72 XFS_LOOKUP_GE); 74 73 cur->bc_rec.rc.rc_startblock = bno; 75 74 cur->bc_rec.rc.rc_blockcount = 0; 75 + cur->bc_rec.rc.rc_domain = domain; 76 76 return xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat); 77 77 } 78 78 ··· 86 80 int 87 81 xfs_refcount_lookup_eq( 88 82 struct xfs_btree_cur *cur, 83 + enum xfs_refc_domain domain, 89 84 xfs_agblock_t bno, 90 85 int *stat) 91 86 { 92 - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, bno, 87 + trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, 88 + xfs_refcount_encode_startblock(bno, domain), 93 89 XFS_LOOKUP_LE); 94 90 cur->bc_rec.rc.rc_startblock = bno; 95 91 cur->bc_rec.rc.rc_blockcount = 0; 92 + cur->bc_rec.rc.rc_domain = domain; 96 93 return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat); 97 94 } 98 95 ··· 105 96 const union xfs_btree_rec *rec, 106 97 struct xfs_refcount_irec *irec) 107 98 { 108 - irec->rc_startblock = be32_to_cpu(rec->refc.rc_startblock); 99 + uint32_t start; 100 + 101 + start = be32_to_cpu(rec->refc.rc_startblock); 102 + if (start & XFS_REFC_COWFLAG) { 103 + start &= ~XFS_REFC_COWFLAG; 104 + irec->rc_domain = XFS_REFC_DOMAIN_COW; 105 + } else { 106 + irec->rc_domain = XFS_REFC_DOMAIN_SHARED; 107 + } 108 + 109 + irec->rc_startblock = start; 109 110 irec->rc_blockcount = be32_to_cpu(rec->refc.rc_blockcount); 110 111 irec->rc_refcount = be32_to_cpu(rec->refc.rc_refcount); 111 112 } ··· 133 114 struct xfs_perag *pag = cur->bc_ag.pag; 134 115 union xfs_btree_rec *rec; 135 116 int error; 136 - xfs_agblock_t realstart; 137 117 138 118 error = xfs_btree_get_rec(cur, &rec, stat); 139 119 if (error || !*stat) ··· 142 124 if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN) 143 125 goto out_bad_rec; 144 126 145 - /* handle special COW-staging state */ 146 - realstart = irec->rc_startblock; 147 - if (realstart & XFS_REFC_COW_START) { 148 - if (irec->rc_refcount != 1) 149 - goto out_bad_rec; 150 - realstart &= ~XFS_REFC_COW_START; 151 - } else if (irec->rc_refcount < 2) { 127 + if (!xfs_refcount_check_domain(irec)) 152 128 goto out_bad_rec; 153 - } 154 129 155 130 /* check for valid extent range, including overflow */ 156 - if (!xfs_verify_agbno(pag, realstart)) 157 - goto out_bad_rec; 158 - if (realstart > realstart + irec->rc_blockcount) 159 - goto out_bad_rec; 160 - if (!xfs_verify_agbno(pag, realstart + irec->rc_blockcount - 1)) 131 + if (!xfs_verify_agbext(pag, irec->rc_startblock, irec->rc_blockcount)) 161 132 goto out_bad_rec; 162 133 163 134 if (irec->rc_refcount == 0 || irec->rc_refcount > MAXREFCOUNT) ··· 176 169 struct xfs_refcount_irec *irec) 177 170 { 178 171 union xfs_btree_rec rec; 172 + uint32_t start; 179 173 int error; 180 174 181 175 trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec); 182 - rec.refc.rc_startblock = cpu_to_be32(irec->rc_startblock); 176 + 177 + start = xfs_refcount_encode_startblock(irec->rc_startblock, 178 + irec->rc_domain); 179 + rec.refc.rc_startblock = cpu_to_be32(start); 183 180 rec.refc.rc_blockcount = cpu_to_be32(irec->rc_blockcount); 184 181 rec.refc.rc_refcount = cpu_to_be32(irec->rc_refcount); 182 + 185 183 error = xfs_btree_update(cur, &rec); 186 184 if (error) 187 185 trace_xfs_refcount_update_error(cur->bc_mp, ··· 208 196 int error; 209 197 210 198 trace_xfs_refcount_insert(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec); 199 + 211 200 cur->bc_rec.rc.rc_startblock = irec->rc_startblock; 212 201 cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount; 213 202 cur->bc_rec.rc.rc_refcount = irec->rc_refcount; 203 + cur->bc_rec.rc.rc_domain = irec->rc_domain; 204 + 214 205 error = xfs_btree_insert(cur, i); 215 206 if (error) 216 207 goto out_error; ··· 259 244 } 260 245 if (error) 261 246 goto out_error; 262 - error = xfs_refcount_lookup_ge(cur, irec.rc_startblock, &found_rec); 247 + error = xfs_refcount_lookup_ge(cur, irec.rc_domain, irec.rc_startblock, 248 + &found_rec); 263 249 out_error: 264 250 if (error) 265 251 trace_xfs_refcount_delete_error(cur->bc_mp, ··· 359 343 STATIC int 360 344 xfs_refcount_split_extent( 361 345 struct xfs_btree_cur *cur, 346 + enum xfs_refc_domain domain, 362 347 xfs_agblock_t agbno, 363 348 bool *shape_changed) 364 349 { ··· 368 351 int error; 369 352 370 353 *shape_changed = false; 371 - error = xfs_refcount_lookup_le(cur, agbno, &found_rec); 354 + error = xfs_refcount_lookup_le(cur, domain, agbno, &found_rec); 372 355 if (error) 373 356 goto out_error; 374 357 if (!found_rec) ··· 381 364 error = -EFSCORRUPTED; 382 365 goto out_error; 383 366 } 367 + if (rcext.rc_domain != domain) 368 + return 0; 384 369 if (rcext.rc_startblock == agbno || xfs_refc_next(&rcext) <= agbno) 385 370 return 0; 386 371 ··· 434 415 trace_xfs_refcount_merge_center_extents(cur->bc_mp, 435 416 cur->bc_ag.pag->pag_agno, left, center, right); 436 417 418 + ASSERT(left->rc_domain == center->rc_domain); 419 + ASSERT(right->rc_domain == center->rc_domain); 420 + 437 421 /* 438 422 * Make sure the center and right extents are not in the btree. 439 423 * If the center extent was synthesized, the first delete call ··· 445 423 * call removes the center and the second one removes the right 446 424 * extent. 447 425 */ 448 - error = xfs_refcount_lookup_ge(cur, center->rc_startblock, 449 - &found_rec); 426 + error = xfs_refcount_lookup_ge(cur, center->rc_domain, 427 + center->rc_startblock, &found_rec); 450 428 if (error) 451 429 goto out_error; 452 430 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 473 451 } 474 452 475 453 /* Enlarge the left extent. */ 476 - error = xfs_refcount_lookup_le(cur, left->rc_startblock, 477 - &found_rec); 454 + error = xfs_refcount_lookup_le(cur, left->rc_domain, 455 + left->rc_startblock, &found_rec); 478 456 if (error) 479 457 goto out_error; 480 458 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 513 491 trace_xfs_refcount_merge_left_extent(cur->bc_mp, 514 492 cur->bc_ag.pag->pag_agno, left, cleft); 515 493 494 + ASSERT(left->rc_domain == cleft->rc_domain); 495 + 516 496 /* If the extent at agbno (cleft) wasn't synthesized, remove it. */ 517 497 if (cleft->rc_refcount > 1) { 518 - error = xfs_refcount_lookup_le(cur, cleft->rc_startblock, 519 - &found_rec); 498 + error = xfs_refcount_lookup_le(cur, cleft->rc_domain, 499 + cleft->rc_startblock, &found_rec); 520 500 if (error) 521 501 goto out_error; 522 502 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 536 512 } 537 513 538 514 /* Enlarge the left extent. */ 539 - error = xfs_refcount_lookup_le(cur, left->rc_startblock, 540 - &found_rec); 515 + error = xfs_refcount_lookup_le(cur, left->rc_domain, 516 + left->rc_startblock, &found_rec); 541 517 if (error) 542 518 goto out_error; 543 519 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 576 552 trace_xfs_refcount_merge_right_extent(cur->bc_mp, 577 553 cur->bc_ag.pag->pag_agno, cright, right); 578 554 555 + ASSERT(right->rc_domain == cright->rc_domain); 556 + 579 557 /* 580 558 * If the extent ending at agbno+aglen (cright) wasn't synthesized, 581 559 * remove it. 582 560 */ 583 561 if (cright->rc_refcount > 1) { 584 - error = xfs_refcount_lookup_le(cur, cright->rc_startblock, 585 - &found_rec); 562 + error = xfs_refcount_lookup_le(cur, cright->rc_domain, 563 + cright->rc_startblock, &found_rec); 586 564 if (error) 587 565 goto out_error; 588 566 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 602 576 } 603 577 604 578 /* Enlarge the right extent. */ 605 - error = xfs_refcount_lookup_le(cur, right->rc_startblock, 606 - &found_rec); 579 + error = xfs_refcount_lookup_le(cur, right->rc_domain, 580 + right->rc_startblock, &found_rec); 607 581 if (error) 608 582 goto out_error; 609 583 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) { ··· 626 600 return error; 627 601 } 628 602 629 - #define XFS_FIND_RCEXT_SHARED 1 630 - #define XFS_FIND_RCEXT_COW 2 631 603 /* 632 604 * Find the left extent and the one after it (cleft). This function assumes 633 605 * that we've already split any extent crossing agbno. ··· 635 611 struct xfs_btree_cur *cur, 636 612 struct xfs_refcount_irec *left, 637 613 struct xfs_refcount_irec *cleft, 614 + enum xfs_refc_domain domain, 638 615 xfs_agblock_t agbno, 639 - xfs_extlen_t aglen, 640 - int flags) 616 + xfs_extlen_t aglen) 641 617 { 642 618 struct xfs_refcount_irec tmp; 643 619 int error; 644 620 int found_rec; 645 621 646 622 left->rc_startblock = cleft->rc_startblock = NULLAGBLOCK; 647 - error = xfs_refcount_lookup_le(cur, agbno - 1, &found_rec); 623 + error = xfs_refcount_lookup_le(cur, domain, agbno - 1, &found_rec); 648 624 if (error) 649 625 goto out_error; 650 626 if (!found_rec) ··· 658 634 goto out_error; 659 635 } 660 636 637 + if (tmp.rc_domain != domain) 638 + return 0; 661 639 if (xfs_refc_next(&tmp) != agbno) 662 - return 0; 663 - if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) 664 - return 0; 665 - if ((flags & XFS_FIND_RCEXT_COW) && tmp.rc_refcount > 1) 666 640 return 0; 667 641 /* We have a left extent; retrieve (or invent) the next right one */ 668 642 *left = tmp; ··· 676 654 error = -EFSCORRUPTED; 677 655 goto out_error; 678 656 } 657 + 658 + if (tmp.rc_domain != domain) 659 + goto not_found; 679 660 680 661 /* if tmp starts at the end of our range, just use that */ 681 662 if (tmp.rc_startblock == agbno) ··· 696 671 cleft->rc_blockcount = min(aglen, 697 672 tmp.rc_startblock - agbno); 698 673 cleft->rc_refcount = 1; 674 + cleft->rc_domain = domain; 699 675 } 700 676 } else { 677 + not_found: 701 678 /* 702 679 * No extents, so pretend that there's one covering the whole 703 680 * range. ··· 707 680 cleft->rc_startblock = agbno; 708 681 cleft->rc_blockcount = aglen; 709 682 cleft->rc_refcount = 1; 683 + cleft->rc_domain = domain; 710 684 } 711 685 trace_xfs_refcount_find_left_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno, 712 686 left, cleft, agbno); ··· 728 700 struct xfs_btree_cur *cur, 729 701 struct xfs_refcount_irec *right, 730 702 struct xfs_refcount_irec *cright, 703 + enum xfs_refc_domain domain, 731 704 xfs_agblock_t agbno, 732 - xfs_extlen_t aglen, 733 - int flags) 705 + xfs_extlen_t aglen) 734 706 { 735 707 struct xfs_refcount_irec tmp; 736 708 int error; 737 709 int found_rec; 738 710 739 711 right->rc_startblock = cright->rc_startblock = NULLAGBLOCK; 740 - error = xfs_refcount_lookup_ge(cur, agbno + aglen, &found_rec); 712 + error = xfs_refcount_lookup_ge(cur, domain, agbno + aglen, &found_rec); 741 713 if (error) 742 714 goto out_error; 743 715 if (!found_rec) ··· 751 723 goto out_error; 752 724 } 753 725 726 + if (tmp.rc_domain != domain) 727 + return 0; 754 728 if (tmp.rc_startblock != agbno + aglen) 755 - return 0; 756 - if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) 757 - return 0; 758 - if ((flags & XFS_FIND_RCEXT_COW) && tmp.rc_refcount > 1) 759 729 return 0; 760 730 /* We have a right extent; retrieve (or invent) the next left one */ 761 731 *right = tmp; ··· 769 743 error = -EFSCORRUPTED; 770 744 goto out_error; 771 745 } 746 + 747 + if (tmp.rc_domain != domain) 748 + goto not_found; 772 749 773 750 /* if tmp ends at the end of our range, just use that */ 774 751 if (xfs_refc_next(&tmp) == agbno + aglen) ··· 789 760 cright->rc_blockcount = right->rc_startblock - 790 761 cright->rc_startblock; 791 762 cright->rc_refcount = 1; 763 + cright->rc_domain = domain; 792 764 } 793 765 } else { 766 + not_found: 794 767 /* 795 768 * No extents, so pretend that there's one covering the whole 796 769 * range. ··· 800 769 cright->rc_startblock = agbno; 801 770 cright->rc_blockcount = aglen; 802 771 cright->rc_refcount = 1; 772 + cright->rc_domain = domain; 803 773 } 804 774 trace_xfs_refcount_find_right_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno, 805 775 cright, right, agbno + aglen); ··· 826 794 STATIC int 827 795 xfs_refcount_merge_extents( 828 796 struct xfs_btree_cur *cur, 797 + enum xfs_refc_domain domain, 829 798 xfs_agblock_t *agbno, 830 799 xfs_extlen_t *aglen, 831 800 enum xfs_refc_adjust_op adjust, 832 - int flags, 833 801 bool *shape_changed) 834 802 { 835 803 struct xfs_refcount_irec left = {0}, cleft = {0}; ··· 844 812 * just below (agbno + aglen) [cright], and just above (agbno + aglen) 845 813 * [right]. 846 814 */ 847 - error = xfs_refcount_find_left_extents(cur, &left, &cleft, *agbno, 848 - *aglen, flags); 815 + error = xfs_refcount_find_left_extents(cur, &left, &cleft, domain, 816 + *agbno, *aglen); 849 817 if (error) 850 818 return error; 851 - error = xfs_refcount_find_right_extents(cur, &right, &cright, *agbno, 852 - *aglen, flags); 819 + error = xfs_refcount_find_right_extents(cur, &right, &cright, domain, 820 + *agbno, *aglen); 853 821 if (error) 854 822 return error; 855 823 ··· 902 870 aglen); 903 871 } 904 872 905 - return error; 873 + return 0; 906 874 } 907 875 908 876 /* ··· 965 933 if (*aglen == 0) 966 934 return 0; 967 935 968 - error = xfs_refcount_lookup_ge(cur, *agbno, &found_rec); 936 + error = xfs_refcount_lookup_ge(cur, XFS_REFC_DOMAIN_SHARED, *agbno, 937 + &found_rec); 969 938 if (error) 970 939 goto out_error; 971 940 ··· 974 941 error = xfs_refcount_get_rec(cur, &ext, &found_rec); 975 942 if (error) 976 943 goto out_error; 977 - if (!found_rec) { 944 + if (!found_rec || ext.rc_domain != XFS_REFC_DOMAIN_SHARED) { 978 945 ext.rc_startblock = cur->bc_mp->m_sb.sb_agblocks; 979 946 ext.rc_blockcount = 0; 980 947 ext.rc_refcount = 0; 948 + ext.rc_domain = XFS_REFC_DOMAIN_SHARED; 981 949 } 982 950 983 951 /* ··· 991 957 tmp.rc_blockcount = min(*aglen, 992 958 ext.rc_startblock - *agbno); 993 959 tmp.rc_refcount = 1 + adj; 960 + tmp.rc_domain = XFS_REFC_DOMAIN_SHARED; 961 + 994 962 trace_xfs_refcount_modify_extent(cur->bc_mp, 995 963 cur->bc_ag.pag->pag_agno, &tmp); 996 964 ··· 1022 986 (*agbno) += tmp.rc_blockcount; 1023 987 (*aglen) -= tmp.rc_blockcount; 1024 988 1025 - error = xfs_refcount_lookup_ge(cur, *agbno, 989 + /* Stop if there's nothing left to modify */ 990 + if (*aglen == 0 || !xfs_refcount_still_have_space(cur)) 991 + break; 992 + 993 + /* Move the cursor to the start of ext. */ 994 + error = xfs_refcount_lookup_ge(cur, 995 + XFS_REFC_DOMAIN_SHARED, *agbno, 1026 996 &found_rec); 1027 997 if (error) 1028 998 goto out_error; 1029 999 } 1030 1000 1031 - /* Stop if there's nothing left to modify */ 1032 - if (*aglen == 0 || !xfs_refcount_still_have_space(cur)) 1033 - break; 1001 + /* 1002 + * A previous step trimmed agbno/aglen such that the end of the 1003 + * range would not be in the middle of the record. If this is 1004 + * no longer the case, something is seriously wrong with the 1005 + * btree. Make sure we never feed the synthesized record into 1006 + * the processing loop below. 1007 + */ 1008 + if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount == 0) || 1009 + XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount > *aglen)) { 1010 + error = -EFSCORRUPTED; 1011 + goto out_error; 1012 + } 1034 1013 1035 1014 /* 1036 1015 * Adjust the reference count and either update the tree ··· 1121 1070 /* 1122 1071 * Ensure that no rcextents cross the boundary of the adjustment range. 1123 1072 */ 1124 - error = xfs_refcount_split_extent(cur, agbno, &shape_changed); 1073 + error = xfs_refcount_split_extent(cur, XFS_REFC_DOMAIN_SHARED, 1074 + agbno, &shape_changed); 1125 1075 if (error) 1126 1076 goto out_error; 1127 1077 if (shape_changed) 1128 1078 shape_changes++; 1129 1079 1130 - error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed); 1080 + error = xfs_refcount_split_extent(cur, XFS_REFC_DOMAIN_SHARED, 1081 + agbno + aglen, &shape_changed); 1131 1082 if (error) 1132 1083 goto out_error; 1133 1084 if (shape_changed) ··· 1138 1085 /* 1139 1086 * Try to merge with the left or right extents of the range. 1140 1087 */ 1141 - error = xfs_refcount_merge_extents(cur, new_agbno, new_aglen, adj, 1142 - XFS_FIND_RCEXT_SHARED, &shape_changed); 1088 + error = xfs_refcount_merge_extents(cur, XFS_REFC_DOMAIN_SHARED, 1089 + new_agbno, new_aglen, adj, &shape_changed); 1143 1090 if (error) 1144 1091 goto out_error; 1145 1092 if (shape_changed) ··· 1175 1122 xfs_btree_del_cursor(rcur, error); 1176 1123 if (error) 1177 1124 xfs_trans_brelse(tp, agbp); 1125 + } 1126 + 1127 + /* 1128 + * Set up a continuation a deferred refcount operation by updating the intent. 1129 + * Checks to make sure we're not going to run off the end of the AG. 1130 + */ 1131 + static inline int 1132 + xfs_refcount_continue_op( 1133 + struct xfs_btree_cur *cur, 1134 + xfs_fsblock_t startblock, 1135 + xfs_agblock_t new_agbno, 1136 + xfs_extlen_t new_len, 1137 + xfs_fsblock_t *new_fsbno) 1138 + { 1139 + struct xfs_mount *mp = cur->bc_mp; 1140 + struct xfs_perag *pag = cur->bc_ag.pag; 1141 + 1142 + if (XFS_IS_CORRUPT(mp, !xfs_verify_agbext(pag, new_agbno, new_len))) 1143 + return -EFSCORRUPTED; 1144 + 1145 + *new_fsbno = XFS_AGB_TO_FSB(mp, pag->pag_agno, new_agbno); 1146 + 1147 + ASSERT(xfs_verify_fsbext(mp, *new_fsbno, new_len)); 1148 + ASSERT(pag->pag_agno == XFS_FSB_TO_AGNO(mp, *new_fsbno)); 1149 + 1150 + return 0; 1178 1151 } 1179 1152 1180 1153 /* ··· 1270 1191 case XFS_REFCOUNT_INCREASE: 1271 1192 error = xfs_refcount_adjust(rcur, bno, blockcount, &new_agbno, 1272 1193 new_len, XFS_REFCOUNT_ADJUST_INCREASE); 1273 - *new_fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, new_agbno); 1194 + if (error) 1195 + goto out_drop; 1196 + if (*new_len > 0) 1197 + error = xfs_refcount_continue_op(rcur, startblock, 1198 + new_agbno, *new_len, new_fsb); 1274 1199 break; 1275 1200 case XFS_REFCOUNT_DECREASE: 1276 1201 error = xfs_refcount_adjust(rcur, bno, blockcount, &new_agbno, 1277 1202 new_len, XFS_REFCOUNT_ADJUST_DECREASE); 1278 - *new_fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, new_agbno); 1203 + if (error) 1204 + goto out_drop; 1205 + if (*new_len > 0) 1206 + error = xfs_refcount_continue_op(rcur, startblock, 1207 + new_agbno, *new_len, new_fsb); 1279 1208 break; 1280 1209 case XFS_REFCOUNT_ALLOC_COW: 1281 1210 *new_fsb = startblock + blockcount; ··· 1394 1307 *flen = 0; 1395 1308 1396 1309 /* Try to find a refcount extent that crosses the start */ 1397 - error = xfs_refcount_lookup_le(cur, agbno, &have); 1310 + error = xfs_refcount_lookup_le(cur, XFS_REFC_DOMAIN_SHARED, agbno, 1311 + &have); 1398 1312 if (error) 1399 1313 goto out_error; 1400 1314 if (!have) { ··· 1413 1325 error = -EFSCORRUPTED; 1414 1326 goto out_error; 1415 1327 } 1328 + if (tmp.rc_domain != XFS_REFC_DOMAIN_SHARED) 1329 + goto done; 1416 1330 1417 1331 /* If the extent ends before the start, look at the next one */ 1418 1332 if (tmp.rc_startblock + tmp.rc_blockcount <= agbno) { ··· 1430 1340 error = -EFSCORRUPTED; 1431 1341 goto out_error; 1432 1342 } 1343 + if (tmp.rc_domain != XFS_REFC_DOMAIN_SHARED) 1344 + goto done; 1433 1345 } 1434 1346 1435 1347 /* If the extent starts after the range we want, bail out */ ··· 1463 1371 error = -EFSCORRUPTED; 1464 1372 goto out_error; 1465 1373 } 1466 - if (tmp.rc_startblock >= agbno + aglen || 1374 + if (tmp.rc_domain != XFS_REFC_DOMAIN_SHARED || 1375 + tmp.rc_startblock >= agbno + aglen || 1467 1376 tmp.rc_startblock != *fbno + *flen) 1468 1377 break; 1469 1378 *flen = min(*flen + tmp.rc_blockcount, agbno + aglen - *fbno); ··· 1548 1455 return 0; 1549 1456 1550 1457 /* Find any overlapping refcount records */ 1551 - error = xfs_refcount_lookup_ge(cur, agbno, &found_rec); 1458 + error = xfs_refcount_lookup_ge(cur, XFS_REFC_DOMAIN_COW, agbno, 1459 + &found_rec); 1552 1460 if (error) 1553 1461 goto out_error; 1554 1462 error = xfs_refcount_get_rec(cur, &ext, &found_rec); 1555 1463 if (error) 1556 1464 goto out_error; 1465 + if (XFS_IS_CORRUPT(cur->bc_mp, found_rec && 1466 + ext.rc_domain != XFS_REFC_DOMAIN_COW)) { 1467 + error = -EFSCORRUPTED; 1468 + goto out_error; 1469 + } 1557 1470 if (!found_rec) { 1558 - ext.rc_startblock = cur->bc_mp->m_sb.sb_agblocks + 1559 - XFS_REFC_COW_START; 1471 + ext.rc_startblock = cur->bc_mp->m_sb.sb_agblocks; 1560 1472 ext.rc_blockcount = 0; 1561 1473 ext.rc_refcount = 0; 1474 + ext.rc_domain = XFS_REFC_DOMAIN_COW; 1562 1475 } 1563 1476 1564 1477 switch (adj) { ··· 1579 1480 tmp.rc_startblock = agbno; 1580 1481 tmp.rc_blockcount = aglen; 1581 1482 tmp.rc_refcount = 1; 1483 + tmp.rc_domain = XFS_REFC_DOMAIN_COW; 1484 + 1582 1485 trace_xfs_refcount_modify_extent(cur->bc_mp, 1583 1486 cur->bc_ag.pag->pag_agno, &tmp); 1584 1487 ··· 1643 1542 bool shape_changed; 1644 1543 int error; 1645 1544 1646 - agbno += XFS_REFC_COW_START; 1647 - 1648 1545 /* 1649 1546 * Ensure that no rcextents cross the boundary of the adjustment range. 1650 1547 */ 1651 - error = xfs_refcount_split_extent(cur, agbno, &shape_changed); 1548 + error = xfs_refcount_split_extent(cur, XFS_REFC_DOMAIN_COW, 1549 + agbno, &shape_changed); 1652 1550 if (error) 1653 1551 goto out_error; 1654 1552 1655 - error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed); 1553 + error = xfs_refcount_split_extent(cur, XFS_REFC_DOMAIN_COW, 1554 + agbno + aglen, &shape_changed); 1656 1555 if (error) 1657 1556 goto out_error; 1658 1557 1659 1558 /* 1660 1559 * Try to merge with the left or right extents of the range. 1661 1560 */ 1662 - error = xfs_refcount_merge_extents(cur, &agbno, &aglen, adj, 1663 - XFS_FIND_RCEXT_COW, &shape_changed); 1561 + error = xfs_refcount_merge_extents(cur, XFS_REFC_DOMAIN_COW, &agbno, 1562 + &aglen, adj, &shape_changed); 1664 1563 if (error) 1665 1564 goto out_error; 1666 1565 ··· 1767 1666 be32_to_cpu(rec->refc.rc_refcount) != 1)) 1768 1667 return -EFSCORRUPTED; 1769 1668 1770 - rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), 0); 1669 + rr = kmalloc(sizeof(struct xfs_refcount_recovery), 1670 + GFP_KERNEL | __GFP_NOFAIL); 1671 + INIT_LIST_HEAD(&rr->rr_list); 1771 1672 xfs_refcount_btrec_to_irec(rec, &rr->rr_rrec); 1772 - list_add_tail(&rr->rr_list, debris); 1773 1673 1674 + if (XFS_IS_CORRUPT(cur->bc_mp, 1675 + rr->rr_rrec.rc_domain != XFS_REFC_DOMAIN_COW)) { 1676 + kfree(rr); 1677 + return -EFSCORRUPTED; 1678 + } 1679 + 1680 + list_add_tail(&rr->rr_list, debris); 1774 1681 return 0; 1775 1682 } 1776 1683 ··· 1796 1687 union xfs_btree_irec low; 1797 1688 union xfs_btree_irec high; 1798 1689 xfs_fsblock_t fsb; 1799 - xfs_agblock_t agbno; 1800 1690 int error; 1801 1691 1802 - if (mp->m_sb.sb_agblocks >= XFS_REFC_COW_START) 1692 + /* reflink filesystems mustn't have AGs larger than 2^31-1 blocks */ 1693 + BUILD_BUG_ON(XFS_MAX_CRC_AG_BLOCKS >= XFS_REFC_COWFLAG); 1694 + if (mp->m_sb.sb_agblocks > XFS_MAX_CRC_AG_BLOCKS) 1803 1695 return -EOPNOTSUPP; 1804 1696 1805 1697 INIT_LIST_HEAD(&debris); ··· 1827 1717 /* Find all the leftover CoW staging extents. */ 1828 1718 memset(&low, 0, sizeof(low)); 1829 1719 memset(&high, 0, sizeof(high)); 1830 - low.rc.rc_startblock = XFS_REFC_COW_START; 1720 + low.rc.rc_domain = high.rc.rc_domain = XFS_REFC_DOMAIN_COW; 1831 1721 high.rc.rc_startblock = -1U; 1832 1722 error = xfs_btree_query_range(cur, &low, &high, 1833 1723 xfs_refcount_recover_extent, &debris); ··· 1848 1738 &rr->rr_rrec); 1849 1739 1850 1740 /* Free the orphan record */ 1851 - agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START; 1852 - fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, agbno); 1741 + fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, 1742 + rr->rr_rrec.rc_startblock); 1853 1743 xfs_refcount_free_cow_extent(tp, fsb, 1854 1744 rr->rr_rrec.rc_blockcount); 1855 1745 ··· 1861 1751 goto out_free; 1862 1752 1863 1753 list_del(&rr->rr_list); 1864 - kmem_free(rr); 1754 + kfree(rr); 1865 1755 } 1866 1756 1867 1757 return error; ··· 1871 1761 /* Free the leftover list */ 1872 1762 list_for_each_entry_safe(rr, n, &debris, rr_list) { 1873 1763 list_del(&rr->rr_list); 1874 - kmem_free(rr); 1764 + kfree(rr); 1875 1765 } 1876 1766 return error; 1877 1767 } ··· 1880 1770 int 1881 1771 xfs_refcount_has_record( 1882 1772 struct xfs_btree_cur *cur, 1773 + enum xfs_refc_domain domain, 1883 1774 xfs_agblock_t bno, 1884 1775 xfs_extlen_t len, 1885 1776 bool *exists) ··· 1892 1781 low.rc.rc_startblock = bno; 1893 1782 memset(&high, 0xFF, sizeof(high)); 1894 1783 high.rc.rc_startblock = bno + len - 1; 1784 + low.rc.rc_domain = high.rc.rc_domain = domain; 1895 1785 1896 1786 return xfs_btree_has_record(cur, &low, &high, exists); 1897 1787 }
+36 -4
fs/xfs/libxfs/xfs_refcount.h
··· 14 14 struct xfs_refcount_irec; 15 15 16 16 extern int xfs_refcount_lookup_le(struct xfs_btree_cur *cur, 17 - xfs_agblock_t bno, int *stat); 17 + enum xfs_refc_domain domain, xfs_agblock_t bno, int *stat); 18 18 extern int xfs_refcount_lookup_ge(struct xfs_btree_cur *cur, 19 - xfs_agblock_t bno, int *stat); 19 + enum xfs_refc_domain domain, xfs_agblock_t bno, int *stat); 20 20 extern int xfs_refcount_lookup_eq(struct xfs_btree_cur *cur, 21 - xfs_agblock_t bno, int *stat); 21 + enum xfs_refc_domain domain, xfs_agblock_t bno, int *stat); 22 22 extern int xfs_refcount_get_rec(struct xfs_btree_cur *cur, 23 23 struct xfs_refcount_irec *irec, int *stat); 24 + 25 + static inline uint32_t 26 + xfs_refcount_encode_startblock( 27 + xfs_agblock_t startblock, 28 + enum xfs_refc_domain domain) 29 + { 30 + uint32_t start; 31 + 32 + /* 33 + * low level btree operations need to handle the generic btree range 34 + * query functions (which set rc_domain == -1U), so we check that the 35 + * domain is /not/ shared. 36 + */ 37 + start = startblock & ~XFS_REFC_COWFLAG; 38 + if (domain != XFS_REFC_DOMAIN_SHARED) 39 + start |= XFS_REFC_COWFLAG; 40 + 41 + return start; 42 + } 24 43 25 44 enum xfs_refcount_intent_type { 26 45 XFS_REFCOUNT_INCREASE = 1, ··· 54 35 xfs_extlen_t ri_blockcount; 55 36 xfs_fsblock_t ri_startblock; 56 37 }; 38 + 39 + /* Check that the refcount is appropriate for the record domain. */ 40 + static inline bool 41 + xfs_refcount_check_domain( 42 + const struct xfs_refcount_irec *irec) 43 + { 44 + if (irec->rc_domain == XFS_REFC_DOMAIN_COW && irec->rc_refcount != 1) 45 + return false; 46 + if (irec->rc_domain == XFS_REFC_DOMAIN_SHARED && irec->rc_refcount < 2) 47 + return false; 48 + return true; 49 + } 57 50 58 51 void xfs_refcount_increase_extent(struct xfs_trans *tp, 59 52 struct xfs_bmbt_irec *irec); ··· 110 79 #define XFS_REFCOUNT_ITEM_OVERHEAD 32 111 80 112 81 extern int xfs_refcount_has_record(struct xfs_btree_cur *cur, 113 - xfs_agblock_t bno, xfs_extlen_t len, bool *exists); 82 + enum xfs_refc_domain domain, xfs_agblock_t bno, 83 + xfs_extlen_t len, bool *exists); 114 84 union xfs_btree_rec; 115 85 extern void xfs_refcount_btrec_to_irec(const union xfs_btree_rec *rec, 116 86 struct xfs_refcount_irec *irec);
+12 -3
fs/xfs/libxfs/xfs_refcount_btree.c
··· 13 13 #include "xfs_btree.h" 14 14 #include "xfs_btree_staging.h" 15 15 #include "xfs_refcount_btree.h" 16 + #include "xfs_refcount.h" 16 17 #include "xfs_alloc.h" 17 18 #include "xfs_error.h" 18 19 #include "xfs_trace.h" ··· 161 160 struct xfs_btree_cur *cur, 162 161 union xfs_btree_rec *rec) 163 162 { 164 - rec->refc.rc_startblock = cpu_to_be32(cur->bc_rec.rc.rc_startblock); 163 + const struct xfs_refcount_irec *irec = &cur->bc_rec.rc; 164 + uint32_t start; 165 + 166 + start = xfs_refcount_encode_startblock(irec->rc_startblock, 167 + irec->rc_domain); 168 + rec->refc.rc_startblock = cpu_to_be32(start); 165 169 rec->refc.rc_blockcount = cpu_to_be32(cur->bc_rec.rc.rc_blockcount); 166 170 rec->refc.rc_refcount = cpu_to_be32(cur->bc_rec.rc.rc_refcount); 167 171 } ··· 188 182 struct xfs_btree_cur *cur, 189 183 const union xfs_btree_key *key) 190 184 { 191 - struct xfs_refcount_irec *rec = &cur->bc_rec.rc; 192 185 const struct xfs_refcount_key *kp = &key->refc; 186 + const struct xfs_refcount_irec *irec = &cur->bc_rec.rc; 187 + uint32_t start; 193 188 194 - return (int64_t)be32_to_cpu(kp->rc_startblock) - rec->rc_startblock; 189 + start = xfs_refcount_encode_startblock(irec->rc_startblock, 190 + irec->rc_domain); 191 + return (int64_t)be32_to_cpu(kp->rc_startblock) - start; 195 192 } 196 193 197 194 STATIC int64_t
+2 -7
fs/xfs/libxfs/xfs_rmap.c
··· 235 235 goto out_bad_rec; 236 236 } else { 237 237 /* check for valid extent range, including overflow */ 238 - if (!xfs_verify_agbno(pag, irec->rm_startblock)) 239 - goto out_bad_rec; 240 - if (irec->rm_startblock > 241 - irec->rm_startblock + irec->rm_blockcount) 242 - goto out_bad_rec; 243 - if (!xfs_verify_agbno(pag, 244 - irec->rm_startblock + irec->rm_blockcount - 1)) 238 + if (!xfs_verify_agbext(pag, irec->rm_startblock, 239 + irec->rm_blockcount)) 245 240 goto out_bad_rec; 246 241 } 247 242
+2 -2
fs/xfs/libxfs/xfs_trans_resv.c
··· 422 422 423 423 /* 424 424 * In renaming a files we can modify: 425 - * the four inodes involved: 4 * inode size 425 + * the five inodes involved: 5 * inode size 426 426 * the two directory btrees: 2 * (max depth + v2) * dir block size 427 427 * the two directory bmap btrees: 2 * max depth * block size 428 428 * And the bmap_finish transaction can free dir and bmap blocks (two sets ··· 437 437 struct xfs_mount *mp) 438 438 { 439 439 return XFS_DQUOT_LOGRES(mp) + 440 - max((xfs_calc_inode_res(mp, 4) + 440 + max((xfs_calc_inode_res(mp, 5) + 441 441 xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp), 442 442 XFS_FSB_TO_B(mp, 1))), 443 443 (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
+30
fs/xfs/libxfs/xfs_types.h
··· 166 166 xfs_exntst_t br_state; /* extent state */ 167 167 } xfs_bmbt_irec_t; 168 168 169 + enum xfs_refc_domain { 170 + XFS_REFC_DOMAIN_SHARED = 0, 171 + XFS_REFC_DOMAIN_COW, 172 + }; 173 + 174 + #define XFS_REFC_DOMAIN_STRINGS \ 175 + { XFS_REFC_DOMAIN_SHARED, "shared" }, \ 176 + { XFS_REFC_DOMAIN_COW, "cow" } 177 + 178 + struct xfs_refcount_irec { 179 + xfs_agblock_t rc_startblock; /* starting block number */ 180 + xfs_extlen_t rc_blockcount; /* count of free blocks */ 181 + xfs_nlink_t rc_refcount; /* number of inodes linked here */ 182 + enum xfs_refc_domain rc_domain; /* shared or cow staging extent? */ 183 + }; 184 + 185 + #define XFS_RMAP_ATTR_FORK (1 << 0) 186 + #define XFS_RMAP_BMBT_BLOCK (1 << 1) 187 + #define XFS_RMAP_UNWRITTEN (1 << 2) 188 + #define XFS_RMAP_KEY_FLAGS (XFS_RMAP_ATTR_FORK | \ 189 + XFS_RMAP_BMBT_BLOCK) 190 + #define XFS_RMAP_REC_FLAGS (XFS_RMAP_UNWRITTEN) 191 + struct xfs_rmap_irec { 192 + xfs_agblock_t rm_startblock; /* extent start block */ 193 + xfs_extlen_t rm_blockcount; /* extent length */ 194 + uint64_t rm_owner; /* extent owner */ 195 + uint64_t rm_offset; /* offset within the owner */ 196 + unsigned int rm_flags; /* state flags */ 197 + }; 198 + 169 199 /* per-AG block reservation types */ 170 200 enum xfs_ag_resv_type { 171 201 XFS_AG_RESV_NONE = 0,
+1 -3
fs/xfs/scrub/alloc.c
··· 100 100 bno = be32_to_cpu(rec->alloc.ar_startblock); 101 101 len = be32_to_cpu(rec->alloc.ar_blockcount); 102 102 103 - if (bno + len <= bno || 104 - !xfs_verify_agbno(pag, bno) || 105 - !xfs_verify_agbno(pag, bno + len - 1)) 103 + if (!xfs_verify_agbext(pag, bno, len)) 106 104 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); 107 105 108 106 xchk_allocbt_xref(bs->sc, bno, len);
+2 -3
fs/xfs/scrub/ialloc.c
··· 108 108 xfs_agblock_t bno; 109 109 110 110 bno = XFS_AGINO_TO_AGBNO(mp, agino); 111 - if (bno + len <= bno || 112 - !xfs_verify_agbno(pag, bno) || 113 - !xfs_verify_agbno(pag, bno + len - 1)) 111 + 112 + if (!xfs_verify_agbext(pag, bno, len)) 114 113 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); 115 114 116 115 xchk_iallocbt_chunk_xref(bs->sc, irec, agino, bno, len);
+30 -42
fs/xfs/scrub/refcount.c
··· 269 269 STATIC void 270 270 xchk_refcountbt_xref_rmap( 271 271 struct xfs_scrub *sc, 272 - xfs_agblock_t bno, 273 - xfs_extlen_t len, 274 - xfs_nlink_t refcount) 272 + const struct xfs_refcount_irec *irec) 275 273 { 276 274 struct xchk_refcnt_check refchk = { 277 - .sc = sc, 278 - .bno = bno, 279 - .len = len, 280 - .refcount = refcount, 275 + .sc = sc, 276 + .bno = irec->rc_startblock, 277 + .len = irec->rc_blockcount, 278 + .refcount = irec->rc_refcount, 281 279 .seen = 0, 282 280 }; 283 281 struct xfs_rmap_irec low; ··· 289 291 290 292 /* Cross-reference with the rmapbt to confirm the refcount. */ 291 293 memset(&low, 0, sizeof(low)); 292 - low.rm_startblock = bno; 294 + low.rm_startblock = irec->rc_startblock; 293 295 memset(&high, 0xFF, sizeof(high)); 294 - high.rm_startblock = bno + len - 1; 296 + high.rm_startblock = irec->rc_startblock + irec->rc_blockcount - 1; 295 297 296 298 INIT_LIST_HEAD(&refchk.fragments); 297 299 error = xfs_rmap_query_range(sc->sa.rmap_cur, &low, &high, ··· 300 302 goto out_free; 301 303 302 304 xchk_refcountbt_process_rmap_fragments(&refchk); 303 - if (refcount != refchk.seen) 305 + if (irec->rc_refcount != refchk.seen) 304 306 xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); 305 307 306 308 out_free: ··· 313 315 /* Cross-reference with the other btrees. */ 314 316 STATIC void 315 317 xchk_refcountbt_xref( 316 - struct xfs_scrub *sc, 317 - xfs_agblock_t agbno, 318 - xfs_extlen_t len, 319 - xfs_nlink_t refcount) 318 + struct xfs_scrub *sc, 319 + const struct xfs_refcount_irec *irec) 320 320 { 321 321 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 322 322 return; 323 323 324 - xchk_xref_is_used_space(sc, agbno, len); 325 - xchk_xref_is_not_inode_chunk(sc, agbno, len); 326 - xchk_refcountbt_xref_rmap(sc, agbno, len, refcount); 324 + xchk_xref_is_used_space(sc, irec->rc_startblock, irec->rc_blockcount); 325 + xchk_xref_is_not_inode_chunk(sc, irec->rc_startblock, 326 + irec->rc_blockcount); 327 + xchk_refcountbt_xref_rmap(sc, irec); 327 328 } 328 329 329 330 /* Scrub a refcountbt record. */ ··· 331 334 struct xchk_btree *bs, 332 335 const union xfs_btree_rec *rec) 333 336 { 337 + struct xfs_refcount_irec irec; 334 338 xfs_agblock_t *cow_blocks = bs->private; 335 339 struct xfs_perag *pag = bs->cur->bc_ag.pag; 336 - xfs_agblock_t bno; 337 - xfs_extlen_t len; 338 - xfs_nlink_t refcount; 339 - bool has_cowflag; 340 340 341 - bno = be32_to_cpu(rec->refc.rc_startblock); 342 - len = be32_to_cpu(rec->refc.rc_blockcount); 343 - refcount = be32_to_cpu(rec->refc.rc_refcount); 341 + xfs_refcount_btrec_to_irec(rec, &irec); 344 342 345 - /* Only CoW records can have refcount == 1. */ 346 - has_cowflag = (bno & XFS_REFC_COW_START); 347 - if ((refcount == 1 && !has_cowflag) || (refcount != 1 && has_cowflag)) 343 + /* Check the domain and refcount are not incompatible. */ 344 + if (!xfs_refcount_check_domain(&irec)) 348 345 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); 349 - if (has_cowflag) 350 - (*cow_blocks) += len; 346 + 347 + if (irec.rc_domain == XFS_REFC_DOMAIN_COW) 348 + (*cow_blocks) += irec.rc_blockcount; 351 349 352 350 /* Check the extent. */ 353 - bno &= ~XFS_REFC_COW_START; 354 - if (bno + len <= bno || 355 - !xfs_verify_agbno(pag, bno) || 356 - !xfs_verify_agbno(pag, bno + len - 1)) 351 + if (!xfs_verify_agbext(pag, irec.rc_startblock, irec.rc_blockcount)) 357 352 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); 358 353 359 - if (refcount == 0) 354 + if (irec.rc_refcount == 0) 360 355 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); 361 356 362 - xchk_refcountbt_xref(bs->sc, bno, len, refcount); 357 + xchk_refcountbt_xref(bs->sc, &irec); 363 358 364 359 return 0; 365 360 } ··· 415 426 xfs_extlen_t len) 416 427 { 417 428 struct xfs_refcount_irec rc; 418 - bool has_cowflag; 419 429 int has_refcount; 420 430 int error; 421 431 ··· 422 434 return; 423 435 424 436 /* Find the CoW staging extent. */ 425 - error = xfs_refcount_lookup_le(sc->sa.refc_cur, 426 - agbno + XFS_REFC_COW_START, &has_refcount); 437 + error = xfs_refcount_lookup_le(sc->sa.refc_cur, XFS_REFC_DOMAIN_COW, 438 + agbno, &has_refcount); 427 439 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) 428 440 return; 429 441 if (!has_refcount) { ··· 439 451 return; 440 452 } 441 453 442 - /* CoW flag must be set, refcount must be 1. */ 443 - has_cowflag = (rc.rc_startblock & XFS_REFC_COW_START); 444 - if (!has_cowflag || rc.rc_refcount != 1) 454 + /* CoW lookup returned a shared extent record? */ 455 + if (rc.rc_domain != XFS_REFC_DOMAIN_COW) 445 456 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); 446 457 447 458 /* Must be at least as long as what was passed in */ ··· 464 477 if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) 465 478 return; 466 479 467 - error = xfs_refcount_has_record(sc->sa.refc_cur, agbno, len, &shared); 480 + error = xfs_refcount_has_record(sc->sa.refc_cur, XFS_REFC_DOMAIN_SHARED, 481 + agbno, len, &shared); 468 482 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) 469 483 return; 470 484 if (shared)
+33 -34
fs/xfs/xfs_attr_item.c
··· 245 245 return attrip; 246 246 } 247 247 248 - /* 249 - * Copy an attr format buffer from the given buf, and into the destination attr 250 - * format structure. 251 - */ 252 - STATIC int 253 - xfs_attri_copy_format( 254 - struct xfs_log_iovec *buf, 255 - struct xfs_attri_log_format *dst_attr_fmt) 256 - { 257 - struct xfs_attri_log_format *src_attr_fmt = buf->i_addr; 258 - size_t len; 259 - 260 - len = sizeof(struct xfs_attri_log_format); 261 - if (buf->i_len != len) { 262 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 263 - return -EFSCORRUPTED; 264 - } 265 - 266 - memcpy((char *)dst_attr_fmt, (char *)src_attr_fmt, len); 267 - return 0; 268 - } 269 - 270 248 static inline struct xfs_attrd_log_item *ATTRD_ITEM(struct xfs_log_item *lip) 271 249 { 272 250 return container_of(lip, struct xfs_attrd_log_item, attrd_item); ··· 709 731 struct xfs_attri_log_nameval *nv; 710 732 const void *attr_value = NULL; 711 733 const void *attr_name; 712 - int error; 734 + size_t len; 713 735 714 736 attri_formatp = item->ri_buf[0].i_addr; 715 737 attr_name = item->ri_buf[1].i_addr; 716 738 717 739 /* Validate xfs_attri_log_format before the large memory allocation */ 740 + len = sizeof(struct xfs_attri_log_format); 741 + if (item->ri_buf[0].i_len != len) { 742 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 743 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 744 + return -EFSCORRUPTED; 745 + } 746 + 718 747 if (!xfs_attri_validate(mp, attri_formatp)) { 719 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); 748 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 749 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 750 + return -EFSCORRUPTED; 751 + } 752 + 753 + /* Validate the attr name */ 754 + if (item->ri_buf[1].i_len != 755 + xlog_calc_iovec_len(attri_formatp->alfi_name_len)) { 756 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 757 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 720 758 return -EFSCORRUPTED; 721 759 } 722 760 723 761 if (!xfs_attr_namecheck(attr_name, attri_formatp->alfi_name_len)) { 724 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); 762 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 763 + item->ri_buf[1].i_addr, item->ri_buf[1].i_len); 725 764 return -EFSCORRUPTED; 726 765 } 727 766 728 - if (attri_formatp->alfi_value_len) 767 + /* Validate the attr value, if present */ 768 + if (attri_formatp->alfi_value_len != 0) { 769 + if (item->ri_buf[2].i_len != xlog_calc_iovec_len(attri_formatp->alfi_value_len)) { 770 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 771 + item->ri_buf[0].i_addr, 772 + item->ri_buf[0].i_len); 773 + return -EFSCORRUPTED; 774 + } 775 + 729 776 attr_value = item->ri_buf[2].i_addr; 777 + } 730 778 731 779 /* 732 780 * Memory alloc failure will cause replay to abort. We attach the ··· 764 760 attri_formatp->alfi_value_len); 765 761 766 762 attrip = xfs_attri_init(mp, nv); 767 - error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format); 768 - if (error) 769 - goto out; 763 + memcpy(&attrip->attri_format, attri_formatp, len); 770 764 771 765 /* 772 766 * The ATTRI has two references. One for the ATTRD and one for ATTRI to ··· 776 774 xfs_attri_release(attrip); 777 775 xfs_attri_log_nameval_put(nv); 778 776 return 0; 779 - out: 780 - xfs_attri_item_free(attrip); 781 - xfs_attri_log_nameval_put(nv); 782 - return error; 783 777 } 784 778 785 779 /* ··· 840 842 841 843 attrd_formatp = item->ri_buf[0].i_addr; 842 844 if (item->ri_buf[0].i_len != sizeof(struct xfs_attrd_log_format)) { 843 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 845 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 846 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 844 847 return -EFSCORRUPTED; 845 848 } 846 849
+29 -27
fs/xfs/xfs_bmap_item.c
··· 608 608 .iop_relog = xfs_bui_item_relog, 609 609 }; 610 610 611 - /* 612 - * Copy an BUI format buffer from the given buf, and into the destination 613 - * BUI format structure. The BUI/BUD items were designed not to need any 614 - * special alignment handling. 615 - */ 616 - static int 611 + static inline void 617 612 xfs_bui_copy_format( 618 - struct xfs_log_iovec *buf, 619 - struct xfs_bui_log_format *dst_bui_fmt) 613 + struct xfs_bui_log_format *dst, 614 + const struct xfs_bui_log_format *src) 620 615 { 621 - struct xfs_bui_log_format *src_bui_fmt; 622 - uint len; 616 + unsigned int i; 623 617 624 - src_bui_fmt = buf->i_addr; 625 - len = xfs_bui_log_format_sizeof(src_bui_fmt->bui_nextents); 618 + memcpy(dst, src, offsetof(struct xfs_bui_log_format, bui_extents)); 626 619 627 - if (buf->i_len == len) { 628 - memcpy(dst_bui_fmt, src_bui_fmt, len); 629 - return 0; 630 - } 631 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 632 - return -EFSCORRUPTED; 620 + for (i = 0; i < src->bui_nextents; i++) 621 + memcpy(&dst->bui_extents[i], &src->bui_extents[i], 622 + sizeof(struct xfs_map_extent)); 633 623 } 634 624 635 625 /* ··· 636 646 struct xlog_recover_item *item, 637 647 xfs_lsn_t lsn) 638 648 { 639 - int error; 640 649 struct xfs_mount *mp = log->l_mp; 641 650 struct xfs_bui_log_item *buip; 642 651 struct xfs_bui_log_format *bui_formatp; 652 + size_t len; 643 653 644 654 bui_formatp = item->ri_buf[0].i_addr; 645 655 646 - if (bui_formatp->bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) { 647 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); 656 + if (item->ri_buf[0].i_len < xfs_bui_log_format_sizeof(0)) { 657 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 658 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 648 659 return -EFSCORRUPTED; 649 660 } 650 - buip = xfs_bui_init(mp); 651 - error = xfs_bui_copy_format(&item->ri_buf[0], &buip->bui_format); 652 - if (error) { 653 - xfs_bui_item_free(buip); 654 - return error; 661 + 662 + if (bui_formatp->bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) { 663 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 664 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 665 + return -EFSCORRUPTED; 655 666 } 667 + 668 + len = xfs_bui_log_format_sizeof(bui_formatp->bui_nextents); 669 + if (item->ri_buf[0].i_len != len) { 670 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 671 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 672 + return -EFSCORRUPTED; 673 + } 674 + 675 + buip = xfs_bui_init(mp); 676 + xfs_bui_copy_format(&buip->bui_format, bui_formatp); 656 677 atomic_set(&buip->bui_next_extent, bui_formatp->bui_nextents); 657 678 /* 658 679 * Insert the intent into the AIL directly and drop one reference so ··· 697 696 698 697 bud_formatp = item->ri_buf[0].i_addr; 699 698 if (item->ri_buf[0].i_len != sizeof(struct xfs_bud_log_format)) { 700 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); 699 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 700 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 701 701 return -EFSCORRUPTED; 702 702 } 703 703
+7 -2
fs/xfs/xfs_error.c
··· 234 234 xfs_errortag_init( 235 235 struct xfs_mount *mp) 236 236 { 237 + int ret; 238 + 237 239 mp->m_errortag = kmem_zalloc(sizeof(unsigned int) * XFS_ERRTAG_MAX, 238 240 KM_MAYFAIL); 239 241 if (!mp->m_errortag) 240 242 return -ENOMEM; 241 243 242 - return xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype, 243 - &mp->m_kobj, "errortag"); 244 + ret = xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype, 245 + &mp->m_kobj, "errortag"); 246 + if (ret) 247 + kmem_free(mp->m_errortag); 248 + return ret; 244 249 } 245 250 246 251 void
+45 -49
fs/xfs/xfs_extfree_item.c
··· 66 66 xfs_efi_item_free(efip); 67 67 } 68 68 69 - /* 70 - * This returns the number of iovecs needed to log the given efi item. 71 - * We only need 1 iovec for an efi item. It just logs the efi_log_format 72 - * structure. 73 - */ 74 - static inline int 75 - xfs_efi_item_sizeof( 76 - struct xfs_efi_log_item *efip) 77 - { 78 - return sizeof(struct xfs_efi_log_format) + 79 - (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t); 80 - } 81 - 82 69 STATIC void 83 70 xfs_efi_item_size( 84 71 struct xfs_log_item *lip, 85 72 int *nvecs, 86 73 int *nbytes) 87 74 { 75 + struct xfs_efi_log_item *efip = EFI_ITEM(lip); 76 + 88 77 *nvecs += 1; 89 - *nbytes += xfs_efi_item_sizeof(EFI_ITEM(lip)); 78 + *nbytes += xfs_efi_log_format_sizeof(efip->efi_format.efi_nextents); 90 79 } 91 80 92 81 /* ··· 101 112 102 113 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFI_FORMAT, 103 114 &efip->efi_format, 104 - xfs_efi_item_sizeof(efip)); 115 + xfs_efi_log_format_sizeof(efip->efi_format.efi_nextents)); 105 116 } 106 117 107 118 ··· 144 155 145 156 { 146 157 struct xfs_efi_log_item *efip; 147 - uint size; 148 158 149 159 ASSERT(nextents > 0); 150 160 if (nextents > XFS_EFI_MAX_FAST_EXTENTS) { 151 - size = (uint)(sizeof(struct xfs_efi_log_item) + 152 - ((nextents - 1) * sizeof(xfs_extent_t))); 153 - efip = kmem_zalloc(size, 0); 161 + efip = kzalloc(xfs_efi_log_item_sizeof(nextents), 162 + GFP_KERNEL | __GFP_NOFAIL); 154 163 } else { 155 164 efip = kmem_cache_zalloc(xfs_efi_cache, 156 165 GFP_KERNEL | __GFP_NOFAIL); ··· 175 188 { 176 189 xfs_efi_log_format_t *src_efi_fmt = buf->i_addr; 177 190 uint i; 178 - uint len = sizeof(xfs_efi_log_format_t) + 179 - (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_t); 180 - uint len32 = sizeof(xfs_efi_log_format_32_t) + 181 - (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_32_t); 182 - uint len64 = sizeof(xfs_efi_log_format_64_t) + 183 - (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_64_t); 191 + uint len = xfs_efi_log_format_sizeof(src_efi_fmt->efi_nextents); 192 + uint len32 = xfs_efi_log_format32_sizeof(src_efi_fmt->efi_nextents); 193 + uint len64 = xfs_efi_log_format64_sizeof(src_efi_fmt->efi_nextents); 184 194 185 195 if (buf->i_len == len) { 186 - memcpy((char *)dst_efi_fmt, (char*)src_efi_fmt, len); 196 + memcpy(dst_efi_fmt, src_efi_fmt, 197 + offsetof(struct xfs_efi_log_format, efi_extents)); 198 + for (i = 0; i < src_efi_fmt->efi_nextents; i++) 199 + memcpy(&dst_efi_fmt->efi_extents[i], 200 + &src_efi_fmt->efi_extents[i], 201 + sizeof(struct xfs_extent)); 187 202 return 0; 188 203 } else if (buf->i_len == len32) { 189 204 xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr; ··· 216 227 } 217 228 return 0; 218 229 } 219 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 230 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, NULL, buf->i_addr, 231 + buf->i_len); 220 232 return -EFSCORRUPTED; 221 233 } 222 234 ··· 236 246 kmem_cache_free(xfs_efd_cache, efdp); 237 247 } 238 248 239 - /* 240 - * This returns the number of iovecs needed to log the given efd item. 241 - * We only need 1 iovec for an efd item. It just logs the efd_log_format 242 - * structure. 243 - */ 244 - static inline int 245 - xfs_efd_item_sizeof( 246 - struct xfs_efd_log_item *efdp) 247 - { 248 - return sizeof(xfs_efd_log_format_t) + 249 - (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t); 250 - } 251 - 252 249 STATIC void 253 250 xfs_efd_item_size( 254 251 struct xfs_log_item *lip, 255 252 int *nvecs, 256 253 int *nbytes) 257 254 { 255 + struct xfs_efd_log_item *efdp = EFD_ITEM(lip); 256 + 258 257 *nvecs += 1; 259 - *nbytes += xfs_efd_item_sizeof(EFD_ITEM(lip)); 258 + *nbytes += xfs_efd_log_format_sizeof(efdp->efd_format.efd_nextents); 260 259 } 261 260 262 261 /* ··· 270 291 271 292 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_EFD_FORMAT, 272 293 &efdp->efd_format, 273 - xfs_efd_item_sizeof(efdp)); 294 + xfs_efd_log_format_sizeof(efdp->efd_format.efd_nextents)); 274 295 } 275 296 276 297 /* ··· 319 340 ASSERT(nextents > 0); 320 341 321 342 if (nextents > XFS_EFD_MAX_FAST_EXTENTS) { 322 - efdp = kmem_zalloc(sizeof(struct xfs_efd_log_item) + 323 - (nextents - 1) * sizeof(struct xfs_extent), 324 - 0); 343 + efdp = kzalloc(xfs_efd_log_item_sizeof(nextents), 344 + GFP_KERNEL | __GFP_NOFAIL); 325 345 } else { 326 346 efdp = kmem_cache_zalloc(xfs_efd_cache, 327 347 GFP_KERNEL | __GFP_NOFAIL); ··· 711 733 712 734 efi_formatp = item->ri_buf[0].i_addr; 713 735 736 + if (item->ri_buf[0].i_len < xfs_efi_log_format_sizeof(0)) { 737 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 738 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 739 + return -EFSCORRUPTED; 740 + } 741 + 714 742 efip = xfs_efi_init(mp, efi_formatp->efi_nextents); 715 743 error = xfs_efi_copy_format(&item->ri_buf[0], &efip->efi_format); 716 744 if (error) { ··· 753 769 xfs_lsn_t lsn) 754 770 { 755 771 struct xfs_efd_log_format *efd_formatp; 772 + int buflen = item->ri_buf[0].i_len; 756 773 757 774 efd_formatp = item->ri_buf[0].i_addr; 758 - ASSERT((item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_32_t) + 759 - ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) || 760 - (item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_64_t) + 761 - ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_64_t))))); 775 + 776 + if (buflen < sizeof(struct xfs_efd_log_format)) { 777 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 778 + efd_formatp, buflen); 779 + return -EFSCORRUPTED; 780 + } 781 + 782 + if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof( 783 + efd_formatp->efd_nextents) && 784 + item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof( 785 + efd_formatp->efd_nextents)) { 786 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 787 + efd_formatp, buflen); 788 + return -EFSCORRUPTED; 789 + } 762 790 763 791 xlog_recover_release_intent(log, XFS_LI_EFI, efd_formatp->efd_efi_id); 764 792 return 0;
+16
fs/xfs/xfs_extfree_item.h
··· 52 52 xfs_efi_log_format_t efi_format; 53 53 }; 54 54 55 + static inline size_t 56 + xfs_efi_log_item_sizeof( 57 + unsigned int nr) 58 + { 59 + return offsetof(struct xfs_efi_log_item, efi_format) + 60 + xfs_efi_log_format_sizeof(nr); 61 + } 62 + 55 63 /* 56 64 * This is the "extent free done" log item. It is used to log 57 65 * the fact that some extents earlier mentioned in an efi item ··· 71 63 uint efd_next_extent; 72 64 xfs_efd_log_format_t efd_format; 73 65 }; 66 + 67 + static inline size_t 68 + xfs_efd_log_item_sizeof( 69 + unsigned int nr) 70 + { 71 + return offsetof(struct xfs_efd_log_item, efd_format) + 72 + xfs_efd_log_format_sizeof(nr); 73 + } 74 74 75 75 /* 76 76 * Max number of extents in fast allocation path.
+4 -3
fs/xfs/xfs_file.c
··· 1261 1261 } 1262 1262 1263 1263 #ifdef CONFIG_FS_DAX 1264 - static int 1264 + static inline vm_fault_t 1265 1265 xfs_dax_fault( 1266 1266 struct vm_fault *vmf, 1267 1267 enum page_entry_size pe_size, ··· 1274 1274 &xfs_read_iomap_ops); 1275 1275 } 1276 1276 #else 1277 - static int 1277 + static inline vm_fault_t 1278 1278 xfs_dax_fault( 1279 1279 struct vm_fault *vmf, 1280 1280 enum page_entry_size pe_size, 1281 1281 bool write_fault, 1282 1282 pfn_t *pfn) 1283 1283 { 1284 - return 0; 1284 + ASSERT(0); 1285 + return VM_FAULT_SIGBUS; 1285 1286 } 1286 1287 #endif 1287 1288
+1 -1
fs/xfs/xfs_inode.c
··· 2818 2818 * Lock all the participating inodes. Depending upon whether 2819 2819 * the target_name exists in the target directory, and 2820 2820 * whether the target directory is the same as the source 2821 - * directory, we can lock from 2 to 4 inodes. 2821 + * directory, we can lock from 2 to 5 inodes. 2822 2822 */ 2823 2823 xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL); 2824 2824
+8 -2
fs/xfs/xfs_log_recover.c
··· 2552 2552 for (lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); 2553 2553 lip != NULL; 2554 2554 lip = xfs_trans_ail_cursor_next(ailp, &cur)) { 2555 + const struct xfs_item_ops *ops; 2556 + 2555 2557 if (!xlog_item_is_intent(lip)) 2556 2558 break; 2557 2559 ··· 2569 2567 * deferred ops, you /must/ attach them to the capture list in 2570 2568 * the recover routine or else those subsequent intents will be 2571 2569 * replayed in the wrong order! 2570 + * 2571 + * The recovery function can free the log item, so we must not 2572 + * access lip after it returns. 2572 2573 */ 2573 2574 spin_unlock(&ailp->ail_lock); 2574 - error = lip->li_ops->iop_recover(lip, &capture_list); 2575 + ops = lip->li_ops; 2576 + error = ops->iop_recover(lip, &capture_list); 2575 2577 spin_lock(&ailp->ail_lock); 2576 2578 if (error) { 2577 2579 trace_xlog_intent_recovery_failed(log->l_mp, error, 2578 - lip->li_ops->iop_recover); 2580 + ops->iop_recover); 2579 2581 break; 2580 2582 } 2581 2583 }
+19 -4
fs/xfs/xfs_ondisk.h
··· 118 118 /* log structures */ 119 119 XFS_CHECK_STRUCT_SIZE(struct xfs_buf_log_format, 88); 120 120 XFS_CHECK_STRUCT_SIZE(struct xfs_dq_logformat, 24); 121 - XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_32, 28); 122 - XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_64, 32); 123 - XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_32, 28); 124 - XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_64, 32); 121 + XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_32, 16); 122 + XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_64, 16); 123 + XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_32, 16); 124 + XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_64, 16); 125 125 XFS_CHECK_STRUCT_SIZE(struct xfs_extent_32, 12); 126 126 XFS_CHECK_STRUCT_SIZE(struct xfs_extent_64, 16); 127 127 XFS_CHECK_STRUCT_SIZE(struct xfs_log_dinode, 176); ··· 134 134 XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header, 16); 135 135 XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format, 40); 136 136 XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format, 16); 137 + XFS_CHECK_STRUCT_SIZE(struct xfs_bui_log_format, 16); 138 + XFS_CHECK_STRUCT_SIZE(struct xfs_bud_log_format, 16); 139 + XFS_CHECK_STRUCT_SIZE(struct xfs_cui_log_format, 16); 140 + XFS_CHECK_STRUCT_SIZE(struct xfs_cud_log_format, 16); 141 + XFS_CHECK_STRUCT_SIZE(struct xfs_rui_log_format, 16); 142 + XFS_CHECK_STRUCT_SIZE(struct xfs_rud_log_format, 16); 143 + XFS_CHECK_STRUCT_SIZE(struct xfs_map_extent, 32); 144 + XFS_CHECK_STRUCT_SIZE(struct xfs_phys_extent, 16); 145 + 146 + XFS_CHECK_OFFSET(struct xfs_bui_log_format, bui_extents, 16); 147 + XFS_CHECK_OFFSET(struct xfs_cui_log_format, cui_extents, 16); 148 + XFS_CHECK_OFFSET(struct xfs_rui_log_format, rui_extents, 16); 149 + XFS_CHECK_OFFSET(struct xfs_efi_log_format, efi_extents, 16); 150 + XFS_CHECK_OFFSET(struct xfs_efi_log_format_32, efi_extents, 16); 151 + XFS_CHECK_OFFSET(struct xfs_efi_log_format_64, efi_extents, 16); 137 152 138 153 /* 139 154 * The v5 superblock format extended several v4 header structures with
+30 -27
fs/xfs/xfs_refcount_item.c
··· 523 523 type = refc_type; 524 524 break; 525 525 default: 526 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); 526 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 527 + &cuip->cui_format, 528 + sizeof(cuip->cui_format)); 527 529 error = -EFSCORRUPTED; 528 530 goto abort_error; 529 531 } ··· 538 536 &new_fsb, &new_len, &rcur); 539 537 if (error == -EFSCORRUPTED) 540 538 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 541 - refc, sizeof(*refc)); 539 + &cuip->cui_format, 540 + sizeof(cuip->cui_format)); 542 541 if (error) 543 542 goto abort_error; 544 543 ··· 625 622 .iop_relog = xfs_cui_item_relog, 626 623 }; 627 624 628 - /* 629 - * Copy an CUI format buffer from the given buf, and into the destination 630 - * CUI format structure. The CUI/CUD items were designed not to need any 631 - * special alignment handling. 632 - */ 633 - static int 625 + static inline void 634 626 xfs_cui_copy_format( 635 - struct xfs_log_iovec *buf, 636 - struct xfs_cui_log_format *dst_cui_fmt) 627 + struct xfs_cui_log_format *dst, 628 + const struct xfs_cui_log_format *src) 637 629 { 638 - struct xfs_cui_log_format *src_cui_fmt; 639 - uint len; 630 + unsigned int i; 640 631 641 - src_cui_fmt = buf->i_addr; 642 - len = xfs_cui_log_format_sizeof(src_cui_fmt->cui_nextents); 632 + memcpy(dst, src, offsetof(struct xfs_cui_log_format, cui_extents)); 643 633 644 - if (buf->i_len == len) { 645 - memcpy(dst_cui_fmt, src_cui_fmt, len); 646 - return 0; 647 - } 648 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 649 - return -EFSCORRUPTED; 634 + for (i = 0; i < src->cui_nextents; i++) 635 + memcpy(&dst->cui_extents[i], &src->cui_extents[i], 636 + sizeof(struct xfs_phys_extent)); 650 637 } 651 638 652 639 /* ··· 653 660 struct xlog_recover_item *item, 654 661 xfs_lsn_t lsn) 655 662 { 656 - int error; 657 663 struct xfs_mount *mp = log->l_mp; 658 664 struct xfs_cui_log_item *cuip; 659 665 struct xfs_cui_log_format *cui_formatp; 666 + size_t len; 660 667 661 668 cui_formatp = item->ri_buf[0].i_addr; 662 669 663 - cuip = xfs_cui_init(mp, cui_formatp->cui_nextents); 664 - error = xfs_cui_copy_format(&item->ri_buf[0], &cuip->cui_format); 665 - if (error) { 666 - xfs_cui_item_free(cuip); 667 - return error; 670 + if (item->ri_buf[0].i_len < xfs_cui_log_format_sizeof(0)) { 671 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 672 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 673 + return -EFSCORRUPTED; 668 674 } 675 + 676 + len = xfs_cui_log_format_sizeof(cui_formatp->cui_nextents); 677 + if (item->ri_buf[0].i_len != len) { 678 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 679 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 680 + return -EFSCORRUPTED; 681 + } 682 + 683 + cuip = xfs_cui_init(mp, cui_formatp->cui_nextents); 684 + xfs_cui_copy_format(&cuip->cui_format, cui_formatp); 669 685 atomic_set(&cuip->cui_next_extent, cui_formatp->cui_nextents); 670 686 /* 671 687 * Insert the intent into the AIL directly and drop one reference so ··· 708 706 709 707 cud_formatp = item->ri_buf[0].i_addr; 710 708 if (item->ri_buf[0].i_len != sizeof(struct xfs_cud_log_format)) { 711 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); 709 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 710 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 712 711 return -EFSCORRUPTED; 713 712 } 714 713
+37 -33
fs/xfs/xfs_rmap_item.c
··· 155 155 return ruip; 156 156 } 157 157 158 - /* 159 - * Copy an RUI format buffer from the given buf, and into the destination 160 - * RUI format structure. The RUI/RUD items were designed not to need any 161 - * special alignment handling. 162 - */ 163 - STATIC int 164 - xfs_rui_copy_format( 165 - struct xfs_log_iovec *buf, 166 - struct xfs_rui_log_format *dst_rui_fmt) 167 - { 168 - struct xfs_rui_log_format *src_rui_fmt; 169 - uint len; 170 - 171 - src_rui_fmt = buf->i_addr; 172 - len = xfs_rui_log_format_sizeof(src_rui_fmt->rui_nextents); 173 - 174 - if (buf->i_len != len) { 175 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 176 - return -EFSCORRUPTED; 177 - } 178 - 179 - memcpy(dst_rui_fmt, src_rui_fmt, len); 180 - return 0; 181 - } 182 - 183 158 static inline struct xfs_rud_log_item *RUD_ITEM(struct xfs_log_item *lip) 184 159 { 185 160 return container_of(lip, struct xfs_rud_log_item, rud_item); ··· 557 582 type = XFS_RMAP_FREE; 558 583 break; 559 584 default: 560 - XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); 585 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 586 + &ruip->rui_format, 587 + sizeof(ruip->rui_format)); 561 588 error = -EFSCORRUPTED; 562 589 goto abort_error; 563 590 } ··· 629 652 .iop_relog = xfs_rui_item_relog, 630 653 }; 631 654 655 + static inline void 656 + xfs_rui_copy_format( 657 + struct xfs_rui_log_format *dst, 658 + const struct xfs_rui_log_format *src) 659 + { 660 + unsigned int i; 661 + 662 + memcpy(dst, src, offsetof(struct xfs_rui_log_format, rui_extents)); 663 + 664 + for (i = 0; i < src->rui_nextents; i++) 665 + memcpy(&dst->rui_extents[i], &src->rui_extents[i], 666 + sizeof(struct xfs_map_extent)); 667 + } 668 + 632 669 /* 633 670 * This routine is called to create an in-core extent rmap update 634 671 * item from the rui format structure which was logged on disk. ··· 657 666 struct xlog_recover_item *item, 658 667 xfs_lsn_t lsn) 659 668 { 660 - int error; 661 669 struct xfs_mount *mp = log->l_mp; 662 670 struct xfs_rui_log_item *ruip; 663 671 struct xfs_rui_log_format *rui_formatp; 672 + size_t len; 664 673 665 674 rui_formatp = item->ri_buf[0].i_addr; 666 675 667 - ruip = xfs_rui_init(mp, rui_formatp->rui_nextents); 668 - error = xfs_rui_copy_format(&item->ri_buf[0], &ruip->rui_format); 669 - if (error) { 670 - xfs_rui_item_free(ruip); 671 - return error; 676 + if (item->ri_buf[0].i_len < xfs_rui_log_format_sizeof(0)) { 677 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 678 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 679 + return -EFSCORRUPTED; 672 680 } 681 + 682 + len = xfs_rui_log_format_sizeof(rui_formatp->rui_nextents); 683 + if (item->ri_buf[0].i_len != len) { 684 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 685 + item->ri_buf[0].i_addr, item->ri_buf[0].i_len); 686 + return -EFSCORRUPTED; 687 + } 688 + 689 + ruip = xfs_rui_init(mp, rui_formatp->rui_nextents); 690 + xfs_rui_copy_format(&ruip->rui_format, rui_formatp); 673 691 atomic_set(&ruip->rui_next_extent, rui_formatp->rui_nextents); 674 692 /* 675 693 * Insert the intent into the AIL directly and drop one reference so ··· 711 711 struct xfs_rud_log_format *rud_formatp; 712 712 713 713 rud_formatp = item->ri_buf[0].i_addr; 714 - ASSERT(item->ri_buf[0].i_len == sizeof(struct xfs_rud_log_format)); 714 + if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) { 715 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp, 716 + rud_formatp, item->ri_buf[0].i_len); 717 + return -EFSCORRUPTED; 718 + } 715 719 716 720 xlog_recover_release_intent(log, XFS_LI_RUI, rud_formatp->rud_rui_id); 717 721 return 0;
+4 -8
fs/xfs/xfs_super.c
··· 2028 2028 goto out_destroy_trans_cache; 2029 2029 2030 2030 xfs_efd_cache = kmem_cache_create("xfs_efd_item", 2031 - (sizeof(struct xfs_efd_log_item) + 2032 - (XFS_EFD_MAX_FAST_EXTENTS - 1) * 2033 - sizeof(struct xfs_extent)), 2034 - 0, 0, NULL); 2031 + xfs_efd_log_item_sizeof(XFS_EFD_MAX_FAST_EXTENTS), 2032 + 0, 0, NULL); 2035 2033 if (!xfs_efd_cache) 2036 2034 goto out_destroy_buf_item_cache; 2037 2035 2038 2036 xfs_efi_cache = kmem_cache_create("xfs_efi_item", 2039 - (sizeof(struct xfs_efi_log_item) + 2040 - (XFS_EFI_MAX_FAST_EXTENTS - 1) * 2041 - sizeof(struct xfs_extent)), 2042 - 0, 0, NULL); 2037 + xfs_efi_log_item_sizeof(XFS_EFI_MAX_FAST_EXTENTS), 2038 + 0, 0, NULL); 2043 2039 if (!xfs_efi_cache) 2044 2040 goto out_destroy_efd_cache; 2045 2041
+6 -1
fs/xfs/xfs_sysfs.h
··· 33 33 const char *name) 34 34 { 35 35 struct kobject *parent; 36 + int err; 36 37 37 38 parent = parent_kobj ? &parent_kobj->kobject : NULL; 38 39 init_completion(&kobj->complete); 39 - return kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name); 40 + err = kobject_init_and_add(&kobj->kobject, ktype, parent, "%s", name); 41 + if (err) 42 + kobject_put(&kobj->kobject); 43 + 44 + return err; 40 45 } 41 46 42 47 static inline void
+39 -9
fs/xfs/xfs_trace.h
··· 799 799 TRACE_DEFINE_ENUM(PE_SIZE_PMD); 800 800 TRACE_DEFINE_ENUM(PE_SIZE_PUD); 801 801 802 + TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED); 803 + TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW); 804 + 802 805 TRACE_EVENT(xfs_filemap_fault, 803 806 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size, 804 807 bool write_fault), ··· 2928 2925 TP_STRUCT__entry( 2929 2926 __field(dev_t, dev) 2930 2927 __field(xfs_agnumber_t, agno) 2928 + __field(enum xfs_refc_domain, domain) 2931 2929 __field(xfs_agblock_t, startblock) 2932 2930 __field(xfs_extlen_t, blockcount) 2933 2931 __field(xfs_nlink_t, refcount) ··· 2936 2932 TP_fast_assign( 2937 2933 __entry->dev = mp->m_super->s_dev; 2938 2934 __entry->agno = agno; 2935 + __entry->domain = irec->rc_domain; 2939 2936 __entry->startblock = irec->rc_startblock; 2940 2937 __entry->blockcount = irec->rc_blockcount; 2941 2938 __entry->refcount = irec->rc_refcount; 2942 2939 ), 2943 - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u", 2940 + TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u", 2944 2941 MAJOR(__entry->dev), MINOR(__entry->dev), 2945 2942 __entry->agno, 2943 + __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS), 2946 2944 __entry->startblock, 2947 2945 __entry->blockcount, 2948 2946 __entry->refcount) ··· 2964 2958 TP_STRUCT__entry( 2965 2959 __field(dev_t, dev) 2966 2960 __field(xfs_agnumber_t, agno) 2961 + __field(enum xfs_refc_domain, domain) 2967 2962 __field(xfs_agblock_t, startblock) 2968 2963 __field(xfs_extlen_t, blockcount) 2969 2964 __field(xfs_nlink_t, refcount) ··· 2973 2966 TP_fast_assign( 2974 2967 __entry->dev = mp->m_super->s_dev; 2975 2968 __entry->agno = agno; 2969 + __entry->domain = irec->rc_domain; 2976 2970 __entry->startblock = irec->rc_startblock; 2977 2971 __entry->blockcount = irec->rc_blockcount; 2978 2972 __entry->refcount = irec->rc_refcount; 2979 2973 __entry->agbno = agbno; 2980 2974 ), 2981 - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", 2975 + TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", 2982 2976 MAJOR(__entry->dev), MINOR(__entry->dev), 2983 2977 __entry->agno, 2978 + __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS), 2984 2979 __entry->startblock, 2985 2980 __entry->blockcount, 2986 2981 __entry->refcount, ··· 3003 2994 TP_STRUCT__entry( 3004 2995 __field(dev_t, dev) 3005 2996 __field(xfs_agnumber_t, agno) 2997 + __field(enum xfs_refc_domain, i1_domain) 3006 2998 __field(xfs_agblock_t, i1_startblock) 3007 2999 __field(xfs_extlen_t, i1_blockcount) 3008 3000 __field(xfs_nlink_t, i1_refcount) 3001 + __field(enum xfs_refc_domain, i2_domain) 3009 3002 __field(xfs_agblock_t, i2_startblock) 3010 3003 __field(xfs_extlen_t, i2_blockcount) 3011 3004 __field(xfs_nlink_t, i2_refcount) ··· 3015 3004 TP_fast_assign( 3016 3005 __entry->dev = mp->m_super->s_dev; 3017 3006 __entry->agno = agno; 3007 + __entry->i1_domain = i1->rc_domain; 3018 3008 __entry->i1_startblock = i1->rc_startblock; 3019 3009 __entry->i1_blockcount = i1->rc_blockcount; 3020 3010 __entry->i1_refcount = i1->rc_refcount; 3011 + __entry->i2_domain = i2->rc_domain; 3021 3012 __entry->i2_startblock = i2->rc_startblock; 3022 3013 __entry->i2_blockcount = i2->rc_blockcount; 3023 3014 __entry->i2_refcount = i2->rc_refcount; 3024 3015 ), 3025 - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " 3026 - "agbno 0x%x fsbcount 0x%x refcount %u", 3016 + TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- " 3017 + "dom %s agbno 0x%x fsbcount 0x%x refcount %u", 3027 3018 MAJOR(__entry->dev), MINOR(__entry->dev), 3028 3019 __entry->agno, 3020 + __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS), 3029 3021 __entry->i1_startblock, 3030 3022 __entry->i1_blockcount, 3031 3023 __entry->i1_refcount, 3024 + __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS), 3032 3025 __entry->i2_startblock, 3033 3026 __entry->i2_blockcount, 3034 3027 __entry->i2_refcount) ··· 3053 3038 TP_STRUCT__entry( 3054 3039 __field(dev_t, dev) 3055 3040 __field(xfs_agnumber_t, agno) 3041 + __field(enum xfs_refc_domain, i1_domain) 3056 3042 __field(xfs_agblock_t, i1_startblock) 3057 3043 __field(xfs_extlen_t, i1_blockcount) 3058 3044 __field(xfs_nlink_t, i1_refcount) 3045 + __field(enum xfs_refc_domain, i2_domain) 3059 3046 __field(xfs_agblock_t, i2_startblock) 3060 3047 __field(xfs_extlen_t, i2_blockcount) 3061 3048 __field(xfs_nlink_t, i2_refcount) ··· 3066 3049 TP_fast_assign( 3067 3050 __entry->dev = mp->m_super->s_dev; 3068 3051 __entry->agno = agno; 3052 + __entry->i1_domain = i1->rc_domain; 3069 3053 __entry->i1_startblock = i1->rc_startblock; 3070 3054 __entry->i1_blockcount = i1->rc_blockcount; 3071 3055 __entry->i1_refcount = i1->rc_refcount; 3056 + __entry->i2_domain = i2->rc_domain; 3072 3057 __entry->i2_startblock = i2->rc_startblock; 3073 3058 __entry->i2_blockcount = i2->rc_blockcount; 3074 3059 __entry->i2_refcount = i2->rc_refcount; 3075 3060 __entry->agbno = agbno; 3076 3061 ), 3077 - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " 3078 - "agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", 3062 + TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- " 3063 + "dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", 3079 3064 MAJOR(__entry->dev), MINOR(__entry->dev), 3080 3065 __entry->agno, 3066 + __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS), 3081 3067 __entry->i1_startblock, 3082 3068 __entry->i1_blockcount, 3083 3069 __entry->i1_refcount, 3070 + __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS), 3084 3071 __entry->i2_startblock, 3085 3072 __entry->i2_blockcount, 3086 3073 __entry->i2_refcount, ··· 3107 3086 TP_STRUCT__entry( 3108 3087 __field(dev_t, dev) 3109 3088 __field(xfs_agnumber_t, agno) 3089 + __field(enum xfs_refc_domain, i1_domain) 3110 3090 __field(xfs_agblock_t, i1_startblock) 3111 3091 __field(xfs_extlen_t, i1_blockcount) 3112 3092 __field(xfs_nlink_t, i1_refcount) 3093 + __field(enum xfs_refc_domain, i2_domain) 3113 3094 __field(xfs_agblock_t, i2_startblock) 3114 3095 __field(xfs_extlen_t, i2_blockcount) 3115 3096 __field(xfs_nlink_t, i2_refcount) 3097 + __field(enum xfs_refc_domain, i3_domain) 3116 3098 __field(xfs_agblock_t, i3_startblock) 3117 3099 __field(xfs_extlen_t, i3_blockcount) 3118 3100 __field(xfs_nlink_t, i3_refcount) ··· 3123 3099 TP_fast_assign( 3124 3100 __entry->dev = mp->m_super->s_dev; 3125 3101 __entry->agno = agno; 3102 + __entry->i1_domain = i1->rc_domain; 3126 3103 __entry->i1_startblock = i1->rc_startblock; 3127 3104 __entry->i1_blockcount = i1->rc_blockcount; 3128 3105 __entry->i1_refcount = i1->rc_refcount; 3106 + __entry->i2_domain = i2->rc_domain; 3129 3107 __entry->i2_startblock = i2->rc_startblock; 3130 3108 __entry->i2_blockcount = i2->rc_blockcount; 3131 3109 __entry->i2_refcount = i2->rc_refcount; 3110 + __entry->i3_domain = i3->rc_domain; 3132 3111 __entry->i3_startblock = i3->rc_startblock; 3133 3112 __entry->i3_blockcount = i3->rc_blockcount; 3134 3113 __entry->i3_refcount = i3->rc_refcount; 3135 3114 ), 3136 - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " 3137 - "agbno 0x%x fsbcount 0x%x refcount %u -- " 3138 - "agbno 0x%x fsbcount 0x%x refcount %u", 3115 + TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- " 3116 + "dom %s agbno 0x%x fsbcount 0x%x refcount %u -- " 3117 + "dom %s agbno 0x%x fsbcount 0x%x refcount %u", 3139 3118 MAJOR(__entry->dev), MINOR(__entry->dev), 3140 3119 __entry->agno, 3120 + __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS), 3141 3121 __entry->i1_startblock, 3142 3122 __entry->i1_blockcount, 3143 3123 __entry->i1_refcount, 3124 + __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS), 3144 3125 __entry->i2_startblock, 3145 3126 __entry->i2_blockcount, 3146 3127 __entry->i2_refcount, 3128 + __print_symbolic(__entry->i3_domain, XFS_REFC_DOMAIN_STRINGS), 3147 3129 __entry->i3_startblock, 3148 3130 __entry->i3_blockcount, 3149 3131 __entry->i3_refcount)
+1 -2
fs/xfs/xfs_trans_ail.c
··· 730 730 xfs_ail_push_all_sync( 731 731 struct xfs_ail *ailp) 732 732 { 733 - struct xfs_log_item *lip; 734 733 DEFINE_WAIT(wait); 735 734 736 735 spin_lock(&ailp->ail_lock); 737 - while ((lip = xfs_ail_max(ailp)) != NULL) { 736 + while (xfs_ail_max(ailp) != NULL) { 738 737 prepare_to_wait(&ailp->ail_empty, &wait, TASK_UNINTERRUPTIBLE); 739 738 wake_up_process(ailp->ail_task); 740 739 spin_unlock(&ailp->ail_lock);
+16
include/linux/can/dev.h
··· 152 152 return (mtu >= CANXL_MIN_MTU && mtu <= CANXL_MAX_MTU); 153 153 } 154 154 155 + /* drop skb if it does not contain a valid CAN frame for sending */ 156 + static inline bool can_dev_dropped_skb(struct net_device *dev, struct sk_buff *skb) 157 + { 158 + struct can_priv *priv = netdev_priv(dev); 159 + 160 + if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) { 161 + netdev_info_once(dev, 162 + "interface in listen only mode, dropping skb\n"); 163 + kfree_skb(skb); 164 + dev->stats.tx_dropped++; 165 + return true; 166 + } 167 + 168 + return can_dropped_invalid_skb(dev, skb); 169 + } 170 + 155 171 void can_setup(struct net_device *dev); 156 172 157 173 struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
+1 -1
include/linux/efi.h
··· 1222 1222 arch_efi_call_virt_teardown(); \ 1223 1223 }) 1224 1224 1225 - #define EFI_RANDOM_SEED_SIZE 64U 1225 + #define EFI_RANDOM_SEED_SIZE 32U // BLAKE2S_HASH_SIZE 1226 1226 1227 1227 struct linux_efi_random_seed { 1228 1228 u32 size;
+9 -4
include/linux/fortify-string.h
··· 454 454 455 455 #define __fortify_memcpy_chk(p, q, size, p_size, q_size, \ 456 456 p_size_field, q_size_field, op) ({ \ 457 - size_t __fortify_size = (size_t)(size); \ 458 - WARN_ONCE(fortify_memcpy_chk(__fortify_size, p_size, q_size, \ 459 - p_size_field, q_size_field, #op), \ 457 + const size_t __fortify_size = (size_t)(size); \ 458 + const size_t __p_size = (p_size); \ 459 + const size_t __q_size = (q_size); \ 460 + const size_t __p_size_field = (p_size_field); \ 461 + const size_t __q_size_field = (q_size_field); \ 462 + WARN_ONCE(fortify_memcpy_chk(__fortify_size, __p_size, \ 463 + __q_size, __p_size_field, \ 464 + __q_size_field, #op), \ 460 465 #op ": detected field-spanning write (size %zu) of single %s (size %zu)\n", \ 461 466 __fortify_size, \ 462 467 "field \"" #p "\" at " __FILE__ ":" __stringify(__LINE__), \ 463 - p_size_field); \ 468 + __p_size_field); \ 464 469 __underlying_##op(p, q, __fortify_size); \ 465 470 }) 466 471
+1 -1
include/linux/skmsg.h
··· 376 376 } 377 377 378 378 struct sk_psock *sk_psock_init(struct sock *sk, int node); 379 - void sk_psock_stop(struct sk_psock *psock, bool wait); 379 + void sk_psock_stop(struct sk_psock *psock); 380 380 381 381 #if IS_ENABLED(CONFIG_BPF_STREAM_PARSER) 382 382 int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);
-23
include/linux/slab.h
··· 470 470 void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node) __assume_slab_alignment 471 471 __malloc; 472 472 473 - #ifdef CONFIG_TRACING 474 473 void *kmalloc_trace(struct kmem_cache *s, gfp_t flags, size_t size) 475 474 __assume_kmalloc_alignment __alloc_size(3); 476 475 477 476 void *kmalloc_node_trace(struct kmem_cache *s, gfp_t gfpflags, 478 477 int node, size_t size) __assume_kmalloc_alignment 479 478 __alloc_size(4); 480 - #else /* CONFIG_TRACING */ 481 - /* Save a function call when CONFIG_TRACING=n */ 482 - static __always_inline __alloc_size(3) 483 - void *kmalloc_trace(struct kmem_cache *s, gfp_t flags, size_t size) 484 - { 485 - void *ret = kmem_cache_alloc(s, flags); 486 - 487 - ret = kasan_kmalloc(s, ret, size, flags); 488 - return ret; 489 - } 490 - 491 - static __always_inline __alloc_size(4) 492 - void *kmalloc_node_trace(struct kmem_cache *s, gfp_t gfpflags, 493 - int node, size_t size) 494 - { 495 - void *ret = kmem_cache_alloc_node(s, gfpflags, node); 496 - 497 - ret = kasan_kmalloc(s, ret, size, gfpflags); 498 - return ret; 499 - } 500 - #endif /* CONFIG_TRACING */ 501 - 502 479 void *kmalloc_large(size_t size, gfp_t flags) __assume_page_alignment 503 480 __alloc_size(1); 504 481
+1 -1
include/uapi/linux/audit.h
··· 187 187 #define AUDIT_MAX_KEY_LEN 256 188 188 #define AUDIT_BITMASK_SIZE 64 189 189 #define AUDIT_WORD(nr) ((__u32)((nr)/32)) 190 - #define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 190 + #define AUDIT_BIT(nr) (1U << ((nr) - AUDIT_WORD(nr)*32)) 191 191 192 192 #define AUDIT_SYSCALL_CLASSES 16 193 193 #define AUDIT_CLASS_DIR_WRITE 0
+1 -1
include/uapi/linux/capability.h
··· 426 426 */ 427 427 428 428 #define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ 429 - #define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */ 429 + #define CAP_TO_MASK(x) (1U << ((x) & 31)) /* mask for indexed __u32 */ 430 430 431 431 432 432 #endif /* _UAPI_LINUX_CAPABILITY_H */
+1
include/uapi/linux/in.h
··· 20 20 #define _UAPI_LINUX_IN_H 21 21 22 22 #include <linux/types.h> 23 + #include <linux/stddef.h> 23 24 #include <linux/libc-compat.h> 24 25 #include <linux/socket.h> 25 26
+13 -4
kernel/bpf/verifier.c
··· 1027 1027 */ 1028 1028 static void *realloc_array(void *arr, size_t old_n, size_t new_n, size_t size) 1029 1029 { 1030 + void *new_arr; 1031 + 1030 1032 if (!new_n || old_n == new_n) 1031 1033 goto out; 1032 1034 1033 - arr = krealloc_array(arr, new_n, size, GFP_KERNEL); 1034 - if (!arr) 1035 + new_arr = krealloc_array(arr, new_n, size, GFP_KERNEL); 1036 + if (!new_arr) { 1037 + kfree(arr); 1035 1038 return NULL; 1039 + } 1040 + arr = new_arr; 1036 1041 1037 1042 if (new_n > old_n) 1038 1043 memset(arr + old_n * size, 0, (new_n - old_n) * size); ··· 6623 6618 return err; 6624 6619 6625 6620 bpf_for_each_reg_in_vstate(env->cur_state, state, reg, ({ 6626 - if (reg->ref_obj_id == ref_obj_id) 6627 - __mark_reg_unknown(env, reg); 6621 + if (reg->ref_obj_id == ref_obj_id) { 6622 + if (!env->allow_ptr_leaks) 6623 + __mark_reg_not_init(env, reg); 6624 + else 6625 + __mark_reg_unknown(env, reg); 6626 + } 6628 6627 })); 6629 6628 6630 6629 return 0;
+2 -2
kernel/events/hw_breakpoint_test.c
··· 295 295 { 296 296 /* Most test cases want 2 distinct CPUs. */ 297 297 if (num_online_cpus() < 2) 298 - return -EINVAL; 298 + kunit_skip(test, "not enough cpus"); 299 299 300 300 /* Want the system to not use breakpoints elsewhere. */ 301 301 if (hw_breakpoint_is_used()) 302 - return -EBUSY; 302 + kunit_skip(test, "hw breakpoint already in use"); 303 303 304 304 return 0; 305 305 }
+4 -1
kernel/kprobes.c
··· 2429 2429 if (!kprobes_all_disarmed && kprobe_disabled(p)) { 2430 2430 p->flags &= ~KPROBE_FLAG_DISABLED; 2431 2431 ret = arm_kprobe(p); 2432 - if (ret) 2432 + if (ret) { 2433 2433 p->flags |= KPROBE_FLAG_DISABLED; 2434 + if (p != kp) 2435 + kp->flags |= KPROBE_FLAG_DISABLED; 2436 + } 2434 2437 } 2435 2438 out: 2436 2439 mutex_unlock(&kprobe_mutex);
+4 -1
kernel/trace/fprobe.c
··· 141 141 return -E2BIG; 142 142 143 143 fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler); 144 + if (!fp->rethook) 145 + return -ENOMEM; 144 146 for (i = 0; i < size; i++) { 145 147 struct fprobe_rethook_node *node; 146 148 ··· 303 301 { 304 302 int ret; 305 303 306 - if (!fp || fp->ops.func != fprobe_handler) 304 + if (!fp || (fp->ops.saved_func != fprobe_handler && 305 + fp->ops.saved_func != fprobe_kprobe_handler)) 307 306 return -EINVAL; 308 307 309 308 /*
+3 -13
kernel/trace/ftrace.c
··· 3028 3028 command |= FTRACE_UPDATE_TRACE_FUNC; 3029 3029 } 3030 3030 3031 - if (!command || !ftrace_enabled) { 3032 - /* 3033 - * If these are dynamic or per_cpu ops, they still 3034 - * need their data freed. Since, function tracing is 3035 - * not currently active, we can just free them 3036 - * without synchronizing all CPUs. 3037 - */ 3038 - if (ops->flags & FTRACE_OPS_FL_DYNAMIC) 3039 - goto free_ops; 3040 - 3041 - return 0; 3042 - } 3031 + if (!command || !ftrace_enabled) 3032 + goto out; 3043 3033 3044 3034 /* 3045 3035 * If the ops uses a trampoline, then it needs to be ··· 3066 3076 removed_ops = NULL; 3067 3077 ops->flags &= ~FTRACE_OPS_FL_REMOVING; 3068 3078 3079 + out: 3069 3080 /* 3070 3081 * Dynamic ops may be freed, we must make sure that all 3071 3082 * callers are done before leaving this function. ··· 3094 3103 if (IS_ENABLED(CONFIG_PREEMPTION)) 3095 3104 synchronize_rcu_tasks(); 3096 3105 3097 - free_ops: 3098 3106 ftrace_trampoline_free(ops); 3099 3107 } 3100 3108
+7 -11
kernel/trace/kprobe_event_gen_test.c
··· 100 100 KPROBE_GEN_TEST_FUNC, 101 101 KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); 102 102 if (ret) 103 - goto free; 103 + goto out; 104 104 105 105 /* Use kprobe_event_add_fields to add the rest of the fields */ 106 106 107 107 ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); 108 108 if (ret) 109 - goto free; 109 + goto out; 110 110 111 111 /* 112 112 * This actually creates the event. 113 113 */ 114 114 ret = kprobe_event_gen_cmd_end(&cmd); 115 115 if (ret) 116 - goto free; 116 + goto out; 117 117 118 118 /* 119 119 * Now get the gen_kprobe_test event file. We need to prevent ··· 136 136 goto delete; 137 137 } 138 138 out: 139 + kfree(buf); 139 140 return ret; 140 141 delete: 141 142 /* We got an error after creating the event, delete it */ 142 143 ret = kprobe_event_delete("gen_kprobe_test"); 143 - free: 144 - kfree(buf); 145 - 146 144 goto out; 147 145 } 148 146 ··· 168 170 KPROBE_GEN_TEST_FUNC, 169 171 "$retval"); 170 172 if (ret) 171 - goto free; 173 + goto out; 172 174 173 175 /* 174 176 * This actually creates the event. 175 177 */ 176 178 ret = kretprobe_event_gen_cmd_end(&cmd); 177 179 if (ret) 178 - goto free; 180 + goto out; 179 181 180 182 /* 181 183 * Now get the gen_kretprobe_test event file. We need to ··· 199 201 goto delete; 200 202 } 201 203 out: 204 + kfree(buf); 202 205 return ret; 203 206 delete: 204 207 /* We got an error after creating the event, delete it */ 205 208 ret = kprobe_event_delete("gen_kretprobe_test"); 206 - free: 207 - kfree(buf); 208 - 209 209 goto out; 210 210 } 211 211
+11
kernel/trace/ring_buffer.c
··· 937 937 struct ring_buffer_per_cpu *cpu_buffer; 938 938 struct rb_irq_work *rbwork; 939 939 940 + if (!buffer) 941 + return; 942 + 940 943 if (cpu == RING_BUFFER_ALL_CPUS) { 941 944 942 945 /* Wake up individual ones too. One level recursion */ ··· 948 945 949 946 rbwork = &buffer->irq_work; 950 947 } else { 948 + if (WARN_ON_ONCE(!buffer->buffers)) 949 + return; 950 + if (WARN_ON_ONCE(cpu >= nr_cpu_ids)) 951 + return; 952 + 951 953 cpu_buffer = buffer->buffers[cpu]; 954 + /* The CPU buffer may not have been initialized yet */ 955 + if (!cpu_buffer) 956 + return; 952 957 rbwork = &cpu_buffer->irq_work; 953 958 } 954 959
+4 -20
mm/slab_common.c
··· 941 941 942 942 if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) { 943 943 ret = __kmalloc_large_node(size, flags, node); 944 - trace_kmalloc(_RET_IP_, ret, size, 944 + trace_kmalloc(caller, ret, size, 945 945 PAGE_SIZE << get_order(size), flags, node); 946 946 return ret; 947 947 } ··· 953 953 954 954 ret = __kmem_cache_alloc_node(s, flags, node, size, caller); 955 955 ret = kasan_kmalloc(s, ret, size, flags); 956 - trace_kmalloc(_RET_IP_, ret, size, s->size, flags, node); 956 + trace_kmalloc(caller, ret, size, s->size, flags, node); 957 957 return ret; 958 958 } 959 959 ··· 1010 1010 1011 1011 /** 1012 1012 * __ksize -- Report full size of underlying allocation 1013 - * @objp: pointer to the object 1013 + * @object: pointer to the object 1014 1014 * 1015 1015 * This should only be used internally to query the true size of allocations. 1016 1016 * It is not meant to be a way to discover the usable size of an allocation ··· 1018 1018 * the originally requested allocation size may trigger KASAN, UBSAN_BOUNDS, 1019 1019 * and/or FORTIFY_SOURCE. 1020 1020 * 1021 - * Return: size of the actual memory used by @objp in bytes 1021 + * Return: size of the actual memory used by @object in bytes 1022 1022 */ 1023 1023 size_t __ksize(const void *object) 1024 1024 { ··· 1040 1040 return slab_ksize(folio_slab(folio)->slab_cache); 1041 1041 } 1042 1042 1043 - #ifdef CONFIG_TRACING 1044 1043 void *kmalloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size) 1045 1044 { 1046 1045 void *ret = __kmem_cache_alloc_node(s, gfpflags, NUMA_NO_NODE, ··· 1063 1064 return ret; 1064 1065 } 1065 1066 EXPORT_SYMBOL(kmalloc_node_trace); 1066 - #endif /* !CONFIG_TRACING */ 1067 1067 #endif /* !CONFIG_SLOB */ 1068 1068 1069 1069 gfp_t kmalloc_fix_flags(gfp_t flags) ··· 1409 1411 } 1410 1412 EXPORT_SYMBOL(kfree_sensitive); 1411 1413 1412 - /** 1413 - * ksize - get the actual amount of memory allocated for a given object 1414 - * @objp: Pointer to the object 1415 - * 1416 - * kmalloc may internally round up allocations and return more memory 1417 - * than requested. ksize() can be used to determine the actual amount of 1418 - * memory allocated. The caller may use this additional memory, even though 1419 - * a smaller amount of memory was initially specified with the kmalloc call. 1420 - * The caller must guarantee that objp points to a valid object previously 1421 - * allocated with either kmalloc() or kmem_cache_alloc(). The object 1422 - * must not be freed during the duration of the call. 1423 - * 1424 - * Return: size of the actual memory used by @objp in bytes 1425 - */ 1426 1414 size_t ksize(const void *objp) 1427 1415 { 1428 1416 size_t size;
+2 -1
net/can/af_can.c
··· 450 450 451 451 /* insert new receiver (dev,canid,mask) -> (func,data) */ 452 452 453 - if (dev && dev->type != ARPHRD_CAN) 453 + if (dev && (dev->type != ARPHRD_CAN || !can_get_ml_priv(dev))) 454 454 return -ENODEV; 455 455 456 456 if (dev && !net_eq(net, dev_net(dev))) ··· 902 902 static __exit void can_exit(void) 903 903 { 904 904 /* protocol unregister */ 905 + dev_remove_pack(&canxl_packet); 905 906 dev_remove_pack(&canfd_packet); 906 907 dev_remove_pack(&can_packet); 907 908 sock_unregister(PF_CAN);
+38 -33
net/can/isotp.c
··· 111 111 #define ISOTP_FC_WT 1 /* wait */ 112 112 #define ISOTP_FC_OVFLW 2 /* overflow */ 113 113 114 + #define ISOTP_FC_TIMEOUT 1 /* 1 sec */ 115 + #define ISOTP_ECHO_TIMEOUT 2 /* 2 secs */ 116 + 114 117 enum { 115 118 ISOTP_IDLE = 0, 116 119 ISOTP_WAIT_FIRST_FC, ··· 261 258 so->lastrxcf_tstamp = ktime_set(0, 0); 262 259 263 260 /* start rx timeout watchdog */ 264 - hrtimer_start(&so->rxtimer, ktime_set(1, 0), HRTIMER_MODE_REL_SOFT); 261 + hrtimer_start(&so->rxtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), 262 + HRTIMER_MODE_REL_SOFT); 265 263 return 0; 266 264 } 267 265 ··· 348 344 return 0; 349 345 } 350 346 347 + static void isotp_send_cframe(struct isotp_sock *so); 348 + 351 349 static int isotp_rcv_fc(struct isotp_sock *so, struct canfd_frame *cf, int ae) 352 350 { 353 351 struct sock *sk = &so->sk; ··· 404 398 case ISOTP_FC_CTS: 405 399 so->tx.bs = 0; 406 400 so->tx.state = ISOTP_SENDING; 407 - /* start cyclic timer for sending CF frame */ 408 - hrtimer_start(&so->txtimer, so->tx_gap, 401 + /* send CF frame and enable echo timeout handling */ 402 + hrtimer_start(&so->txtimer, ktime_set(ISOTP_ECHO_TIMEOUT, 0), 409 403 HRTIMER_MODE_REL_SOFT); 404 + isotp_send_cframe(so); 410 405 break; 411 406 412 407 case ISOTP_FC_WT: 413 408 /* start timer to wait for next FC frame */ 414 - hrtimer_start(&so->txtimer, ktime_set(1, 0), 409 + hrtimer_start(&so->txtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), 415 410 HRTIMER_MODE_REL_SOFT); 416 411 break; 417 412 ··· 607 600 /* perform blocksize handling, if enabled */ 608 601 if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) { 609 602 /* start rx timeout watchdog */ 610 - hrtimer_start(&so->rxtimer, ktime_set(1, 0), 603 + hrtimer_start(&so->rxtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), 611 604 HRTIMER_MODE_REL_SOFT); 612 605 return 0; 613 606 } ··· 836 829 struct isotp_sock *so = isotp_sk(sk); 837 830 struct canfd_frame *cf = (struct canfd_frame *)skb->data; 838 831 839 - /* only handle my own local echo skb's */ 832 + /* only handle my own local echo CF/SF skb's (no FF!) */ 840 833 if (skb->sk != sk || so->cfecho != *(u32 *)cf->data) 841 834 return; 842 835 ··· 856 849 if (so->txfc.bs && so->tx.bs >= so->txfc.bs) { 857 850 /* stop and wait for FC with timeout */ 858 851 so->tx.state = ISOTP_WAIT_FC; 859 - hrtimer_start(&so->txtimer, ktime_set(1, 0), 852 + hrtimer_start(&so->txtimer, ktime_set(ISOTP_FC_TIMEOUT, 0), 860 853 HRTIMER_MODE_REL_SOFT); 861 854 return; 862 855 } 863 856 864 857 /* no gap between data frames needed => use burst mode */ 865 858 if (!so->tx_gap) { 859 + /* enable echo timeout handling */ 860 + hrtimer_start(&so->txtimer, ktime_set(ISOTP_ECHO_TIMEOUT, 0), 861 + HRTIMER_MODE_REL_SOFT); 866 862 isotp_send_cframe(so); 867 863 return; 868 864 } ··· 889 879 /* start timeout for unlikely lost echo skb */ 890 880 hrtimer_set_expires(&so->txtimer, 891 881 ktime_add(ktime_get(), 892 - ktime_set(2, 0))); 882 + ktime_set(ISOTP_ECHO_TIMEOUT, 0))); 893 883 restart = HRTIMER_RESTART; 894 884 895 885 /* push out the next consecutive frame */ ··· 917 907 break; 918 908 919 909 default: 920 - WARN_ON_ONCE(1); 910 + WARN_ONCE(1, "can-isotp: tx timer state %08X cfecho %08X\n", 911 + so->tx.state, so->cfecho); 921 912 } 922 913 923 914 return restart; ··· 934 923 struct canfd_frame *cf; 935 924 int ae = (so->opt.flags & CAN_ISOTP_EXTEND_ADDR) ? 1 : 0; 936 925 int wait_tx_done = (so->opt.flags & CAN_ISOTP_WAIT_TX_DONE) ? 1 : 0; 937 - s64 hrtimer_sec = 0; 926 + s64 hrtimer_sec = ISOTP_ECHO_TIMEOUT; 938 927 int off; 939 928 int err; 940 929 ··· 953 942 err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); 954 943 if (err) 955 944 goto err_out; 945 + 946 + so->tx.state = ISOTP_SENDING; 956 947 } 957 948 958 949 if (!size || size > MAX_MSG_LENGTH) { ··· 999 986 cf = (struct canfd_frame *)skb->data; 1000 987 skb_put_zero(skb, so->ll.mtu); 1001 988 989 + /* cfecho should have been zero'ed by init / former isotp_rcv_echo() */ 990 + if (so->cfecho) 991 + pr_notice_once("can-isotp: uninit cfecho %08X\n", so->cfecho); 992 + 1002 993 /* check for single frame transmission depending on TX_DL */ 1003 994 if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) { 1004 995 /* The message size generally fits into a SingleFrame - good. ··· 1028 1011 else 1029 1012 cf->data[ae] |= size; 1030 1013 1031 - so->tx.state = ISOTP_IDLE; 1032 - wake_up_interruptible(&so->wait); 1033 - 1034 - /* don't enable wait queue for a single frame transmission */ 1035 - wait_tx_done = 0; 1014 + /* set CF echo tag for isotp_rcv_echo() (SF-mode) */ 1015 + so->cfecho = *(u32 *)cf->data; 1036 1016 } else { 1037 1017 /* send first frame */ 1038 1018 ··· 1045 1031 /* disable wait for FCs due to activated block size */ 1046 1032 so->txfc.bs = 0; 1047 1033 1048 - /* cfecho should have been zero'ed by init */ 1049 - if (so->cfecho) 1050 - pr_notice_once("can-isotp: no fc cfecho %08X\n", 1051 - so->cfecho); 1052 - 1053 - /* set consecutive frame echo tag */ 1034 + /* set CF echo tag for isotp_rcv_echo() (CF-mode) */ 1054 1035 so->cfecho = *(u32 *)cf->data; 1055 - 1056 - /* switch directly to ISOTP_SENDING state */ 1057 - so->tx.state = ISOTP_SENDING; 1058 - 1059 - /* start timeout for unlikely lost echo skb */ 1060 - hrtimer_sec = 2; 1061 1036 } else { 1062 1037 /* standard flow control check */ 1063 1038 so->tx.state = ISOTP_WAIT_FIRST_FC; 1064 1039 1065 1040 /* start timeout for FC */ 1066 - hrtimer_sec = 1; 1067 - } 1041 + hrtimer_sec = ISOTP_FC_TIMEOUT; 1068 1042 1069 - hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0), 1070 - HRTIMER_MODE_REL_SOFT); 1043 + /* no CF echo tag for isotp_rcv_echo() (FF-mode) */ 1044 + so->cfecho = 0; 1045 + } 1071 1046 } 1047 + 1048 + hrtimer_start(&so->txtimer, ktime_set(hrtimer_sec, 0), 1049 + HRTIMER_MODE_REL_SOFT); 1072 1050 1073 1051 /* send the first or only CAN frame */ 1074 1052 cf->flags = so->ll.tx_flags; ··· 1074 1068 __func__, ERR_PTR(err)); 1075 1069 1076 1070 /* no transmission -> no timeout monitoring */ 1077 - if (hrtimer_sec) 1078 - hrtimer_cancel(&so->txtimer); 1071 + hrtimer_cancel(&so->txtimer); 1079 1072 1080 1073 /* reset consecutive frame echo tag */ 1081 1074 so->cfecho = 0;
+3
net/can/j1939/main.c
··· 336 336 /* re-claim the CAN_HDR from the SKB */ 337 337 cf = skb_push(skb, J1939_CAN_HDR); 338 338 339 + /* initialize header structure */ 340 + memset(cf, 0, J1939_CAN_HDR); 341 + 339 342 /* make it a full can frame again */ 340 343 skb_put(skb, J1939_CAN_FTR + (8 - dlc)); 341 344
+19 -17
net/core/skbuff.c
··· 4147 4147 int i = 0; 4148 4148 int pos; 4149 4149 4150 - if (list_skb && !list_skb->head_frag && skb_headlen(list_skb) && 4151 - (skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY)) { 4152 - /* gso_size is untrusted, and we have a frag_list with a linear 4153 - * non head_frag head. 4154 - * 4155 - * (we assume checking the first list_skb member suffices; 4156 - * i.e if either of the list_skb members have non head_frag 4157 - * head, then the first one has too). 4158 - * 4159 - * If head_skb's headlen does not fit requested gso_size, it 4160 - * means that the frag_list members do NOT terminate on exact 4161 - * gso_size boundaries. Hence we cannot perform skb_frag_t page 4162 - * sharing. Therefore we must fallback to copying the frag_list 4163 - * skbs; we do so by disabling SG. 4164 - */ 4165 - if (mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb)) 4166 - features &= ~NETIF_F_SG; 4150 + if ((skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY) && 4151 + mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb)) { 4152 + struct sk_buff *check_skb; 4153 + 4154 + for (check_skb = list_skb; check_skb; check_skb = check_skb->next) { 4155 + if (skb_headlen(check_skb) && !check_skb->head_frag) { 4156 + /* gso_size is untrusted, and we have a frag_list with 4157 + * a linear non head_frag item. 4158 + * 4159 + * If head_skb's headlen does not fit requested gso_size, 4160 + * it means that the frag_list members do NOT terminate 4161 + * on exact gso_size boundaries. Hence we cannot perform 4162 + * skb_frag_t page sharing. Therefore we must fallback to 4163 + * copying the frag_list skbs; we do so by disabling SG. 4164 + */ 4165 + features &= ~NETIF_F_SG; 4166 + break; 4167 + } 4168 + } 4167 4169 } 4168 4170 4169 4171 __skb_push(head_skb, doffset);
+2 -5
net/core/skmsg.c
··· 803 803 } 804 804 } 805 805 806 - void sk_psock_stop(struct sk_psock *psock, bool wait) 806 + void sk_psock_stop(struct sk_psock *psock) 807 807 { 808 808 spin_lock_bh(&psock->ingress_lock); 809 809 sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED); 810 810 sk_psock_cork_free(psock); 811 811 __sk_psock_zap_ingress(psock); 812 812 spin_unlock_bh(&psock->ingress_lock); 813 - 814 - if (wait) 815 - cancel_work_sync(&psock->work); 816 813 } 817 814 818 815 static void sk_psock_done_strp(struct sk_psock *psock); ··· 847 850 sk_psock_stop_verdict(sk, psock); 848 851 write_unlock_bh(&sk->sk_callback_lock); 849 852 850 - sk_psock_stop(psock, false); 853 + sk_psock_stop(psock); 851 854 852 855 INIT_RCU_WORK(&psock->rwork, sk_psock_destroy); 853 856 queue_rcu_work(system_wq, &psock->rwork);
+4 -3
net/core/sock_map.c
··· 1596 1596 saved_destroy = psock->saved_destroy; 1597 1597 sock_map_remove_links(sk, psock); 1598 1598 rcu_read_unlock(); 1599 - sk_psock_stop(psock, false); 1599 + sk_psock_stop(psock); 1600 1600 sk_psock_put(sk, psock); 1601 1601 saved_destroy(sk); 1602 1602 } ··· 1619 1619 saved_close = psock->saved_close; 1620 1620 sock_map_remove_links(sk, psock); 1621 1621 rcu_read_unlock(); 1622 - sk_psock_stop(psock, true); 1623 - sk_psock_put(sk, psock); 1622 + sk_psock_stop(psock); 1624 1623 release_sock(sk); 1624 + cancel_work_sync(&psock->work); 1625 + sk_psock_put(sk, psock); 1625 1626 saved_close(sk, timeout); 1626 1627 } 1627 1628 EXPORT_SYMBOL_GPL(sock_map_close);
+1 -1
net/ipv4/tcp.c
··· 3648 3648 case TCP_REPAIR_OPTIONS: 3649 3649 if (!tp->repair) 3650 3650 err = -EINVAL; 3651 - else if (sk->sk_state == TCP_ESTABLISHED) 3651 + else if (sk->sk_state == TCP_ESTABLISHED && !tp->bytes_sent) 3652 3652 err = tcp_repair_options_est(sk, optval, optlen); 3653 3653 else 3654 3654 err = -EPERM;
+5 -3
net/ipv4/tcp_bpf.c
··· 278 278 { 279 279 bool cork = false, enospc = sk_msg_full(msg); 280 280 struct sock *sk_redir; 281 - u32 tosend, delta = 0; 281 + u32 tosend, origsize, sent, delta = 0; 282 282 u32 eval = __SK_NONE; 283 283 int ret; 284 284 ··· 333 333 cork = true; 334 334 psock->cork = NULL; 335 335 } 336 - sk_msg_return(sk, msg, msg->sg.size); 336 + sk_msg_return(sk, msg, tosend); 337 337 release_sock(sk); 338 338 339 + origsize = msg->sg.size; 339 340 ret = tcp_bpf_sendmsg_redir(sk_redir, msg, tosend, flags); 341 + sent = origsize - msg->sg.size; 340 342 341 343 if (eval == __SK_REDIRECT) 342 344 sock_put(sk_redir); ··· 377 375 msg->sg.data[msg->sg.start].page_link && 378 376 msg->sg.data[msg->sg.start].length) { 379 377 if (eval == __SK_REDIRECT) 380 - sk_mem_charge(sk, msg->sg.size); 378 + sk_mem_charge(sk, tosend - sent); 381 379 goto more_data; 382 380 } 383 381 }
+1
net/ipv6/addrlabel.c
··· 437 437 { 438 438 struct ifaddrlblmsg *ifal = nlmsg_data(nlh); 439 439 ifal->ifal_family = AF_INET6; 440 + ifal->__ifal_reserved = 0; 440 441 ifal->ifal_prefixlen = prefixlen; 441 442 ifal->ifal_flags = 0; 442 443 ifal->ifal_index = ifindex;
+6 -2
net/mac80211/main.c
··· 1446 1446 ieee80211_led_exit(local); 1447 1447 destroy_workqueue(local->workqueue); 1448 1448 fail_workqueue: 1449 - if (local->wiphy_ciphers_allocated) 1449 + if (local->wiphy_ciphers_allocated) { 1450 1450 kfree(local->hw.wiphy->cipher_suites); 1451 + local->wiphy_ciphers_allocated = false; 1452 + } 1451 1453 kfree(local->int_scan_req); 1452 1454 return result; 1453 1455 } ··· 1517 1515 mutex_destroy(&local->iflist_mtx); 1518 1516 mutex_destroy(&local->mtx); 1519 1517 1520 - if (local->wiphy_ciphers_allocated) 1518 + if (local->wiphy_ciphers_allocated) { 1521 1519 kfree(local->hw.wiphy->cipher_suites); 1520 + local->wiphy_ciphers_allocated = false; 1521 + } 1522 1522 1523 1523 idr_for_each(&local->ack_status_frames, 1524 1524 ieee80211_free_ack_frame, NULL);
+1 -1
net/mac80211/mesh_pathtbl.c
··· 710 710 void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata, 711 711 struct sk_buff *skb) 712 712 { 713 - kfree_skb(skb); 713 + ieee80211_free_txskb(&sdata->local->hw, skb); 714 714 sdata->u.mesh.mshstats.dropped_frames_no_route++; 715 715 } 716 716
+3
net/mac80211/s1g.c
··· 112 112 goto out; 113 113 } 114 114 115 + /* TWT Information not supported yet */ 116 + twt->control |= IEEE80211_TWT_CONTROL_RX_DISABLED; 117 + 115 118 drv_add_twt_setup(sdata->local, sdata, &sta->sta, twt); 116 119 out: 117 120 ieee80211_s1g_send_twt_setup(sdata, mgmt->sa, sdata->vif.addr, twt);
+5
net/mac80211/tx.c
··· 4406 4406 if (likely(!is_multicast_ether_addr(eth->h_dest))) 4407 4407 goto normal; 4408 4408 4409 + if (unlikely(!ieee80211_sdata_running(sdata))) { 4410 + kfree_skb(skb); 4411 + return NETDEV_TX_OK; 4412 + } 4413 + 4409 4414 if (unlikely(ieee80211_multicast_to_unicast(skb, dev))) { 4410 4415 struct sk_buff_head queue; 4411 4416
+3 -1
net/mctp/af_mctp.c
··· 665 665 666 666 rc = mctp_neigh_init(); 667 667 if (rc) 668 - goto err_unreg_proto; 668 + goto err_unreg_routes; 669 669 670 670 mctp_device_init(); 671 671 672 672 return 0; 673 673 674 + err_unreg_routes: 675 + mctp_routes_exit(); 674 676 err_unreg_proto: 675 677 proto_unregister(&mctp_proto); 676 678 err_unreg_sock:
+1 -1
net/mctp/route.c
··· 1400 1400 return register_pernet_subsys(&mctp_net_ops); 1401 1401 } 1402 1402 1403 - void __exit mctp_routes_exit(void) 1403 + void mctp_routes_exit(void) 1404 1404 { 1405 1405 unregister_pernet_subsys(&mctp_net_ops); 1406 1406 rtnl_unregister(PF_MCTP, RTM_DELROUTE);
+2 -1
net/netfilter/nf_tables_api.c
··· 10127 10127 struct nftables_pernet *nft_net = nft_pernet(net); 10128 10128 10129 10129 mutex_lock(&nft_net->commit_mutex); 10130 - if (!list_empty(&nft_net->commit_list)) 10130 + if (!list_empty(&nft_net->commit_list) || 10131 + !list_empty(&nft_net->module_list)) 10131 10132 __nf_tables_abort(net, NFNL_ABORT_NONE); 10132 10133 __nft_release_tables(net); 10133 10134 mutex_unlock(&nft_net->commit_mutex);
+1
net/netfilter/nfnetlink.c
··· 294 294 nfnl_lock(subsys_id); 295 295 if (nfnl_dereference_protected(subsys_id) != ss || 296 296 nfnetlink_find_client(type, ss) != nc) { 297 + nfnl_unlock(subsys_id); 297 298 err = -EAGAIN; 298 299 break; 299 300 }
+8 -5
net/sctp/outqueue.c
··· 384 384 { 385 385 struct sctp_outq *q = &asoc->outqueue; 386 386 struct sctp_chunk *chk, *temp; 387 + struct sctp_stream_out *sout; 387 388 388 389 q->sched->unsched_all(&asoc->stream); 389 390 ··· 399 398 sctp_sched_dequeue_common(q, chk); 400 399 asoc->sent_cnt_removable--; 401 400 asoc->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; 402 - if (chk->sinfo.sinfo_stream < asoc->stream.outcnt) { 403 - struct sctp_stream_out *streamout = 404 - SCTP_SO(&asoc->stream, chk->sinfo.sinfo_stream); 405 401 406 - streamout->ext->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; 407 - } 402 + sout = SCTP_SO(&asoc->stream, chk->sinfo.sinfo_stream); 403 + sout->ext->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; 404 + 405 + /* clear out_curr if all frag chunks are pruned */ 406 + if (asoc->stream.out_curr == sout && 407 + list_is_last(&chk->frag_list, &chk->msg->chunks)) 408 + asoc->stream.out_curr = NULL; 408 409 409 410 msg_len -= chk->skb->truesize + sizeof(struct sctp_chunk); 410 411 sctp_chunk_free(chk);
+9 -3
net/wireless/reg.c
··· 1084 1084 1085 1085 static int query_regdb_file(const char *alpha2) 1086 1086 { 1087 + int err; 1088 + 1087 1089 ASSERT_RTNL(); 1088 1090 1089 1091 if (regdb) ··· 1095 1093 if (!alpha2) 1096 1094 return -ENOMEM; 1097 1095 1098 - return request_firmware_nowait(THIS_MODULE, true, "regulatory.db", 1099 - &reg_pdev->dev, GFP_KERNEL, 1100 - (void *)alpha2, regdb_fw_cb); 1096 + err = request_firmware_nowait(THIS_MODULE, true, "regulatory.db", 1097 + &reg_pdev->dev, GFP_KERNEL, 1098 + (void *)alpha2, regdb_fw_cb); 1099 + if (err) 1100 + kfree(alpha2); 1101 + 1102 + return err; 1101 1103 } 1102 1104 1103 1105 int reg_reload_regdb(void)
+3 -1
net/wireless/scan.c
··· 1674 1674 if (old == rcu_access_pointer(known->pub.ies)) 1675 1675 rcu_assign_pointer(known->pub.ies, new->pub.beacon_ies); 1676 1676 1677 - cfg80211_update_hidden_bsses(known, new->pub.beacon_ies, old); 1677 + cfg80211_update_hidden_bsses(known, 1678 + rcu_access_pointer(new->pub.beacon_ies), 1679 + old); 1678 1680 1679 1681 if (old) 1680 1682 kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head);
+4 -2
net/wireless/util.c
··· 1559 1559 tmp = result; 1560 1560 tmp *= SCALE; 1561 1561 do_div(tmp, mcs_divisors[rate->mcs]); 1562 - result = tmp; 1563 1562 1564 1563 /* and take NSS */ 1565 - result = (result * rate->nss) / 8; 1564 + tmp *= rate->nss; 1565 + do_div(tmp, 8); 1566 + 1567 + result = tmp; 1566 1568 1567 1569 return result / 10000; 1568 1570 }
+1 -1
scripts/Makefile.modpost
··· 122 122 sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) -T - $(vmlinux.o-if-present) 123 123 124 124 targets += $(output-symdump) 125 - $(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(moudle.symvers-if-present) $(MODPOST) FORCE 125 + $(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(module.symvers-if-present) $(MODPOST) FORCE 126 126 $(call if_changed,modpost) 127 127 128 128 __modpost: $(output-symdump)
+4 -19
scripts/kconfig/menu.c
··· 722 722 if (!expr_eq(prop->menu->dep, prop->visible.expr)) 723 723 get_dep_str(r, prop->visible.expr, " Visible if: "); 724 724 725 - menu = prop->menu->parent; 726 - for (i = 0; menu && i < 8; menu = menu->parent) { 725 + menu = prop->menu; 726 + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { 727 727 bool accessible = menu_is_visible(menu); 728 728 729 729 submenu[i++] = menu; ··· 733 733 if (head && location) { 734 734 jump = xmalloc(sizeof(struct jump_key)); 735 735 736 - if (menu_is_visible(prop->menu)) { 737 - /* 738 - * There is not enough room to put the hint at the 739 - * beginning of the "Prompt" line. Put the hint on the 740 - * last "Location" line even when it would belong on 741 - * the former. 742 - */ 743 - jump->target = prop->menu; 744 - } else 745 - jump->target = location; 736 + jump->target = location; 746 737 747 738 if (list_empty(head)) 748 739 jump->index = 0; ··· 749 758 menu = submenu[i]; 750 759 if (jump && menu == location) 751 760 jump->offset = strlen(r->s); 752 - 753 - if (menu == &rootmenu) 754 - /* The real rootmenu prompt is ugly */ 755 - str_printf(r, "%*cMain menu", j, ' '); 756 - else 757 - str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); 758 - 761 + str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); 759 762 if (menu->sym) { 760 763 str_printf(r, " (%s [=%s])", menu->sym->name ? 761 764 menu->sym->name : "<choice>",
+3
tools/bpf/bpftool/common.c
··· 302 302 int err; 303 303 int fd; 304 304 305 + if (!REQ_ARGS(3)) 306 + return -EINVAL; 307 + 305 308 fd = get_fd(&argc, &argv); 306 309 if (fd < 0) 307 310 return fd;
+1
tools/include/uapi/linux/in.h
··· 20 20 #define _UAPI_LINUX_IN_H 21 21 22 22 #include <linux/types.h> 23 + #include <linux/stddef.h> 23 24 #include <linux/libc-compat.h> 24 25 #include <linux/socket.h> 25 26
+47
tools/include/uapi/linux/stddef.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _LINUX_STDDEF_H 3 + #define _LINUX_STDDEF_H 4 + 5 + 6 + 7 + #ifndef __always_inline 8 + #define __always_inline __inline__ 9 + #endif 10 + 11 + /** 12 + * __struct_group() - Create a mirrored named and anonyomous struct 13 + * 14 + * @TAG: The tag name for the named sub-struct (usually empty) 15 + * @NAME: The identifier name of the mirrored sub-struct 16 + * @ATTRS: Any struct attributes (usually empty) 17 + * @MEMBERS: The member declarations for the mirrored structs 18 + * 19 + * Used to create an anonymous union of two structs with identical layout 20 + * and size: one anonymous and one named. The former's members can be used 21 + * normally without sub-struct naming, and the latter can be used to 22 + * reason about the start, end, and size of the group of struct members. 23 + * The named struct can also be explicitly tagged for layer reuse, as well 24 + * as both having struct attributes appended. 25 + */ 26 + #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ 27 + union { \ 28 + struct { MEMBERS } ATTRS; \ 29 + struct TAG { MEMBERS } ATTRS NAME; \ 30 + } 31 + 32 + /** 33 + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union 34 + * 35 + * @TYPE: The type of each flexible array element 36 + * @NAME: The name of the flexible array member 37 + * 38 + * In order to have a flexible array member in a union or alone in a 39 + * struct, it needs to be wrapped in an anonymous struct with at least 1 40 + * named member, but that member can be empty. 41 + */ 42 + #define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ 43 + struct { \ 44 + struct { } __empty_ ## NAME; \ 45 + TYPE NAME[]; \ 46 + } 47 + #endif
+280 -21
tools/testing/cxl/test/cxl.c
··· 12 12 #include "mock.h" 13 13 14 14 #define NR_CXL_HOST_BRIDGES 2 15 + #define NR_CXL_SINGLE_HOST 1 15 16 #define NR_CXL_ROOT_PORTS 2 16 17 #define NR_CXL_SWITCH_PORTS 2 17 18 #define NR_CXL_PORT_DECODERS 8 18 19 19 20 static struct platform_device *cxl_acpi; 20 21 static struct platform_device *cxl_host_bridge[NR_CXL_HOST_BRIDGES]; 21 - static struct platform_device 22 - *cxl_root_port[NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS]; 23 - static struct platform_device 24 - *cxl_switch_uport[NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS]; 25 - static struct platform_device 26 - *cxl_switch_dport[NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS * 27 - NR_CXL_SWITCH_PORTS]; 28 - struct platform_device 29 - *cxl_mem[NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS * NR_CXL_SWITCH_PORTS]; 22 + #define NR_MULTI_ROOT (NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS) 23 + static struct platform_device *cxl_root_port[NR_MULTI_ROOT]; 24 + static struct platform_device *cxl_switch_uport[NR_MULTI_ROOT]; 25 + #define NR_MEM_MULTI \ 26 + (NR_CXL_HOST_BRIDGES * NR_CXL_ROOT_PORTS * NR_CXL_SWITCH_PORTS) 27 + static struct platform_device *cxl_switch_dport[NR_MEM_MULTI]; 28 + 29 + static struct platform_device *cxl_hb_single[NR_CXL_SINGLE_HOST]; 30 + static struct platform_device *cxl_root_single[NR_CXL_SINGLE_HOST]; 31 + static struct platform_device *cxl_swu_single[NR_CXL_SINGLE_HOST]; 32 + #define NR_MEM_SINGLE (NR_CXL_SINGLE_HOST * NR_CXL_SWITCH_PORTS) 33 + static struct platform_device *cxl_swd_single[NR_MEM_SINGLE]; 34 + 35 + struct platform_device *cxl_mem[NR_MEM_MULTI]; 36 + struct platform_device *cxl_mem_single[NR_MEM_SINGLE]; 37 + 38 + 39 + static inline bool is_multi_bridge(struct device *dev) 40 + { 41 + int i; 42 + 43 + for (i = 0; i < ARRAY_SIZE(cxl_host_bridge); i++) 44 + if (&cxl_host_bridge[i]->dev == dev) 45 + return true; 46 + return false; 47 + } 48 + 49 + static inline bool is_single_bridge(struct device *dev) 50 + { 51 + int i; 52 + 53 + for (i = 0; i < ARRAY_SIZE(cxl_hb_single); i++) 54 + if (&cxl_hb_single[i]->dev == dev) 55 + return true; 56 + return false; 57 + } 30 58 31 59 static struct acpi_device acpi0017_mock; 32 - static struct acpi_device host_bridge[NR_CXL_HOST_BRIDGES] = { 60 + static struct acpi_device host_bridge[NR_CXL_HOST_BRIDGES + NR_CXL_SINGLE_HOST] = { 33 61 [0] = { 34 62 .handle = &host_bridge[0], 35 63 }, 36 64 [1] = { 37 65 .handle = &host_bridge[1], 38 66 }, 67 + [2] = { 68 + .handle = &host_bridge[2], 69 + }, 70 + 39 71 }; 40 72 41 73 static bool is_mock_dev(struct device *dev) ··· 76 44 77 45 for (i = 0; i < ARRAY_SIZE(cxl_mem); i++) 78 46 if (dev == &cxl_mem[i]->dev) 47 + return true; 48 + for (i = 0; i < ARRAY_SIZE(cxl_mem_single); i++) 49 + if (dev == &cxl_mem_single[i]->dev) 79 50 return true; 80 51 if (dev == &cxl_acpi->dev) 81 52 return true; ··· 101 66 102 67 static struct { 103 68 struct acpi_table_cedt cedt; 104 - struct acpi_cedt_chbs chbs[NR_CXL_HOST_BRIDGES]; 69 + struct acpi_cedt_chbs chbs[NR_CXL_HOST_BRIDGES + NR_CXL_SINGLE_HOST]; 105 70 struct { 106 71 struct acpi_cedt_cfmws cfmws; 107 72 u32 target[1]; ··· 118 83 struct acpi_cedt_cfmws cfmws; 119 84 u32 target[2]; 120 85 } cfmws3; 86 + struct { 87 + struct acpi_cedt_cfmws cfmws; 88 + u32 target[1]; 89 + } cfmws4; 121 90 } __packed mock_cedt = { 122 91 .cedt = { 123 92 .header = { ··· 144 105 .length = sizeof(mock_cedt.chbs[0]), 145 106 }, 146 107 .uid = 1, 108 + .cxl_version = ACPI_CEDT_CHBS_VERSION_CXL20, 109 + }, 110 + .chbs[2] = { 111 + .header = { 112 + .type = ACPI_CEDT_TYPE_CHBS, 113 + .length = sizeof(mock_cedt.chbs[0]), 114 + }, 115 + .uid = 2, 147 116 .cxl_version = ACPI_CEDT_CHBS_VERSION_CXL20, 148 117 }, 149 118 .cfmws0 = { ··· 214 167 }, 215 168 .target = { 0, 1, }, 216 169 }, 170 + .cfmws4 = { 171 + .cfmws = { 172 + .header = { 173 + .type = ACPI_CEDT_TYPE_CFMWS, 174 + .length = sizeof(mock_cedt.cfmws4), 175 + }, 176 + .interleave_ways = 0, 177 + .granularity = 4, 178 + .restrictions = ACPI_CEDT_CFMWS_RESTRICT_TYPE3 | 179 + ACPI_CEDT_CFMWS_RESTRICT_PMEM, 180 + .qtg_id = 4, 181 + .window_size = SZ_256M * 4UL, 182 + }, 183 + .target = { 2 }, 184 + }, 217 185 }; 218 186 219 - struct acpi_cedt_cfmws *mock_cfmws[4] = { 187 + struct acpi_cedt_cfmws *mock_cfmws[] = { 220 188 [0] = &mock_cedt.cfmws0.cfmws, 221 189 [1] = &mock_cedt.cfmws1.cfmws, 222 190 [2] = &mock_cedt.cfmws2.cfmws, 223 191 [3] = &mock_cedt.cfmws3.cfmws, 192 + [4] = &mock_cedt.cfmws4.cfmws, 224 193 }; 225 194 226 195 struct cxl_mock_res { ··· 367 304 for (i = 0; i < ARRAY_SIZE(cxl_host_bridge); i++) 368 305 if (dev == &cxl_host_bridge[i]->dev) 369 306 return true; 307 + for (i = 0; i < ARRAY_SIZE(cxl_hb_single); i++) 308 + if (dev == &cxl_hb_single[i]->dev) 309 + return true; 370 310 return false; 371 311 } 372 312 ··· 390 324 391 325 for (i = 0; i < ARRAY_SIZE(cxl_switch_dport); i++) 392 326 if (dev == &cxl_switch_dport[i]->dev) 327 + return true; 328 + 329 + for (i = 0; i < ARRAY_SIZE(cxl_root_single); i++) 330 + if (dev == &cxl_root_single[i]->dev) 331 + return true; 332 + 333 + for (i = 0; i < ARRAY_SIZE(cxl_swu_single); i++) 334 + if (dev == &cxl_swu_single[i]->dev) 335 + return true; 336 + 337 + for (i = 0; i < ARRAY_SIZE(cxl_swd_single); i++) 338 + if (dev == &cxl_swd_single[i]->dev) 393 339 return true; 394 340 395 341 if (is_cxl_memdev(dev)) ··· 639 561 int i, array_size; 640 562 641 563 if (port->depth == 1) { 642 - array_size = ARRAY_SIZE(cxl_root_port); 643 - array = cxl_root_port; 564 + if (is_multi_bridge(port->uport)) { 565 + array_size = ARRAY_SIZE(cxl_root_port); 566 + array = cxl_root_port; 567 + } else if (is_single_bridge(port->uport)) { 568 + array_size = ARRAY_SIZE(cxl_root_single); 569 + array = cxl_root_single; 570 + } else { 571 + dev_dbg(&port->dev, "%s: unknown bridge type\n", 572 + dev_name(port->uport)); 573 + return -ENXIO; 574 + } 644 575 } else if (port->depth == 2) { 645 - array_size = ARRAY_SIZE(cxl_switch_dport); 646 - array = cxl_switch_dport; 576 + struct cxl_port *parent = to_cxl_port(port->dev.parent); 577 + 578 + if (is_multi_bridge(parent->uport)) { 579 + array_size = ARRAY_SIZE(cxl_switch_dport); 580 + array = cxl_switch_dport; 581 + } else if (is_single_bridge(parent->uport)) { 582 + array_size = ARRAY_SIZE(cxl_swd_single); 583 + array = cxl_swd_single; 584 + } else { 585 + dev_dbg(&port->dev, "%s: unknown bridge type\n", 586 + dev_name(port->uport)); 587 + return -ENXIO; 588 + } 647 589 } else { 648 590 dev_WARN_ONCE(&port->dev, 1, "unexpected depth %d\n", 649 591 port->depth); ··· 674 576 struct platform_device *pdev = array[i]; 675 577 struct cxl_dport *dport; 676 578 677 - if (pdev->dev.parent != port->uport) 579 + if (pdev->dev.parent != port->uport) { 580 + dev_dbg(&port->dev, "%s: mismatch parent %s\n", 581 + dev_name(port->uport), 582 + dev_name(pdev->dev.parent)); 678 583 continue; 584 + } 679 585 680 586 dport = devm_cxl_add_dport(port, &pdev->dev, pdev->id, 681 587 CXL_RESOURCE_NONE); ··· 728 626 #ifndef SZ_512G 729 627 #define SZ_512G (SZ_64G * 8) 730 628 #endif 629 + 630 + static __init int cxl_single_init(void) 631 + { 632 + int i, rc; 633 + 634 + for (i = 0; i < ARRAY_SIZE(cxl_hb_single); i++) { 635 + struct acpi_device *adev = 636 + &host_bridge[NR_CXL_HOST_BRIDGES + i]; 637 + struct platform_device *pdev; 638 + 639 + pdev = platform_device_alloc("cxl_host_bridge", 640 + NR_CXL_HOST_BRIDGES + i); 641 + if (!pdev) 642 + goto err_bridge; 643 + 644 + mock_companion(adev, &pdev->dev); 645 + rc = platform_device_add(pdev); 646 + if (rc) { 647 + platform_device_put(pdev); 648 + goto err_bridge; 649 + } 650 + 651 + cxl_hb_single[i] = pdev; 652 + rc = sysfs_create_link(&pdev->dev.kobj, &pdev->dev.kobj, 653 + "physical_node"); 654 + if (rc) 655 + goto err_bridge; 656 + } 657 + 658 + for (i = 0; i < ARRAY_SIZE(cxl_root_single); i++) { 659 + struct platform_device *bridge = 660 + cxl_hb_single[i % ARRAY_SIZE(cxl_hb_single)]; 661 + struct platform_device *pdev; 662 + 663 + pdev = platform_device_alloc("cxl_root_port", 664 + NR_MULTI_ROOT + i); 665 + if (!pdev) 666 + goto err_port; 667 + pdev->dev.parent = &bridge->dev; 668 + 669 + rc = platform_device_add(pdev); 670 + if (rc) { 671 + platform_device_put(pdev); 672 + goto err_port; 673 + } 674 + cxl_root_single[i] = pdev; 675 + } 676 + 677 + for (i = 0; i < ARRAY_SIZE(cxl_swu_single); i++) { 678 + struct platform_device *root_port = cxl_root_single[i]; 679 + struct platform_device *pdev; 680 + 681 + pdev = platform_device_alloc("cxl_switch_uport", 682 + NR_MULTI_ROOT + i); 683 + if (!pdev) 684 + goto err_uport; 685 + pdev->dev.parent = &root_port->dev; 686 + 687 + rc = platform_device_add(pdev); 688 + if (rc) { 689 + platform_device_put(pdev); 690 + goto err_uport; 691 + } 692 + cxl_swu_single[i] = pdev; 693 + } 694 + 695 + for (i = 0; i < ARRAY_SIZE(cxl_swd_single); i++) { 696 + struct platform_device *uport = 697 + cxl_swu_single[i % ARRAY_SIZE(cxl_swu_single)]; 698 + struct platform_device *pdev; 699 + 700 + pdev = platform_device_alloc("cxl_switch_dport", 701 + i + NR_MEM_MULTI); 702 + if (!pdev) 703 + goto err_dport; 704 + pdev->dev.parent = &uport->dev; 705 + 706 + rc = platform_device_add(pdev); 707 + if (rc) { 708 + platform_device_put(pdev); 709 + goto err_dport; 710 + } 711 + cxl_swd_single[i] = pdev; 712 + } 713 + 714 + for (i = 0; i < ARRAY_SIZE(cxl_mem_single); i++) { 715 + struct platform_device *dport = cxl_swd_single[i]; 716 + struct platform_device *pdev; 717 + 718 + pdev = platform_device_alloc("cxl_mem", NR_MEM_MULTI + i); 719 + if (!pdev) 720 + goto err_mem; 721 + pdev->dev.parent = &dport->dev; 722 + set_dev_node(&pdev->dev, i % 2); 723 + 724 + rc = platform_device_add(pdev); 725 + if (rc) { 726 + platform_device_put(pdev); 727 + goto err_mem; 728 + } 729 + cxl_mem_single[i] = pdev; 730 + } 731 + 732 + return 0; 733 + 734 + err_mem: 735 + for (i = ARRAY_SIZE(cxl_mem_single) - 1; i >= 0; i--) 736 + platform_device_unregister(cxl_mem_single[i]); 737 + err_dport: 738 + for (i = ARRAY_SIZE(cxl_swd_single) - 1; i >= 0; i--) 739 + platform_device_unregister(cxl_swd_single[i]); 740 + err_uport: 741 + for (i = ARRAY_SIZE(cxl_swu_single) - 1; i >= 0; i--) 742 + platform_device_unregister(cxl_swu_single[i]); 743 + err_port: 744 + for (i = ARRAY_SIZE(cxl_root_single) - 1; i >= 0; i--) 745 + platform_device_unregister(cxl_root_single[i]); 746 + err_bridge: 747 + for (i = ARRAY_SIZE(cxl_hb_single) - 1; i >= 0; i--) { 748 + struct platform_device *pdev = cxl_hb_single[i]; 749 + 750 + if (!pdev) 751 + continue; 752 + sysfs_remove_link(&pdev->dev.kobj, "physical_node"); 753 + platform_device_unregister(cxl_hb_single[i]); 754 + } 755 + 756 + return rc; 757 + } 758 + 759 + static void cxl_single_exit(void) 760 + { 761 + int i; 762 + 763 + for (i = ARRAY_SIZE(cxl_mem_single) - 1; i >= 0; i--) 764 + platform_device_unregister(cxl_mem_single[i]); 765 + for (i = ARRAY_SIZE(cxl_swd_single) - 1; i >= 0; i--) 766 + platform_device_unregister(cxl_swd_single[i]); 767 + for (i = ARRAY_SIZE(cxl_swu_single) - 1; i >= 0; i--) 768 + platform_device_unregister(cxl_swu_single[i]); 769 + for (i = ARRAY_SIZE(cxl_root_single) - 1; i >= 0; i--) 770 + platform_device_unregister(cxl_root_single[i]); 771 + for (i = ARRAY_SIZE(cxl_hb_single) - 1; i >= 0; i--) { 772 + struct platform_device *pdev = cxl_hb_single[i]; 773 + 774 + if (!pdev) 775 + continue; 776 + sysfs_remove_link(&pdev->dev.kobj, "physical_node"); 777 + platform_device_unregister(cxl_hb_single[i]); 778 + } 779 + } 731 780 732 781 static __init int cxl_test_init(void) 733 782 { ··· 948 695 949 696 pdev = platform_device_alloc("cxl_switch_uport", i); 950 697 if (!pdev) 951 - goto err_port; 698 + goto err_uport; 952 699 pdev->dev.parent = &root_port->dev; 953 700 954 701 rc = platform_device_add(pdev); ··· 966 713 967 714 pdev = platform_device_alloc("cxl_switch_dport", i); 968 715 if (!pdev) 969 - goto err_port; 716 + goto err_dport; 970 717 pdev->dev.parent = &uport->dev; 971 718 972 719 rc = platform_device_add(pdev); ··· 977 724 cxl_switch_dport[i] = pdev; 978 725 } 979 726 980 - BUILD_BUG_ON(ARRAY_SIZE(cxl_mem) != ARRAY_SIZE(cxl_switch_dport)); 981 727 for (i = 0; i < ARRAY_SIZE(cxl_mem); i++) { 982 728 struct platform_device *dport = cxl_switch_dport[i]; 983 729 struct platform_device *pdev; ··· 995 743 cxl_mem[i] = pdev; 996 744 } 997 745 746 + rc = cxl_single_init(); 747 + if (rc) 748 + goto err_mem; 749 + 998 750 cxl_acpi = platform_device_alloc("cxl_acpi", 0); 999 751 if (!cxl_acpi) 1000 - goto err_mem; 752 + goto err_single; 1001 753 1002 754 mock_companion(&acpi0017_mock, &cxl_acpi->dev); 1003 755 acpi0017_mock.dev.bus = &platform_bus_type; ··· 1014 758 1015 759 err_add: 1016 760 platform_device_put(cxl_acpi); 761 + err_single: 762 + cxl_single_exit(); 1017 763 err_mem: 1018 764 for (i = ARRAY_SIZE(cxl_mem) - 1; i >= 0; i--) 1019 765 platform_device_unregister(cxl_mem[i]); ··· 1051 793 int i; 1052 794 1053 795 platform_device_unregister(cxl_acpi); 796 + cxl_single_exit(); 1054 797 for (i = ARRAY_SIZE(cxl_mem) - 1; i >= 0; i--) 1055 798 platform_device_unregister(cxl_mem[i]); 1056 799 for (i = ARRAY_SIZE(cxl_switch_dport) - 1; i >= 0; i--)
+36
tools/testing/selftests/bpf/verifier/ref_tracking.c
··· 1044 1044 .result_unpriv = REJECT, 1045 1045 .errstr_unpriv = "unknown func", 1046 1046 }, 1047 + { 1048 + "reference tracking: try to leak released ptr reg", 1049 + .insns = { 1050 + BPF_MOV64_IMM(BPF_REG_0, 0), 1051 + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -4), 1052 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 1053 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4), 1054 + BPF_LD_MAP_FD(BPF_REG_1, 0), 1055 + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), 1056 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), 1057 + BPF_EXIT_INSN(), 1058 + BPF_MOV64_REG(BPF_REG_9, BPF_REG_0), 1059 + 1060 + BPF_MOV64_IMM(BPF_REG_0, 0), 1061 + BPF_LD_MAP_FD(BPF_REG_1, 0), 1062 + BPF_MOV64_IMM(BPF_REG_2, 8), 1063 + BPF_MOV64_IMM(BPF_REG_3, 0), 1064 + BPF_EMIT_CALL(BPF_FUNC_ringbuf_reserve), 1065 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), 1066 + BPF_EXIT_INSN(), 1067 + BPF_MOV64_REG(BPF_REG_8, BPF_REG_0), 1068 + 1069 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_8), 1070 + BPF_MOV64_IMM(BPF_REG_2, 0), 1071 + BPF_EMIT_CALL(BPF_FUNC_ringbuf_discard), 1072 + BPF_MOV64_IMM(BPF_REG_0, 0), 1073 + 1074 + BPF_STX_MEM(BPF_DW, BPF_REG_9, BPF_REG_8, 0), 1075 + BPF_EXIT_INSN() 1076 + }, 1077 + .fixup_map_array_48b = { 4 }, 1078 + .fixup_map_ringbuf = { 11 }, 1079 + .result = ACCEPT, 1080 + .result_unpriv = REJECT, 1081 + .errstr_unpriv = "R8 !read_ok" 1082 + },
+4 -3
tools/testing/selftests/landlock/Makefile
··· 3 3 # First run: make -C ../../../.. headers_install 4 4 5 5 CFLAGS += -Wall -O2 $(KHDR_INCLUDES) 6 - LDLIBS += -lcap 7 6 8 7 LOCAL_HDRS += common.h 9 8 ··· 12 13 13 14 TEST_GEN_PROGS_EXTENDED := true 14 15 15 - # Static linking for short targets: 16 + # Short targets: 17 + $(TEST_GEN_PROGS): LDLIBS += -lcap 16 18 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static 17 19 18 20 include ../lib.mk 19 21 20 - # Static linking for targets with $(OUTPUT)/ prefix: 22 + # Targets with $(OUTPUT)/ prefix: 23 + $(TEST_GEN_PROGS): LDLIBS += -lcap 21 24 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
+2 -2
tools/testing/selftests/net/udpgro.sh
··· 50 50 echo "failed" & 51 51 52 52 # Hack: let bg programs complete the startup 53 - sleep 0.1 53 + sleep 0.2 54 54 ./udpgso_bench_tx ${tx_args} 55 55 ret=$? 56 56 wait $(jobs -p) ··· 117 117 echo "failed" & 118 118 119 119 # Hack: let bg programs complete the startup 120 - sleep 0.1 120 + sleep 0.2 121 121 ./udpgso_bench_tx ${tx_args} -p 12345 122 122 sleep 0.1 123 123 # first UDP GSO socket should be closed at this point
+1 -1
tools/testing/selftests/net/udpgro_bench.sh
··· 39 39 ip netns exec "${PEER_NS}" ./udpgso_bench_rx -t ${rx_args} -r & 40 40 41 41 # Hack: let bg programs complete the startup 42 - sleep 0.1 42 + sleep 0.2 43 43 ./udpgso_bench_tx ${tx_args} 44 44 } 45 45
+1 -1
tools/testing/selftests/net/udpgro_frglist.sh
··· 44 44 ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r & 45 45 46 46 # Hack: let bg programs complete the startup 47 - sleep 0.1 47 + sleep 0.2 48 48 ./udpgso_bench_tx ${tx_args} 49 49 } 50 50
+8 -6
tools/testing/selftests/netfilter/rpath.sh
··· 15 15 16 16 if ip6tables-legacy --version >/dev/null 2>&1; then 17 17 ip6tables='ip6tables-legacy' 18 - elif ! ip6tables --version >/dev/null 2>&1; then 18 + elif ip6tables --version >/dev/null 2>&1; then 19 19 ip6tables='ip6tables' 20 20 else 21 21 ip6tables='' ··· 62 62 ip -net "$ns2" a a fec0:42::1/64 dev d0 nodad 63 63 64 64 # firewall matches to test 65 - ip netns exec "$ns2" "$iptables" -t raw -A PREROUTING -s 192.168.0.0/16 -m rpfilter 66 - ip netns exec "$ns2" "$ip6tables" -t raw -A PREROUTING -s fec0::/16 -m rpfilter 67 - ip netns exec "$ns2" nft -f - <<EOF 65 + [ -n "$iptables" ] && ip netns exec "$ns2" \ 66 + "$iptables" -t raw -A PREROUTING -s 192.168.0.0/16 -m rpfilter 67 + [ -n "$ip6tables" ] && ip netns exec "$ns2" \ 68 + "$ip6tables" -t raw -A PREROUTING -s fec0::/16 -m rpfilter 69 + [ -n "$nft" ] && ip netns exec "$ns2" $nft -f - <<EOF 68 70 table inet t { 69 71 chain c { 70 72 type filter hook prerouting priority raw; ··· 108 106 if [ -n "$nft" ]; then 109 107 ( 110 108 echo "delete table inet t"; 111 - ip netns exec "$ns2" nft -s list table inet t; 112 - ) | ip netns exec "$ns2" nft -f - 109 + ip netns exec "$ns2" $nft -s list table inet t; 110 + ) | ip netns exec "$ns2" $nft -f - 113 111 fi 114 112 115 113 # test 1: martian traffic should fail rpfilter matches
+1 -1
tools/testing/selftests/pidfd/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - CFLAGS += -g -I../../../../usr/include/ -pthread 2 + CFLAGS += -g -I../../../../usr/include/ -pthread -Wall 3 3 4 4 TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \ 5 5 pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test
+3 -1
tools/testing/selftests/pidfd/pidfd_test.c
··· 413 413 414 414 c = epoll_wait(epoll_fd, events, MAX_EVENTS, 5000); 415 415 if (c != 1 || !(events[0].events & EPOLLIN)) 416 - ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) ", 416 + ksft_exit_fail_msg("%s test: Unexpected epoll_wait result (c=%d, events=%x) " 417 417 "(errno %d)\n", 418 418 test_name, c, events[0].events, errno); 419 419 ··· 435 435 */ 436 436 while (1) 437 437 sleep(1); 438 + 439 + return 0; 438 440 } 439 441 440 442 static void test_pidfd_poll_exec(int use_waitpid)
+11 -1
tools/testing/selftests/pidfd/pidfd_wait.c
··· 95 95 .flags = CLONE_PIDFD | CLONE_PARENT_SETTID, 96 96 .exit_signal = SIGCHLD, 97 97 }; 98 + int pfd[2]; 98 99 pid_t pid; 99 100 siginfo_t info = { 100 101 .si_signo = 0, 101 102 }; 102 103 104 + ASSERT_EQ(pipe(pfd), 0); 103 105 pid = sys_clone3(&args); 104 106 ASSERT_GE(pid, 0); 105 107 106 108 if (pid == 0) { 109 + char buf[2]; 110 + 111 + close(pfd[1]); 107 112 kill(getpid(), SIGSTOP); 113 + ASSERT_EQ(read(pfd[0], buf, 1), 1); 114 + close(pfd[0]); 108 115 kill(getpid(), SIGSTOP); 109 116 exit(EXIT_SUCCESS); 110 117 } 111 118 119 + close(pfd[0]); 112 120 ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WSTOPPED, NULL), 0); 113 121 ASSERT_EQ(info.si_signo, SIGCHLD); 114 122 ASSERT_EQ(info.si_code, CLD_STOPPED); ··· 125 117 ASSERT_EQ(sys_pidfd_send_signal(pidfd, SIGCONT, NULL, 0), 0); 126 118 127 119 ASSERT_EQ(sys_waitid(P_PIDFD, pidfd, &info, WCONTINUED, NULL), 0); 120 + ASSERT_EQ(write(pfd[1], "C", 1), 1); 121 + close(pfd[1]); 128 122 ASSERT_EQ(info.si_signo, SIGCHLD); 129 123 ASSERT_EQ(info.si_code, CLD_CONTINUED); 130 124 ASSERT_EQ(info.si_pid, parent_tid); ··· 148 138 149 139 TEST(wait_nonblock) 150 140 { 151 - int pidfd, status = 0; 141 + int pidfd; 152 142 unsigned int flags = 0; 153 143 pid_t parent_tid = -1; 154 144 struct clone_args args = {
+3
virt/kvm/kvm_main.c
··· 4585 4585 } 4586 4586 case KVM_CAP_DIRTY_LOG_RING: 4587 4587 case KVM_CAP_DIRTY_LOG_RING_ACQ_REL: 4588 + if (!kvm_vm_ioctl_check_extension_generic(kvm, cap->cap)) 4589 + return -EINVAL; 4590 + 4588 4591 return kvm_vm_ioctl_enable_dirty_log_ring(kvm, cap->args[0]); 4589 4592 default: 4590 4593 return kvm_vm_ioctl_enable_cap(kvm, cap);