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

Merge 5.14-rc3 into driver-core-next

We need the driver-core fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+3430 -1980
+17 -7
Documentation/arm64/tagged-address-abi.rst
··· 45 45 46 46 1. User addresses not accessed by the kernel but used for address space 47 47 management (e.g. ``mprotect()``, ``madvise()``). The use of valid 48 - tagged pointers in this context is allowed with the exception of 49 - ``brk()``, ``mmap()`` and the ``new_address`` argument to 50 - ``mremap()`` as these have the potential to alias with existing 51 - user addresses. 48 + tagged pointers in this context is allowed with these exceptions: 52 49 53 - NOTE: This behaviour changed in v5.6 and so some earlier kernels may 54 - incorrectly accept valid tagged pointers for the ``brk()``, 55 - ``mmap()`` and ``mremap()`` system calls. 50 + - ``brk()``, ``mmap()`` and the ``new_address`` argument to 51 + ``mremap()`` as these have the potential to alias with existing 52 + user addresses. 53 + 54 + NOTE: This behaviour changed in v5.6 and so some earlier kernels may 55 + incorrectly accept valid tagged pointers for the ``brk()``, 56 + ``mmap()`` and ``mremap()`` system calls. 57 + 58 + - The ``range.start``, ``start`` and ``dst`` arguments to the 59 + ``UFFDIO_*`` ``ioctl()``s used on a file descriptor obtained from 60 + ``userfaultfd()``, as fault addresses subsequently obtained by reading 61 + the file descriptor will be untagged, which may otherwise confuse 62 + tag-unaware programs. 63 + 64 + NOTE: This behaviour changed in v5.14 and so some earlier kernels may 65 + incorrectly accept valid tagged pointers for this system call. 56 66 57 67 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI 58 68 relaxation is disabled by default and the application thread needs to
-56
Documentation/devicetree/bindings/net/imx-dwmac.txt
··· 1 - IMX8 glue layer controller, NXP imx8 families support Synopsys MAC 5.10a IP. 2 - 3 - This file documents platform glue layer for IMX. 4 - Please see stmmac.txt for the other unchanged properties. 5 - 6 - The device node has following properties. 7 - 8 - Required properties: 9 - - compatible: Should be "nxp,imx8mp-dwmac-eqos" to select glue layer 10 - and "snps,dwmac-5.10a" to select IP version. 11 - - clocks: Must contain a phandle for each entry in clock-names. 12 - - clock-names: Should be "stmmaceth" for the host clock. 13 - Should be "pclk" for the MAC apb clock. 14 - Should be "ptp_ref" for the MAC timer clock. 15 - Should be "tx" for the MAC RGMII TX clock: 16 - Should be "mem" for EQOS MEM clock. 17 - - "mem" clock is required for imx8dxl platform. 18 - - "mem" clock is not required for imx8mp platform. 19 - - interrupt-names: Should contain a list of interrupt names corresponding to 20 - the interrupts in the interrupts property, if available. 21 - Should be "macirq" for the main MAC IRQ 22 - Should be "eth_wake_irq" for the IT which wake up system 23 - - intf_mode: Should be phandle/offset pair. The phandle to the syscon node which 24 - encompases the GPR register, and the offset of the GPR register. 25 - - required for imx8mp platform. 26 - - is optional for imx8dxl platform. 27 - 28 - Optional properties: 29 - - intf_mode: is optional for imx8dxl platform. 30 - - snps,rmii_refclk_ext: to select RMII reference clock from external. 31 - 32 - Example: 33 - eqos: ethernet@30bf0000 { 34 - compatible = "nxp,imx8mp-dwmac-eqos", "snps,dwmac-5.10a"; 35 - reg = <0x30bf0000 0x10000>; 36 - interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>, 37 - <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>; 38 - interrupt-names = "eth_wake_irq", "macirq"; 39 - clocks = <&clk IMX8MP_CLK_ENET_QOS_ROOT>, 40 - <&clk IMX8MP_CLK_QOS_ENET_ROOT>, 41 - <&clk IMX8MP_CLK_ENET_QOS_TIMER>, 42 - <&clk IMX8MP_CLK_ENET_QOS>; 43 - clock-names = "stmmaceth", "pclk", "ptp_ref", "tx"; 44 - assigned-clocks = <&clk IMX8MP_CLK_ENET_AXI>, 45 - <&clk IMX8MP_CLK_ENET_QOS_TIMER>, 46 - <&clk IMX8MP_CLK_ENET_QOS>; 47 - assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>, 48 - <&clk IMX8MP_SYS_PLL2_100M>, 49 - <&clk IMX8MP_SYS_PLL2_125M>; 50 - assigned-clock-rates = <0>, <100000000>, <125000000>; 51 - nvmem-cells = <&eth_mac0>; 52 - nvmem-cell-names = "mac-address"; 53 - nvmem_macaddr_swap; 54 - intf_mode = <&gpr 0x4>; 55 - status = "disabled"; 56 - };
+93
Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/net/nxp,dwmac-imx.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NXP i.MX8 DWMAC glue layer Device Tree Bindings 8 + 9 + maintainers: 10 + - Joakim Zhang <qiangqing.zhang@nxp.com> 11 + 12 + # We need a select here so we don't match all nodes with 'snps,dwmac' 13 + select: 14 + properties: 15 + compatible: 16 + contains: 17 + enum: 18 + - nxp,imx8mp-dwmac-eqos 19 + - nxp,imx8dxl-dwmac-eqos 20 + required: 21 + - compatible 22 + 23 + allOf: 24 + - $ref: "snps,dwmac.yaml#" 25 + 26 + properties: 27 + compatible: 28 + oneOf: 29 + - items: 30 + - enum: 31 + - nxp,imx8mp-dwmac-eqos 32 + - nxp,imx8dxl-dwmac-eqos 33 + - const: snps,dwmac-5.10a 34 + 35 + clocks: 36 + minItems: 3 37 + maxItems: 5 38 + items: 39 + - description: MAC host clock 40 + - description: MAC apb clock 41 + - description: MAC timer clock 42 + - description: MAC RGMII TX clock 43 + - description: EQOS MEM clock 44 + 45 + clock-names: 46 + minItems: 3 47 + maxItems: 5 48 + contains: 49 + enum: 50 + - stmmaceth 51 + - pclk 52 + - ptp_ref 53 + - tx 54 + - mem 55 + 56 + intf_mode: 57 + $ref: /schemas/types.yaml#/definitions/phandle-array 58 + description: 59 + Should be phandle/offset pair. The phandle to the syscon node which 60 + encompases the GPR register, and the offset of the GPR register. 61 + 62 + snps,rmii_refclk_ext: 63 + $ref: /schemas/types.yaml#/definitions/flag 64 + description: 65 + To select RMII reference clock from external. 66 + 67 + required: 68 + - compatible 69 + - clocks 70 + - clock-names 71 + 72 + unevaluatedProperties: false 73 + 74 + examples: 75 + - | 76 + #include <dt-bindings/interrupt-controller/arm-gic.h> 77 + #include <dt-bindings/interrupt-controller/irq.h> 78 + #include <dt-bindings/clock/imx8mp-clock.h> 79 + 80 + eqos: ethernet@30bf0000 { 81 + compatible = "nxp,imx8mp-dwmac-eqos","snps,dwmac-5.10a"; 82 + reg = <0x30bf0000 0x10000>; 83 + interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, 84 + <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>; 85 + interrupt-names = "macirq", "eth_wake_irq"; 86 + clocks = <&clk IMX8MP_CLK_ENET_QOS_ROOT>, 87 + <&clk IMX8MP_CLK_QOS_ENET_ROOT>, 88 + <&clk IMX8MP_CLK_ENET_QOS_TIMER>, 89 + <&clk IMX8MP_CLK_ENET_QOS>; 90 + clock-names = "stmmaceth", "pclk", "ptp_ref", "tx"; 91 + phy-mode = "rgmii"; 92 + status = "disabled"; 93 + };
+3
Documentation/devicetree/bindings/net/snps,dwmac.yaml
··· 28 28 - snps,dwmac-4.00 29 29 - snps,dwmac-4.10a 30 30 - snps,dwmac-4.20a 31 + - snps,dwmac-5.10a 31 32 - snps,dwxgmac 32 33 - snps,dwxgmac-2.10 33 34 ··· 83 82 - snps,dwmac-4.00 84 83 - snps,dwmac-4.10a 85 84 - snps,dwmac-4.20a 85 + - snps,dwmac-5.10a 86 86 - snps,dwxgmac 87 87 - snps,dwxgmac-2.10 88 88 ··· 377 375 - snps,dwmac-4.00 378 376 - snps,dwmac-4.10a 379 377 - snps,dwmac-4.20a 378 + - snps,dwmac-5.10a 380 379 - snps,dwxgmac 381 380 - snps,dwxgmac-2.10 382 381 - st,spear600-gmac
+2
Documentation/devicetree/bindings/regulator/fixed-regulator.yaml
··· 57 57 maxItems: 1 58 58 59 59 power-domains: 60 + deprecated: true 60 61 description: 61 62 Power domain to use for enable control. This binding is only 62 63 available if the compatible is chosen to regulator-fixed-domain. 63 64 maxItems: 1 64 65 65 66 required-opps: 67 + deprecated: true 66 68 description: 67 69 Performance state to use for enable control. This binding is only 68 70 available if the compatible is chosen to regulator-fixed-domain. The
+1 -1
Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
··· 114 114 115 115 ports: 116 116 $ref: /schemas/graph.yaml#/properties/ports 117 - properties: 117 + patternProperties: 118 118 port(@[0-9a-f]+)?: 119 119 $ref: audio-graph-port.yaml# 120 120 unevaluatedProperties: false
+3 -3
Documentation/networking/af_xdp.rst
··· 243 243 These are the various configuration flags that can be used to control 244 244 and monitor the behavior of AF_XDP sockets. 245 245 246 - XDP_COPY and XDP_ZERO_COPY bind flags 247 - ------------------------------------- 246 + XDP_COPY and XDP_ZEROCOPY bind flags 247 + ------------------------------------ 248 248 249 249 When you bind to a socket, the kernel will first try to use zero-copy 250 250 copy. If zero-copy is not supported, it will fall back on using copy ··· 252 252 like to force a certain mode, you can use the following flags. If you 253 253 pass the XDP_COPY flag to the bind call, the kernel will force the 254 254 socket into copy mode. If it cannot use copy mode, the bind call will 255 - fail with an error. Conversely, the XDP_ZERO_COPY flag will force the 255 + fail with an error. Conversely, the XDP_ZEROCOPY flag will force the 256 256 socket into zero-copy mode or fail. 257 257 258 258 XDP_SHARED_UMEM bind flag
+1 -1
Documentation/networking/ip-sysctl.rst
··· 826 826 initial value when the blackhole issue goes away. 827 827 0 to disable the blackhole detection. 828 828 829 - By default, it is set to 1hr. 829 + By default, it is set to 0 (feature is disabled). 830 830 831 831 tcp_fastopen_key - list of comma separated 32-digit hexadecimal INTEGERs 832 832 The list consists of a primary key and an optional backup key. The
+1 -1
Documentation/trace/histogram.rst
··· 191 191 with the event, in nanoseconds. May be 192 192 modified by .usecs to have timestamps 193 193 interpreted as microseconds. 194 - cpu int the cpu on which the event occurred. 194 + common_cpu int the cpu on which the event occurred. 195 195 ====================== ==== ======================================= 196 196 197 197 Extended error information
+11 -2
MAINTAINERS
··· 445 445 F: include/uapi/linux/wmi.h 446 446 447 447 ACRN HYPERVISOR SERVICE MODULE 448 - M: Shuo Liu <shuo.a.liu@intel.com> 448 + M: Fei Li <fei1.li@intel.com> 449 449 L: acrn-dev@lists.projectacrn.org (subscribers-only) 450 450 S: Supported 451 451 W: https://projectacrn.org ··· 11758 11758 MEDIATEK SWITCH DRIVER 11759 11759 M: Sean Wang <sean.wang@mediatek.com> 11760 11760 M: Landen Chao <Landen.Chao@mediatek.com> 11761 + M: DENG Qingfang <dqfext@gmail.com> 11761 11762 L: netdev@vger.kernel.org 11762 11763 S: Maintained 11763 11764 F: drivers/net/dsa/mt7530.* ··· 19123 19122 L: linux-usb@vger.kernel.org 19124 19123 S: Maintained 19125 19124 F: Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml 19126 - F: drivers/phy/hisilicon/phy-kirin970-usb3.c 19125 + F: drivers/phy/hisilicon/phy-hi3670-usb3.c 19127 19126 19128 19127 USB ISP116X DRIVER 19129 19128 M: Olav Kongas <ok@artecdesign.ee> ··· 19800 19799 L: netdev@vger.kernel.org 19801 19800 S: Supported 19802 19801 F: drivers/ptp/ptp_vmw.c 19802 + 19803 + VMWARE VMCI DRIVER 19804 + M: Jorgen Hansen <jhansen@vmware.com> 19805 + M: Vishnu Dasa <vdasa@vmware.com> 19806 + L: linux-kernel@vger.kernel.org 19807 + L: pv-drivers@vmware.com (private) 19808 + S: Maintained 19809 + F: drivers/misc/vmw_vmci/ 19803 19810 19804 19811 VMWARE VMMOUSE SUBDRIVER 19805 19812 M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 14 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc2 5 + EXTRAVERSION = -rc3 6 6 NAME = Opossums on Parade 7 7 8 8 # *DOCUMENTATION*
+3 -3
arch/arm64/boot/dts/freescale/imx8mp.dtsi
··· 821 821 eqos: ethernet@30bf0000 { 822 822 compatible = "nxp,imx8mp-dwmac-eqos", "snps,dwmac-5.10a"; 823 823 reg = <0x30bf0000 0x10000>; 824 - interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>, 825 - <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>; 826 - interrupt-names = "eth_wake_irq", "macirq"; 824 + interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>, 825 + <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>; 826 + interrupt-names = "macirq", "eth_wake_irq"; 827 827 clocks = <&clk IMX8MP_CLK_ENET_QOS_ROOT>, 828 828 <&clk IMX8MP_CLK_QOS_ENET_ROOT>, 829 829 <&clk IMX8MP_CLK_ENET_QOS_TIMER>,
+2 -2
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
··· 1063 1063 status = "okay"; 1064 1064 extcon = <&usb2_id>; 1065 1065 1066 - usb@7600000 { 1066 + dwc3@7600000 { 1067 1067 extcon = <&usb2_id>; 1068 1068 dr_mode = "otg"; 1069 1069 maximum-speed = "high-speed"; ··· 1074 1074 status = "okay"; 1075 1075 extcon = <&usb3_id>; 1076 1076 1077 - usb@6a00000 { 1077 + dwc3@6a00000 { 1078 1078 extcon = <&usb3_id>; 1079 1079 dr_mode = "otg"; 1080 1080 };
+2 -2
arch/arm64/boot/dts/qcom/ipq8074.dtsi
··· 443 443 resets = <&gcc GCC_USB0_BCR>; 444 444 status = "disabled"; 445 445 446 - dwc_0: usb@8a00000 { 446 + dwc_0: dwc3@8a00000 { 447 447 compatible = "snps,dwc3"; 448 448 reg = <0x8a00000 0xcd00>; 449 449 interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; ··· 484 484 resets = <&gcc GCC_USB1_BCR>; 485 485 status = "disabled"; 486 486 487 - dwc_1: usb@8c00000 { 487 + dwc_1: dwc3@8c00000 { 488 488 compatible = "snps,dwc3"; 489 489 reg = <0x8c00000 0xcd00>; 490 490 interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+2 -2
arch/arm64/boot/dts/qcom/msm8996.dtsi
··· 2566 2566 power-domains = <&gcc USB30_GDSC>; 2567 2567 status = "disabled"; 2568 2568 2569 - usb@6a00000 { 2569 + dwc3@6a00000 { 2570 2570 compatible = "snps,dwc3"; 2571 2571 reg = <0x06a00000 0xcc00>; 2572 2572 interrupts = <0 131 IRQ_TYPE_LEVEL_HIGH>; ··· 2873 2873 qcom,select-utmi-as-pipe-clk; 2874 2874 status = "disabled"; 2875 2875 2876 - usb@7600000 { 2876 + dwc3@7600000 { 2877 2877 compatible = "snps,dwc3"; 2878 2878 reg = <0x07600000 0xcc00>; 2879 2879 interrupts = <0 138 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/msm8998.dtsi
··· 1964 1964 1965 1965 resets = <&gcc GCC_USB_30_BCR>; 1966 1966 1967 - usb3_dwc3: usb@a800000 { 1967 + usb3_dwc3: dwc3@a800000 { 1968 1968 compatible = "snps,dwc3"; 1969 1969 reg = <0x0a800000 0xcd00>; 1970 1970 interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
··· 337 337 &usb3 { 338 338 status = "okay"; 339 339 340 - usb@7580000 { 340 + dwc3@7580000 { 341 341 dr_mode = "host"; 342 342 }; 343 343 };
+2 -2
arch/arm64/boot/dts/qcom/qcs404.dtsi
··· 544 544 assigned-clock-rates = <19200000>, <200000000>; 545 545 status = "disabled"; 546 546 547 - usb@7580000 { 547 + dwc3@7580000 { 548 548 compatible = "snps,dwc3"; 549 549 reg = <0x07580000 0xcd00>; 550 550 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; ··· 573 573 assigned-clock-rates = <19200000>, <133333333>; 574 574 status = "disabled"; 575 575 576 - usb@78c0000 { 576 + dwc3@78c0000 { 577 577 compatible = "snps,dwc3"; 578 578 reg = <0x078c0000 0xcc00>; 579 579 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/sc7180.dtsi
··· 2756 2756 <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3 0>; 2757 2757 interconnect-names = "usb-ddr", "apps-usb"; 2758 2758 2759 - usb_1_dwc3: usb@a600000 { 2759 + usb_1_dwc3: dwc3@a600000 { 2760 2760 compatible = "snps,dwc3"; 2761 2761 reg = <0 0x0a600000 0 0xe000>; 2762 2762 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+2 -2
arch/arm64/boot/dts/qcom/sdm845.dtsi
··· 3781 3781 <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_0 0>; 3782 3782 interconnect-names = "usb-ddr", "apps-usb"; 3783 3783 3784 - usb_1_dwc3: usb@a600000 { 3784 + usb_1_dwc3: dwc3@a600000 { 3785 3785 compatible = "snps,dwc3"; 3786 3786 reg = <0 0x0a600000 0 0xcd00>; 3787 3787 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; ··· 3829 3829 <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_1 0>; 3830 3830 interconnect-names = "usb-ddr", "apps-usb"; 3831 3831 3832 - usb_2_dwc3: usb@a800000 { 3832 + usb_2_dwc3: dwc3@a800000 { 3833 3833 compatible = "snps,dwc3"; 3834 3834 reg = <0 0x0a800000 0 0xcd00>; 3835 3835 interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/sm8150.dtsi
··· 2344 2344 2345 2345 resets = <&gcc GCC_USB30_PRIM_BCR>; 2346 2346 2347 - usb_1_dwc3: usb@a600000 { 2347 + usb_1_dwc3: dwc3@a600000 { 2348 2348 compatible = "snps,dwc3"; 2349 2349 reg = <0 0x0a600000 0 0xcd00>; 2350 2350 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+6 -3
arch/arm64/kernel/smccc-call.S
··· 32 32 EXPORT_SYMBOL(__arm_smccc_sve_check) 33 33 34 34 .macro SMCCC instr 35 + stp x29, x30, [sp, #-16]! 36 + mov x29, sp 35 37 alternative_if ARM64_SVE 36 38 bl __arm_smccc_sve_check 37 39 alternative_else_nop_endif 38 40 \instr #0 39 - ldr x4, [sp] 41 + ldr x4, [sp, #16] 40 42 stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] 41 43 stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] 42 - ldr x4, [sp, #8] 44 + ldr x4, [sp, #24] 43 45 cbz x4, 1f /* no quirk structure */ 44 46 ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS] 45 47 cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6 46 48 b.ne 1f 47 49 str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS] 48 - 1: ret 50 + 1: ldp x29, x30, [sp], #16 51 + ret 49 52 .endm 50 53 51 54 /*
+8 -12
arch/arm64/mm/mmu.c
··· 1339 1339 return dt_virt; 1340 1340 } 1341 1341 1342 - #if CONFIG_PGTABLE_LEVELS > 3 1343 1342 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) 1344 1343 { 1345 1344 pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot)); ··· 1353 1354 return 1; 1354 1355 } 1355 1356 1356 - int pud_clear_huge(pud_t *pudp) 1357 - { 1358 - if (!pud_sect(READ_ONCE(*pudp))) 1359 - return 0; 1360 - pud_clear(pudp); 1361 - return 1; 1362 - } 1363 - #endif 1364 - 1365 - #if CONFIG_PGTABLE_LEVELS > 2 1366 1357 int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) 1367 1358 { 1368 1359 pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), mk_pmd_sect_prot(prot)); ··· 1367 1378 return 1; 1368 1379 } 1369 1380 1381 + int pud_clear_huge(pud_t *pudp) 1382 + { 1383 + if (!pud_sect(READ_ONCE(*pudp))) 1384 + return 0; 1385 + pud_clear(pudp); 1386 + return 1; 1387 + } 1388 + 1370 1389 int pmd_clear_huge(pmd_t *pmdp) 1371 1390 { 1372 1391 if (!pmd_sect(READ_ONCE(*pmdp))) ··· 1382 1385 pmd_clear(pmdp); 1383 1386 return 1; 1384 1387 } 1385 - #endif 1386 1388 1387 1389 int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) 1388 1390 {
+1
arch/m68k/Kconfig.machine
··· 33 33 depends on MMU 34 34 select MMU_MOTOROLA if MMU 35 35 select HAVE_ARCH_NVRAM_OPS 36 + select HAVE_PATA_PLATFORM 36 37 select LEGACY_TIMER_TICK 37 38 help 38 39 This option enables support for the Apple Macintosh series of
+1 -1
arch/nds32/mm/mmap.c
··· 59 59 60 60 vma = find_vma(mm, addr); 61 61 if (TASK_SIZE - len >= addr && 62 - (!vma || addr + len <= vma->vm_start)) 62 + (!vma || addr + len <= vm_start_gap(vma))) 63 63 return addr; 64 64 } 65 65
+2
arch/powerpc/kvm/book3s_hv.c
··· 2697 2697 HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; 2698 2698 if (cpu_has_feature(CPU_FTR_HVMODE)) { 2699 2699 vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); 2700 + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 2700 2701 if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) 2701 2702 vcpu->arch.hfscr |= HFSCR_TM; 2703 + #endif 2702 2704 } 2703 2705 if (cpu_has_feature(CPU_FTR_TM_COMP)) 2704 2706 vcpu->arch.hfscr |= HFSCR_TM;
+20
arch/powerpc/kvm/book3s_hv_nested.c
··· 302 302 if (vcpu->kvm->arch.l1_ptcr == 0) 303 303 return H_NOT_AVAILABLE; 304 304 305 + if (MSR_TM_TRANSACTIONAL(vcpu->arch.shregs.msr)) 306 + return H_BAD_MODE; 307 + 305 308 /* copy parameters in */ 306 309 hv_ptr = kvmppc_get_gpr(vcpu, 4); 307 310 regs_ptr = kvmppc_get_gpr(vcpu, 5); ··· 324 321 byteswap_pt_regs(&l2_regs); 325 322 if (l2_hv.vcpu_token >= NR_CPUS) 326 323 return H_PARAMETER; 324 + 325 + /* 326 + * L1 must have set up a suspended state to enter the L2 in a 327 + * transactional state, and only in that case. These have to be 328 + * filtered out here to prevent causing a TM Bad Thing in the 329 + * host HRFID. We could synthesize a TM Bad Thing back to the L1 330 + * here but there doesn't seem like much point. 331 + */ 332 + if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) { 333 + if (!MSR_TM_ACTIVE(l2_regs.msr)) 334 + return H_BAD_MODE; 335 + } else { 336 + if (l2_regs.msr & MSR_TS_MASK) 337 + return H_BAD_MODE; 338 + if (WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_TS_MASK)) 339 + return H_BAD_MODE; 340 + } 327 341 328 342 /* translate lpid */ 329 343 l2 = kvmhv_get_nested(vcpu->kvm, l2_hv.lpid, true);
+22 -3
arch/powerpc/kvm/book3s_hv_p9_entry.c
··· 317 317 */ 318 318 mtspr(SPRN_HDEC, hdec); 319 319 320 + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 321 + tm_return_to_guest: 322 + #endif 320 323 mtspr(SPRN_DAR, vcpu->arch.shregs.dar); 321 324 mtspr(SPRN_DSISR, vcpu->arch.shregs.dsisr); 322 325 mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0); ··· 418 415 * is in real suspend mode and is trying to transition to 419 416 * transactional mode. 420 417 */ 421 - if (local_paca->kvm_hstate.fake_suspend && 418 + if (!local_paca->kvm_hstate.fake_suspend && 422 419 (vcpu->arch.shregs.msr & MSR_TS_S)) { 423 420 if (kvmhv_p9_tm_emulation_early(vcpu)) { 424 - /* Prevent it being handled again. */ 425 - trap = 0; 421 + /* 422 + * Go straight back into the guest with the 423 + * new NIP/MSR as set by TM emulation. 424 + */ 425 + mtspr(SPRN_HSRR0, vcpu->arch.regs.nip); 426 + mtspr(SPRN_HSRR1, vcpu->arch.shregs.msr); 427 + 428 + /* 429 + * tm_return_to_guest re-loads SRR0/1, DAR, 430 + * DSISR after RI is cleared, in case they had 431 + * been clobbered by a MCE. 432 + */ 433 + __mtmsrd(0, 1); /* clear RI */ 434 + goto tm_return_to_guest; 426 435 } 427 436 } 428 437 #endif ··· 514 499 * If we are in real mode, only switch MMU on after the MMU is 515 500 * switched to host, to avoid the P9_RADIX_PREFETCH_BUG. 516 501 */ 502 + if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) && 503 + vcpu->arch.shregs.msr & MSR_TS_MASK) 504 + msr |= MSR_TS_S; 505 + 517 506 __mtmsrd(msr, 0); 518 507 519 508 end_timing(vcpu);
+22 -3
arch/powerpc/kvm/book3s_rtas.c
··· 242 242 * value so we can restore it on the way out. 243 243 */ 244 244 orig_rets = args.rets; 245 + if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) { 246 + /* 247 + * Don't overflow our args array: ensure there is room for 248 + * at least rets[0] (even if the call specifies 0 nret). 249 + * 250 + * Each handler must then check for the correct nargs and nret 251 + * values, but they may always return failure in rets[0]. 252 + */ 253 + rc = -EINVAL; 254 + goto fail; 255 + } 245 256 args.rets = &args.args[be32_to_cpu(args.nargs)]; 246 257 247 258 mutex_lock(&vcpu->kvm->arch.rtas_token_lock); ··· 280 269 fail: 281 270 /* 282 271 * We only get here if the guest has called RTAS with a bogus 283 - * args pointer. That means we can't get to the args, and so we 284 - * can't fail the RTAS call. So fail right out to userspace, 285 - * which should kill the guest. 272 + * args pointer or nargs/nret values that would overflow the 273 + * array. That means we can't get to the args, and so we can't 274 + * fail the RTAS call. So fail right out to userspace, which 275 + * should kill the guest. 276 + * 277 + * SLOF should actually pass the hcall return value from the 278 + * rtas handler call in r3, so enter_rtas could be modified to 279 + * return a failure indication in r3 and we could return such 280 + * errors to the guest rather than failing to host userspace. 281 + * However old guests that don't test for failure could then 282 + * continue silently after errors, so for now we won't do this. 286 283 */ 287 284 return rc; 288 285 }
+2 -2
arch/powerpc/kvm/powerpc.c
··· 2048 2048 { 2049 2049 struct kvm_enable_cap cap; 2050 2050 r = -EFAULT; 2051 - vcpu_load(vcpu); 2052 2051 if (copy_from_user(&cap, argp, sizeof(cap))) 2053 2052 goto out; 2053 + vcpu_load(vcpu); 2054 2054 r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); 2055 2055 vcpu_put(vcpu); 2056 2056 break; ··· 2074 2074 case KVM_DIRTY_TLB: { 2075 2075 struct kvm_dirty_tlb dirty; 2076 2076 r = -EFAULT; 2077 - vcpu_load(vcpu); 2078 2077 if (copy_from_user(&dirty, argp, sizeof(dirty))) 2079 2078 goto out; 2079 + vcpu_load(vcpu); 2080 2080 r = kvm_vcpu_ioctl_dirty_tlb(vcpu, &dirty); 2081 2081 vcpu_put(vcpu); 2082 2082 break;
+10
arch/powerpc/mm/nohash/8xx.c
··· 240 240 mtspr(SPRN_MD_AP, MD_APG_KUAP); 241 241 } 242 242 #endif 243 + 244 + int pud_clear_huge(pud_t *pud) 245 + { 246 + return 0; 247 + } 248 + 249 + int pmd_clear_huge(pmd_t *pmd) 250 + { 251 + return 0; 252 + }
+1
arch/powerpc/platforms/pasemi/idle.c
··· 42 42 switch (regs->msr & SRR1_WAKEMASK) { 43 43 case SRR1_WAKEDEC: 44 44 set_dec(1); 45 + break; 45 46 case SRR1_WAKEEE: 46 47 /* 47 48 * Handle these when interrupts get re-enabled and we take
+2 -2
arch/riscv/include/asm/efi.h
··· 27 27 28 28 #define ARCH_EFI_IRQ_FLAGS_MASK (SR_IE | SR_SPIE) 29 29 30 - /* Load initrd at enough distance from DRAM start */ 30 + /* Load initrd anywhere in system RAM */ 31 31 static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr) 32 32 { 33 - return image_addr + SZ_256M; 33 + return ULONG_MAX; 34 34 } 35 35 36 36 #define alloc_screen_info(x...) (&screen_info)
+5 -1
arch/riscv/kernel/stacktrace.c
··· 132 132 { 133 133 unsigned long pc = 0; 134 134 135 - if (likely(task && task != current && !task_is_running(task))) 135 + if (likely(task && task != current && !task_is_running(task))) { 136 + if (!try_get_task_stack(task)) 137 + return 0; 136 138 walk_stackframe(task, NULL, save_wchan, &pc); 139 + put_task_stack(task); 140 + } 137 141 return pc; 138 142 } 139 143
+13 -14
arch/riscv/lib/uaccess.S
··· 30 30 * t0 - end of uncopied dst 31 31 */ 32 32 add t0, a0, a2 33 - bgtu a0, t0, 5f 34 33 35 34 /* 36 35 * Use byte copy only if too small. 36 + * SZREG holds 4 for RV32 and 8 for RV64 37 37 */ 38 - li a3, 8*SZREG /* size must be larger than size in word_copy */ 38 + li a3, 9*SZREG /* size must be larger than size in word_copy */ 39 39 bltu a2, a3, .Lbyte_copy_tail 40 40 41 41 /* 42 - * Copy first bytes until dst is align to word boundary. 42 + * Copy first bytes until dst is aligned to word boundary. 43 43 * a0 - start of dst 44 44 * t1 - start of aligned dst 45 45 */ 46 46 addi t1, a0, SZREG-1 47 47 andi t1, t1, ~(SZREG-1) 48 48 /* dst is already aligned, skip */ 49 - beq a0, t1, .Lskip_first_bytes 49 + beq a0, t1, .Lskip_align_dst 50 50 1: 51 51 /* a5 - one byte for copying data */ 52 52 fixup lb a5, 0(a1), 10f ··· 55 55 addi a0, a0, 1 /* dst */ 56 56 bltu a0, t1, 1b /* t1 - start of aligned dst */ 57 57 58 - .Lskip_first_bytes: 58 + .Lskip_align_dst: 59 59 /* 60 60 * Now dst is aligned. 61 61 * Use shift-copy if src is misaligned. ··· 72 72 * 73 73 * a0 - start of aligned dst 74 74 * a1 - start of aligned src 75 - * a3 - a1 & mask:(SZREG-1) 76 75 * t0 - end of aligned dst 77 76 */ 78 - addi t0, t0, -(8*SZREG-1) /* not to over run */ 77 + addi t0, t0, -(8*SZREG) /* not to over run */ 79 78 2: 80 79 fixup REG_L a4, 0(a1), 10f 81 80 fixup REG_L a5, SZREG(a1), 10f ··· 96 97 addi a1, a1, 8*SZREG 97 98 bltu a0, t0, 2b 98 99 99 - addi t0, t0, 8*SZREG-1 /* revert to original value */ 100 + addi t0, t0, 8*SZREG /* revert to original value */ 100 101 j .Lbyte_copy_tail 101 102 102 103 .Lshift_copy: ··· 106 107 * For misaligned copy we still perform aligned word copy, but 107 108 * we need to use the value fetched from the previous iteration and 108 109 * do some shifts. 109 - * This is safe because reading less than a word size. 110 + * This is safe because reading is less than a word size. 110 111 * 111 112 * a0 - start of aligned dst 112 113 * a1 - start of src ··· 116 117 */ 117 118 /* calculating aligned word boundary for dst */ 118 119 andi t1, t0, ~(SZREG-1) 119 - /* Converting unaligned src to aligned arc */ 120 + /* Converting unaligned src to aligned src */ 120 121 andi a1, a1, ~(SZREG-1) 121 122 122 123 /* ··· 124 125 * t3 - prev shift 125 126 * t4 - current shift 126 127 */ 127 - slli t3, a3, LGREG 128 + slli t3, a3, 3 /* converting bytes in a3 to bits */ 128 129 li a5, SZREG*8 129 130 sub t4, a5, t3 130 131 131 - /* Load the first word to combine with seceond word */ 132 + /* Load the first word to combine with second word */ 132 133 fixup REG_L a5, 0(a1), 10f 133 134 134 135 3: ··· 160 161 * a1 - start of remaining src 161 162 * t0 - end of remaining dst 162 163 */ 163 - bgeu a0, t0, 5f 164 + bgeu a0, t0, .Lout_copy_user /* check if end of copy */ 164 165 4: 165 166 fixup lb a5, 0(a1), 10f 166 167 addi a1, a1, 1 /* src */ ··· 168 169 addi a0, a0, 1 /* dst */ 169 170 bltu a0, t0, 4b /* t0 - end of dst */ 170 171 171 - 5: 172 + .Lout_copy_user: 172 173 /* Disable access to user memory */ 173 174 csrc CSR_STATUS, t6 174 175 li a0, 0
+28 -4
arch/riscv/mm/init.c
··· 127 127 } 128 128 129 129 /* 130 - * The default maximal physical memory size is -PAGE_OFFSET, 131 - * limit the memory size via mem. 130 + * The default maximal physical memory size is -PAGE_OFFSET for 32-bit kernel, 131 + * whereas for 64-bit kernel, the end of the virtual address space is occupied 132 + * by the modules/BPF/kernel mappings which reduces the available size of the 133 + * linear mapping. 134 + * Limit the memory size via mem. 132 135 */ 136 + #ifdef CONFIG_64BIT 137 + static phys_addr_t memory_limit = -PAGE_OFFSET - SZ_4G; 138 + #else 133 139 static phys_addr_t memory_limit = -PAGE_OFFSET; 140 + #endif 134 141 135 142 static int __init early_mem(char *p) 136 143 { ··· 159 152 { 160 153 phys_addr_t vmlinux_end = __pa_symbol(&_end); 161 154 phys_addr_t vmlinux_start = __pa_symbol(&_start); 162 - phys_addr_t max_mapped_addr = __pa(~(ulong)0); 155 + phys_addr_t __maybe_unused max_mapped_addr; 163 156 phys_addr_t dram_end; 164 157 165 158 #ifdef CONFIG_XIP_KERNEL ··· 182 175 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); 183 176 184 177 dram_end = memblock_end_of_DRAM(); 178 + 179 + #ifndef CONFIG_64BIT 185 180 /* 186 181 * memblock allocator is not aware of the fact that last 4K bytes of 187 182 * the addressable memory can not be mapped because of IS_ERR_VALUE 188 183 * macro. Make sure that last 4k bytes are not usable by memblock 189 - * if end of dram is equal to maximum addressable memory. 184 + * if end of dram is equal to maximum addressable memory. For 64-bit 185 + * kernel, this problem can't happen here as the end of the virtual 186 + * address space is occupied by the kernel mapping then this check must 187 + * be done in create_kernel_page_table. 190 188 */ 189 + max_mapped_addr = __pa(~(ulong)0); 191 190 if (max_mapped_addr == (dram_end - 1)) 192 191 memblock_set_current_limit(max_mapped_addr - 4096); 192 + #endif 193 193 194 194 min_low_pfn = PFN_UP(memblock_start_of_DRAM()); 195 195 max_low_pfn = max_pfn = PFN_DOWN(dram_end); ··· 584 570 BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); 585 571 BUG_ON((kernel_map.phys_addr % map_size) != 0); 586 572 573 + #ifdef CONFIG_64BIT 574 + /* 575 + * The last 4K bytes of the addressable memory can not be mapped because 576 + * of IS_ERR_VALUE macro. 577 + */ 578 + BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K); 579 + #endif 580 + 587 581 pt_ops.alloc_pte = alloc_pte_early; 588 582 pt_ops.get_pte_virt = get_pte_virt_early; 589 583 #ifndef __PAGETABLE_PMD_FOLDED ··· 731 709 if (start <= __pa(PAGE_OFFSET) && 732 710 __pa(PAGE_OFFSET) < end) 733 711 start = __pa(PAGE_OFFSET); 712 + if (end >= __pa(PAGE_OFFSET) + memory_limit) 713 + end = __pa(PAGE_OFFSET) + memory_limit; 734 714 735 715 map_size = best_map_size(start, end - start); 736 716 for (pa = start; pa < end; pa += map_size) {
+4 -15
arch/s390/boot/text_dma.S
··· 9 9 #include <asm/errno.h> 10 10 #include <asm/sigp.h> 11 11 12 - #ifdef CC_USING_EXPOLINE 13 - .pushsection .dma.text.__s390_indirect_jump_r14,"axG" 14 - __dma__s390_indirect_jump_r14: 15 - larl %r1,0f 16 - ex 0,0(%r1) 17 - j . 18 - 0: br %r14 19 - .popsection 20 - #endif 21 - 22 12 .section .dma.text,"ax" 23 13 /* 24 14 * Simplified version of expoline thunk. The normal thunks can not be used here, ··· 17 27 * affects a few functions that are not performance-relevant. 18 28 */ 19 29 .macro BR_EX_DMA_r14 20 - #ifdef CC_USING_EXPOLINE 21 - jg __dma__s390_indirect_jump_r14 22 - #else 23 - br %r14 24 - #endif 30 + larl %r1,0f 31 + ex 0,0(%r1) 32 + j . 33 + 0: br %r14 25 34 .endm 26 35 27 36 /*
+18 -9
arch/s390/configs/debug_defconfig
··· 5 5 CONFIG_AUDIT=y 6 6 CONFIG_NO_HZ_IDLE=y 7 7 CONFIG_HIGH_RES_TIMERS=y 8 + CONFIG_BPF_SYSCALL=y 9 + CONFIG_BPF_JIT=y 10 + CONFIG_BPF_JIT_ALWAYS_ON=y 11 + CONFIG_BPF_LSM=y 8 12 CONFIG_PREEMPT=y 13 + CONFIG_SCHED_CORE=y 9 14 CONFIG_BSD_PROCESS_ACCT=y 10 15 CONFIG_BSD_PROCESS_ACCT_V3=y 11 16 CONFIG_TASKSTATS=y ··· 33 28 CONFIG_CGROUP_CPUACCT=y 34 29 CONFIG_CGROUP_PERF=y 35 30 CONFIG_CGROUP_BPF=y 31 + CONFIG_CGROUP_MISC=y 36 32 CONFIG_NAMESPACES=y 37 33 CONFIG_USER_NS=y 38 34 CONFIG_CHECKPOINT_RESTORE=y 39 35 CONFIG_SCHED_AUTOGROUP=y 40 36 CONFIG_EXPERT=y 41 37 # CONFIG_SYSFS_SYSCALL is not set 42 - CONFIG_BPF_LSM=y 43 - CONFIG_BPF_SYSCALL=y 44 38 CONFIG_USERFAULTFD=y 45 39 # CONFIG_COMPAT_BRK is not set 46 40 CONFIG_PROFILING=y ··· 80 76 CONFIG_BLK_WBT=y 81 77 CONFIG_BLK_CGROUP_IOLATENCY=y 82 78 CONFIG_BLK_CGROUP_IOCOST=y 79 + CONFIG_BLK_CGROUP_IOPRIO=y 83 80 CONFIG_BLK_INLINE_ENCRYPTION=y 84 81 CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y 85 82 CONFIG_PARTITION_ADVANCED=y ··· 100 95 CONFIG_FRONTSWAP=y 101 96 CONFIG_CMA_DEBUG=y 102 97 CONFIG_CMA_DEBUGFS=y 98 + CONFIG_CMA_SYSFS=y 103 99 CONFIG_CMA_AREAS=7 104 100 CONFIG_MEM_SOFT_DIRTY=y 105 101 CONFIG_ZSWAP=y ··· 164 158 CONFIG_MPTCP=y 165 159 CONFIG_NETFILTER=y 166 160 CONFIG_BRIDGE_NETFILTER=m 161 + CONFIG_NETFILTER_NETLINK_HOOK=m 167 162 CONFIG_NF_CONNTRACK=m 168 163 CONFIG_NF_CONNTRACK_SECMARK=y 169 164 CONFIG_NF_CONNTRACK_EVENTS=y ··· 287 280 CONFIG_IP_VS_PE_SIP=m 288 281 CONFIG_NFT_FIB_IPV4=m 289 282 CONFIG_NF_TABLES_ARP=y 283 + CONFIG_NF_LOG_IPV4=m 290 284 CONFIG_IP_NF_IPTABLES=m 291 285 CONFIG_IP_NF_MATCH_AH=m 292 286 CONFIG_IP_NF_MATCH_ECN=m ··· 392 384 CONFIG_VIRTIO_VSOCKETS=m 393 385 CONFIG_NETLINK_DIAG=m 394 386 CONFIG_CGROUP_NET_PRIO=y 395 - CONFIG_BPF_JIT=y 396 387 CONFIG_NET_PKTGEN=m 397 388 CONFIG_PCI=y 398 - CONFIG_PCI_IOV=y 399 389 # CONFIG_PCIEASPM is not set 400 390 CONFIG_PCI_DEBUG=y 391 + CONFIG_PCI_IOV=y 401 392 CONFIG_HOTPLUG_PCI=y 402 393 CONFIG_HOTPLUG_PCI_S390=y 403 394 CONFIG_DEVTMPFS=y ··· 443 436 CONFIG_MD_FAULTY=m 444 437 CONFIG_MD_CLUSTER=m 445 438 CONFIG_BCACHE=m 446 - CONFIG_BLK_DEV_DM=m 439 + CONFIG_BLK_DEV_DM=y 447 440 CONFIG_DM_UNSTRIPED=m 448 441 CONFIG_DM_CRYPT=m 449 442 CONFIG_DM_SNAPSHOT=m ··· 460 453 CONFIG_DM_MULTIPATH_HST=m 461 454 CONFIG_DM_MULTIPATH_IOA=m 462 455 CONFIG_DM_DELAY=m 456 + CONFIG_DM_INIT=y 463 457 CONFIG_DM_UEVENT=y 464 458 CONFIG_DM_FLAKEY=m 465 459 CONFIG_DM_VERITY=m ··· 503 495 # CONFIG_NET_VENDOR_GOOGLE is not set 504 496 # CONFIG_NET_VENDOR_HUAWEI is not set 505 497 # CONFIG_NET_VENDOR_INTEL is not set 498 + # CONFIG_NET_VENDOR_MICROSOFT is not set 506 499 # CONFIG_NET_VENDOR_MARVELL is not set 507 500 CONFIG_MLX4_EN=m 508 501 CONFIG_MLX5_CORE=m ··· 560 551 CONFIG_LEGACY_PTY_COUNT=0 561 552 CONFIG_VIRTIO_CONSOLE=m 562 553 CONFIG_HW_RANDOM_VIRTIO=m 563 - CONFIG_RAW_DRIVER=m 564 554 CONFIG_HANGCHECK_TIMER=m 565 555 CONFIG_TN3270_FS=y 566 556 CONFIG_PPS=m ··· 582 574 CONFIG_VFIO=m 583 575 CONFIG_VFIO_PCI=m 584 576 CONFIG_VFIO_MDEV=m 585 - CONFIG_VFIO_MDEV_DEVICE=m 586 577 CONFIG_VIRTIO_PCI=m 587 578 CONFIG_VIRTIO_BALLOON=m 588 579 CONFIG_VIRTIO_INPUT=y ··· 626 619 CONFIG_CUSE=m 627 620 CONFIG_VIRTIO_FS=m 628 621 CONFIG_OVERLAY_FS=m 622 + CONFIG_NETFS_STATS=y 629 623 CONFIG_FSCACHE=m 630 624 CONFIG_CACHEFILES=m 631 625 CONFIG_ISO9660_FS=y ··· 662 654 CONFIG_NFSD_V4=y 663 655 CONFIG_NFSD_V4_SECURITY_LABEL=y 664 656 CONFIG_CIFS=m 665 - CONFIG_CIFS_STATS2=y 666 657 CONFIG_CIFS_WEAK_PW_HASH=y 667 658 CONFIG_CIFS_UPCALL=y 668 659 CONFIG_CIFS_XATTR=y ··· 689 682 CONFIG_SECURITY_SELINUX_DISABLE=y 690 683 CONFIG_SECURITY_LOCKDOWN_LSM=y 691 684 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y 685 + CONFIG_SECURITY_LANDLOCK=y 692 686 CONFIG_INTEGRITY_SIGNATURE=y 693 687 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y 694 688 CONFIG_IMA=y ··· 704 696 CONFIG_CRYPTO_TEST=m 705 697 CONFIG_CRYPTO_DH=m 706 698 CONFIG_CRYPTO_ECDH=m 699 + CONFIG_CRYPTO_ECDSA=m 707 700 CONFIG_CRYPTO_ECRDSA=m 708 701 CONFIG_CRYPTO_SM2=m 709 702 CONFIG_CRYPTO_CURVE25519=m ··· 852 843 CONFIG_FAIL_FUNCTION=y 853 844 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y 854 845 CONFIG_LKDTM=m 855 - CONFIG_TEST_LIST_SORT=y 856 846 CONFIG_TEST_MIN_HEAP=y 857 847 CONFIG_TEST_SORT=y 858 848 CONFIG_KPROBES_SANITY_TEST=y ··· 861 853 CONFIG_ATOMIC64_SELFTEST=y 862 854 CONFIG_TEST_BITOPS=m 863 855 CONFIG_TEST_BPF=m 856 + CONFIG_TEST_LIVEPATCH=m
+19 -8
arch/s390/configs/defconfig
··· 4 4 CONFIG_AUDIT=y 5 5 CONFIG_NO_HZ_IDLE=y 6 6 CONFIG_HIGH_RES_TIMERS=y 7 + CONFIG_BPF_SYSCALL=y 8 + CONFIG_BPF_JIT=y 9 + CONFIG_BPF_JIT_ALWAYS_ON=y 10 + CONFIG_BPF_LSM=y 11 + CONFIG_SCHED_CORE=y 7 12 CONFIG_BSD_PROCESS_ACCT=y 8 13 CONFIG_BSD_PROCESS_ACCT_V3=y 9 14 CONFIG_TASKSTATS=y ··· 31 26 CONFIG_CGROUP_CPUACCT=y 32 27 CONFIG_CGROUP_PERF=y 33 28 CONFIG_CGROUP_BPF=y 29 + CONFIG_CGROUP_MISC=y 34 30 CONFIG_NAMESPACES=y 35 31 CONFIG_USER_NS=y 36 32 CONFIG_CHECKPOINT_RESTORE=y 37 33 CONFIG_SCHED_AUTOGROUP=y 38 34 CONFIG_EXPERT=y 39 35 # CONFIG_SYSFS_SYSCALL is not set 40 - CONFIG_BPF_LSM=y 41 - CONFIG_BPF_SYSCALL=y 42 36 CONFIG_USERFAULTFD=y 43 37 # CONFIG_COMPAT_BRK is not set 44 38 CONFIG_PROFILING=y ··· 74 70 CONFIG_BLK_WBT=y 75 71 CONFIG_BLK_CGROUP_IOLATENCY=y 76 72 CONFIG_BLK_CGROUP_IOCOST=y 73 + CONFIG_BLK_CGROUP_IOPRIO=y 77 74 CONFIG_BLK_INLINE_ENCRYPTION=y 78 75 CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y 79 76 CONFIG_PARTITION_ADVANCED=y ··· 92 87 CONFIG_TRANSPARENT_HUGEPAGE=y 93 88 CONFIG_CLEANCACHE=y 94 89 CONFIG_FRONTSWAP=y 90 + CONFIG_CMA_SYSFS=y 95 91 CONFIG_CMA_AREAS=7 96 92 CONFIG_MEM_SOFT_DIRTY=y 97 93 CONFIG_ZSWAP=y ··· 155 149 CONFIG_MPTCP=y 156 150 CONFIG_NETFILTER=y 157 151 CONFIG_BRIDGE_NETFILTER=m 152 + CONFIG_NETFILTER_NETLINK_HOOK=m 158 153 CONFIG_NF_CONNTRACK=m 159 154 CONFIG_NF_CONNTRACK_SECMARK=y 160 155 CONFIG_NF_CONNTRACK_EVENTS=y ··· 278 271 CONFIG_IP_VS_PE_SIP=m 279 272 CONFIG_NFT_FIB_IPV4=m 280 273 CONFIG_NF_TABLES_ARP=y 274 + CONFIG_NF_LOG_IPV4=m 281 275 CONFIG_IP_NF_IPTABLES=m 282 276 CONFIG_IP_NF_MATCH_AH=m 283 277 CONFIG_IP_NF_MATCH_ECN=m ··· 382 374 CONFIG_VIRTIO_VSOCKETS=m 383 375 CONFIG_NETLINK_DIAG=m 384 376 CONFIG_CGROUP_NET_PRIO=y 385 - CONFIG_BPF_JIT=y 386 377 CONFIG_NET_PKTGEN=m 387 378 CONFIG_PCI=y 388 - CONFIG_PCI_IOV=y 389 379 # CONFIG_PCIEASPM is not set 380 + CONFIG_PCI_IOV=y 390 381 CONFIG_HOTPLUG_PCI=y 391 382 CONFIG_HOTPLUG_PCI_S390=y 392 383 CONFIG_UEVENT_HELPER=y ··· 434 427 CONFIG_MD_FAULTY=m 435 428 CONFIG_MD_CLUSTER=m 436 429 CONFIG_BCACHE=m 437 - CONFIG_BLK_DEV_DM=m 430 + CONFIG_BLK_DEV_DM=y 438 431 CONFIG_DM_UNSTRIPED=m 439 432 CONFIG_DM_CRYPT=m 440 433 CONFIG_DM_SNAPSHOT=m ··· 451 444 CONFIG_DM_MULTIPATH_HST=m 452 445 CONFIG_DM_MULTIPATH_IOA=m 453 446 CONFIG_DM_DELAY=m 447 + CONFIG_DM_INIT=y 454 448 CONFIG_DM_UEVENT=y 455 449 CONFIG_DM_FLAKEY=m 456 450 CONFIG_DM_VERITY=m ··· 495 487 # CONFIG_NET_VENDOR_GOOGLE is not set 496 488 # CONFIG_NET_VENDOR_HUAWEI is not set 497 489 # CONFIG_NET_VENDOR_INTEL is not set 490 + # CONFIG_NET_VENDOR_MICROSOFT is not set 498 491 # CONFIG_NET_VENDOR_MARVELL is not set 499 492 CONFIG_MLX4_EN=m 500 493 CONFIG_MLX5_CORE=m ··· 552 543 CONFIG_LEGACY_PTY_COUNT=0 553 544 CONFIG_VIRTIO_CONSOLE=m 554 545 CONFIG_HW_RANDOM_VIRTIO=m 555 - CONFIG_RAW_DRIVER=m 556 546 CONFIG_HANGCHECK_TIMER=m 557 547 CONFIG_TN3270_FS=y 558 548 # CONFIG_PTP_1588_CLOCK is not set ··· 574 566 CONFIG_VFIO=m 575 567 CONFIG_VFIO_PCI=m 576 568 CONFIG_VFIO_MDEV=m 577 - CONFIG_VFIO_MDEV_DEVICE=m 578 569 CONFIG_VIRTIO_PCI=m 579 570 CONFIG_VIRTIO_BALLOON=m 580 571 CONFIG_VIRTIO_INPUT=y ··· 614 607 CONFIG_CUSE=m 615 608 CONFIG_VIRTIO_FS=m 616 609 CONFIG_OVERLAY_FS=m 610 + CONFIG_NETFS_STATS=y 617 611 CONFIG_FSCACHE=m 618 612 CONFIG_CACHEFILES=m 619 613 CONFIG_ISO9660_FS=y ··· 650 642 CONFIG_NFSD_V4=y 651 643 CONFIG_NFSD_V4_SECURITY_LABEL=y 652 644 CONFIG_CIFS=m 653 - CONFIG_CIFS_STATS2=y 654 645 CONFIG_CIFS_WEAK_PW_HASH=y 655 646 CONFIG_CIFS_UPCALL=y 656 647 CONFIG_CIFS_XATTR=y ··· 676 669 CONFIG_SECURITY_SELINUX_DISABLE=y 677 670 CONFIG_SECURITY_LOCKDOWN_LSM=y 678 671 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y 672 + CONFIG_SECURITY_LANDLOCK=y 679 673 CONFIG_INTEGRITY_SIGNATURE=y 680 674 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y 681 675 CONFIG_IMA=y ··· 692 684 CONFIG_CRYPTO_TEST=m 693 685 CONFIG_CRYPTO_DH=m 694 686 CONFIG_CRYPTO_ECDH=m 687 + CONFIG_CRYPTO_ECDSA=m 695 688 CONFIG_CRYPTO_ECRDSA=m 696 689 CONFIG_CRYPTO_SM2=m 697 690 CONFIG_CRYPTO_CURVE25519=m ··· 763 754 CONFIG_DMA_CMA=y 764 755 CONFIG_CMA_SIZE_MBYTES=0 765 756 CONFIG_PRINTK_TIME=y 757 + CONFIG_DYNAMIC_DEBUG=y 766 758 CONFIG_DEBUG_INFO=y 767 759 CONFIG_DEBUG_INFO_DWARF4=y 768 760 CONFIG_GDB_SCRIPTS=y ··· 791 781 CONFIG_PERCPU_TEST=m 792 782 CONFIG_ATOMIC64_SELFTEST=y 793 783 CONFIG_TEST_BPF=m 784 + CONFIG_TEST_LIVEPATCH=m
+1 -2
arch/s390/configs/zfcpdump_defconfig
··· 29 29 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 30 30 # CONFIG_COMPACTION is not set 31 31 # CONFIG_MIGRATION is not set 32 - # CONFIG_BOUNCE is not set 33 32 CONFIG_NET=y 34 33 # CONFIG_IUCV is not set 34 + # CONFIG_PCPU_DEV_REFCNT is not set 35 35 # CONFIG_ETHTOOL_NETLINK is not set 36 36 CONFIG_DEVTMPFS=y 37 37 CONFIG_BLK_DEV_RAM=y ··· 51 51 # CONFIG_SERIO is not set 52 52 # CONFIG_HVC_IUCV is not set 53 53 # CONFIG_HW_RANDOM_S390 is not set 54 - CONFIG_RAW_DRIVER=y 55 54 # CONFIG_HMC_DRV is not set 56 55 # CONFIG_S390_TAPE is not set 57 56 # CONFIG_VMCP is not set
+1
arch/s390/include/asm/ftrace.h
··· 19 19 20 20 extern char ftrace_graph_caller_end; 21 21 extern unsigned long ftrace_plt; 22 + extern void *ftrace_func; 22 23 23 24 struct dyn_arch_ftrace { }; 24 25
+2
arch/s390/kernel/ftrace.c
··· 40 40 * trampoline (ftrace_plt), which clobbers also r1. 41 41 */ 42 42 43 + void *ftrace_func __read_mostly = ftrace_stub; 43 44 unsigned long ftrace_plt; 44 45 45 46 int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, ··· 86 85 87 86 int ftrace_update_ftrace_func(ftrace_func_t func) 88 87 { 88 + ftrace_func = func; 89 89 return 0; 90 90 } 91 91
+2 -2
arch/s390/kernel/mcount.S
··· 59 59 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES 60 60 aghik %r2,%r0,-MCOUNT_INSN_SIZE 61 61 lgrl %r4,function_trace_op 62 - lgrl %r1,ftrace_trace_function 62 + lgrl %r1,ftrace_func 63 63 #else 64 64 lgr %r2,%r0 65 65 aghi %r2,-MCOUNT_INSN_SIZE 66 66 larl %r4,function_trace_op 67 67 lg %r4,0(%r4) 68 - larl %r1,ftrace_trace_function 68 + larl %r1,ftrace_func 69 69 lg %r1,0(%r1) 70 70 #endif 71 71 lgr %r3,%r14
+1 -1
arch/s390/kernel/perf_cpum_cf.c
··· 745 745 if (!cf_dbg) { 746 746 pr_err("Registration of s390dbf(cpum_cf) failed\n"); 747 747 return -ENOMEM; 748 - }; 748 + } 749 749 debug_register_view(cf_dbg, &debug_sprintf_view); 750 750 751 751 cpumf_pmu.attr_groups = cpumf_cf_event_group();
+1
arch/s390/kernel/vdso32/Makefile
··· 29 29 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) 30 30 31 31 obj-y += vdso32_wrapper.o 32 + targets += vdso32.lds 32 33 CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) 33 34 34 35 # Disable gcov profiling, ubsan and kasan for VDSO code
+1 -1
arch/s390/net/bpf_jit_comp.c
··· 112 112 { 113 113 u32 r1 = reg2hex[b1]; 114 114 115 - if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15) 115 + if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1]) 116 116 jit->seen_reg[r1] = 1; 117 117 } 118 118
+1 -1
arch/x86/kernel/cpu/mshyperv.c
··· 237 237 for_each_present_cpu(i) { 238 238 if (i == 0) 239 239 continue; 240 - ret = hv_call_add_logical_proc(numa_cpu_node(i), i, i); 240 + ret = hv_call_add_logical_proc(numa_cpu_node(i), i, cpu_physical_id(i)); 241 241 BUG_ON(ret); 242 242 } 243 243
+4 -3
arch/x86/kernel/jump_label.c
··· 79 79 return (struct jump_label_patch){.code = code, .size = size}; 80 80 } 81 81 82 - static inline void __jump_label_transform(struct jump_entry *entry, 83 - enum jump_label_type type, 84 - int init) 82 + static __always_inline void 83 + __jump_label_transform(struct jump_entry *entry, 84 + enum jump_label_type type, 85 + int init) 85 86 { 86 87 const struct jump_label_patch jlp = __jump_label_patch(entry, type); 87 88
+15 -19
arch/x86/mm/pgtable.c
··· 682 682 } 683 683 #endif 684 684 685 - #if CONFIG_PGTABLE_LEVELS > 3 686 685 /** 687 686 * pud_set_huge - setup kernel PUD mapping 688 687 * ··· 721 722 } 722 723 723 724 /** 724 - * pud_clear_huge - clear kernel PUD mapping when it is set 725 - * 726 - * Returns 1 on success and 0 on failure (no PUD map is found). 727 - */ 728 - int pud_clear_huge(pud_t *pud) 729 - { 730 - if (pud_large(*pud)) { 731 - pud_clear(pud); 732 - return 1; 733 - } 734 - 735 - return 0; 736 - } 737 - #endif 738 - 739 - #if CONFIG_PGTABLE_LEVELS > 2 740 - /** 741 725 * pmd_set_huge - setup kernel PMD mapping 742 726 * 743 727 * See text over pud_set_huge() above. ··· 751 769 } 752 770 753 771 /** 772 + * pud_clear_huge - clear kernel PUD mapping when it is set 773 + * 774 + * Returns 1 on success and 0 on failure (no PUD map is found). 775 + */ 776 + int pud_clear_huge(pud_t *pud) 777 + { 778 + if (pud_large(*pud)) { 779 + pud_clear(pud); 780 + return 1; 781 + } 782 + 783 + return 0; 784 + } 785 + 786 + /** 754 787 * pmd_clear_huge - clear kernel PMD mapping when it is set 755 788 * 756 789 * Returns 1 on success and 0 on failure (no PMD map is found). ··· 779 782 780 783 return 0; 781 784 } 782 - #endif 783 785 784 786 #ifdef CONFIG_X86_64 785 787 /**
+1 -1
drivers/acpi/Kconfig
··· 370 370 config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD 371 371 bool "Override ACPI tables from built-in initrd" 372 372 depends on ACPI_TABLE_UPGRADE 373 - depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION="" 373 + depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION_NONE 374 374 help 375 375 This option provides functionality to override arbitrary ACPI tables 376 376 from built-in uncompressed initrd.
+3 -4
drivers/acpi/utils.c
··· 860 860 * Return the next match of ACPI device if another matching device was present 861 861 * at the moment of invocation, or NULL otherwise. 862 862 * 863 - * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g. 864 - * in the case of a hotplug event. That said, the caller should ensure that 865 - * this will never happen. 866 - * 867 863 * The caller is responsible for invoking acpi_dev_put() on the returned device. 864 + * On the other hand the function invokes acpi_dev_put() on the given @adev 865 + * assuming that its reference counter had been increased beforehand. 868 866 * 869 867 * See additional information in acpi_dev_present() as well. 870 868 */ ··· 878 880 match.hrv = hrv; 879 881 880 882 dev = bus_find_device(&acpi_bus_type, start, &match, acpi_dev_match_cb); 883 + acpi_dev_put(adev); 881 884 return dev ? to_acpi_device(dev) : NULL; 882 885 } 883 886 EXPORT_SYMBOL(acpi_dev_get_next_match_dev);
+7 -1
drivers/base/auxiliary.c
··· 229 229 int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, 230 230 struct module *owner, const char *modname) 231 231 { 232 + int ret; 233 + 232 234 if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) 233 235 return -EINVAL; 234 236 ··· 246 244 auxdrv->driver.bus = &auxiliary_bus_type; 247 245 auxdrv->driver.mod_name = modname; 248 246 249 - return driver_register(&auxdrv->driver); 247 + ret = driver_register(&auxdrv->driver); 248 + if (ret) 249 + kfree(auxdrv->driver.name); 250 + 251 + return ret; 250 252 } 251 253 EXPORT_SYMBOL_GPL(__auxiliary_driver_register); 252 254
+4 -2
drivers/base/core.c
··· 574 574 return; 575 575 } 576 576 577 - snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); 578 - sysfs_remove_link(&con->kobj, buf); 577 + if (device_is_registered(con)) { 578 + snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); 579 + sysfs_remove_link(&con->kobj, buf); 580 + } 579 581 snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con)); 580 582 sysfs_remove_link(&sup->kobj, buf); 581 583 kfree(buf);
+13 -20
drivers/block/rbd.c
··· 4100 4100 4101 4101 static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) 4102 4102 { 4103 - bool need_wait; 4104 - 4105 4103 dout("%s rbd_dev %p\n", __func__, rbd_dev); 4106 4104 lockdep_assert_held_write(&rbd_dev->lock_rwsem); 4107 4105 ··· 4111 4113 */ 4112 4114 rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING; 4113 4115 rbd_assert(!completion_done(&rbd_dev->releasing_wait)); 4114 - need_wait = !list_empty(&rbd_dev->running_list); 4115 - downgrade_write(&rbd_dev->lock_rwsem); 4116 - if (need_wait) 4117 - wait_for_completion(&rbd_dev->releasing_wait); 4118 - up_read(&rbd_dev->lock_rwsem); 4116 + if (list_empty(&rbd_dev->running_list)) 4117 + return true; 4118 + 4119 + up_write(&rbd_dev->lock_rwsem); 4120 + wait_for_completion(&rbd_dev->releasing_wait); 4119 4121 4120 4122 down_write(&rbd_dev->lock_rwsem); 4121 4123 if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING) ··· 4201 4203 if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { 4202 4204 down_write(&rbd_dev->lock_rwsem); 4203 4205 if (rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { 4204 - /* 4205 - * we already know that the remote client is 4206 - * the owner 4207 - */ 4208 - up_write(&rbd_dev->lock_rwsem); 4209 - return; 4206 + dout("%s rbd_dev %p cid %llu-%llu == owner_cid\n", 4207 + __func__, rbd_dev, cid.gid, cid.handle); 4208 + } else { 4209 + rbd_set_owner_cid(rbd_dev, &cid); 4210 4210 } 4211 - 4212 - rbd_set_owner_cid(rbd_dev, &cid); 4213 4211 downgrade_write(&rbd_dev->lock_rwsem); 4214 4212 } else { 4215 4213 down_read(&rbd_dev->lock_rwsem); ··· 4230 4236 if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { 4231 4237 down_write(&rbd_dev->lock_rwsem); 4232 4238 if (!rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { 4233 - dout("%s rbd_dev %p unexpected owner, cid %llu-%llu != owner_cid %llu-%llu\n", 4239 + dout("%s rbd_dev %p cid %llu-%llu != owner_cid %llu-%llu\n", 4234 4240 __func__, rbd_dev, cid.gid, cid.handle, 4235 4241 rbd_dev->owner_cid.gid, rbd_dev->owner_cid.handle); 4236 - up_write(&rbd_dev->lock_rwsem); 4237 - return; 4242 + } else { 4243 + rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); 4238 4244 } 4239 - 4240 - rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); 4241 4245 downgrade_write(&rbd_dev->lock_rwsem); 4242 4246 } else { 4243 4247 down_read(&rbd_dev->lock_rwsem); ··· 4943 4951 disk->minors = RBD_MINORS_PER_MAJOR; 4944 4952 } 4945 4953 disk->fops = &rbd_bd_ops; 4954 + disk->private_data = rbd_dev; 4946 4955 4947 4956 blk_queue_flag_set(QUEUE_FLAG_NONROT, q); 4948 4957 /* QUEUE_FLAG_ADD_RANDOM is off by default for blk-mq */
+12 -5
drivers/bus/mhi/core/main.c
··· 773 773 cmd_pkt = mhi_to_virtual(mhi_ring, ptr); 774 774 775 775 chan = MHI_TRE_GET_CMD_CHID(cmd_pkt); 776 - mhi_chan = &mhi_cntrl->mhi_chan[chan]; 777 - write_lock_bh(&mhi_chan->lock); 778 - mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre); 779 - complete(&mhi_chan->completion); 780 - write_unlock_bh(&mhi_chan->lock); 776 + 777 + if (chan < mhi_cntrl->max_chan && 778 + mhi_cntrl->mhi_chan[chan].configured) { 779 + mhi_chan = &mhi_cntrl->mhi_chan[chan]; 780 + write_lock_bh(&mhi_chan->lock); 781 + mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre); 782 + complete(&mhi_chan->completion); 783 + write_unlock_bh(&mhi_chan->lock); 784 + } else { 785 + dev_err(&mhi_cntrl->mhi_dev->dev, 786 + "Completion packet for invalid channel ID: %d\n", chan); 787 + } 781 788 782 789 mhi_del_ring_element(mhi_cntrl, mhi_ring); 783 790 }
+36 -9
drivers/bus/mhi/pci_generic.c
··· 32 32 * @edl: emergency download mode firmware path (if any) 33 33 * @bar_num: PCI base address register to use for MHI MMIO register space 34 34 * @dma_data_width: DMA transfer word size (32 or 64 bits) 35 + * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead 36 + * of inband wake support (such as sdx24) 35 37 */ 36 38 struct mhi_pci_dev_info { 37 39 const struct mhi_controller_config *config; ··· 42 40 const char *edl; 43 41 unsigned int bar_num; 44 42 unsigned int dma_data_width; 43 + bool sideband_wake; 45 44 }; 46 45 47 46 #define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring) \ ··· 73 70 .lpm_notify = false, \ 74 71 .offload_channel = false, \ 75 72 .doorbell_mode_switch = false, \ 73 + } 74 + 75 + #define MHI_CHANNEL_CONFIG_DL_AUTOQUEUE(ch_num, ch_name, el_count, ev_ring) \ 76 + { \ 77 + .num = ch_num, \ 78 + .name = ch_name, \ 79 + .num_elements = el_count, \ 80 + .event_ring = ev_ring, \ 81 + .dir = DMA_FROM_DEVICE, \ 82 + .ee_mask = BIT(MHI_EE_AMSS), \ 83 + .pollcfg = 0, \ 84 + .doorbell = MHI_DB_BRST_DISABLE, \ 85 + .lpm_notify = false, \ 86 + .offload_channel = false, \ 87 + .doorbell_mode_switch = false, \ 88 + .auto_queue = true, \ 76 89 } 77 90 78 91 #define MHI_EVENT_CONFIG_CTRL(ev_ring, el_count) \ ··· 229 210 MHI_CHANNEL_CONFIG_UL(14, "QMI", 4, 0), 230 211 MHI_CHANNEL_CONFIG_DL(15, "QMI", 4, 0), 231 212 MHI_CHANNEL_CONFIG_UL(20, "IPCR", 8, 0), 232 - MHI_CHANNEL_CONFIG_DL(21, "IPCR", 8, 0), 213 + MHI_CHANNEL_CONFIG_DL_AUTOQUEUE(21, "IPCR", 8, 0), 233 214 MHI_CHANNEL_CONFIG_UL_FP(34, "FIREHOSE", 32, 0), 234 215 MHI_CHANNEL_CONFIG_DL_FP(35, "FIREHOSE", 32, 0), 235 216 MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0", 128, 2), ··· 261 242 .edl = "qcom/sdx65m/edl.mbn", 262 243 .config = &modem_qcom_v1_mhiv_config, 263 244 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 264 - .dma_data_width = 32 245 + .dma_data_width = 32, 246 + .sideband_wake = false, 265 247 }; 266 248 267 249 static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = { ··· 271 251 .edl = "qcom/sdx55m/edl.mbn", 272 252 .config = &modem_qcom_v1_mhiv_config, 273 253 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 274 - .dma_data_width = 32 254 + .dma_data_width = 32, 255 + .sideband_wake = false, 275 256 }; 276 257 277 258 static const struct mhi_pci_dev_info mhi_qcom_sdx24_info = { ··· 280 259 .edl = "qcom/prog_firehose_sdx24.mbn", 281 260 .config = &modem_qcom_v1_mhiv_config, 282 261 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 283 - .dma_data_width = 32 262 + .dma_data_width = 32, 263 + .sideband_wake = true, 284 264 }; 285 265 286 266 static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = { ··· 323 301 .edl = "qcom/prog_firehose_sdx24.mbn", 324 302 .config = &modem_quectel_em1xx_config, 325 303 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 326 - .dma_data_width = 32 304 + .dma_data_width = 32, 305 + .sideband_wake = true, 327 306 }; 328 307 329 308 static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = { ··· 362 339 .edl = "qcom/sdx55m/edl.mbn", 363 340 .config = &modem_foxconn_sdx55_config, 364 341 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 365 - .dma_data_width = 32 342 + .dma_data_width = 32, 343 + .sideband_wake = false, 366 344 }; 367 345 368 346 static const struct pci_device_id mhi_pci_id_table[] = { ··· 664 640 mhi_cntrl->status_cb = mhi_pci_status_cb; 665 641 mhi_cntrl->runtime_get = mhi_pci_runtime_get; 666 642 mhi_cntrl->runtime_put = mhi_pci_runtime_put; 667 - mhi_cntrl->wake_get = mhi_pci_wake_get_nop; 668 - mhi_cntrl->wake_put = mhi_pci_wake_put_nop; 669 - mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop; 643 + 644 + if (info->sideband_wake) { 645 + mhi_cntrl->wake_get = mhi_pci_wake_get_nop; 646 + mhi_cntrl->wake_put = mhi_pci_wake_put_nop; 647 + mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop; 648 + } 670 649 671 650 err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width)); 672 651 if (err)
-1
drivers/firmware/efi/dev-path-parser.c
··· 34 34 break; 35 35 if (!adev->pnp.unique_id && node->acpi.uid == 0) 36 36 break; 37 - acpi_dev_put(adev); 38 37 } 39 38 if (!adev) 40 39 return -ENODEV;
+12 -1
drivers/firmware/efi/efi.c
··· 896 896 static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) 897 897 { 898 898 struct resource *res, *parent; 899 + int ret; 899 900 900 901 res = kzalloc(sizeof(struct resource), GFP_ATOMIC); 901 902 if (!res) ··· 909 908 910 909 /* we expect a conflict with a 'System RAM' region */ 911 910 parent = request_resource_conflict(&iomem_resource, res); 912 - return parent ? request_resource(parent, res) : 0; 911 + ret = parent ? request_resource(parent, res) : 0; 912 + 913 + /* 914 + * Given that efi_mem_reserve_iomem() can be called at any 915 + * time, only call memblock_reserve() if the architecture 916 + * keeps the infrastructure around. 917 + */ 918 + if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret) 919 + memblock_reserve(addr, size); 920 + 921 + return ret; 913 922 } 914 923 915 924 int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+2 -2
drivers/firmware/efi/libstub/efi-stub-helper.c
··· 630 630 * @image: EFI loaded image protocol 631 631 * @load_addr: pointer to loaded initrd 632 632 * @load_size: size of loaded initrd 633 - * @soft_limit: preferred size of allocated memory for loading the initrd 634 - * @hard_limit: minimum size of allocated memory 633 + * @soft_limit: preferred address for loading the initrd 634 + * @hard_limit: upper limit address for loading the initrd 635 635 * 636 636 * Return: status code 637 637 */
+4 -1
drivers/firmware/efi/mokvar-table.c
··· 180 180 pr_err("EFI MOKvar config table is not valid\n"); 181 181 return; 182 182 } 183 - efi_mem_reserve(efi.mokvar_table, map_size_needed); 183 + 184 + if (md.type == EFI_BOOT_SERVICES_DATA) 185 + efi_mem_reserve(efi.mokvar_table, map_size_needed); 186 + 184 187 efi_mokvar_table_size = map_size_needed; 185 188 } 186 189
+5 -3
drivers/firmware/efi/tpm.c
··· 62 62 tbl_size = sizeof(*log_tbl) + log_tbl->size; 63 63 memblock_reserve(efi.tpm_log, tbl_size); 64 64 65 - if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR || 66 - log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { 67 - pr_warn(FW_BUG "TPM Final Events table missing or invalid\n"); 65 + if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) { 66 + pr_info("TPM Final Events table not present\n"); 67 + goto out; 68 + } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { 69 + pr_warn(FW_BUG "TPM Final Events table invalid\n"); 68 70 goto out; 69 71 } 70 72
+7
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 619 619 u32 max_level; 620 620 }; 621 621 622 + #define codec_info_build(type, width, height, level) \ 623 + .codec_type = type,\ 624 + .max_width = width,\ 625 + .max_height = height,\ 626 + .max_pixels_per_frame = height * width,\ 627 + .max_level = level, 628 + 622 629 struct amdgpu_video_codecs { 623 630 const u32 codec_count; 624 631 const struct amdgpu_video_codec_info *codec_array;
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 1190 1190 /* Van Gogh */ 1191 1191 {0x1002, 0x163F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VANGOGH|AMD_IS_APU}, 1192 1192 1193 + /* Yellow Carp */ 1194 + {0x1002, 0x164D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_YELLOW_CARP|AMD_IS_APU}, 1195 + {0x1002, 0x1681, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_YELLOW_CARP|AMD_IS_APU}, 1196 + 1193 1197 /* Navy_Flounder */ 1194 1198 {0x1002, 0x73C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVY_FLOUNDER}, 1195 1199 {0x1002, 0x73C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVY_FLOUNDER},
+9
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 255 255 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) 256 256 return -EPERM; 257 257 258 + /* Workaround for Thunk bug creating PROT_NONE,MAP_PRIVATE mappings 259 + * for debugger access to invisible VRAM. Should have used MAP_SHARED 260 + * instead. Clearing VM_MAYWRITE prevents the mapping from ever 261 + * becoming writable and makes is_cow_mapping(vm_flags) false. 262 + */ 263 + if (is_cow_mapping(vma->vm_flags) && 264 + !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) 265 + vma->vm_flags &= ~VM_MAYWRITE; 266 + 258 267 return drm_gem_ttm_mmap(obj, vma); 259 268 } 260 269
+3
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 3300 3300 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000), 3301 3301 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000), 3302 3302 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000), 3303 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3303 3304 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000), 3304 3305 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000) 3305 3306 }; ··· 3380 3379 SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0xffffffbf, 0x00000020), 3381 3380 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1_Vangogh, 0xffffffff, 0x00070103), 3382 3381 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQG_CONFIG, 0x000017ff, 0x00001000), 3382 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3383 3383 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000), 3384 3384 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00400000), 3385 3385 SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000000ff), ··· 3447 3445 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000), 3448 3446 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000), 3449 3447 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000), 3448 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3450 3449 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0x01030000, 0x01030000), 3451 3450 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a00000, 0x00a00000), 3452 3451 SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x00000020, 0x00000020)
+50 -198
drivers/gpu/drm/amd/amdgpu/nv.c
··· 64 64 #include "smuio_v11_0.h" 65 65 #include "smuio_v11_0_6.h" 66 66 67 - #define codec_info_build(type, width, height, level) \ 68 - .codec_type = type,\ 69 - .max_width = width,\ 70 - .max_height = height,\ 71 - .max_pixels_per_frame = height * width,\ 72 - .max_level = level, 73 - 74 67 static const struct amd_ip_funcs nv_common_ip_funcs; 75 68 76 69 /* Navi */ 77 70 static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] = 78 71 { 79 - { 80 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 81 - .max_width = 4096, 82 - .max_height = 2304, 83 - .max_pixels_per_frame = 4096 * 2304, 84 - .max_level = 0, 85 - }, 86 - { 87 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 88 - .max_width = 4096, 89 - .max_height = 2304, 90 - .max_pixels_per_frame = 4096 * 2304, 91 - .max_level = 0, 92 - }, 72 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 73 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 93 74 }; 94 75 95 76 static const struct amdgpu_video_codecs nv_video_codecs_encode = ··· 82 101 /* Navi1x */ 83 102 static const struct amdgpu_video_codec_info nv_video_codecs_decode_array[] = 84 103 { 85 - { 86 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 87 - .max_width = 4096, 88 - .max_height = 4096, 89 - .max_pixels_per_frame = 4096 * 4096, 90 - .max_level = 3, 91 - }, 92 - { 93 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 94 - .max_width = 4096, 95 - .max_height = 4096, 96 - .max_pixels_per_frame = 4096 * 4096, 97 - .max_level = 5, 98 - }, 99 - { 100 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 101 - .max_width = 4096, 102 - .max_height = 4096, 103 - .max_pixels_per_frame = 4096 * 4096, 104 - .max_level = 52, 105 - }, 106 - { 107 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 108 - .max_width = 4096, 109 - .max_height = 4096, 110 - .max_pixels_per_frame = 4096 * 4096, 111 - .max_level = 4, 112 - }, 113 - { 114 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 115 - .max_width = 8192, 116 - .max_height = 4352, 117 - .max_pixels_per_frame = 8192 * 4352, 118 - .max_level = 186, 119 - }, 120 - { 121 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 122 - .max_width = 4096, 123 - .max_height = 4096, 124 - .max_pixels_per_frame = 4096 * 4096, 125 - .max_level = 0, 126 - }, 127 - { 128 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 129 - .max_width = 8192, 130 - .max_height = 4352, 131 - .max_pixels_per_frame = 8192 * 4352, 132 - .max_level = 0, 133 - }, 104 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 105 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 106 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 107 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 108 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 109 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 110 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 134 111 }; 135 112 136 113 static const struct amdgpu_video_codecs nv_video_codecs_decode = ··· 100 161 /* Sienna Cichlid */ 101 162 static const struct amdgpu_video_codec_info sc_video_codecs_decode_array[] = 102 163 { 103 - { 104 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 105 - .max_width = 4096, 106 - .max_height = 4096, 107 - .max_pixels_per_frame = 4096 * 4096, 108 - .max_level = 3, 109 - }, 110 - { 111 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 112 - .max_width = 4096, 113 - .max_height = 4096, 114 - .max_pixels_per_frame = 4096 * 4096, 115 - .max_level = 5, 116 - }, 117 - { 118 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 119 - .max_width = 4096, 120 - .max_height = 4096, 121 - .max_pixels_per_frame = 4096 * 4096, 122 - .max_level = 52, 123 - }, 124 - { 125 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 126 - .max_width = 4096, 127 - .max_height = 4096, 128 - .max_pixels_per_frame = 4096 * 4096, 129 - .max_level = 4, 130 - }, 131 - { 132 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 133 - .max_width = 8192, 134 - .max_height = 4352, 135 - .max_pixels_per_frame = 8192 * 4352, 136 - .max_level = 186, 137 - }, 138 - { 139 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 140 - .max_width = 4096, 141 - .max_height = 4096, 142 - .max_pixels_per_frame = 4096 * 4096, 143 - .max_level = 0, 144 - }, 145 - { 146 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 147 - .max_width = 8192, 148 - .max_height = 4352, 149 - .max_pixels_per_frame = 8192 * 4352, 150 - .max_level = 0, 151 - }, 152 - { 153 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 154 - .max_width = 8192, 155 - .max_height = 4352, 156 - .max_pixels_per_frame = 8192 * 4352, 157 - .max_level = 0, 158 - }, 164 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 165 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 166 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 167 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 168 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 169 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 170 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 171 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, 159 172 }; 160 173 161 174 static const struct amdgpu_video_codecs sc_video_codecs_decode = ··· 119 228 /* SRIOV Sienna Cichlid, not const since data is controlled by host */ 120 229 static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = 121 230 { 122 - { 123 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 124 - .max_width = 4096, 125 - .max_height = 2304, 126 - .max_pixels_per_frame = 4096 * 2304, 127 - .max_level = 0, 128 - }, 129 - { 130 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 131 - .max_width = 4096, 132 - .max_height = 2304, 133 - .max_pixels_per_frame = 4096 * 2304, 134 - .max_level = 0, 135 - }, 231 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 232 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 136 233 }; 137 234 138 235 static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array[] = 139 236 { 140 - { 141 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 142 - .max_width = 4096, 143 - .max_height = 4096, 144 - .max_pixels_per_frame = 4096 * 4096, 145 - .max_level = 3, 146 - }, 147 - { 148 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 149 - .max_width = 4096, 150 - .max_height = 4096, 151 - .max_pixels_per_frame = 4096 * 4096, 152 - .max_level = 5, 153 - }, 154 - { 155 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 156 - .max_width = 4096, 157 - .max_height = 4096, 158 - .max_pixels_per_frame = 4096 * 4096, 159 - .max_level = 52, 160 - }, 161 - { 162 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 163 - .max_width = 4096, 164 - .max_height = 4096, 165 - .max_pixels_per_frame = 4096 * 4096, 166 - .max_level = 4, 167 - }, 168 - { 169 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 170 - .max_width = 8192, 171 - .max_height = 4352, 172 - .max_pixels_per_frame = 8192 * 4352, 173 - .max_level = 186, 174 - }, 175 - { 176 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 177 - .max_width = 4096, 178 - .max_height = 4096, 179 - .max_pixels_per_frame = 4096 * 4096, 180 - .max_level = 0, 181 - }, 182 - { 183 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 184 - .max_width = 8192, 185 - .max_height = 4352, 186 - .max_pixels_per_frame = 8192 * 4352, 187 - .max_level = 0, 188 - }, 189 - { 190 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 191 - .max_width = 8192, 192 - .max_height = 4352, 193 - .max_pixels_per_frame = 8192 * 4352, 194 - .max_level = 0, 195 - }, 237 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 238 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 239 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 240 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 241 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 242 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 243 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 244 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, 196 245 }; 197 246 198 247 static struct amdgpu_video_codecs sriov_sc_video_codecs_encode = ··· 164 333 .codec_array = NULL, 165 334 }; 166 335 336 + /* Yellow Carp*/ 337 + static const struct amdgpu_video_codec_info yc_video_codecs_decode_array[] = { 338 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 339 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 340 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 341 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 342 + }; 343 + 344 + static const struct amdgpu_video_codecs yc_video_codecs_decode = { 345 + .codec_count = ARRAY_SIZE(yc_video_codecs_decode_array), 346 + .codec_array = yc_video_codecs_decode_array, 347 + }; 348 + 167 349 static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode, 168 350 const struct amdgpu_video_codecs **codecs) 169 351 { ··· 197 353 case CHIP_NAVY_FLOUNDER: 198 354 case CHIP_DIMGREY_CAVEFISH: 199 355 case CHIP_VANGOGH: 200 - case CHIP_YELLOW_CARP: 201 356 if (encode) 202 357 *codecs = &nv_video_codecs_encode; 203 358 else 204 359 *codecs = &sc_video_codecs_decode; 360 + return 0; 361 + case CHIP_YELLOW_CARP: 362 + if (encode) 363 + *codecs = &nv_video_codecs_encode; 364 + else 365 + *codecs = &yc_video_codecs_decode; 205 366 return 0; 206 367 case CHIP_BEIGE_GOBY: 207 368 if (encode) ··· 1236 1387 AMD_PG_SUPPORT_VCN | 1237 1388 AMD_PG_SUPPORT_VCN_DPG | 1238 1389 AMD_PG_SUPPORT_JPEG; 1239 - adev->external_rev_id = adev->rev_id + 0x01; 1390 + if (adev->pdev->device == 0x1681) 1391 + adev->external_rev_id = adev->rev_id + 0x19; 1392 + else 1393 + adev->external_rev_id = adev->rev_id + 0x01; 1240 1394 break; 1241 1395 default: 1242 1396 /* FIXME: not supported yet */
+22 -154
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 88 88 /* Vega, Raven, Arcturus */ 89 89 static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] = 90 90 { 91 - { 92 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 93 - .max_width = 4096, 94 - .max_height = 2304, 95 - .max_pixels_per_frame = 4096 * 2304, 96 - .max_level = 0, 97 - }, 98 - { 99 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 100 - .max_width = 4096, 101 - .max_height = 2304, 102 - .max_pixels_per_frame = 4096 * 2304, 103 - .max_level = 0, 104 - }, 91 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 92 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 105 93 }; 106 94 107 95 static const struct amdgpu_video_codecs vega_video_codecs_encode = ··· 101 113 /* Vega */ 102 114 static const struct amdgpu_video_codec_info vega_video_codecs_decode_array[] = 103 115 { 104 - { 105 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 106 - .max_width = 4096, 107 - .max_height = 4096, 108 - .max_pixels_per_frame = 4096 * 4096, 109 - .max_level = 3, 110 - }, 111 - { 112 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 113 - .max_width = 4096, 114 - .max_height = 4096, 115 - .max_pixels_per_frame = 4096 * 4096, 116 - .max_level = 5, 117 - }, 118 - { 119 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 120 - .max_width = 4096, 121 - .max_height = 4096, 122 - .max_pixels_per_frame = 4096 * 4096, 123 - .max_level = 52, 124 - }, 125 - { 126 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 127 - .max_width = 4096, 128 - .max_height = 4096, 129 - .max_pixels_per_frame = 4096 * 4096, 130 - .max_level = 4, 131 - }, 132 - { 133 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 134 - .max_width = 4096, 135 - .max_height = 4096, 136 - .max_pixels_per_frame = 4096 * 4096, 137 - .max_level = 186, 138 - }, 139 - { 140 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 141 - .max_width = 4096, 142 - .max_height = 4096, 143 - .max_pixels_per_frame = 4096 * 4096, 144 - .max_level = 0, 145 - }, 116 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 117 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 118 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 119 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 120 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 186)}, 121 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 146 122 }; 147 123 148 124 static const struct amdgpu_video_codecs vega_video_codecs_decode = ··· 118 166 /* Raven */ 119 167 static const struct amdgpu_video_codec_info rv_video_codecs_decode_array[] = 120 168 { 121 - { 122 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 123 - .max_width = 4096, 124 - .max_height = 4096, 125 - .max_pixels_per_frame = 4096 * 4096, 126 - .max_level = 3, 127 - }, 128 - { 129 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 130 - .max_width = 4096, 131 - .max_height = 4096, 132 - .max_pixels_per_frame = 4096 * 4096, 133 - .max_level = 5, 134 - }, 135 - { 136 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 137 - .max_width = 4096, 138 - .max_height = 4096, 139 - .max_pixels_per_frame = 4096 * 4096, 140 - .max_level = 52, 141 - }, 142 - { 143 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 144 - .max_width = 4096, 145 - .max_height = 4096, 146 - .max_pixels_per_frame = 4096 * 4096, 147 - .max_level = 4, 148 - }, 149 - { 150 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 151 - .max_width = 4096, 152 - .max_height = 4096, 153 - .max_pixels_per_frame = 4096 * 4096, 154 - .max_level = 186, 155 - }, 156 - { 157 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 158 - .max_width = 4096, 159 - .max_height = 4096, 160 - .max_pixels_per_frame = 4096 * 4096, 161 - .max_level = 0, 162 - }, 163 - { 164 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 165 - .max_width = 4096, 166 - .max_height = 4096, 167 - .max_pixels_per_frame = 4096 * 4096, 168 - .max_level = 0, 169 - }, 169 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 170 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 171 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 172 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 173 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 186)}, 174 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 175 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 4096, 4096, 0)}, 170 176 }; 171 177 172 178 static const struct amdgpu_video_codecs rv_video_codecs_decode = ··· 136 226 /* Renoir, Arcturus */ 137 227 static const struct amdgpu_video_codec_info rn_video_codecs_decode_array[] = 138 228 { 139 - { 140 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 141 - .max_width = 4096, 142 - .max_height = 4096, 143 - .max_pixels_per_frame = 4096 * 4096, 144 - .max_level = 3, 145 - }, 146 - { 147 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 148 - .max_width = 4096, 149 - .max_height = 4096, 150 - .max_pixels_per_frame = 4096 * 4096, 151 - .max_level = 5, 152 - }, 153 - { 154 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 155 - .max_width = 4096, 156 - .max_height = 4096, 157 - .max_pixels_per_frame = 4096 * 4096, 158 - .max_level = 52, 159 - }, 160 - { 161 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 162 - .max_width = 4096, 163 - .max_height = 4096, 164 - .max_pixels_per_frame = 4096 * 4096, 165 - .max_level = 4, 166 - }, 167 - { 168 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 169 - .max_width = 8192, 170 - .max_height = 4352, 171 - .max_pixels_per_frame = 4096 * 4096, 172 - .max_level = 186, 173 - }, 174 - { 175 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 176 - .max_width = 4096, 177 - .max_height = 4096, 178 - .max_pixels_per_frame = 4096 * 4096, 179 - .max_level = 0, 180 - }, 181 - { 182 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 183 - .max_width = 8192, 184 - .max_height = 4352, 185 - .max_pixels_per_frame = 4096 * 4096, 186 - .max_level = 0, 187 - }, 229 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 230 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 231 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 232 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 233 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 234 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 235 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 188 236 }; 189 237 190 238 static const struct amdgpu_video_codecs rn_video_codecs_decode =
+4
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c
··· 190 190 &clk_mgr_base->bw_params->clk_table.entries[0].dtbclk_mhz, 191 191 &num_levels); 192 192 193 + /* SOCCLK */ 194 + dcn3_init_single_clock(clk_mgr, PPCLK_SOCCLK, 195 + &clk_mgr_base->bw_params->clk_table.entries[0].socclk_mhz, 196 + &num_levels); 193 197 // DPREFCLK ??? 194 198 195 199 /* DISPCLK */
+50 -9
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
··· 48 48 49 49 #include "dc_dmub_srv.h" 50 50 51 + #include "yellow_carp_offset.h" 52 + 53 + #define regCLK1_CLK_PLL_REQ 0x0237 54 + #define regCLK1_CLK_PLL_REQ_BASE_IDX 0 55 + 56 + #define CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 57 + #define CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 58 + #define CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 59 + #define CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 60 + #define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 61 + #define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 62 + 63 + #define REG(reg_name) \ 64 + (CLK_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name) 65 + 51 66 #define TO_CLK_MGR_DCN31(clk_mgr)\ 52 67 container_of(clk_mgr, struct clk_mgr_dcn31, base) 53 68 ··· 139 124 * also if safe to lower is false, we just go in the higher state 140 125 */ 141 126 if (safe_to_lower) { 142 - if (new_clocks->z9_support == DCN_Z9_SUPPORT_ALLOW && 143 - new_clocks->z9_support != clk_mgr_base->clks.z9_support) { 127 + if (new_clocks->zstate_support == DCN_ZSTATE_SUPPORT_ALLOW && 128 + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { 144 129 dcn31_smu_set_Z9_support(clk_mgr, true); 145 - clk_mgr_base->clks.z9_support = new_clocks->z9_support; 130 + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; 146 131 } 147 132 148 133 if (clk_mgr_base->clks.dtbclk_en && !new_clocks->dtbclk_en) { ··· 163 148 } 164 149 } 165 150 } else { 166 - if (new_clocks->z9_support == DCN_Z9_SUPPORT_DISALLOW && 167 - new_clocks->z9_support != clk_mgr_base->clks.z9_support) { 151 + if (new_clocks->zstate_support == DCN_ZSTATE_SUPPORT_DISALLOW && 152 + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { 168 153 dcn31_smu_set_Z9_support(clk_mgr, false); 169 - clk_mgr_base->clks.z9_support = new_clocks->z9_support; 154 + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; 170 155 } 171 156 172 157 if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) { ··· 244 229 245 230 static int get_vco_frequency_from_reg(struct clk_mgr_internal *clk_mgr) 246 231 { 247 - return 0; 232 + /* get FbMult value */ 233 + struct fixed31_32 pll_req; 234 + unsigned int fbmult_frac_val = 0; 235 + unsigned int fbmult_int_val = 0; 236 + 237 + /* 238 + * Register value of fbmult is in 8.16 format, we are converting to 31.32 239 + * to leverage the fix point operations available in driver 240 + */ 241 + 242 + REG_GET(CLK1_CLK_PLL_REQ, FbMult_frac, &fbmult_frac_val); /* 16 bit fractional part*/ 243 + REG_GET(CLK1_CLK_PLL_REQ, FbMult_int, &fbmult_int_val); /* 8 bit integer part */ 244 + 245 + pll_req = dc_fixpt_from_int(fbmult_int_val); 246 + 247 + /* 248 + * since fractional part is only 16 bit in register definition but is 32 bit 249 + * in our fix point definiton, need to shift left by 16 to obtain correct value 250 + */ 251 + pll_req.value |= fbmult_frac_val << 16; 252 + 253 + /* multiply by REFCLK period */ 254 + pll_req = dc_fixpt_mul_int(pll_req, clk_mgr->dfs_ref_freq_khz); 255 + 256 + /* integer part is now VCO frequency in kHz */ 257 + return dc_fixpt_floor(pll_req); 248 258 } 249 259 250 260 static void dcn31_enable_pme_wa(struct clk_mgr *clk_mgr_base) ··· 286 246 clk_mgr->clks.p_state_change_support = true; 287 247 clk_mgr->clks.prev_p_state_change_support = true; 288 248 clk_mgr->clks.pwr_state = DCN_PWR_STATE_UNKNOWN; 289 - clk_mgr->clks.z9_support = DCN_Z9_SUPPORT_UNKNOWN; 249 + clk_mgr->clks.zstate_support = DCN_ZSTATE_SUPPORT_UNKNOWN; 290 250 } 291 251 292 252 static bool dcn31_are_clock_states_equal(struct dc_clocks *a, ··· 300 260 return false; 301 261 else if (a->dcfclk_deep_sleep_khz != b->dcfclk_deep_sleep_khz) 302 262 return false; 303 - else if (a->z9_support != b->z9_support) 263 + else if (a->zstate_support != b->zstate_support) 304 264 return false; 305 265 else if (a->dtbclk_en != b->dtbclk_en) 306 266 return false; ··· 632 592 clk_mgr->base.dprefclk_ss_percentage = 0; 633 593 clk_mgr->base.dprefclk_ss_divider = 1000; 634 594 clk_mgr->base.ss_on_dprefclk = false; 595 + clk_mgr->base.dfs_ref_freq_khz = 48000; 635 596 636 597 clk_mgr->smu_wm_set.wm_set = (struct dcn31_watermarks *)dm_helpers_allocate_gpu_mem( 637 598 clk_mgr->base.base.ctx,
-54
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.h
··· 27 27 #define __DCN31_CLK_MGR_H__ 28 28 #include "clk_mgr_internal.h" 29 29 30 - //CLK1_CLK_PLL_REQ 31 - #ifndef CLK11_CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 32 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 33 - #define CLK11_CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 34 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 35 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 36 - #define CLK11_CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 37 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 38 - //CLK1_CLK0_DFS_CNTL 39 - #define CLK11_CLK1_CLK0_DFS_CNTL__CLK0_DIVIDER__SHIFT 0x0 40 - #define CLK11_CLK1_CLK0_DFS_CNTL__CLK0_DIVIDER_MASK 0x0000007FL 41 - /*DPREF clock related*/ 42 - #define CLK0_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 43 - #define CLK0_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 44 - #define CLK1_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 45 - #define CLK1_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 46 - #define CLK2_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 47 - #define CLK2_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 48 - #define CLK3_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 49 - #define CLK3_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 50 - 51 - //CLK3_0_CLK3_CLK_PLL_REQ 52 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 53 - #define CLK3_0_CLK3_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 54 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 55 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 56 - #define CLK3_0_CLK3_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 57 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 58 - 59 - #define mmCLK0_CLK3_DFS_CNTL 0x16C60 60 - #define mmCLK00_CLK0_CLK3_DFS_CNTL 0x16C60 61 - #define mmCLK01_CLK0_CLK3_DFS_CNTL 0x16E60 62 - #define mmCLK02_CLK0_CLK3_DFS_CNTL 0x17060 63 - #define mmCLK03_CLK0_CLK3_DFS_CNTL 0x17260 64 - 65 - #define mmCLK0_CLK_PLL_REQ 0x16C10 66 - #define mmCLK00_CLK0_CLK_PLL_REQ 0x16C10 67 - #define mmCLK01_CLK0_CLK_PLL_REQ 0x16E10 68 - #define mmCLK02_CLK0_CLK_PLL_REQ 0x17010 69 - #define mmCLK03_CLK0_CLK_PLL_REQ 0x17210 70 - 71 - #define mmCLK1_CLK_PLL_REQ 0x1B00D 72 - #define mmCLK10_CLK1_CLK_PLL_REQ 0x1B00D 73 - #define mmCLK11_CLK1_CLK_PLL_REQ 0x1B20D 74 - #define mmCLK12_CLK1_CLK_PLL_REQ 0x1B40D 75 - #define mmCLK13_CLK1_CLK_PLL_REQ 0x1B60D 76 - 77 - #define mmCLK2_CLK_PLL_REQ 0x17E0D 78 - 79 - /*AMCLK*/ 80 - #define mmCLK11_CLK1_CLK0_DFS_CNTL 0x1B23F 81 - #define mmCLK11_CLK1_CLK_PLL_REQ 0x1B20D 82 - #endif 83 - 84 30 struct dcn31_watermarks; 85 31 86 32 struct dcn31_smu_watermark_set {
+1 -1
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1062 1062 * so use only 30 bpp on DCE_VERSION_11_0. Testing with DCE 11.2 and 8.3 1063 1063 * did not show such problems, so this seems to be the exception. 1064 1064 */ 1065 - if (plane_state->ctx->dce_version != DCE_VERSION_11_0) 1065 + if (plane_state->ctx->dce_version > DCE_VERSION_11_0) 1066 1066 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_36BPP; 1067 1067 else 1068 1068 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
+5 -5
drivers/gpu/drm/amd/display/dc/dc.h
··· 354 354 }; 355 355 356 356 #if defined(CONFIG_DRM_AMD_DC_DCN) 357 - enum dcn_z9_support_state { 358 - DCN_Z9_SUPPORT_UNKNOWN, 359 - DCN_Z9_SUPPORT_ALLOW, 360 - DCN_Z9_SUPPORT_DISALLOW, 357 + enum dcn_zstate_support_state { 358 + DCN_ZSTATE_SUPPORT_UNKNOWN, 359 + DCN_ZSTATE_SUPPORT_ALLOW, 360 + DCN_ZSTATE_SUPPORT_DISALLOW, 361 361 }; 362 362 #endif 363 363 /* ··· 378 378 int dramclk_khz; 379 379 bool p_state_change_support; 380 380 #if defined(CONFIG_DRM_AMD_DC_DCN) 381 - enum dcn_z9_support_state z9_support; 381 + enum dcn_zstate_support_state zstate_support; 382 382 bool dtbclk_en; 383 383 #endif 384 384 enum dcn_pwr_state pwr_state;
+3 -1
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h
··· 636 636 uint32_t ODM_MEM_PWR_CTRL3; 637 637 uint32_t DMU_MEM_PWR_CNTL; 638 638 uint32_t MMHUBBUB_MEM_PWR_CNTL; 639 + uint32_t DCHUBBUB_ARB_HOSTVM_CNTL; 639 640 }; 640 641 /* set field name */ 641 642 #define HWS_SF(blk_name, reg_name, field_name, post_fix)\ ··· 1111 1110 type DOMAIN_POWER_FORCEON;\ 1112 1111 type DOMAIN_POWER_GATE;\ 1113 1112 type DOMAIN_PGFSM_PWR_STATUS;\ 1114 - type HPO_HDMISTREAMCLK_G_GATE_DIS; 1113 + type HPO_HDMISTREAMCLK_G_GATE_DIS;\ 1114 + type DISABLE_HOSTVM_FORCE_ALLOW_PSTATE; 1115 1115 1116 1116 struct dce_hwseq_shift { 1117 1117 HWSEQ_REG_FIELD_LIST(uint8_t)
+6 -1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c
··· 217 217 const struct line_buffer_params *lb_params, 218 218 enum lb_memory_config mem_size_config) 219 219 { 220 + uint32_t max_partitions = 63; /* Currently hardcoded on all ASICs before DCN 3.2 */ 221 + 220 222 /* LB */ 221 223 if (dpp->base.caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT) { 222 224 /* DSCL caps: pixel data processed in fixed format */ ··· 241 239 LB_DATA_FORMAT__ALPHA_EN, lb_params->alpha_en); /* Alpha enable */ 242 240 } 243 241 242 + if (dpp->base.caps->max_lb_partitions == 31) 243 + max_partitions = 31; 244 + 244 245 REG_SET_2(LB_MEMORY_CTRL, 0, 245 246 MEMORY_CONFIG, mem_size_config, 246 - LB_MAX_PARTITIONS, 63); 247 + LB_MAX_PARTITIONS, max_partitions); 247 248 } 248 249 249 250 static const uint16_t *dpp1_dscl_get_filter_coeffs_64p(int taps, struct fixed31_32 ratio)
+36 -14
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 2093 2093 - timing->v_border_bottom; 2094 2094 pipes[pipe_cnt].pipe.dest.htotal = timing->h_total; 2095 2095 pipes[pipe_cnt].pipe.dest.vtotal = v_total; 2096 - pipes[pipe_cnt].pipe.dest.hactive = timing->h_addressable; 2097 - pipes[pipe_cnt].pipe.dest.vactive = timing->v_addressable; 2096 + pipes[pipe_cnt].pipe.dest.hactive = 2097 + timing->h_addressable + timing->h_border_left + timing->h_border_right; 2098 + pipes[pipe_cnt].pipe.dest.vactive = 2099 + timing->v_addressable + timing->v_border_top + timing->v_border_bottom; 2098 2100 pipes[pipe_cnt].pipe.dest.interlaced = timing->flags.INTERLACE; 2099 2101 pipes[pipe_cnt].pipe.dest.pixel_rate_mhz = timing->pix_clk_100hz/10000.0; 2100 2102 if (timing->timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING) ··· 3081 3079 return false; 3082 3080 } 3083 3081 3082 + static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struct dc_state *context) 3083 + { 3084 + int plane_count; 3085 + int i; 3086 + 3087 + plane_count = 0; 3088 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 3089 + if (context->res_ctx.pipe_ctx[i].plane_state) 3090 + plane_count++; 3091 + } 3092 + 3093 + /* 3094 + * Zstate is allowed in following scenarios: 3095 + * 1. Single eDP with PSR enabled 3096 + * 2. 0 planes (No memory requests) 3097 + * 3. Single eDP without PSR but > 5ms stutter period 3098 + */ 3099 + if (plane_count == 0) 3100 + return DCN_ZSTATE_SUPPORT_ALLOW; 3101 + else if (context->stream_count == 1 && context->streams[0]->signal == SIGNAL_TYPE_EDP) { 3102 + struct dc_link *link = context->streams[0]->sink->link; 3103 + 3104 + if ((link->link_index == 0 && link->psr_settings.psr_feature_enabled) 3105 + || context->bw_ctx.dml.vba.StutterPeriod > 5000.0) 3106 + return DCN_ZSTATE_SUPPORT_ALLOW; 3107 + else 3108 + return DCN_ZSTATE_SUPPORT_DISALLOW; 3109 + } else 3110 + return DCN_ZSTATE_SUPPORT_DISALLOW; 3111 + } 3112 + 3084 3113 void dcn20_calculate_dlg_params( 3085 3114 struct dc *dc, struct dc_state *context, 3086 3115 display_e2e_pipe_params_st *pipes, ··· 3119 3086 int vlevel) 3120 3087 { 3121 3088 int i, pipe_idx; 3122 - int plane_count; 3123 3089 3124 3090 /* Writeback MCIF_WB arbitration parameters */ 3125 3091 dc->res_pool->funcs->set_mcif_arb_params(dc, context, pipes, pipe_cnt); ··· 3134 3102 != dm_dram_clock_change_unsupported; 3135 3103 context->bw_ctx.bw.dcn.clk.dppclk_khz = 0; 3136 3104 3137 - context->bw_ctx.bw.dcn.clk.z9_support = (context->bw_ctx.dml.vba.StutterPeriod > 5000.0) ? 3138 - DCN_Z9_SUPPORT_ALLOW : DCN_Z9_SUPPORT_DISALLOW; 3139 - 3140 - plane_count = 0; 3141 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 3142 - if (context->res_ctx.pipe_ctx[i].plane_state) 3143 - plane_count++; 3144 - } 3145 - 3146 - if (plane_count == 0) 3147 - context->bw_ctx.bw.dcn.clk.z9_support = DCN_Z9_SUPPORT_ALLOW; 3105 + context->bw_ctx.bw.dcn.clk.zstate_support = decide_zstate_support(dc, context); 3148 3106 3149 3107 context->bw_ctx.bw.dcn.clk.dtbclk_en = is_dtbclk_required(dc, context); 3150 3108
-16
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c
··· 383 383 int min_taps_y, min_taps_c; 384 384 enum lb_memory_config lb_config; 385 385 386 - /* Some ASICs does not support FP16 scaling, so we reject modes require this*/ 387 - if (scl_data->viewport.width != scl_data->h_active && 388 - scl_data->viewport.height != scl_data->v_active && 389 - dpp->caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT && 390 - scl_data->format == PIXEL_FORMAT_FP16) 391 - return false; 392 - 393 386 if (scl_data->viewport.width > scl_data->h_active && 394 387 dpp->ctx->dc->debug.max_downscale_src_width != 0 && 395 388 scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) ··· 1432 1439 dpp->tf_regs = tf_regs; 1433 1440 dpp->tf_shift = tf_shift; 1434 1441 dpp->tf_mask = tf_mask; 1435 - 1436 - dpp->lb_pixel_depth_supported = 1437 - LB_PIXEL_DEPTH_18BPP | 1438 - LB_PIXEL_DEPTH_24BPP | 1439 - LB_PIXEL_DEPTH_30BPP | 1440 - LB_PIXEL_DEPTH_36BPP; 1441 - 1442 - dpp->lb_bits_per_entry = LB_BITS_PER_ENTRY; 1443 - dpp->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x1404*/ 1444 1442 1445 1443 return true; 1446 1444 }
+1 -2
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.h
··· 154 154 SRI(COLOR_KEYER_BLUE, CNVC_CFG, id), \ 155 155 SRI(CURSOR_CONTROL, CURSOR0_, id),\ 156 156 SRI(OBUF_MEM_PWR_CTRL, DSCL, id),\ 157 + SRI(DSCL_MEM_PWR_STATUS, DSCL, id), \ 157 158 SRI(DSCL_MEM_PWR_CTRL, DSCL, id) 158 159 159 160 #define DPP_REG_LIST_DCN30(id)\ ··· 164 163 SRI(CM_SHAPER_LUT_DATA, CM, id),\ 165 164 SRI(CM_MEM_PWR_CTRL2, CM, id), \ 166 165 SRI(CM_MEM_PWR_STATUS2, CM, id), \ 167 - SRI(DSCL_MEM_PWR_STATUS, DSCL, id), \ 168 - SRI(DSCL_MEM_PWR_CTRL, DSCL, id), \ 169 166 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_B, CM, id),\ 170 167 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_G, CM, id),\ 171 168 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_R, CM, id),\
+10 -3
drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c
··· 1398 1398 dcn3_02_soc.clock_limits[i].dispclk_mhz = max_dispclk_mhz; 1399 1399 dcn3_02_soc.clock_limits[i].dppclk_mhz = max_dppclk_mhz; 1400 1400 dcn3_02_soc.clock_limits[i].phyclk_mhz = max_phyclk_mhz; 1401 - dcn3_02_soc.clock_limits[i].dtbclk_mhz = dcn3_02_soc.clock_limits[0].dtbclk_mhz; 1401 + /* Populate from bw_params for DTBCLK, SOCCLK */ 1402 + if (!bw_params->clk_table.entries[i].dtbclk_mhz && i > 0) 1403 + dcn3_02_soc.clock_limits[i].dtbclk_mhz = dcn3_02_soc.clock_limits[i-1].dtbclk_mhz; 1404 + else 1405 + dcn3_02_soc.clock_limits[i].dtbclk_mhz = bw_params->clk_table.entries[i].dtbclk_mhz; 1406 + if (!bw_params->clk_table.entries[i].socclk_mhz && i > 0) 1407 + dcn3_02_soc.clock_limits[i].socclk_mhz = dcn3_02_soc.clock_limits[i-1].socclk_mhz; 1408 + else 1409 + dcn3_02_soc.clock_limits[i].socclk_mhz = bw_params->clk_table.entries[i].socclk_mhz; 1402 1410 /* These clocks cannot come from bw_params, always fill from dcn3_02_soc[1] */ 1403 - /* FCLK, PHYCLK_D18, SOCCLK, DSCCLK */ 1411 + /* FCLK, PHYCLK_D18, DSCCLK */ 1404 1412 dcn3_02_soc.clock_limits[i].phyclk_d18_mhz = dcn3_02_soc.clock_limits[0].phyclk_d18_mhz; 1405 - dcn3_02_soc.clock_limits[i].socclk_mhz = dcn3_02_soc.clock_limits[0].socclk_mhz; 1406 1413 dcn3_02_soc.clock_limits[i].dscclk_mhz = dcn3_02_soc.clock_limits[0].dscclk_mhz; 1407 1414 } 1408 1415 /* re-init DML with updated bb */
+10 -3
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c
··· 1326 1326 dcn3_03_soc.clock_limits[i].dispclk_mhz = max_dispclk_mhz; 1327 1327 dcn3_03_soc.clock_limits[i].dppclk_mhz = max_dppclk_mhz; 1328 1328 dcn3_03_soc.clock_limits[i].phyclk_mhz = max_phyclk_mhz; 1329 - dcn3_03_soc.clock_limits[i].dtbclk_mhz = dcn3_03_soc.clock_limits[0].dtbclk_mhz; 1329 + /* Populate from bw_params for DTBCLK, SOCCLK */ 1330 + if (!bw_params->clk_table.entries[i].dtbclk_mhz && i > 0) 1331 + dcn3_03_soc.clock_limits[i].dtbclk_mhz = dcn3_03_soc.clock_limits[i-1].dtbclk_mhz; 1332 + else 1333 + dcn3_03_soc.clock_limits[i].dtbclk_mhz = bw_params->clk_table.entries[i].dtbclk_mhz; 1334 + if (!bw_params->clk_table.entries[i].socclk_mhz && i > 0) 1335 + dcn3_03_soc.clock_limits[i].socclk_mhz = dcn3_03_soc.clock_limits[i-1].socclk_mhz; 1336 + else 1337 + dcn3_03_soc.clock_limits[i].socclk_mhz = bw_params->clk_table.entries[i].socclk_mhz; 1330 1338 /* These clocks cannot come from bw_params, always fill from dcn3_03_soc[1] */ 1331 - /* FCLK, PHYCLK_D18, SOCCLK, DSCCLK */ 1339 + /* FCLK, PHYCLK_D18, DSCCLK */ 1332 1340 dcn3_03_soc.clock_limits[i].phyclk_d18_mhz = dcn3_03_soc.clock_limits[0].phyclk_d18_mhz; 1333 - dcn3_03_soc.clock_limits[i].socclk_mhz = dcn3_03_soc.clock_limits[0].socclk_mhz; 1334 1341 dcn3_03_soc.clock_limits[i].dscclk_mhz = dcn3_03_soc.clock_limits[0].dscclk_mhz; 1335 1342 } 1336 1343 /* re-init DML with updated bb */
+18
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
··· 47 47 #include "dce/dmub_outbox.h" 48 48 #include "dc_link_dp.h" 49 49 #include "inc/link_dpcd.h" 50 + #include "dcn10/dcn10_hw_sequencer.h" 50 51 51 52 #define DC_LOGGER_INIT(logger) 52 53 ··· 594 593 return true; 595 594 } 596 595 return false; 596 + } 597 + 598 + static void apply_riommu_invalidation_wa(struct dc *dc) 599 + { 600 + struct dce_hwseq *hws = dc->hwseq; 601 + 602 + if (!hws->wa.early_riommu_invalidation) 603 + return; 604 + 605 + REG_UPDATE(DCHUBBUB_ARB_HOSTVM_CNTL, DISABLE_HOSTVM_FORCE_ALLOW_PSTATE, 0); 606 + } 607 + 608 + void dcn31_init_pipes(struct dc *dc, struct dc_state *context) 609 + { 610 + dcn10_init_pipes(dc, context); 611 + apply_riommu_invalidation_wa(dc); 612 + 597 613 }
+1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.h
··· 52 52 struct dc_state *context); 53 53 bool dcn31_is_abm_supported(struct dc *dc, 54 54 struct dc_state *context, struct dc_stream_state *stream); 55 + void dcn31_init_pipes(struct dc *dc, struct dc_state *context); 55 56 56 57 #endif /* __DC_HWSS_DCN31_H__ */
+1 -2
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 93 93 .set_flip_control_gsl = dcn20_set_flip_control_gsl, 94 94 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 95 95 .calc_vupdate_position = dcn10_calc_vupdate_position, 96 - .apply_idle_power_optimizations = dcn30_apply_idle_power_optimizations, 97 96 .set_backlight_level = dcn21_set_backlight_level, 98 97 .set_abm_immediate_disable = dcn21_set_abm_immediate_disable, 99 98 .set_pipe = dcn21_set_pipe, ··· 103 104 }; 104 105 105 106 static const struct hwseq_private_funcs dcn31_private_funcs = { 106 - .init_pipes = dcn10_init_pipes, 107 + .init_pipes = dcn31_init_pipes, 107 108 .update_plane_addr = dcn20_update_plane_addr, 108 109 .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, 109 110 .update_mpcc = dcn20_update_mpcc,
+4
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
··· 220 220 .sr_exit_z8_time_us = 402.0, 221 221 .sr_enter_plus_exit_z8_time_us = 520.0, 222 222 .writeback_latency_us = 12.0, 223 + .dram_channel_width_bytes = 4, 223 224 .round_trip_ping_latency_dcfclk_cycles = 106, 224 225 .urgent_latency_pixel_data_only_us = 4.0, 225 226 .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, ··· 742 741 743 742 #define HWSEQ_DCN31_REG_LIST()\ 744 743 SR(DCHUBBUB_GLOBAL_TIMER_CNTL), \ 744 + SR(DCHUBBUB_ARB_HOSTVM_CNTL), \ 745 745 SR(DIO_MEM_PWR_CTRL), \ 746 746 SR(ODM_MEM_PWR_CTRL3), \ 747 747 SR(DMU_MEM_PWR_CNTL), \ ··· 803 801 #define HWSEQ_DCN31_MASK_SH_LIST(mask_sh)\ 804 802 HWSEQ_DCN_MASK_SH_LIST(mask_sh), \ 805 803 HWS_SF(, DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, mask_sh), \ 804 + HWS_SF(, DCHUBBUB_ARB_HOSTVM_CNTL, DISABLE_HOSTVM_FORCE_ALLOW_PSTATE, mask_sh), \ 806 805 HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN_POWER_FORCEON, mask_sh), \ 807 806 HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN_POWER_GATE, mask_sh), \ 808 807 HWS_SF(, DOMAIN1_PG_CONFIG, DOMAIN_POWER_FORCEON, mask_sh), \ ··· 1302 1299 hws->regs = &hwseq_reg; 1303 1300 hws->shifts = &hwseq_shift; 1304 1301 hws->masks = &hwseq_mask; 1302 + hws->wa.early_riommu_invalidation = true; 1305 1303 } 1306 1304 return hws; 1307 1305 }
+1 -1
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
··· 4889 4889 } 4890 4890 } while ((locals->PrefetchSupported[i][j] != true || locals->VRatioInPrefetchSupported[i][j] != true) 4891 4891 && (mode_lib->vba.NextMaxVStartup != mode_lib->vba.MaxMaxVStartup[0][0] 4892 - || mode_lib->vba.NextPrefetchMode < mode_lib->vba.MaxPrefetchMode)); 4892 + || mode_lib->vba.NextPrefetchMode <= mode_lib->vba.MaxPrefetchMode)); 4893 4893 4894 4894 if (locals->PrefetchSupported[i][j] == true && locals->VRatioInPrefetchSupported[i][j] == true) { 4895 4895 mode_lib->vba.BandwidthAvailableForImmediateFlip = locals->ReturnBWPerState[i][0];
+3
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
··· 289 289 /* DSCL processing pixel data in fixed or float format */ 290 290 enum dscl_data_processing_format dscl_data_proc_format; 291 291 292 + /* max LB partitions */ 293 + unsigned int max_lb_partitions; 294 + 292 295 /* Calculates the number of partitions in the line buffer. 293 296 * The implementation of this function is overloaded for 294 297 * different versions of DSCL LB.
+1
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h
··· 41 41 bool DEGVIDCN10_254; 42 42 bool DEGVIDCN21; 43 43 bool disallow_self_refresh_during_multi_plane_transition; 44 + bool early_riommu_invalidation; 44 45 }; 45 46 46 47 struct hwseq_wa_state {
+2 -1
drivers/gpu/drm/amd/pm/inc/aldebaran_ppsmc.h
··· 101 101 #define PPSMC_MSG_SetSystemVirtualSTBtoDramAddrLow 0x41 102 102 103 103 #define PPSMC_MSG_GfxDriverResetRecovery 0x42 104 - #define PPSMC_Message_Count 0x43 104 + #define PPSMC_MSG_BoardPowerCalibration 0x43 105 + #define PPSMC_Message_Count 0x44 105 106 106 107 //PPSMC Reset Types 107 108 #define PPSMC_RESET_TYPE_WARM_RESET 0x00
+2 -1
drivers/gpu/drm/amd/pm/inc/smu_types.h
··· 225 225 __SMU_DUMMY_MAP(DisableDeterminism), \ 226 226 __SMU_DUMMY_MAP(SetUclkDpmMode), \ 227 227 __SMU_DUMMY_MAP(LightSBR), \ 228 - __SMU_DUMMY_MAP(GfxDriverResetRecovery), 228 + __SMU_DUMMY_MAP(GfxDriverResetRecovery), \ 229 + __SMU_DUMMY_MAP(BoardPowerCalibration), 229 230 230 231 #undef __SMU_DUMMY_MAP 231 232 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+1 -1
drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
··· 34 34 #define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0xE 35 35 #define SMU11_DRIVER_IF_VERSION_VANGOGH 0x03 36 36 #define SMU11_DRIVER_IF_VERSION_Dimgrey_Cavefish 0xF 37 - #define SMU11_DRIVER_IF_VERSION_Beige_Goby 0x9 37 + #define SMU11_DRIVER_IF_VERSION_Beige_Goby 0xD 38 38 39 39 /* MP Apertures */ 40 40 #define MP0_Public 0x03800000
+36 -10
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
··· 134 134 MSG_MAP(DisableDeterminism, PPSMC_MSG_DisableDeterminism, 0), 135 135 MSG_MAP(SetUclkDpmMode, PPSMC_MSG_SetUclkDpmMode, 0), 136 136 MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0), 137 + MSG_MAP(BoardPowerCalibration, PPSMC_MSG_BoardPowerCalibration, 0), 137 138 }; 138 139 139 140 static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] = { ··· 441 440 return ret; 442 441 } 443 442 443 + static bool aldebaran_is_primary(struct smu_context *smu) 444 + { 445 + struct amdgpu_device *adev = smu->adev; 446 + 447 + if (adev->smuio.funcs && adev->smuio.funcs->get_die_id) 448 + return adev->smuio.funcs->get_die_id(adev) == 0; 449 + 450 + return true; 451 + } 452 + 453 + static int aldebaran_run_board_btc(struct smu_context *smu) 454 + { 455 + u32 smu_version; 456 + int ret; 457 + 458 + if (!aldebaran_is_primary(smu)) 459 + return 0; 460 + 461 + ret = smu_cmn_get_smc_version(smu, NULL, &smu_version); 462 + if (ret) { 463 + dev_err(smu->adev->dev, "Failed to get smu version!\n"); 464 + return ret; 465 + } 466 + if (smu_version <= 0x00441d00) 467 + return 0; 468 + 469 + ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BoardPowerCalibration, NULL); 470 + if (ret) 471 + dev_err(smu->adev->dev, "Board power calibration failed!\n"); 472 + 473 + return ret; 474 + } 475 + 444 476 static int aldebaran_run_btc(struct smu_context *smu) 445 477 { 446 478 int ret; ··· 481 447 ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL); 482 448 if (ret) 483 449 dev_err(smu->adev->dev, "RunDcBtc failed!\n"); 450 + else 451 + ret = aldebaran_run_board_btc(smu); 484 452 485 453 return ret; 486 454 } ··· 558 522 int32_t frequency2) 559 523 { 560 524 return (abs(frequency1 - frequency2) <= EPSILON); 561 - } 562 - 563 - static bool aldebaran_is_primary(struct smu_context *smu) 564 - { 565 - struct amdgpu_device *adev = smu->adev; 566 - 567 - if (adev->smuio.funcs && adev->smuio.funcs->get_die_id) 568 - return adev->smuio.funcs->get_die_id(adev) == 0; 569 - 570 - return true; 571 525 } 572 526 573 527 static int aldebaran_get_smu_metrics_data(struct smu_context *smu,
+3
drivers/gpu/drm/drm_ioctl.c
··· 834 834 if (drm_dev_is_unplugged(dev)) 835 835 return -ENODEV; 836 836 837 + if (DRM_IOCTL_TYPE(cmd) != DRM_IOCTL_BASE) 838 + return -ENOTTY; 839 + 837 840 is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END; 838 841 839 842 if (is_driver_ioctl) {
+13 -214
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 25 25 #include "i915_gem_clflush.h" 26 26 #include "i915_gem_context.h" 27 27 #include "i915_gem_ioctls.h" 28 - #include "i915_sw_fence_work.h" 29 28 #include "i915_trace.h" 30 29 #include "i915_user_extensions.h" 31 - #include "i915_memcpy.h" 32 30 33 31 struct eb_vma { 34 32 struct i915_vma *vma; ··· 1454 1456 int err; 1455 1457 struct intel_engine_cs *engine = eb->engine; 1456 1458 1459 + /* If we need to copy for the cmdparser, we will stall anyway */ 1460 + if (eb_use_cmdparser(eb)) 1461 + return ERR_PTR(-EWOULDBLOCK); 1462 + 1457 1463 if (!reloc_can_use_engine(engine)) { 1458 1464 engine = engine->gt->engine_class[COPY_ENGINE_CLASS][0]; 1459 1465 if (!engine) ··· 2374 2372 return vma; 2375 2373 } 2376 2374 2377 - struct eb_parse_work { 2378 - struct dma_fence_work base; 2379 - struct intel_engine_cs *engine; 2380 - struct i915_vma *batch; 2381 - struct i915_vma *shadow; 2382 - struct i915_vma *trampoline; 2383 - unsigned long batch_offset; 2384 - unsigned long batch_length; 2385 - unsigned long *jump_whitelist; 2386 - const void *batch_map; 2387 - void *shadow_map; 2388 - }; 2389 - 2390 - static int __eb_parse(struct dma_fence_work *work) 2391 - { 2392 - struct eb_parse_work *pw = container_of(work, typeof(*pw), base); 2393 - int ret; 2394 - bool cookie; 2395 - 2396 - cookie = dma_fence_begin_signalling(); 2397 - ret = intel_engine_cmd_parser(pw->engine, 2398 - pw->batch, 2399 - pw->batch_offset, 2400 - pw->batch_length, 2401 - pw->shadow, 2402 - pw->jump_whitelist, 2403 - pw->shadow_map, 2404 - pw->batch_map); 2405 - dma_fence_end_signalling(cookie); 2406 - 2407 - return ret; 2408 - } 2409 - 2410 - static void __eb_parse_release(struct dma_fence_work *work) 2411 - { 2412 - struct eb_parse_work *pw = container_of(work, typeof(*pw), base); 2413 - 2414 - if (!IS_ERR_OR_NULL(pw->jump_whitelist)) 2415 - kfree(pw->jump_whitelist); 2416 - 2417 - if (pw->batch_map) 2418 - i915_gem_object_unpin_map(pw->batch->obj); 2419 - else 2420 - i915_gem_object_unpin_pages(pw->batch->obj); 2421 - 2422 - i915_gem_object_unpin_map(pw->shadow->obj); 2423 - 2424 - if (pw->trampoline) 2425 - i915_active_release(&pw->trampoline->active); 2426 - i915_active_release(&pw->shadow->active); 2427 - i915_active_release(&pw->batch->active); 2428 - } 2429 - 2430 - static const struct dma_fence_work_ops eb_parse_ops = { 2431 - .name = "eb_parse", 2432 - .work = __eb_parse, 2433 - .release = __eb_parse_release, 2434 - }; 2435 - 2436 - static inline int 2437 - __parser_mark_active(struct i915_vma *vma, 2438 - struct intel_timeline *tl, 2439 - struct dma_fence *fence) 2440 - { 2441 - struct intel_gt_buffer_pool_node *node = vma->private; 2442 - 2443 - return i915_active_ref(&node->active, tl->fence_context, fence); 2444 - } 2445 - 2446 - static int 2447 - parser_mark_active(struct eb_parse_work *pw, struct intel_timeline *tl) 2448 - { 2449 - int err; 2450 - 2451 - mutex_lock(&tl->mutex); 2452 - 2453 - err = __parser_mark_active(pw->shadow, tl, &pw->base.dma); 2454 - if (err) 2455 - goto unlock; 2456 - 2457 - if (pw->trampoline) { 2458 - err = __parser_mark_active(pw->trampoline, tl, &pw->base.dma); 2459 - if (err) 2460 - goto unlock; 2461 - } 2462 - 2463 - unlock: 2464 - mutex_unlock(&tl->mutex); 2465 - return err; 2466 - } 2467 - 2468 - static int eb_parse_pipeline(struct i915_execbuffer *eb, 2469 - struct i915_vma *shadow, 2470 - struct i915_vma *trampoline) 2471 - { 2472 - struct eb_parse_work *pw; 2473 - struct drm_i915_gem_object *batch = eb->batch->vma->obj; 2474 - bool needs_clflush; 2475 - int err; 2476 - 2477 - GEM_BUG_ON(overflows_type(eb->batch_start_offset, pw->batch_offset)); 2478 - GEM_BUG_ON(overflows_type(eb->batch_len, pw->batch_length)); 2479 - 2480 - pw = kzalloc(sizeof(*pw), GFP_KERNEL); 2481 - if (!pw) 2482 - return -ENOMEM; 2483 - 2484 - err = i915_active_acquire(&eb->batch->vma->active); 2485 - if (err) 2486 - goto err_free; 2487 - 2488 - err = i915_active_acquire(&shadow->active); 2489 - if (err) 2490 - goto err_batch; 2491 - 2492 - if (trampoline) { 2493 - err = i915_active_acquire(&trampoline->active); 2494 - if (err) 2495 - goto err_shadow; 2496 - } 2497 - 2498 - pw->shadow_map = i915_gem_object_pin_map(shadow->obj, I915_MAP_WB); 2499 - if (IS_ERR(pw->shadow_map)) { 2500 - err = PTR_ERR(pw->shadow_map); 2501 - goto err_trampoline; 2502 - } 2503 - 2504 - needs_clflush = 2505 - !(batch->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ); 2506 - 2507 - pw->batch_map = ERR_PTR(-ENODEV); 2508 - if (needs_clflush && i915_has_memcpy_from_wc()) 2509 - pw->batch_map = i915_gem_object_pin_map(batch, I915_MAP_WC); 2510 - 2511 - if (IS_ERR(pw->batch_map)) { 2512 - err = i915_gem_object_pin_pages(batch); 2513 - if (err) 2514 - goto err_unmap_shadow; 2515 - pw->batch_map = NULL; 2516 - } 2517 - 2518 - pw->jump_whitelist = 2519 - intel_engine_cmd_parser_alloc_jump_whitelist(eb->batch_len, 2520 - trampoline); 2521 - if (IS_ERR(pw->jump_whitelist)) { 2522 - err = PTR_ERR(pw->jump_whitelist); 2523 - goto err_unmap_batch; 2524 - } 2525 - 2526 - dma_fence_work_init(&pw->base, &eb_parse_ops); 2527 - 2528 - pw->engine = eb->engine; 2529 - pw->batch = eb->batch->vma; 2530 - pw->batch_offset = eb->batch_start_offset; 2531 - pw->batch_length = eb->batch_len; 2532 - pw->shadow = shadow; 2533 - pw->trampoline = trampoline; 2534 - 2535 - /* Mark active refs early for this worker, in case we get interrupted */ 2536 - err = parser_mark_active(pw, eb->context->timeline); 2537 - if (err) 2538 - goto err_commit; 2539 - 2540 - err = dma_resv_reserve_shared(pw->batch->resv, 1); 2541 - if (err) 2542 - goto err_commit; 2543 - 2544 - err = dma_resv_reserve_shared(shadow->resv, 1); 2545 - if (err) 2546 - goto err_commit; 2547 - 2548 - /* Wait for all writes (and relocs) into the batch to complete */ 2549 - err = i915_sw_fence_await_reservation(&pw->base.chain, 2550 - pw->batch->resv, NULL, false, 2551 - 0, I915_FENCE_GFP); 2552 - if (err < 0) 2553 - goto err_commit; 2554 - 2555 - /* Keep the batch alive and unwritten as we parse */ 2556 - dma_resv_add_shared_fence(pw->batch->resv, &pw->base.dma); 2557 - 2558 - /* Force execution to wait for completion of the parser */ 2559 - dma_resv_add_excl_fence(shadow->resv, &pw->base.dma); 2560 - 2561 - dma_fence_work_commit_imm(&pw->base); 2562 - return 0; 2563 - 2564 - err_commit: 2565 - i915_sw_fence_set_error_once(&pw->base.chain, err); 2566 - dma_fence_work_commit_imm(&pw->base); 2567 - return err; 2568 - 2569 - err_unmap_batch: 2570 - if (pw->batch_map) 2571 - i915_gem_object_unpin_map(batch); 2572 - else 2573 - i915_gem_object_unpin_pages(batch); 2574 - err_unmap_shadow: 2575 - i915_gem_object_unpin_map(shadow->obj); 2576 - err_trampoline: 2577 - if (trampoline) 2578 - i915_active_release(&trampoline->active); 2579 - err_shadow: 2580 - i915_active_release(&shadow->active); 2581 - err_batch: 2582 - i915_active_release(&eb->batch->vma->active); 2583 - err_free: 2584 - kfree(pw); 2585 - return err; 2586 - } 2587 - 2588 2375 static struct i915_vma *eb_dispatch_secure(struct i915_execbuffer *eb, struct i915_vma *vma) 2589 2376 { 2590 2377 /* ··· 2463 2672 goto err_trampoline; 2464 2673 } 2465 2674 2466 - err = eb_parse_pipeline(eb, shadow, trampoline); 2675 + err = dma_resv_reserve_shared(shadow->resv, 1); 2676 + if (err) 2677 + goto err_trampoline; 2678 + 2679 + err = intel_engine_cmd_parser(eb->engine, 2680 + eb->batch->vma, 2681 + eb->batch_start_offset, 2682 + eb->batch_len, 2683 + shadow, trampoline); 2467 2684 if (err) 2468 2685 goto err_unpin_batch; 2469 2686
+4
drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c
··· 125 125 intel_gt_pm_get(&eb.i915->gt); 126 126 127 127 for_each_uabi_engine(eb.engine, eb.i915) { 128 + if (intel_engine_requires_cmd_parser(eb.engine) || 129 + intel_engine_using_cmd_parser(eb.engine)) 130 + continue; 131 + 128 132 reloc_cache_init(&eb.reloc_cache, eb.i915); 129 133 memset(map, POISON_INUSE, 4096); 130 134
+15
drivers/gpu/drm/i915/gvt/handlers.c
··· 1977 1977 if (drm_WARN_ON(&i915->drm, !engine)) 1978 1978 return -EINVAL; 1979 1979 1980 + /* 1981 + * Due to d3_entered is used to indicate skipping PPGTT invalidation on 1982 + * vGPU reset, it's set on D0->D3 on PCI config write, and cleared after 1983 + * vGPU reset if in resuming. 1984 + * In S0ix exit, the device power state also transite from D3 to D0 as 1985 + * S3 resume, but no vGPU reset (triggered by QEMU devic model). After 1986 + * S0ix exit, all engines continue to work. However the d3_entered 1987 + * remains set which will break next vGPU reset logic (miss the expected 1988 + * PPGTT invalidation). 1989 + * Engines can only work in D0. Thus the 1st elsp write gives GVT a 1990 + * chance to clear d3_entered. 1991 + */ 1992 + if (vgpu->d3_entered) 1993 + vgpu->d3_entered = false; 1994 + 1980 1995 execlist = &vgpu->submission.execlist[engine->id]; 1981 1996 1982 1997 execlist->elsp_dwords.data[3 - execlist->elsp_dwords.index] = data;
+71 -59
drivers/gpu/drm/i915/i915_cmd_parser.c
··· 1145 1145 static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, 1146 1146 struct drm_i915_gem_object *src_obj, 1147 1147 unsigned long offset, unsigned long length, 1148 - void *dst, const void *src) 1148 + bool *needs_clflush_after) 1149 1149 { 1150 - bool needs_clflush = 1151 - !(src_obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ); 1150 + unsigned int src_needs_clflush; 1151 + unsigned int dst_needs_clflush; 1152 + void *dst, *src; 1153 + int ret; 1152 1154 1153 - if (src) { 1154 - GEM_BUG_ON(!needs_clflush); 1155 - i915_unaligned_memcpy_from_wc(dst, src + offset, length); 1156 - } else { 1157 - struct scatterlist *sg; 1155 + ret = i915_gem_object_prepare_write(dst_obj, &dst_needs_clflush); 1156 + if (ret) 1157 + return ERR_PTR(ret); 1158 + 1159 + dst = i915_gem_object_pin_map(dst_obj, I915_MAP_WB); 1160 + i915_gem_object_finish_access(dst_obj); 1161 + if (IS_ERR(dst)) 1162 + return dst; 1163 + 1164 + ret = i915_gem_object_prepare_read(src_obj, &src_needs_clflush); 1165 + if (ret) { 1166 + i915_gem_object_unpin_map(dst_obj); 1167 + return ERR_PTR(ret); 1168 + } 1169 + 1170 + src = ERR_PTR(-ENODEV); 1171 + if (src_needs_clflush && i915_has_memcpy_from_wc()) { 1172 + src = i915_gem_object_pin_map(src_obj, I915_MAP_WC); 1173 + if (!IS_ERR(src)) { 1174 + i915_unaligned_memcpy_from_wc(dst, 1175 + src + offset, 1176 + length); 1177 + i915_gem_object_unpin_map(src_obj); 1178 + } 1179 + } 1180 + if (IS_ERR(src)) { 1181 + unsigned long x, n, remain; 1158 1182 void *ptr; 1159 - unsigned int x, sg_ofs; 1160 - unsigned long remain; 1161 1183 1162 1184 /* 1163 1185 * We can avoid clflushing partial cachelines before the write ··· 1190 1168 * validate up to the end of the batch. 1191 1169 */ 1192 1170 remain = length; 1193 - if (!(dst_obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ)) 1171 + if (dst_needs_clflush & CLFLUSH_BEFORE) 1194 1172 remain = round_up(remain, 1195 1173 boot_cpu_data.x86_clflush_size); 1196 1174 1197 1175 ptr = dst; 1198 1176 x = offset_in_page(offset); 1199 - sg = i915_gem_object_get_sg(src_obj, offset >> PAGE_SHIFT, &sg_ofs, false); 1177 + for (n = offset >> PAGE_SHIFT; remain; n++) { 1178 + int len = min(remain, PAGE_SIZE - x); 1200 1179 1201 - while (remain) { 1202 - unsigned long sg_max = sg->length >> PAGE_SHIFT; 1180 + src = kmap_atomic(i915_gem_object_get_page(src_obj, n)); 1181 + if (src_needs_clflush) 1182 + drm_clflush_virt_range(src + x, len); 1183 + memcpy(ptr, src + x, len); 1184 + kunmap_atomic(src); 1203 1185 1204 - for (; remain && sg_ofs < sg_max; sg_ofs++) { 1205 - unsigned long len = min(remain, PAGE_SIZE - x); 1206 - void *map; 1207 - 1208 - map = kmap_atomic(nth_page(sg_page(sg), sg_ofs)); 1209 - if (needs_clflush) 1210 - drm_clflush_virt_range(map + x, len); 1211 - memcpy(ptr, map + x, len); 1212 - kunmap_atomic(map); 1213 - 1214 - ptr += len; 1215 - remain -= len; 1216 - x = 0; 1217 - } 1218 - 1219 - sg_ofs = 0; 1220 - sg = sg_next(sg); 1186 + ptr += len; 1187 + remain -= len; 1188 + x = 0; 1221 1189 } 1222 1190 } 1191 + 1192 + i915_gem_object_finish_access(src_obj); 1223 1193 1224 1194 memset32(dst + length, 0, (dst_obj->base.size - length) / sizeof(u32)); 1225 1195 1226 1196 /* dst_obj is returned with vmap pinned */ 1197 + *needs_clflush_after = dst_needs_clflush & CLFLUSH_AFTER; 1198 + 1227 1199 return dst; 1228 1200 } 1229 1201 ··· 1376 1360 if (target_cmd_index == offset) 1377 1361 return 0; 1378 1362 1363 + if (IS_ERR(jump_whitelist)) 1364 + return PTR_ERR(jump_whitelist); 1365 + 1379 1366 if (!test_bit(target_cmd_index, jump_whitelist)) { 1380 1367 DRM_DEBUG("CMD: BB_START to 0x%llx not a previously executed cmd\n", 1381 1368 jump_target); ··· 1388 1369 return 0; 1389 1370 } 1390 1371 1391 - /** 1392 - * intel_engine_cmd_parser_alloc_jump_whitelist() - preallocate jump whitelist for intel_engine_cmd_parser() 1393 - * @batch_length: length of the commands in batch_obj 1394 - * @trampoline: Whether jump trampolines are used. 1395 - * 1396 - * Preallocates a jump whitelist for parsing the cmd buffer in intel_engine_cmd_parser(). 1397 - * This has to be preallocated, because the command parser runs in signaling context, 1398 - * and may not allocate any memory. 1399 - * 1400 - * Return: NULL or pointer to a jump whitelist, or ERR_PTR() on failure. Use 1401 - * IS_ERR() to check for errors. Must bre freed() with kfree(). 1402 - * 1403 - * NULL is a valid value, meaning no allocation was required. 1404 - */ 1405 - unsigned long *intel_engine_cmd_parser_alloc_jump_whitelist(u32 batch_length, 1406 - bool trampoline) 1372 + static unsigned long *alloc_whitelist(u32 batch_length) 1407 1373 { 1408 1374 unsigned long *jmp; 1409 - 1410 - if (trampoline) 1411 - return NULL; 1412 1375 1413 1376 /* 1414 1377 * We expect batch_length to be less than 256KiB for known users, ··· 1416 1415 * @batch_offset: byte offset in the batch at which execution starts 1417 1416 * @batch_length: length of the commands in batch_obj 1418 1417 * @shadow: validated copy of the batch buffer in question 1419 - * @jump_whitelist: buffer preallocated with intel_engine_cmd_parser_alloc_jump_whitelist() 1420 - * @shadow_map: mapping to @shadow vma 1421 - * @batch_map: mapping to @batch vma 1418 + * @trampoline: true if we need to trampoline into privileged execution 1422 1419 * 1423 1420 * Parses the specified batch buffer looking for privilege violations as 1424 1421 * described in the overview. ··· 1424 1425 * Return: non-zero if the parser finds violations or otherwise fails; -EACCES 1425 1426 * if the batch appears legal but should use hardware parsing 1426 1427 */ 1428 + 1427 1429 int intel_engine_cmd_parser(struct intel_engine_cs *engine, 1428 1430 struct i915_vma *batch, 1429 1431 unsigned long batch_offset, 1430 1432 unsigned long batch_length, 1431 1433 struct i915_vma *shadow, 1432 - unsigned long *jump_whitelist, 1433 - void *shadow_map, 1434 - const void *batch_map) 1434 + bool trampoline) 1435 1435 { 1436 1436 u32 *cmd, *batch_end, offset = 0; 1437 1437 struct drm_i915_cmd_descriptor default_desc = noop_desc; 1438 1438 const struct drm_i915_cmd_descriptor *desc = &default_desc; 1439 + bool needs_clflush_after = false; 1440 + unsigned long *jump_whitelist; 1439 1441 u64 batch_addr, shadow_addr; 1440 1442 int ret = 0; 1441 - bool trampoline = !jump_whitelist; 1442 1443 1443 1444 GEM_BUG_ON(!IS_ALIGNED(batch_offset, sizeof(*cmd))); 1444 1445 GEM_BUG_ON(!IS_ALIGNED(batch_length, sizeof(*cmd))); ··· 1446 1447 batch->size)); 1447 1448 GEM_BUG_ON(!batch_length); 1448 1449 1449 - cmd = copy_batch(shadow->obj, batch->obj, batch_offset, batch_length, 1450 - shadow_map, batch_map); 1450 + cmd = copy_batch(shadow->obj, batch->obj, 1451 + batch_offset, batch_length, 1452 + &needs_clflush_after); 1453 + if (IS_ERR(cmd)) { 1454 + DRM_DEBUG("CMD: Failed to copy batch\n"); 1455 + return PTR_ERR(cmd); 1456 + } 1457 + 1458 + jump_whitelist = NULL; 1459 + if (!trampoline) 1460 + /* Defer failure until attempted use */ 1461 + jump_whitelist = alloc_whitelist(batch_length); 1451 1462 1452 1463 shadow_addr = gen8_canonical_addr(shadow->node.start); 1453 1464 batch_addr = gen8_canonical_addr(batch->node.start + batch_offset); ··· 1558 1549 1559 1550 i915_gem_object_flush_map(shadow->obj); 1560 1551 1552 + if (!IS_ERR_OR_NULL(jump_whitelist)) 1553 + kfree(jump_whitelist); 1554 + i915_gem_object_unpin_map(shadow->obj); 1561 1555 return ret; 1562 1556 } 1563 1557
+1 -6
drivers/gpu/drm/i915/i915_drv.h
··· 1906 1906 int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv); 1907 1907 int intel_engine_init_cmd_parser(struct intel_engine_cs *engine); 1908 1908 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine); 1909 - unsigned long *intel_engine_cmd_parser_alloc_jump_whitelist(u32 batch_length, 1910 - bool trampoline); 1911 - 1912 1909 int intel_engine_cmd_parser(struct intel_engine_cs *engine, 1913 1910 struct i915_vma *batch, 1914 1911 unsigned long batch_offset, 1915 1912 unsigned long batch_length, 1916 1913 struct i915_vma *shadow, 1917 - unsigned long *jump_whitelist, 1918 - void *shadow_map, 1919 - const void *batch_map); 1914 + bool trampoline); 1920 1915 #define I915_CMD_PARSER_TRAMPOLINE_SIZE 8 1921 1916 1922 1917 /* intel_device_info.c */
+2 -6
drivers/gpu/drm/i915/i915_request.c
··· 1426 1426 1427 1427 do { 1428 1428 fence = *child++; 1429 - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 1430 - i915_sw_fence_set_error_once(&rq->submit, fence->error); 1429 + if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 1431 1430 continue; 1432 - } 1433 1431 1434 1432 if (fence->context == rq->fence.context) 1435 1433 continue; ··· 1525 1527 1526 1528 do { 1527 1529 fence = *child++; 1528 - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 1529 - i915_sw_fence_set_error_once(&rq->submit, fence->error); 1530 + if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 1530 1531 continue; 1531 - } 1532 1532 1533 1533 /* 1534 1534 * Requests on the same timeline are explicitly ordered, along
+6
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 149 149 */ 150 150 if (bo->base.dev) 151 151 drm_gem_object_release(&bo->base); 152 + else 153 + dma_resv_fini(&bo->base._resv); 152 154 153 155 kfree(nvbo); 154 156 } ··· 331 329 tile_flags); 332 330 if (IS_ERR(nvbo)) 333 331 return PTR_ERR(nvbo); 332 + 333 + nvbo->bo.base.size = size; 334 + dma_resv_init(&nvbo->bo.base._resv); 335 + drm_vma_node_reset(&nvbo->bo.base.vma_node); 334 336 335 337 ret = nouveau_bo_init(nvbo, size, align, domain, sg, robj); 336 338 if (ret)
-1
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
··· 447 447 drm_panel_remove(&ts->base); 448 448 449 449 mipi_dsi_device_unregister(ts->dsi); 450 - kfree(ts->dsi); 451 450 452 451 return 0; 453 452 }
+3
drivers/gpu/drm/ttm/ttm_bo.c
··· 102 102 return; 103 103 } 104 104 105 + if (!mem) 106 + return; 107 + 105 108 man = ttm_manager_type(bdev, mem->mem_type); 106 109 list_move_tail(&bo->lru, &man->lru[bo->priority]); 107 110
+3
drivers/gpu/drm/ttm/ttm_bo_util.c
··· 63 63 void ttm_mem_io_free(struct ttm_device *bdev, 64 64 struct ttm_resource *mem) 65 65 { 66 + if (!mem) 67 + return; 68 + 66 69 if (!mem->bus.offset && !mem->bus.addr) 67 70 return; 68 71
+2
drivers/gpu/drm/ttm/ttm_device.c
··· 100 100 debugfs_create_atomic_t("buffer_objects", 0444, ttm_debugfs_root, 101 101 &glob->bo_count); 102 102 out: 103 + if (ret) 104 + --ttm_glob_use_count; 103 105 mutex_unlock(&ttm_global_mutex); 104 106 return ret; 105 107 }
+33 -16
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 1857 1857 vc4_hdmi_cec_update_clk_div(vc4_hdmi); 1858 1858 1859 1859 if (vc4_hdmi->variant->external_irq_controller) { 1860 - ret = devm_request_threaded_irq(&pdev->dev, 1861 - platform_get_irq_byname(pdev, "cec-rx"), 1862 - vc4_cec_irq_handler_rx_bare, 1863 - vc4_cec_irq_handler_rx_thread, 0, 1864 - "vc4 hdmi cec rx", vc4_hdmi); 1860 + ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-rx"), 1861 + vc4_cec_irq_handler_rx_bare, 1862 + vc4_cec_irq_handler_rx_thread, 0, 1863 + "vc4 hdmi cec rx", vc4_hdmi); 1865 1864 if (ret) 1866 1865 goto err_delete_cec_adap; 1867 1866 1868 - ret = devm_request_threaded_irq(&pdev->dev, 1869 - platform_get_irq_byname(pdev, "cec-tx"), 1870 - vc4_cec_irq_handler_tx_bare, 1871 - vc4_cec_irq_handler_tx_thread, 0, 1872 - "vc4 hdmi cec tx", vc4_hdmi); 1867 + ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-tx"), 1868 + vc4_cec_irq_handler_tx_bare, 1869 + vc4_cec_irq_handler_tx_thread, 0, 1870 + "vc4 hdmi cec tx", vc4_hdmi); 1873 1871 if (ret) 1874 - goto err_delete_cec_adap; 1872 + goto err_remove_cec_rx_handler; 1875 1873 } else { 1876 1874 HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff); 1877 1875 1878 - ret = devm_request_threaded_irq(&pdev->dev, platform_get_irq(pdev, 0), 1879 - vc4_cec_irq_handler, 1880 - vc4_cec_irq_handler_thread, 0, 1881 - "vc4 hdmi cec", vc4_hdmi); 1876 + ret = request_threaded_irq(platform_get_irq(pdev, 0), 1877 + vc4_cec_irq_handler, 1878 + vc4_cec_irq_handler_thread, 0, 1879 + "vc4 hdmi cec", vc4_hdmi); 1882 1880 if (ret) 1883 1881 goto err_delete_cec_adap; 1884 1882 } 1885 1883 1886 1884 ret = cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev); 1887 1885 if (ret < 0) 1888 - goto err_delete_cec_adap; 1886 + goto err_remove_handlers; 1889 1887 1890 1888 return 0; 1889 + 1890 + err_remove_handlers: 1891 + if (vc4_hdmi->variant->external_irq_controller) 1892 + free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi); 1893 + else 1894 + free_irq(platform_get_irq(pdev, 0), vc4_hdmi); 1895 + 1896 + err_remove_cec_rx_handler: 1897 + if (vc4_hdmi->variant->external_irq_controller) 1898 + free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi); 1891 1899 1892 1900 err_delete_cec_adap: 1893 1901 cec_delete_adapter(vc4_hdmi->cec_adap); ··· 1905 1897 1906 1898 static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) 1907 1899 { 1900 + struct platform_device *pdev = vc4_hdmi->pdev; 1901 + 1902 + if (vc4_hdmi->variant->external_irq_controller) { 1903 + free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi); 1904 + free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi); 1905 + } else { 1906 + free_irq(platform_get_irq(pdev, 0), vc4_hdmi); 1907 + } 1908 + 1908 1909 cec_unregister_adapter(vc4_hdmi->cec_adap); 1909 1910 } 1910 1911 #else
+66 -34
drivers/hv/channel_mgmt.c
··· 605 605 */ 606 606 mutex_lock(&vmbus_connection.channel_mutex); 607 607 608 + list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { 609 + if (guid_equal(&channel->offermsg.offer.if_type, 610 + &newchannel->offermsg.offer.if_type) && 611 + guid_equal(&channel->offermsg.offer.if_instance, 612 + &newchannel->offermsg.offer.if_instance)) { 613 + fnew = false; 614 + newchannel->primary_channel = channel; 615 + break; 616 + } 617 + } 618 + 608 619 init_vp_index(newchannel); 609 620 610 621 /* Remember the channels that should be cleaned up upon suspend. */ ··· 627 616 * we can release the potentially racing rescind thread. 628 617 */ 629 618 atomic_dec(&vmbus_connection.offer_in_progress); 630 - 631 - list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { 632 - if (guid_equal(&channel->offermsg.offer.if_type, 633 - &newchannel->offermsg.offer.if_type) && 634 - guid_equal(&channel->offermsg.offer.if_instance, 635 - &newchannel->offermsg.offer.if_instance)) { 636 - fnew = false; 637 - break; 638 - } 639 - } 640 619 641 620 if (fnew) { 642 621 list_add_tail(&newchannel->listentry, ··· 648 647 /* 649 648 * Process the sub-channel. 650 649 */ 651 - newchannel->primary_channel = channel; 652 650 list_add_tail(&newchannel->sc_list, &channel->sc_list); 653 651 } 654 652 ··· 684 684 } 685 685 686 686 /* 687 + * Check if CPUs used by other channels of the same device. 688 + * It should only be called by init_vp_index(). 689 + */ 690 + static bool hv_cpuself_used(u32 cpu, struct vmbus_channel *chn) 691 + { 692 + struct vmbus_channel *primary = chn->primary_channel; 693 + struct vmbus_channel *sc; 694 + 695 + lockdep_assert_held(&vmbus_connection.channel_mutex); 696 + 697 + if (!primary) 698 + return false; 699 + 700 + if (primary->target_cpu == cpu) 701 + return true; 702 + 703 + list_for_each_entry(sc, &primary->sc_list, sc_list) 704 + if (sc != chn && sc->target_cpu == cpu) 705 + return true; 706 + 707 + return false; 708 + } 709 + 710 + /* 687 711 * We use this state to statically distribute the channel interrupt load. 688 712 */ 689 713 static int next_numa_node_id; ··· 726 702 static void init_vp_index(struct vmbus_channel *channel) 727 703 { 728 704 bool perf_chn = hv_is_perf_channel(channel); 705 + u32 i, ncpu = num_online_cpus(); 729 706 cpumask_var_t available_mask; 730 707 struct cpumask *alloced_mask; 731 708 u32 target_cpu; ··· 749 724 return; 750 725 } 751 726 752 - while (true) { 753 - numa_node = next_numa_node_id++; 754 - if (numa_node == nr_node_ids) { 755 - next_numa_node_id = 0; 756 - continue; 727 + for (i = 1; i <= ncpu + 1; i++) { 728 + while (true) { 729 + numa_node = next_numa_node_id++; 730 + if (numa_node == nr_node_ids) { 731 + next_numa_node_id = 0; 732 + continue; 733 + } 734 + if (cpumask_empty(cpumask_of_node(numa_node))) 735 + continue; 736 + break; 757 737 } 758 - if (cpumask_empty(cpumask_of_node(numa_node))) 759 - continue; 760 - break; 738 + alloced_mask = &hv_context.hv_numa_map[numa_node]; 739 + 740 + if (cpumask_weight(alloced_mask) == 741 + cpumask_weight(cpumask_of_node(numa_node))) { 742 + /* 743 + * We have cycled through all the CPUs in the node; 744 + * reset the alloced map. 745 + */ 746 + cpumask_clear(alloced_mask); 747 + } 748 + 749 + cpumask_xor(available_mask, alloced_mask, 750 + cpumask_of_node(numa_node)); 751 + 752 + target_cpu = cpumask_first(available_mask); 753 + cpumask_set_cpu(target_cpu, alloced_mask); 754 + 755 + if (channel->offermsg.offer.sub_channel_index >= ncpu || 756 + i > ncpu || !hv_cpuself_used(target_cpu, channel)) 757 + break; 761 758 } 762 - alloced_mask = &hv_context.hv_numa_map[numa_node]; 763 - 764 - if (cpumask_weight(alloced_mask) == 765 - cpumask_weight(cpumask_of_node(numa_node))) { 766 - /* 767 - * We have cycled through all the CPUs in the node; 768 - * reset the alloced map. 769 - */ 770 - cpumask_clear(alloced_mask); 771 - } 772 - 773 - cpumask_xor(available_mask, alloced_mask, cpumask_of_node(numa_node)); 774 - 775 - target_cpu = cpumask_first(available_mask); 776 - cpumask_set_cpu(target_cpu, alloced_mask); 777 759 778 760 channel->target_cpu = target_cpu; 779 761
+2 -2
drivers/i2c/busses/i2c-mpc.c
··· 635 635 636 636 status = readb(i2c->base + MPC_I2C_SR); 637 637 if (status & CSR_MIF) { 638 - /* Read again to allow register to stabilise */ 639 - status = readb(i2c->base + MPC_I2C_SR); 638 + /* Wait up to 100us for transfer to properly complete */ 639 + readb_poll_timeout(i2c->base + MPC_I2C_SR, status, !(status & CSR_MCF), 0, 100); 640 640 writeb(0, i2c->base + MPC_I2C_SR); 641 641 mpc_i2c_do_intr(i2c, status); 642 642 return IRQ_HANDLED;
+2 -4
drivers/media/pci/intel/ipu3/cio2-bridge.c
··· 173 173 int ret; 174 174 175 175 for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) { 176 - if (!adev->status.enabled) { 177 - acpi_dev_put(adev); 176 + if (!adev->status.enabled) 178 177 continue; 179 - } 180 178 181 179 if (bridge->n_sensors >= CIO2_NUM_PORTS) { 182 180 acpi_dev_put(adev); ··· 183 185 } 184 186 185 187 sensor = &bridge->sensors[bridge->n_sensors]; 186 - sensor->adev = adev; 187 188 strscpy(sensor->name, cfg->hid, sizeof(sensor->name)); 188 189 189 190 ret = cio2_bridge_read_acpi_buffer(adev, "SSDB", ··· 212 215 goto err_free_swnodes; 213 216 } 214 217 218 + sensor->adev = acpi_dev_get(adev); 215 219 adev->fwnode.secondary = fwnode; 216 220 217 221 dev_info(&cio2->dev, "Found supported sensor %s\n",
+1 -1
drivers/media/pci/ngene/ngene-core.c
··· 385 385 386 386 com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER; 387 387 com.cmd.hdr.Length = 6; 388 - memcpy(&com.cmd.ConfigureBuffers.config, config, 6); 388 + memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6); 389 389 com.in_len = 6; 390 390 com.out_len = 0; 391 391
+8 -6
drivers/media/pci/ngene/ngene.h
··· 407 407 408 408 struct FW_CONFIGURE_FREE_BUFFERS { 409 409 struct FW_HEADER hdr; 410 - u8 UVI1_BufferLength; 411 - u8 UVI2_BufferLength; 412 - u8 TVO_BufferLength; 413 - u8 AUD1_BufferLength; 414 - u8 AUD2_BufferLength; 415 - u8 TVA_BufferLength; 410 + struct { 411 + u8 UVI1_BufferLength; 412 + u8 UVI2_BufferLength; 413 + u8 TVO_BufferLength; 414 + u8 AUD1_BufferLength; 415 + u8 AUD2_BufferLength; 416 + u8 TVA_BufferLength; 417 + } __packed config; 416 418 } __attribute__ ((__packed__)); 417 419 418 420 struct FW_CONFIGURE_UART {
+7 -10
drivers/misc/eeprom/at24.c
··· 714 714 } 715 715 716 716 /* 717 - * If the 'label' property is not present for the AT24 EEPROM, 718 - * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO, 719 - * and this will append the 'devid' to the name of the NVMEM 720 - * device. This is purely legacy and the AT24 driver has always 721 - * defaulted to this. However, if the 'label' property is 722 - * present then this means that the name is specified by the 723 - * firmware and this name should be used verbatim and so it is 724 - * not necessary to append the 'devid'. 717 + * We initialize nvmem_config.id to NVMEM_DEVID_AUTO even if the 718 + * label property is set as some platform can have multiple eeproms 719 + * with same label and we can not register each of those with same 720 + * label. Failing to register those eeproms trigger cascade failure 721 + * on such platform. 725 722 */ 723 + nvmem_config.id = NVMEM_DEVID_AUTO; 724 + 726 725 if (device_property_present(dev, "label")) { 727 - nvmem_config.id = NVMEM_DEVID_NONE; 728 726 err = device_property_read_string(dev, "label", 729 727 &nvmem_config.name); 730 728 if (err) 731 729 return err; 732 730 } else { 733 - nvmem_config.id = NVMEM_DEVID_AUTO; 734 731 nvmem_config.name = dev_name(dev); 735 732 } 736 733
+22 -15
drivers/mmc/core/block.c
··· 28 28 #include <linux/errno.h> 29 29 #include <linux/hdreg.h> 30 30 #include <linux/kdev_t.h> 31 + #include <linux/kref.h> 31 32 #include <linux/blkdev.h> 32 33 #include <linux/cdev.h> 33 34 #include <linux/mutex.h> ··· 112 111 #define MMC_BLK_CMD23 (1 << 0) /* Can do SET_BLOCK_COUNT for multiblock */ 113 112 #define MMC_BLK_REL_WR (1 << 1) /* MMC Reliable write support */ 114 113 115 - unsigned int usage; 114 + struct kref kref; 116 115 unsigned int read_only; 117 116 unsigned int part_type; 118 117 unsigned int reset_done; ··· 182 181 183 182 mutex_lock(&open_lock); 184 183 md = disk->private_data; 185 - if (md && md->usage == 0) 184 + if (md && !kref_get_unless_zero(&md->kref)) 186 185 md = NULL; 187 - if (md) 188 - md->usage++; 189 186 mutex_unlock(&open_lock); 190 187 191 188 return md; ··· 195 196 return devidx; 196 197 } 197 198 199 + static void mmc_blk_kref_release(struct kref *ref) 200 + { 201 + struct mmc_blk_data *md = container_of(ref, struct mmc_blk_data, kref); 202 + int devidx; 203 + 204 + devidx = mmc_get_devidx(md->disk); 205 + ida_simple_remove(&mmc_blk_ida, devidx); 206 + 207 + mutex_lock(&open_lock); 208 + md->disk->private_data = NULL; 209 + mutex_unlock(&open_lock); 210 + 211 + put_disk(md->disk); 212 + kfree(md); 213 + } 214 + 198 215 static void mmc_blk_put(struct mmc_blk_data *md) 199 216 { 200 - mutex_lock(&open_lock); 201 - md->usage--; 202 - if (md->usage == 0) { 203 - int devidx = mmc_get_devidx(md->disk); 204 - 205 - ida_simple_remove(&mmc_blk_ida, devidx); 206 - put_disk(md->disk); 207 - kfree(md); 208 - } 209 - mutex_unlock(&open_lock); 217 + kref_put(&md->kref, mmc_blk_kref_release); 210 218 } 211 219 212 220 static ssize_t power_ro_lock_show(struct device *dev, ··· 2333 2327 2334 2328 INIT_LIST_HEAD(&md->part); 2335 2329 INIT_LIST_HEAD(&md->rpmbs); 2336 - md->usage = 1; 2330 + kref_init(&md->kref); 2331 + 2337 2332 md->queue.blkdata = md; 2338 2333 2339 2334 md->disk->major = MMC_BLOCK_MAJOR;
+11 -11
drivers/mmc/core/host.c
··· 75 75 { 76 76 struct mmc_host *host = cls_dev_to_mmc_host(dev); 77 77 wakeup_source_unregister(host->ws); 78 - ida_simple_remove(&mmc_host_ida, host->index); 78 + if (of_alias_get_id(host->parent->of_node, "mmc") < 0) 79 + ida_simple_remove(&mmc_host_ida, host->index); 79 80 kfree(host); 80 81 } 81 82 ··· 503 502 */ 504 503 struct mmc_host *mmc_alloc_host(int extra, struct device *dev) 505 504 { 506 - int err; 505 + int index; 507 506 struct mmc_host *host; 508 507 int alias_id, min_idx, max_idx; 509 508 ··· 516 515 517 516 alias_id = of_alias_get_id(dev->of_node, "mmc"); 518 517 if (alias_id >= 0) { 519 - min_idx = alias_id; 520 - max_idx = alias_id + 1; 518 + index = alias_id; 521 519 } else { 522 520 min_idx = mmc_first_nonreserved_index(); 523 521 max_idx = 0; 522 + 523 + index = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL); 524 + if (index < 0) { 525 + kfree(host); 526 + return NULL; 527 + } 524 528 } 525 529 526 - err = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL); 527 - if (err < 0) { 528 - kfree(host); 529 - return NULL; 530 - } 531 - 532 - host->index = err; 530 + host->index = index; 533 531 534 532 dev_set_name(&host->class_dev, "mmc%d", host->index); 535 533 host->ws = wakeup_source_register(NULL, dev_name(&host->class_dev));
+2
drivers/net/bonding/bond_main.c
··· 3450 3450 return bond_event_changename(event_bond); 3451 3451 case NETDEV_UNREGISTER: 3452 3452 bond_remove_proc_entry(event_bond); 3453 + #ifdef CONFIG_XFRM_OFFLOAD 3453 3454 xfrm_dev_state_flush(dev_net(bond_dev), bond_dev, true); 3455 + #endif /* CONFIG_XFRM_OFFLOAD */ 3454 3456 break; 3455 3457 case NETDEV_REGISTER: 3456 3458 bond_create_proc_entry(event_bond);
+2
drivers/net/dsa/mt7530.c
··· 366 366 int i; 367 367 368 368 reg[1] |= vid & CVID_MASK; 369 + if (vid > 1) 370 + reg[1] |= ATA2_IVL; 369 371 reg[2] |= (aging & AGE_TIMER_MASK) << AGE_TIMER; 370 372 reg[2] |= (port_mask & PORT_MAP_MASK) << PORT_MAP; 371 373 /* STATIC_ENT indicate that entry is static wouldn't
+1
drivers/net/dsa/mt7530.h
··· 79 79 #define STATIC_EMP 0 80 80 #define STATIC_ENT 3 81 81 #define MT7530_ATA2 0x78 82 + #define ATA2_IVL BIT(15) 82 83 83 84 /* Register for address table write data */ 84 85 #define MT7530_ATWD 0x7c
+1 -1
drivers/net/dsa/mv88e6xxx/Kconfig
··· 12 12 config NET_DSA_MV88E6XXX_PTP 13 13 bool "PTP support for Marvell 88E6xxx" 14 14 default n 15 - depends on PTP_1588_CLOCK 15 + depends on NET_DSA_MV88E6XXX && PTP_1588_CLOCK 16 16 help 17 17 Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch 18 18 chips that support it.
+6
drivers/net/dsa/sja1105/sja1105_main.c
··· 397 397 if (dsa_is_cpu_port(ds, port)) 398 398 v->pvid = true; 399 399 list_add(&v->list, &priv->dsa_8021q_vlans); 400 + 401 + v = kmemdup(v, sizeof(*v), GFP_KERNEL); 402 + if (!v) 403 + return -ENOMEM; 404 + 405 + list_add(&v->list, &priv->bridge_vlans); 400 406 } 401 407 402 408 ((struct sja1105_vlan_lookup_entry *)table->entries)[0] = pvid;
+62 -23
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 1671 1671 1672 1672 if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) && 1673 1673 (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) { 1674 - u16 vlan_proto = tpa_info->metadata >> 1675 - RX_CMP_FLAGS2_METADATA_TPID_SFT; 1674 + __be16 vlan_proto = htons(tpa_info->metadata >> 1675 + RX_CMP_FLAGS2_METADATA_TPID_SFT); 1676 1676 u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK; 1677 1677 1678 - __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag); 1678 + if (eth_type_vlan(vlan_proto)) { 1679 + __vlan_hwaccel_put_tag(skb, vlan_proto, vtag); 1680 + } else { 1681 + dev_kfree_skb(skb); 1682 + return NULL; 1683 + } 1679 1684 } 1680 1685 1681 1686 skb_checksum_none_assert(skb); ··· 1902 1897 (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) { 1903 1898 u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data); 1904 1899 u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK; 1905 - u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT; 1900 + __be16 vlan_proto = htons(meta_data >> 1901 + RX_CMP_FLAGS2_METADATA_TPID_SFT); 1906 1902 1907 - __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag); 1903 + if (eth_type_vlan(vlan_proto)) { 1904 + __vlan_hwaccel_put_tag(skb, vlan_proto, vtag); 1905 + } else { 1906 + dev_kfree_skb(skb); 1907 + goto next_rx; 1908 + } 1908 1909 } 1909 1910 1910 1911 skb_checksum_none_assert(skb); ··· 7574 7563 bp->flags &= ~BNXT_FLAG_WOL_CAP; 7575 7564 if (flags & FUNC_QCAPS_RESP_FLAGS_WOL_MAGICPKT_SUPPORTED) 7576 7565 bp->flags |= BNXT_FLAG_WOL_CAP; 7577 - if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) 7566 + if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) { 7578 7567 __bnxt_hwrm_ptp_qcfg(bp); 7568 + } else { 7569 + kfree(bp->ptp_cfg); 7570 + bp->ptp_cfg = NULL; 7571 + } 7579 7572 } else { 7580 7573 #ifdef CONFIG_BNXT_SRIOV 7581 7574 struct bnxt_vf_info *vf = &bp->vf; ··· 10138 10123 } 10139 10124 } 10140 10125 10141 - bnxt_ptp_start(bp); 10142 10126 rc = bnxt_init_nic(bp, irq_re_init); 10143 10127 if (rc) { 10144 10128 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); ··· 10211 10197 { 10212 10198 int rc = 0; 10213 10199 10200 + if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { 10201 + netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n"); 10202 + rc = -ENODEV; 10203 + goto half_open_err; 10204 + } 10205 + 10214 10206 rc = bnxt_alloc_mem(bp, false); 10215 10207 if (rc) { 10216 10208 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); ··· 10276 10256 rc = bnxt_hwrm_if_change(bp, true); 10277 10257 if (rc) 10278 10258 return rc; 10259 + 10260 + if (bnxt_ptp_init(bp)) { 10261 + netdev_warn(dev, "PTP initialization failed.\n"); 10262 + kfree(bp->ptp_cfg); 10263 + bp->ptp_cfg = NULL; 10264 + } 10279 10265 rc = __bnxt_open_nic(bp, true, true); 10280 10266 if (rc) { 10281 10267 bnxt_hwrm_if_change(bp, false); 10268 + bnxt_ptp_clear(bp); 10282 10269 } else { 10283 10270 if (test_and_clear_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) { 10284 10271 if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) { ··· 10376 10349 { 10377 10350 struct bnxt *bp = netdev_priv(dev); 10378 10351 10352 + bnxt_ptp_clear(bp); 10379 10353 bnxt_hwmon_close(bp); 10380 10354 bnxt_close_nic(bp, true, true); 10381 10355 bnxt_hwrm_shutdown_link(bp); ··· 11363 11335 bnxt_clear_int_mode(bp); 11364 11336 pci_disable_device(bp->pdev); 11365 11337 } 11338 + bnxt_ptp_clear(bp); 11366 11339 __bnxt_close_nic(bp, true, false); 11367 11340 bnxt_vf_reps_free(bp); 11368 11341 bnxt_clear_int_mode(bp); ··· 11988 11959 (bp->fw_reset_max_dsecs * HZ / 10)); 11989 11960 } 11990 11961 11962 + static void bnxt_fw_reset_abort(struct bnxt *bp, int rc) 11963 + { 11964 + clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 11965 + if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF) { 11966 + bnxt_ulp_start(bp, rc); 11967 + bnxt_dl_health_status_update(bp, false); 11968 + } 11969 + bp->fw_reset_state = 0; 11970 + dev_close(bp->dev); 11971 + } 11972 + 11991 11973 static void bnxt_fw_reset_task(struct work_struct *work) 11992 11974 { 11993 11975 struct bnxt *bp = container_of(work, struct bnxt, fw_reset_task.work); 11994 - int rc; 11976 + int rc = 0; 11995 11977 11996 11978 if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) { 11997 11979 netdev_err(bp->dev, "bnxt_fw_reset_task() called when not in fw reset mode!\n"); ··· 12032 11992 } 12033 11993 bp->fw_reset_timestamp = jiffies; 12034 11994 rtnl_lock(); 11995 + if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) { 11996 + bnxt_fw_reset_abort(bp, rc); 11997 + rtnl_unlock(); 11998 + return; 11999 + } 12035 12000 bnxt_fw_reset_close(bp); 12036 12001 if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) { 12037 12002 bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN; ··· 12084 12039 if (val == 0xffff) { 12085 12040 if (bnxt_fw_reset_timeout(bp)) { 12086 12041 netdev_err(bp->dev, "Firmware reset aborted, PCI config space invalid\n"); 12042 + rc = -ETIMEDOUT; 12087 12043 goto fw_reset_abort; 12088 12044 } 12089 12045 bnxt_queue_fw_reset_work(bp, HZ / 1000); ··· 12094 12048 clear_bit(BNXT_STATE_FW_FATAL_COND, &bp->state); 12095 12049 if (pci_enable_device(bp->pdev)) { 12096 12050 netdev_err(bp->dev, "Cannot re-enable PCI device\n"); 12051 + rc = -ENODEV; 12097 12052 goto fw_reset_abort; 12098 12053 } 12099 12054 pci_set_master(bp->pdev); ··· 12121 12074 } 12122 12075 rc = bnxt_open(bp->dev); 12123 12076 if (rc) { 12124 - netdev_err(bp->dev, "bnxt_open_nic() failed\n"); 12125 - clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 12126 - dev_close(bp->dev); 12077 + netdev_err(bp->dev, "bnxt_open() failed during FW reset\n"); 12078 + bnxt_fw_reset_abort(bp, rc); 12079 + rtnl_unlock(); 12080 + return; 12127 12081 } 12128 12082 12129 12083 bp->fw_reset_state = 0; ··· 12151 12103 netdev_err(bp->dev, "fw_health_status 0x%x\n", sts); 12152 12104 } 12153 12105 fw_reset_abort: 12154 - clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 12155 - if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF) 12156 - bnxt_dl_health_status_update(bp, false); 12157 - bp->fw_reset_state = 0; 12158 12106 rtnl_lock(); 12159 - dev_close(bp->dev); 12107 + bnxt_fw_reset_abort(bp, rc); 12160 12108 rtnl_unlock(); 12161 12109 } 12162 12110 ··· 12706 12662 if (BNXT_PF(bp)) 12707 12663 devlink_port_type_clear(&bp->dl_port); 12708 12664 12709 - bnxt_ptp_clear(bp); 12710 12665 pci_disable_pcie_error_reporting(pdev); 12711 12666 unregister_netdev(dev); 12712 12667 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); ··· 13289 13246 rc); 13290 13247 } 13291 13248 13292 - if (bnxt_ptp_init(bp)) { 13293 - netdev_warn(dev, "PTP initialization failed.\n"); 13294 - kfree(bp->ptp_cfg); 13295 - bp->ptp_cfg = NULL; 13296 - } 13297 13249 bnxt_inv_fw_health_reg(bp); 13298 13250 bnxt_dl_register(bp); 13299 13251 ··· 13474 13436 if (netif_running(netdev)) 13475 13437 bnxt_close(netdev); 13476 13438 13477 - pci_disable_device(pdev); 13439 + if (pci_is_enabled(pdev)) 13440 + pci_disable_device(pdev); 13478 13441 bnxt_free_ctx_mem(bp); 13479 13442 kfree(bp->ctx); 13480 13443 bp->ctx = NULL;
+9 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
··· 433 433 static int bnxt_ets_validate(struct bnxt *bp, struct ieee_ets *ets, u8 *tc) 434 434 { 435 435 int total_ets_bw = 0; 436 + bool zero = false; 436 437 u8 max_tc = 0; 437 438 int i; 438 439 ··· 454 453 break; 455 454 case IEEE_8021QAZ_TSA_ETS: 456 455 total_ets_bw += ets->tc_tx_bw[i]; 456 + zero = zero || !ets->tc_tx_bw[i]; 457 457 break; 458 458 default: 459 459 return -ENOTSUPP; 460 460 } 461 461 } 462 - if (total_ets_bw > 100) 462 + if (total_ets_bw > 100) { 463 + netdev_warn(bp->dev, "rejecting ETS config exceeding available bandwidth\n"); 463 464 return -EINVAL; 465 + } 466 + if (zero && total_ets_bw == 100) { 467 + netdev_warn(bp->dev, "rejecting ETS config starving a TC\n"); 468 + return -EINVAL; 469 + } 464 470 465 471 if (max_tc >= bp->max_tc) 466 472 *tc = bp->max_tc;
+7 -17
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
··· 385 385 return 0; 386 386 } 387 387 388 - void bnxt_ptp_start(struct bnxt *bp) 389 - { 390 - struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; 391 - 392 - if (!ptp) 393 - return; 394 - 395 - if (bp->flags & BNXT_FLAG_CHIP_P5) { 396 - spin_lock_bh(&ptp->ptp_lock); 397 - ptp->current_time = bnxt_refclk_read(bp, NULL); 398 - WRITE_ONCE(ptp->old_time, ptp->current_time); 399 - spin_unlock_bh(&ptp->ptp_lock); 400 - ptp_schedule_worker(ptp->ptp_clock, 0); 401 - } 402 - } 403 - 404 388 static const struct ptp_clock_info bnxt_ptp_caps = { 405 389 .owner = THIS_MODULE, 406 390 .name = "bnxt clock", ··· 434 450 bnxt_unmap_ptp_regs(bp); 435 451 return err; 436 452 } 437 - 453 + if (bp->flags & BNXT_FLAG_CHIP_P5) { 454 + spin_lock_bh(&ptp->ptp_lock); 455 + ptp->current_time = bnxt_refclk_read(bp, NULL); 456 + WRITE_ONCE(ptp->old_time, ptp->current_time); 457 + spin_unlock_bh(&ptp->ptp_lock); 458 + ptp_schedule_worker(ptp->ptp_clock, 0); 459 + } 438 460 return 0; 439 461 } 440 462
-1
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
··· 75 75 int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr); 76 76 int bnxt_get_tx_ts_p5(struct bnxt *bp, struct sk_buff *skb); 77 77 int bnxt_get_rx_ts_p5(struct bnxt *bp, u64 *ts, u32 pkt_ts); 78 - void bnxt_ptp_start(struct bnxt *bp); 79 78 int bnxt_ptp_init(struct bnxt *bp); 80 79 void bnxt_ptp_clear(struct bnxt *bp); 81 80 #endif
+5 -4
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
··· 479 479 if (!edev) 480 480 return ERR_PTR(-ENOMEM); 481 481 edev->en_ops = &bnxt_en_ops_tbl; 482 - if (bp->flags & BNXT_FLAG_ROCEV1_CAP) 483 - edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; 484 - if (bp->flags & BNXT_FLAG_ROCEV2_CAP) 485 - edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; 486 482 edev->net = dev; 487 483 edev->pdev = bp->pdev; 488 484 edev->l2_db_size = bp->db_size; 489 485 edev->l2_db_size_nc = bp->db_size; 490 486 bp->edev = edev; 491 487 } 488 + edev->flags &= ~BNXT_EN_FLAG_ROCE_CAP; 489 + if (bp->flags & BNXT_FLAG_ROCEV1_CAP) 490 + edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP; 491 + if (bp->flags & BNXT_FLAG_ROCEV2_CAP) 492 + edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP; 492 493 return bp->edev; 493 494 } 494 495 EXPORT_SYMBOL(bnxt_ulp_probe);
+1 -1
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
··· 420 420 * bits 32:47 indicate the PVF num. 421 421 */ 422 422 for (q_no = 0; q_no < ern; q_no++) { 423 - reg_val = oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; 423 + reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS; 424 424 425 425 /* for VF assigned queues. */ 426 426 if (q_no < oct->sriov_info.pf_srn) {
+8 -8
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
··· 2770 2770 if (err) 2771 2771 return err; 2772 2772 2773 - err = dpaa2_switch_seed_bp(ethsw); 2774 - if (err) 2775 - goto err_free_dpbp; 2776 - 2777 2773 err = dpaa2_switch_alloc_rings(ethsw); 2778 2774 if (err) 2779 - goto err_drain_dpbp; 2775 + goto err_free_dpbp; 2780 2776 2781 2777 err = dpaa2_switch_setup_dpio(ethsw); 2782 2778 if (err) 2783 2779 goto err_destroy_rings; 2784 2780 2781 + err = dpaa2_switch_seed_bp(ethsw); 2782 + if (err) 2783 + goto err_deregister_dpio; 2784 + 2785 2785 err = dpsw_ctrl_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle); 2786 2786 if (err) { 2787 2787 dev_err(ethsw->dev, "dpsw_ctrl_if_enable err %d\n", err); 2788 - goto err_deregister_dpio; 2788 + goto err_drain_dpbp; 2789 2789 } 2790 2790 2791 2791 return 0; 2792 2792 2793 + err_drain_dpbp: 2794 + dpaa2_switch_drain_bp(ethsw); 2793 2795 err_deregister_dpio: 2794 2796 dpaa2_switch_free_dpio(ethsw); 2795 2797 err_destroy_rings: 2796 2798 dpaa2_switch_destroy_rings(ethsw); 2797 - err_drain_dpbp: 2798 - dpaa2_switch_drain_bp(ethsw); 2799 2799 err_free_dpbp: 2800 2800 dpaa2_switch_free_dpbp(ethsw); 2801 2801
+1
drivers/net/ethernet/freescale/fman/mac.c
··· 524 524 | SUPPORTED_Autoneg \ 525 525 | SUPPORTED_Pause \ 526 526 | SUPPORTED_Asym_Pause \ 527 + | SUPPORTED_FIBRE \ 527 528 | SUPPORTED_MII) 528 529 529 530 static DEFINE_MUTEX(eth_lock);
+3 -3
drivers/net/ethernet/hisilicon/hip04_eth.c
··· 131 131 /* buf unit size is cache_line_size, which is 64, so the shift is 6 */ 132 132 #define PPE_BUF_SIZE_SHIFT 6 133 133 #define PPE_TX_BUF_HOLD BIT(31) 134 - #define CACHE_LINE_MASK 0x3F 134 + #define SOC_CACHE_LINE_MASK 0x3F 135 135 #else 136 136 #define PPE_CFG_QOS_VMID_GRP_SHIFT 8 137 137 #define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 ··· 531 531 #if defined(CONFIG_HI13X1_GMAC) 532 532 desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV 533 533 | TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT); 534 - desc->data_offset = (__force u32)cpu_to_be32(phys & CACHE_LINE_MASK); 535 - desc->send_addr = (__force u32)cpu_to_be32(phys & ~CACHE_LINE_MASK); 534 + desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK); 535 + desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK); 536 536 #else 537 537 desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV); 538 538 desc->send_addr = (__force u32)cpu_to_be32(phys);
+5 -2
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
··· 98 98 u32 origin_mbx_msg; 99 99 bool received_resp; 100 100 int resp_status; 101 + u16 match_id; 101 102 u8 additional_info[HCLGE_MBX_MAX_RESP_DATA_SIZE]; 102 103 }; 103 104 ··· 144 143 u8 mbx_need_resp; 145 144 u8 rsv1[1]; 146 145 u8 msg_len; 147 - u8 rsv2[3]; 146 + u8 rsv2; 147 + u16 match_id; 148 148 struct hclge_vf_to_pf_msg msg; 149 149 }; 150 150 ··· 155 153 u8 dest_vfid; 156 154 u8 rsv[3]; 157 155 u8 msg_len; 158 - u8 rsv1[3]; 156 + u8 rsv1; 157 + u16 match_id; 159 158 struct hclge_pf_to_vf_msg msg; 160 159 }; 161 160
+6 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 9552 9552 if (ret) 9553 9553 return ret; 9554 9554 9555 - if (test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, ae_dev->caps)) 9555 + if (test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, ae_dev->caps)) { 9556 9556 ret = hclge_set_port_vlan_filter_bypass(hdev, vport->vport_id, 9557 9557 !enable); 9558 - else if (!vport->vport_id) 9558 + } else if (!vport->vport_id) { 9559 + if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps)) 9560 + enable = false; 9561 + 9559 9562 ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, 9560 9563 HCLGE_FILTER_FE_INGRESS, 9561 9564 enable, 0); 9565 + } 9562 9566 9563 9567 return ret; 9564 9568 }
+1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 47 47 48 48 resp_pf_to_vf->dest_vfid = vf_to_pf_req->mbx_src_vfid; 49 49 resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len; 50 + resp_pf_to_vf->match_id = vf_to_pf_req->match_id; 50 51 51 52 resp_pf_to_vf->msg.code = HCLGE_MBX_PF_VF_RESP; 52 53 resp_pf_to_vf->msg.vf_mbx_msg_code = vf_to_pf_req->msg.code;
+10
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 2641 2641 2642 2642 static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev) 2643 2643 { 2644 + struct hnae3_handle *nic = &hdev->nic; 2645 + int ret; 2646 + 2647 + ret = hclgevf_en_hw_strip_rxvtag(nic, true); 2648 + if (ret) { 2649 + dev_err(&hdev->pdev->dev, 2650 + "failed to enable rx vlan offload, ret = %d\n", ret); 2651 + return ret; 2652 + } 2653 + 2644 2654 return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0, 2645 2655 false); 2646 2656 }
+19
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
··· 13 13 return resp_code ? -resp_code : 0; 14 14 } 15 15 16 + #define HCLGEVF_MBX_MATCH_ID_START 1 16 17 static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev) 17 18 { 18 19 /* this function should be called with mbx_resp.mbx_mutex held ··· 22 21 hdev->mbx_resp.received_resp = false; 23 22 hdev->mbx_resp.origin_mbx_msg = 0; 24 23 hdev->mbx_resp.resp_status = 0; 24 + hdev->mbx_resp.match_id++; 25 + /* Update match_id and ensure the value of match_id is not zero */ 26 + if (hdev->mbx_resp.match_id == 0) 27 + hdev->mbx_resp.match_id = HCLGEVF_MBX_MATCH_ID_START; 25 28 memset(hdev->mbx_resp.additional_info, 0, HCLGE_MBX_MAX_RESP_DATA_SIZE); 26 29 } 27 30 ··· 120 115 if (need_resp) { 121 116 mutex_lock(&hdev->mbx_resp.mbx_mutex); 122 117 hclgevf_reset_mbx_resp_status(hdev); 118 + req->match_id = hdev->mbx_resp.match_id; 123 119 status = hclgevf_cmd_send(&hdev->hw, &desc, 1); 124 120 if (status) { 125 121 dev_err(&hdev->pdev->dev, ··· 216 210 for (i = 0; i < HCLGE_MBX_MAX_RESP_DATA_SIZE; i++) { 217 211 resp->additional_info[i] = *temp; 218 212 temp++; 213 + } 214 + 215 + /* If match_id is not zero, it means PF support 216 + * match_id. If the match_id is right, VF get the 217 + * right response, otherwise ignore the response. 218 + * Driver will clear hdev->mbx_resp when send 219 + * next message which need response. 220 + */ 221 + if (req->match_id) { 222 + if (req->match_id == resp->match_id) 223 + resp->received_resp = true; 224 + } else { 225 + resp->received_resp = true; 219 226 } 220 227 break; 221 228 case HCLGE_MBX_LINK_STAT_CHANGE:
+1 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 1731 1731 tx_send_failed++; 1732 1732 tx_dropped++; 1733 1733 ret = NETDEV_TX_OK; 1734 - ibmvnic_tx_scrq_flush(adapter, tx_scrq); 1735 1734 goto out; 1736 1735 } 1737 1736 ··· 1752 1753 dev_kfree_skb_any(skb); 1753 1754 tx_send_failed++; 1754 1755 tx_dropped++; 1756 + ibmvnic_tx_scrq_flush(adapter, tx_scrq); 1755 1757 ret = NETDEV_TX_OK; 1756 1758 goto out; 1757 1759 }
+2 -1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 1825 1825 struct sk_buff *skb) 1826 1826 { 1827 1827 if (ring_uses_build_skb(rx_ring)) { 1828 - unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK; 1828 + unsigned long mask = (unsigned long)ixgbe_rx_pg_size(rx_ring) - 1; 1829 + unsigned long offset = (unsigned long)(skb->data) & mask; 1829 1830 1830 1831 dma_sync_single_range_for_cpu(rx_ring->dev, 1831 1832 IXGBE_CB(skb)->dma,
+1 -1
drivers/net/ethernet/marvell/octeontx2/af/Makefile
··· 10 10 rvu_mbox-y := mbox.o rvu_trace.o 11 11 rvu_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ 12 12 rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o rvu_npc_fs.o \ 13 - rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o 13 + rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o rvu_switch.o
+9 -1
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
··· 1314 1314 return rvu_detach_rsrcs(rvu, detach, detach->hdr.pcifunc); 1315 1315 } 1316 1316 1317 - static int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc) 1317 + int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc) 1318 1318 { 1319 1319 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); 1320 1320 int blkaddr = BLKADDR_NIX0, vf; ··· 2859 2859 if (!vfs) 2860 2860 return 0; 2861 2861 2862 + /* LBK channel number 63 is used for switching packets between 2863 + * CGX mapped VFs. Hence limit LBK pairs till 62 only. 2864 + */ 2865 + if (vfs > 62) 2866 + vfs = 62; 2867 + 2862 2868 /* Save VFs number for reference in VF interrupts handlers. 2863 2869 * Since interrupts might start arriving during SRIOV enablement 2864 2870 * ordinary API cannot be used to get number of enabled VFs. ··· 3006 3000 3007 3001 /* Initialize debugfs */ 3008 3002 rvu_dbg_init(rvu); 3003 + 3004 + mutex_init(&rvu->rswitch.switch_lock); 3009 3005 3010 3006 return 0; 3011 3007 err_dl:
+21
drivers/net/ethernet/marvell/octeontx2/af/rvu.h
··· 415 415 size_t kpus; 416 416 }; 417 417 418 + #define RVU_SWITCH_LBK_CHAN 63 419 + 420 + struct rvu_switch { 421 + struct mutex switch_lock; /* Serialize flow installation */ 422 + u32 used_entries; 423 + u16 *entry2pcifunc; 424 + u16 mode; 425 + u16 start_entry; 426 + }; 427 + 418 428 struct rvu { 419 429 void __iomem *afreg_base; 420 430 void __iomem *pfreg_base; ··· 455 445 456 446 /* CGX */ 457 447 #define PF_CGXMAP_BASE 1 /* PF 0 is reserved for RVU PF */ 448 + u16 cgx_mapped_vfs; /* maximum CGX mapped VFs */ 458 449 u8 cgx_mapped_pfs; 459 450 u8 cgx_cnt_max; /* CGX port count max */ 460 451 u8 *pf2cgxlmac_map; /* pf to cgx_lmac map */ ··· 488 477 struct rvu_debugfs rvu_dbg; 489 478 #endif 490 479 struct rvu_devlink *rvu_dl; 480 + 481 + /* RVU switch implementation over NPC with DMAC rules */ 482 + struct rvu_switch rswitch; 491 483 }; 492 484 493 485 static inline void rvu_write64(struct rvu *rvu, u64 block, u64 offset, u64 val) ··· 705 691 struct nix_cn10k_aq_enq_req *aq_req, 706 692 struct nix_cn10k_aq_enq_rsp *aq_rsp, 707 693 u16 pcifunc, u8 ctype, u32 qidx); 694 + int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc); 708 695 709 696 /* NPC APIs */ 710 697 int rvu_npc_init(struct rvu *rvu); ··· 783 768 static inline void rvu_dbg_init(struct rvu *rvu) {} 784 769 static inline void rvu_dbg_exit(struct rvu *rvu) {} 785 770 #endif 771 + 772 + /* RVU Switch */ 773 + void rvu_switch_enable(struct rvu *rvu); 774 + void rvu_switch_disable(struct rvu *rvu); 775 + void rvu_switch_update_rules(struct rvu *rvu, u16 pcifunc); 776 + 786 777 #endif /* RVU_H */
+3
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
··· 126 126 unsigned long lmac_bmap; 127 127 int size, free_pkind; 128 128 int cgx, lmac, iter; 129 + int numvfs, hwvfs; 129 130 130 131 if (!cgx_cnt_max) 131 132 return 0; ··· 167 166 pkind->pfchan_map[free_pkind] = ((pf) & 0x3F) << 16; 168 167 rvu_map_cgx_nix_block(rvu, pf, cgx, lmac); 169 168 rvu->cgx_mapped_pfs++; 169 + rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvfs); 170 + rvu->cgx_mapped_vfs += numvfs; 170 171 pf++; 171 172 } 172 173 }
+1 -4
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
··· 2113 2113 int entry_acnt, entry_ecnt; 2114 2114 int cntr_acnt, cntr_ecnt; 2115 2115 2116 - /* Skip PF0 */ 2117 - if (!pcifunc) 2118 - return; 2119 2116 rvu_npc_get_mcam_entry_alloc_info(rvu, pcifunc, blkaddr, 2120 2117 &entry_acnt, &entry_ecnt); 2121 2118 rvu_npc_get_mcam_counter_alloc_info(rvu, pcifunc, blkaddr, ··· 2295 2298 static void rvu_dbg_npc_mcam_show_action(struct seq_file *s, 2296 2299 struct rvu_npc_mcam_rule *rule) 2297 2300 { 2298 - if (rule->intf == NIX_INTF_TX) { 2301 + if (is_npc_intf_tx(rule->intf)) { 2299 2302 switch (rule->tx_action.op) { 2300 2303 case NIX_TX_ACTIONOP_DROP: 2301 2304 seq_puts(s, "\taction: Drop\n");
+41 -7
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
··· 1364 1364 rvu_nix_health_reporters_destroy(rvu_dl); 1365 1365 } 1366 1366 1367 + static int rvu_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode) 1368 + { 1369 + struct rvu_devlink *rvu_dl = devlink_priv(devlink); 1370 + struct rvu *rvu = rvu_dl->rvu; 1371 + struct rvu_switch *rswitch; 1372 + 1373 + rswitch = &rvu->rswitch; 1374 + *mode = rswitch->mode; 1375 + 1376 + return 0; 1377 + } 1378 + 1379 + static int rvu_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, 1380 + struct netlink_ext_ack *extack) 1381 + { 1382 + struct rvu_devlink *rvu_dl = devlink_priv(devlink); 1383 + struct rvu *rvu = rvu_dl->rvu; 1384 + struct rvu_switch *rswitch; 1385 + 1386 + rswitch = &rvu->rswitch; 1387 + switch (mode) { 1388 + case DEVLINK_ESWITCH_MODE_LEGACY: 1389 + case DEVLINK_ESWITCH_MODE_SWITCHDEV: 1390 + if (rswitch->mode == mode) 1391 + return 0; 1392 + rswitch->mode = mode; 1393 + if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) 1394 + rvu_switch_enable(rvu); 1395 + else 1396 + rvu_switch_disable(rvu); 1397 + break; 1398 + default: 1399 + return -EINVAL; 1400 + } 1401 + 1402 + return 0; 1403 + } 1404 + 1367 1405 static int rvu_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req, 1368 1406 struct netlink_ext_ack *extack) 1369 1407 { ··· 1410 1372 1411 1373 static const struct devlink_ops rvu_devlink_ops = { 1412 1374 .info_get = rvu_devlink_info_get, 1375 + .eswitch_mode_get = rvu_devlink_eswitch_mode_get, 1376 + .eswitch_mode_set = rvu_devlink_eswitch_mode_set, 1413 1377 }; 1414 1378 1415 1379 int rvu_register_dl(struct rvu *rvu) ··· 1420 1380 struct devlink *dl; 1421 1381 int err; 1422 1382 1423 - rvu_dl = kzalloc(sizeof(*rvu_dl), GFP_KERNEL); 1424 - if (!rvu_dl) 1425 - return -ENOMEM; 1426 - 1427 1383 dl = devlink_alloc(&rvu_devlink_ops, sizeof(struct rvu_devlink)); 1428 1384 if (!dl) { 1429 1385 dev_warn(rvu->dev, "devlink_alloc failed\n"); 1430 - kfree(rvu_dl); 1431 1386 return -ENOMEM; 1432 1387 } 1433 1388 ··· 1430 1395 if (err) { 1431 1396 dev_err(rvu->dev, "devlink register failed with error %d\n", err); 1432 1397 devlink_free(dl); 1433 - kfree(rvu_dl); 1434 1398 return err; 1435 1399 } 1436 1400 1401 + rvu_dl = devlink_priv(dl); 1437 1402 rvu_dl->dl = dl; 1438 1403 rvu_dl->rvu = rvu; 1439 1404 rvu->rvu_dl = rvu_dl; ··· 1452 1417 rvu_health_reporters_destroy(rvu); 1453 1418 devlink_unregister(dl); 1454 1419 devlink_free(dl); 1455 - kfree(rvu_dl); 1456 1420 }
+36
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
··· 1952 1952 pfvf_map[schq] = TXSCH_SET_FLAG(pfvf_map[schq], NIX_TXSCHQ_CFG_DONE); 1953 1953 } 1954 1954 1955 + static void rvu_nix_tx_tl2_cfg(struct rvu *rvu, int blkaddr, 1956 + u16 pcifunc, struct nix_txsch *txsch) 1957 + { 1958 + struct rvu_hwinfo *hw = rvu->hw; 1959 + int lbk_link_start, lbk_links; 1960 + u8 pf = rvu_get_pf(pcifunc); 1961 + int schq; 1962 + 1963 + if (!is_pf_cgxmapped(rvu, pf)) 1964 + return; 1965 + 1966 + lbk_link_start = hw->cgx_links; 1967 + 1968 + for (schq = 0; schq < txsch->schq.max; schq++) { 1969 + if (TXSCH_MAP_FUNC(txsch->pfvf_map[schq]) != pcifunc) 1970 + continue; 1971 + /* Enable all LBK links with channel 63 by default so that 1972 + * packets can be sent to LBK with a NPC TX MCAM rule 1973 + */ 1974 + lbk_links = hw->lbk_links; 1975 + while (lbk_links--) 1976 + rvu_write64(rvu, blkaddr, 1977 + NIX_AF_TL3_TL2X_LINKX_CFG(schq, 1978 + lbk_link_start + 1979 + lbk_links), 1980 + BIT_ULL(12) | RVU_SWITCH_LBK_CHAN); 1981 + } 1982 + } 1983 + 1955 1984 int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu, 1956 1985 struct nix_txschq_config *req, 1957 1986 struct msg_rsp *rsp) ··· 2068 2039 } 2069 2040 rvu_write64(rvu, blkaddr, reg, regval); 2070 2041 } 2042 + 2043 + rvu_nix_tx_tl2_cfg(rvu, blkaddr, pcifunc, 2044 + &nix_hw->txsch[NIX_TXSCH_LVL_TL2]); 2071 2045 2072 2046 return 0; 2073 2047 } ··· 3212 3180 if (test_bit(PF_SET_VF_TRUSTED, &pfvf->flags) && from_vf) 3213 3181 ether_addr_copy(pfvf->default_mac, req->mac_addr); 3214 3182 3183 + rvu_switch_update_rules(rvu, pcifunc); 3184 + 3215 3185 return 0; 3216 3186 } 3217 3187 ··· 3882 3848 3883 3849 pfvf = rvu_get_pfvf(rvu, pcifunc); 3884 3850 set_bit(NIXLF_INITIALIZED, &pfvf->flags); 3851 + 3852 + rvu_switch_update_rules(rvu, pcifunc); 3885 3853 3886 3854 return rvu_cgx_start_stop_io(rvu, pcifunc, true); 3887 3855 }
+36 -11
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
··· 442 442 owner = mcam->entry2pfvf_map[index]; 443 443 target_func = (entry->action >> 4) & 0xffff; 444 444 /* do nothing when target is LBK/PF or owner is not PF */ 445 - if (is_afvf(target_func) || (owner & RVU_PFVF_FUNC_MASK) || 445 + if (is_pffunc_af(owner) || is_afvf(target_func) || 446 + (owner & RVU_PFVF_FUNC_MASK) || 446 447 !(target_func & RVU_PFVF_FUNC_MASK)) 447 448 return; 448 449 ··· 469 468 { 470 469 int bank = npc_get_bank(mcam, index); 471 470 int kw = 0, actbank, actindex; 471 + u8 tx_intf_mask = ~intf & 0x3; 472 + u8 tx_intf = intf; 472 473 u64 cam0, cam1; 473 474 474 475 actbank = bank; /* Save bank id, to set action later on */ ··· 491 488 */ 492 489 for (; bank < (actbank + mcam->banks_per_entry); bank++, kw = kw + 2) { 493 490 /* Interface should be set in all banks */ 491 + if (is_npc_intf_tx(intf)) { 492 + /* Last bit must be set and rest don't care 493 + * for TX interfaces 494 + */ 495 + tx_intf_mask = 0x1; 496 + tx_intf = intf & tx_intf_mask; 497 + tx_intf_mask = ~tx_intf & tx_intf_mask; 498 + } 499 + 494 500 rvu_write64(rvu, blkaddr, 495 501 NPC_AF_MCAMEX_BANKX_CAMX_INTF(index, bank, 1), 496 - intf); 502 + tx_intf); 497 503 rvu_write64(rvu, blkaddr, 498 504 NPC_AF_MCAMEX_BANKX_CAMX_INTF(index, bank, 0), 499 - ~intf & 0x3); 505 + tx_intf_mask); 500 506 501 507 /* Set the match key */ 502 508 npc_get_keyword(entry, kw, &cam0, &cam1); ··· 662 650 eth_broadcast_addr((u8 *)&req.mask.dmac); 663 651 req.features = BIT_ULL(NPC_DMAC); 664 652 req.channel = chan; 653 + req.chan_mask = 0xFFFU; 665 654 req.intf = pfvf->nix_rx_intf; 666 655 req.op = action.op; 667 656 req.hdr.pcifunc = 0; /* AF is requester */ ··· 812 799 eth_broadcast_addr((u8 *)&req.mask.dmac); 813 800 req.features = BIT_ULL(NPC_DMAC); 814 801 req.channel = chan; 802 + req.chan_mask = 0xFFFU; 815 803 req.intf = pfvf->nix_rx_intf; 816 804 req.entry = index; 817 805 req.hdr.pcifunc = 0; /* AF is requester */ ··· 1759 1745 int nixlf_count = rvu_get_nixlf_count(rvu); 1760 1746 struct npc_mcam *mcam = &rvu->hw->mcam; 1761 1747 int rsvd, err; 1748 + u16 index; 1749 + int cntr; 1762 1750 u64 cfg; 1763 1751 1764 1752 /* Actual number of MCAM entries vary by entry size */ ··· 1860 1844 sizeof(u16), GFP_KERNEL); 1861 1845 if (!mcam->entry2target_pffunc) 1862 1846 goto free_mem; 1847 + 1848 + for (index = 0; index < mcam->bmap_entries; index++) { 1849 + mcam->entry2pfvf_map[index] = NPC_MCAM_INVALID_MAP; 1850 + mcam->entry2cntr_map[index] = NPC_MCAM_INVALID_MAP; 1851 + } 1852 + 1853 + for (cntr = 0; cntr < mcam->counters.max; cntr++) 1854 + mcam->cntr2pfvf_map[cntr] = NPC_MCAM_INVALID_MAP; 1863 1855 1864 1856 mutex_init(&mcam->lock); 1865 1857 ··· 2586 2562 } 2587 2563 2588 2564 /* Alloc request from PFFUNC with no NIXLF attached should be denied */ 2589 - if (!is_nixlf_attached(rvu, pcifunc)) 2565 + if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc)) 2590 2566 return NPC_MCAM_ALLOC_DENIED; 2591 2567 2592 2568 return npc_mcam_alloc_entries(mcam, pcifunc, req, rsp); ··· 2606 2582 return NPC_MCAM_INVALID_REQ; 2607 2583 2608 2584 /* Free request from PFFUNC with no NIXLF attached, ignore */ 2609 - if (!is_nixlf_attached(rvu, pcifunc)) 2585 + if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc)) 2610 2586 return NPC_MCAM_INVALID_REQ; 2611 2587 2612 2588 mutex_lock(&mcam->lock); ··· 2618 2594 if (rc) 2619 2595 goto exit; 2620 2596 2621 - mcam->entry2pfvf_map[req->entry] = 0; 2597 + mcam->entry2pfvf_map[req->entry] = NPC_MCAM_INVALID_MAP; 2622 2598 mcam->entry2target_pffunc[req->entry] = 0x0; 2623 2599 npc_mcam_clear_bit(mcam, req->entry); 2624 2600 npc_enable_mcam_entry(rvu, mcam, blkaddr, req->entry, false); ··· 2703 2679 else 2704 2680 nix_intf = pfvf->nix_rx_intf; 2705 2681 2706 - if (npc_mcam_verify_channel(rvu, pcifunc, req->intf, channel)) { 2682 + if (!is_pffunc_af(pcifunc) && 2683 + npc_mcam_verify_channel(rvu, pcifunc, req->intf, channel)) { 2707 2684 rc = NPC_MCAM_INVALID_REQ; 2708 2685 goto exit; 2709 2686 } 2710 2687 2711 - if (npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf, 2712 - pcifunc)) { 2688 + if (!is_pffunc_af(pcifunc) && 2689 + npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf, pcifunc)) { 2713 2690 rc = NPC_MCAM_INVALID_REQ; 2714 2691 goto exit; 2715 2692 } ··· 2861 2836 return NPC_MCAM_INVALID_REQ; 2862 2837 2863 2838 /* If the request is from a PFFUNC with no NIXLF attached, ignore */ 2864 - if (!is_nixlf_attached(rvu, pcifunc)) 2839 + if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc)) 2865 2840 return NPC_MCAM_INVALID_REQ; 2866 2841 2867 2842 /* Since list of allocated counter IDs needs to be sent to requester, ··· 3106 3081 if (rc) { 3107 3082 /* Free allocated MCAM entry */ 3108 3083 mutex_lock(&mcam->lock); 3109 - mcam->entry2pfvf_map[entry] = 0; 3084 + mcam->entry2pfvf_map[entry] = NPC_MCAM_INVALID_MAP; 3110 3085 npc_mcam_clear_bit(mcam, entry); 3111 3086 mutex_unlock(&mcam->lock); 3112 3087 return rc;
+21 -8
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
··· 910 910 911 911 static void npc_update_rx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf, 912 912 struct mcam_entry *entry, 913 - struct npc_install_flow_req *req, u16 target) 913 + struct npc_install_flow_req *req, 914 + u16 target, bool pf_set_vfs_mac) 914 915 { 916 + struct rvu_switch *rswitch = &rvu->rswitch; 915 917 struct nix_rx_action action; 916 - u64 chan_mask; 917 918 918 - chan_mask = req->chan_mask ? req->chan_mask : ~0ULL; 919 - npc_update_entry(rvu, NPC_CHAN, entry, req->channel, 0, chan_mask, 0, 920 - NIX_INTF_RX); 919 + if (rswitch->mode == DEVLINK_ESWITCH_MODE_SWITCHDEV && pf_set_vfs_mac) 920 + req->chan_mask = 0x0; /* Do not care channel */ 921 + 922 + npc_update_entry(rvu, NPC_CHAN, entry, req->channel, 0, req->chan_mask, 923 + 0, NIX_INTF_RX); 921 924 922 925 *(u64 *)&action = 0x00; 923 926 action.pf_func = target; ··· 952 949 struct npc_install_flow_req *req, u16 target) 953 950 { 954 951 struct nix_tx_action action; 952 + u64 mask = ~0ULL; 953 + 954 + /* If AF is installing then do not care about 955 + * PF_FUNC in Send Descriptor 956 + */ 957 + if (is_pffunc_af(req->hdr.pcifunc)) 958 + mask = 0; 955 959 956 960 npc_update_entry(rvu, NPC_PF_FUNC, entry, (__force u16)htons(target), 957 - 0, ~0ULL, 0, NIX_INTF_TX); 961 + 0, mask, 0, NIX_INTF_TX); 958 962 959 963 *(u64 *)&action = 0x00; 960 964 action.op = req->op; ··· 1012 1002 req->intf); 1013 1003 1014 1004 if (is_npc_intf_rx(req->intf)) 1015 - npc_update_rx_entry(rvu, pfvf, entry, req, target); 1005 + npc_update_rx_entry(rvu, pfvf, entry, req, target, pf_set_vfs_mac); 1016 1006 else 1017 1007 npc_update_tx_entry(rvu, pfvf, entry, req, target); 1018 1008 ··· 1174 1164 if (err) 1175 1165 return err; 1176 1166 1177 - if (npc_mcam_verify_channel(rvu, target, req->intf, req->channel)) 1167 + /* Skip channel validation if AF is installing */ 1168 + if (!is_pffunc_af(req->hdr.pcifunc) && 1169 + npc_mcam_verify_channel(rvu, target, req->intf, req->channel)) 1178 1170 return -EINVAL; 1179 1171 1180 1172 pfvf = rvu_get_pfvf(rvu, target); ··· 1192 1180 eth_broadcast_addr((u8 *)&req->mask.dmac); 1193 1181 } 1194 1182 1183 + /* Proceed if NIXLF is attached or not for TX rules */ 1195 1184 err = nix_get_nixlf(rvu, target, &nixlf, NULL); 1196 1185 if (err && is_npc_intf_rx(req->intf) && !pf_set_vfs_mac) 1197 1186 return -EINVAL;
+258
drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Marvell OcteonTx2 RVU Admin Function driver 3 + * 4 + * Copyright (C) 2021 Marvell. 5 + */ 6 + 7 + #include <linux/bitfield.h> 8 + #include "rvu.h" 9 + 10 + static int rvu_switch_install_rx_rule(struct rvu *rvu, u16 pcifunc, 11 + u16 chan_mask) 12 + { 13 + struct npc_install_flow_req req = { 0 }; 14 + struct npc_install_flow_rsp rsp = { 0 }; 15 + struct rvu_pfvf *pfvf; 16 + 17 + pfvf = rvu_get_pfvf(rvu, pcifunc); 18 + /* If the pcifunc is not initialized then nothing to do. 19 + * This same function will be called again via rvu_switch_update_rules 20 + * after pcifunc is initialized. 21 + */ 22 + if (!test_bit(NIXLF_INITIALIZED, &pfvf->flags)) 23 + return 0; 24 + 25 + ether_addr_copy(req.packet.dmac, pfvf->mac_addr); 26 + eth_broadcast_addr((u8 *)&req.mask.dmac); 27 + req.hdr.pcifunc = 0; /* AF is requester */ 28 + req.vf = pcifunc; 29 + req.features = BIT_ULL(NPC_DMAC); 30 + req.channel = pfvf->rx_chan_base; 31 + req.chan_mask = chan_mask; 32 + req.intf = pfvf->nix_rx_intf; 33 + req.op = NIX_RX_ACTION_DEFAULT; 34 + req.default_rule = 1; 35 + 36 + return rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp); 37 + } 38 + 39 + static int rvu_switch_install_tx_rule(struct rvu *rvu, u16 pcifunc, u16 entry) 40 + { 41 + struct npc_install_flow_req req = { 0 }; 42 + struct npc_install_flow_rsp rsp = { 0 }; 43 + struct rvu_pfvf *pfvf; 44 + u8 lbkid; 45 + 46 + pfvf = rvu_get_pfvf(rvu, pcifunc); 47 + /* If the pcifunc is not initialized then nothing to do. 48 + * This same function will be called again via rvu_switch_update_rules 49 + * after pcifunc is initialized. 50 + */ 51 + if (!test_bit(NIXLF_INITIALIZED, &pfvf->flags)) 52 + return 0; 53 + 54 + lbkid = pfvf->nix_blkaddr == BLKADDR_NIX0 ? 0 : 1; 55 + ether_addr_copy(req.packet.dmac, pfvf->mac_addr); 56 + eth_broadcast_addr((u8 *)&req.mask.dmac); 57 + req.hdr.pcifunc = 0; /* AF is requester */ 58 + req.vf = pcifunc; 59 + req.entry = entry; 60 + req.features = BIT_ULL(NPC_DMAC); 61 + req.intf = pfvf->nix_tx_intf; 62 + req.op = NIX_TX_ACTIONOP_UCAST_CHAN; 63 + req.index = (lbkid << 8) | RVU_SWITCH_LBK_CHAN; 64 + req.set_cntr = 1; 65 + 66 + return rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp); 67 + } 68 + 69 + static int rvu_switch_install_rules(struct rvu *rvu) 70 + { 71 + struct rvu_switch *rswitch = &rvu->rswitch; 72 + u16 start = rswitch->start_entry; 73 + struct rvu_hwinfo *hw = rvu->hw; 74 + int pf, vf, numvfs, hwvf; 75 + u16 pcifunc, entry = 0; 76 + int err; 77 + 78 + for (pf = 1; pf < hw->total_pfs; pf++) { 79 + if (!is_pf_cgxmapped(rvu, pf)) 80 + continue; 81 + 82 + pcifunc = pf << 10; 83 + /* rvu_get_nix_blkaddr sets up the corresponding NIX block 84 + * address and NIX RX and TX interfaces for a pcifunc. 85 + * Generally it is called during attach call of a pcifunc but it 86 + * is called here since we are pre-installing rules before 87 + * nixlfs are attached 88 + */ 89 + rvu_get_nix_blkaddr(rvu, pcifunc); 90 + 91 + /* MCAM RX rule for a PF/VF already exists as default unicast 92 + * rules installed by AF. Hence change the channel in those 93 + * rules to ignore channel so that packets with the required 94 + * DMAC received from LBK(by other PF/VFs in system) or from 95 + * external world (from wire) are accepted. 96 + */ 97 + err = rvu_switch_install_rx_rule(rvu, pcifunc, 0x0); 98 + if (err) { 99 + dev_err(rvu->dev, "RX rule for PF%d failed(%d)\n", 100 + pf, err); 101 + return err; 102 + } 103 + 104 + err = rvu_switch_install_tx_rule(rvu, pcifunc, start + entry); 105 + if (err) { 106 + dev_err(rvu->dev, "TX rule for PF%d failed(%d)\n", 107 + pf, err); 108 + return err; 109 + } 110 + 111 + rswitch->entry2pcifunc[entry++] = pcifunc; 112 + 113 + rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvf); 114 + for (vf = 0; vf < numvfs; vf++, hwvf++) { 115 + pcifunc = pf << 10 | ((vf + 1) & 0x3FF); 116 + rvu_get_nix_blkaddr(rvu, pcifunc); 117 + 118 + err = rvu_switch_install_rx_rule(rvu, pcifunc, 0x0); 119 + if (err) { 120 + dev_err(rvu->dev, 121 + "RX rule for PF%dVF%d failed(%d)\n", 122 + pf, vf, err); 123 + return err; 124 + } 125 + 126 + err = rvu_switch_install_tx_rule(rvu, pcifunc, 127 + start + entry); 128 + if (err) { 129 + dev_err(rvu->dev, 130 + "TX rule for PF%dVF%d failed(%d)\n", 131 + pf, vf, err); 132 + return err; 133 + } 134 + 135 + rswitch->entry2pcifunc[entry++] = pcifunc; 136 + } 137 + } 138 + 139 + return 0; 140 + } 141 + 142 + void rvu_switch_enable(struct rvu *rvu) 143 + { 144 + struct npc_mcam_alloc_entry_req alloc_req = { 0 }; 145 + struct npc_mcam_alloc_entry_rsp alloc_rsp = { 0 }; 146 + struct npc_delete_flow_req uninstall_req = { 0 }; 147 + struct npc_mcam_free_entry_req free_req = { 0 }; 148 + struct rvu_switch *rswitch = &rvu->rswitch; 149 + struct msg_rsp rsp; 150 + int ret; 151 + 152 + alloc_req.contig = true; 153 + alloc_req.count = rvu->cgx_mapped_pfs + rvu->cgx_mapped_vfs; 154 + ret = rvu_mbox_handler_npc_mcam_alloc_entry(rvu, &alloc_req, 155 + &alloc_rsp); 156 + if (ret) { 157 + dev_err(rvu->dev, 158 + "Unable to allocate MCAM entries\n"); 159 + goto exit; 160 + } 161 + 162 + if (alloc_rsp.count != alloc_req.count) { 163 + dev_err(rvu->dev, 164 + "Unable to allocate %d MCAM entries, got %d\n", 165 + alloc_req.count, alloc_rsp.count); 166 + goto free_entries; 167 + } 168 + 169 + rswitch->entry2pcifunc = kcalloc(alloc_req.count, sizeof(u16), 170 + GFP_KERNEL); 171 + if (!rswitch->entry2pcifunc) 172 + goto free_entries; 173 + 174 + rswitch->used_entries = alloc_rsp.count; 175 + rswitch->start_entry = alloc_rsp.entry; 176 + 177 + ret = rvu_switch_install_rules(rvu); 178 + if (ret) 179 + goto uninstall_rules; 180 + 181 + return; 182 + 183 + uninstall_rules: 184 + uninstall_req.start = rswitch->start_entry; 185 + uninstall_req.end = rswitch->start_entry + rswitch->used_entries - 1; 186 + rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp); 187 + kfree(rswitch->entry2pcifunc); 188 + free_entries: 189 + free_req.all = 1; 190 + rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp); 191 + exit: 192 + return; 193 + } 194 + 195 + void rvu_switch_disable(struct rvu *rvu) 196 + { 197 + struct npc_delete_flow_req uninstall_req = { 0 }; 198 + struct npc_mcam_free_entry_req free_req = { 0 }; 199 + struct rvu_switch *rswitch = &rvu->rswitch; 200 + struct rvu_hwinfo *hw = rvu->hw; 201 + int pf, vf, numvfs, hwvf; 202 + struct msg_rsp rsp; 203 + u16 pcifunc; 204 + int err; 205 + 206 + if (!rswitch->used_entries) 207 + return; 208 + 209 + for (pf = 1; pf < hw->total_pfs; pf++) { 210 + if (!is_pf_cgxmapped(rvu, pf)) 211 + continue; 212 + 213 + pcifunc = pf << 10; 214 + err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF); 215 + if (err) 216 + dev_err(rvu->dev, 217 + "Reverting RX rule for PF%d failed(%d)\n", 218 + pf, err); 219 + 220 + for (vf = 0; vf < numvfs; vf++, hwvf++) { 221 + pcifunc = pf << 10 | ((vf + 1) & 0x3FF); 222 + err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF); 223 + if (err) 224 + dev_err(rvu->dev, 225 + "Reverting RX rule for PF%dVF%d failed(%d)\n", 226 + pf, vf, err); 227 + } 228 + } 229 + 230 + uninstall_req.start = rswitch->start_entry; 231 + uninstall_req.end = rswitch->start_entry + rswitch->used_entries - 1; 232 + free_req.all = 1; 233 + rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp); 234 + rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp); 235 + rswitch->used_entries = 0; 236 + kfree(rswitch->entry2pcifunc); 237 + } 238 + 239 + void rvu_switch_update_rules(struct rvu *rvu, u16 pcifunc) 240 + { 241 + struct rvu_switch *rswitch = &rvu->rswitch; 242 + u32 max = rswitch->used_entries; 243 + u16 entry; 244 + 245 + if (!rswitch->used_entries) 246 + return; 247 + 248 + for (entry = 0; entry < max; entry++) { 249 + if (rswitch->entry2pcifunc[entry] == pcifunc) 250 + break; 251 + } 252 + 253 + if (entry >= max) 254 + return; 255 + 256 + rvu_switch_install_tx_rule(rvu, pcifunc, rswitch->start_entry + entry); 257 + rvu_switch_install_rx_rule(rvu, pcifunc, 0x0); 258 + }
+1
drivers/net/ethernet/microchip/sparx5/Kconfig
··· 3 3 depends on NET_SWITCHDEV 4 4 depends on HAS_IOMEM 5 5 depends on OF 6 + depends on ARCH_SPARX5 || COMPILE_TEST 6 7 select PHYLINK 7 8 select PHY_SPARX5_SERDES 8 9 select RESET_CONTROLLER
+2 -1
drivers/net/ethernet/realtek/r8169_main.c
··· 5084 5084 new_bus->priv = tp; 5085 5085 new_bus->parent = &pdev->dev; 5086 5086 new_bus->irq[0] = PHY_MAC_INTERRUPT; 5087 - snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); 5087 + snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", 5088 + pci_domain_nr(pdev->bus), pci_dev_id(pdev)); 5088 5089 5089 5090 new_bus->read = r8169_mdio_read_reg; 5090 5091 new_bus->write = r8169_mdio_write_reg;
+1 -1
drivers/net/ethernet/renesas/ravb.h
··· 864 864 865 865 /* The Ethernet AVB descriptor definitions. */ 866 866 struct ravb_desc { 867 - __le16 ds; /* Descriptor size */ 867 + __le16 ds; /* Descriptor size */ 868 868 u8 cc; /* Content control MSBs (reserved) */ 869 869 u8 die_dt; /* Descriptor interrupt enable and type */ 870 870 __le32 dptr; /* Descriptor pointer */
+1 -1
drivers/net/ethernet/renesas/ravb_main.c
··· 920 920 if (ravb_rx(ndev, &quota, q)) 921 921 goto out; 922 922 923 - /* Processing RX Descriptor Ring */ 923 + /* Processing TX Descriptor Ring */ 924 924 spin_lock_irqsave(&priv->lock, flags); 925 925 /* Clear TX interrupt */ 926 926 ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
+2
drivers/net/ethernet/xscale/ptp_ixp46x.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/ptp_clock_kernel.h> 16 16 #include <linux/soc/ixp4xx/cpu.h> 17 + #include <linux/module.h> 18 + #include <mach/ixp4xx-regs.h> 17 19 18 20 #include "ixp46x_ts.h" 19 21
+23 -10
drivers/net/usb/hso.c
··· 2495 2495 hso_net_init); 2496 2496 if (!net) { 2497 2497 dev_err(&interface->dev, "Unable to create ethernet device\n"); 2498 - goto exit; 2498 + goto err_hso_dev; 2499 2499 } 2500 2500 2501 2501 hso_net = netdev_priv(net); ··· 2508 2508 USB_DIR_IN); 2509 2509 if (!hso_net->in_endp) { 2510 2510 dev_err(&interface->dev, "Can't find BULK IN endpoint\n"); 2511 - goto exit; 2511 + goto err_net; 2512 2512 } 2513 2513 hso_net->out_endp = hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, 2514 2514 USB_DIR_OUT); 2515 2515 if (!hso_net->out_endp) { 2516 2516 dev_err(&interface->dev, "Can't find BULK OUT endpoint\n"); 2517 - goto exit; 2517 + goto err_net; 2518 2518 } 2519 2519 SET_NETDEV_DEV(net, &interface->dev); 2520 2520 SET_NETDEV_DEVTYPE(net, &hso_type); ··· 2523 2523 for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { 2524 2524 hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL); 2525 2525 if (!hso_net->mux_bulk_rx_urb_pool[i]) 2526 - goto exit; 2526 + goto err_mux_bulk_rx; 2527 2527 hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE, 2528 2528 GFP_KERNEL); 2529 2529 if (!hso_net->mux_bulk_rx_buf_pool[i]) 2530 - goto exit; 2530 + goto err_mux_bulk_rx; 2531 2531 } 2532 2532 hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL); 2533 2533 if (!hso_net->mux_bulk_tx_urb) 2534 - goto exit; 2534 + goto err_mux_bulk_rx; 2535 2535 hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL); 2536 2536 if (!hso_net->mux_bulk_tx_buf) 2537 - goto exit; 2537 + goto err_free_tx_urb; 2538 2538 2539 2539 add_net_device(hso_dev); 2540 2540 ··· 2542 2542 result = register_netdev(net); 2543 2543 if (result) { 2544 2544 dev_err(&interface->dev, "Failed to register device\n"); 2545 - goto exit; 2545 + goto err_free_tx_buf; 2546 2546 } 2547 2547 2548 2548 hso_log_port(hso_dev); ··· 2550 2550 hso_create_rfkill(hso_dev, interface); 2551 2551 2552 2552 return hso_dev; 2553 - exit: 2554 - hso_free_net_device(hso_dev, true); 2553 + 2554 + err_free_tx_buf: 2555 + remove_net_device(hso_dev); 2556 + kfree(hso_net->mux_bulk_tx_buf); 2557 + err_free_tx_urb: 2558 + usb_free_urb(hso_net->mux_bulk_tx_urb); 2559 + err_mux_bulk_rx: 2560 + for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { 2561 + usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]); 2562 + kfree(hso_net->mux_bulk_rx_buf_pool[i]); 2563 + } 2564 + err_net: 2565 + free_netdev(net); 2566 + err_hso_dev: 2567 + kfree(hso_dev); 2555 2568 return NULL; 2556 2569 } 2557 2570
+21 -11
drivers/net/usb/r8152.c
··· 1552 1552 rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u32 speed, u8 duplex, 1553 1553 u32 advertising); 1554 1554 1555 - static int rtl8152_set_mac_address(struct net_device *netdev, void *p) 1555 + static int __rtl8152_set_mac_address(struct net_device *netdev, void *p, 1556 + bool in_resume) 1556 1557 { 1557 1558 struct r8152 *tp = netdev_priv(netdev); 1558 1559 struct sockaddr *addr = p; ··· 1562 1561 if (!is_valid_ether_addr(addr->sa_data)) 1563 1562 goto out1; 1564 1563 1565 - ret = usb_autopm_get_interface(tp->intf); 1566 - if (ret < 0) 1567 - goto out1; 1564 + if (!in_resume) { 1565 + ret = usb_autopm_get_interface(tp->intf); 1566 + if (ret < 0) 1567 + goto out1; 1568 + } 1568 1569 1569 1570 mutex_lock(&tp->control); 1570 1571 ··· 1578 1575 1579 1576 mutex_unlock(&tp->control); 1580 1577 1581 - usb_autopm_put_interface(tp->intf); 1578 + if (!in_resume) 1579 + usb_autopm_put_interface(tp->intf); 1582 1580 out1: 1583 1581 return ret; 1582 + } 1583 + 1584 + static int rtl8152_set_mac_address(struct net_device *netdev, void *p) 1585 + { 1586 + return __rtl8152_set_mac_address(netdev, p, false); 1584 1587 } 1585 1588 1586 1589 /* Devices containing proper chips can support a persistent ··· 1707 1698 return ret; 1708 1699 } 1709 1700 1710 - static int set_ethernet_addr(struct r8152 *tp) 1701 + static int set_ethernet_addr(struct r8152 *tp, bool in_resume) 1711 1702 { 1712 1703 struct net_device *dev = tp->netdev; 1713 1704 struct sockaddr sa; ··· 1720 1711 if (tp->version == RTL_VER_01) 1721 1712 ether_addr_copy(dev->dev_addr, sa.sa_data); 1722 1713 else 1723 - ret = rtl8152_set_mac_address(dev, &sa); 1714 + ret = __rtl8152_set_mac_address(dev, &sa, in_resume); 1724 1715 1725 1716 return ret; 1726 1717 } ··· 6772 6763 tp->rtl_ops.down(tp); 6773 6764 6774 6765 mutex_unlock(&tp->control); 6775 - 6776 - usb_autopm_put_interface(tp->intf); 6777 6766 } 6767 + 6768 + if (!res) 6769 + usb_autopm_put_interface(tp->intf); 6778 6770 6779 6771 free_all_mem(tp); 6780 6772 ··· 8453 8443 clear_bit(SELECTIVE_SUSPEND, &tp->flags); 8454 8444 tp->rtl_ops.init(tp); 8455 8445 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); 8456 - set_ethernet_addr(tp); 8446 + set_ethernet_addr(tp, true); 8457 8447 return rtl8152_resume(intf); 8458 8448 } 8459 8449 ··· 9654 9644 tp->rtl_fw.retry = true; 9655 9645 #endif 9656 9646 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); 9657 - set_ethernet_addr(tp); 9647 + set_ethernet_addr(tp, false); 9658 9648 9659 9649 usb_set_intfdata(intf, tp); 9660 9650
+15 -4
drivers/nvme/host/core.c
··· 900 900 cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); 901 901 cmnd->write_zeroes.length = 902 902 cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1); 903 - cmnd->write_zeroes.control = 0; 903 + if (nvme_ns_has_pi(ns)) 904 + cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT); 905 + else 906 + cmnd->write_zeroes.control = 0; 904 907 return BLK_STS_OK; 905 908 } 906 909 ··· 3810 3807 3811 3808 static void nvme_ns_remove(struct nvme_ns *ns) 3812 3809 { 3810 + bool last_path = false; 3811 + 3813 3812 if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags)) 3814 3813 return; 3815 3814 ··· 3820 3815 3821 3816 mutex_lock(&ns->ctrl->subsys->lock); 3822 3817 list_del_rcu(&ns->siblings); 3823 - if (list_empty(&ns->head->list)) 3824 - list_del_init(&ns->head->entry); 3825 3818 mutex_unlock(&ns->ctrl->subsys->lock); 3826 3819 3827 3820 synchronize_rcu(); /* guarantee not available in head->list */ ··· 3839 3836 list_del_init(&ns->list); 3840 3837 up_write(&ns->ctrl->namespaces_rwsem); 3841 3838 3842 - nvme_mpath_check_last_path(ns); 3839 + /* Synchronize with nvme_init_ns_head() */ 3840 + mutex_lock(&ns->head->subsys->lock); 3841 + if (list_empty(&ns->head->list)) { 3842 + list_del_init(&ns->head->entry); 3843 + last_path = true; 3844 + } 3845 + mutex_unlock(&ns->head->subsys->lock); 3846 + if (last_path) 3847 + nvme_mpath_shutdown_disk(ns->head); 3843 3848 nvme_put_ns(ns); 3844 3849 } 3845 3850
+8 -1
drivers/nvme/host/multipath.c
··· 760 760 #endif 761 761 } 762 762 763 - void nvme_mpath_remove_disk(struct nvme_ns_head *head) 763 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 764 764 { 765 765 if (!head->disk) 766 766 return; 767 + kblockd_schedule_work(&head->requeue_work); 767 768 if (head->disk->flags & GENHD_FL_UP) { 768 769 nvme_cdev_del(&head->cdev, &head->cdev_device); 769 770 del_gendisk(head->disk); 770 771 } 772 + } 773 + 774 + void nvme_mpath_remove_disk(struct nvme_ns_head *head) 775 + { 776 + if (!head->disk) 777 + return; 771 778 blk_set_queue_dying(head->disk->queue); 772 779 /* make sure all pending bios are cleaned up */ 773 780 kblockd_schedule_work(&head->requeue_work);
+2 -9
drivers/nvme/host/nvme.h
··· 716 716 void nvme_mpath_stop(struct nvme_ctrl *ctrl); 717 717 bool nvme_mpath_clear_current_path(struct nvme_ns *ns); 718 718 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl); 719 - 720 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 721 - { 722 - struct nvme_ns_head *head = ns->head; 723 - 724 - if (head->disk && list_empty(&head->list)) 725 - kblockd_schedule_work(&head->requeue_work); 726 - } 719 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head); 727 720 728 721 static inline void nvme_trace_bio_complete(struct request *req) 729 722 { ··· 765 772 static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 766 773 { 767 774 } 768 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 775 + static inline void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 769 776 { 770 777 } 771 778 static inline void nvme_trace_bio_complete(struct request *req)
+3 -1
drivers/nvme/host/pci.c
··· 2631 2631 bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); 2632 2632 int result; 2633 2633 2634 - if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { 2634 + if (dev->ctrl.state != NVME_CTRL_RESETTING) { 2635 + dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n", 2636 + dev->ctrl.state); 2635 2637 result = -ENODEV; 2636 2638 goto out; 2637 2639 }
+3 -3
drivers/nvme/host/trace.h
··· 56 56 __field(u8, fctype) 57 57 __field(u16, cid) 58 58 __field(u32, nsid) 59 - __field(u64, metadata) 59 + __field(bool, metadata) 60 60 __array(u8, cdw10, 24) 61 61 ), 62 62 TP_fast_assign( ··· 66 66 __entry->flags = cmd->common.flags; 67 67 __entry->cid = cmd->common.command_id; 68 68 __entry->nsid = le32_to_cpu(cmd->common.nsid); 69 - __entry->metadata = le64_to_cpu(cmd->common.metadata); 69 + __entry->metadata = !!blk_integrity_rq(req); 70 70 __entry->fctype = cmd->fabrics.fctype; 71 71 __assign_disk_name(__entry->disk, req->rq_disk); 72 72 memcpy(__entry->cdw10, &cmd->common.cdw10, 73 73 sizeof(__entry->cdw10)); 74 74 ), 75 - TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", 75 + TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", 76 76 __entry->ctrl_id, __print_disk_name(__entry->disk), 77 77 __entry->qid, __entry->cid, __entry->nsid, 78 78 __entry->flags, __entry->metadata,
+2 -2
drivers/regulator/bd9576-regulator.c
··· 294 294 struct bd957x_regulator_data *r) 295 295 { 296 296 if ((severity == REGULATOR_SEVERITY_ERR && 297 - r->ovd_notif != REGULATOR_EVENT_OVER_TEMP) || 297 + r->temp_notif != REGULATOR_EVENT_OVER_TEMP) || 298 298 (severity == REGULATOR_SEVERITY_WARN && 299 - r->ovd_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) { 299 + r->temp_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) { 300 300 dev_warn(rdev_get_dev(rdev), 301 301 "Can't support both thermal WARN and ERR\n"); 302 302 if (severity == REGULATOR_SEVERITY_WARN)
+13 -9
drivers/regulator/hi6421-regulator.c
··· 366 366 367 367 static int hi6421_regulator_enable(struct regulator_dev *rdev) 368 368 { 369 - struct hi6421_regulator_pdata *pdata; 369 + struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev); 370 370 371 - pdata = dev_get_drvdata(rdev->dev.parent); 372 371 /* hi6421 spec requires regulator enablement must be serialized: 373 372 * - Because when BUCK, LDO switching from off to on, it will have 374 373 * a huge instantaneous current; so you can not turn on two or ··· 384 385 385 386 static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) 386 387 { 387 - struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); 388 + struct hi6421_regulator_info *info; 388 389 unsigned int reg_val; 389 390 391 + info = container_of(rdev->desc, struct hi6421_regulator_info, desc); 390 392 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); 391 393 if (reg_val & info->mode_mask) 392 394 return REGULATOR_MODE_IDLE; ··· 397 397 398 398 static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) 399 399 { 400 - struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); 400 + struct hi6421_regulator_info *info; 401 401 unsigned int reg_val; 402 402 403 + info = container_of(rdev->desc, struct hi6421_regulator_info, desc); 403 404 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); 404 405 if (reg_val & info->mode_mask) 405 406 return REGULATOR_MODE_STANDBY; ··· 411 410 static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, 412 411 unsigned int mode) 413 412 { 414 - struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); 413 + struct hi6421_regulator_info *info; 415 414 unsigned int new_mode; 416 415 416 + info = container_of(rdev->desc, struct hi6421_regulator_info, desc); 417 417 switch (mode) { 418 418 case REGULATOR_MODE_NORMAL: 419 419 new_mode = 0; ··· 436 434 static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, 437 435 unsigned int mode) 438 436 { 439 - struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); 437 + struct hi6421_regulator_info *info; 440 438 unsigned int new_mode; 441 439 440 + info = container_of(rdev->desc, struct hi6421_regulator_info, desc); 442 441 switch (mode) { 443 442 case REGULATOR_MODE_NORMAL: 444 443 new_mode = 0; ··· 462 459 hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, 463 460 int input_uV, int output_uV, int load_uA) 464 461 { 465 - struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); 462 + struct hi6421_regulator_info *info; 463 + 464 + info = container_of(rdev->desc, struct hi6421_regulator_info, desc); 466 465 467 466 if (load_uA > info->eco_microamp) 468 467 return REGULATOR_MODE_NORMAL; ··· 548 543 if (!pdata) 549 544 return -ENOMEM; 550 545 mutex_init(&pdata->lock); 551 - platform_set_drvdata(pdev, pdata); 552 546 553 547 for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) { 554 548 /* assign per-regulator data */ 555 549 info = &hi6421_regulator_info[i]; 556 550 557 551 config.dev = pdev->dev.parent; 558 - config.driver_data = info; 552 + config.driver_data = pdata; 559 553 config.regmap = pmic->regmap; 560 554 561 555 rdev = devm_regulator_register(&pdev->dev, &info->desc,
+9 -7
drivers/regulator/hi6421v600-regulator.c
··· 98 98 99 99 static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) 100 100 { 101 - struct hi6421_spmi_reg_priv *priv; 101 + struct hi6421_spmi_reg_priv *priv = rdev_get_drvdata(rdev); 102 102 int ret; 103 103 104 - priv = dev_get_drvdata(rdev->dev.parent); 105 104 /* cannot enable more than one regulator at one time */ 106 105 mutex_lock(&priv->enable_mutex); 107 106 ··· 118 119 119 120 static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev) 120 121 { 121 - struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); 122 + struct hi6421_spmi_reg_info *sreg; 122 123 unsigned int reg_val; 123 124 125 + sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); 124 126 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); 125 127 126 128 if (reg_val & sreg->eco_mode_mask) ··· 133 133 static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev, 134 134 unsigned int mode) 135 135 { 136 - struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); 136 + struct hi6421_spmi_reg_info *sreg; 137 137 unsigned int val; 138 138 139 + sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); 139 140 switch (mode) { 140 141 case REGULATOR_MODE_NORMAL: 141 142 val = 0; ··· 160 159 int input_uV, int output_uV, 161 160 int load_uA) 162 161 { 163 - struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev); 162 + struct hi6421_spmi_reg_info *sreg; 163 + 164 + sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); 164 165 165 166 if (!sreg->eco_uA || ((unsigned int)load_uA > sreg->eco_uA)) 166 167 return REGULATOR_MODE_NORMAL; ··· 255 252 return -ENOMEM; 256 253 257 254 mutex_init(&priv->enable_mutex); 258 - platform_set_drvdata(pdev, priv); 259 255 260 256 for (i = 0; i < ARRAY_SIZE(regulator_info); i++) { 261 257 info = &regulator_info[i]; 262 258 263 259 config.dev = pdev->dev.parent; 264 - config.driver_data = info; 260 + config.driver_data = priv; 265 261 config.regmap = pmic->regmap; 266 262 267 263 rdev = devm_regulator_register(dev, &info->desc, &config);
+1 -2
drivers/regulator/mtk-dvfsrc-regulator.c
··· 179 179 for (i = 0; i < regulator_init_data->size; i++) { 180 180 config.dev = dev->parent; 181 181 config.driver_data = (mt_regulators + i); 182 - rdev = devm_regulator_register(dev->parent, 183 - &(mt_regulators + i)->desc, 182 + rdev = devm_regulator_register(dev, &(mt_regulators + i)->desc, 184 183 &config); 185 184 if (IS_ERR(rdev)) { 186 185 dev_err(dev, "failed to register %s\n",
+1 -1
drivers/regulator/rtmv20-regulator.c
··· 37 37 #define RTMV20_WIDTH2_MASK GENMASK(7, 0) 38 38 #define RTMV20_LBPLVL_MASK GENMASK(3, 0) 39 39 #define RTMV20_LBPEN_MASK BIT(7) 40 - #define RTMV20_STROBEPOL_MASK BIT(1) 40 + #define RTMV20_STROBEPOL_MASK BIT(0) 41 41 #define RTMV20_VSYNPOL_MASK BIT(1) 42 42 #define RTMV20_FSINEN_MASK BIT(7) 43 43 #define RTMV20_ESEN_MASK BIT(6)
+16 -16
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 2983 2983 } 2984 2984 2985 2985 /** 2986 - * _base_free_irq - free irq 2986 + * mpt3sas_base_free_irq - free irq 2987 2987 * @ioc: per adapter object 2988 2988 * 2989 2989 * Freeing respective reply_queue from the list. 2990 2990 */ 2991 - static void 2992 - _base_free_irq(struct MPT3SAS_ADAPTER *ioc) 2991 + void 2992 + mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc) 2993 2993 { 2994 2994 struct adapter_reply_queue *reply_q, *next; 2995 2995 ··· 3191 3191 } 3192 3192 3193 3193 /** 3194 - * _base_disable_msix - disables msix 3194 + * mpt3sas_base_disable_msix - disables msix 3195 3195 * @ioc: per adapter object 3196 3196 * 3197 3197 */ 3198 - static void 3199 - _base_disable_msix(struct MPT3SAS_ADAPTER *ioc) 3198 + void 3199 + mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc) 3200 3200 { 3201 3201 if (!ioc->msix_enable) 3202 3202 return; ··· 3304 3304 for (i = 0; i < ioc->reply_queue_count; i++) { 3305 3305 r = _base_request_irq(ioc, i); 3306 3306 if (r) { 3307 - _base_free_irq(ioc); 3308 - _base_disable_msix(ioc); 3307 + mpt3sas_base_free_irq(ioc); 3308 + mpt3sas_base_disable_msix(ioc); 3309 3309 goto try_ioapic; 3310 3310 } 3311 3311 } ··· 3342 3342 3343 3343 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); 3344 3344 3345 - _base_free_irq(ioc); 3346 - _base_disable_msix(ioc); 3345 + mpt3sas_base_free_irq(ioc); 3346 + mpt3sas_base_disable_msix(ioc); 3347 3347 3348 3348 kfree(ioc->replyPostRegisterIndex); 3349 3349 ioc->replyPostRegisterIndex = NULL; ··· 7613 7613 } 7614 7614 7615 7615 /** 7616 - * _base_make_ioc_ready - put controller in READY state 7616 + * mpt3sas_base_make_ioc_ready - put controller in READY state 7617 7617 * @ioc: per adapter object 7618 7618 * @type: FORCE_BIG_HAMMER or SOFT_RESET 7619 7619 * 7620 7620 * Return: 0 for success, non-zero for failure. 7621 7621 */ 7622 - static int 7623 - _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) 7622 + int 7623 + mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) 7624 7624 { 7625 7625 u32 ioc_state; 7626 7626 int rc; ··· 7897 7897 if (ioc->chip_phys && ioc->chip) { 7898 7898 mpt3sas_base_mask_interrupts(ioc); 7899 7899 ioc->shost_recovery = 1; 7900 - _base_make_ioc_ready(ioc, SOFT_RESET); 7900 + mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 7901 7901 ioc->shost_recovery = 0; 7902 7902 } 7903 7903 ··· 8017 8017 ioc->build_sg_mpi = &_base_build_sg; 8018 8018 ioc->build_zero_len_sge_mpi = &_base_build_zero_len_sge; 8019 8019 8020 - r = _base_make_ioc_ready(ioc, SOFT_RESET); 8020 + r = mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 8021 8021 if (r) 8022 8022 goto out_free_resources; 8023 8023 ··· 8471 8471 _base_pre_reset_handler(ioc); 8472 8472 mpt3sas_wait_for_commands_to_complete(ioc); 8473 8473 mpt3sas_base_mask_interrupts(ioc); 8474 - r = _base_make_ioc_ready(ioc, type); 8474 + r = mpt3sas_base_make_ioc_ready(ioc, type); 8475 8475 if (r) 8476 8476 goto out; 8477 8477 _base_clear_outstanding_commands(ioc);
+4
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 1730 1730 status, mpi_request, sz); } while (0) 1731 1731 1732 1732 int mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int wait_count); 1733 + int 1734 + mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type); 1735 + void mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc); 1736 + void mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc); 1733 1737 1734 1738 /* scsih shared API */ 1735 1739 struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,
+6 -1
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 11295 11295 11296 11296 _scsih_ir_shutdown(ioc); 11297 11297 _scsih_nvme_shutdown(ioc); 11298 - mpt3sas_base_detach(ioc); 11298 + mpt3sas_base_mask_interrupts(ioc); 11299 + ioc->shost_recovery = 1; 11300 + mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 11301 + ioc->shost_recovery = 0; 11302 + mpt3sas_base_free_irq(ioc); 11303 + mpt3sas_base_disable_msix(ioc); 11299 11304 } 11300 11305 11301 11306
+34 -56
drivers/scsi/scsi_transport_iscsi.c
··· 439 439 struct device *dev = container_of(kobj, struct device, kobj); 440 440 struct iscsi_iface *iface = iscsi_dev_to_iface(dev); 441 441 struct iscsi_transport *t = iface->transport; 442 - int param; 443 - int param_type; 442 + int param = -1; 444 443 445 444 if (attr == &dev_attr_iface_enabled.attr) 446 445 param = ISCSI_NET_PARAM_IFACE_ENABLE; 447 - else if (attr == &dev_attr_iface_vlan_id.attr) 448 - param = ISCSI_NET_PARAM_VLAN_ID; 449 - else if (attr == &dev_attr_iface_vlan_priority.attr) 450 - param = ISCSI_NET_PARAM_VLAN_PRIORITY; 451 - else if (attr == &dev_attr_iface_vlan_enabled.attr) 452 - param = ISCSI_NET_PARAM_VLAN_ENABLED; 453 - else if (attr == &dev_attr_iface_mtu.attr) 454 - param = ISCSI_NET_PARAM_MTU; 455 - else if (attr == &dev_attr_iface_port.attr) 456 - param = ISCSI_NET_PARAM_PORT; 457 - else if (attr == &dev_attr_iface_ipaddress_state.attr) 458 - param = ISCSI_NET_PARAM_IPADDR_STATE; 459 - else if (attr == &dev_attr_iface_delayed_ack_en.attr) 460 - param = ISCSI_NET_PARAM_DELAYED_ACK_EN; 461 - else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) 462 - param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; 463 - else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) 464 - param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; 465 - else if (attr == &dev_attr_iface_tcp_wsf.attr) 466 - param = ISCSI_NET_PARAM_TCP_WSF; 467 - else if (attr == &dev_attr_iface_tcp_timer_scale.attr) 468 - param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; 469 - else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) 470 - param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; 471 - else if (attr == &dev_attr_iface_cache_id.attr) 472 - param = ISCSI_NET_PARAM_CACHE_ID; 473 - else if (attr == &dev_attr_iface_redirect_en.attr) 474 - param = ISCSI_NET_PARAM_REDIRECT_EN; 475 446 else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) 476 447 param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; 477 448 else if (attr == &dev_attr_iface_header_digest.attr) ··· 479 508 param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN; 480 509 else if (attr == &dev_attr_iface_initiator_name.attr) 481 510 param = ISCSI_IFACE_PARAM_INITIATOR_NAME; 511 + 512 + if (param != -1) 513 + return t->attr_is_visible(ISCSI_IFACE_PARAM, param); 514 + 515 + if (attr == &dev_attr_iface_vlan_id.attr) 516 + param = ISCSI_NET_PARAM_VLAN_ID; 517 + else if (attr == &dev_attr_iface_vlan_priority.attr) 518 + param = ISCSI_NET_PARAM_VLAN_PRIORITY; 519 + else if (attr == &dev_attr_iface_vlan_enabled.attr) 520 + param = ISCSI_NET_PARAM_VLAN_ENABLED; 521 + else if (attr == &dev_attr_iface_mtu.attr) 522 + param = ISCSI_NET_PARAM_MTU; 523 + else if (attr == &dev_attr_iface_port.attr) 524 + param = ISCSI_NET_PARAM_PORT; 525 + else if (attr == &dev_attr_iface_ipaddress_state.attr) 526 + param = ISCSI_NET_PARAM_IPADDR_STATE; 527 + else if (attr == &dev_attr_iface_delayed_ack_en.attr) 528 + param = ISCSI_NET_PARAM_DELAYED_ACK_EN; 529 + else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) 530 + param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; 531 + else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) 532 + param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; 533 + else if (attr == &dev_attr_iface_tcp_wsf.attr) 534 + param = ISCSI_NET_PARAM_TCP_WSF; 535 + else if (attr == &dev_attr_iface_tcp_timer_scale.attr) 536 + param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; 537 + else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) 538 + param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; 539 + else if (attr == &dev_attr_iface_cache_id.attr) 540 + param = ISCSI_NET_PARAM_CACHE_ID; 541 + else if (attr == &dev_attr_iface_redirect_en.attr) 542 + param = ISCSI_NET_PARAM_REDIRECT_EN; 482 543 else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { 483 544 if (attr == &dev_attr_ipv4_iface_ipaddress.attr) 484 545 param = ISCSI_NET_PARAM_IPV4_ADDR; ··· 601 598 return 0; 602 599 } 603 600 604 - switch (param) { 605 - case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: 606 - case ISCSI_IFACE_PARAM_HDRDGST_EN: 607 - case ISCSI_IFACE_PARAM_DATADGST_EN: 608 - case ISCSI_IFACE_PARAM_IMM_DATA_EN: 609 - case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: 610 - case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: 611 - case ISCSI_IFACE_PARAM_PDU_INORDER_EN: 612 - case ISCSI_IFACE_PARAM_ERL: 613 - case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: 614 - case ISCSI_IFACE_PARAM_FIRST_BURST: 615 - case ISCSI_IFACE_PARAM_MAX_R2T: 616 - case ISCSI_IFACE_PARAM_MAX_BURST: 617 - case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: 618 - case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: 619 - case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: 620 - case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: 621 - case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: 622 - case ISCSI_IFACE_PARAM_INITIATOR_NAME: 623 - param_type = ISCSI_IFACE_PARAM; 624 - break; 625 - default: 626 - param_type = ISCSI_NET_PARAM; 627 - } 628 - 629 - return t->attr_is_visible(param_type, param); 601 + return t->attr_is_visible(ISCSI_NET_PARAM, param); 630 602 } 631 603 632 604 static struct attribute *iscsi_iface_attrs[] = {
+2 -7
drivers/spi/spi-atmel.c
··· 352 352 } 353 353 354 354 mr = spi_readl(as, MR); 355 - if (spi->cs_gpiod) 356 - gpiod_set_value(spi->cs_gpiod, 1); 357 355 } else { 358 356 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0; 359 357 int i; ··· 367 369 368 370 mr = spi_readl(as, MR); 369 371 mr = SPI_BFINS(PCS, ~(1 << chip_select), mr); 370 - if (spi->cs_gpiod) 371 - gpiod_set_value(spi->cs_gpiod, 1); 372 372 spi_writel(as, MR, mr); 373 373 } 374 374 ··· 396 400 397 401 if (!spi->cs_gpiod) 398 402 spi_writel(as, CR, SPI_BIT(LASTXFER)); 399 - else 400 - gpiod_set_value(spi->cs_gpiod, 0); 401 403 } 402 404 403 405 static void atmel_spi_lock(struct atmel_spi *as) __acquires(&as->lock) ··· 1477 1483 master->bus_num = pdev->id; 1478 1484 master->num_chipselect = 4; 1479 1485 master->setup = atmel_spi_setup; 1480 - master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX); 1486 + master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX | 1487 + SPI_MASTER_GPIO_SS); 1481 1488 master->transfer_one = atmel_spi_one_transfer; 1482 1489 master->set_cs = atmel_spi_set_cs; 1483 1490 master->cleanup = atmel_spi_cleanup;
+7 -5
drivers/spi/spi-bcm2835.c
··· 83 83 * struct bcm2835_spi - BCM2835 SPI controller 84 84 * @regs: base address of register map 85 85 * @clk: core clock, divided to calculate serial clock 86 + * @clk_hz: core clock cached speed 86 87 * @irq: interrupt, signals TX FIFO empty or RX FIFO ¾ full 87 88 * @tfr: SPI transfer currently processed 88 89 * @ctlr: SPI controller reverse lookup ··· 117 116 struct bcm2835_spi { 118 117 void __iomem *regs; 119 118 struct clk *clk; 119 + unsigned long clk_hz; 120 120 int irq; 121 121 struct spi_transfer *tfr; 122 122 struct spi_controller *ctlr; ··· 1047 1045 { 1048 1046 struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); 1049 1047 struct bcm2835_spidev *slv = spi_get_ctldata(spi); 1050 - unsigned long spi_hz, clk_hz, cdiv; 1048 + unsigned long spi_hz, cdiv; 1051 1049 unsigned long hz_per_byte, byte_limit; 1052 1050 u32 cs = slv->prepare_cs; 1053 1051 1054 1052 /* set clock */ 1055 1053 spi_hz = tfr->speed_hz; 1056 - clk_hz = clk_get_rate(bs->clk); 1057 1054 1058 - if (spi_hz >= clk_hz / 2) { 1055 + if (spi_hz >= bs->clk_hz / 2) { 1059 1056 cdiv = 2; /* clk_hz/2 is the fastest we can go */ 1060 1057 } else if (spi_hz) { 1061 1058 /* CDIV must be a multiple of two */ 1062 - cdiv = DIV_ROUND_UP(clk_hz, spi_hz); 1059 + cdiv = DIV_ROUND_UP(bs->clk_hz, spi_hz); 1063 1060 cdiv += (cdiv % 2); 1064 1061 1065 1062 if (cdiv >= 65536) ··· 1066 1065 } else { 1067 1066 cdiv = 0; /* 0 is the slowest we can go */ 1068 1067 } 1069 - tfr->effective_speed_hz = cdiv ? (clk_hz / cdiv) : (clk_hz / 65536); 1068 + tfr->effective_speed_hz = cdiv ? (bs->clk_hz / cdiv) : (bs->clk_hz / 65536); 1070 1069 bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv); 1071 1070 1072 1071 /* handle all the 3-wire mode */ ··· 1355 1354 return bs->irq ? bs->irq : -ENODEV; 1356 1355 1357 1356 clk_prepare_enable(bs->clk); 1357 + bs->clk_hz = clk_get_rate(bs->clk); 1358 1358 1359 1359 err = bcm2835_dma_init(ctlr, &pdev->dev, bs); 1360 1360 if (err)
+17 -13
drivers/spi/spi-cadence-quadspi.c
··· 309 309 { 310 310 unsigned int dummy_clk; 311 311 312 + if (!op->dummy.nbytes) 313 + return 0; 314 + 312 315 dummy_clk = op->dummy.nbytes * (8 / op->dummy.buswidth); 313 316 if (dtr) 314 317 dummy_clk /= 2; ··· 800 797 reg = cqspi_calc_rdreg(f_pdata); 801 798 writel(reg, reg_base + CQSPI_REG_RD_INSTR); 802 799 803 - if (f_pdata->dtr) { 804 - /* 805 - * Some flashes like the cypress Semper flash expect a 4-byte 806 - * dummy address with the Read SR command in DTR mode, but this 807 - * controller does not support sending address with the Read SR 808 - * command. So, disable write completion polling on the 809 - * controller's side. spi-nor will take care of polling the 810 - * status register. 811 - */ 812 - reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL); 813 - reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL; 814 - writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL); 815 - } 800 + /* 801 + * SPI NAND flashes require the address of the status register to be 802 + * passed in the Read SR command. Also, some SPI NOR flashes like the 803 + * cypress Semper flash expect a 4-byte dummy address in the Read SR 804 + * command in DTR mode. 805 + * 806 + * But this controller does not support address phase in the Read SR 807 + * command when doing auto-HW polling. So, disable write completion 808 + * polling on the controller's side. spinand and spi-nor will take 809 + * care of polling the status register. 810 + */ 811 + reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL); 812 + reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL; 813 + writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL); 816 814 817 815 reg = readl(reg_base + CQSPI_REG_SIZE); 818 816 reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK;
+9 -5
drivers/spi/spi-cadence.c
··· 517 517 goto clk_dis_apb; 518 518 } 519 519 520 + pm_runtime_use_autosuspend(&pdev->dev); 521 + pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); 522 + pm_runtime_get_noresume(&pdev->dev); 523 + pm_runtime_set_active(&pdev->dev); 524 + pm_runtime_enable(&pdev->dev); 525 + 520 526 ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); 521 527 if (ret < 0) 522 528 master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS; ··· 536 530 537 531 /* SPI controller initializations */ 538 532 cdns_spi_init_hw(xspi); 539 - 540 - pm_runtime_set_active(&pdev->dev); 541 - pm_runtime_enable(&pdev->dev); 542 - pm_runtime_use_autosuspend(&pdev->dev); 543 - pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); 544 533 545 534 irq = platform_get_irq(pdev, 0); 546 535 if (irq <= 0) { ··· 566 565 xspi->speed_hz = master->max_speed_hz; 567 566 568 567 master->bits_per_word_mask = SPI_BPW_MASK(8); 568 + 569 + pm_runtime_mark_last_busy(&pdev->dev); 570 + pm_runtime_put_autosuspend(&pdev->dev); 569 571 570 572 ret = spi_register_master(master); 571 573 if (ret) {
+19 -19
drivers/spi/spi-imx.c
··· 506 506 { 507 507 struct spi_device *spi = msg->spi; 508 508 u32 ctrl = MX51_ECSPI_CTRL_ENABLE; 509 - u32 testreg; 509 + u32 testreg, delay; 510 510 u32 cfg = readl(spi_imx->base + MX51_ECSPI_CONFIG); 511 511 512 512 /* set Master or Slave mode */ ··· 567 567 568 568 writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); 569 569 570 + /* 571 + * Wait until the changes in the configuration register CONFIGREG 572 + * propagate into the hardware. It takes exactly one tick of the 573 + * SCLK clock, but we will wait two SCLK clock just to be sure. The 574 + * effect of the delay it takes for the hardware to apply changes 575 + * is noticable if the SCLK clock run very slow. In such a case, if 576 + * the polarity of SCLK should be inverted, the GPIO ChipSelect might 577 + * be asserted before the SCLK polarity changes, which would disrupt 578 + * the SPI communication as the device on the other end would consider 579 + * the change of SCLK polarity as a clock tick already. 580 + */ 581 + delay = (2 * 1000000) / spi_imx->spi_bus_clk; 582 + if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ 583 + udelay(delay); 584 + else /* SCLK is _very_ slow */ 585 + usleep_range(delay, delay + 10); 586 + 570 587 return 0; 571 588 } 572 589 ··· 591 574 struct spi_device *spi) 592 575 { 593 576 u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL); 594 - u32 clk, delay; 577 + u32 clk; 595 578 596 579 /* Clear BL field and set the right value */ 597 580 ctrl &= ~MX51_ECSPI_CTRL_BL_MASK; ··· 612 595 ctrl |= MX51_ECSPI_CTRL_SMC; 613 596 614 597 writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); 615 - 616 - /* 617 - * Wait until the changes in the configuration register CONFIGREG 618 - * propagate into the hardware. It takes exactly one tick of the 619 - * SCLK clock, but we will wait two SCLK clock just to be sure. The 620 - * effect of the delay it takes for the hardware to apply changes 621 - * is noticable if the SCLK clock run very slow. In such a case, if 622 - * the polarity of SCLK should be inverted, the GPIO ChipSelect might 623 - * be asserted before the SCLK polarity changes, which would disrupt 624 - * the SPI communication as the device on the other end would consider 625 - * the change of SCLK polarity as a clock tick already. 626 - */ 627 - delay = (2 * 1000000) / clk; 628 - if (likely(delay < 10)) /* SCLK is faster than 100 kHz */ 629 - udelay(delay); 630 - else /* SCLK is _very_ slow */ 631 - usleep_range(delay, delay + 10); 632 598 633 599 return 0; 634 600 }
+19 -9
drivers/spi/spi-mt65xx.c
··· 427 427 mtk_spi_setup_packet(master); 428 428 429 429 cnt = xfer->len / 4; 430 - iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); 430 + if (xfer->tx_buf) 431 + iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt); 432 + 433 + if (xfer->rx_buf) 434 + ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt); 431 435 432 436 remainder = xfer->len % 4; 433 437 if (remainder > 0) { 434 438 reg_val = 0; 435 - memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder); 436 - writel(reg_val, mdata->base + SPI_TX_DATA_REG); 439 + if (xfer->tx_buf) { 440 + memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder); 441 + writel(reg_val, mdata->base + SPI_TX_DATA_REG); 442 + } 443 + if (xfer->rx_buf) { 444 + reg_val = readl(mdata->base + SPI_RX_DATA_REG); 445 + memcpy(xfer->rx_buf + (cnt * 4), &reg_val, remainder); 446 + } 437 447 } 438 448 439 449 mtk_spi_enable_transfer(master); ··· 803 793 804 794 pm_runtime_enable(&pdev->dev); 805 795 806 - ret = devm_spi_register_master(&pdev->dev, master); 807 - if (ret) { 808 - dev_err(&pdev->dev, "failed to register master (%d)\n", ret); 809 - goto err_disable_runtime_pm; 810 - } 811 - 812 796 if (mdata->dev_comp->need_pad_sel) { 813 797 if (mdata->pad_num != master->num_chipselect) { 814 798 dev_err(&pdev->dev, ··· 841 837 if (ret) 842 838 dev_notice(&pdev->dev, "SPI dma_set_mask(%d) failed, ret:%d\n", 843 839 addr_bits, ret); 840 + 841 + ret = devm_spi_register_master(&pdev->dev, master); 842 + if (ret) { 843 + dev_err(&pdev->dev, "failed to register master (%d)\n", ret); 844 + goto err_disable_runtime_pm; 845 + } 844 846 845 847 return 0; 846 848
+17 -7
drivers/spi/spi-stm32.c
··· 884 884 ier = readl_relaxed(spi->base + STM32H7_SPI_IER); 885 885 886 886 mask = ier; 887 - /* EOTIE is triggered on EOT, SUSP and TXC events. */ 887 + /* 888 + * EOTIE enables irq from EOT, SUSP and TXC events. We need to set 889 + * SUSP to acknowledge it later. TXC is automatically cleared 890 + */ 891 + 888 892 mask |= STM32H7_SPI_SR_SUSP; 889 893 /* 890 - * When TXTF is set, DXPIE and TXPIE are cleared. So in case of 891 - * Full-Duplex, need to poll RXP event to know if there are remaining 892 - * data, before disabling SPI. 894 + * DXPIE is set in Full-Duplex, one IT will be raised if TXP and RXP 895 + * are set. So in case of Full-Duplex, need to poll TXP and RXP event. 893 896 */ 894 - if (spi->rx_buf && !spi->cur_usedma) 895 - mask |= STM32H7_SPI_SR_RXP; 897 + if ((spi->cur_comm == SPI_FULL_DUPLEX) && !spi->cur_usedma) 898 + mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP; 896 899 897 900 if (!(sr & mask)) { 898 901 dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", ··· 1928 1925 master->can_dma = stm32_spi_can_dma; 1929 1926 1930 1927 pm_runtime_set_active(&pdev->dev); 1928 + pm_runtime_get_noresume(&pdev->dev); 1931 1929 pm_runtime_enable(&pdev->dev); 1932 1930 1933 1931 ret = spi_register_master(master); ··· 1944 1940 1945 1941 err_pm_disable: 1946 1942 pm_runtime_disable(&pdev->dev); 1943 + pm_runtime_put_noidle(&pdev->dev); 1944 + pm_runtime_set_suspended(&pdev->dev); 1947 1945 err_dma_release: 1948 1946 if (spi->dma_tx) 1949 1947 dma_release_channel(spi->dma_tx); ··· 1962 1956 struct spi_master *master = platform_get_drvdata(pdev); 1963 1957 struct stm32_spi *spi = spi_master_get_devdata(master); 1964 1958 1959 + pm_runtime_get_sync(&pdev->dev); 1960 + 1965 1961 spi_unregister_master(master); 1966 1962 spi->cfg->disable(spi); 1967 1963 1964 + pm_runtime_disable(&pdev->dev); 1965 + pm_runtime_put_noidle(&pdev->dev); 1966 + pm_runtime_set_suspended(&pdev->dev); 1968 1967 if (master->dma_tx) 1969 1968 dma_release_channel(master->dma_tx); 1970 1969 if (master->dma_rx) ··· 1977 1966 1978 1967 clk_disable_unprepare(spi->clk); 1979 1968 1980 - pm_runtime_disable(&pdev->dev); 1981 1969 1982 1970 pinctrl_pm_select_sleep_state(&pdev->dev); 1983 1971
+17 -18
drivers/target/target_core_sbc.c
··· 25 25 #include "target_core_alua.h" 26 26 27 27 static sense_reason_t 28 - sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool); 28 + sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool); 29 29 static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd); 30 30 31 31 static sense_reason_t ··· 279 279 } 280 280 281 281 static sense_reason_t 282 - sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) 282 + sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops) 283 283 { 284 284 struct se_device *dev = cmd->se_dev; 285 285 sector_t end_lba = dev->transport->get_blocks(dev) + 1; 286 286 unsigned int sectors = sbc_get_write_same_sectors(cmd); 287 287 sense_reason_t ret; 288 288 289 - if ((flags[0] & 0x04) || (flags[0] & 0x02)) { 289 + if ((flags & 0x04) || (flags & 0x02)) { 290 290 pr_err("WRITE_SAME PBDATA and LBDATA" 291 291 " bits not supported for Block Discard" 292 292 " Emulation\n"); ··· 308 308 } 309 309 310 310 /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ 311 - if (flags[0] & 0x10) { 311 + if (flags & 0x10) { 312 312 pr_warn("WRITE SAME with ANCHOR not supported\n"); 313 313 return TCM_INVALID_CDB_FIELD; 314 314 } ··· 316 316 * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting 317 317 * translated into block discard requests within backend code. 318 318 */ 319 - if (flags[0] & 0x08) { 319 + if (flags & 0x08) { 320 320 if (!ops->execute_unmap) 321 321 return TCM_UNSUPPORTED_SCSI_OPCODE; 322 322 ··· 331 331 if (!ops->execute_write_same) 332 332 return TCM_UNSUPPORTED_SCSI_OPCODE; 333 333 334 - ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true); 334 + ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true); 335 335 if (ret) 336 336 return ret; 337 337 ··· 717 717 } 718 718 719 719 static sense_reason_t 720 - sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, 720 + sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect, 721 721 u32 sectors, bool is_write) 722 722 { 723 - u8 protect = cdb[1] >> 5; 724 723 int sp_ops = cmd->se_sess->sup_prot_ops; 725 724 int pi_prot_type = dev->dev_attrib.pi_prot_type; 726 725 bool fabric_prot = false; ··· 767 768 fallthrough; 768 769 default: 769 770 pr_err("Unable to determine pi_prot_type for CDB: 0x%02x " 770 - "PROTECT: 0x%02x\n", cdb[0], protect); 771 + "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect); 771 772 return TCM_INVALID_CDB_FIELD; 772 773 } 773 774 ··· 842 843 if (sbc_check_dpofua(dev, cmd, cdb)) 843 844 return TCM_INVALID_CDB_FIELD; 844 845 845 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 846 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 846 847 if (ret) 847 848 return ret; 848 849 ··· 856 857 if (sbc_check_dpofua(dev, cmd, cdb)) 857 858 return TCM_INVALID_CDB_FIELD; 858 859 859 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 860 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 860 861 if (ret) 861 862 return ret; 862 863 ··· 870 871 if (sbc_check_dpofua(dev, cmd, cdb)) 871 872 return TCM_INVALID_CDB_FIELD; 872 873 873 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 874 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 874 875 if (ret) 875 876 return ret; 876 877 ··· 891 892 if (sbc_check_dpofua(dev, cmd, cdb)) 892 893 return TCM_INVALID_CDB_FIELD; 893 894 894 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 895 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 895 896 if (ret) 896 897 return ret; 897 898 ··· 905 906 if (sbc_check_dpofua(dev, cmd, cdb)) 906 907 return TCM_INVALID_CDB_FIELD; 907 908 908 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 909 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 909 910 if (ret) 910 911 return ret; 911 912 ··· 920 921 if (sbc_check_dpofua(dev, cmd, cdb)) 921 922 return TCM_INVALID_CDB_FIELD; 922 923 923 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 924 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 924 925 if (ret) 925 926 return ret; 926 927 ··· 979 980 size = sbc_get_size(cmd, 1); 980 981 cmd->t_task_lba = get_unaligned_be64(&cdb[12]); 981 982 982 - ret = sbc_setup_write_same(cmd, &cdb[10], ops); 983 + ret = sbc_setup_write_same(cmd, cdb[10], ops); 983 984 if (ret) 984 985 return ret; 985 986 break; ··· 1078 1079 size = sbc_get_size(cmd, 1); 1079 1080 cmd->t_task_lba = get_unaligned_be64(&cdb[2]); 1080 1081 1081 - ret = sbc_setup_write_same(cmd, &cdb[1], ops); 1082 + ret = sbc_setup_write_same(cmd, cdb[1], ops); 1082 1083 if (ret) 1083 1084 return ret; 1084 1085 break; ··· 1096 1097 * Follow sbcr26 with WRITE_SAME (10) and check for the existence 1097 1098 * of byte 1 bit 3 UNMAP instead of original reserved field 1098 1099 */ 1099 - ret = sbc_setup_write_same(cmd, &cdb[1], ops); 1100 + ret = sbc_setup_write_same(cmd, cdb[1], ops); 1100 1101 if (ret) 1101 1102 return ret; 1102 1103 break;
+1 -1
drivers/target/target_core_transport.c
··· 886 886 INIT_WORK(&cmd->work, success ? target_complete_ok_work : 887 887 target_complete_failure_work); 888 888 889 - if (wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) 889 + if (!wwn || wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) 890 890 cpu = cmd->cpuid; 891 891 else 892 892 cpu = wwn->cmd_compl_affinity;
+3 -3
drivers/usb/class/cdc-wdm.c
··· 824 824 }; 825 825 826 826 /* --- WWAN framework integration --- */ 827 - #ifdef CONFIG_WWAN 827 + #ifdef CONFIG_WWAN_CORE 828 828 static int wdm_wwan_port_start(struct wwan_port *port) 829 829 { 830 830 struct wdm_device *desc = wwan_port_get_drvdata(port); ··· 963 963 /* inbuf has been copied, it is safe to check for outstanding data */ 964 964 schedule_work(&desc->service_outs_intr); 965 965 } 966 - #else /* CONFIG_WWAN */ 966 + #else /* CONFIG_WWAN_CORE */ 967 967 static void wdm_wwan_init(struct wdm_device *desc) {} 968 968 static void wdm_wwan_deinit(struct wdm_device *desc) {} 969 969 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} 970 - #endif /* CONFIG_WWAN */ 970 + #endif /* CONFIG_WWAN_CORE */ 971 971 972 972 /* --- error handling --- */ 973 973 static void wdm_rxwork(struct work_struct *work)
+1 -1
drivers/usb/core/devio.c
··· 1133 1133 "wIndex=%04x wLength=%04x\n", 1134 1134 ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, 1135 1135 ctrl->wIndex, ctrl->wLength); 1136 - if (ctrl->bRequestType & 0x80) { 1136 + if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) { 1137 1137 pipe = usb_rcvctrlpipe(dev, 0); 1138 1138 snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0); 1139 1139
+84 -36
drivers/usb/core/hub.c
··· 48 48 49 49 #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ 50 50 #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ 51 + #define USB_PING_RESPONSE_TIME 400 /* ns */ 51 52 52 53 /* Protect struct usb_device->state and ->children members 53 54 * Note: Both are also protected by ->dev.sem, except that ->state can ··· 183 182 } 184 183 185 184 /* 186 - * Set the Maximum Exit Latency (MEL) for the host to initiate a transition from 187 - * either U1 or U2. 185 + * Set the Maximum Exit Latency (MEL) for the host to wakup up the path from 186 + * U1/U2, send a PING to the device and receive a PING_RESPONSE. 187 + * See USB 3.1 section C.1.5.2 188 188 */ 189 189 static void usb_set_lpm_mel(struct usb_device *udev, 190 190 struct usb3_lpm_parameters *udev_lpm_params, ··· 195 193 unsigned int hub_exit_latency) 196 194 { 197 195 unsigned int total_mel; 198 - unsigned int device_mel; 199 - unsigned int hub_mel; 200 196 201 197 /* 202 - * Calculate the time it takes to transition all links from the roothub 203 - * to the parent hub into U0. The parent hub must then decode the 204 - * packet (hub header decode latency) to figure out which port it was 205 - * bound for. 206 - * 207 - * The Hub Header decode latency is expressed in 0.1us intervals (0x1 208 - * means 0.1us). Multiply that by 100 to get nanoseconds. 198 + * tMEL1. time to transition path from host to device into U0. 199 + * MEL for parent already contains the delay up to parent, so only add 200 + * the exit latency for the last link (pick the slower exit latency), 201 + * and the hub header decode latency. See USB 3.1 section C 2.2.1 202 + * Store MEL in nanoseconds 209 203 */ 210 204 total_mel = hub_lpm_params->mel + 211 - (hub->descriptor->u.ss.bHubHdrDecLat * 100); 205 + max(udev_exit_latency, hub_exit_latency) * 1000 + 206 + hub->descriptor->u.ss.bHubHdrDecLat * 100; 212 207 213 208 /* 214 - * How long will it take to transition the downstream hub's port into 215 - * U0? The greater of either the hub exit latency or the device exit 216 - * latency. 217 - * 218 - * The BOS U1/U2 exit latencies are expressed in 1us intervals. 219 - * Multiply that by 1000 to get nanoseconds. 209 + * tMEL2. Time to submit PING packet. Sum of tTPTransmissionDelay for 210 + * each link + wHubDelay for each hub. Add only for last link. 211 + * tMEL4, the time for PING_RESPONSE to traverse upstream is similar. 212 + * Multiply by 2 to include it as well. 220 213 */ 221 - device_mel = udev_exit_latency * 1000; 222 - hub_mel = hub_exit_latency * 1000; 223 - if (device_mel > hub_mel) 224 - total_mel += device_mel; 225 - else 226 - total_mel += hub_mel; 214 + total_mel += (__le16_to_cpu(hub->descriptor->u.ss.wHubDelay) + 215 + USB_TP_TRANSMISSION_DELAY) * 2; 216 + 217 + /* 218 + * tMEL3, tPingResponse. Time taken by device to generate PING_RESPONSE 219 + * after receiving PING. Also add 2100ns as stated in USB 3.1 C 1.5.2.4 220 + * to cover the delay if the PING_RESPONSE is queued behind a Max Packet 221 + * Size DP. 222 + * Note these delays should be added only once for the entire path, so 223 + * add them to the MEL of the device connected to the roothub. 224 + */ 225 + if (!hub->hdev->parent) 226 + total_mel += USB_PING_RESPONSE_TIME + 2100; 227 227 228 228 udev_lpm_params->mel = total_mel; 229 229 } ··· 4117 4113 } 4118 4114 4119 4115 /* 4116 + * Don't allow device intiated U1/U2 if the system exit latency + one bus 4117 + * interval is greater than the minimum service interval of any active 4118 + * periodic endpoint. See USB 3.2 section 9.4.9 4119 + */ 4120 + static bool usb_device_may_initiate_lpm(struct usb_device *udev, 4121 + enum usb3_link_state state) 4122 + { 4123 + unsigned int sel; /* us */ 4124 + int i, j; 4125 + 4126 + if (state == USB3_LPM_U1) 4127 + sel = DIV_ROUND_UP(udev->u1_params.sel, 1000); 4128 + else if (state == USB3_LPM_U2) 4129 + sel = DIV_ROUND_UP(udev->u2_params.sel, 1000); 4130 + else 4131 + return false; 4132 + 4133 + for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 4134 + struct usb_interface *intf; 4135 + struct usb_endpoint_descriptor *desc; 4136 + unsigned int interval; 4137 + 4138 + intf = udev->actconfig->interface[i]; 4139 + if (!intf) 4140 + continue; 4141 + 4142 + for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) { 4143 + desc = &intf->cur_altsetting->endpoint[j].desc; 4144 + 4145 + if (usb_endpoint_xfer_int(desc) || 4146 + usb_endpoint_xfer_isoc(desc)) { 4147 + interval = (1 << (desc->bInterval - 1)) * 125; 4148 + if (sel + 125 > interval) 4149 + return false; 4150 + } 4151 + } 4152 + } 4153 + return true; 4154 + } 4155 + 4156 + /* 4120 4157 * Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated 4121 4158 * U1/U2 entry. 4122 4159 * ··· 4229 4184 * U1/U2_ENABLE 4230 4185 */ 4231 4186 if (udev->actconfig && 4232 - usb_set_device_initiated_lpm(udev, state, true) == 0) { 4233 - if (state == USB3_LPM_U1) 4234 - udev->usb3_lpm_u1_enabled = 1; 4235 - else if (state == USB3_LPM_U2) 4236 - udev->usb3_lpm_u2_enabled = 1; 4237 - } else { 4238 - /* Don't request U1/U2 entry if the device 4239 - * cannot transition to U1/U2. 4240 - */ 4241 - usb_set_lpm_timeout(udev, state, 0); 4242 - hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); 4187 + usb_device_may_initiate_lpm(udev, state)) { 4188 + if (usb_set_device_initiated_lpm(udev, state, true)) { 4189 + /* 4190 + * Request to enable device initiated U1/U2 failed, 4191 + * better to turn off lpm in this case. 4192 + */ 4193 + usb_set_lpm_timeout(udev, state, 0); 4194 + hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); 4195 + return; 4196 + } 4243 4197 } 4244 - } 4245 4198 4199 + if (state == USB3_LPM_U1) 4200 + udev->usb3_lpm_u1_enabled = 1; 4201 + else if (state == USB3_LPM_U2) 4202 + udev->usb3_lpm_u2_enabled = 1; 4203 + } 4246 4204 /* 4247 4205 * Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated 4248 4206 * U1/U2 entry.
-4
drivers/usb/core/quirks.c
··· 501 501 /* DJI CineSSD */ 502 502 { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, 503 503 504 - /* Fibocom L850-GL LTE Modem */ 505 - { USB_DEVICE(0x2cb7, 0x0007), .driver_info = 506 - USB_QUIRK_IGNORE_REMOTE_WAKEUP }, 507 - 508 504 /* INTEL VALUE SSD */ 509 505 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, 510 506
+4
drivers/usb/dwc2/core.h
··· 383 383 * 0 - No (default) 384 384 * 1 - Partial power down 385 385 * 2 - Hibernation 386 + * @no_clock_gating: Specifies whether to avoid clock gating feature. 387 + * 0 - No (use clock gating) 388 + * 1 - Yes (avoid it) 386 389 * @lpm: Enable LPM support. 387 390 * 0 - No 388 391 * 1 - Yes ··· 483 480 #define DWC2_POWER_DOWN_PARAM_NONE 0 484 481 #define DWC2_POWER_DOWN_PARAM_PARTIAL 1 485 482 #define DWC2_POWER_DOWN_PARAM_HIBERNATION 2 483 + bool no_clock_gating; 486 484 487 485 bool lpm; 488 486 bool lpm_clock_gating;
+2 -1
drivers/usb/dwc2/core_intr.c
··· 556 556 * If neither hibernation nor partial power down are supported, 557 557 * clock gating is used to save power. 558 558 */ 559 - dwc2_gadget_enter_clock_gating(hsotg); 559 + if (!hsotg->params.no_clock_gating) 560 + dwc2_gadget_enter_clock_gating(hsotg); 560 561 } 561 562 562 563 /*
+27 -4
drivers/usb/dwc2/gadget.c
··· 2749 2749 return; 2750 2750 } 2751 2751 2752 - /* Zlp for all endpoints, for ep0 only in DATA IN stage */ 2752 + /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ 2753 2753 if (hs_ep->send_zlp) { 2754 - dwc2_hsotg_program_zlp(hsotg, hs_ep); 2755 2754 hs_ep->send_zlp = 0; 2756 - /* transfer will be completed on next complete interrupt */ 2757 - return; 2755 + if (!using_desc_dma(hsotg)) { 2756 + dwc2_hsotg_program_zlp(hsotg, hs_ep); 2757 + /* transfer will be completed on next complete interrupt */ 2758 + return; 2759 + } 2758 2760 } 2759 2761 2760 2762 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) { ··· 3902 3900 __func__); 3903 3901 } 3904 3902 } else { 3903 + /* Mask GINTSTS_GOUTNAKEFF interrupt */ 3904 + dwc2_hsotg_disable_gsint(hsotg, GINTSTS_GOUTNAKEFF); 3905 + 3905 3906 if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF)) 3906 3907 dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK); 3908 + 3909 + if (!using_dma(hsotg)) { 3910 + /* Wait for GINTSTS_RXFLVL interrupt */ 3911 + if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, 3912 + GINTSTS_RXFLVL, 100)) { 3913 + dev_warn(hsotg->dev, "%s: timeout GINTSTS.RXFLVL\n", 3914 + __func__); 3915 + } else { 3916 + /* 3917 + * Pop GLOBAL OUT NAK status packet from RxFIFO 3918 + * to assert GOUTNAKEFF interrupt 3919 + */ 3920 + dwc2_readl(hsotg, GRXSTSP); 3921 + } 3922 + } 3907 3923 3908 3924 /* Wait for global nak to take effect */ 3909 3925 if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, ··· 4368 4348 epctl = dwc2_readl(hs, epreg); 4369 4349 4370 4350 if (value) { 4351 + /* Unmask GOUTNAKEFF interrupt */ 4352 + dwc2_hsotg_en_gsint(hs, GINTSTS_GOUTNAKEFF); 4353 + 4371 4354 if (!(dwc2_readl(hs, GINTSTS) & GINTSTS_GOUTNAKEFF)) 4372 4355 dwc2_set_bit(hs, DCTL, DCTL_SGOUTNAK); 4373 4356 // STALL bit will be set in GOUTNAKEFF interrupt handler
+4 -2
drivers/usb/dwc2/hcd.c
··· 3338 3338 * If not hibernation nor partial power down are supported, 3339 3339 * clock gating is used to save power. 3340 3340 */ 3341 - dwc2_host_enter_clock_gating(hsotg); 3341 + if (!hsotg->params.no_clock_gating) 3342 + dwc2_host_enter_clock_gating(hsotg); 3342 3343 break; 3343 3344 } 3344 3345 ··· 4403 4402 * If not hibernation nor partial power down are supported, 4404 4403 * clock gating is used to save power. 4405 4404 */ 4406 - dwc2_host_enter_clock_gating(hsotg); 4405 + if (!hsotg->params.no_clock_gating) 4406 + dwc2_host_enter_clock_gating(hsotg); 4407 4407 4408 4408 /* After entering suspend, hardware is not accessible */ 4409 4409 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+1
drivers/usb/dwc2/params.c
··· 76 76 struct dwc2_core_params *p = &hsotg->params; 77 77 78 78 p->power_down = DWC2_POWER_DOWN_PARAM_NONE; 79 + p->no_clock_gating = true; 79 80 p->phy_utmi_width = 8; 80 81 } 81 82
+1
drivers/usb/dwc3/core.h
··· 1279 1279 unsigned dis_metastability_quirk:1; 1280 1280 1281 1281 unsigned dis_split_quirk:1; 1282 + unsigned async_callbacks:1; 1282 1283 1283 1284 u16 imod_interval; 1284 1285 };
+6 -4
drivers/usb/dwc3/ep0.c
··· 597 597 598 598 static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) 599 599 { 600 - int ret; 600 + int ret = -EINVAL; 601 601 602 - spin_unlock(&dwc->lock); 603 - ret = dwc->gadget_driver->setup(dwc->gadget, ctrl); 604 - spin_lock(&dwc->lock); 602 + if (dwc->async_callbacks) { 603 + spin_unlock(&dwc->lock); 604 + ret = dwc->gadget_driver->setup(dwc->gadget, ctrl); 605 + spin_lock(&dwc->lock); 606 + } 605 607 return ret; 606 608 } 607 609
+16 -5
drivers/usb/dwc3/gadget.c
··· 2585 2585 return ret; 2586 2586 } 2587 2587 2588 + static void dwc3_gadget_async_callbacks(struct usb_gadget *g, bool enable) 2589 + { 2590 + struct dwc3 *dwc = gadget_to_dwc(g); 2591 + unsigned long flags; 2592 + 2593 + spin_lock_irqsave(&dwc->lock, flags); 2594 + dwc->async_callbacks = enable; 2595 + spin_unlock_irqrestore(&dwc->lock, flags); 2596 + } 2597 + 2588 2598 static const struct usb_gadget_ops dwc3_gadget_ops = { 2589 2599 .get_frame = dwc3_gadget_get_frame, 2590 2600 .wakeup = dwc3_gadget_wakeup, ··· 2606 2596 .udc_set_ssp_rate = dwc3_gadget_set_ssp_rate, 2607 2597 .get_config_params = dwc3_gadget_config_params, 2608 2598 .vbus_draw = dwc3_gadget_vbus_draw, 2599 + .udc_async_callbacks = dwc3_gadget_async_callbacks, 2609 2600 }; 2610 2601 2611 2602 /* -------------------------------------------------------------------------- */ ··· 3242 3231 3243 3232 static void dwc3_disconnect_gadget(struct dwc3 *dwc) 3244 3233 { 3245 - if (dwc->gadget_driver && dwc->gadget_driver->disconnect) { 3234 + if (dwc->async_callbacks && dwc->gadget_driver->disconnect) { 3246 3235 spin_unlock(&dwc->lock); 3247 3236 dwc->gadget_driver->disconnect(dwc->gadget); 3248 3237 spin_lock(&dwc->lock); ··· 3251 3240 3252 3241 static void dwc3_suspend_gadget(struct dwc3 *dwc) 3253 3242 { 3254 - if (dwc->gadget_driver && dwc->gadget_driver->suspend) { 3243 + if (dwc->async_callbacks && dwc->gadget_driver->suspend) { 3255 3244 spin_unlock(&dwc->lock); 3256 3245 dwc->gadget_driver->suspend(dwc->gadget); 3257 3246 spin_lock(&dwc->lock); ··· 3260 3249 3261 3250 static void dwc3_resume_gadget(struct dwc3 *dwc) 3262 3251 { 3263 - if (dwc->gadget_driver && dwc->gadget_driver->resume) { 3252 + if (dwc->async_callbacks && dwc->gadget_driver->resume) { 3264 3253 spin_unlock(&dwc->lock); 3265 3254 dwc->gadget_driver->resume(dwc->gadget); 3266 3255 spin_lock(&dwc->lock); ··· 3272 3261 if (!dwc->gadget_driver) 3273 3262 return; 3274 3263 3275 - if (dwc->gadget->speed != USB_SPEED_UNKNOWN) { 3264 + if (dwc->async_callbacks && dwc->gadget->speed != USB_SPEED_UNKNOWN) { 3276 3265 spin_unlock(&dwc->lock); 3277 3266 usb_gadget_udc_reset(dwc->gadget, dwc->gadget_driver); 3278 3267 spin_lock(&dwc->lock); ··· 3596 3585 * implemented. 3597 3586 */ 3598 3587 3599 - if (dwc->gadget_driver && dwc->gadget_driver->resume) { 3588 + if (dwc->async_callbacks && dwc->gadget_driver->resume) { 3600 3589 spin_unlock(&dwc->lock); 3601 3590 dwc->gadget_driver->resume(dwc->gadget); 3602 3591 spin_lock(&dwc->lock);
+1 -1
drivers/usb/gadget/function/u_serial.c
··· 1198 1198 struct gs_port *port; 1199 1199 1200 1200 mutex_lock(&ports[port_num].lock); 1201 - if (WARN_ON(!ports[port_num].port)) { 1201 + if (!ports[port_num].port) { 1202 1202 mutex_unlock(&ports[port_num].lock); 1203 1203 return; 1204 1204 }
+1
drivers/usb/gadget/udc/tegra-xudc.c
··· 3853 3853 return 0; 3854 3854 3855 3855 free_eps: 3856 + pm_runtime_disable(&pdev->dev); 3856 3857 tegra_xudc_free_eps(xudc); 3857 3858 free_event_ring: 3858 3859 tegra_xudc_free_event_ring(xudc);
+14 -4
drivers/usb/host/ehci-hcd.c
··· 703 703 static irqreturn_t ehci_irq (struct usb_hcd *hcd) 704 704 { 705 705 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 706 - u32 status, masked_status, pcd_status = 0, cmd; 706 + u32 status, current_status, masked_status, pcd_status = 0; 707 + u32 cmd; 707 708 int bh; 708 709 709 710 spin_lock(&ehci->lock); 710 711 711 - status = ehci_readl(ehci, &ehci->regs->status); 712 + status = 0; 713 + current_status = ehci_readl(ehci, &ehci->regs->status); 714 + restart: 712 715 713 716 /* e.g. cardbus physical eject */ 714 - if (status == ~(u32) 0) { 717 + if (current_status == ~(u32) 0) { 715 718 ehci_dbg (ehci, "device removed\n"); 716 719 goto dead; 717 720 } 721 + status |= current_status; 718 722 719 723 /* 720 724 * We don't use STS_FLR, but some controllers don't like it to 721 725 * remain on, so mask it out along with the other status bits. 722 726 */ 723 - masked_status = status & (INTR_MASK | STS_FLR); 727 + masked_status = current_status & (INTR_MASK | STS_FLR); 724 728 725 729 /* Shared IRQ? */ 726 730 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { ··· 734 730 735 731 /* clear (just) interrupts */ 736 732 ehci_writel(ehci, masked_status, &ehci->regs->status); 733 + 734 + /* For edge interrupts, don't race with an interrupt bit being raised */ 735 + current_status = ehci_readl(ehci, &ehci->regs->status); 736 + if (current_status & INTR_MASK) 737 + goto restart; 738 + 737 739 cmd = ehci_readl(ehci, &ehci->regs->command); 738 740 bh = 0; 739 741
+14 -30
drivers/usb/host/max3421-hcd.c
··· 153 153 */ 154 154 struct urb *curr_urb; 155 155 enum scheduling_pass sched_pass; 156 - struct usb_device *loaded_dev; /* dev that's loaded into the chip */ 157 - int loaded_epnum; /* epnum whose toggles are loaded */ 158 156 int urb_done; /* > 0 -> no errors, < 0: errno */ 159 157 size_t curr_len; 160 158 u8 hien; ··· 490 492 * Caller must NOT hold HCD spinlock. 491 493 */ 492 494 static void 493 - max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, 494 - int force_toggles) 495 + max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum) 495 496 { 496 - struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); 497 - int old_epnum, same_ep, rcvtog, sndtog; 498 - struct usb_device *old_dev; 497 + int rcvtog, sndtog; 499 498 u8 hctl; 500 499 501 - old_dev = max3421_hcd->loaded_dev; 502 - old_epnum = max3421_hcd->loaded_epnum; 503 - 504 - same_ep = (dev == old_dev && epnum == old_epnum); 505 - if (same_ep && !force_toggles) 506 - return; 507 - 508 - if (old_dev && !same_ep) { 509 - /* save the old end-points toggles: */ 510 - u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); 511 - 512 - rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; 513 - sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; 514 - 515 - /* no locking: HCD (i.e., we) own toggles, don't we? */ 516 - usb_settoggle(old_dev, old_epnum, 0, rcvtog); 517 - usb_settoggle(old_dev, old_epnum, 1, sndtog); 518 - } 519 500 /* setup new endpoint's toggle bits: */ 520 501 rcvtog = usb_gettoggle(dev, epnum, 0); 521 502 sndtog = usb_gettoggle(dev, epnum, 1); 522 503 hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) | 523 504 BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT)); 524 505 525 - max3421_hcd->loaded_epnum = epnum; 526 506 spi_wr8(hcd, MAX3421_REG_HCTL, hctl); 527 507 528 508 /* ··· 508 532 * address-assignment so it's best to just always load the 509 533 * address whenever the end-point changed/was forced. 510 534 */ 511 - max3421_hcd->loaded_dev = dev; 512 535 spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum); 513 536 } 514 537 ··· 642 667 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); 643 668 struct urb *urb, *curr_urb = NULL; 644 669 struct max3421_ep *max3421_ep; 645 - int epnum, force_toggles = 0; 670 + int epnum; 646 671 struct usb_host_endpoint *ep; 647 672 struct list_head *pos; 648 673 unsigned long flags; ··· 752 777 usb_settoggle(urb->dev, epnum, 0, 1); 753 778 usb_settoggle(urb->dev, epnum, 1, 1); 754 779 max3421_ep->pkt_state = PKT_STATE_SETUP; 755 - force_toggles = 1; 756 780 } else 757 781 max3421_ep->pkt_state = PKT_STATE_TRANSFER; 758 782 } ··· 759 785 spin_unlock_irqrestore(&max3421_hcd->lock, flags); 760 786 761 787 max3421_ep->last_active = max3421_hcd->frame_number; 762 - max3421_set_address(hcd, urb->dev, epnum, force_toggles); 788 + max3421_set_address(hcd, urb->dev, epnum); 763 789 max3421_set_speed(hcd, urb->dev); 764 790 max3421_next_transfer(hcd, 0); 765 791 return 1; ··· 1353 1379 status = 0; 1354 1380 urb = max3421_hcd->curr_urb; 1355 1381 if (urb) { 1382 + /* save the old end-points toggles: */ 1383 + u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); 1384 + int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; 1385 + int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; 1386 + int epnum = usb_endpoint_num(&urb->ep->desc); 1387 + 1388 + /* no locking: HCD (i.e., we) own toggles, don't we? */ 1389 + usb_settoggle(urb->dev, epnum, 0, rcvtog); 1390 + usb_settoggle(urb->dev, epnum, 1, sndtog); 1391 + 1356 1392 max3421_hcd->curr_urb = NULL; 1357 1393 spin_lock_irqsave(&max3421_hcd->lock, flags); 1358 1394 usb_hcd_unlink_urb_from_ep(hcd, urb);
+2 -1
drivers/usb/host/xhci-hub.c
··· 1638 1638 * Inform the usbcore about resume-in-progress by returning 1639 1639 * a non-zero value even if there are no status changes. 1640 1640 */ 1641 + spin_lock_irqsave(&xhci->lock, flags); 1642 + 1641 1643 status = bus_state->resuming_ports; 1642 1644 1643 1645 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; 1644 1646 1645 - spin_lock_irqsave(&xhci->lock, flags); 1646 1647 /* For each port, did anything change? If so, set that bit in buf. */ 1647 1648 for (i = 0; i < max_ports; i++) { 1648 1649 temp = readl(ports[i]->addr);
+8 -8
drivers/usb/host/xhci-pci-renesas.c
··· 207 207 return 0; 208 208 209 209 case RENESAS_ROM_STATUS_NO_RESULT: /* No result yet */ 210 - dev_dbg(&pdev->dev, "Unknown ROM status ...\n"); 211 - break; 210 + return 0; 212 211 213 212 case RENESAS_ROM_STATUS_ERROR: /* Error State */ 214 213 default: /* All other states are marked as "Reserved states" */ ··· 224 225 u8 fw_state; 225 226 int err; 226 227 227 - /* 228 - * Only if device has ROM and loaded FW we can skip loading and 229 - * return success. Otherwise (even unknown state), attempt to load FW. 230 - */ 231 - if (renesas_check_rom(pdev) && !renesas_check_rom_state(pdev)) 232 - return 0; 228 + /* Check if device has ROM and loaded, if so skip everything */ 229 + err = renesas_check_rom(pdev); 230 + if (err) { /* we have rom */ 231 + err = renesas_check_rom_state(pdev); 232 + if (!err) 233 + return err; 234 + } 233 235 234 236 /* 235 237 * Test if the device is actually needing the firmware. As most
+7
drivers/usb/host/xhci-pci.c
··· 636 636 { /* end: all zeroes */ } 637 637 }; 638 638 MODULE_DEVICE_TABLE(pci, pci_ids); 639 + 640 + /* 641 + * Without CONFIG_USB_XHCI_PCI_RENESAS renesas_xhci_check_request_fw() won't 642 + * load firmware, so don't encumber the xhci-pci driver with it. 643 + */ 644 + #if IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS) 639 645 MODULE_FIRMWARE("renesas_usb_fw.mem"); 646 + #endif 640 647 641 648 /* pci driver glue; this is a "new style" PCI driver module */ 642 649 static struct pci_driver xhci_pci_driver = {
+8 -2
drivers/usb/phy/phy.c
··· 86 86 87 87 list_for_each_entry(usb_phy, &phy_list, head) { 88 88 if (usb_phy->dev == dev) 89 - break; 89 + return usb_phy; 90 90 } 91 91 92 - return usb_phy; 92 + return NULL; 93 93 } 94 94 95 95 static void usb_phy_set_default_current(struct usb_phy *usb_phy) ··· 150 150 struct usb_phy *usb_phy; 151 151 char uchger_state[50] = { 0 }; 152 152 char uchger_type[50] = { 0 }; 153 + unsigned long flags; 153 154 155 + spin_lock_irqsave(&phy_lock, flags); 154 156 usb_phy = __device_to_usb_phy(dev); 157 + spin_unlock_irqrestore(&phy_lock, flags); 158 + 159 + if (!usb_phy) 160 + return -ENODEV; 155 161 156 162 snprintf(uchger_state, ARRAY_SIZE(uchger_state), 157 163 "USB_CHARGER_STATE=%s", usb_chger_state[usb_phy->chg_state]);
+7
drivers/usb/renesas_usbhs/fifo.c
··· 101 101 #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) 102 102 #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) 103 103 static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); 104 + static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable); 105 + static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable); 104 106 struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) 105 107 { 106 108 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); ··· 125 123 if (chan) { 126 124 dmaengine_terminate_all(chan); 127 125 usbhsf_dma_unmap(pkt); 126 + } else { 127 + if (usbhs_pipe_is_dir_in(pipe)) 128 + usbhsf_rx_irq_ctrl(pipe, 0); 129 + else 130 + usbhsf_tx_irq_ctrl(pipe, 0); 128 131 } 129 132 130 133 usbhs_pipe_clear_without_sequence(pipe, 0, 0);
+3 -2
drivers/usb/serial/cp210x.c
··· 155 155 { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ 156 156 { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */ 157 157 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ 158 + { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */ 158 159 { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ 159 160 { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ 160 161 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ ··· 203 202 { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */ 204 203 { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */ 205 204 { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */ 206 - { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */ 207 - { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */ 205 + { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */ 206 + { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */ 208 207 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */ 209 208 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ 210 209 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
+3
drivers/usb/serial/option.c
··· 238 238 #define QUECTEL_PRODUCT_UC15 0x9090 239 239 /* These u-blox products use Qualcomm's vendor ID */ 240 240 #define UBLOX_PRODUCT_R410M 0x90b2 241 + #define UBLOX_PRODUCT_R6XX 0x90fa 241 242 /* These Yuga products use Qualcomm's vendor ID */ 242 243 #define YUGA_PRODUCT_CLM920_NC5 0x9625 243 244 ··· 1102 1101 /* u-blox products using Qualcomm vendor ID */ 1103 1102 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), 1104 1103 .driver_info = RSVD(1) | RSVD(3) }, 1104 + { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX), 1105 + .driver_info = RSVD(3) }, 1105 1106 /* Quectel products using Quectel vendor ID */ 1106 1107 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), 1107 1108 .driver_info = NUMEP2 },
+7
drivers/usb/storage/unusual_uas.h
··· 45 45 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 46 46 US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), 47 47 48 + /* Reported-by: Julian Sikorski <belegdol@gmail.com> */ 49 + UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, 50 + "LaCie", 51 + "Rugged USB3-FW", 52 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 53 + US_FL_IGNORE_UAS), 54 + 48 55 /* 49 56 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI 50 57 * commands in UAS mode. Observed with the 1.28 firmware; are there others?
+16 -4
drivers/usb/typec/stusb160x.c
··· 686 686 return -ENODEV; 687 687 688 688 /* 689 + * This fwnode has a "compatible" property, but is never populated as a 690 + * struct device. Instead we simply parse it to read the properties. 691 + * This it breaks fw_devlink=on. To maintain backward compatibility 692 + * with existing DT files, we work around this by deleting any 693 + * fwnode_links to/from this fwnode. 694 + */ 695 + fw_devlink_purge_absent_suppliers(fwnode); 696 + 697 + /* 689 698 * When both VDD and VSYS power supplies are present, the low power 690 699 * supply VSYS is selected when VSYS voltage is above 3.1 V. 691 700 * Otherwise VDD is selected. ··· 748 739 typec_set_pwr_opmode(chip->port, chip->pwr_opmode); 749 740 750 741 if (client->irq) { 751 - ret = stusb160x_irq_init(chip, client->irq); 752 - if (ret) 753 - goto port_unregister; 754 - 755 742 chip->role_sw = fwnode_usb_role_switch_get(fwnode); 756 743 if (IS_ERR(chip->role_sw)) { 757 744 ret = PTR_ERR(chip->role_sw); ··· 757 752 ret); 758 753 goto port_unregister; 759 754 } 755 + 756 + ret = stusb160x_irq_init(chip, client->irq); 757 + if (ret) 758 + goto role_sw_put; 760 759 } else { 761 760 /* 762 761 * If Source or Dual power role, need to enable VDD supply ··· 784 775 785 776 return 0; 786 777 778 + role_sw_put: 779 + if (chip->role_sw) 780 + usb_role_switch_put(chip->role_sw); 787 781 port_unregister: 788 782 typec_unregister_port(chip->port); 789 783 all_reg_disable:
+9
drivers/usb/typec/tipd/core.c
··· 629 629 if (!fwnode) 630 630 return -ENODEV; 631 631 632 + /* 633 + * This fwnode has a "compatible" property, but is never populated as a 634 + * struct device. Instead we simply parse it to read the properties. 635 + * This breaks fw_devlink=on. To maintain backward compatibility 636 + * with existing DT files, we work around this by deleting any 637 + * fwnode_links to/from this fwnode. 638 + */ 639 + fw_devlink_purge_absent_suppliers(fwnode); 640 + 632 641 tps->role_sw = fwnode_usb_role_switch_get(fwnode); 633 642 if (IS_ERR(tps->role_sw)) { 634 643 ret = PTR_ERR(tps->role_sw);
+7 -18
fs/afs/cmservice.c
··· 29 29 30 30 static int afs_deliver_yfs_cb_callback(struct afs_call *); 31 31 32 - #define CM_NAME(name) \ 33 - char afs_SRXCB##name##_name[] __tracepoint_string = \ 34 - "CB." #name 35 - 36 32 /* 37 33 * CB.CallBack operation type 38 34 */ 39 - static CM_NAME(CallBack); 40 35 static const struct afs_call_type afs_SRXCBCallBack = { 41 - .name = afs_SRXCBCallBack_name, 36 + .name = "CB.CallBack", 42 37 .deliver = afs_deliver_cb_callback, 43 38 .destructor = afs_cm_destructor, 44 39 .work = SRXAFSCB_CallBack, ··· 42 47 /* 43 48 * CB.InitCallBackState operation type 44 49 */ 45 - static CM_NAME(InitCallBackState); 46 50 static const struct afs_call_type afs_SRXCBInitCallBackState = { 47 - .name = afs_SRXCBInitCallBackState_name, 51 + .name = "CB.InitCallBackState", 48 52 .deliver = afs_deliver_cb_init_call_back_state, 49 53 .destructor = afs_cm_destructor, 50 54 .work = SRXAFSCB_InitCallBackState, ··· 52 58 /* 53 59 * CB.InitCallBackState3 operation type 54 60 */ 55 - static CM_NAME(InitCallBackState3); 56 61 static const struct afs_call_type afs_SRXCBInitCallBackState3 = { 57 - .name = afs_SRXCBInitCallBackState3_name, 62 + .name = "CB.InitCallBackState3", 58 63 .deliver = afs_deliver_cb_init_call_back_state3, 59 64 .destructor = afs_cm_destructor, 60 65 .work = SRXAFSCB_InitCallBackState, ··· 62 69 /* 63 70 * CB.Probe operation type 64 71 */ 65 - static CM_NAME(Probe); 66 72 static const struct afs_call_type afs_SRXCBProbe = { 67 - .name = afs_SRXCBProbe_name, 73 + .name = "CB.Probe", 68 74 .deliver = afs_deliver_cb_probe, 69 75 .destructor = afs_cm_destructor, 70 76 .work = SRXAFSCB_Probe, ··· 72 80 /* 73 81 * CB.ProbeUuid operation type 74 82 */ 75 - static CM_NAME(ProbeUuid); 76 83 static const struct afs_call_type afs_SRXCBProbeUuid = { 77 - .name = afs_SRXCBProbeUuid_name, 84 + .name = "CB.ProbeUuid", 78 85 .deliver = afs_deliver_cb_probe_uuid, 79 86 .destructor = afs_cm_destructor, 80 87 .work = SRXAFSCB_ProbeUuid, ··· 82 91 /* 83 92 * CB.TellMeAboutYourself operation type 84 93 */ 85 - static CM_NAME(TellMeAboutYourself); 86 94 static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { 87 - .name = afs_SRXCBTellMeAboutYourself_name, 95 + .name = "CB.TellMeAboutYourself", 88 96 .deliver = afs_deliver_cb_tell_me_about_yourself, 89 97 .destructor = afs_cm_destructor, 90 98 .work = SRXAFSCB_TellMeAboutYourself, ··· 92 102 /* 93 103 * YFS CB.CallBack operation type 94 104 */ 95 - static CM_NAME(YFS_CallBack); 96 105 static const struct afs_call_type afs_SRXYFSCB_CallBack = { 97 - .name = afs_SRXCBYFS_CallBack_name, 106 + .name = "YFSCB.CallBack", 98 107 .deliver = afs_deliver_yfs_cb_callback, 99 108 .destructor = afs_cm_destructor, 100 109 .work = SRXAFSCB_CallBack,
+6 -4
fs/afs/dir.c
··· 656 656 return ret; 657 657 } 658 658 659 - ret = -ENOENT; 660 659 if (!cookie.found) { 661 660 _leave(" = -ENOENT [not found]"); 662 661 return -ENOENT; ··· 2019 2020 2020 2021 if (d_count(new_dentry) > 2) { 2021 2022 /* copy the target dentry's name */ 2022 - ret = -ENOMEM; 2023 2023 op->rename.tmp = d_alloc(new_dentry->d_parent, 2024 2024 &new_dentry->d_name); 2025 - if (!op->rename.tmp) 2025 + if (!op->rename.tmp) { 2026 + op->error = -ENOMEM; 2026 2027 goto error; 2028 + } 2027 2029 2028 2030 ret = afs_sillyrename(new_dvnode, 2029 2031 AFS_FS_I(d_inode(new_dentry)), 2030 2032 new_dentry, op->key); 2031 - if (ret) 2033 + if (ret) { 2034 + op->error = ret; 2032 2035 goto error; 2036 + } 2033 2037 2034 2038 op->dentry_2 = op->rename.tmp; 2035 2039 op->rename.rehash = NULL;
+12 -6
fs/afs/write.c
··· 771 771 if (wbc->range_cyclic) { 772 772 start = mapping->writeback_index * PAGE_SIZE; 773 773 ret = afs_writepages_region(mapping, wbc, start, LLONG_MAX, &next); 774 - if (start > 0 && wbc->nr_to_write > 0 && ret == 0) 775 - ret = afs_writepages_region(mapping, wbc, 0, start, 776 - &next); 777 - mapping->writeback_index = next / PAGE_SIZE; 774 + if (ret == 0) { 775 + mapping->writeback_index = next / PAGE_SIZE; 776 + if (start > 0 && wbc->nr_to_write > 0) { 777 + ret = afs_writepages_region(mapping, wbc, 0, 778 + start, &next); 779 + if (ret == 0) 780 + mapping->writeback_index = 781 + next / PAGE_SIZE; 782 + } 783 + } 778 784 } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) { 779 785 ret = afs_writepages_region(mapping, wbc, 0, LLONG_MAX, &next); 780 - if (wbc->nr_to_write > 0) 781 - mapping->writeback_index = next; 786 + if (wbc->nr_to_write > 0 && ret == 0) 787 + mapping->writeback_index = next / PAGE_SIZE; 782 788 } else { 783 789 ret = afs_writepages_region(mapping, wbc, 784 790 wbc->range_start, wbc->range_end, &next);
+3 -3
fs/btrfs/backref.c
··· 1488 1488 int btrfs_find_all_roots(struct btrfs_trans_handle *trans, 1489 1489 struct btrfs_fs_info *fs_info, u64 bytenr, 1490 1490 u64 time_seq, struct ulist **roots, 1491 - bool ignore_offset) 1491 + bool ignore_offset, bool skip_commit_root_sem) 1492 1492 { 1493 1493 int ret; 1494 1494 1495 - if (!trans) 1495 + if (!trans && !skip_commit_root_sem) 1496 1496 down_read(&fs_info->commit_root_sem); 1497 1497 ret = btrfs_find_all_roots_safe(trans, fs_info, bytenr, 1498 1498 time_seq, roots, ignore_offset); 1499 - if (!trans) 1499 + if (!trans && !skip_commit_root_sem) 1500 1500 up_read(&fs_info->commit_root_sem); 1501 1501 return ret; 1502 1502 }
+2 -1
fs/btrfs/backref.h
··· 47 47 const u64 *extent_item_pos, bool ignore_offset); 48 48 int btrfs_find_all_roots(struct btrfs_trans_handle *trans, 49 49 struct btrfs_fs_info *fs_info, u64 bytenr, 50 - u64 time_seq, struct ulist **roots, bool ignore_offset); 50 + u64 time_seq, struct ulist **roots, bool ignore_offset, 51 + bool skip_commit_root_sem); 51 52 char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, 52 53 u32 name_len, unsigned long name_off, 53 54 struct extent_buffer *eb_in, u64 parent,
+2 -2
fs/btrfs/delayed-ref.c
··· 974 974 kmem_cache_free(btrfs_delayed_tree_ref_cachep, ref); 975 975 976 976 if (qrecord_inserted) 977 - btrfs_qgroup_trace_extent_post(fs_info, record); 977 + btrfs_qgroup_trace_extent_post(trans, record); 978 978 979 979 return 0; 980 980 } ··· 1069 1069 1070 1070 1071 1071 if (qrecord_inserted) 1072 - return btrfs_qgroup_trace_extent_post(fs_info, record); 1072 + return btrfs_qgroup_trace_extent_post(trans, record); 1073 1073 return 0; 1074 1074 } 1075 1075
+3
fs/btrfs/extent-tree.c
··· 6019 6019 mutex_lock(&fs_info->fs_devices->device_list_mutex); 6020 6020 devices = &fs_info->fs_devices->devices; 6021 6021 list_for_each_entry(device, devices, dev_list) { 6022 + if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) 6023 + continue; 6024 + 6022 6025 ret = btrfs_trim_free_extents(device, &group_trimmed); 6023 6026 if (ret) { 6024 6027 dev_failed++;
+1 -1
fs/btrfs/inode.c
··· 2992 2992 goto out; 2993 2993 } 2994 2994 2995 - if (ordered_extent->disk) 2995 + if (ordered_extent->bdev) 2996 2996 btrfs_rewrite_logical_zoned(ordered_extent); 2997 2997 2998 2998 btrfs_free_io_failure_record(inode, start, end);
-2
fs/btrfs/ordered-data.c
··· 190 190 entry->truncated_len = (u64)-1; 191 191 entry->qgroup_rsv = ret; 192 192 entry->physical = (u64)-1; 193 - entry->disk = NULL; 194 - entry->partno = (u8)-1; 195 193 196 194 ASSERT(type == BTRFS_ORDERED_REGULAR || 197 195 type == BTRFS_ORDERED_NOCOW ||
+1 -2
fs/btrfs/ordered-data.h
··· 145 145 * command in a workqueue context 146 146 */ 147 147 u64 physical; 148 - struct gendisk *disk; 149 - u8 partno; 148 + struct block_device *bdev; 150 149 }; 151 150 152 151 /*
+30 -8
fs/btrfs/qgroup.c
··· 1704 1704 return 0; 1705 1705 } 1706 1706 1707 - int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info, 1707 + int btrfs_qgroup_trace_extent_post(struct btrfs_trans_handle *trans, 1708 1708 struct btrfs_qgroup_extent_record *qrecord) 1709 1709 { 1710 1710 struct ulist *old_root; 1711 1711 u64 bytenr = qrecord->bytenr; 1712 1712 int ret; 1713 1713 1714 - ret = btrfs_find_all_roots(NULL, fs_info, bytenr, 0, &old_root, false); 1714 + /* 1715 + * We are always called in a context where we are already holding a 1716 + * transaction handle. Often we are called when adding a data delayed 1717 + * reference from btrfs_truncate_inode_items() (truncating or unlinking), 1718 + * in which case we will be holding a write lock on extent buffer from a 1719 + * subvolume tree. In this case we can't allow btrfs_find_all_roots() to 1720 + * acquire fs_info->commit_root_sem, because that is a higher level lock 1721 + * that must be acquired before locking any extent buffers. 1722 + * 1723 + * So we want btrfs_find_all_roots() to not acquire the commit_root_sem 1724 + * but we can't pass it a non-NULL transaction handle, because otherwise 1725 + * it would not use commit roots and would lock extent buffers, causing 1726 + * a deadlock if it ends up trying to read lock the same extent buffer 1727 + * that was previously write locked at btrfs_truncate_inode_items(). 1728 + * 1729 + * So pass a NULL transaction handle to btrfs_find_all_roots() and 1730 + * explicitly tell it to not acquire the commit_root_sem - if we are 1731 + * holding a transaction handle we don't need its protection. 1732 + */ 1733 + ASSERT(trans != NULL); 1734 + 1735 + ret = btrfs_find_all_roots(NULL, trans->fs_info, bytenr, 0, &old_root, 1736 + false, true); 1715 1737 if (ret < 0) { 1716 - fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1717 - btrfs_warn(fs_info, 1738 + trans->fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1739 + btrfs_warn(trans->fs_info, 1718 1740 "error accounting new delayed refs extent (err code: %d), quota inconsistent", 1719 1741 ret); 1720 1742 return 0; ··· 1780 1758 kfree(record); 1781 1759 return 0; 1782 1760 } 1783 - return btrfs_qgroup_trace_extent_post(fs_info, record); 1761 + return btrfs_qgroup_trace_extent_post(trans, record); 1784 1762 } 1785 1763 1786 1764 int btrfs_qgroup_trace_leaf_items(struct btrfs_trans_handle *trans, ··· 2651 2629 /* Search commit root to find old_roots */ 2652 2630 ret = btrfs_find_all_roots(NULL, fs_info, 2653 2631 record->bytenr, 0, 2654 - &record->old_roots, false); 2632 + &record->old_roots, false, false); 2655 2633 if (ret < 0) 2656 2634 goto cleanup; 2657 2635 } ··· 2667 2645 * current root. It's safe inside commit_transaction(). 2668 2646 */ 2669 2647 ret = btrfs_find_all_roots(trans, fs_info, 2670 - record->bytenr, BTRFS_SEQ_LAST, &new_roots, false); 2648 + record->bytenr, BTRFS_SEQ_LAST, &new_roots, false, false); 2671 2649 if (ret < 0) 2672 2650 goto cleanup; 2673 2651 if (qgroup_to_skip) { ··· 3201 3179 num_bytes = found.offset; 3202 3180 3203 3181 ret = btrfs_find_all_roots(NULL, fs_info, found.objectid, 0, 3204 - &roots, false); 3182 + &roots, false, false); 3205 3183 if (ret < 0) 3206 3184 goto out; 3207 3185 /* For rescan, just pass old_roots as NULL */
+1 -1
fs/btrfs/qgroup.h
··· 298 298 * using current root, then we can move all expensive backref walk out of 299 299 * transaction committing, but not now as qgroup accounting will be wrong again. 300 300 */ 301 - int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info, 301 + int btrfs_qgroup_trace_extent_post(struct btrfs_trans_handle *trans, 302 302 struct btrfs_qgroup_extent_record *qrecord); 303 303 304 304 /*
+10 -10
fs/btrfs/tests/qgroup-tests.c
··· 224 224 * quota. 225 225 */ 226 226 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 227 - false); 227 + false, false); 228 228 if (ret) { 229 229 ulist_free(old_roots); 230 230 test_err("couldn't find old roots: %d", ret); ··· 237 237 return ret; 238 238 239 239 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 240 - false); 240 + false, false); 241 241 if (ret) { 242 242 ulist_free(old_roots); 243 243 ulist_free(new_roots); ··· 261 261 new_roots = NULL; 262 262 263 263 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 264 - false); 264 + false, false); 265 265 if (ret) { 266 266 ulist_free(old_roots); 267 267 test_err("couldn't find old roots: %d", ret); ··· 273 273 return -EINVAL; 274 274 275 275 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 276 - false); 276 + false, false); 277 277 if (ret) { 278 278 ulist_free(old_roots); 279 279 ulist_free(new_roots); ··· 325 325 } 326 326 327 327 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 328 - false); 328 + false, false); 329 329 if (ret) { 330 330 ulist_free(old_roots); 331 331 test_err("couldn't find old roots: %d", ret); ··· 338 338 return ret; 339 339 340 340 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 341 - false); 341 + false, false); 342 342 if (ret) { 343 343 ulist_free(old_roots); 344 344 ulist_free(new_roots); ··· 360 360 } 361 361 362 362 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 363 - false); 363 + false, false); 364 364 if (ret) { 365 365 ulist_free(old_roots); 366 366 test_err("couldn't find old roots: %d", ret); ··· 373 373 return ret; 374 374 375 375 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 376 - false); 376 + false, false); 377 377 if (ret) { 378 378 ulist_free(old_roots); 379 379 ulist_free(new_roots); ··· 401 401 } 402 402 403 403 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 404 - false); 404 + false, false); 405 405 if (ret) { 406 406 ulist_free(old_roots); 407 407 test_err("couldn't find old roots: %d", ret); ··· 414 414 return ret; 415 415 416 416 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 417 - false); 417 + false, false); 418 418 if (ret) { 419 419 ulist_free(old_roots); 420 420 ulist_free(new_roots);
+22 -9
fs/btrfs/tree-log.c
··· 5526 5526 spin_lock(&inode->lock); 5527 5527 inode->logged_trans = trans->transid; 5528 5528 /* 5529 - * Don't update last_log_commit if we logged that an inode exists 5530 - * after it was loaded to memory (full_sync bit set). 5531 - * This is to prevent data loss when we do a write to the inode, 5532 - * then the inode gets evicted after all delalloc was flushed, 5533 - * then we log it exists (due to a rename for example) and then 5534 - * fsync it. This last fsync would do nothing (not logging the 5535 - * extents previously written). 5529 + * Don't update last_log_commit if we logged that an inode exists. 5530 + * We do this for two reasons: 5531 + * 5532 + * 1) We might have had buffered writes to this inode that were 5533 + * flushed and had their ordered extents completed in this 5534 + * transaction, but we did not previously log the inode with 5535 + * LOG_INODE_ALL. Later the inode was evicted and after that 5536 + * it was loaded again and this LOG_INODE_EXISTS log operation 5537 + * happened. We must make sure that if an explicit fsync against 5538 + * the inode is performed later, it logs the new extents, an 5539 + * updated inode item, etc, and syncs the log. The same logic 5540 + * applies to direct IO writes instead of buffered writes. 5541 + * 5542 + * 2) When we log the inode with LOG_INODE_EXISTS, its inode item 5543 + * is logged with an i_size of 0 or whatever value was logged 5544 + * before. If later the i_size of the inode is increased by a 5545 + * truncate operation, the log is synced through an fsync of 5546 + * some other inode and then finally an explicit fsync against 5547 + * this inode is made, we must make sure this fsync logs the 5548 + * inode with the new i_size, the hole between old i_size and 5549 + * the new i_size, and syncs the log. 5536 5550 */ 5537 - if (inode_only != LOG_INODE_EXISTS || 5538 - !test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags)) 5551 + if (inode_only != LOG_INODE_EXISTS) 5539 5552 inode->last_log_commit = inode->last_sub_trans; 5540 5553 spin_unlock(&inode->lock); 5541 5554 }
+4 -8
fs/btrfs/zoned.c
··· 1349 1349 return; 1350 1350 1351 1351 ordered->physical = physical; 1352 - ordered->disk = bio->bi_bdev->bd_disk; 1353 - ordered->partno = bio->bi_bdev->bd_partno; 1352 + ordered->bdev = bio->bi_bdev; 1354 1353 1355 1354 btrfs_put_ordered_extent(ordered); 1356 1355 } ··· 1361 1362 struct extent_map_tree *em_tree; 1362 1363 struct extent_map *em; 1363 1364 struct btrfs_ordered_sum *sum; 1364 - struct block_device *bdev; 1365 1365 u64 orig_logical = ordered->disk_bytenr; 1366 1366 u64 *logical = NULL; 1367 1367 int nr, stripe_len; 1368 1368 1369 1369 /* Zoned devices should not have partitions. So, we can assume it is 0 */ 1370 - ASSERT(ordered->partno == 0); 1371 - bdev = bdgrab(ordered->disk->part0); 1372 - if (WARN_ON(!bdev)) 1370 + ASSERT(!bdev_is_partition(ordered->bdev)); 1371 + if (WARN_ON(!ordered->bdev)) 1373 1372 return; 1374 1373 1375 - if (WARN_ON(btrfs_rmap_block(fs_info, orig_logical, bdev, 1374 + if (WARN_ON(btrfs_rmap_block(fs_info, orig_logical, ordered->bdev, 1376 1375 ordered->physical, &logical, &nr, 1377 1376 &stripe_len))) 1378 1377 goto out; ··· 1399 1402 1400 1403 out: 1401 1404 kfree(logical); 1402 - bdput(bdev); 1403 1405 } 1404 1406 1405 1407 bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
+1 -1
fs/ceph/mds_client.c
··· 4456 4456 break; 4457 4457 case CEPH_MDS_SESSION_CLOSING: 4458 4458 /* Should never reach this when we're unmounting */ 4459 - WARN_ON_ONCE(true); 4459 + WARN_ON_ONCE(s->s_ttl); 4460 4460 fallthrough; 4461 4461 case CEPH_MDS_SESSION_NEW: 4462 4462 case CEPH_MDS_SESSION_RESTARTING:
+7 -3
fs/cifs/cifssmb.c
··· 873 873 InformationLevel) - 4; 874 874 offset = param_offset + params; 875 875 876 - /* Setup pointer to Request Data (inode type) */ 877 - pRqD = (struct unlink_psx_rq *)(((char *)&pSMB->hdr.Protocol) + offset); 876 + /* Setup pointer to Request Data (inode type). 877 + * Note that SMB offsets are from the beginning of SMB which is 4 bytes 878 + * in, after RFC1001 field 879 + */ 880 + pRqD = (struct unlink_psx_rq *)((char *)(pSMB) + offset + 4); 878 881 pRqD->type = cpu_to_le16(type); 879 882 pSMB->ParameterOffset = cpu_to_le16(param_offset); 880 883 pSMB->DataOffset = cpu_to_le16(offset); ··· 1084 1081 param_offset = offsetof(struct smb_com_transaction2_spi_req, 1085 1082 InformationLevel) - 4; 1086 1083 offset = param_offset + params; 1087 - pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset); 1084 + /* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */ 1085 + pdata = (OPEN_PSX_REQ *)((char *)(pSMB) + offset + 4); 1088 1086 pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); 1089 1087 pdata->Permissions = cpu_to_le64(mode); 1090 1088 pdata->PosixOpenFlags = cpu_to_le32(posix_flags);
+2 -2
fs/cifs/connect.c
··· 220 220 #ifdef CONFIG_CIFS_DFS_UPCALL 221 221 struct super_block *sb = NULL; 222 222 struct cifs_sb_info *cifs_sb = NULL; 223 - struct dfs_cache_tgt_list tgt_list = {0}; 223 + struct dfs_cache_tgt_list tgt_list = DFS_CACHE_TGT_LIST_INIT(tgt_list); 224 224 struct dfs_cache_tgt_iterator *tgt_it = NULL; 225 225 #endif 226 226 ··· 3130 3130 { 3131 3131 int rc; 3132 3132 char *npath = NULL; 3133 - struct dfs_cache_tgt_list tgt_list = {0}; 3133 + struct dfs_cache_tgt_list tgt_list = DFS_CACHE_TGT_LIST_INIT(tgt_list); 3134 3134 struct dfs_cache_tgt_iterator *tgt_it = NULL; 3135 3135 struct smb3_fs_context tmp_ctx = {NULL}; 3136 3136
+191 -38
fs/cifs/dfs_cache.c
··· 19 19 #include "cifs_debug.h" 20 20 #include "cifs_unicode.h" 21 21 #include "smb2glob.h" 22 + #include "dns_resolve.h" 22 23 23 24 #include "dfs_cache.h" 24 25 ··· 912 911 913 912 err_free_it: 914 913 list_for_each_entry_safe(it, nit, head, it_list) { 914 + list_del(&it->it_list); 915 915 kfree(it->it_name); 916 916 kfree(it); 917 917 } ··· 1295 1293 return 0; 1296 1294 } 1297 1295 1296 + static bool target_share_equal(struct TCP_Server_Info *server, const char *s1, const char *s2) 1297 + { 1298 + char unc[sizeof("\\\\") + SERVER_NAME_LENGTH] = {0}; 1299 + const char *host; 1300 + size_t hostlen; 1301 + char *ip = NULL; 1302 + struct sockaddr sa; 1303 + bool match; 1304 + int rc; 1305 + 1306 + if (strcasecmp(s1, s2)) 1307 + return false; 1308 + 1309 + /* 1310 + * Resolve share's hostname and check if server address matches. Otherwise just ignore it 1311 + * as we could not have upcall to resolve hostname or failed to convert ip address. 1312 + */ 1313 + match = true; 1314 + extract_unc_hostname(s1, &host, &hostlen); 1315 + scnprintf(unc, sizeof(unc), "\\\\%.*s", (int)hostlen, host); 1316 + 1317 + rc = dns_resolve_server_name_to_ip(unc, &ip, NULL); 1318 + if (rc < 0) { 1319 + cifs_dbg(FYI, "%s: could not resolve %.*s. assuming server address matches.\n", 1320 + __func__, (int)hostlen, host); 1321 + return true; 1322 + } 1323 + 1324 + if (!cifs_convert_address(&sa, ip, strlen(ip))) { 1325 + cifs_dbg(VFS, "%s: failed to convert address \'%s\'. skip address matching.\n", 1326 + __func__, ip); 1327 + } else { 1328 + mutex_lock(&server->srv_mutex); 1329 + match = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, &sa); 1330 + mutex_unlock(&server->srv_mutex); 1331 + } 1332 + 1333 + kfree(ip); 1334 + return match; 1335 + } 1336 + 1337 + /* 1338 + * Mark dfs tcon for reconnecting when the currently connected tcon does not match any of the new 1339 + * target shares in @refs. 1340 + */ 1341 + static void mark_for_reconnect_if_needed(struct cifs_tcon *tcon, struct dfs_cache_tgt_list *tl, 1342 + const struct dfs_info3_param *refs, int numrefs) 1343 + { 1344 + struct dfs_cache_tgt_iterator *it; 1345 + int i; 1346 + 1347 + for (it = dfs_cache_get_tgt_iterator(tl); it; it = dfs_cache_get_next_tgt(tl, it)) { 1348 + for (i = 0; i < numrefs; i++) { 1349 + if (target_share_equal(tcon->ses->server, dfs_cache_get_tgt_name(it), 1350 + refs[i].node_name)) 1351 + return; 1352 + } 1353 + } 1354 + 1355 + cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__); 1356 + for (i = 0; i < tcon->ses->chan_count; i++) { 1357 + spin_lock(&GlobalMid_Lock); 1358 + if (tcon->ses->chans[i].server->tcpStatus != CifsExiting) 1359 + tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect; 1360 + spin_unlock(&GlobalMid_Lock); 1361 + } 1362 + } 1363 + 1364 + /* Refresh dfs referral of tcon and mark it for reconnect if needed */ 1365 + static int refresh_tcon(struct cifs_ses **sessions, struct cifs_tcon *tcon, bool force_refresh) 1366 + { 1367 + const char *path = tcon->dfs_path + 1; 1368 + struct cifs_ses *ses; 1369 + struct cache_entry *ce; 1370 + struct dfs_info3_param *refs = NULL; 1371 + int numrefs = 0; 1372 + bool needs_refresh = false; 1373 + struct dfs_cache_tgt_list tl = DFS_CACHE_TGT_LIST_INIT(tl); 1374 + int rc = 0; 1375 + unsigned int xid; 1376 + 1377 + ses = find_ipc_from_server_path(sessions, path); 1378 + if (IS_ERR(ses)) { 1379 + cifs_dbg(FYI, "%s: could not find ipc session\n", __func__); 1380 + return PTR_ERR(ses); 1381 + } 1382 + 1383 + down_read(&htable_rw_lock); 1384 + ce = lookup_cache_entry(path); 1385 + needs_refresh = force_refresh || IS_ERR(ce) || cache_entry_expired(ce); 1386 + if (!IS_ERR(ce)) { 1387 + rc = get_targets(ce, &tl); 1388 + if (rc) 1389 + cifs_dbg(FYI, "%s: could not get dfs targets: %d\n", __func__, rc); 1390 + } 1391 + up_read(&htable_rw_lock); 1392 + 1393 + if (!needs_refresh) { 1394 + rc = 0; 1395 + goto out; 1396 + } 1397 + 1398 + xid = get_xid(); 1399 + rc = get_dfs_referral(xid, ses, path, &refs, &numrefs); 1400 + free_xid(xid); 1401 + 1402 + /* Create or update a cache entry with the new referral */ 1403 + if (!rc) { 1404 + dump_refs(refs, numrefs); 1405 + 1406 + down_write(&htable_rw_lock); 1407 + ce = lookup_cache_entry(path); 1408 + if (IS_ERR(ce)) 1409 + add_cache_entry_locked(refs, numrefs); 1410 + else if (force_refresh || cache_entry_expired(ce)) 1411 + update_cache_entry_locked(ce, refs, numrefs); 1412 + up_write(&htable_rw_lock); 1413 + 1414 + mark_for_reconnect_if_needed(tcon, &tl, refs, numrefs); 1415 + } 1416 + 1417 + out: 1418 + dfs_cache_free_tgts(&tl); 1419 + free_dfs_info_array(refs, numrefs); 1420 + return rc; 1421 + } 1422 + 1423 + /** 1424 + * dfs_cache_remount_fs - remount a DFS share 1425 + * 1426 + * Reconfigure dfs mount by forcing a new DFS referral and if the currently cached targets do not 1427 + * match any of the new targets, mark it for reconnect. 1428 + * 1429 + * @cifs_sb: cifs superblock. 1430 + * 1431 + * Return zero if remounted, otherwise non-zero. 1432 + */ 1433 + int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb) 1434 + { 1435 + struct cifs_tcon *tcon; 1436 + struct mount_group *mg; 1437 + struct cifs_ses *sessions[CACHE_MAX_ENTRIES + 1] = {NULL}; 1438 + int rc; 1439 + 1440 + if (!cifs_sb || !cifs_sb->master_tlink) 1441 + return -EINVAL; 1442 + 1443 + tcon = cifs_sb_master_tcon(cifs_sb); 1444 + if (!tcon->dfs_path) { 1445 + cifs_dbg(FYI, "%s: not a dfs tcon\n", __func__); 1446 + return 0; 1447 + } 1448 + 1449 + if (uuid_is_null(&cifs_sb->dfs_mount_id)) { 1450 + cifs_dbg(FYI, "%s: tcon has no dfs mount group id\n", __func__); 1451 + return -EINVAL; 1452 + } 1453 + 1454 + mutex_lock(&mount_group_list_lock); 1455 + mg = find_mount_group_locked(&cifs_sb->dfs_mount_id); 1456 + if (IS_ERR(mg)) { 1457 + mutex_unlock(&mount_group_list_lock); 1458 + cifs_dbg(FYI, "%s: tcon has ipc session to refresh referral\n", __func__); 1459 + return PTR_ERR(mg); 1460 + } 1461 + kref_get(&mg->refcount); 1462 + mutex_unlock(&mount_group_list_lock); 1463 + 1464 + spin_lock(&mg->lock); 1465 + memcpy(&sessions, mg->sessions, mg->num_sessions * sizeof(mg->sessions[0])); 1466 + spin_unlock(&mg->lock); 1467 + 1468 + /* 1469 + * After reconnecting to a different server, unique ids won't match anymore, so we disable 1470 + * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE). 1471 + */ 1472 + cifs_autodisable_serverino(cifs_sb); 1473 + /* 1474 + * Force the use of prefix path to support failover on DFS paths that resolve to targets 1475 + * that have different prefix paths. 1476 + */ 1477 + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; 1478 + rc = refresh_tcon(sessions, tcon, true); 1479 + 1480 + kref_put(&mg->refcount, mount_group_release); 1481 + return rc; 1482 + } 1483 + 1298 1484 /* 1299 1485 * Refresh all active dfs mounts regardless of whether they are in cache or not. 1300 1486 * (cache can be cleared) ··· 1493 1303 struct cifs_ses *ses; 1494 1304 struct cifs_tcon *tcon, *ntcon; 1495 1305 struct list_head tcons; 1496 - unsigned int xid; 1497 1306 1498 1307 INIT_LIST_HEAD(&tcons); 1499 1308 ··· 1510 1321 spin_unlock(&cifs_tcp_ses_lock); 1511 1322 1512 1323 list_for_each_entry_safe(tcon, ntcon, &tcons, ulist) { 1513 - const char *path = tcon->dfs_path + 1; 1514 - struct cache_entry *ce; 1515 - struct dfs_info3_param *refs = NULL; 1516 - int numrefs = 0; 1517 - bool needs_refresh = false; 1518 - int rc = 0; 1519 - 1520 1324 list_del_init(&tcon->ulist); 1521 - 1522 - ses = find_ipc_from_server_path(sessions, path); 1523 - if (IS_ERR(ses)) 1524 - goto next_tcon; 1525 - 1526 - down_read(&htable_rw_lock); 1527 - ce = lookup_cache_entry(path); 1528 - needs_refresh = IS_ERR(ce) || cache_entry_expired(ce); 1529 - up_read(&htable_rw_lock); 1530 - 1531 - if (!needs_refresh) 1532 - goto next_tcon; 1533 - 1534 - xid = get_xid(); 1535 - rc = get_dfs_referral(xid, ses, path, &refs, &numrefs); 1536 - free_xid(xid); 1537 - 1538 - /* Create or update a cache entry with the new referral */ 1539 - if (!rc) { 1540 - down_write(&htable_rw_lock); 1541 - ce = lookup_cache_entry(path); 1542 - if (IS_ERR(ce)) 1543 - add_cache_entry_locked(refs, numrefs); 1544 - else if (cache_entry_expired(ce)) 1545 - update_cache_entry_locked(ce, refs, numrefs); 1546 - up_write(&htable_rw_lock); 1547 - } 1548 - 1549 - next_tcon: 1550 - free_dfs_info_array(refs, numrefs); 1325 + refresh_tcon(sessions, tcon, false); 1551 1326 cifs_put_tcon(tcon); 1552 1327 } 1553 1328 }
+3
fs/cifs/dfs_cache.h
··· 13 13 #include <linux/uuid.h> 14 14 #include "cifsglob.h" 15 15 16 + #define DFS_CACHE_TGT_LIST_INIT(var) { .tl_numtgts = 0, .tl_list = LIST_HEAD_INIT((var).tl_list), } 17 + 16 18 struct dfs_cache_tgt_list { 17 19 int tl_numtgts; 18 20 struct list_head tl_list; ··· 46 44 void dfs_cache_put_refsrv_sessions(const uuid_t *mount_id); 47 45 void dfs_cache_add_refsrv_session(const uuid_t *mount_id, struct cifs_ses *ses); 48 46 char *dfs_cache_canonical_path(const char *path, const struct nls_table *cp, int remap); 47 + int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb); 49 48 50 49 static inline struct dfs_cache_tgt_iterator * 51 50 dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl,
+7
fs/cifs/fs_context.c
··· 13 13 #include <linux/magic.h> 14 14 #include <linux/security.h> 15 15 #include <net/net_namespace.h> 16 + #ifdef CONFIG_CIFS_DFS_UPCALL 17 + #include "dfs_cache.h" 18 + #endif 16 19 */ 17 20 18 21 #include <linux/ctype.h> ··· 782 779 smb3_cleanup_fs_context_contents(cifs_sb->ctx); 783 780 rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); 784 781 smb3_update_mnt_flags(cifs_sb); 782 + #ifdef CONFIG_CIFS_DFS_UPCALL 783 + if (!rc) 784 + rc = dfs_cache_remount_fs(cifs_sb); 785 + #endif 785 786 786 787 return rc; 787 788 }
+37 -12
fs/cifs/smb2ops.c
··· 3617 3617 char *buf) 3618 3618 { 3619 3619 struct cifs_io_parms io_parms = {0}; 3620 - int nbytes; 3620 + int rc, nbytes; 3621 3621 struct kvec iov[2]; 3622 3622 3623 3623 io_parms.netfid = cfile->fid.netfid; ··· 3625 3625 io_parms.tcon = tcon; 3626 3626 io_parms.persistent_fid = cfile->fid.persistent_fid; 3627 3627 io_parms.volatile_fid = cfile->fid.volatile_fid; 3628 - io_parms.offset = off; 3629 - io_parms.length = len; 3630 3628 3631 - /* iov[0] is reserved for smb header */ 3632 - iov[1].iov_base = buf; 3633 - iov[1].iov_len = io_parms.length; 3634 - return SMB2_write(xid, &io_parms, &nbytes, iov, 1); 3629 + while (len) { 3630 + io_parms.offset = off; 3631 + io_parms.length = len; 3632 + if (io_parms.length > SMB2_MAX_BUFFER_SIZE) 3633 + io_parms.length = SMB2_MAX_BUFFER_SIZE; 3634 + /* iov[0] is reserved for smb header */ 3635 + iov[1].iov_base = buf; 3636 + iov[1].iov_len = io_parms.length; 3637 + rc = SMB2_write(xid, &io_parms, &nbytes, iov, 1); 3638 + if (rc) 3639 + break; 3640 + if (nbytes > len) 3641 + return -EINVAL; 3642 + buf += nbytes; 3643 + off += nbytes; 3644 + len -= nbytes; 3645 + } 3646 + return rc; 3635 3647 } 3636 3648 3637 3649 static int smb3_simple_fallocate_range(unsigned int xid, ··· 3666 3654 1024 * sizeof(struct file_allocated_range_buffer), 3667 3655 (char **)&out_data, &out_data_len); 3668 3656 if (rc) 3669 - goto out; 3670 - /* 3671 - * It is already all allocated 3672 - */ 3673 - if (out_data_len == 0) 3674 3657 goto out; 3675 3658 3676 3659 buf = kzalloc(1024 * 1024, GFP_KERNEL); ··· 3787 3780 if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) { 3788 3781 rc = 0; 3789 3782 goto out; 3783 + } 3784 + 3785 + if (keep_size == true) { 3786 + /* 3787 + * We can not preallocate pages beyond the end of the file 3788 + * in SMB2 3789 + */ 3790 + if (off >= i_size_read(inode)) { 3791 + rc = 0; 3792 + goto out; 3793 + } 3794 + /* 3795 + * For fallocates that are partially beyond the end of file, 3796 + * clamp len so we only fallocate up to the end of file. 3797 + */ 3798 + if (off + len > i_size_read(inode)) { 3799 + len = i_size_read(inode) - off; 3800 + } 3790 3801 } 3791 3802 3792 3803 if ((keep_size == true) || (i_size_read(inode) >= off + len)) {
+3
fs/fs-writeback.c
··· 521 521 */ 522 522 smp_mb(); 523 523 524 + if (IS_DAX(inode)) 525 + return false; 526 + 524 527 /* while holding I_WB_SWITCH, no one else can update the association */ 525 528 spin_lock(&inode->i_lock); 526 529 if (!(inode->i_sb->s_flags & SB_ACTIVE) ||
+1 -1
fs/hugetlbfs/inode.c
··· 77 77 static const struct fs_parameter_spec hugetlb_fs_parameters[] = { 78 78 fsparam_u32 ("gid", Opt_gid), 79 79 fsparam_string("min_size", Opt_min_size), 80 - fsparam_u32 ("mode", Opt_mode), 80 + fsparam_u32oct("mode", Opt_mode), 81 81 fsparam_string("nr_inodes", Opt_nr_inodes), 82 82 fsparam_string("pagesize", Opt_pagesize), 83 83 fsparam_string("size", Opt_size),
+6 -1
fs/io-wq.c
··· 731 731 int work_flags; 732 732 unsigned long flags; 733 733 734 - if (test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state)) { 734 + /* 735 + * If io-wq is exiting for this task, or if the request has explicitly 736 + * been marked as one that should not get executed, cancel it here. 737 + */ 738 + if (test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state) || 739 + (work->flags & IO_WQ_WORK_CANCEL)) { 735 740 io_run_cancel(work, wqe); 736 741 return; 737 742 }
+39 -16
fs/io_uring.c
··· 1294 1294 1295 1295 /* init ->work of the whole link before punting */ 1296 1296 io_prep_async_link(req); 1297 + 1298 + /* 1299 + * Not expected to happen, but if we do have a bug where this _can_ 1300 + * happen, catch it here and ensure the request is marked as 1301 + * canceled. That will make io-wq go through the usual work cancel 1302 + * procedure rather than attempt to run this request (or create a new 1303 + * worker for it). 1304 + */ 1305 + if (WARN_ON_ONCE(!same_thread_group(req->task, current))) 1306 + req->work.flags |= IO_WQ_WORK_CANCEL; 1307 + 1297 1308 trace_io_uring_queue_async_work(ctx, io_wq_is_hashed(&req->work), req, 1298 1309 &req->work, req->flags); 1299 1310 io_wq_enqueue(tctx->io_wq, &req->work); ··· 2216 2205 * Find and free completed poll iocbs 2217 2206 */ 2218 2207 static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, 2219 - struct list_head *done) 2208 + struct list_head *done, bool resubmit) 2220 2209 { 2221 2210 struct req_batch rb; 2222 2211 struct io_kiocb *req; ··· 2231 2220 req = list_first_entry(done, struct io_kiocb, inflight_entry); 2232 2221 list_del(&req->inflight_entry); 2233 2222 2234 - if (READ_ONCE(req->result) == -EAGAIN && 2223 + if (READ_ONCE(req->result) == -EAGAIN && resubmit && 2235 2224 !(req->flags & REQ_F_DONT_REISSUE)) { 2236 2225 req->iopoll_completed = 0; 2237 2226 req_ref_get(req); ··· 2255 2244 } 2256 2245 2257 2246 static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, 2258 - long min) 2247 + long min, bool resubmit) 2259 2248 { 2260 2249 struct io_kiocb *req, *tmp; 2261 2250 LIST_HEAD(done); ··· 2298 2287 } 2299 2288 2300 2289 if (!list_empty(&done)) 2301 - io_iopoll_complete(ctx, nr_events, &done); 2290 + io_iopoll_complete(ctx, nr_events, &done, resubmit); 2302 2291 2303 2292 return ret; 2304 2293 } ··· 2316 2305 while (!list_empty(&ctx->iopoll_list)) { 2317 2306 unsigned int nr_events = 0; 2318 2307 2319 - io_do_iopoll(ctx, &nr_events, 0); 2308 + io_do_iopoll(ctx, &nr_events, 0, false); 2320 2309 2321 2310 /* let it sleep and repeat later if can't complete a request */ 2322 2311 if (nr_events == 0) ··· 2378 2367 list_empty(&ctx->iopoll_list)) 2379 2368 break; 2380 2369 } 2381 - ret = io_do_iopoll(ctx, &nr_events, min); 2370 + ret = io_do_iopoll(ctx, &nr_events, min, true); 2382 2371 } while (!ret && nr_events < min && !need_resched()); 2383 2372 out: 2384 2373 mutex_unlock(&ctx->uring_lock); ··· 4813 4802 struct io_poll_table { 4814 4803 struct poll_table_struct pt; 4815 4804 struct io_kiocb *req; 4805 + int nr_entries; 4816 4806 int error; 4817 4807 }; 4818 4808 ··· 5007 4995 struct io_kiocb *req = pt->req; 5008 4996 5009 4997 /* 5010 - * If poll->head is already set, it's because the file being polled 5011 - * uses multiple waitqueues for poll handling (eg one for read, one 5012 - * for write). Setup a separate io_poll_iocb if this happens. 4998 + * The file being polled uses multiple waitqueues for poll handling 4999 + * (e.g. one for read, one for write). Setup a separate io_poll_iocb 5000 + * if this happens. 5013 5001 */ 5014 - if (unlikely(poll->head)) { 5002 + if (unlikely(pt->nr_entries)) { 5015 5003 struct io_poll_iocb *poll_one = poll; 5016 5004 5017 5005 /* already have a 2nd entry, fail a third attempt */ ··· 5039 5027 *poll_ptr = poll; 5040 5028 } 5041 5029 5042 - pt->error = 0; 5030 + pt->nr_entries++; 5043 5031 poll->head = head; 5044 5032 5045 5033 if (poll->events & EPOLLEXCLUSIVE) ··· 5116 5104 5117 5105 ipt->pt._key = mask; 5118 5106 ipt->req = req; 5119 - ipt->error = -EINVAL; 5107 + ipt->error = 0; 5108 + ipt->nr_entries = 0; 5120 5109 5121 5110 mask = vfs_poll(req->file, &ipt->pt) & poll->events; 5111 + if (unlikely(!ipt->nr_entries) && !ipt->error) 5112 + ipt->error = -EINVAL; 5122 5113 5123 5114 spin_lock_irq(&ctx->completion_lock); 5115 + if (ipt->error) 5116 + io_poll_remove_double(req); 5124 5117 if (likely(poll->head)) { 5125 5118 spin_lock(&poll->head->lock); 5126 5119 if (unlikely(list_empty(&poll->wait.entry))) { ··· 6809 6792 6810 6793 mutex_lock(&ctx->uring_lock); 6811 6794 if (!list_empty(&ctx->iopoll_list)) 6812 - io_do_iopoll(ctx, &nr_events, 0); 6795 + io_do_iopoll(ctx, &nr_events, 0, true); 6813 6796 6814 6797 /* 6815 6798 * Don't submit if refs are dying, good for io_uring_register(), ··· 7916 7899 struct io_wq_data data; 7917 7900 unsigned int concurrency; 7918 7901 7902 + mutex_lock(&ctx->uring_lock); 7919 7903 hash = ctx->hash_map; 7920 7904 if (!hash) { 7921 7905 hash = kzalloc(sizeof(*hash), GFP_KERNEL); 7922 - if (!hash) 7906 + if (!hash) { 7907 + mutex_unlock(&ctx->uring_lock); 7923 7908 return ERR_PTR(-ENOMEM); 7909 + } 7924 7910 refcount_set(&hash->refs, 1); 7925 7911 init_waitqueue_head(&hash->wait); 7926 7912 ctx->hash_map = hash; 7927 7913 } 7914 + mutex_unlock(&ctx->uring_lock); 7928 7915 7929 7916 data.hash = hash; 7930 7917 data.task = task; ··· 8002 7981 f = fdget(p->wq_fd); 8003 7982 if (!f.file) 8004 7983 return -ENXIO; 8005 - fdput(f); 8006 - if (f.file->f_op != &io_uring_fops) 7984 + if (f.file->f_op != &io_uring_fops) { 7985 + fdput(f); 8007 7986 return -EINVAL; 7987 + } 7988 + fdput(f); 8008 7989 } 8009 7990 if (ctx->flags & IORING_SETUP_SQPOLL) { 8010 7991 struct task_struct *tsk;
+3
fs/seq_file.c
··· 32 32 33 33 static void *seq_buf_alloc(unsigned long size) 34 34 { 35 + if (unlikely(size > MAX_RW_COUNT)) 36 + return NULL; 37 + 35 38 return kvmalloc(size, GFP_KERNEL_ACCOUNT); 36 39 } 37 40
+12 -14
fs/userfaultfd.c
··· 1236 1236 } 1237 1237 1238 1238 static __always_inline int validate_range(struct mm_struct *mm, 1239 - __u64 *start, __u64 len) 1239 + __u64 start, __u64 len) 1240 1240 { 1241 1241 __u64 task_size = mm->task_size; 1242 1242 1243 - *start = untagged_addr(*start); 1244 - 1245 - if (*start & ~PAGE_MASK) 1243 + if (start & ~PAGE_MASK) 1246 1244 return -EINVAL; 1247 1245 if (len & ~PAGE_MASK) 1248 1246 return -EINVAL; 1249 1247 if (!len) 1250 1248 return -EINVAL; 1251 - if (*start < mmap_min_addr) 1249 + if (start < mmap_min_addr) 1252 1250 return -EINVAL; 1253 - if (*start >= task_size) 1251 + if (start >= task_size) 1254 1252 return -EINVAL; 1255 - if (len > task_size - *start) 1253 + if (len > task_size - start) 1256 1254 return -EINVAL; 1257 1255 return 0; 1258 1256 } ··· 1314 1316 vm_flags |= VM_UFFD_MINOR; 1315 1317 } 1316 1318 1317 - ret = validate_range(mm, &uffdio_register.range.start, 1319 + ret = validate_range(mm, uffdio_register.range.start, 1318 1320 uffdio_register.range.len); 1319 1321 if (ret) 1320 1322 goto out; ··· 1520 1522 if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) 1521 1523 goto out; 1522 1524 1523 - ret = validate_range(mm, &uffdio_unregister.start, 1525 + ret = validate_range(mm, uffdio_unregister.start, 1524 1526 uffdio_unregister.len); 1525 1527 if (ret) 1526 1528 goto out; ··· 1669 1671 if (copy_from_user(&uffdio_wake, buf, sizeof(uffdio_wake))) 1670 1672 goto out; 1671 1673 1672 - ret = validate_range(ctx->mm, &uffdio_wake.start, uffdio_wake.len); 1674 + ret = validate_range(ctx->mm, uffdio_wake.start, uffdio_wake.len); 1673 1675 if (ret) 1674 1676 goto out; 1675 1677 ··· 1709 1711 sizeof(uffdio_copy)-sizeof(__s64))) 1710 1712 goto out; 1711 1713 1712 - ret = validate_range(ctx->mm, &uffdio_copy.dst, uffdio_copy.len); 1714 + ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len); 1713 1715 if (ret) 1714 1716 goto out; 1715 1717 /* ··· 1766 1768 sizeof(uffdio_zeropage)-sizeof(__s64))) 1767 1769 goto out; 1768 1770 1769 - ret = validate_range(ctx->mm, &uffdio_zeropage.range.start, 1771 + ret = validate_range(ctx->mm, uffdio_zeropage.range.start, 1770 1772 uffdio_zeropage.range.len); 1771 1773 if (ret) 1772 1774 goto out; ··· 1816 1818 sizeof(struct uffdio_writeprotect))) 1817 1819 return -EFAULT; 1818 1820 1819 - ret = validate_range(ctx->mm, &uffdio_wp.range.start, 1821 + ret = validate_range(ctx->mm, uffdio_wp.range.start, 1820 1822 uffdio_wp.range.len); 1821 1823 if (ret) 1822 1824 return ret; ··· 1864 1866 sizeof(uffdio_continue) - (sizeof(__s64)))) 1865 1867 goto out; 1866 1868 1867 - ret = validate_range(ctx->mm, &uffdio_continue.range.start, 1869 + ret = validate_range(ctx->mm, uffdio_continue.range.start, 1868 1870 uffdio_continue.range.len); 1869 1871 if (ret) 1870 1872 goto out;
+2 -6
include/acpi/acpi_bus.h
··· 707 707 * @hrv: Hardware Revision of the device, pass -1 to not check _HRV 708 708 * 709 709 * The caller is responsible for invoking acpi_dev_put() on the returned device. 710 - * 711 - * FIXME: Due to above requirement there is a window that may invalidate @adev 712 - * and next iteration will use a dangling pointer, e.g. in the case of a 713 - * hotplug event. That said, the caller should ensure that this will never 714 - * happen. 715 710 */ 716 711 #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ 717 712 for (adev = acpi_dev_get_first_match_dev(hid, uid, hrv); \ ··· 720 725 721 726 static inline void acpi_dev_put(struct acpi_device *adev) 722 727 { 723 - put_device(&adev->dev); 728 + if (adev) 729 + put_device(&adev->dev); 724 730 } 725 731 726 732 struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle);
+1
include/drm/drm_ioctl.h
··· 68 68 unsigned long arg); 69 69 70 70 #define DRM_IOCTL_NR(n) _IOC_NR(n) 71 + #define DRM_IOCTL_TYPE(n) _IOC_TYPE(n) 71 72 #define DRM_MAJOR 226 72 73 73 74 /**
+1 -1
include/linux/blkdev.h
··· 57 57 * Maximum number of blkcg policies allowed to be registered concurrently. 58 58 * Defined here to simplify include dependency. 59 59 */ 60 - #define BLKCG_MAX_POLS 5 60 + #define BLKCG_MAX_POLS 6 61 61 62 62 typedef void (rq_end_io_fn)(struct request *, blk_status_t); 63 63
+4 -2
include/linux/highmem.h
··· 318 318 319 319 VM_BUG_ON(offset + len > PAGE_SIZE); 320 320 memcpy(to + offset, from, len); 321 + flush_dcache_page(page); 321 322 kunmap_local(to); 322 323 } 323 324 324 325 static inline void memzero_page(struct page *page, size_t offset, size_t len) 325 326 { 326 - char *addr = kmap_atomic(page); 327 + char *addr = kmap_local_page(page); 327 328 memset(addr + offset, 0, len); 328 - kunmap_atomic(addr); 329 + flush_dcache_page(page); 330 + kunmap_local(addr); 329 331 } 330 332 331 333 #endif /* _LINUX_HIGHMEM_H */
+2 -2
include/linux/memblock.h
··· 209 209 */ 210 210 #define for_each_mem_range(i, p_start, p_end) \ 211 211 __for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 212 - MEMBLOCK_NONE, p_start, p_end, NULL) 212 + MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 213 213 214 214 /** 215 215 * for_each_mem_range_rev - reverse iterate through memblock areas from ··· 220 220 */ 221 221 #define for_each_mem_range_rev(i, p_start, p_end) \ 222 222 __for_each_mem_range_rev(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 223 - MEMBLOCK_NONE, p_start, p_end, NULL) 223 + MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 224 224 225 225 /** 226 226 * for_each_reserved_mem_range - iterate over all reserved memblock areas
+2 -2
include/linux/mfd/rt5033-private.h
··· 200 200 #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U 201 201 #define RT5033_REGULATOR_BUCK_VOLTAGE_MAX 3000000U 202 202 #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP 100000U 203 - #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 32 203 + #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 21 204 204 205 205 /* RT5033 regulator LDO output voltage uV */ 206 206 #define RT5033_REGULATOR_LDO_VOLTAGE_MIN 1200000U 207 207 #define RT5033_REGULATOR_LDO_VOLTAGE_MAX 3000000U 208 208 #define RT5033_REGULATOR_LDO_VOLTAGE_STEP 100000U 209 - #define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 32 209 + #define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 19 210 210 211 211 /* RT5033 regulator SAFE LDO output voltage uV */ 212 212 #define RT5033_REGULATOR_SAFE_LDO_VOLTAGE 4900000U
+1 -25
include/linux/pgtable.h
··· 1397 1397 } 1398 1398 #endif /* !__PAGETABLE_P4D_FOLDED */ 1399 1399 1400 - #ifndef __PAGETABLE_PUD_FOLDED 1401 1400 int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot); 1402 - int pud_clear_huge(pud_t *pud); 1403 - #else 1404 - static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) 1405 - { 1406 - return 0; 1407 - } 1408 - static inline int pud_clear_huge(pud_t *pud) 1409 - { 1410 - return 0; 1411 - } 1412 - #endif /* !__PAGETABLE_PUD_FOLDED */ 1413 - 1414 - #ifndef __PAGETABLE_PMD_FOLDED 1415 1401 int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot); 1402 + int pud_clear_huge(pud_t *pud); 1416 1403 int pmd_clear_huge(pmd_t *pmd); 1417 - #else 1418 - static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) 1419 - { 1420 - return 0; 1421 - } 1422 - static inline int pmd_clear_huge(pmd_t *pmd) 1423 - { 1424 - return 0; 1425 - } 1426 - #endif /* !__PAGETABLE_PMD_FOLDED */ 1427 - 1428 1404 int p4d_free_pud_page(p4d_t *p4d, unsigned long addr); 1429 1405 int pud_free_pmd_page(pud_t *pud, unsigned long addr); 1430 1406 int pmd_free_pte_page(pmd_t *pmd, unsigned long addr);
-1
include/net/tcp.h
··· 1709 1709 struct rcu_head rcu; 1710 1710 }; 1711 1711 1712 - extern unsigned int sysctl_tcp_fastopen_blackhole_timeout; 1713 1712 void tcp_fastopen_active_disable(struct sock *sk); 1714 1713 bool tcp_fastopen_active_should_disable(struct sock *sk); 1715 1714 void tcp_fastopen_active_disable_ofo_check(struct sock *sk);
+6
include/sound/soc.h
··· 712 712 /* Do not create a PCM for this DAI link (Backend link) */ 713 713 unsigned int ignore:1; 714 714 715 + /* This flag will reorder stop sequence. By enabling this flag 716 + * DMA controller stop sequence will be invoked first followed by 717 + * CPU DAI driver stop sequence 718 + */ 719 + unsigned int stop_dma_first:1; 720 + 715 721 #ifdef CONFIG_SND_SOC_TOPOLOGY 716 722 struct snd_soc_dobj dobj; /* For topology */ 717 723 #endif
+62 -5
include/trace/events/afs.h
··· 174 174 afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */ 175 175 }; 176 176 177 + enum afs_cm_operation { 178 + afs_CB_CallBack = 204, /* AFS break callback promises */ 179 + afs_CB_InitCallBackState = 205, /* AFS initialise callback state */ 180 + afs_CB_Probe = 206, /* AFS probe client */ 181 + afs_CB_GetLock = 207, /* AFS get contents of CM lock table */ 182 + afs_CB_GetCE = 208, /* AFS get cache file description */ 183 + afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */ 184 + afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */ 185 + afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */ 186 + afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */ 187 + }; 188 + 189 + enum yfs_cm_operation { 190 + yfs_CB_Probe = 206, /* YFS probe client */ 191 + yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */ 192 + yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */ 193 + yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */ 194 + yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */ 195 + yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */ 196 + yfs_CB_GetServerPrefs = 215, 197 + yfs_CB_GetCellServDV = 216, 198 + yfs_CB_GetLocalCell = 217, 199 + yfs_CB_GetCacheConfig = 218, 200 + yfs_CB_GetCellByNum = 65537, 201 + yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */ 202 + yfs_CB_CallBack = 64204, 203 + }; 204 + 177 205 enum afs_edit_dir_op { 178 206 afs_edit_dir_create, 179 207 afs_edit_dir_create_error, ··· 464 436 EM(afs_YFSVL_GetCellName, "YFSVL.GetCellName") \ 465 437 E_(afs_VL_GetCapabilities, "VL.GetCapabilities") 466 438 439 + #define afs_cm_operations \ 440 + EM(afs_CB_CallBack, "CB.CallBack") \ 441 + EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \ 442 + EM(afs_CB_Probe, "CB.Probe") \ 443 + EM(afs_CB_GetLock, "CB.GetLock") \ 444 + EM(afs_CB_GetCE, "CB.GetCE") \ 445 + EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \ 446 + EM(afs_CB_GetXStats, "CB.GetXStats") \ 447 + EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \ 448 + E_(afs_CB_ProbeUuid, "CB.ProbeUuid") 449 + 450 + #define yfs_cm_operations \ 451 + EM(yfs_CB_Probe, "YFSCB.Probe") \ 452 + EM(yfs_CB_GetLock, "YFSCB.GetLock") \ 453 + EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \ 454 + EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \ 455 + EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \ 456 + EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \ 457 + EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \ 458 + EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \ 459 + EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \ 460 + EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \ 461 + EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \ 462 + EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \ 463 + E_(yfs_CB_CallBack, "YFSCB.CallBack") 464 + 467 465 #define afs_edit_dir_ops \ 468 466 EM(afs_edit_dir_create, "create") \ 469 467 EM(afs_edit_dir_create_error, "c_fail") \ ··· 623 569 afs_cell_traces; 624 570 afs_fs_operations; 625 571 afs_vl_operations; 572 + afs_cm_operations; 573 + yfs_cm_operations; 626 574 afs_edit_dir_ops; 627 575 afs_edit_dir_reasons; 628 576 afs_eproto_causes; ··· 705 649 706 650 TP_STRUCT__entry( 707 651 __field(unsigned int, call ) 708 - __field(const char *, name ) 709 652 __field(u32, op ) 653 + __field(u16, service_id ) 710 654 ), 711 655 712 656 TP_fast_assign( 713 657 __entry->call = call->debug_id; 714 - __entry->name = call->type->name; 715 658 __entry->op = call->operation_ID; 659 + __entry->service_id = call->service_id; 716 660 ), 717 661 718 - TP_printk("c=%08x %s o=%u", 662 + TP_printk("c=%08x %s", 719 663 __entry->call, 720 - __entry->name, 721 - __entry->op) 664 + __entry->service_id == 2501 ? 665 + __print_symbolic(__entry->op, yfs_cm_operations) : 666 + __print_symbolic(__entry->op, afs_cm_operations)) 722 667 ); 723 668 724 669 TRACE_EVENT(afs_call,
+1 -1
include/trace/events/net.h
··· 136 136 __assign_str(name, skb->dev->name); 137 137 ), 138 138 139 - TP_printk("dev=%s skbaddr=%p len=%u", 139 + TP_printk("dev=%s skbaddr=%px len=%u", 140 140 __get_str(name), __entry->skbaddr, __entry->len) 141 141 ) 142 142
+27 -1
include/trace/events/qdisc.h
··· 41 41 __entry->txq_state = txq->state; 42 42 ), 43 43 44 - TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p", 44 + TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%px", 45 45 __entry->ifindex, __entry->handle, __entry->parent, 46 46 __entry->txq_state, __entry->packets, __entry->skbaddr ) 47 + ); 48 + 49 + TRACE_EVENT(qdisc_enqueue, 50 + 51 + TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, struct sk_buff *skb), 52 + 53 + TP_ARGS(qdisc, txq, skb), 54 + 55 + TP_STRUCT__entry( 56 + __field(struct Qdisc *, qdisc) 57 + __field(void *, skbaddr) 58 + __field(int, ifindex) 59 + __field(u32, handle) 60 + __field(u32, parent) 61 + ), 62 + 63 + TP_fast_assign( 64 + __entry->qdisc = qdisc; 65 + __entry->skbaddr = skb; 66 + __entry->ifindex = txq->dev ? txq->dev->ifindex : 0; 67 + __entry->handle = qdisc->handle; 68 + __entry->parent = qdisc->parent; 69 + ), 70 + 71 + TP_printk("enqueue ifindex=%d qdisc handle=0x%X parent=0x%X skbaddr=%px", 72 + __entry->ifindex, __entry->handle, __entry->parent, __entry->skbaddr) 47 73 ); 48 74 49 75 TRACE_EVENT(qdisc_reset,
+2
kernel/bpf/verifier.c
··· 3677 3677 if (tail_call_reachable) 3678 3678 for (j = 0; j < frame; j++) 3679 3679 subprog[ret_prog[j]].tail_call_reachable = true; 3680 + if (subprog[0].tail_call_reachable) 3681 + env->prog->aux->tail_call_reachable = true; 3680 3682 3681 3683 /* end of for() loop means the last insn of the 'subprog' 3682 3684 * was reached. Doesn't matter whether it was JA or EXIT
+10 -2
kernel/dma/ops_helpers.c
··· 5 5 */ 6 6 #include <linux/dma-map-ops.h> 7 7 8 + static struct page *dma_common_vaddr_to_page(void *cpu_addr) 9 + { 10 + if (is_vmalloc_addr(cpu_addr)) 11 + return vmalloc_to_page(cpu_addr); 12 + return virt_to_page(cpu_addr); 13 + } 14 + 8 15 /* 9 16 * Create scatter-list for the already allocated DMA buffer. 10 17 */ ··· 19 12 void *cpu_addr, dma_addr_t dma_addr, size_t size, 20 13 unsigned long attrs) 21 14 { 22 - struct page *page = virt_to_page(cpu_addr); 15 + struct page *page = dma_common_vaddr_to_page(cpu_addr); 23 16 int ret; 24 17 25 18 ret = sg_alloc_table(sgt, 1, GFP_KERNEL); ··· 39 32 unsigned long user_count = vma_pages(vma); 40 33 unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; 41 34 unsigned long off = vma->vm_pgoff; 35 + struct page *page = dma_common_vaddr_to_page(cpu_addr); 42 36 int ret = -ENXIO; 43 37 44 38 vma->vm_page_prot = dma_pgprot(dev, vma->vm_page_prot, attrs); ··· 51 43 return -ENXIO; 52 44 53 45 return remap_pfn_range(vma, vma->vm_start, 54 - page_to_pfn(virt_to_page(cpu_addr)) + vma->vm_pgoff, 46 + page_to_pfn(page) + vma->vm_pgoff, 55 47 user_count << PAGE_SHIFT, vma->vm_page_prot); 56 48 #else 57 49 return -ENXIO;
+1 -1
kernel/smpboot.c
··· 47 47 * 48 48 * Creates the thread if it does not exist. 49 49 */ 50 - static inline void idle_init(unsigned int cpu) 50 + static __always_inline void idle_init(unsigned int cpu) 51 51 { 52 52 struct task_struct *tsk = per_cpu(idle_threads, cpu); 53 53
+5 -5
kernel/time/posix-cpu-timers.c
··· 991 991 if (!p) 992 992 goto out; 993 993 994 + /* Protect timer list r/w in arm_timer() */ 995 + sighand = lock_task_sighand(p, &flags); 996 + if (unlikely(sighand == NULL)) 997 + goto out; 998 + 994 999 /* 995 1000 * Fetch the current sample and update the timer's expiry time. 996 1001 */ ··· 1005 1000 now = cpu_clock_sample_group(clkid, p, true); 1006 1001 1007 1002 bump_cpu_timer(timer, now); 1008 - 1009 - /* Protect timer list r/w in arm_timer() */ 1010 - sighand = lock_task_sighand(p, &flags); 1011 - if (unlikely(sighand == NULL)) 1012 - goto out; 1013 1003 1014 1004 /* 1015 1005 * Now re-arm for the new expiry time.
+5 -3
kernel/time/timer.c
··· 207 207 unsigned int cpu; 208 208 bool next_expiry_recalc; 209 209 bool is_idle; 210 + bool timers_pending; 210 211 DECLARE_BITMAP(pending_map, WHEEL_SIZE); 211 212 struct hlist_head vectors[WHEEL_SIZE]; 212 213 } ____cacheline_aligned; ··· 596 595 * can reevaluate the wheel: 597 596 */ 598 597 base->next_expiry = bucket_expiry; 598 + base->timers_pending = true; 599 599 base->next_expiry_recalc = false; 600 600 trigger_dyntick_cpu(base, timer); 601 601 } ··· 1584 1582 } 1585 1583 1586 1584 base->next_expiry_recalc = false; 1585 + base->timers_pending = !(next == base->clk + NEXT_TIMER_MAX_DELTA); 1587 1586 1588 1587 return next; 1589 1588 } ··· 1636 1633 struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); 1637 1634 u64 expires = KTIME_MAX; 1638 1635 unsigned long nextevt; 1639 - bool is_max_delta; 1640 1636 1641 1637 /* 1642 1638 * Pretend that there is no timer pending if the cpu is offline. ··· 1648 1646 if (base->next_expiry_recalc) 1649 1647 base->next_expiry = __next_timer_interrupt(base); 1650 1648 nextevt = base->next_expiry; 1651 - is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA); 1652 1649 1653 1650 /* 1654 1651 * We have a fresh next event. Check whether we can forward the ··· 1665 1664 expires = basem; 1666 1665 base->is_idle = false; 1667 1666 } else { 1668 - if (!is_max_delta) 1667 + if (base->timers_pending) 1669 1668 expires = basem + (u64)(nextevt - basej) * TICK_NSEC; 1670 1669 /* 1671 1670 * If we expect to sleep more than a tick, mark the base idle. ··· 1948 1947 base = per_cpu_ptr(&timer_bases[b], cpu); 1949 1948 base->clk = jiffies; 1950 1949 base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA; 1950 + base->timers_pending = false; 1951 1951 base->is_idle = false; 1952 1952 } 1953 1953 return 0;
+3 -2
kernel/trace/ftrace.c
··· 5985 5985 * infrastructure to do the synchronization, thus we must do it 5986 5986 * ourselves. 5987 5987 */ 5988 - synchronize_rcu_tasks_rude(); 5988 + if (old_hash != EMPTY_HASH) 5989 + synchronize_rcu_tasks_rude(); 5989 5990 5990 5991 free_ftrace_hash(old_hash); 5991 5992 } ··· 7545 7544 */ 7546 7545 int register_ftrace_function(struct ftrace_ops *ops) 7547 7546 { 7548 - int ret = -1; 7547 + int ret; 7549 7548 7550 7549 ftrace_ops_init(ops); 7551 7550
+24 -4
kernel/trace/ring_buffer.c
··· 3880 3880 if (unlikely(!head)) 3881 3881 return true; 3882 3882 3883 - return reader->read == rb_page_commit(reader) && 3884 - (commit == reader || 3885 - (commit == head && 3886 - head->read == rb_page_commit(commit))); 3883 + /* Reader should exhaust content in reader page */ 3884 + if (reader->read != rb_page_commit(reader)) 3885 + return false; 3886 + 3887 + /* 3888 + * If writers are committing on the reader page, knowing all 3889 + * committed content has been read, the ring buffer is empty. 3890 + */ 3891 + if (commit == reader) 3892 + return true; 3893 + 3894 + /* 3895 + * If writers are committing on a page other than reader page 3896 + * and head page, there should always be content to read. 3897 + */ 3898 + if (commit != head) 3899 + return false; 3900 + 3901 + /* 3902 + * Writers are committing on the head page, we just need 3903 + * to care about there're committed data, and the reader will 3904 + * swap reader page with head page when it is to read data. 3905 + */ 3906 + return rb_page_commit(commit) == 0; 3887 3907 } 3888 3908 3889 3909 /**
+4
kernel/trace/trace.c
··· 5609 5609 "\t [:name=histname1]\n" 5610 5610 "\t [:<handler>.<action>]\n" 5611 5611 "\t [if <filter>]\n\n" 5612 + "\t Note, special fields can be used as well:\n" 5613 + "\t common_timestamp - to record current timestamp\n" 5614 + "\t common_cpu - to record the CPU the event happened on\n" 5615 + "\n" 5612 5616 "\t When a matching event is hit, an entry is added to a hash\n" 5613 5617 "\t table using the key(s) and value(s) named, and the value of a\n" 5614 5618 "\t sum called 'hitcount' is incremented. Keys and values\n"
+16 -6
kernel/trace/trace_events_hist.c
··· 1111 1111 field->flags & HIST_FIELD_FL_ALIAS) 1112 1112 field_name = hist_field_name(field->operands[0], ++level); 1113 1113 else if (field->flags & HIST_FIELD_FL_CPU) 1114 - field_name = "cpu"; 1114 + field_name = "common_cpu"; 1115 1115 else if (field->flags & HIST_FIELD_FL_EXPR || 1116 1116 field->flags & HIST_FIELD_FL_VAR_REF) { 1117 1117 if (field->system) { ··· 1991 1991 hist_data->enable_timestamps = true; 1992 1992 if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) 1993 1993 hist_data->attrs->ts_in_usecs = true; 1994 - } else if (strcmp(field_name, "cpu") == 0) 1994 + } else if (strcmp(field_name, "common_cpu") == 0) 1995 1995 *flags |= HIST_FIELD_FL_CPU; 1996 1996 else { 1997 1997 field = trace_find_event_field(file->event_call, field_name); 1998 1998 if (!field || !field->size) { 1999 - hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name)); 2000 - field = ERR_PTR(-EINVAL); 2001 - goto out; 1999 + /* 2000 + * For backward compatibility, if field_name 2001 + * was "cpu", then we treat this the same as 2002 + * common_cpu. 2003 + */ 2004 + if (strcmp(field_name, "cpu") == 0) { 2005 + *flags |= HIST_FIELD_FL_CPU; 2006 + } else { 2007 + hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, 2008 + errpos(field_name)); 2009 + field = ERR_PTR(-EINVAL); 2010 + goto out; 2011 + } 2002 2012 } 2003 2013 } 2004 2014 out: ··· 5095 5085 seq_printf(m, "%s=", hist_field->var.name); 5096 5086 5097 5087 if (hist_field->flags & HIST_FIELD_FL_CPU) 5098 - seq_puts(m, "cpu"); 5088 + seq_puts(m, "common_cpu"); 5099 5089 else if (field_name) { 5100 5090 if (hist_field->flags & HIST_FIELD_FL_VAR_REF || 5101 5091 hist_field->flags & HIST_FIELD_FL_ALIAS)
+3 -5
kernel/trace/trace_events_synth.c
··· 893 893 dyn_event_init(&event->devent, &synth_event_ops); 894 894 895 895 for (i = 0, j = 0; i < n_fields; i++) { 896 + fields[i]->field_pos = i; 896 897 event->fields[i] = fields[i]; 897 898 898 - if (fields[i]->is_dynamic) { 899 - event->dynamic_fields[j] = fields[i]; 900 - event->dynamic_fields[j]->field_pos = i; 899 + if (fields[i]->is_dynamic) 901 900 event->dynamic_fields[j++] = fields[i]; 902 - event->n_dynamic_fields++; 903 - } 904 901 } 902 + event->n_dynamic_fields = j; 905 903 event->n_fields = n_fields; 906 904 out: 907 905 return event;
+1 -1
kernel/trace/trace_synth.h
··· 14 14 char *name; 15 15 size_t size; 16 16 unsigned int offset; 17 + unsigned int field_pos; 17 18 bool is_signed; 18 19 bool is_string; 19 20 bool is_dynamic; 20 - bool field_pos; 21 21 }; 22 22 23 23 struct synth_event {
+1 -1
kernel/tracepoint.c
··· 299 299 * a pointer to it. This array is referenced by __DO_TRACE from 300 300 * include/linux/tracepoint.h using rcu_dereference_sched(). 301 301 */ 302 - rcu_assign_pointer(tp->funcs, tp_funcs); 303 302 tracepoint_update_call(tp, tp_funcs, false); 303 + rcu_assign_pointer(tp->funcs, tp_funcs); 304 304 static_key_enable(&tp->key); 305 305 306 306 release_probes(old);
+1 -1
mm/backing-dev.c
··· 398 398 blkcg_unpin_online(blkcg); 399 399 400 400 fprop_local_destroy_percpu(&wb->memcg_completions); 401 - percpu_ref_exit(&wb->refcnt); 402 401 403 402 spin_lock_irq(&cgwb_lock); 404 403 list_del(&wb->offline_node); 405 404 spin_unlock_irq(&cgwb_lock); 406 405 406 + percpu_ref_exit(&wb->refcnt); 407 407 wb_exit(wb); 408 408 WARN_ON_ONCE(!list_empty(&wb->b_attached)); 409 409 kfree_rcu(wb, rcu);
+16 -3
mm/kfence/core.c
··· 734 734 void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) 735 735 { 736 736 /* 737 + * Perform size check before switching kfence_allocation_gate, so that 738 + * we don't disable KFENCE without making an allocation. 739 + */ 740 + if (size > PAGE_SIZE) 741 + return NULL; 742 + 743 + /* 744 + * Skip allocations from non-default zones, including DMA. We cannot 745 + * guarantee that pages in the KFENCE pool will have the requested 746 + * properties (e.g. reside in DMAable memory). 747 + */ 748 + if ((flags & GFP_ZONEMASK) || 749 + (s->flags & (SLAB_CACHE_DMA | SLAB_CACHE_DMA32))) 750 + return NULL; 751 + 752 + /* 737 753 * allocation_gate only needs to become non-zero, so it doesn't make 738 754 * sense to continue writing to it and pay the associated contention 739 755 * cost, in case we have a large number of concurrent allocations. ··· 771 755 #endif 772 756 773 757 if (!READ_ONCE(kfence_enabled)) 774 - return NULL; 775 - 776 - if (size > PAGE_SIZE) 777 758 return NULL; 778 759 779 760 return kfence_guarded_alloc(s, size, flags);
+1 -1
mm/kfence/kfence_test.c
··· 852 852 tracepoint_synchronize_unregister(); 853 853 } 854 854 855 - late_initcall(kfence_test_init); 855 + late_initcall_sync(kfence_test_init); 856 856 module_exit(kfence_test_exit); 857 857 858 858 MODULE_LICENSE("GPL v2");
+2 -1
mm/memblock.c
··· 947 947 return true; 948 948 949 949 /* skip hotpluggable memory regions if needed */ 950 - if (movable_node_is_enabled() && memblock_is_hotpluggable(m)) 950 + if (movable_node_is_enabled() && memblock_is_hotpluggable(m) && 951 + !(flags & MEMBLOCK_HOTPLUG)) 951 952 return true; 952 953 953 954 /* if we want mirror memory skip non-mirror memory regions */
+10 -1
mm/memory.c
··· 4026 4026 return ret; 4027 4027 } 4028 4028 4029 - if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) 4029 + if (vmf->prealloc_pte) { 4030 + vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); 4031 + if (likely(pmd_none(*vmf->pmd))) { 4032 + mm_inc_nr_ptes(vma->vm_mm); 4033 + pmd_populate(vma->vm_mm, vmf->pmd, vmf->prealloc_pte); 4034 + vmf->prealloc_pte = NULL; 4035 + } 4036 + spin_unlock(vmf->ptl); 4037 + } else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) { 4030 4038 return VM_FAULT_OOM; 4039 + } 4031 4040 } 4032 4041 4033 4042 /* See comment in handle_pte_fault() */
+2 -2
mm/mmap_lock.c
··· 156 156 #define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ 157 157 do { \ 158 158 const char *memcg_path; \ 159 - preempt_disable(); \ 159 + local_lock(&memcg_paths.lock); \ 160 160 memcg_path = get_mm_memcg_path(mm); \ 161 161 trace_mmap_lock_##type(mm, \ 162 162 memcg_path != NULL ? memcg_path : "", \ 163 163 ##__VA_ARGS__); \ 164 164 if (likely(memcg_path != NULL)) \ 165 165 put_memcg_path_buf(); \ 166 - preempt_enable(); \ 166 + local_unlock(&memcg_paths.lock); \ 167 167 } while (0) 168 168 169 169 #else /* !CONFIG_MEMCG */
+16 -13
mm/page_alloc.c
··· 840 840 } 841 841 #endif 842 842 843 - if (_init_on_alloc_enabled_early) { 844 - if (page_poisoning_requested) 845 - pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 846 - "will take precedence over init_on_alloc\n"); 847 - else 848 - static_branch_enable(&init_on_alloc); 843 + if ((_init_on_alloc_enabled_early || _init_on_free_enabled_early) && 844 + page_poisoning_requested) { 845 + pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 846 + "will take precedence over init_on_alloc and init_on_free\n"); 847 + _init_on_alloc_enabled_early = false; 848 + _init_on_free_enabled_early = false; 849 849 } 850 - if (_init_on_free_enabled_early) { 851 - if (page_poisoning_requested) 852 - pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 853 - "will take precedence over init_on_free\n"); 854 - else 855 - static_branch_enable(&init_on_free); 856 - } 850 + 851 + if (_init_on_alloc_enabled_early) 852 + static_branch_enable(&init_on_alloc); 853 + else 854 + static_branch_disable(&init_on_alloc); 855 + 856 + if (_init_on_free_enabled_early) 857 + static_branch_enable(&init_on_free); 858 + else 859 + static_branch_disable(&init_on_free); 857 860 858 861 #ifdef CONFIG_DEBUG_PAGEALLOC 859 862 if (!debug_pagealloc_enabled())
+1
mm/secretmem.c
··· 152 152 } 153 153 154 154 const struct address_space_operations secretmem_aops = { 155 + .set_page_dirty = __set_page_dirty_no_writeback, 155 156 .freepage = secretmem_freepage, 156 157 .migratepage = secretmem_migratepage, 157 158 .isolate_page = secretmem_isolate_page,
+3
net/bpf/test_run.c
··· 701 701 void *data; 702 702 int ret; 703 703 704 + if (prog->expected_attach_type == BPF_XDP_DEVMAP || 705 + prog->expected_attach_type == BPF_XDP_CPUMAP) 706 + return -EINVAL; 704 707 if (kattr->test.ctx_in || kattr->test.ctx_out) 705 708 return -EINVAL; 706 709
+1 -1
net/bridge/br_fdb.c
··· 780 780 struct net_device *dst_dev; 781 781 782 782 dst_dev = dst ? dst->dev : br->dev; 783 - if (dst_dev != br_dev && dst_dev != dev) 783 + if (dst_dev && dst_dev != dev) 784 784 continue; 785 785 786 786 err = br_fdb_replay_one(nb, fdb, dst_dev, action, ctx);
+2 -1
net/caif/caif_socket.c
··· 539 539 goto err; 540 540 541 541 ret = -EINVAL; 542 - if (unlikely(msg->msg_iter.iov->iov_base == NULL)) 542 + if (unlikely(msg->msg_iter.nr_segs == 0) || 543 + unlikely(msg->msg_iter.iov->iov_base == NULL)) 543 544 goto err; 544 545 noblock = msg->msg_flags & MSG_DONTWAIT; 545 546
+26 -8
net/core/dev.c
··· 131 131 #include <trace/events/napi.h> 132 132 #include <trace/events/net.h> 133 133 #include <trace/events/skb.h> 134 + #include <trace/events/qdisc.h> 134 135 #include <linux/inetdevice.h> 135 136 #include <linux/cpu_rmap.h> 136 137 #include <linux/static_key.h> ··· 3845 3844 } 3846 3845 } 3847 3846 3847 + static int dev_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *q, 3848 + struct sk_buff **to_free, 3849 + struct netdev_queue *txq) 3850 + { 3851 + int rc; 3852 + 3853 + rc = q->enqueue(skb, q, to_free) & NET_XMIT_MASK; 3854 + if (rc == NET_XMIT_SUCCESS) 3855 + trace_qdisc_enqueue(q, txq, skb); 3856 + return rc; 3857 + } 3858 + 3848 3859 static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, 3849 3860 struct net_device *dev, 3850 3861 struct netdev_queue *txq) ··· 3875 3862 * of q->seqlock to protect from racing with requeuing. 3876 3863 */ 3877 3864 if (unlikely(!nolock_qdisc_is_empty(q))) { 3878 - rc = q->enqueue(skb, q, &to_free) & 3879 - NET_XMIT_MASK; 3865 + rc = dev_qdisc_enqueue(skb, q, &to_free, txq); 3880 3866 __qdisc_run(q); 3881 3867 qdisc_run_end(q); 3882 3868 ··· 3891 3879 return NET_XMIT_SUCCESS; 3892 3880 } 3893 3881 3894 - rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK; 3882 + rc = dev_qdisc_enqueue(skb, q, &to_free, txq); 3895 3883 qdisc_run(q); 3896 3884 3897 3885 no_lock_out: ··· 3935 3923 qdisc_run_end(q); 3936 3924 rc = NET_XMIT_SUCCESS; 3937 3925 } else { 3938 - rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK; 3926 + rc = dev_qdisc_enqueue(skb, q, &to_free, txq); 3939 3927 if (qdisc_run_begin(q)) { 3940 3928 if (unlikely(contended)) { 3941 3929 spin_unlock(&q->busylock); ··· 9712 9700 struct net_device *dev; 9713 9701 int err, fd; 9714 9702 9703 + rtnl_lock(); 9715 9704 dev = dev_get_by_index(net, attr->link_create.target_ifindex); 9716 - if (!dev) 9705 + if (!dev) { 9706 + rtnl_unlock(); 9717 9707 return -EINVAL; 9708 + } 9718 9709 9719 9710 link = kzalloc(sizeof(*link), GFP_USER); 9720 9711 if (!link) { 9721 9712 err = -ENOMEM; 9722 - goto out_put_dev; 9713 + goto unlock; 9723 9714 } 9724 9715 9725 9716 bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog); ··· 9732 9717 err = bpf_link_prime(&link->link, &link_primer); 9733 9718 if (err) { 9734 9719 kfree(link); 9735 - goto out_put_dev; 9720 + goto unlock; 9736 9721 } 9737 9722 9738 - rtnl_lock(); 9739 9723 err = dev_xdp_attach_link(dev, NULL, link); 9740 9724 rtnl_unlock(); 9741 9725 9742 9726 if (err) { 9727 + link->dev = NULL; 9743 9728 bpf_link_cleanup(&link_primer); 9744 9729 goto out_put_dev; 9745 9730 } ··· 9748 9733 /* link itself doesn't hold dev's refcnt to not complicate shutdown */ 9749 9734 dev_put(dev); 9750 9735 return fd; 9736 + 9737 + unlock: 9738 + rtnl_unlock(); 9751 9739 9752 9740 out_put_dev: 9753 9741 dev_put(dev);
+16 -2
net/core/skbuff.c
··· 663 663 if (skb->cloned && 664 664 atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1, 665 665 &shinfo->dataref)) 666 - return; 666 + goto exit; 667 667 668 668 skb_zcopy_clear(skb, true); 669 669 ··· 674 674 kfree_skb_list(shinfo->frag_list); 675 675 676 676 skb_free_head(skb); 677 + exit: 678 + /* When we clone an SKB we copy the reycling bit. The pp_recycle 679 + * bit is only set on the head though, so in order to avoid races 680 + * while trying to recycle fragments on __skb_frag_unref() we need 681 + * to make one SKB responsible for triggering the recycle path. 682 + * So disable the recycling bit if an SKB is cloned and we have 683 + * additional references to to the fragmented part of the SKB. 684 + * Eventually the last SKB will have the recycling bit set and it's 685 + * dataref set to 0, which will trigger the recycling 686 + */ 687 + skb->pp_recycle = 0; 677 688 } 678 689 679 690 /* ··· 3022 3011 3023 3012 if (!from->head_frag || 3024 3013 skb_headlen(from) < L1_CACHE_BYTES || 3025 - skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) 3014 + skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) { 3026 3015 hlen = skb_headlen(from); 3016 + if (!hlen) 3017 + hlen = from->len; 3018 + } 3027 3019 3028 3020 if (skb_has_frag_list(from)) 3029 3021 hlen = from->len;
+11 -5
net/core/skmsg.c
··· 508 508 if (skb_linearize(skb)) 509 509 return -EAGAIN; 510 510 num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len); 511 - if (unlikely(num_sge < 0)) { 512 - kfree(msg); 511 + if (unlikely(num_sge < 0)) 513 512 return num_sge; 514 - } 515 513 516 514 copied = skb->len; 517 515 msg->sg.start = 0; ··· 528 530 { 529 531 struct sock *sk = psock->sk; 530 532 struct sk_msg *msg; 533 + int err; 531 534 532 535 /* If we are receiving on the same sock skb->sk is already assigned, 533 536 * skip memory accounting and owner transition seeing it already set ··· 547 548 * into user buffers. 548 549 */ 549 550 skb_set_owner_r(skb, sk); 550 - return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); 551 + err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); 552 + if (err < 0) 553 + kfree(msg); 554 + return err; 551 555 } 552 556 553 557 /* Puts an skb on the ingress queue of the socket already assigned to the ··· 561 559 { 562 560 struct sk_msg *msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC); 563 561 struct sock *sk = psock->sk; 562 + int err; 564 563 565 564 if (unlikely(!msg)) 566 565 return -EAGAIN; 567 566 sk_msg_init(msg); 568 567 skb_set_owner_r(skb, sk); 569 - return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); 568 + err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); 569 + if (err < 0) 570 + kfree(msg); 571 + return err; 570 572 } 571 573 572 574 static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb,
+12 -15
net/decnet/af_decnet.c
··· 816 816 static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) 817 817 { 818 818 struct dn_scp *scp = DN_SK(sk); 819 - DEFINE_WAIT(wait); 819 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 820 820 int err; 821 821 822 822 if (scp->state != DN_CR) ··· 826 826 scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk)); 827 827 dn_send_conn_conf(sk, allocation); 828 828 829 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 829 + add_wait_queue(sk_sleep(sk), &wait); 830 830 for(;;) { 831 831 release_sock(sk); 832 832 if (scp->state == DN_CC) 833 - *timeo = schedule_timeout(*timeo); 833 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); 834 834 lock_sock(sk); 835 835 err = 0; 836 836 if (scp->state == DN_RUN) ··· 844 844 err = -EAGAIN; 845 845 if (!*timeo) 846 846 break; 847 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 848 847 } 849 - finish_wait(sk_sleep(sk), &wait); 848 + remove_wait_queue(sk_sleep(sk), &wait); 850 849 if (err == 0) { 851 850 sk->sk_socket->state = SS_CONNECTED; 852 851 } else if (scp->state != DN_CC) { ··· 857 858 static int dn_wait_run(struct sock *sk, long *timeo) 858 859 { 859 860 struct dn_scp *scp = DN_SK(sk); 860 - DEFINE_WAIT(wait); 861 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 861 862 int err = 0; 862 863 863 864 if (scp->state == DN_RUN) ··· 866 867 if (!*timeo) 867 868 return -EALREADY; 868 869 869 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 870 + add_wait_queue(sk_sleep(sk), &wait); 870 871 for(;;) { 871 872 release_sock(sk); 872 873 if (scp->state == DN_CI || scp->state == DN_CC) 873 - *timeo = schedule_timeout(*timeo); 874 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); 874 875 lock_sock(sk); 875 876 err = 0; 876 877 if (scp->state == DN_RUN) ··· 884 885 err = -ETIMEDOUT; 885 886 if (!*timeo) 886 887 break; 887 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 888 888 } 889 - finish_wait(sk_sleep(sk), &wait); 889 + remove_wait_queue(sk_sleep(sk), &wait); 890 890 out: 891 891 if (err == 0) { 892 892 sk->sk_socket->state = SS_CONNECTED; ··· 1030 1032 1031 1033 static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) 1032 1034 { 1033 - DEFINE_WAIT(wait); 1035 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 1034 1036 struct sk_buff *skb = NULL; 1035 1037 int err = 0; 1036 1038 1037 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 1039 + add_wait_queue(sk_sleep(sk), &wait); 1038 1040 for(;;) { 1039 1041 release_sock(sk); 1040 1042 skb = skb_dequeue(&sk->sk_receive_queue); 1041 1043 if (skb == NULL) { 1042 - *timeo = schedule_timeout(*timeo); 1044 + *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo); 1043 1045 skb = skb_dequeue(&sk->sk_receive_queue); 1044 1046 } 1045 1047 lock_sock(sk); ··· 1054 1056 err = -EAGAIN; 1055 1057 if (!*timeo) 1056 1058 break; 1057 - prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); 1058 1059 } 1059 - finish_wait(sk_sleep(sk), &wait); 1060 + remove_wait_queue(sk_sleep(sk), &wait); 1060 1061 1061 1062 return skb == NULL ? ERR_PTR(err) : skb; 1062 1063 }
+9 -5
net/dsa/slave.c
··· 1808 1808 struct dsa_slave_priv *p = netdev_priv(slave); 1809 1809 const struct dsa_port *cpu_dp = dp->cpu_dp; 1810 1810 struct net_device *master = cpu_dp->master; 1811 + const struct dsa_switch *ds = dp->ds; 1811 1812 1812 1813 slave->needed_headroom = cpu_dp->tag_ops->needed_headroom; 1813 1814 slave->needed_tailroom = cpu_dp->tag_ops->needed_tailroom; ··· 1820 1819 slave->needed_tailroom += master->needed_tailroom; 1821 1820 1822 1821 p->xmit = cpu_dp->tag_ops->xmit; 1822 + 1823 + slave->features = master->vlan_features | NETIF_F_HW_TC; 1824 + if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) 1825 + slave->features |= NETIF_F_HW_VLAN_CTAG_FILTER; 1826 + slave->hw_features |= NETIF_F_HW_TC; 1827 + slave->features |= NETIF_F_LLTX; 1828 + if (slave->needed_tailroom) 1829 + slave->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST); 1823 1830 } 1824 1831 1825 1832 static struct lock_class_key dsa_slave_netdev_xmit_lock_key; ··· 1890 1881 if (slave_dev == NULL) 1891 1882 return -ENOMEM; 1892 1883 1893 - slave_dev->features = master->vlan_features | NETIF_F_HW_TC; 1894 - if (ds->ops->port_vlan_add && ds->ops->port_vlan_del) 1895 - slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; 1896 - slave_dev->hw_features |= NETIF_F_HW_TC; 1897 - slave_dev->features |= NETIF_F_LLTX; 1898 1884 slave_dev->ethtool_ops = &dsa_slave_ethtool_ops; 1899 1885 if (!is_zero_ether_addr(port->mac)) 1900 1886 ether_addr_copy(slave_dev->dev_addr, port->mac);
+9
net/dsa/tag_ksz.c
··· 53 53 u8 *tag; 54 54 u8 *addr; 55 55 56 + if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) 57 + return NULL; 58 + 56 59 /* Tag encoding */ 57 60 tag = skb_put(skb, KSZ_INGRESS_TAG_LEN); 58 61 addr = skb_mac_header(skb); ··· 117 114 u8 *addr; 118 115 u16 val; 119 116 117 + if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) 118 + return NULL; 119 + 120 120 /* Tag encoding */ 121 121 tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN); 122 122 addr = skb_mac_header(skb); ··· 169 163 struct dsa_port *dp = dsa_slave_to_port(dev); 170 164 u8 *addr; 171 165 u8 *tag; 166 + 167 + if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) 168 + return NULL; 172 169 173 170 /* Tag encoding */ 174 171 tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
+1 -1
net/ipv4/tcp_bpf.c
··· 503 503 tcp_bpf_rebuild_protos(tcp_bpf_prots[TCP_BPF_IPV4], &tcp_prot); 504 504 return 0; 505 505 } 506 - core_initcall(tcp_bpf_v4_build_proto); 506 + late_initcall(tcp_bpf_v4_build_proto); 507 507 508 508 static int tcp_bpf_assert_proto_ops(struct proto *ops) 509 509 {
+24 -4
net/ipv4/tcp_fastopen.c
··· 507 507 { 508 508 struct net *net = sock_net(sk); 509 509 510 + if (!sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout) 511 + return; 512 + 513 + /* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */ 514 + WRITE_ONCE(net->ipv4.tfo_active_disable_stamp, jiffies); 515 + 516 + /* Paired with smp_rmb() in tcp_fastopen_active_should_disable(). 517 + * We want net->ipv4.tfo_active_disable_stamp to be updated first. 518 + */ 519 + smp_mb__before_atomic(); 510 520 atomic_inc(&net->ipv4.tfo_active_disable_times); 511 - net->ipv4.tfo_active_disable_stamp = jiffies; 521 + 512 522 NET_INC_STATS(net, LINUX_MIB_TCPFASTOPENBLACKHOLE); 513 523 } 514 524 ··· 529 519 bool tcp_fastopen_active_should_disable(struct sock *sk) 530 520 { 531 521 unsigned int tfo_bh_timeout = sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout; 532 - int tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times); 533 522 unsigned long timeout; 523 + int tfo_da_times; 534 524 int multiplier; 535 525 526 + if (!tfo_bh_timeout) 527 + return false; 528 + 529 + tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times); 536 530 if (!tfo_da_times) 537 531 return false; 538 532 533 + /* Paired with smp_mb__before_atomic() in tcp_fastopen_active_disable() */ 534 + smp_rmb(); 535 + 539 536 /* Limit timeout to max: 2^6 * initial timeout */ 540 537 multiplier = 1 << min(tfo_da_times - 1, 6); 541 - timeout = multiplier * tfo_bh_timeout * HZ; 542 - if (time_before(jiffies, sock_net(sk)->ipv4.tfo_active_disable_stamp + timeout)) 538 + 539 + /* Paired with the WRITE_ONCE() in tcp_fastopen_active_disable(). */ 540 + timeout = READ_ONCE(sock_net(sk)->ipv4.tfo_active_disable_stamp) + 541 + multiplier * tfo_bh_timeout * HZ; 542 + if (time_before(jiffies, timeout)) 543 543 return true; 544 544 545 545 /* Mark check bit so we can check for successful active TFO
+1 -1
net/ipv4/tcp_ipv4.c
··· 2965 2965 net->ipv4.sysctl_tcp_comp_sack_nr = 44; 2966 2966 net->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE; 2967 2967 spin_lock_init(&net->ipv4.tcp_fastopen_ctx_lock); 2968 - net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 60 * 60; 2968 + net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 0; 2969 2969 atomic_set(&net->ipv4.tfo_active_disable_times, 0); 2970 2970 2971 2971 /* Reno is always built in */
+19 -6
net/ipv4/udp.c
··· 645 645 const struct iphdr *iph, 646 646 struct udphdr *uh, 647 647 struct udp_table *udptable, 648 + struct sock *sk, 648 649 struct sk_buff *skb, u32 info) 649 650 { 651 + int (*lookup)(struct sock *sk, struct sk_buff *skb); 650 652 int network_offset, transport_offset; 651 - struct sock *sk; 653 + struct udp_sock *up; 652 654 653 655 network_offset = skb_network_offset(skb); 654 656 transport_offset = skb_transport_offset(skb); ··· 661 659 /* Transport header needs to point to the UDP header */ 662 660 skb_set_transport_header(skb, iph->ihl << 2); 663 661 662 + if (sk) { 663 + up = udp_sk(sk); 664 + 665 + lookup = READ_ONCE(up->encap_err_lookup); 666 + if (lookup && lookup(sk, skb)) 667 + sk = NULL; 668 + 669 + goto out; 670 + } 671 + 664 672 sk = __udp4_lib_lookup(net, iph->daddr, uh->source, 665 673 iph->saddr, uh->dest, skb->dev->ifindex, 0, 666 674 udptable, NULL); 667 675 if (sk) { 668 - int (*lookup)(struct sock *sk, struct sk_buff *skb); 669 - struct udp_sock *up = udp_sk(sk); 676 + up = udp_sk(sk); 670 677 671 678 lookup = READ_ONCE(up->encap_err_lookup); 672 679 if (!lookup || lookup(sk, skb)) 673 680 sk = NULL; 674 681 } 675 682 683 + out: 676 684 if (!sk) 677 685 sk = ERR_PTR(__udp4_lib_err_encap_no_sk(skb, info)); 678 686 ··· 719 707 sk = __udp4_lib_lookup(net, iph->daddr, uh->dest, 720 708 iph->saddr, uh->source, skb->dev->ifindex, 721 709 inet_sdif(skb), udptable, NULL); 710 + 722 711 if (!sk || udp_sk(sk)->encap_type) { 723 712 /* No socket for error: try tunnels before discarding */ 724 - sk = ERR_PTR(-ENOENT); 725 713 if (static_branch_unlikely(&udp_encap_needed_key)) { 726 - sk = __udp4_lib_err_encap(net, iph, uh, udptable, skb, 714 + sk = __udp4_lib_err_encap(net, iph, uh, udptable, sk, skb, 727 715 info); 728 716 if (!sk) 729 717 return 0; 730 - } 718 + } else 719 + sk = ERR_PTR(-ENOENT); 731 720 732 721 if (IS_ERR(sk)) { 733 722 __ICMP_INC_STATS(net, ICMP_MIB_INERRORS);
+1 -1
net/ipv4/udp_bpf.c
··· 134 134 udp_bpf_rebuild_protos(&udp_bpf_prots[UDP_BPF_IPV4], &udp_prot); 135 135 return 0; 136 136 } 137 - core_initcall(udp_bpf_v4_build_proto); 137 + late_initcall(udp_bpf_v4_build_proto); 138 138 139 139 int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore) 140 140 {
+1 -1
net/ipv6/ip6_output.c
··· 74 74 75 75 if (likely(nskb)) { 76 76 if (skb->sk) 77 - skb_set_owner_w(skb, skb->sk); 77 + skb_set_owner_w(nskb, skb->sk); 78 78 consume_skb(skb); 79 79 } else { 80 80 kfree_skb(skb);
+1 -1
net/ipv6/route.c
··· 3769 3769 err = PTR_ERR(rt->fib6_metrics); 3770 3770 /* Do not leave garbage there. */ 3771 3771 rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics; 3772 - goto out; 3772 + goto out_free; 3773 3773 } 3774 3774 3775 3775 if (cfg->fc_flags & RTF_ADDRCONF)
+19 -6
net/ipv6/udp.c
··· 502 502 const struct ipv6hdr *hdr, int offset, 503 503 struct udphdr *uh, 504 504 struct udp_table *udptable, 505 + struct sock *sk, 505 506 struct sk_buff *skb, 506 507 struct inet6_skb_parm *opt, 507 508 u8 type, u8 code, __be32 info) 508 509 { 510 + int (*lookup)(struct sock *sk, struct sk_buff *skb); 509 511 int network_offset, transport_offset; 510 - struct sock *sk; 512 + struct udp_sock *up; 511 513 512 514 network_offset = skb_network_offset(skb); 513 515 transport_offset = skb_transport_offset(skb); ··· 520 518 /* Transport header needs to point to the UDP header */ 521 519 skb_set_transport_header(skb, offset); 522 520 521 + if (sk) { 522 + up = udp_sk(sk); 523 + 524 + lookup = READ_ONCE(up->encap_err_lookup); 525 + if (lookup && lookup(sk, skb)) 526 + sk = NULL; 527 + 528 + goto out; 529 + } 530 + 523 531 sk = __udp6_lib_lookup(net, &hdr->daddr, uh->source, 524 532 &hdr->saddr, uh->dest, 525 533 inet6_iif(skb), 0, udptable, skb); 526 534 if (sk) { 527 - int (*lookup)(struct sock *sk, struct sk_buff *skb); 528 - struct udp_sock *up = udp_sk(sk); 535 + up = udp_sk(sk); 529 536 530 537 lookup = READ_ONCE(up->encap_err_lookup); 531 538 if (!lookup || lookup(sk, skb)) 532 539 sk = NULL; 533 540 } 534 541 542 + out: 535 543 if (!sk) { 536 544 sk = ERR_PTR(__udp6_lib_err_encap_no_sk(skb, opt, type, code, 537 545 offset, info)); ··· 570 558 571 559 sk = __udp6_lib_lookup(net, daddr, uh->dest, saddr, uh->source, 572 560 inet6_iif(skb), inet6_sdif(skb), udptable, NULL); 561 + 573 562 if (!sk || udp_sk(sk)->encap_type) { 574 563 /* No socket for error: try tunnels before discarding */ 575 - sk = ERR_PTR(-ENOENT); 576 564 if (static_branch_unlikely(&udpv6_encap_needed_key)) { 577 565 sk = __udp6_lib_err_encap(net, hdr, offset, uh, 578 - udptable, skb, 566 + udptable, sk, skb, 579 567 opt, type, code, info); 580 568 if (!sk) 581 569 return 0; 582 - } 570 + } else 571 + sk = ERR_PTR(-ENOENT); 583 572 584 573 if (IS_ERR(sk)) { 585 574 __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev),
+11 -9
net/netrom/nr_timer.c
··· 121 121 is accepted() it isn't 'dead' so doesn't get removed. */ 122 122 if (sock_flag(sk, SOCK_DESTROY) || 123 123 (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) { 124 - sock_hold(sk); 125 124 bh_unlock_sock(sk); 126 125 nr_destroy_socket(sk); 127 - sock_put(sk); 128 - return; 126 + goto out; 129 127 } 130 128 break; 131 129 ··· 144 146 145 147 nr_start_heartbeat(sk); 146 148 bh_unlock_sock(sk); 149 + out: 150 + sock_put(sk); 147 151 } 148 152 149 153 static void nr_t2timer_expiry(struct timer_list *t) ··· 159 159 nr_enquiry_response(sk); 160 160 } 161 161 bh_unlock_sock(sk); 162 + sock_put(sk); 162 163 } 163 164 164 165 static void nr_t4timer_expiry(struct timer_list *t) ··· 170 169 bh_lock_sock(sk); 171 170 nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY; 172 171 bh_unlock_sock(sk); 172 + sock_put(sk); 173 173 } 174 174 175 175 static void nr_idletimer_expiry(struct timer_list *t) ··· 199 197 sock_set_flag(sk, SOCK_DEAD); 200 198 } 201 199 bh_unlock_sock(sk); 200 + sock_put(sk); 202 201 } 203 202 204 203 static void nr_t1timer_expiry(struct timer_list *t) ··· 212 209 case NR_STATE_1: 213 210 if (nr->n2count == nr->n2) { 214 211 nr_disconnect(sk, ETIMEDOUT); 215 - bh_unlock_sock(sk); 216 - return; 212 + goto out; 217 213 } else { 218 214 nr->n2count++; 219 215 nr_write_internal(sk, NR_CONNREQ); ··· 222 220 case NR_STATE_2: 223 221 if (nr->n2count == nr->n2) { 224 222 nr_disconnect(sk, ETIMEDOUT); 225 - bh_unlock_sock(sk); 226 - return; 223 + goto out; 227 224 } else { 228 225 nr->n2count++; 229 226 nr_write_internal(sk, NR_DISCREQ); ··· 232 231 case NR_STATE_3: 233 232 if (nr->n2count == nr->n2) { 234 233 nr_disconnect(sk, ETIMEDOUT); 235 - bh_unlock_sock(sk); 236 - return; 234 + goto out; 237 235 } else { 238 236 nr->n2count++; 239 237 nr_requeue_frames(sk); ··· 241 241 } 242 242 243 243 nr_start_t1timer(sk); 244 + out: 244 245 bh_unlock_sock(sk); 246 + sock_put(sk); 245 247 }
+8 -4
net/sched/act_skbmod.c
··· 6 6 */ 7 7 8 8 #include <linux/module.h> 9 + #include <linux/if_arp.h> 9 10 #include <linux/init.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/skbuff.h> ··· 34 33 tcf_lastuse_update(&d->tcf_tm); 35 34 bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb); 36 35 36 + action = READ_ONCE(d->tcf_action); 37 + if (unlikely(action == TC_ACT_SHOT)) 38 + goto drop; 39 + 40 + if (!skb->dev || skb->dev->type != ARPHRD_ETHER) 41 + return action; 42 + 37 43 /* XXX: if you are going to edit more fields beyond ethernet header 38 44 * (example when you add IP header replacement or vlan swap) 39 45 * then MAX_EDIT_LEN needs to change appropriately 40 46 */ 41 47 err = skb_ensure_writable(skb, MAX_EDIT_LEN); 42 48 if (unlikely(err)) /* best policy is to drop on the floor */ 43 - goto drop; 44 - 45 - action = READ_ONCE(d->tcf_action); 46 - if (unlikely(action == TC_ACT_SHOT)) 47 49 goto drop; 48 50 49 51 p = rcu_dereference_bh(d->skbmod_p);
+1 -1
net/sched/cls_api.c
··· 2904 2904 break; 2905 2905 case RTM_GETCHAIN: 2906 2906 err = tc_chain_notify(chain, skb, n->nlmsg_seq, 2907 - n->nlmsg_seq, n->nlmsg_type, true); 2907 + n->nlmsg_flags, n->nlmsg_type, true); 2908 2908 if (err < 0) 2909 2909 NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); 2910 2910 break;
+4 -1
net/sched/cls_tcindex.c
··· 278 278 TCA_TCINDEX_POLICE); 279 279 } 280 280 281 + static void tcindex_free_perfect_hash(struct tcindex_data *cp); 282 + 281 283 static void tcindex_partial_destroy_work(struct work_struct *work) 282 284 { 283 285 struct tcindex_data *p = container_of(to_rcu_work(work), ··· 287 285 rwork); 288 286 289 287 rtnl_lock(); 290 - kfree(p->perfect); 288 + if (p->perfect) 289 + tcindex_free_perfect_hash(p); 291 290 kfree(p); 292 291 rtnl_unlock(); 293 292 }
+2
net/sctp/auth.c
··· 860 860 if (replace) { 861 861 list_del_init(&shkey->key_list); 862 862 sctp_auth_shkey_release(shkey); 863 + if (asoc && asoc->active_key_id == auth_key->sca_keynumber) 864 + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); 863 865 } 864 866 list_add(&cur_key->key_list, sh_keys); 865 867
+2 -2
net/sctp/output.c
··· 104 104 if (asoc->param_flags & SPP_PMTUD_ENABLE) 105 105 sctp_assoc_sync_pmtu(asoc); 106 106 } else if (!sctp_transport_pl_enabled(tp) && 107 - !sctp_transport_pmtu_check(tp)) { 108 - if (asoc->param_flags & SPP_PMTUD_ENABLE) 107 + asoc->param_flags & SPP_PMTUD_ENABLE) { 108 + if (!sctp_transport_pmtu_check(tp)) 109 109 sctp_assoc_sync_pmtu(asoc); 110 110 } 111 111
+4
net/sctp/socket.c
··· 4577 4577 } 4578 4578 4579 4579 if (optlen > 0) { 4580 + /* Trim it to the biggest size sctp sockopt may need if necessary */ 4581 + optlen = min_t(unsigned int, optlen, 4582 + PAGE_ALIGN(USHRT_MAX + 4583 + sizeof(__u16) * sizeof(struct sctp_reset_streams))); 4580 4584 kopt = memdup_sockptr(optval, optlen); 4581 4585 if (IS_ERR(kopt)) 4582 4586 return PTR_ERR(kopt);
+20 -7
sound/core/pcm_native.c
··· 246 246 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) 247 247 return false; 248 248 249 - if (substream->ops->mmap || 250 - (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV && 251 - substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC)) 249 + if (substream->ops->mmap) 252 250 return true; 253 251 254 - return dma_can_mmap(substream->dma_buffer.dev.dev); 252 + switch (substream->dma_buffer.dev.type) { 253 + case SNDRV_DMA_TYPE_UNKNOWN: 254 + return false; 255 + case SNDRV_DMA_TYPE_CONTINUOUS: 256 + case SNDRV_DMA_TYPE_VMALLOC: 257 + return true; 258 + default: 259 + return dma_can_mmap(substream->dma_buffer.dev.dev); 260 + } 255 261 } 256 262 257 263 static int constrain_mask_params(struct snd_pcm_substream *substream, ··· 3069 3063 boundary = 0x7fffffff; 3070 3064 snd_pcm_stream_lock_irq(substream); 3071 3065 /* FIXME: we should consider the boundary for the sync from app */ 3072 - if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) 3073 - control->appl_ptr = scontrol.appl_ptr; 3074 - else 3066 + if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) { 3067 + err = pcm_lib_apply_appl_ptr(substream, 3068 + scontrol.appl_ptr); 3069 + if (err < 0) { 3070 + snd_pcm_stream_unlock_irq(substream); 3071 + return err; 3072 + } 3073 + } else 3075 3074 scontrol.appl_ptr = control->appl_ptr % boundary; 3076 3075 if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) 3077 3076 control->avail_min = scontrol.avail_min; ··· 3675 3664 return VM_FAULT_SIGBUS; 3676 3665 if (substream->ops->page) 3677 3666 page = substream->ops->page(substream, offset); 3667 + else if (!snd_pcm_get_dma_buf(substream)) 3668 + page = virt_to_page(runtime->dma_area + offset); 3678 3669 else 3679 3670 page = snd_sgbuf_get_page(snd_pcm_get_dma_buf(substream), offset); 3680 3671 if (!page)
+4
sound/hda/intel-dsp-config.c
··· 319 319 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, 320 320 .device = 0x4b55, 321 321 }, 322 + { 323 + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, 324 + .device = 0x4b58, 325 + }, 322 326 #endif 323 327 324 328 /* Alder Lake */
+4
sound/isa/sb/sb16_csp.c
··· 816 816 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); 817 817 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); 818 818 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); 819 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags); 819 820 820 821 spin_lock(&p->chip->reg_lock); 821 822 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ ··· 856 855 spin_unlock(&p->chip->reg_lock); 857 856 858 857 /* restore PCM volume */ 858 + spin_lock_irqsave(&p->chip->mixer_lock, flags); 859 859 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); 860 860 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); 861 861 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); ··· 882 880 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); 883 881 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); 884 882 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); 883 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags); 885 884 886 885 spin_lock(&p->chip->reg_lock); 887 886 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { ··· 897 894 spin_unlock(&p->chip->reg_lock); 898 895 899 896 /* restore PCM volume */ 897 + spin_lock_irqsave(&p->chip->mixer_lock, flags); 900 898 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); 901 899 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); 902 900 spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
+2
sound/pci/hda/patch_hdmi.c
··· 1940 1940 static const struct snd_pci_quirk force_connect_list[] = { 1941 1941 SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), 1942 1942 SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), 1943 + SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), 1944 + SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", 1), 1943 1945 {} 1944 1946 }; 1945 1947
+1
sound/pci/hda/patch_realtek.c
··· 8626 8626 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8627 8627 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8628 8628 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8629 + SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340), 8629 8630 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), 8630 8631 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), 8631 8632 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
+5
sound/soc/amd/acp-da7219-max98357a.c
··· 576 576 | SND_SOC_DAIFMT_CBM_CFM, 577 577 .init = cz_rt5682_init, 578 578 .dpcm_playback = 1, 579 + .stop_dma_first = 1, 579 580 .ops = &cz_rt5682_play_ops, 580 581 SND_SOC_DAILINK_REG(designware1, rt5682, platform), 581 582 }, ··· 586 585 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 587 586 | SND_SOC_DAIFMT_CBM_CFM, 588 587 .dpcm_capture = 1, 588 + .stop_dma_first = 1, 589 589 .ops = &cz_rt5682_cap_ops, 590 590 SND_SOC_DAILINK_REG(designware2, rt5682, platform), 591 591 }, ··· 596 594 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 597 595 | SND_SOC_DAIFMT_CBM_CFM, 598 596 .dpcm_playback = 1, 597 + .stop_dma_first = 1, 599 598 .ops = &cz_rt5682_max_play_ops, 600 599 SND_SOC_DAILINK_REG(designware3, mx, platform), 601 600 }, ··· 607 604 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 608 605 | SND_SOC_DAIFMT_CBM_CFM, 609 606 .dpcm_capture = 1, 607 + .stop_dma_first = 1, 610 608 .ops = &cz_rt5682_dmic0_cap_ops, 611 609 SND_SOC_DAILINK_REG(designware3, adau, platform), 612 610 }, ··· 618 614 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 619 615 | SND_SOC_DAIFMT_CBM_CFM, 620 616 .dpcm_capture = 1, 617 + .stop_dma_first = 1, 621 618 .ops = &cz_rt5682_dmic1_cap_ops, 622 619 SND_SOC_DAILINK_REG(designware2, adau, platform), 623 620 },
+2 -6
sound/soc/codecs/Kconfig
··· 1325 1325 high-efficiency mono Class-D audio power amplifiers. 1326 1326 1327 1327 config SND_SOC_SSM2518 1328 - tristate 1328 + tristate "Analog Devices SSM2518 Class-D Amplifier" 1329 1329 depends on I2C 1330 1330 1331 1331 config SND_SOC_SSM2602 ··· 1557 1557 Qualcomm SoCs like SDM845. 1558 1558 1559 1559 config SND_SOC_WCD938X 1560 + depends on SND_SOC_WCD938X_SDW 1560 1561 tristate 1561 1562 1562 1563 config SND_SOC_WCD938X_SDW ··· 1813 1812 Support for ZL38060 Connected Home Audio Processor from Microsemi, 1814 1813 which consists of a Digital Signal Processor (DSP), several Digital 1815 1814 Audio Interfaces (DAIs), analog outputs, and a block of 14 GPIOs. 1816 - 1817 - config SND_SOC_ZX_AUD96P22 1818 - tristate "ZTE ZX AUD96P22 CODEC" 1819 - depends on I2C 1820 - select REGMAP_I2C 1821 1815 1822 1816 # Amp 1823 1817 config SND_SOC_LM4857
+2
sound/soc/codecs/rt5631.c
··· 1695 1695 .reg_defaults = rt5631_reg, 1696 1696 .num_reg_defaults = ARRAY_SIZE(rt5631_reg), 1697 1697 .cache_type = REGCACHE_RBTREE, 1698 + .use_single_read = true, 1699 + .use_single_write = true, 1698 1700 }; 1699 1701 1700 1702 static int rt5631_i2c_probe(struct i2c_client *i2c,
+6 -2
sound/soc/codecs/rt5682.c
··· 973 973 rt5682_enable_push_button_irq(component, false); 974 974 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, 975 975 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW); 976 - if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS")) 976 + if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS") && 977 + !snd_soc_dapm_get_pin_status(dapm, "PLL1") && 978 + !snd_soc_dapm_get_pin_status(dapm, "PLL2B")) 977 979 snd_soc_component_update_bits(component, 978 980 RT5682_PWR_ANLG_1, RT5682_PWR_MB, 0); 979 - if (!snd_soc_dapm_get_pin_status(dapm, "Vref2")) 981 + if (!snd_soc_dapm_get_pin_status(dapm, "Vref2") && 982 + !snd_soc_dapm_get_pin_status(dapm, "PLL1") && 983 + !snd_soc_dapm_get_pin_status(dapm, "PLL2B")) 980 984 snd_soc_component_update_bits(component, 981 985 RT5682_PWR_ANLG_1, RT5682_PWR_VREF2, 0); 982 986 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
+2
sound/soc/codecs/tlv320aic31xx.c
··· 1604 1604 ret); 1605 1605 return ret; 1606 1606 } 1607 + regcache_cache_only(aic31xx->regmap, true); 1608 + 1607 1609 aic31xx->dev = &i2c->dev; 1608 1610 aic31xx->irq = i2c->irq; 1609 1611
+2 -2
sound/soc/codecs/tlv320aic31xx.h
··· 151 151 #define AIC31XX_WORD_LEN_24BITS 0x02 152 152 #define AIC31XX_WORD_LEN_32BITS 0x03 153 153 #define AIC31XX_IFACE1_MASTER_MASK GENMASK(3, 2) 154 - #define AIC31XX_BCLK_MASTER BIT(2) 155 - #define AIC31XX_WCLK_MASTER BIT(3) 154 + #define AIC31XX_BCLK_MASTER BIT(3) 155 + #define AIC31XX_WCLK_MASTER BIT(2) 156 156 157 157 /* AIC31XX_DATA_OFFSET */ 158 158 #define AIC31XX_DATA_OFFSET_MASK GENMASK(7, 0)
+13 -14
sound/soc/codecs/tlv320aic32x4.c
··· 250 250 static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0); 251 251 /* -12dB min, 0.5dB steps */ 252 252 static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0); 253 - 254 - static DECLARE_TLV_DB_LINEAR(tlv_spk_vol, TLV_DB_GAIN_MUTE, 0); 253 + /* -6dB min, 1dB steps */ 254 + static DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0); 255 255 static DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1); 256 256 257 257 static const char * const lo_cm_text[] = { ··· 1063 1063 }; 1064 1064 1065 1065 static const struct snd_kcontrol_new aic32x4_tas2505_snd_controls[] = { 1066 - SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL, 1067 - AIC32X4_LDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm), 1066 + SOC_SINGLE_S8_TLV("PCM Playback Volume", 1067 + AIC32X4_LDACVOL, -0x7f, 0x30, tlv_pcm), 1068 1068 SOC_ENUM("DAC Playback PowerTune Switch", l_ptm_enum), 1069 - SOC_DOUBLE_R_S_TLV("HP Driver Playback Volume", AIC32X4_HPLGAIN, 1070 - AIC32X4_HPLGAIN, 0, -0x6, 0x1d, 5, 0, 1071 - tlv_driver_gain), 1072 - SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, 1073 - AIC32X4_HPLGAIN, 6, 0x01, 1), 1069 + 1070 + SOC_SINGLE_TLV("HP Driver Gain Volume", 1071 + AIC32X4_HPLGAIN, 0, 0x74, 1, tlv_tas_driver_gain), 1072 + SOC_SINGLE("HP DAC Playback Switch", AIC32X4_HPLGAIN, 6, 1, 1), 1073 + 1074 + SOC_SINGLE_TLV("Speaker Driver Playback Volume", 1075 + TAS2505_SPKVOL1, 0, 0x74, 1, tlv_tas_driver_gain), 1076 + SOC_SINGLE_TLV("Speaker Amplifier Playback Volume", 1077 + TAS2505_SPKVOL2, 4, 5, 0, tlv_amp_vol), 1074 1078 1075 1079 SOC_SINGLE("Auto-mute Switch", AIC32X4_DACMUTE, 4, 7, 0), 1076 - 1077 - SOC_SINGLE_RANGE_TLV("Speaker Driver Playback Volume", TAS2505_SPKVOL1, 1078 - 0, 0, 117, 1, tlv_spk_vol), 1079 - SOC_SINGLE_TLV("Speaker Amplifier Playback Volume", TAS2505_SPKVOL2, 1080 - 4, 5, 0, tlv_amp_vol), 1081 1080 }; 1082 1081 1083 1082 static const struct snd_kcontrol_new hp_output_mixer_controls[] = {
+9 -9
sound/soc/codecs/wcd938x.c
··· 3317 3317 (WCD938X_DIGITAL_INTR_LEVEL_0 + i), 0); 3318 3318 } 3319 3319 3320 - ret = wcd938x_irq_init(wcd938x, component->dev); 3321 - if (ret) { 3322 - dev_err(component->dev, "%s: IRQ init failed: %d\n", 3323 - __func__, ret); 3324 - return ret; 3325 - } 3326 - 3327 3320 wcd938x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, 3328 3321 WCD938X_IRQ_HPHR_PDM_WD_INT); 3329 3322 wcd938x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, ··· 3546 3553 } 3547 3554 wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev); 3548 3555 wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x; 3549 - wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq; 3550 3556 3551 3557 wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode); 3552 3558 if (!wcd938x->txdev) { ··· 3554 3562 } 3555 3563 wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev); 3556 3564 wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x; 3557 - wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq; 3558 3565 wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev); 3559 3566 if (!wcd938x->tx_sdw_dev) { 3560 3567 dev_err(dev, "could not get txslave with matching of dev\n"); ··· 3585 3594 dev_err(dev, "%s: tx csr regmap not found\n", __func__); 3586 3595 return PTR_ERR(wcd938x->regmap); 3587 3596 } 3597 + 3598 + ret = wcd938x_irq_init(wcd938x, dev); 3599 + if (ret) { 3600 + dev_err(dev, "%s: IRQ init failed: %d\n", __func__, ret); 3601 + return ret; 3602 + } 3603 + 3604 + wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq; 3605 + wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq; 3588 3606 3589 3607 ret = wcd938x_set_micbias_data(wcd938x); 3590 3608 if (ret < 0) {
+4 -2
sound/soc/codecs/wm_adsp.c
··· 282 282 /* 283 283 * HALO_CCM_CORE_CONTROL 284 284 */ 285 + #define HALO_CORE_RESET 0x00000200 285 286 #define HALO_CORE_EN 0x00000001 286 287 287 288 /* ··· 1214 1213 1215 1214 mutex_lock(&ctl->dsp->pwr_lock); 1216 1215 1217 - ret = wm_coeff_read_ctrl_raw(ctl, ctl->cache, size); 1216 + ret = wm_coeff_read_ctrl(ctl, ctl->cache, size); 1218 1217 1219 1218 if (!ret && copy_to_user(bytes, ctl->cache, size)) 1220 1219 ret = -EFAULT; ··· 3334 3333 { 3335 3334 return regmap_update_bits(dsp->regmap, 3336 3335 dsp->base + HALO_CCM_CORE_CONTROL, 3337 - HALO_CORE_EN, HALO_CORE_EN); 3336 + HALO_CORE_RESET | HALO_CORE_EN, 3337 + HALO_CORE_RESET | HALO_CORE_EN); 3338 3338 } 3339 3339 3340 3340 static void wm_halo_stop_core(struct wm_adsp *dsp)
+51 -26
sound/soc/intel/boards/sof_sdw_max98373.c
··· 55 55 return ret; 56 56 } 57 57 58 - static int max98373_sdw_trigger(struct snd_pcm_substream *substream, int cmd) 58 + static int mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable) 59 59 { 60 + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 61 + struct snd_soc_dai *codec_dai; 62 + struct snd_soc_dai *cpu_dai; 60 63 int ret; 64 + int j; 61 65 62 - switch (cmd) { 63 - case SNDRV_PCM_TRIGGER_START: 64 - case SNDRV_PCM_TRIGGER_RESUME: 65 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 66 - /* enable max98373 first */ 67 - ret = max_98373_trigger(substream, cmd); 68 - if (ret < 0) 69 - break; 66 + /* set spk pin by playback only */ 67 + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 68 + return 0; 70 69 71 - ret = sdw_trigger(substream, cmd); 72 - break; 73 - case SNDRV_PCM_TRIGGER_STOP: 74 - case SNDRV_PCM_TRIGGER_SUSPEND: 75 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 76 - ret = sdw_trigger(substream, cmd); 77 - if (ret < 0) 78 - break; 70 + cpu_dai = asoc_rtd_to_cpu(rtd, 0); 71 + for_each_rtd_codec_dais(rtd, j, codec_dai) { 72 + struct snd_soc_dapm_context *dapm = 73 + snd_soc_component_get_dapm(cpu_dai->component); 74 + char pin_name[16]; 79 75 80 - ret = max_98373_trigger(substream, cmd); 81 - break; 82 - default: 83 - ret = -EINVAL; 84 - break; 76 + snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk", 77 + codec_dai->component->name_prefix); 78 + 79 + if (enable) 80 + ret = snd_soc_dapm_enable_pin(dapm, pin_name); 81 + else 82 + ret = snd_soc_dapm_disable_pin(dapm, pin_name); 83 + 84 + if (!ret) 85 + snd_soc_dapm_sync(dapm); 85 86 } 86 87 87 - return ret; 88 + return 0; 89 + } 90 + 91 + static int mx8373_sdw_prepare(struct snd_pcm_substream *substream) 92 + { 93 + int ret = 0; 94 + 95 + /* according to soc_pcm_prepare dai link prepare is called first */ 96 + ret = sdw_prepare(substream); 97 + if (ret < 0) 98 + return ret; 99 + 100 + return mx8373_enable_spk_pin(substream, true); 101 + } 102 + 103 + static int mx8373_sdw_hw_free(struct snd_pcm_substream *substream) 104 + { 105 + int ret = 0; 106 + 107 + /* according to soc_pcm_hw_free dai link free is called first */ 108 + ret = sdw_hw_free(substream); 109 + if (ret < 0) 110 + return ret; 111 + 112 + return mx8373_enable_spk_pin(substream, false); 88 113 } 89 114 90 115 static const struct snd_soc_ops max_98373_sdw_ops = { 91 116 .startup = sdw_startup, 92 - .prepare = sdw_prepare, 93 - .trigger = max98373_sdw_trigger, 94 - .hw_free = sdw_hw_free, 117 + .prepare = mx8373_sdw_prepare, 118 + .trigger = sdw_trigger, 119 + .hw_free = mx8373_sdw_hw_free, 95 120 .shutdown = sdw_shutdown, 96 121 }; 97 122
+16 -6
sound/soc/soc-pcm.c
··· 1015 1015 1016 1016 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 1017 1017 { 1018 + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 1018 1019 int ret = -EINVAL, _ret = 0; 1019 1020 int rollback = 0; 1020 1021 ··· 1056 1055 case SNDRV_PCM_TRIGGER_STOP: 1057 1056 case SNDRV_PCM_TRIGGER_SUSPEND: 1058 1057 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1059 - ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1060 - if (ret < 0) 1061 - break; 1058 + if (rtd->dai_link->stop_dma_first) { 1059 + ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1060 + if (ret < 0) 1061 + break; 1062 1062 1063 - ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1064 - if (ret < 0) 1065 - break; 1063 + ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1064 + if (ret < 0) 1065 + break; 1066 + } else { 1067 + ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1068 + if (ret < 0) 1069 + break; 1066 1070 1071 + ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1072 + if (ret < 0) 1073 + break; 1074 + } 1067 1075 ret = snd_soc_link_trigger(substream, cmd, rollback); 1068 1076 break; 1069 1077 }
+1
sound/soc/sof/intel/pci-tgl.c
··· 89 89 static const struct sof_dev_desc adl_desc = { 90 90 .machines = snd_soc_acpi_intel_adl_machines, 91 91 .alt_machines = snd_soc_acpi_intel_adl_sdw_machines, 92 + .use_acpi_target_states = true, 92 93 .resindex_lpe_base = 0, 93 94 .resindex_pcicfg_base = -1, 94 95 .resindex_imr_base = -1,
+18 -12
sound/soc/tegra/tegra_pcm.c
··· 213 213 } 214 214 EXPORT_SYMBOL_GPL(tegra_pcm_pointer); 215 215 216 - static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream, 216 + static int tegra_pcm_preallocate_dma_buffer(struct device *dev, struct snd_pcm *pcm, int stream, 217 217 size_t size) 218 218 { 219 219 struct snd_pcm_substream *substream = pcm->streams[stream].substream; 220 220 struct snd_dma_buffer *buf = &substream->dma_buffer; 221 221 222 - buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL); 222 + buf->area = dma_alloc_wc(dev, size, &buf->addr, GFP_KERNEL); 223 223 if (!buf->area) 224 224 return -ENOMEM; 225 225 226 226 buf->private_data = NULL; 227 227 buf->dev.type = SNDRV_DMA_TYPE_DEV; 228 - buf->dev.dev = pcm->card->dev; 228 + buf->dev.dev = dev; 229 229 buf->bytes = size; 230 230 231 231 return 0; ··· 244 244 if (!buf->area) 245 245 return; 246 246 247 - dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr); 247 + dma_free_wc(buf->dev.dev, buf->bytes, buf->area, buf->addr); 248 248 buf->area = NULL; 249 249 } 250 250 251 - static int tegra_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, 251 + static int tegra_pcm_dma_allocate(struct device *dev, struct snd_soc_pcm_runtime *rtd, 252 252 size_t size) 253 253 { 254 - struct snd_card *card = rtd->card->snd_card; 255 254 struct snd_pcm *pcm = rtd->pcm; 256 255 int ret; 257 256 258 - ret = dma_set_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); 257 + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 259 258 if (ret < 0) 260 259 return ret; 261 260 262 261 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 263 - ret = tegra_pcm_preallocate_dma_buffer(pcm, 264 - SNDRV_PCM_STREAM_PLAYBACK, size); 262 + ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_PLAYBACK, size); 265 263 if (ret) 266 264 goto err; 267 265 } 268 266 269 267 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 270 - ret = tegra_pcm_preallocate_dma_buffer(pcm, 271 - SNDRV_PCM_STREAM_CAPTURE, size); 268 + ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_CAPTURE, size); 272 269 if (ret) 273 270 goto err_free_play; 274 271 } ··· 281 284 int tegra_pcm_construct(struct snd_soc_component *component, 282 285 struct snd_soc_pcm_runtime *rtd) 283 286 { 284 - return tegra_pcm_dma_allocate(rtd, tegra_pcm_hardware.buffer_bytes_max); 287 + struct device *dev = component->dev; 288 + 289 + /* 290 + * Fallback for backwards-compatibility with older device trees that 291 + * have the iommus property in the virtual, top-level "sound" node. 292 + */ 293 + if (!of_get_property(dev->of_node, "iommus", NULL)) 294 + dev = rtd->card->snd_card->dev; 295 + 296 + return tegra_pcm_dma_allocate(dev, rtd, tegra_pcm_hardware.buffer_bytes_max); 285 297 } 286 298 EXPORT_SYMBOL_GPL(tegra_pcm_construct); 287 299
+12 -6
sound/soc/ti/j721e-evm.c
··· 197 197 return ret; 198 198 } 199 199 200 - if (priv->hsdiv_rates[domain->parent_clk_id] != scki) { 200 + if (domain->parent_clk_id == -1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) { 201 201 dev_dbg(priv->dev, 202 202 "%s configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n", 203 203 audio_domain == J721E_AUDIO_DOMAIN_CPB ? "CPB" : "IVI", ··· 278 278 j721e_rule_rate, &priv->rate_range, 279 279 SNDRV_PCM_HW_PARAM_RATE, -1); 280 280 281 - mutex_unlock(&priv->mutex); 282 281 283 282 if (ret) 284 - return ret; 283 + goto out; 285 284 286 285 /* Reset TDM slots to 32 */ 287 286 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 32); 288 287 if (ret && ret != -ENOTSUPP) 289 - return ret; 288 + goto out; 290 289 291 290 for_each_rtd_codec_dais(rtd, i, codec_dai) { 292 291 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 2, 32); 293 292 if (ret && ret != -ENOTSUPP) 294 - return ret; 293 + goto out; 295 294 } 296 295 297 - return 0; 296 + if (ret == -ENOTSUPP) 297 + ret = 0; 298 + out: 299 + if (ret) 300 + domain->active--; 301 + mutex_unlock(&priv->mutex); 302 + 303 + return ret; 298 304 } 299 305 300 306 static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
+9 -1
sound/usb/mixer.c
··· 3295 3295 { 3296 3296 struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); 3297 3297 static const char * const val_types[] = { 3298 - "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32", 3298 + [USB_MIXER_BOOLEAN] = "BOOLEAN", 3299 + [USB_MIXER_INV_BOOLEAN] = "INV_BOOLEAN", 3300 + [USB_MIXER_S8] = "S8", 3301 + [USB_MIXER_U8] = "U8", 3302 + [USB_MIXER_S16] = "S16", 3303 + [USB_MIXER_U16] = "U16", 3304 + [USB_MIXER_S32] = "S32", 3305 + [USB_MIXER_U32] = "U32", 3306 + [USB_MIXER_BESPOKEN] = "BESPOKEN", 3299 3307 }; 3300 3308 snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " 3301 3309 "channels=%i, type=\"%s\"\n", cval->head.id,
+3
sound/usb/quirks.c
··· 1897 1897 REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ 1898 1898 REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ 1899 1899 REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ 1900 + REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ 1901 + REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ 1902 + REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ 1900 1903 { 0 } /* terminator */ 1901 1904 }; 1902 1905
+5
tools/bpf/bpftool/common.c
··· 222 222 int err = 0; 223 223 224 224 file = malloc(strlen(name) + 1); 225 + if (!file) { 226 + p_err("mem alloc failed"); 227 + return -1; 228 + } 229 + 225 230 strcpy(file, name); 226 231 dir = dirname(file); 227 232
+54 -1
tools/testing/selftests/net/nettest.c
··· 11 11 #include <sys/socket.h> 12 12 #include <sys/wait.h> 13 13 #include <linux/tcp.h> 14 + #include <linux/udp.h> 14 15 #include <arpa/inet.h> 15 16 #include <net/if.h> 16 17 #include <netinet/in.h> 18 + #include <netinet/ip.h> 17 19 #include <netdb.h> 18 20 #include <fcntl.h> 19 21 #include <libgen.h> ··· 28 26 #include <unistd.h> 29 27 #include <time.h> 30 28 #include <errno.h> 29 + 30 + #include <linux/xfrm.h> 31 + #include <linux/ipsec.h> 32 + #include <linux/pfkeyv2.h> 31 33 32 34 #ifndef IPV6_UNICAST_IF 33 35 #define IPV6_UNICAST_IF 76 ··· 120 114 struct in_addr in; 121 115 struct in6_addr in6; 122 116 } expected_raddr; 117 + 118 + /* ESP in UDP encap test */ 119 + int use_xfrm; 123 120 }; 124 121 125 122 static int server_mode; ··· 1355 1346 return 0; 1356 1347 } 1357 1348 1349 + static int config_xfrm_policy(int sd, struct sock_args *args) 1350 + { 1351 + struct xfrm_userpolicy_info policy = {}; 1352 + int type = UDP_ENCAP_ESPINUDP; 1353 + int xfrm_af = IP_XFRM_POLICY; 1354 + int level = SOL_IP; 1355 + 1356 + if (args->type != SOCK_DGRAM) { 1357 + log_error("Invalid socket type. Only DGRAM could be used for XFRM\n"); 1358 + return 1; 1359 + } 1360 + 1361 + policy.action = XFRM_POLICY_ALLOW; 1362 + policy.sel.family = args->version; 1363 + if (args->version == AF_INET6) { 1364 + xfrm_af = IPV6_XFRM_POLICY; 1365 + level = SOL_IPV6; 1366 + } 1367 + 1368 + policy.dir = XFRM_POLICY_OUT; 1369 + if (setsockopt(sd, level, xfrm_af, &policy, sizeof(policy)) < 0) 1370 + return 1; 1371 + 1372 + policy.dir = XFRM_POLICY_IN; 1373 + if (setsockopt(sd, level, xfrm_af, &policy, sizeof(policy)) < 0) 1374 + return 1; 1375 + 1376 + if (setsockopt(sd, IPPROTO_UDP, UDP_ENCAP, &type, sizeof(type)) < 0) { 1377 + log_err_errno("Failed to set xfrm encap"); 1378 + return 1; 1379 + } 1380 + 1381 + return 0; 1382 + } 1383 + 1358 1384 static int lsock_init(struct sock_args *args) 1359 1385 { 1360 1386 long flags; ··· 1432 1388 1433 1389 if (fcntl(sd, F_SETFD, FD_CLOEXEC) < 0) 1434 1390 log_err_errno("Failed to set close-on-exec flag"); 1391 + 1392 + if (args->use_xfrm && config_xfrm_policy(sd, args)) { 1393 + log_err_errno("Failed to set xfrm policy"); 1394 + goto err; 1395 + } 1435 1396 1436 1397 out: 1437 1398 return sd; ··· 1821 1772 return client_status; 1822 1773 } 1823 1774 1824 - #define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6L:0:1:2:3:Fbq" 1775 + #define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbq" 1825 1776 1826 1777 static void print_usage(char *prog) 1827 1778 { ··· 1844 1795 " -D|R datagram (D) / raw (R) socket (default stream)\n" 1845 1796 " -l addr local address to bind to in server mode\n" 1846 1797 " -c addr local address to bind to in client mode\n" 1798 + " -x configure XFRM policy on socket\n" 1847 1799 "\n" 1848 1800 " -d dev bind socket to given device name\n" 1849 1801 " -I dev bind socket to given device name - server mode\n" ··· 2015 1965 break; 2016 1966 case 'q': 2017 1967 quiet = 1; 1968 + break; 1969 + case 'x': 1970 + args.use_xfrm = 1; 2018 1971 break; 2019 1972 default: 2020 1973 print_usage(argv[0]);
+206 -6
tools/testing/selftests/net/pmtu.sh
··· 118 118 # below for IPv6 doesn't apply here, because, on IPv4, administrative MTU 119 119 # changes alone won't affect PMTU 120 120 # 121 + # - pmtu_vti4_udp_exception 122 + # Same as pmtu_vti4_exception, but using ESP-in-UDP 123 + # 124 + # - pmtu_vti4_udp_routed_exception 125 + # Set up vti tunnel on top of veth connected through routing namespace and 126 + # add xfrm states and policies with ESP-in-UDP encapsulation. Check that 127 + # route exception is not created if link layer MTU is not exceeded, then 128 + # lower MTU on second part of routed environment and check that exception 129 + # is created with the expected PMTU. 130 + # 121 131 # - pmtu_vti6_exception 122 132 # Set up vti6 tunnel on top of veth, with xfrm states and policies, in two 123 133 # namespaces with matching endpoints. Check that route exception is 124 134 # created by exceeding link layer MTU with ping to other endpoint. Then 125 135 # decrease and increase MTU of tunnel, checking that route exception PMTU 126 136 # changes accordingly 137 + # 138 + # - pmtu_vti6_udp_exception 139 + # Same as pmtu_vti6_exception, but using ESP-in-UDP 140 + # 141 + # - pmtu_vti6_udp_routed_exception 142 + # Same as pmtu_vti6_udp_routed_exception but with routing between vti 143 + # endpoints 127 144 # 128 145 # - pmtu_vti4_default_mtu 129 146 # Set up vti4 tunnel on top of veth, in two namespaces with matching ··· 241 224 pmtu_ipv6_ipv6_exception IPv6 over IPv6: PMTU exceptions 1 242 225 pmtu_vti6_exception vti6: PMTU exceptions 0 243 226 pmtu_vti4_exception vti4: PMTU exceptions 0 227 + pmtu_vti6_udp_exception vti6: PMTU exceptions (ESP-in-UDP) 0 228 + pmtu_vti4_udp_exception vti4: PMTU exceptions (ESP-in-UDP) 0 229 + pmtu_vti6_udp_routed_exception vti6: PMTU exceptions, routed (ESP-in-UDP) 0 230 + pmtu_vti4_udp_routed_exception vti4: PMTU exceptions, routed (ESP-in-UDP) 0 244 231 pmtu_vti4_default_mtu vti4: default MTU assignment 0 245 232 pmtu_vti6_default_mtu vti6: default MTU assignment 0 246 233 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation 0 ··· 267 246 ns_c="ip netns exec ${NS_C}" 268 247 ns_r1="ip netns exec ${NS_R1}" 269 248 ns_r2="ip netns exec ${NS_R2}" 270 - 271 249 # Addressing and routing for tests with routers: four network segments, with 272 250 # index SEGMENT between 1 and 4, a common prefix (PREFIX4 or PREFIX6) and an 273 251 # identifier ID, which is 1 for hosts (A and B), 2 for routers (R1 and R2). ··· 299 279 A ${prefix6}:${b_r2}::1 ${prefix6}:${a_r2}::2 300 280 B default ${prefix6}:${b_r1}::2 301 281 " 302 - 303 282 USE_NH="no" 304 283 # ns family nh id destination gateway 305 284 nexthops=" ··· 345 326 346 327 err_buf= 347 328 tcpdump_pids= 329 + nettest_pids= 348 330 349 331 err() { 350 332 err_buf="${err_buf}${1} ··· 568 548 setup_vti 6 ${veth6_a_addr} ${veth6_b_addr} ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask} 569 549 } 570 550 551 + setup_vti4routed() { 552 + setup_vti 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 ${tunnel4_a_addr} ${tunnel4_b_addr} ${tunnel4_mask} 553 + } 554 + 555 + setup_vti6routed() { 556 + setup_vti 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask} 557 + } 558 + 571 559 setup_vxlan_or_geneve() { 572 560 type="${1}" 573 561 a_addr="${2}" ··· 647 619 proto=${1} 648 620 veth_a_addr="${2}" 649 621 veth_b_addr="${3}" 622 + encap=${4} 650 623 651 - run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel || return 1 652 - run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel 624 + run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap} || return 1 625 + run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap} 653 626 run_cmd ${ns_a} ip -${proto} xfrm policy add dir out mark 10 tmpl src ${veth_a_addr} dst ${veth_b_addr} proto esp mode tunnel 654 627 run_cmd ${ns_a} ip -${proto} xfrm policy add dir in mark 10 tmpl src ${veth_b_addr} dst ${veth_a_addr} proto esp mode tunnel 655 628 656 - run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel 657 - run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel 629 + run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap} 630 + run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap} 658 631 run_cmd ${ns_b} ip -${proto} xfrm policy add dir out mark 10 tmpl src ${veth_b_addr} dst ${veth_a_addr} proto esp mode tunnel 659 632 run_cmd ${ns_b} ip -${proto} xfrm policy add dir in mark 10 tmpl src ${veth_a_addr} dst ${veth_b_addr} proto esp mode tunnel 633 + } 634 + 635 + setup_nettest_xfrm() { 636 + which nettest >/dev/null 637 + if [ $? -ne 0 ]; then 638 + echo "'nettest' command not found; skipping tests" 639 + return 1 640 + fi 641 + 642 + [ ${1} -eq 6 ] && proto="-6" || proto="" 643 + port=${2} 644 + 645 + run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 & 646 + nettest_pids="${nettest_pids} $!" 647 + 648 + run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 & 649 + nettest_pids="${nettest_pids} $!" 660 650 } 661 651 662 652 setup_xfrm4() { ··· 683 637 684 638 setup_xfrm6() { 685 639 setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} 640 + } 641 + 642 + setup_xfrm4udp() { 643 + setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0" 644 + setup_nettest_xfrm 4 4500 645 + } 646 + 647 + setup_xfrm6udp() { 648 + setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0" 649 + setup_nettest_xfrm 6 4500 650 + } 651 + 652 + setup_xfrm4udprouted() { 653 + setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0" 654 + setup_nettest_xfrm 4 4500 655 + } 656 + 657 + setup_xfrm6udprouted() { 658 + setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0" 659 + setup_nettest_xfrm 6 4500 686 660 } 687 661 688 662 setup_routing_old() { ··· 888 822 kill ${pid} 889 823 done 890 824 tcpdump_pids= 825 + 826 + for pid in ${nettest_pids}; do 827 + kill ${pid} 828 + done 829 + nettest_pids= 891 830 892 831 for n in ${NS_A} ${NS_B} ${NS_C} ${NS_R1} ${NS_R2}; do 893 832 ip netns del ${n} 2> /dev/null ··· 1501 1430 check_pmtu_value "9000" "${pmtu}" "increasing tunnel MTU" || fail=1 1502 1431 1503 1432 return ${fail} 1433 + } 1434 + 1435 + test_pmtu_vti4_udp_exception() { 1436 + setup namespaces veth vti4 xfrm4udp || return $ksft_skip 1437 + trace "${ns_a}" veth_a "${ns_b}" veth_b \ 1438 + "${ns_a}" vti4_a "${ns_b}" vti4_b 1439 + 1440 + veth_mtu=1500 1441 + vti_mtu=$((veth_mtu - 20)) 1442 + 1443 + # UDP SPI SN IV ICV pad length next header 1444 + esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1)) 1445 + ping_payload=$((esp_payload_rfc4106 - 28)) 1446 + 1447 + mtu "${ns_a}" veth_a ${veth_mtu} 1448 + mtu "${ns_b}" veth_b ${veth_mtu} 1449 + mtu "${ns_a}" vti4_a ${vti_mtu} 1450 + mtu "${ns_b}" vti4_b ${vti_mtu} 1451 + 1452 + # Send DF packet without exceeding link layer MTU, check that no 1453 + # exception is created 1454 + run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr} 1455 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})" 1456 + check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1 1457 + 1458 + # Now exceed link layer MTU by one byte, check that exception is created 1459 + # with the right PMTU value 1460 + run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload + 1)) ${tunnel4_b_addr} 1461 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})" 1462 + check_pmtu_value "${esp_payload_rfc4106}" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106 + 1)))" 1463 + } 1464 + 1465 + test_pmtu_vti6_udp_exception() { 1466 + setup namespaces veth vti6 xfrm6udp || return $ksft_skip 1467 + trace "${ns_a}" veth_a "${ns_b}" veth_b \ 1468 + "${ns_a}" vti6_a "${ns_b}" vti6_b 1469 + fail=0 1470 + 1471 + # Create route exception by exceeding link layer MTU 1472 + mtu "${ns_a}" veth_a 4000 1473 + mtu "${ns_b}" veth_b 4000 1474 + mtu "${ns_a}" vti6_a 5000 1475 + mtu "${ns_b}" vti6_b 5000 1476 + run_cmd ${ns_a} ${ping6} -q -i 0.1 -w 1 -s 60000 ${tunnel6_b_addr} 1477 + 1478 + # Check that exception was created 1479 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" 1480 + check_pmtu_value any "${pmtu}" "creating tunnel exceeding link layer MTU" || return 1 1481 + 1482 + # Decrease tunnel MTU, check for PMTU decrease in route exception 1483 + mtu "${ns_a}" vti6_a 3000 1484 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" 1485 + check_pmtu_value "3000" "${pmtu}" "decreasing tunnel MTU" || fail=1 1486 + 1487 + # Increase tunnel MTU, check for PMTU increase in route exception 1488 + mtu "${ns_a}" vti6_a 9000 1489 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" 1490 + check_pmtu_value "9000" "${pmtu}" "increasing tunnel MTU" || fail=1 1491 + 1492 + return ${fail} 1493 + } 1494 + 1495 + test_pmtu_vti4_udp_routed_exception() { 1496 + setup namespaces routing vti4routed xfrm4udprouted || return $ksft_skip 1497 + trace "${ns_a}" veth_A-R1 "${ns_b}" veth_B-R1 \ 1498 + "${ns_a}" vti4_a "${ns_b}" vti4_b 1499 + 1500 + veth_mtu=1500 1501 + vti_mtu=$((veth_mtu - 20)) 1502 + 1503 + # UDP SPI SN IV ICV pad length next header 1504 + esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1)) 1505 + ping_payload=$((esp_payload_rfc4106 - 28)) 1506 + 1507 + mtu "${ns_a}" veth_A-R1 ${veth_mtu} 1508 + mtu "${ns_r1}" veth_R1-A ${veth_mtu} 1509 + mtu "${ns_b}" veth_B-R1 ${veth_mtu} 1510 + mtu "${ns_r1}" veth_R1-B ${veth_mtu} 1511 + 1512 + mtu "${ns_a}" vti4_a ${vti_mtu} 1513 + mtu "${ns_b}" vti4_b ${vti_mtu} 1514 + 1515 + # Send DF packet without exceeding link layer MTU, check that no 1516 + # exception is created 1517 + run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr} 1518 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})" 1519 + check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1 1520 + 1521 + # Now decrease link layer MTU by 8 bytes on R1, check that exception is created 1522 + # with the right PMTU value 1523 + mtu "${ns_r1}" veth_R1-B $((veth_mtu - 8)) 1524 + run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload)) ${tunnel4_b_addr} 1525 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})" 1526 + check_pmtu_value "$((esp_payload_rfc4106 - 8))" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106)))" 1527 + } 1528 + 1529 + test_pmtu_vti6_udp_routed_exception() { 1530 + setup namespaces routing vti6routed xfrm6udprouted || return $ksft_skip 1531 + trace "${ns_a}" veth_A-R1 "${ns_b}" veth_B-R1 \ 1532 + "${ns_a}" vti6_a "${ns_b}" vti6_b 1533 + 1534 + veth_mtu=1500 1535 + vti_mtu=$((veth_mtu - 40)) 1536 + 1537 + # UDP SPI SN IV ICV pad length next header 1538 + esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1)) 1539 + ping_payload=$((esp_payload_rfc4106 - 48)) 1540 + 1541 + mtu "${ns_a}" veth_A-R1 ${veth_mtu} 1542 + mtu "${ns_r1}" veth_R1-A ${veth_mtu} 1543 + mtu "${ns_b}" veth_B-R1 ${veth_mtu} 1544 + mtu "${ns_r1}" veth_R1-B ${veth_mtu} 1545 + 1546 + # mtu "${ns_a}" vti6_a ${vti_mtu} 1547 + # mtu "${ns_b}" vti6_b ${vti_mtu} 1548 + 1549 + run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel6_b_addr} 1550 + 1551 + # Check that exception was not created 1552 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" 1553 + check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1 1554 + 1555 + # Now decrease link layer MTU by 8 bytes on R1, check that exception is created 1556 + # with the right PMTU value 1557 + mtu "${ns_r1}" veth_R1-B $((veth_mtu - 8)) 1558 + run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s $((ping_payload)) ${tunnel6_b_addr} 1559 + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})" 1560 + check_pmtu_value "$((esp_payload_rfc4106 - 8))" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106)))" 1561 + 1504 1562 } 1505 1563 1506 1564 test_pmtu_vti4_default_mtu() {
+4 -2
tools/testing/selftests/vm/userfaultfd.c
··· 210 210 211 211 static void anon_allocate_area(void **alloc_area) 212 212 { 213 - if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) 214 - err("posix_memalign() failed"); 213 + *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 214 + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); 215 + if (*alloc_area == MAP_FAILED) 216 + err("mmap of anonymous memory failed"); 215 217 } 216 218 217 219 static void noop_alias_mapping(__u64 *start, size_t len, unsigned long offset)