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

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

+3142 -1196
+1
.mailmap
··· 159 159 Peter Oruba <peter.oruba@amd.com> 160 160 Pratyush Anand <pratyush.anand@gmail.com> <pratyush.anand@st.com> 161 161 Praveen BP <praveenbp@ti.com> 162 + Punit Agrawal <punitagrawal@gmail.com> <punit.agrawal@arm.com> 162 163 Qais Yousef <qsyousef@gmail.com> <qais.yousef@imgtec.com> 163 164 Oleksij Rempel <linux@rempel-privat.de> <bug-track@fisher-privat.net> 164 165 Oleksij Rempel <linux@rempel-privat.de> <external.Oleksij.Rempel@de.bosch.com>
+2 -2
Documentation/ABI/testing/sysfs-class-led-trigger-pattern
··· 37 37 0-| / \/ \/ 38 38 +---0----1----2----3----4----5----6------------> time (s) 39 39 40 - 2. To make the LED go instantly from one brigntess value to another, 41 - we should use use zero-time lengths (the brightness must be same as 40 + 2. To make the LED go instantly from one brightness value to another, 41 + we should use zero-time lengths (the brightness must be same as 42 42 the previous tuple's). So the format should be: 43 43 "brightness_1 duration_1 brightness_1 0 brightness_2 duration_2 44 44 brightness_2 0 ...". For example:
+1 -1
Documentation/devicetree/bindings/arm/shmobile.txt
··· 27 27 compatible = "renesas,r8a77470" 28 28 - RZ/G2M (R8A774A1) 29 29 compatible = "renesas,r8a774a1" 30 - - RZ/G2E (RA8774C0) 30 + - RZ/G2E (R8A774C0) 31 31 compatible = "renesas,r8a774c0" 32 32 - R-Car M1A (R8A77781) 33 33 compatible = "renesas,r8a7778"
+6 -2
Documentation/devicetree/bindings/i2c/i2c-omap.txt
··· 1 1 I2C for OMAP platforms 2 2 3 3 Required properties : 4 - - compatible : Must be "ti,omap2420-i2c", "ti,omap2430-i2c", "ti,omap3-i2c" 5 - or "ti,omap4-i2c" 4 + - compatible : Must be 5 + "ti,omap2420-i2c" for OMAP2420 SoCs 6 + "ti,omap2430-i2c" for OMAP2430 SoCs 7 + "ti,omap3-i2c" for OMAP3 SoCs 8 + "ti,omap4-i2c" for OMAP4+ SoCs 9 + "ti,am654-i2c", "ti,omap4-i2c" for AM654 SoCs 6 10 - ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) 7 11 - #address-cells = <1>; 8 12 - #size-cells = <0>;
+18
Documentation/i2c/busses/i2c-nvidia-gpu
··· 1 + Kernel driver i2c-nvidia-gpu 2 + 3 + Datasheet: not publicly available. 4 + 5 + Authors: 6 + Ajay Gupta <ajayg@nvidia.com> 7 + 8 + Description 9 + ----------- 10 + 11 + i2c-nvidia-gpu is a driver for I2C controller included in NVIDIA Turing 12 + and later GPUs and it is used to communicate with Type-C controller on GPUs. 13 + 14 + If your 'lspci -v' listing shows something like the following, 15 + 16 + 01:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad9 (rev a1) 17 + 18 + then this driver should support the I2C controller of your GPU.
+18 -16
Documentation/x86/x86_64/mm.txt
··· 34 34 ____________________________________________________________|___________________________________________________________ 35 35 | | | | 36 36 ffff800000000000 | -128 TB | ffff87ffffffffff | 8 TB | ... guard hole, also reserved for hypervisor 37 - ffff880000000000 | -120 TB | ffffc7ffffffffff | 64 TB | direct mapping of all physical memory (page_offset_base) 38 - ffffc80000000000 | -56 TB | ffffc8ffffffffff | 1 TB | ... unused hole 37 + ffff880000000000 | -120 TB | ffff887fffffffff | 0.5 TB | LDT remap for PTI 38 + ffff888000000000 | -119.5 TB | ffffc87fffffffff | 64 TB | direct mapping of all physical memory (page_offset_base) 39 + ffffc88000000000 | -55.5 TB | ffffc8ffffffffff | 0.5 TB | ... unused hole 39 40 ffffc90000000000 | -55 TB | ffffe8ffffffffff | 32 TB | vmalloc/ioremap space (vmalloc_base) 40 41 ffffe90000000000 | -23 TB | ffffe9ffffffffff | 1 TB | ... unused hole 41 42 ffffea0000000000 | -22 TB | ffffeaffffffffff | 1 TB | virtual memory map (vmemmap_base) 42 43 ffffeb0000000000 | -21 TB | ffffebffffffffff | 1 TB | ... unused hole 43 44 ffffec0000000000 | -20 TB | fffffbffffffffff | 16 TB | KASAN shadow memory 45 + __________________|____________|__________________|_________|____________________________________________________________ 46 + | 47 + | Identical layout to the 56-bit one from here on: 48 + ____________________________________________________________|____________________________________________________________ 49 + | | | | 44 50 fffffc0000000000 | -4 TB | fffffdffffffffff | 2 TB | ... unused hole 45 51 | | | | vaddr_end for KASLR 46 52 fffffe0000000000 | -2 TB | fffffe7fffffffff | 0.5 TB | cpu_entry_area mapping 47 - fffffe8000000000 | -1.5 TB | fffffeffffffffff | 0.5 TB | LDT remap for PTI 53 + fffffe8000000000 | -1.5 TB | fffffeffffffffff | 0.5 TB | ... unused hole 48 54 ffffff0000000000 | -1 TB | ffffff7fffffffff | 0.5 TB | %esp fixup stacks 49 - __________________|____________|__________________|_________|____________________________________________________________ 50 - | 51 - | Identical layout to the 47-bit one from here on: 52 - ____________________________________________________________|____________________________________________________________ 53 - | | | | 54 55 ffffff8000000000 | -512 GB | ffffffeeffffffff | 444 GB | ... unused hole 55 56 ffffffef00000000 | -68 GB | fffffffeffffffff | 64 GB | EFI region mapping space 56 57 ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | ... unused hole ··· 84 83 __________________|____________|__________________|_________|___________________________________________________________ 85 84 | | | | 86 85 0000800000000000 | +64 PB | ffff7fffffffffff | ~16K PB | ... huge, still almost 64 bits wide hole of non-canonical 87 - | | | | virtual memory addresses up to the -128 TB 86 + | | | | virtual memory addresses up to the -64 PB 88 87 | | | | starting offset of kernel mappings. 89 88 __________________|____________|__________________|_________|___________________________________________________________ 90 89 | ··· 92 91 ____________________________________________________________|___________________________________________________________ 93 92 | | | | 94 93 ff00000000000000 | -64 PB | ff0fffffffffffff | 4 PB | ... guard hole, also reserved for hypervisor 95 - ff10000000000000 | -60 PB | ff8fffffffffffff | 32 PB | direct mapping of all physical memory (page_offset_base) 96 - ff90000000000000 | -28 PB | ff9fffffffffffff | 4 PB | LDT remap for PTI 94 + ff10000000000000 | -60 PB | ff10ffffffffffff | 0.25 PB | LDT remap for PTI 95 + ff11000000000000 | -59.75 PB | ff90ffffffffffff | 32 PB | direct mapping of all physical memory (page_offset_base) 96 + ff91000000000000 | -27.75 PB | ff9fffffffffffff | 3.75 PB | ... unused hole 97 97 ffa0000000000000 | -24 PB | ffd1ffffffffffff | 12.5 PB | vmalloc/ioremap space (vmalloc_base) 98 98 ffd2000000000000 | -11.5 PB | ffd3ffffffffffff | 0.5 PB | ... unused hole 99 99 ffd4000000000000 | -11 PB | ffd5ffffffffffff | 0.5 PB | virtual memory map (vmemmap_base) 100 100 ffd6000000000000 | -10.5 PB | ffdeffffffffffff | 2.25 PB | ... unused hole 101 101 ffdf000000000000 | -8.25 PB | fffffdffffffffff | ~8 PB | KASAN shadow memory 102 - fffffc0000000000 | -4 TB | fffffdffffffffff | 2 TB | ... unused hole 103 - | | | | vaddr_end for KASLR 104 - fffffe0000000000 | -2 TB | fffffe7fffffffff | 0.5 TB | cpu_entry_area mapping 105 - fffffe8000000000 | -1.5 TB | fffffeffffffffff | 0.5 TB | ... unused hole 106 - ffffff0000000000 | -1 TB | ffffff7fffffffff | 0.5 TB | %esp fixup stacks 107 102 __________________|____________|__________________|_________|____________________________________________________________ 108 103 | 109 104 | Identical layout to the 47-bit one from here on: 110 105 ____________________________________________________________|____________________________________________________________ 111 106 | | | | 107 + fffffc0000000000 | -4 TB | fffffdffffffffff | 2 TB | ... unused hole 108 + | | | | vaddr_end for KASLR 109 + fffffe0000000000 | -2 TB | fffffe7fffffffff | 0.5 TB | cpu_entry_area mapping 110 + fffffe8000000000 | -1.5 TB | fffffeffffffffff | 0.5 TB | ... unused hole 111 + ffffff0000000000 | -1 TB | ffffff7fffffffff | 0.5 TB | %esp fixup stacks 112 112 ffffff8000000000 | -512 GB | ffffffeeffffffff | 444 GB | ... unused hole 113 113 ffffffef00000000 | -68 GB | fffffffeffffffff | 64 GB | EFI region mapping space 114 114 ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | ... unused hole
+1 -1
Documentation/x86/zero-page.txt
··· 25 25 0C8/004 ALL ext_cmd_line_ptr cmd_line_ptr high 32bits 26 26 140/080 ALL edid_info Video mode setup (struct edid_info) 27 27 1C0/020 ALL efi_info EFI 32 information (struct efi_info) 28 - 1E0/004 ALL alk_mem_k Alternative mem check, in KB 28 + 1E0/004 ALL alt_mem_k Alternative mem check, in KB 29 29 1E4/004 ALL scratch Scratch field for the kernel setup code 30 30 1E8/001 ALL e820_entries Number of entries in e820_table (below) 31 31 1E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
+22 -7
MAINTAINERS
··· 6607 6607 6608 6608 HID CORE LAYER 6609 6609 M: Jiri Kosina <jikos@kernel.org> 6610 - R: Benjamin Tissoires <benjamin.tissoires@redhat.com> 6610 + M: Benjamin Tissoires <benjamin.tissoires@redhat.com> 6611 6611 L: linux-input@vger.kernel.org 6612 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git 6612 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git 6613 6613 S: Maintained 6614 6614 F: drivers/hid/ 6615 6615 F: include/linux/hid* ··· 6860 6860 L: linux-acpi@vger.kernel.org 6861 6861 S: Maintained 6862 6862 F: drivers/i2c/i2c-core-acpi.c 6863 + 6864 + I2C CONTROLLER DRIVER FOR NVIDIA GPU 6865 + M: Ajay Gupta <ajayg@nvidia.com> 6866 + L: linux-i2c@vger.kernel.org 6867 + S: Maintained 6868 + F: Documentation/i2c/busses/i2c-nvidia-gpu 6869 + F: drivers/i2c/busses/i2c-nvidia-gpu.c 6863 6870 6864 6871 I2C MUXES 6865 6872 M: Peter Rosin <peda@axentia.se> ··· 8367 8360 LIBATA PATA ARASAN COMPACT FLASH CONTROLLER 8368 8361 M: Viresh Kumar <vireshk@kernel.org> 8369 8362 L: linux-ide@vger.kernel.org 8370 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git 8363 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 8371 8364 S: Maintained 8372 8365 F: include/linux/pata_arasan_cf_data.h 8373 8366 F: drivers/ata/pata_arasan_cf.c ··· 8384 8377 LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS 8385 8378 M: Linus Walleij <linus.walleij@linaro.org> 8386 8379 L: linux-ide@vger.kernel.org 8387 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git 8380 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 8388 8381 S: Maintained 8389 8382 F: drivers/ata/pata_ftide010.c 8390 8383 F: drivers/ata/sata_gemini.c ··· 8403 8396 LIBATA SATA PROMISE TX2/TX4 CONTROLLER DRIVER 8404 8397 M: Mikael Pettersson <mikpelinux@gmail.com> 8405 8398 L: linux-ide@vger.kernel.org 8406 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git 8399 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 8407 8400 S: Maintained 8408 8401 F: drivers/ata/sata_promise.* 8409 8402 ··· 10783 10776 L: linux-omap@vger.kernel.org 10784 10777 S: Maintained 10785 10778 F: arch/arm/mach-omap2/omap_hwmod.* 10779 + 10780 + OMAP I2C DRIVER 10781 + M: Vignesh R <vigneshr@ti.com> 10782 + L: linux-omap@vger.kernel.org 10783 + L: linux-i2c@vger.kernel.org 10784 + S: Maintained 10785 + F: Documentation/devicetree/bindings/i2c/i2c-omap.txt 10786 + F: drivers/i2c/busses/i2c-omap.c 10786 10787 10787 10788 OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS) 10788 10789 M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> ··· 15444 15429 15445 15430 USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 15446 15431 M: Jiri Kosina <jikos@kernel.org> 15447 - R: Benjamin Tissoires <benjamin.tissoires@redhat.com> 15432 + M: Benjamin Tissoires <benjamin.tissoires@redhat.com> 15448 15433 L: linux-usb@vger.kernel.org 15449 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git 15434 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git 15450 15435 S: Maintained 15451 15436 F: Documentation/hid/hiddev.txt 15452 15437 F: drivers/hid/usbhid/
+1 -1
Makefile
··· 2 2 VERSION = 4 3 3 PATCHLEVEL = 20 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = "People's Front" 7 7 8 8 # *DOCUMENTATION*
+7 -1
arch/alpha/include/asm/termios.h
··· 73 73 }) 74 74 75 75 #define user_termios_to_kernel_termios(k, u) \ 76 - copy_from_user(k, u, sizeof(struct termios)) 76 + copy_from_user(k, u, sizeof(struct termios2)) 77 77 78 78 #define kernel_termios_to_user_termios(u, k) \ 79 + copy_to_user(u, k, sizeof(struct termios2)) 80 + 81 + #define user_termios_to_kernel_termios_1(k, u) \ 82 + copy_from_user(k, u, sizeof(struct termios)) 83 + 84 + #define kernel_termios_to_user_termios_1(u, k) \ 79 85 copy_to_user(u, k, sizeof(struct termios)) 80 86 81 87 #endif /* _ALPHA_TERMIOS_H */
+5
arch/alpha/include/uapi/asm/ioctls.h
··· 32 32 #define TCXONC _IO('t', 30) 33 33 #define TCFLSH _IO('t', 31) 34 34 35 + #define TCGETS2 _IOR('T', 42, struct termios2) 36 + #define TCSETS2 _IOW('T', 43, struct termios2) 37 + #define TCSETSW2 _IOW('T', 44, struct termios2) 38 + #define TCSETSF2 _IOW('T', 45, struct termios2) 39 + 35 40 #define TIOCSWINSZ _IOW('t', 103, struct winsize) 36 41 #define TIOCGWINSZ _IOR('t', 104, struct winsize) 37 42 #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
+17
arch/alpha/include/uapi/asm/termbits.h
··· 26 26 speed_t c_ospeed; /* output speed */ 27 27 }; 28 28 29 + /* Alpha has identical termios and termios2 */ 30 + 31 + struct termios2 { 32 + tcflag_t c_iflag; /* input mode flags */ 33 + tcflag_t c_oflag; /* output mode flags */ 34 + tcflag_t c_cflag; /* control mode flags */ 35 + tcflag_t c_lflag; /* local mode flags */ 36 + cc_t c_cc[NCCS]; /* control characters */ 37 + cc_t c_line; /* line discipline (== c_cc[19]) */ 38 + speed_t c_ispeed; /* input speed */ 39 + speed_t c_ospeed; /* output speed */ 40 + }; 41 + 29 42 /* Alpha has matching termios and ktermios */ 30 43 31 44 struct ktermios { ··· 165 152 #define B3000000 00034 166 153 #define B3500000 00035 167 154 #define B4000000 00036 155 + #define BOTHER 00037 168 156 169 157 #define CSIZE 00001400 170 158 #define CS5 00000000 ··· 182 168 #define CLOCAL 00100000 183 169 #define CMSPAR 010000000000 /* mark or space (stick) parity */ 184 170 #define CRTSCTS 020000000000 /* flow control */ 171 + 172 + #define CIBAUD 07600000 173 + #define IBSHIFT 16 185 174 186 175 /* c_lflag bits */ 187 176 #define ISIG 0x00000080
+1 -1
arch/arm/boot/dts/imx53-ppd.dts
··· 55 55 }; 56 56 57 57 chosen { 58 - stdout-path = "&uart1:115200n8"; 58 + stdout-path = "serial0:115200n8"; 59 59 }; 60 60 61 61 memory@70000000 {
+1 -1
arch/arm/boot/dts/imx6sll.dtsi
··· 740 740 i2c1: i2c@21a0000 { 741 741 #address-cells = <1>; 742 742 #size-cells = <0>; 743 - compatible = "fs,imx6sll-i2c", "fsl,imx21-i2c"; 743 + compatible = "fsl,imx6sll-i2c", "fsl,imx21-i2c"; 744 744 reg = <0x021a0000 0x4000>; 745 745 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 746 746 clocks = <&clks IMX6SLL_CLK_I2C1>;
+6 -1
arch/arm/boot/dts/imx6sx-sdb.dtsi
··· 117 117 regulator-name = "enet_3v3"; 118 118 regulator-min-microvolt = <3300000>; 119 119 regulator-max-microvolt = <3300000>; 120 - gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; 120 + gpio = <&gpio2 6 GPIO_ACTIVE_LOW>; 121 + regulator-boot-on; 122 + regulator-always-on; 121 123 }; 122 124 123 125 reg_pcie_gpio: regulator-pcie-gpio { ··· 182 180 phy-supply = <&reg_enet_3v3>; 183 181 phy-mode = "rgmii"; 184 182 phy-handle = <&ethphy1>; 183 + phy-reset-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>; 185 184 status = "okay"; 186 185 187 186 mdio { ··· 376 373 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081 377 374 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081 378 375 MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M 0x91 376 + /* phy reset */ 377 + MX6SX_PAD_ENET2_CRS__GPIO2_IO_7 0x10b0 379 378 >; 380 379 }; 381 380
+2 -2
arch/arm/boot/dts/vf610m4-colibri.dts
··· 50 50 compatible = "fsl,vf610m4"; 51 51 52 52 chosen { 53 - bootargs = "console=ttyLP2,115200 clk_ignore_unused init=/linuxrc rw"; 54 - stdout-path = "&uart2"; 53 + bootargs = "clk_ignore_unused init=/linuxrc rw"; 54 + stdout-path = "serial2:115200"; 55 55 }; 56 56 57 57 memory@8c000000 {
-1
arch/arm/configs/multi_v7_defconfig
··· 1 1 CONFIG_SYSVIPC=y 2 2 CONFIG_NO_HZ=y 3 3 CONFIG_HIGH_RES_TIMERS=y 4 - CONFIG_PREEMPT=y 5 4 CONFIG_CGROUPS=y 6 5 CONFIG_BLK_DEV_INITRD=y 7 6 CONFIG_EMBEDDED=y
+1 -1
arch/arm/include/asm/pgtable-2level.h
··· 10 10 #ifndef _ASM_PGTABLE_2LEVEL_H 11 11 #define _ASM_PGTABLE_2LEVEL_H 12 12 13 - #define __PAGETABLE_PMD_FOLDED 13 + #define __PAGETABLE_PMD_FOLDED 1 14 14 15 15 /* 16 16 * Hardware-wise, we have a two level page table structure, where the first
+3
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
··· 139 139 clock-names = "stmmaceth"; 140 140 tx-fifo-depth = <16384>; 141 141 rx-fifo-depth = <16384>; 142 + snps,multicast-filter-bins = <256>; 142 143 status = "disabled"; 143 144 }; 144 145 ··· 155 154 clock-names = "stmmaceth"; 156 155 tx-fifo-depth = <16384>; 157 156 rx-fifo-depth = <16384>; 157 + snps,multicast-filter-bins = <256>; 158 158 status = "disabled"; 159 159 }; 160 160 ··· 171 169 clock-names = "stmmaceth"; 172 170 tx-fifo-depth = <16384>; 173 171 rx-fifo-depth = <16384>; 172 + snps,multicast-filter-bins = <256>; 174 173 status = "disabled"; 175 174 }; 176 175
+1 -1
arch/arm64/boot/dts/renesas/r8a7795.dtsi
··· 652 652 clock-names = "fck", "brg_int", "scif_clk"; 653 653 dmas = <&dmac1 0x35>, <&dmac1 0x34>, 654 654 <&dmac2 0x35>, <&dmac2 0x34>; 655 - dma-names = "tx", "rx"; 655 + dma-names = "tx", "rx", "tx", "rx"; 656 656 power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 657 657 resets = <&cpg 518>; 658 658 status = "disabled";
+24 -23
arch/arm64/boot/dts/renesas/r8a77980-condor.dts
··· 15 15 16 16 aliases { 17 17 serial0 = &scif0; 18 - ethernet0 = &avb; 18 + ethernet0 = &gether; 19 19 }; 20 20 21 21 chosen { ··· 97 97 }; 98 98 }; 99 99 100 - &avb { 101 - pinctrl-0 = <&avb_pins>; 102 - pinctrl-names = "default"; 103 - 104 - phy-mode = "rgmii-id"; 105 - phy-handle = <&phy0>; 106 - renesas,no-ether-link; 107 - status = "okay"; 108 - 109 - phy0: ethernet-phy@0 { 110 - rxc-skew-ps = <1500>; 111 - reg = <0>; 112 - interrupt-parent = <&gpio1>; 113 - interrupts = <17 IRQ_TYPE_LEVEL_LOW>; 114 - }; 115 - }; 116 - 117 100 &canfd { 118 101 pinctrl-0 = <&canfd0_pins>; 119 102 pinctrl-names = "default"; ··· 120 137 121 138 &extalr_clk { 122 139 clock-frequency = <32768>; 140 + }; 141 + 142 + &gether { 143 + pinctrl-0 = <&gether_pins>; 144 + pinctrl-names = "default"; 145 + 146 + phy-mode = "rgmii-id"; 147 + phy-handle = <&phy0>; 148 + renesas,no-ether-link; 149 + status = "okay"; 150 + 151 + phy0: ethernet-phy@0 { 152 + rxc-skew-ps = <1500>; 153 + reg = <0>; 154 + interrupt-parent = <&gpio4>; 155 + interrupts = <23 IRQ_TYPE_LEVEL_LOW>; 156 + }; 123 157 }; 124 158 125 159 &i2c0 { ··· 236 236 }; 237 237 238 238 &pfc { 239 - avb_pins: avb { 240 - groups = "avb_mdio", "avb_rgmii"; 241 - function = "avb"; 242 - }; 243 - 244 239 canfd0_pins: canfd0 { 245 240 groups = "canfd0_data_a"; 246 241 function = "canfd0"; 242 + }; 243 + 244 + gether_pins: gether { 245 + groups = "gether_mdio_a", "gether_rgmii", 246 + "gether_txcrefclk", "gether_txcrefclk_mega"; 247 + function = "gether"; 247 248 }; 248 249 249 250 i2c0_pins: i2c0 {
+8
arch/arm64/include/asm/processor.h
··· 24 24 #define KERNEL_DS UL(-1) 25 25 #define USER_DS (TASK_SIZE_64 - 1) 26 26 27 + /* 28 + * On arm64 systems, unaligned accesses by the CPU are cheap, and so there is 29 + * no point in shifting all network buffers by 2 bytes just to make some IP 30 + * header fields appear aligned in memory, potentially sacrificing some DMA 31 + * performance on some platforms. 32 + */ 33 + #define NET_IP_ALIGN 0 34 + 27 35 #ifndef __ASSEMBLY__ 28 36 #ifdef __KERNEL__ 29 37
-2
arch/arm64/mm/init.c
··· 483 483 high_memory = __va(memblock_end_of_DRAM() - 1) + 1; 484 484 485 485 dma_contiguous_reserve(arm64_dma_phys_limit); 486 - 487 - memblock_allow_resize(); 488 486 } 489 487 490 488 void __init bootmem_init(void)
+2
arch/arm64/mm/mmu.c
··· 659 659 660 660 memblock_free(__pa_symbol(init_pg_dir), 661 661 __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir)); 662 + 663 + memblock_allow_resize(); 662 664 } 663 665 664 666 /*
+2 -2
arch/m68k/include/asm/pgtable_mm.h
··· 55 55 */ 56 56 #ifdef CONFIG_SUN3 57 57 #define PTRS_PER_PTE 16 58 - #define __PAGETABLE_PMD_FOLDED 58 + #define __PAGETABLE_PMD_FOLDED 1 59 59 #define PTRS_PER_PMD 1 60 60 #define PTRS_PER_PGD 2048 61 61 #elif defined(CONFIG_COLDFIRE) 62 62 #define PTRS_PER_PTE 512 63 - #define __PAGETABLE_PMD_FOLDED 63 + #define __PAGETABLE_PMD_FOLDED 1 64 64 #define PTRS_PER_PMD 1 65 65 #define PTRS_PER_PGD 1024 66 66 #else
+1 -1
arch/microblaze/include/asm/pgtable.h
··· 63 63 64 64 #include <asm-generic/4level-fixup.h> 65 65 66 - #define __PAGETABLE_PMD_FOLDED 66 + #define __PAGETABLE_PMD_FOLDED 1 67 67 68 68 #ifdef __KERNEL__ 69 69 #ifndef __ASSEMBLY__
+1 -1
arch/mips/cavium-octeon/executive/cvmx-helper.c
··· 67 67 void (*cvmx_override_ipd_port_setup) (int ipd_port); 68 68 69 69 /* Port count per interface */ 70 - static int interface_port_count[5]; 70 + static int interface_port_count[9]; 71 71 72 72 /** 73 73 * Return the number of interfaces the chip has. Each interface
+1 -1
arch/mips/mm/dma-noncoherent.c
··· 50 50 void *ret; 51 51 52 52 ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs); 53 - if (!ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) { 53 + if (ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) { 54 54 dma_cache_wback_inv((unsigned long) ret, size); 55 55 ret = (void *)UNCAC_ADDR(ret); 56 56 }
+1 -1
arch/nds32/include/asm/pgtable.h
··· 4 4 #ifndef _ASMNDS32_PGTABLE_H 5 5 #define _ASMNDS32_PGTABLE_H 6 6 7 - #define __PAGETABLE_PMD_FOLDED 7 + #define __PAGETABLE_PMD_FOLDED 1 8 8 #include <asm-generic/4level-fixup.h> 9 9 #include <asm-generic/sizes.h> 10 10
+1 -1
arch/parisc/include/asm/pgtable.h
··· 111 111 #if CONFIG_PGTABLE_LEVELS == 3 112 112 #define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY) 113 113 #else 114 - #define __PAGETABLE_PMD_FOLDED 114 + #define __PAGETABLE_PMD_FOLDED 1 115 115 #define BITS_PER_PMD 0 116 116 #endif 117 117 #define PTRS_PER_PMD (1UL << BITS_PER_PMD)
+1 -1
arch/s390/Makefile
··· 27 27 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) 28 28 KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) 29 29 UTS_MACHINE := s390x 30 - STACK_SIZE := $(if $(CONFIG_KASAN),32768,16384) 30 + STACK_SIZE := $(if $(CONFIG_KASAN),65536,16384) 31 31 CHECKFLAGS += -D__s390__ -D__s390x__ 32 32 33 33 export LD_BFD
+8 -8
arch/s390/boot/compressed/Makefile
··· 22 22 OBJECTS := $(addprefix $(obj)/,$(obj-y)) 23 23 24 24 LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T 25 - $(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) 25 + $(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE 26 26 $(call if_changed,ld) 27 27 28 - OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info 28 + OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load 29 29 $(obj)/info.bin: vmlinux FORCE 30 30 $(call if_changed,objcopy) 31 31 ··· 46 46 suffix-$(CONFIG_KERNEL_LZO) := .lzo 47 47 suffix-$(CONFIG_KERNEL_XZ) := .xz 48 48 49 - $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) 49 + $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE 50 50 $(call if_changed,gzip) 51 - $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) 51 + $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE 52 52 $(call if_changed,bzip2) 53 - $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) 53 + $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE 54 54 $(call if_changed,lz4) 55 - $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) 55 + $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE 56 56 $(call if_changed,lzma) 57 - $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) 57 + $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE 58 58 $(call if_changed,lzo) 59 - $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) 59 + $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE 60 60 $(call if_changed,xzkern) 61 61 62 62 OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed
+11 -3
arch/s390/configs/debug_defconfig
··· 64 64 CONFIG_PREEMPT=y 65 65 CONFIG_HZ_100=y 66 66 CONFIG_KEXEC_FILE=y 67 + CONFIG_EXPOLINE=y 68 + CONFIG_EXPOLINE_AUTO=y 67 69 CONFIG_MEMORY_HOTPLUG=y 68 70 CONFIG_MEMORY_HOTREMOVE=y 69 71 CONFIG_KSM=y ··· 86 84 CONFIG_HOTPLUG_PCI=y 87 85 CONFIG_HOTPLUG_PCI_S390=y 88 86 CONFIG_CHSC_SCH=y 87 + CONFIG_VFIO_AP=m 89 88 CONFIG_CRASH_DUMP=y 90 89 CONFIG_BINFMT_MISC=m 91 90 CONFIG_HIBERNATION=y 91 + CONFIG_PM_DEBUG=y 92 92 CONFIG_NET=y 93 93 CONFIG_PACKET=y 94 94 CONFIG_PACKET_DIAG=m ··· 165 161 CONFIG_NF_CT_NETLINK=m 166 162 CONFIG_NF_CT_NETLINK_TIMEOUT=m 167 163 CONFIG_NF_TABLES=m 168 - CONFIG_NFT_EXTHDR=m 169 - CONFIG_NFT_META=m 170 164 CONFIG_NFT_CT=m 171 165 CONFIG_NFT_COUNTER=m 172 166 CONFIG_NFT_LOG=m ··· 367 365 CONFIG_NET_ACT_CSUM=m 368 366 CONFIG_DNS_RESOLVER=y 369 367 CONFIG_OPENVSWITCH=m 368 + CONFIG_VSOCKETS=m 369 + CONFIG_VIRTIO_VSOCKETS=m 370 370 CONFIG_NETLINK_DIAG=m 371 371 CONFIG_CGROUP_NET_PRIO=y 372 372 CONFIG_BPF_JIT=y ··· 465 461 CONFIG_PPPOL2TP=m 466 462 CONFIG_PPP_ASYNC=m 467 463 CONFIG_PPP_SYNC_TTY=m 464 + CONFIG_ISM=m 468 465 CONFIG_INPUT_EVDEV=y 469 466 # CONFIG_INPUT_KEYBOARD is not set 470 467 # CONFIG_INPUT_MOUSE is not set ··· 491 486 CONFIG_MLX5_INFINIBAND=m 492 487 CONFIG_VFIO=m 493 488 CONFIG_VFIO_PCI=m 489 + CONFIG_VFIO_MDEV=m 490 + CONFIG_VFIO_MDEV_DEVICE=m 494 491 CONFIG_VIRTIO_PCI=m 495 492 CONFIG_VIRTIO_BALLOON=m 496 493 CONFIG_VIRTIO_INPUT=y 494 + CONFIG_S390_AP_IOMMU=y 497 495 CONFIG_EXT4_FS=y 498 496 CONFIG_EXT4_FS_POSIX_ACL=y 499 497 CONFIG_EXT4_FS_SECURITY=y ··· 623 615 CONFIG_RCU_TORTURE_TEST=m 624 616 CONFIG_RCU_CPU_STALL_TIMEOUT=300 625 617 CONFIG_NOTIFIER_ERROR_INJECTION=m 626 - CONFIG_PM_NOTIFIER_ERROR_INJECT=m 627 618 CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m 628 619 CONFIG_FAULT_INJECTION=y 629 620 CONFIG_FAILSLAB=y ··· 734 727 CONFIG_KVM=m 735 728 CONFIG_KVM_S390_UCONTROL=y 736 729 CONFIG_VHOST_NET=m 730 + CONFIG_VHOST_VSOCK=m
+11 -2
arch/s390/configs/performance_defconfig
··· 65 65 CONFIG_NUMA=y 66 66 CONFIG_HZ_100=y 67 67 CONFIG_KEXEC_FILE=y 68 + CONFIG_EXPOLINE=y 69 + CONFIG_EXPOLINE_AUTO=y 68 70 CONFIG_MEMORY_HOTPLUG=y 69 71 CONFIG_MEMORY_HOTREMOVE=y 70 72 CONFIG_KSM=y ··· 84 82 CONFIG_HOTPLUG_PCI=y 85 83 CONFIG_HOTPLUG_PCI_S390=y 86 84 CONFIG_CHSC_SCH=y 85 + CONFIG_VFIO_AP=m 87 86 CONFIG_CRASH_DUMP=y 88 87 CONFIG_BINFMT_MISC=m 89 88 CONFIG_HIBERNATION=y 89 + CONFIG_PM_DEBUG=y 90 90 CONFIG_NET=y 91 91 CONFIG_PACKET=y 92 92 CONFIG_PACKET_DIAG=m ··· 163 159 CONFIG_NF_CT_NETLINK=m 164 160 CONFIG_NF_CT_NETLINK_TIMEOUT=m 165 161 CONFIG_NF_TABLES=m 166 - CONFIG_NFT_EXTHDR=m 167 - CONFIG_NFT_META=m 168 162 CONFIG_NFT_CT=m 169 163 CONFIG_NFT_COUNTER=m 170 164 CONFIG_NFT_LOG=m ··· 364 362 CONFIG_NET_ACT_CSUM=m 365 363 CONFIG_DNS_RESOLVER=y 366 364 CONFIG_OPENVSWITCH=m 365 + CONFIG_VSOCKETS=m 366 + CONFIG_VIRTIO_VSOCKETS=m 367 367 CONFIG_NETLINK_DIAG=m 368 368 CONFIG_CGROUP_NET_PRIO=y 369 369 CONFIG_BPF_JIT=y ··· 462 458 CONFIG_PPPOL2TP=m 463 459 CONFIG_PPP_ASYNC=m 464 460 CONFIG_PPP_SYNC_TTY=m 461 + CONFIG_ISM=m 465 462 CONFIG_INPUT_EVDEV=y 466 463 # CONFIG_INPUT_KEYBOARD is not set 467 464 # CONFIG_INPUT_MOUSE is not set ··· 488 483 CONFIG_MLX5_INFINIBAND=m 489 484 CONFIG_VFIO=m 490 485 CONFIG_VFIO_PCI=m 486 + CONFIG_VFIO_MDEV=m 487 + CONFIG_VFIO_MDEV_DEVICE=m 491 488 CONFIG_VIRTIO_PCI=m 492 489 CONFIG_VIRTIO_BALLOON=m 493 490 CONFIG_VIRTIO_INPUT=y 491 + CONFIG_S390_AP_IOMMU=y 494 492 CONFIG_EXT4_FS=y 495 493 CONFIG_EXT4_FS_POSIX_ACL=y 496 494 CONFIG_EXT4_FS_SECURITY=y ··· 674 666 CONFIG_KVM=m 675 667 CONFIG_KVM_S390_UCONTROL=y 676 668 CONFIG_VHOST_NET=m 669 + CONFIG_VHOST_VSOCK=m
+41 -38
arch/s390/defconfig
··· 26 26 CONFIG_CGROUP_PERF=y 27 27 CONFIG_NAMESPACES=y 28 28 CONFIG_USER_NS=y 29 + CONFIG_CHECKPOINT_RESTORE=y 29 30 CONFIG_BLK_DEV_INITRD=y 30 31 CONFIG_EXPERT=y 31 32 # CONFIG_SYSFS_SYSCALL is not set 32 - CONFIG_CHECKPOINT_RESTORE=y 33 33 CONFIG_BPF_SYSCALL=y 34 34 CONFIG_USERFAULTFD=y 35 35 # CONFIG_COMPAT_BRK is not set 36 36 CONFIG_PROFILING=y 37 + CONFIG_LIVEPATCH=y 38 + CONFIG_NR_CPUS=256 39 + CONFIG_NUMA=y 40 + CONFIG_HZ_100=y 41 + CONFIG_KEXEC_FILE=y 42 + CONFIG_CRASH_DUMP=y 43 + CONFIG_HIBERNATION=y 44 + CONFIG_PM_DEBUG=y 45 + CONFIG_CMM=m 37 46 CONFIG_OPROFILE=y 38 47 CONFIG_KPROBES=y 39 48 CONFIG_JUMP_LABEL=y ··· 53 44 CONFIG_PARTITION_ADVANCED=y 54 45 CONFIG_IBM_PARTITION=y 55 46 CONFIG_DEFAULT_DEADLINE=y 56 - CONFIG_LIVEPATCH=y 57 - CONFIG_NR_CPUS=256 58 - CONFIG_NUMA=y 59 - CONFIG_HZ_100=y 60 - CONFIG_KEXEC_FILE=y 47 + CONFIG_BINFMT_MISC=m 61 48 CONFIG_MEMORY_HOTPLUG=y 62 49 CONFIG_MEMORY_HOTREMOVE=y 63 50 CONFIG_KSM=y ··· 65 60 CONFIG_ZSMALLOC=m 66 61 CONFIG_ZSMALLOC_STAT=y 67 62 CONFIG_IDLE_PAGE_TRACKING=y 68 - CONFIG_CRASH_DUMP=y 69 - CONFIG_BINFMT_MISC=m 70 - CONFIG_HIBERNATION=y 71 63 CONFIG_NET=y 72 64 CONFIG_PACKET=y 73 65 CONFIG_UNIX=y ··· 100 98 CONFIG_BLK_DEV_RAM=y 101 99 CONFIG_VIRTIO_BLK=y 102 100 CONFIG_SCSI=y 101 + # CONFIG_SCSI_MQ_DEFAULT is not set 103 102 CONFIG_BLK_DEV_SD=y 104 103 CONFIG_CHR_DEV_ST=y 105 104 CONFIG_BLK_DEV_SR=y ··· 134 131 CONFIG_TUN=m 135 132 CONFIG_VIRTIO_NET=y 136 133 # CONFIG_NET_VENDOR_ALACRITECH is not set 134 + # CONFIG_NET_VENDOR_AURORA is not set 137 135 # CONFIG_NET_VENDOR_CORTINA is not set 138 136 # CONFIG_NET_VENDOR_SOLARFLARE is not set 139 137 # CONFIG_NET_VENDOR_SOCIONEXT is not set ··· 161 157 CONFIG_TMPFS_POSIX_ACL=y 162 158 CONFIG_HUGETLBFS=y 163 159 # CONFIG_NETWORK_FILESYSTEMS is not set 164 - CONFIG_DEBUG_INFO=y 165 - CONFIG_DEBUG_INFO_DWARF4=y 166 - CONFIG_GDB_SCRIPTS=y 167 - CONFIG_UNUSED_SYMBOLS=y 168 - CONFIG_DEBUG_SECTION_MISMATCH=y 169 - CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 170 - CONFIG_MAGIC_SYSRQ=y 171 - CONFIG_DEBUG_PAGEALLOC=y 172 - CONFIG_DETECT_HUNG_TASK=y 173 - CONFIG_PANIC_ON_OOPS=y 174 - CONFIG_PROVE_LOCKING=y 175 - CONFIG_LOCK_STAT=y 176 - CONFIG_DEBUG_LOCKDEP=y 177 - CONFIG_DEBUG_ATOMIC_SLEEP=y 178 - CONFIG_DEBUG_LIST=y 179 - CONFIG_DEBUG_SG=y 180 - CONFIG_DEBUG_NOTIFIERS=y 181 - CONFIG_RCU_CPU_STALL_TIMEOUT=60 182 - CONFIG_LATENCYTOP=y 183 - CONFIG_SCHED_TRACER=y 184 - CONFIG_FTRACE_SYSCALLS=y 185 - CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y 186 - CONFIG_STACK_TRACER=y 187 - CONFIG_BLK_DEV_IO_TRACE=y 188 - CONFIG_FUNCTION_PROFILER=y 189 - # CONFIG_RUNTIME_TESTING_MENU is not set 190 - CONFIG_S390_PTDUMP=y 191 160 CONFIG_CRYPTO_CRYPTD=m 192 161 CONFIG_CRYPTO_AUTHENC=m 193 162 CONFIG_CRYPTO_TEST=m ··· 170 193 CONFIG_CRYPTO_CFB=m 171 194 CONFIG_CRYPTO_CTS=m 172 195 CONFIG_CRYPTO_LRW=m 196 + CONFIG_CRYPTO_OFB=m 173 197 CONFIG_CRYPTO_PCBC=m 174 198 CONFIG_CRYPTO_XTS=m 175 199 CONFIG_CRYPTO_CMAC=m ··· 209 231 CONFIG_CRYPTO_USER_API_SKCIPHER=m 210 232 CONFIG_CRYPTO_USER_API_RNG=m 211 233 CONFIG_ZCRYPT=m 212 - CONFIG_ZCRYPT_MULTIDEVNODES=y 213 234 CONFIG_PKEY=m 214 235 CONFIG_CRYPTO_PAES_S390=m 215 236 CONFIG_CRYPTO_SHA1_S390=m ··· 224 247 # CONFIG_XZ_DEC_ARM is not set 225 248 # CONFIG_XZ_DEC_ARMTHUMB is not set 226 249 # CONFIG_XZ_DEC_SPARC is not set 227 - CONFIG_CMM=m 250 + CONFIG_DEBUG_INFO=y 251 + CONFIG_DEBUG_INFO_DWARF4=y 252 + CONFIG_GDB_SCRIPTS=y 253 + CONFIG_UNUSED_SYMBOLS=y 254 + CONFIG_DEBUG_SECTION_MISMATCH=y 255 + CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 256 + CONFIG_MAGIC_SYSRQ=y 257 + CONFIG_DEBUG_PAGEALLOC=y 258 + CONFIG_DETECT_HUNG_TASK=y 259 + CONFIG_PANIC_ON_OOPS=y 260 + CONFIG_PROVE_LOCKING=y 261 + CONFIG_LOCK_STAT=y 262 + CONFIG_DEBUG_LOCKDEP=y 263 + CONFIG_DEBUG_ATOMIC_SLEEP=y 264 + CONFIG_DEBUG_LIST=y 265 + CONFIG_DEBUG_SG=y 266 + CONFIG_DEBUG_NOTIFIERS=y 267 + CONFIG_RCU_CPU_STALL_TIMEOUT=60 268 + CONFIG_LATENCYTOP=y 269 + CONFIG_SCHED_TRACER=y 270 + CONFIG_FTRACE_SYSCALLS=y 271 + CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y 272 + CONFIG_STACK_TRACER=y 273 + CONFIG_BLK_DEV_IO_TRACE=y 274 + CONFIG_FUNCTION_PROFILER=y 275 + # CONFIG_RUNTIME_TESTING_MENU is not set 276 + CONFIG_S390_PTDUMP=y
-5
arch/s390/include/asm/mmu_context.h
··· 46 46 mm->context.asce_limit = STACK_TOP_MAX; 47 47 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 48 48 _ASCE_USER_BITS | _ASCE_TYPE_REGION3; 49 - /* pgd_alloc() did not account this pud */ 50 - mm_inc_nr_puds(mm); 51 49 break; 52 50 case -PAGE_SIZE: 53 51 /* forked 5-level task, set new asce with new_mm->pgd */ ··· 61 63 /* forked 2-level compat task, set new asce with new mm->pgd */ 62 64 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 63 65 _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT; 64 - /* pgd_alloc() did not account this pmd */ 65 - mm_inc_nr_pmds(mm); 66 - mm_inc_nr_puds(mm); 67 66 } 68 67 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); 69 68 return 0;
+3 -3
arch/s390/include/asm/pgalloc.h
··· 36 36 37 37 static inline unsigned long pgd_entry_type(struct mm_struct *mm) 38 38 { 39 - if (mm->context.asce_limit <= _REGION3_SIZE) 39 + if (mm_pmd_folded(mm)) 40 40 return _SEGMENT_ENTRY_EMPTY; 41 - if (mm->context.asce_limit <= _REGION2_SIZE) 41 + if (mm_pud_folded(mm)) 42 42 return _REGION3_ENTRY_EMPTY; 43 - if (mm->context.asce_limit <= _REGION1_SIZE) 43 + if (mm_p4d_folded(mm)) 44 44 return _REGION2_ENTRY_EMPTY; 45 45 return _REGION1_ENTRY_EMPTY; 46 46 }
+18
arch/s390/include/asm/pgtable.h
··· 493 493 _REGION_ENTRY_PROTECT | \ 494 494 _REGION_ENTRY_NOEXEC) 495 495 496 + static inline bool mm_p4d_folded(struct mm_struct *mm) 497 + { 498 + return mm->context.asce_limit <= _REGION1_SIZE; 499 + } 500 + #define mm_p4d_folded(mm) mm_p4d_folded(mm) 501 + 502 + static inline bool mm_pud_folded(struct mm_struct *mm) 503 + { 504 + return mm->context.asce_limit <= _REGION2_SIZE; 505 + } 506 + #define mm_pud_folded(mm) mm_pud_folded(mm) 507 + 508 + static inline bool mm_pmd_folded(struct mm_struct *mm) 509 + { 510 + return mm->context.asce_limit <= _REGION3_SIZE; 511 + } 512 + #define mm_pmd_folded(mm) mm_pmd_folded(mm) 513 + 496 514 static inline int mm_has_pgste(struct mm_struct *mm) 497 515 { 498 516 #ifdef CONFIG_PGSTE
+1 -1
arch/s390/include/asm/thread_info.h
··· 14 14 * General size of kernel stacks 15 15 */ 16 16 #ifdef CONFIG_KASAN 17 - #define THREAD_SIZE_ORDER 3 17 + #define THREAD_SIZE_ORDER 4 18 18 #else 19 19 #define THREAD_SIZE_ORDER 2 20 20 #endif
+3 -3
arch/s390/include/asm/tlb.h
··· 136 136 static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, 137 137 unsigned long address) 138 138 { 139 - if (tlb->mm->context.asce_limit <= _REGION3_SIZE) 139 + if (mm_pmd_folded(tlb->mm)) 140 140 return; 141 141 pgtable_pmd_page_dtor(virt_to_page(pmd)); 142 142 tlb_remove_table(tlb, pmd); ··· 152 152 static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, 153 153 unsigned long address) 154 154 { 155 - if (tlb->mm->context.asce_limit <= _REGION1_SIZE) 155 + if (mm_p4d_folded(tlb->mm)) 156 156 return; 157 157 tlb_remove_table(tlb, p4d); 158 158 } ··· 167 167 static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, 168 168 unsigned long address) 169 169 { 170 - if (tlb->mm->context.asce_limit <= _REGION2_SIZE) 170 + if (mm_pud_folded(tlb->mm)) 171 171 return; 172 172 tlb_remove_table(tlb, pud); 173 173 }
+3 -3
arch/s390/kernel/entry.S
··· 236 236 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task 237 237 lghi %r4,__TASK_stack 238 238 lghi %r1,__TASK_thread 239 - lg %r5,0(%r4,%r3) # start of kernel stack of next 239 + llill %r5,STACK_INIT 240 240 stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev 241 - lgr %r15,%r5 242 - aghi %r15,STACK_INIT # end of kernel stack of next 241 + lg %r15,0(%r4,%r3) # start of kernel stack of next 242 + agr %r15,%r5 # end of kernel stack of next 243 243 stg %r3,__LC_CURRENT # store task struct of next 244 244 stg %r15,__LC_KERNEL_STACK # store end of kernel stack 245 245 lg %r15,__THREAD_ksp(%r1,%r3) # load kernel stack of next
+1 -1
arch/s390/kernel/perf_cpum_cf.c
··· 373 373 return -ENOENT; 374 374 375 375 if (ev > PERF_CPUM_CF_MAX_CTR) 376 - return -EINVAL; 376 + return -ENOENT; 377 377 378 378 /* Obtain the counter set to which the specified counter belongs */ 379 379 set = get_counter_set(ev);
+28 -5
arch/s390/kernel/perf_cpum_sf.c
··· 1842 1842 CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); 1843 1843 CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); 1844 1844 1845 - static struct attribute *cpumsf_pmu_events_attr[] = { 1846 - CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), 1847 - NULL, 1848 - NULL, 1845 + /* Attribute list for CPU_SF. 1846 + * 1847 + * The availablitiy depends on the CPU_MF sampling facility authorization 1848 + * for basic + diagnositic samples. This is determined at initialization 1849 + * time by the sampling facility device driver. 1850 + * If the authorization for basic samples is turned off, it should be 1851 + * also turned off for diagnostic sampling. 1852 + * 1853 + * During initialization of the device driver, check the authorization 1854 + * level for diagnostic sampling and installs the attribute 1855 + * file for diagnostic sampling if necessary. 1856 + * 1857 + * For now install a placeholder to reference all possible attributes: 1858 + * SF_CYCLES_BASIC and SF_CYCLES_BASIC_DIAG. 1859 + * Add another entry for the final NULL pointer. 1860 + */ 1861 + enum { 1862 + SF_CYCLES_BASIC_ATTR_IDX = 0, 1863 + SF_CYCLES_BASIC_DIAG_ATTR_IDX, 1864 + SF_CYCLES_ATTR_MAX 1865 + }; 1866 + 1867 + static struct attribute *cpumsf_pmu_events_attr[SF_CYCLES_ATTR_MAX + 1] = { 1868 + [SF_CYCLES_BASIC_ATTR_IDX] = CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC) 1849 1869 }; 1850 1870 1851 1871 PMU_FORMAT_ATTR(event, "config:0-63"); ··· 2060 2040 2061 2041 if (si.ad) { 2062 2042 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); 2063 - cpumsf_pmu_events_attr[1] = 2043 + /* Sampling of diagnostic data authorized, 2044 + * install event into attribute list of PMU device. 2045 + */ 2046 + cpumsf_pmu_events_attr[SF_CYCLES_BASIC_DIAG_ATTR_IDX] = 2064 2047 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG); 2065 2048 } 2066 2049
+3 -3
arch/s390/kernel/vdso32/Makefile
··· 37 37 $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so 38 38 39 39 # link rule for the .so file, .lds has to be first 40 - $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) 40 + $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE 41 41 $(call if_changed,vdso32ld) 42 42 43 43 # strip rule for the .so file ··· 46 46 $(call if_changed,objcopy) 47 47 48 48 # assembly rules for the .S files 49 - $(obj-vdso32): %.o: %.S 49 + $(obj-vdso32): %.o: %.S FORCE 50 50 $(call if_changed_dep,vdso32as) 51 51 52 52 # actual build commands 53 53 quiet_cmd_vdso32ld = VDSO32L $@ 54 - cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ 54 + cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ 55 55 quiet_cmd_vdso32as = VDSO32A $@ 56 56 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< 57 57
+3 -3
arch/s390/kernel/vdso64/Makefile
··· 37 37 $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so 38 38 39 39 # link rule for the .so file, .lds has to be first 40 - $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) 40 + $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE 41 41 $(call if_changed,vdso64ld) 42 42 43 43 # strip rule for the .so file ··· 46 46 $(call if_changed,objcopy) 47 47 48 48 # assembly rules for the .S files 49 - $(obj-vdso64): %.o: %.S 49 + $(obj-vdso64): %.o: %.S FORCE 50 50 $(call if_changed_dep,vdso64as) 51 51 52 52 # actual build commands 53 53 quiet_cmd_vdso64ld = VDSO64L $@ 54 - cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ 54 + cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ 55 55 quiet_cmd_vdso64as = VDSO64A $@ 56 56 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< 57 57
+2 -2
arch/s390/kernel/vmlinux.lds.S
··· 154 154 * uncompressed image info used by the decompressor 155 155 * it should match struct vmlinux_info 156 156 */ 157 - .vmlinux.info 0 : { 157 + .vmlinux.info 0 (INFO) : { 158 158 QUAD(_stext) /* default_lma */ 159 159 QUAD(startup_continue) /* entry */ 160 160 QUAD(__bss_start - _stext) /* image_size */ 161 161 QUAD(__bss_stop - __bss_start) /* bss_size */ 162 162 QUAD(__boot_data_start) /* bootdata_off */ 163 163 QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */ 164 - } 164 + } :NONE 165 165 166 166 /* Debugging sections. */ 167 167 STABS_DEBUG
+1
arch/s390/mm/pgalloc.c
··· 101 101 mm->context.asce_limit = _REGION1_SIZE; 102 102 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 103 103 _ASCE_USER_BITS | _ASCE_TYPE_REGION2; 104 + mm_inc_nr_puds(mm); 104 105 } else { 105 106 crst_table_init(table, _REGION1_ENTRY_EMPTY); 106 107 pgd_populate(mm, (pgd_t *) table, (p4d_t *) pgd);
+1
arch/s390/numa/numa.c
··· 53 53 { 54 54 return mode->distance ? mode->distance(a, b) : 0; 55 55 } 56 + EXPORT_SYMBOL(__node_distance); 56 57 57 58 int numa_debug_enabled; 58 59
+8 -4
arch/um/drivers/ubd_kern.c
··· 1305 1305 io_req->fds[0] = dev->cow.fd; 1306 1306 else 1307 1307 io_req->fds[0] = dev->fd; 1308 + io_req->error = 0; 1308 1309 1309 1310 if (req_op(req) == REQ_OP_FLUSH) { 1310 1311 io_req->op = UBD_FLUSH; ··· 1314 1313 io_req->cow_offset = -1; 1315 1314 io_req->offset = off; 1316 1315 io_req->length = bvec->bv_len; 1317 - io_req->error = 0; 1318 1316 io_req->sector_mask = 0; 1319 - 1320 1317 io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE; 1321 1318 io_req->offsets[0] = 0; 1322 1319 io_req->offsets[1] = dev->cow.data_offset; ··· 1340 1341 static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, 1341 1342 const struct blk_mq_queue_data *bd) 1342 1343 { 1344 + struct ubd *ubd_dev = hctx->queue->queuedata; 1343 1345 struct request *req = bd->rq; 1344 1346 int ret = 0; 1345 1347 1346 1348 blk_mq_start_request(req); 1349 + 1350 + spin_lock_irq(&ubd_dev->lock); 1347 1351 1348 1352 if (req_op(req) == REQ_OP_FLUSH) { 1349 1353 ret = ubd_queue_one_vec(hctx, req, 0, NULL); ··· 1363 1361 } 1364 1362 } 1365 1363 out: 1366 - if (ret < 0) { 1364 + spin_unlock_irq(&ubd_dev->lock); 1365 + 1366 + if (ret < 0) 1367 1367 blk_mq_requeue_request(req, true); 1368 - } 1368 + 1369 1369 return BLK_STS_OK; 1370 1370 } 1371 1371
-1
arch/x86/Kconfig
··· 525 525 bool "ScaleMP vSMP" 526 526 select HYPERVISOR_GUEST 527 527 select PARAVIRT 528 - select PARAVIRT_XXL 529 528 depends on X86_64 && PCI 530 529 depends on X86_EXTENDED_PLATFORM 531 530 depends on SMP
+1 -3
arch/x86/Makefile
··· 213 213 KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000) 214 214 endif 215 215 216 - # Speed up the build 217 - KBUILD_CFLAGS += -pipe 218 216 # Workaround for a gcc prelease that unfortunately was shipped in a suse release 219 217 KBUILD_CFLAGS += -Wno-sign-compare 220 218 # ··· 237 239 archmacros: 238 240 $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s 239 241 240 - ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,- 242 + ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s 241 243 export ASM_MACRO_FLAGS 242 244 KBUILD_CFLAGS += $(ASM_MACRO_FLAGS) 243 245
+2
arch/x86/include/asm/mce.h
··· 221 221 222 222 int mce_available(struct cpuinfo_x86 *c); 223 223 bool mce_is_memory_error(struct mce *m); 224 + bool mce_is_correctable(struct mce *m); 225 + int mce_usable_address(struct mce *m); 224 226 225 227 DECLARE_PER_CPU(unsigned, mce_exception_count); 226 228 DECLARE_PER_CPU(unsigned, mce_poll_count);
+1 -1
arch/x86/include/asm/mshyperv.h
··· 232 232 : "cc"); 233 233 } 234 234 #endif 235 - return hv_status; 235 + return hv_status; 236 236 } 237 237 238 238 /*
+7 -5
arch/x86/include/asm/page_64_types.h
··· 33 33 34 34 /* 35 35 * Set __PAGE_OFFSET to the most negative possible address + 36 - * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a 37 - * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's 38 - * what Xen requires. 36 + * PGDIR_SIZE*17 (pgd slot 273). 37 + * 38 + * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for 39 + * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary, 40 + * but it's what Xen requires. 39 41 */ 40 - #define __PAGE_OFFSET_BASE_L5 _AC(0xff10000000000000, UL) 41 - #define __PAGE_OFFSET_BASE_L4 _AC(0xffff880000000000, UL) 42 + #define __PAGE_OFFSET_BASE_L5 _AC(0xff11000000000000, UL) 43 + #define __PAGE_OFFSET_BASE_L4 _AC(0xffff888000000000, UL) 42 44 43 45 #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT 44 46 #define __PAGE_OFFSET page_offset_base
+1 -3
arch/x86/include/asm/pgtable_64_types.h
··· 111 111 */ 112 112 #define MAXMEM (1UL << MAX_PHYSMEM_BITS) 113 113 114 - #define LDT_PGD_ENTRY_L4 -3UL 115 - #define LDT_PGD_ENTRY_L5 -112UL 116 - #define LDT_PGD_ENTRY (pgtable_l5_enabled() ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) 114 + #define LDT_PGD_ENTRY -240UL 117 115 #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) 118 116 #define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) 119 117
+8 -5
arch/x86/include/asm/qspinlock.h
··· 13 13 #define queued_fetch_set_pending_acquire queued_fetch_set_pending_acquire 14 14 static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lock) 15 15 { 16 - u32 val = 0; 16 + u32 val; 17 17 18 - if (GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c, 19 - "I", _Q_PENDING_OFFSET)) 20 - val |= _Q_PENDING_VAL; 21 - 18 + /* 19 + * We can't use GEN_BINARY_RMWcc() inside an if() stmt because asm goto 20 + * and CONFIG_PROFILE_ALL_BRANCHES=y results in a label inside a 21 + * statement expression, which GCC doesn't like. 22 + */ 23 + val = GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c, 24 + "I", _Q_PENDING_OFFSET) * _Q_PENDING_VAL; 22 25 val |= atomic_read(&lock->val) & ~_Q_PENDING_MASK; 23 26 24 27 return val;
+31 -4
arch/x86/include/asm/xen/page.h
··· 9 9 #include <linux/mm.h> 10 10 #include <linux/device.h> 11 11 12 - #include <linux/uaccess.h> 12 + #include <asm/extable.h> 13 13 #include <asm/page.h> 14 14 #include <asm/pgtable.h> 15 15 ··· 93 93 */ 94 94 static inline int xen_safe_write_ulong(unsigned long *addr, unsigned long val) 95 95 { 96 - return __put_user(val, (unsigned long __user *)addr); 96 + int ret = 0; 97 + 98 + asm volatile("1: mov %[val], %[ptr]\n" 99 + "2:\n" 100 + ".section .fixup, \"ax\"\n" 101 + "3: sub $1, %[ret]\n" 102 + " jmp 2b\n" 103 + ".previous\n" 104 + _ASM_EXTABLE(1b, 3b) 105 + : [ret] "+r" (ret), [ptr] "=m" (*addr) 106 + : [val] "r" (val)); 107 + 108 + return ret; 97 109 } 98 110 99 - static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val) 111 + static inline int xen_safe_read_ulong(const unsigned long *addr, 112 + unsigned long *val) 100 113 { 101 - return __get_user(*val, (unsigned long __user *)addr); 114 + int ret = 0; 115 + unsigned long rval = ~0ul; 116 + 117 + asm volatile("1: mov %[ptr], %[rval]\n" 118 + "2:\n" 119 + ".section .fixup, \"ax\"\n" 120 + "3: sub $1, %[ret]\n" 121 + " jmp 2b\n" 122 + ".previous\n" 123 + _ASM_EXTABLE(1b, 3b) 124 + : [ret] "+r" (ret), [rval] "+r" (rval) 125 + : [ptr] "m" (*addr)); 126 + *val = rval; 127 + 128 + return ret; 102 129 } 103 130 104 131 #ifdef CONFIG_XEN_PV
+4 -2
arch/x86/kernel/cpu/mcheck/mce.c
··· 485 485 * be somewhat complicated (e.g. segment offset would require an instruction 486 486 * parser). So only support physical addresses up to page granuality for now. 487 487 */ 488 - static int mce_usable_address(struct mce *m) 488 + int mce_usable_address(struct mce *m) 489 489 { 490 490 if (!(m->status & MCI_STATUS_ADDRV)) 491 491 return 0; ··· 505 505 506 506 return 1; 507 507 } 508 + EXPORT_SYMBOL_GPL(mce_usable_address); 508 509 509 510 bool mce_is_memory_error(struct mce *m) 510 511 { ··· 535 534 } 536 535 EXPORT_SYMBOL_GPL(mce_is_memory_error); 537 536 538 - static bool mce_is_correctable(struct mce *m) 537 + bool mce_is_correctable(struct mce *m) 539 538 { 540 539 if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED) 541 540 return false; ··· 548 547 549 548 return true; 550 549 } 550 + EXPORT_SYMBOL_GPL(mce_is_correctable); 551 551 552 552 static bool cec_add_mce(struct mce *m) 553 553 {
+11
arch/x86/kernel/cpu/mshyperv.c
··· 20 20 #include <linux/interrupt.h> 21 21 #include <linux/irq.h> 22 22 #include <linux/kexec.h> 23 + #include <linux/i8253.h> 23 24 #include <asm/processor.h> 24 25 #include <asm/hypervisor.h> 25 26 #include <asm/hyperv-tlfs.h> ··· 295 294 */ 296 295 if (efi_enabled(EFI_BOOT)) 297 296 x86_platform.get_nmi_reason = hv_get_nmi_reason; 297 + 298 + /* 299 + * Hyper-V VMs have a PIT emulation quirk such that zeroing the 300 + * counter register during PIT shutdown restarts the PIT. So it 301 + * continues to interrupt @18.2 HZ. Setting i8253_clear_counter 302 + * to false tells pit_shutdown() not to zero the counter so that 303 + * the PIT really is shutdown. Generation 2 VMs don't have a PIT, 304 + * and setting this value has no effect. 305 + */ 306 + i8253_clear_counter_on_shutdown = false; 298 307 299 308 #if IS_ENABLED(CONFIG_HYPERV) 300 309 /*
+1 -1
arch/x86/kernel/cpu/vmware.c
··· 77 77 } 78 78 early_param("no-vmw-sched-clock", setup_vmw_sched_clock); 79 79 80 - static unsigned long long vmware_sched_clock(void) 80 + static unsigned long long notrace vmware_sched_clock(void) 81 81 { 82 82 unsigned long long ns; 83 83
+38 -21
arch/x86/kernel/ldt.c
··· 199 199 /* 200 200 * If PTI is enabled, this maps the LDT into the kernelmode and 201 201 * usermode tables for the given mm. 202 - * 203 - * There is no corresponding unmap function. Even if the LDT is freed, we 204 - * leave the PTEs around until the slot is reused or the mm is destroyed. 205 - * This is harmless: the LDT is always in ordinary memory, and no one will 206 - * access the freed slot. 207 - * 208 - * If we wanted to unmap freed LDTs, we'd also need to do a flush to make 209 - * it useful, and the flush would slow down modify_ldt(). 210 202 */ 211 203 static int 212 204 map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) ··· 206 214 unsigned long va; 207 215 bool is_vmalloc; 208 216 spinlock_t *ptl; 209 - pgd_t *pgd; 210 - int i; 217 + int i, nr_pages; 211 218 212 219 if (!static_cpu_has(X86_FEATURE_PTI)) 213 220 return 0; ··· 220 229 /* Check if the current mappings are sane */ 221 230 sanity_check_ldt_mapping(mm); 222 231 223 - /* 224 - * Did we already have the top level entry allocated? We can't 225 - * use pgd_none() for this because it doens't do anything on 226 - * 4-level page table kernels. 227 - */ 228 - pgd = pgd_offset(mm, LDT_BASE_ADDR); 229 - 230 232 is_vmalloc = is_vmalloc_addr(ldt->entries); 231 233 232 - for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) { 234 + nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); 235 + 236 + for (i = 0; i < nr_pages; i++) { 233 237 unsigned long offset = i << PAGE_SHIFT; 234 238 const void *src = (char *)ldt->entries + offset; 235 239 unsigned long pfn; ··· 258 272 /* Propagate LDT mapping to the user page-table */ 259 273 map_ldt_struct_to_user(mm); 260 274 261 - va = (unsigned long)ldt_slot_va(slot); 262 - flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, PAGE_SHIFT, false); 263 - 264 275 ldt->slot = slot; 265 276 return 0; 277 + } 278 + 279 + static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) 280 + { 281 + unsigned long va; 282 + int i, nr_pages; 283 + 284 + if (!ldt) 285 + return; 286 + 287 + /* LDT map/unmap is only required for PTI */ 288 + if (!static_cpu_has(X86_FEATURE_PTI)) 289 + return; 290 + 291 + nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); 292 + 293 + for (i = 0; i < nr_pages; i++) { 294 + unsigned long offset = i << PAGE_SHIFT; 295 + spinlock_t *ptl; 296 + pte_t *ptep; 297 + 298 + va = (unsigned long)ldt_slot_va(ldt->slot) + offset; 299 + ptep = get_locked_pte(mm, va, &ptl); 300 + pte_clear(mm, va, ptep); 301 + pte_unmap_unlock(ptep, ptl); 302 + } 303 + 304 + va = (unsigned long)ldt_slot_va(ldt->slot); 305 + flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false); 266 306 } 267 307 268 308 #else /* !CONFIG_PAGE_TABLE_ISOLATION */ ··· 297 285 map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) 298 286 { 299 287 return 0; 288 + } 289 + 290 + static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) 291 + { 300 292 } 301 293 #endif /* CONFIG_PAGE_TABLE_ISOLATION */ 302 294 ··· 540 524 } 541 525 542 526 install_ldt(mm, new_ldt); 527 + unmap_ldt_struct(mm, old_ldt); 543 528 free_ldt_struct(old_ldt); 544 529 error = 0; 545 530
+7 -77
arch/x86/kernel/vsmp_64.c
··· 26 26 27 27 #define TOPOLOGY_REGISTER_OFFSET 0x10 28 28 29 - #if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL 30 - /* 31 - * Interrupt control on vSMPowered systems: 32 - * ~AC is a shadow of IF. If IF is 'on' AC should be 'off' 33 - * and vice versa. 34 - */ 35 - 36 - asmlinkage __visible unsigned long vsmp_save_fl(void) 37 - { 38 - unsigned long flags = native_save_fl(); 39 - 40 - if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC)) 41 - flags &= ~X86_EFLAGS_IF; 42 - return flags; 43 - } 44 - PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl); 45 - 46 - __visible void vsmp_restore_fl(unsigned long flags) 47 - { 48 - if (flags & X86_EFLAGS_IF) 49 - flags &= ~X86_EFLAGS_AC; 50 - else 51 - flags |= X86_EFLAGS_AC; 52 - native_restore_fl(flags); 53 - } 54 - PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl); 55 - 56 - asmlinkage __visible void vsmp_irq_disable(void) 57 - { 58 - unsigned long flags = native_save_fl(); 59 - 60 - native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC); 61 - } 62 - PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable); 63 - 64 - asmlinkage __visible void vsmp_irq_enable(void) 65 - { 66 - unsigned long flags = native_save_fl(); 67 - 68 - native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC)); 69 - } 70 - PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable); 71 - 72 - static unsigned __init vsmp_patch(u8 type, void *ibuf, 73 - unsigned long addr, unsigned len) 74 - { 75 - switch (type) { 76 - case PARAVIRT_PATCH(irq.irq_enable): 77 - case PARAVIRT_PATCH(irq.irq_disable): 78 - case PARAVIRT_PATCH(irq.save_fl): 79 - case PARAVIRT_PATCH(irq.restore_fl): 80 - return paravirt_patch_default(type, ibuf, addr, len); 81 - default: 82 - return native_patch(type, ibuf, addr, len); 83 - } 84 - 85 - } 86 - 87 - static void __init set_vsmp_pv_ops(void) 29 + #ifdef CONFIG_PCI 30 + static void __init set_vsmp_ctl(void) 88 31 { 89 32 void __iomem *address; 90 33 unsigned int cap, ctl, cfg; ··· 52 109 } 53 110 #endif 54 111 55 - if (cap & ctl & (1 << 4)) { 56 - /* Setup irq ops and turn on vSMP IRQ fastpath handling */ 57 - pv_ops.irq.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable); 58 - pv_ops.irq.irq_enable = PV_CALLEE_SAVE(vsmp_irq_enable); 59 - pv_ops.irq.save_fl = PV_CALLEE_SAVE(vsmp_save_fl); 60 - pv_ops.irq.restore_fl = PV_CALLEE_SAVE(vsmp_restore_fl); 61 - pv_ops.init.patch = vsmp_patch; 62 - ctl &= ~(1 << 4); 63 - } 64 112 writel(ctl, address + 4); 65 113 ctl = readl(address + 4); 66 114 pr_info("vSMP CTL: control set to:0x%08x\n", ctl); 67 115 68 116 early_iounmap(address, 8); 69 117 } 70 - #else 71 - static void __init set_vsmp_pv_ops(void) 72 - { 73 - } 74 - #endif 75 - 76 - #ifdef CONFIG_PCI 77 118 static int is_vsmp = -1; 78 119 79 120 static void __init detect_vsmp_box(void) ··· 91 164 { 92 165 return 0; 93 166 } 167 + static void __init set_vsmp_ctl(void) 168 + { 169 + } 94 170 #endif 95 171 96 172 static void __init vsmp_cap_cpus(void) 97 173 { 98 - #if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) 174 + #if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) && defined(CONFIG_PCI) 99 175 void __iomem *address; 100 176 unsigned int cfg, topology, node_shift, maxcpus; 101 177 ··· 151 221 152 222 vsmp_cap_cpus(); 153 223 154 - set_vsmp_pv_ops(); 224 + set_vsmp_ctl(); 155 225 return; 156 226 }
+3 -3
arch/x86/xen/mmu_pv.c
··· 1905 1905 init_top_pgt[0] = __pgd(0); 1906 1906 1907 1907 /* Pre-constructed entries are in pfn, so convert to mfn */ 1908 - /* L4[272] -> level3_ident_pgt */ 1908 + /* L4[273] -> level3_ident_pgt */ 1909 1909 /* L4[511] -> level3_kernel_pgt */ 1910 1910 convert_pfn_mfn(init_top_pgt); 1911 1911 ··· 1925 1925 addr[0] = (unsigned long)pgd; 1926 1926 addr[1] = (unsigned long)l3; 1927 1927 addr[2] = (unsigned long)l2; 1928 - /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: 1929 - * Both L4[272][0] and L4[511][510] have entries that point to the same 1928 + /* Graft it onto L4[273][0]. Note that we creating an aliasing problem: 1929 + * Both L4[273][0] and L4[511][510] have entries that point to the same 1930 1930 * L2 (PMD) tables. Meaning that if you modify it in __va space 1931 1931 * it will be also modified in the __ka space! (But if you just 1932 1932 * modify the PMD table to point to other PTE's or none, then you
+1 -2
arch/x86/xen/p2m.c
··· 656 656 657 657 /* 658 658 * The interface requires atomic updates on p2m elements. 659 - * xen_safe_write_ulong() is using __put_user which does an atomic 660 - * store via asm(). 659 + * xen_safe_write_ulong() is using an atomic store via asm(). 661 660 */ 662 661 if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn))) 663 662 return true;
+8 -6
arch/x86/xen/spinlock.c
··· 9 9 #include <linux/log2.h> 10 10 #include <linux/gfp.h> 11 11 #include <linux/slab.h> 12 + #include <linux/atomic.h> 12 13 13 14 #include <asm/paravirt.h> 14 15 #include <asm/qspinlock.h> ··· 22 21 23 22 static DEFINE_PER_CPU(int, lock_kicker_irq) = -1; 24 23 static DEFINE_PER_CPU(char *, irq_name); 24 + static DEFINE_PER_CPU(atomic_t, xen_qlock_wait_nest); 25 25 static bool xen_pvspin = true; 26 26 27 27 static void xen_qlock_kick(int cpu) ··· 41 39 */ 42 40 static void xen_qlock_wait(u8 *byte, u8 val) 43 41 { 44 - unsigned long flags; 45 42 int irq = __this_cpu_read(lock_kicker_irq); 43 + atomic_t *nest_cnt = this_cpu_ptr(&xen_qlock_wait_nest); 46 44 47 45 /* If kicker interrupts not initialized yet, just spin */ 48 46 if (irq == -1 || in_nmi()) 49 47 return; 50 48 51 - /* Guard against reentry. */ 52 - local_irq_save(flags); 49 + /* Detect reentry. */ 50 + atomic_inc(nest_cnt); 53 51 54 - /* If irq pending already clear it. */ 55 - if (xen_test_irq_pending(irq)) { 52 + /* If irq pending already and no nested call clear it. */ 53 + if (atomic_read(nest_cnt) == 1 && xen_test_irq_pending(irq)) { 56 54 xen_clear_irq_pending(irq); 57 55 } else if (READ_ONCE(*byte) == val) { 58 56 /* Block until irq becomes pending (or a spurious wakeup) */ 59 57 xen_poll_irq(irq); 60 58 } 61 59 62 - local_irq_restore(flags); 60 + atomic_dec(nest_cnt); 63 61 } 64 62 65 63 static irqreturn_t dummy_handler(int irq, void *dev_id)
+1
block/bio.c
··· 1260 1260 if (ret) 1261 1261 goto cleanup; 1262 1262 } else { 1263 + zero_fill_bio(bio); 1263 1264 iov_iter_advance(iter, bio->bi_iter.bi_size); 1264 1265 } 1265 1266
+7 -19
block/blk-lib.c
··· 51 51 if ((sector | nr_sects) & bs_mask) 52 52 return -EINVAL; 53 53 54 + if (!nr_sects) 55 + return -EINVAL; 56 + 54 57 while (nr_sects) { 55 - unsigned int req_sects = nr_sects; 56 - sector_t end_sect; 57 - 58 - if (!req_sects) 59 - goto fail; 60 - if (req_sects > UINT_MAX >> 9) 61 - req_sects = UINT_MAX >> 9; 62 - 63 - end_sect = sector + req_sects; 58 + unsigned int req_sects = min_t(unsigned int, nr_sects, 59 + bio_allowed_max_sectors(q)); 64 60 65 61 bio = blk_next_bio(bio, 0, gfp_mask); 66 62 bio->bi_iter.bi_sector = sector; ··· 64 68 bio_set_op_attrs(bio, op, 0); 65 69 66 70 bio->bi_iter.bi_size = req_sects << 9; 71 + sector += req_sects; 67 72 nr_sects -= req_sects; 68 - sector = end_sect; 69 73 70 74 /* 71 75 * We can loop for a long time in here, if someone does ··· 78 82 79 83 *biop = bio; 80 84 return 0; 81 - 82 - fail: 83 - if (bio) { 84 - submit_bio_wait(bio); 85 - bio_put(bio); 86 - } 87 - *biop = NULL; 88 - return -EOPNOTSUPP; 89 85 } 90 86 EXPORT_SYMBOL(__blkdev_issue_discard); 91 87 ··· 149 161 return -EOPNOTSUPP; 150 162 151 163 /* Ensure that max_write_same_sectors doesn't overflow bi_size */ 152 - max_write_same_sectors = UINT_MAX >> 9; 164 + max_write_same_sectors = bio_allowed_max_sectors(q); 153 165 154 166 while (nr_sects) { 155 167 bio = blk_next_bio(bio, 1, gfp_mask);
+3 -2
block/blk-merge.c
··· 46 46 bio_get_first_bvec(prev_rq->bio, &pb); 47 47 else 48 48 bio_get_first_bvec(prev, &pb); 49 - if (pb.bv_offset) 49 + if (pb.bv_offset & queue_virt_boundary(q)) 50 50 return true; 51 51 52 52 /* ··· 90 90 /* Zero-sector (unknown) and one-sector granularities are the same. */ 91 91 granularity = max(q->limits.discard_granularity >> 9, 1U); 92 92 93 - max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9); 93 + max_discard_sectors = min(q->limits.max_discard_sectors, 94 + bio_allowed_max_sectors(q)); 94 95 max_discard_sectors -= max_discard_sectors % granularity; 95 96 96 97 if (unlikely(!max_discard_sectors)) {
+11 -1
block/blk.h
··· 169 169 static inline bool __bvec_gap_to_prev(struct request_queue *q, 170 170 struct bio_vec *bprv, unsigned int offset) 171 171 { 172 - return offset || 172 + return (offset & queue_virt_boundary(q)) || 173 173 ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q)); 174 174 } 175 175 ··· 393 393 static inline unsigned long blk_rq_deadline(struct request *rq) 394 394 { 395 395 return rq->__deadline & ~0x1UL; 396 + } 397 + 398 + /* 399 + * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size 400 + * is defined as 'unsigned int', meantime it has to aligned to with logical 401 + * block size which is the minimum accepted unit by hardware. 402 + */ 403 + static inline unsigned int bio_allowed_max_sectors(struct request_queue *q) 404 + { 405 + return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9; 396 406 } 397 407 398 408 /*
+6 -2
drivers/acpi/nfit/mce.c
··· 25 25 struct acpi_nfit_desc *acpi_desc; 26 26 struct nfit_spa *nfit_spa; 27 27 28 - /* We only care about memory errors */ 29 - if (!mce_is_memory_error(mce)) 28 + /* We only care about uncorrectable memory errors */ 29 + if (!mce_is_memory_error(mce) || mce_is_correctable(mce)) 30 + return NOTIFY_DONE; 31 + 32 + /* Verify the address reported in the MCE is valid. */ 33 + if (!mce_usable_address(mce)) 30 34 return NOTIFY_DONE; 31 35 32 36 /*
+1 -5
drivers/ata/sata_rcar.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Renesas R-Car SATA driver 3 4 * 4 5 * Author: Vladimir Barinov <source@cogentembedded.com> 5 6 * Copyright (C) 2013-2015 Cogent Embedded, Inc. 6 7 * Copyright (C) 2013-2015 Renesas Solutions Corp. 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of the GNU General Public License as published by the 10 - * Free Software Foundation; either version 2 of the License, or (at your 11 - * option) any later version. 12 8 */ 13 9 14 10 #include <linux/kernel.h>
+1
drivers/block/xen-blkfront.c
··· 1919 1919 GFP_KERNEL); 1920 1920 if (!info->rinfo) { 1921 1921 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); 1922 + info->nr_rings = 0; 1922 1923 return -ENOMEM; 1923 1924 } 1924 1925
+1
drivers/clk/clk-fixed-factor.c
··· 210 210 { 211 211 struct clk *clk = platform_get_drvdata(pdev); 212 212 213 + of_clk_del_provider(pdev->dev.of_node); 213 214 clk_unregister_fixed_factor(clk); 214 215 215 216 return 0;
+13
drivers/clk/meson/axg.c
··· 325 325 .ops = &clk_regmap_gate_ops, 326 326 .parent_names = (const char *[]){ "fclk_div2_div" }, 327 327 .num_parents = 1, 328 + .flags = CLK_IS_CRITICAL, 328 329 }, 329 330 }; 330 331 ··· 350 349 .ops = &clk_regmap_gate_ops, 351 350 .parent_names = (const char *[]){ "fclk_div3_div" }, 352 351 .num_parents = 1, 352 + /* 353 + * FIXME: 354 + * This clock, as fdiv2, is used by the SCPI FW and is required 355 + * by the platform to operate correctly. 356 + * Until the following condition are met, we need this clock to 357 + * be marked as critical: 358 + * a) The SCPI generic driver claims and enable all the clocks 359 + * it needs 360 + * b) CCF has a clock hand-off mechanism to make the sure the 361 + * clock stays on until the proper driver comes along 362 + */ 363 + .flags = CLK_IS_CRITICAL, 353 364 }, 354 365 }; 355 366
+12
drivers/clk/meson/gxbb.c
··· 506 506 .ops = &clk_regmap_gate_ops, 507 507 .parent_names = (const char *[]){ "fclk_div3_div" }, 508 508 .num_parents = 1, 509 + /* 510 + * FIXME: 511 + * This clock, as fdiv2, is used by the SCPI FW and is required 512 + * by the platform to operate correctly. 513 + * Until the following condition are met, we need this clock to 514 + * be marked as critical: 515 + * a) The SCPI generic driver claims and enable all the clocks 516 + * it needs 517 + * b) CCF has a clock hand-off mechanism to make the sure the 518 + * clock stays on until the proper driver comes along 519 + */ 520 + .flags = CLK_IS_CRITICAL, 509 521 }, 510 522 }; 511 523
+1 -1
drivers/clk/qcom/gcc-qcs404.c
··· 265 265 .div = 1, 266 266 .hw.init = &(struct clk_init_data){ 267 267 .name = "cxo", 268 - .parent_names = (const char *[]){ "xo_board" }, 268 + .parent_names = (const char *[]){ "xo-board" }, 269 269 .num_parents = 1, 270 270 .ops = &clk_fixed_factor_ops, 271 271 },
+12 -2
drivers/clocksource/i8253.c
··· 20 20 DEFINE_RAW_SPINLOCK(i8253_lock); 21 21 EXPORT_SYMBOL(i8253_lock); 22 22 23 + /* 24 + * Handle PIT quirk in pit_shutdown() where zeroing the counter register 25 + * restarts the PIT, negating the shutdown. On platforms with the quirk, 26 + * platform specific code can set this to false. 27 + */ 28 + bool i8253_clear_counter_on_shutdown __ro_after_init = true; 29 + 23 30 #ifdef CONFIG_CLKSRC_I8253 24 31 /* 25 32 * Since the PIT overflows every tick, its not very useful ··· 116 109 raw_spin_lock(&i8253_lock); 117 110 118 111 outb_p(0x30, PIT_MODE); 119 - outb_p(0, PIT_CH0); 120 - outb_p(0, PIT_CH0); 112 + 113 + if (i8253_clear_counter_on_shutdown) { 114 + outb_p(0, PIT_CH0); 115 + outb_p(0, PIT_CH0); 116 + } 121 117 122 118 raw_spin_unlock(&i8253_lock); 123 119 return 0;
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 151 151 extern int amdgpu_gpu_recovery; 152 152 extern int amdgpu_emu_mode; 153 153 extern uint amdgpu_smu_memory_pool_size; 154 + extern uint amdgpu_dc_feature_mask; 154 155 extern struct amdgpu_mgpu_info mgpu_info; 155 156 156 157 #ifdef CONFIG_DRM_AMDGPU_SI
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 127 127 int amdgpu_gpu_recovery = -1; /* auto */ 128 128 int amdgpu_emu_mode = 0; 129 129 uint amdgpu_smu_memory_pool_size = 0; 130 + /* FBC (bit 0) disabled by default*/ 131 + uint amdgpu_dc_feature_mask = 0; 132 + 130 133 struct amdgpu_mgpu_info mgpu_info = { 131 134 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), 132 135 }; ··· 633 630 module_param(halt_if_hws_hang, int, 0644); 634 631 MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)"); 635 632 #endif 633 + 634 + /** 635 + * DOC: dcfeaturemask (uint) 636 + * Override display features enabled. See enum DC_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h. 637 + * The default is the current set of stable display features. 638 + */ 639 + MODULE_PARM_DESC(dcfeaturemask, "all stable DC features enabled (default))"); 640 + module_param_named(dcfeaturemask, amdgpu_dc_feature_mask, uint, 0444); 636 641 637 642 static const struct pci_device_id pciidlist[] = { 638 643 #ifdef CONFIG_DRM_AMDGPU_SI
+1
drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
··· 49 49 adev->reg_offset[SMUIO_HWIP][i] = (uint32_t *)(&(SMUIO_BASE.instance[i])); 50 50 adev->reg_offset[NBIF_HWIP][i] = (uint32_t *)(&(NBIO_BASE.instance[i])); 51 51 adev->reg_offset[THM_HWIP][i] = (uint32_t *)(&(THM_BASE.instance[i])); 52 + adev->reg_offset[CLK_HWIP][i] = (uint32_t *)(&(CLK_BASE.instance[i])); 52 53 } 53 54 return 0; 54 55 }
+8 -19
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 429 429 adev->asic_type < CHIP_RAVEN) 430 430 init_data.flags.gpu_vm_support = true; 431 431 432 + if (amdgpu_dc_feature_mask & DC_FBC_MASK) 433 + init_data.flags.fbc_support = true; 434 + 432 435 /* Display Core create. */ 433 436 adev->dm.dc = dc_create(&init_data); 434 437 ··· 1527 1524 { 1528 1525 struct amdgpu_display_manager *dm = bl_get_data(bd); 1529 1526 1530 - /* 1531 - * PWM interperts 0 as 100% rather than 0% because of HW 1532 - * limitation for level 0.So limiting minimum brightness level 1533 - * to 1. 1534 - */ 1535 - if (bd->props.brightness < 1) 1536 - return 1; 1537 1527 if (dc_link_set_backlight_level(dm->backlight_link, 1538 1528 bd->props.brightness, 0, 0)) 1539 1529 return 0; ··· 2703 2707 drm_connector = &aconnector->base; 2704 2708 2705 2709 if (!aconnector->dc_sink) { 2706 - /* 2707 - * Create dc_sink when necessary to MST 2708 - * Don't apply fake_sink to MST 2709 - */ 2710 - if (aconnector->mst_port) { 2711 - dm_dp_mst_dc_sink_create(drm_connector); 2712 - return stream; 2710 + if (!aconnector->mst_port) { 2711 + sink = create_fake_sink(aconnector); 2712 + if (!sink) 2713 + return stream; 2713 2714 } 2714 - 2715 - sink = create_fake_sink(aconnector); 2716 - if (!sink) 2717 - return stream; 2718 2715 } else { 2719 2716 sink = aconnector->dc_sink; 2720 2717 } ··· 3297 3308 static const struct drm_plane_funcs dm_plane_funcs = { 3298 3309 .update_plane = drm_atomic_helper_update_plane, 3299 3310 .disable_plane = drm_atomic_helper_disable_plane, 3300 - .destroy = drm_plane_cleanup, 3311 + .destroy = drm_primary_helper_destroy, 3301 3312 .reset = dm_drm_plane_reset, 3302 3313 .atomic_duplicate_state = dm_drm_plane_duplicate_state, 3303 3314 .atomic_destroy_state = dm_drm_plane_destroy_state,
-2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
··· 160 160 struct mutex hpd_lock; 161 161 162 162 bool fake_enable; 163 - 164 - bool mst_connected; 165 163 }; 166 164 167 165 #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base)
+7 -72
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 205 205 .atomic_get_property = amdgpu_dm_connector_atomic_get_property 206 206 }; 207 207 208 - void dm_dp_mst_dc_sink_create(struct drm_connector *connector) 209 - { 210 - struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); 211 - struct dc_sink *dc_sink; 212 - struct dc_sink_init_data init_params = { 213 - .link = aconnector->dc_link, 214 - .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST }; 215 - 216 - /* FIXME none of this is safe. we shouldn't touch aconnector here in 217 - * atomic_check 218 - */ 219 - 220 - /* 221 - * TODO: Need to further figure out why ddc.algo is NULL while MST port exists 222 - */ 223 - if (!aconnector->port || !aconnector->port->aux.ddc.algo) 224 - return; 225 - 226 - ASSERT(aconnector->edid); 227 - 228 - dc_sink = dc_link_add_remote_sink( 229 - aconnector->dc_link, 230 - (uint8_t *)aconnector->edid, 231 - (aconnector->edid->extensions + 1) * EDID_LENGTH, 232 - &init_params); 233 - 234 - dc_sink->priv = aconnector; 235 - aconnector->dc_sink = dc_sink; 236 - 237 - if (aconnector->dc_sink) 238 - amdgpu_dm_update_freesync_caps( 239 - connector, aconnector->edid); 240 - } 241 - 242 208 static int dm_dp_mst_get_modes(struct drm_connector *connector) 243 209 { 244 210 struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); ··· 285 319 struct amdgpu_device *adev = dev->dev_private; 286 320 struct amdgpu_encoder *amdgpu_encoder; 287 321 struct drm_encoder *encoder; 288 - const struct drm_connector_helper_funcs *connector_funcs = 289 - connector->base.helper_private; 290 - struct drm_encoder *enc_master = 291 - connector_funcs->best_encoder(&connector->base); 292 322 293 - DRM_DEBUG_KMS("enc master is %p\n", enc_master); 294 323 amdgpu_encoder = kzalloc(sizeof(*amdgpu_encoder), GFP_KERNEL); 295 324 if (!amdgpu_encoder) 296 325 return NULL; ··· 315 354 struct amdgpu_device *adev = dev->dev_private; 316 355 struct amdgpu_dm_connector *aconnector; 317 356 struct drm_connector *connector; 318 - struct drm_connector_list_iter conn_iter; 319 - 320 - drm_connector_list_iter_begin(dev, &conn_iter); 321 - drm_for_each_connector_iter(connector, &conn_iter) { 322 - aconnector = to_amdgpu_dm_connector(connector); 323 - if (aconnector->mst_port == master 324 - && !aconnector->port) { 325 - DRM_INFO("DM_MST: reusing connector: %p [id: %d] [master: %p]\n", 326 - aconnector, connector->base.id, aconnector->mst_port); 327 - 328 - aconnector->port = port; 329 - drm_connector_set_path_property(connector, pathprop); 330 - 331 - drm_connector_list_iter_end(&conn_iter); 332 - aconnector->mst_connected = true; 333 - return &aconnector->base; 334 - } 335 - } 336 - drm_connector_list_iter_end(&conn_iter); 337 357 338 358 aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); 339 359 if (!aconnector) ··· 363 421 */ 364 422 amdgpu_dm_connector_funcs_reset(connector); 365 423 366 - aconnector->mst_connected = true; 367 - 368 424 DRM_INFO("DM_MST: added connector: %p [id: %d] [master: %p]\n", 369 425 aconnector, connector->base.id, aconnector->mst_port); 370 426 ··· 374 434 static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, 375 435 struct drm_connector *connector) 376 436 { 437 + struct amdgpu_dm_connector *master = container_of(mgr, struct amdgpu_dm_connector, mst_mgr); 438 + struct drm_device *dev = master->base.dev; 439 + struct amdgpu_device *adev = dev->dev_private; 377 440 struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); 378 441 379 442 DRM_INFO("DM_MST: Disabling connector: %p [id: %d] [master: %p]\n", ··· 390 447 aconnector->dc_sink = NULL; 391 448 } 392 449 393 - aconnector->mst_connected = false; 450 + drm_connector_unregister(connector); 451 + if (adev->mode_info.rfbdev) 452 + drm_fb_helper_remove_one_connector(&adev->mode_info.rfbdev->helper, connector); 453 + drm_connector_put(connector); 394 454 } 395 455 396 456 static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) ··· 404 458 drm_kms_helper_hotplug_event(dev); 405 459 } 406 460 407 - static void dm_dp_mst_link_status_reset(struct drm_connector *connector) 408 - { 409 - mutex_lock(&connector->dev->mode_config.mutex); 410 - drm_connector_set_link_status_property(connector, DRM_MODE_LINK_STATUS_BAD); 411 - mutex_unlock(&connector->dev->mode_config.mutex); 412 - } 413 - 414 461 static void dm_dp_mst_register_connector(struct drm_connector *connector) 415 462 { 416 463 struct drm_device *dev = connector->dev; 417 464 struct amdgpu_device *adev = dev->dev_private; 418 - struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); 419 465 420 466 if (adev->mode_info.rfbdev) 421 467 drm_fb_helper_add_one_connector(&adev->mode_info.rfbdev->helper, connector); ··· 415 477 DRM_ERROR("adev->mode_info.rfbdev is NULL\n"); 416 478 417 479 drm_connector_register(connector); 418 - 419 - if (aconnector->mst_connected) 420 - dm_dp_mst_link_status_reset(connector); 421 480 } 422 481 423 482 static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
-1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
··· 31 31 32 32 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, 33 33 struct amdgpu_dm_connector *aconnector); 34 - void dm_dp_mst_dc_sink_create(struct drm_connector *connector); 35 34 36 35 #endif
+2 -2
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 1722 1722 i2c_success = i2c_write(pipe_ctx, slave_address, 1723 1723 buffer, sizeof(buffer)); 1724 1724 RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\ 1725 - offset = 0x%d, reg_val = 0x%d, i2c_success = %d\n", 1725 + offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n", 1726 1726 slave_address, buffer[0], buffer[1], i2c_success?1:0); 1727 1727 if (!i2c_success) 1728 1728 /* Write failure */ ··· 1734 1734 i2c_success = i2c_write(pipe_ctx, slave_address, 1735 1735 buffer, sizeof(buffer)); 1736 1736 RETIMER_REDRIVER_INFO("retimer write to slave_address = 0x%x,\ 1737 - offset = 0x%d, reg_val = 0x%d, i2c_success = %d\n", 1737 + offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n", 1738 1738 slave_address, buffer[0], buffer[1], i2c_success?1:0); 1739 1739 if (!i2c_success) 1740 1740 /* Write failure */
+1
drivers/gpu/drm/amd/display/dc/dc.h
··· 169 169 struct dc_config { 170 170 bool gpu_vm_support; 171 171 bool disable_disp_pll_sharing; 172 + bool fbc_support; 172 173 }; 173 174 174 175 enum visual_confirm {
+6 -1
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
··· 1736 1736 if (events->force_trigger) 1737 1737 value |= 0x1; 1738 1738 1739 - value |= 0x84; 1739 + if (num_pipes) { 1740 + struct dc *dc = pipe_ctx[0]->stream->ctx->dc; 1741 + 1742 + if (dc->fbc_compressor) 1743 + value |= 0x84; 1744 + } 1740 1745 1741 1746 for (i = 0; i < num_pipes; i++) 1742 1747 pipe_ctx[i]->stream_res.tg->funcs->
+2 -1
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
··· 1362 1362 pool->base.sw_i2cs[i] = NULL; 1363 1363 } 1364 1364 1365 - dc->fbc_compressor = dce110_compressor_create(ctx); 1365 + if (dc->config.fbc_support) 1366 + dc->fbc_compressor = dce110_compressor_create(ctx); 1366 1367 1367 1368 if (!underlay_create(ctx, &pool->base)) 1368 1369 goto res_create_fail;
+4
drivers/gpu/drm/amd/include/amd_shared.h
··· 133 133 PP_AVFS_MASK = 0x40000, 134 134 }; 135 135 136 + enum DC_FEATURE_MASK { 137 + DC_FBC_MASK = 0x1, 138 + }; 139 + 136 140 /** 137 141 * struct amd_ip_funcs - general hooks for managing amdgpu IP Blocks 138 142 */
+5 -2
drivers/gpu/drm/amd/include/atomfirmware.h
··· 1325 1325 struct atom_common_table_header table_header; 1326 1326 uint8_t smuip_min_ver; 1327 1327 uint8_t smuip_max_ver; 1328 - uint8_t smu_rsd1; 1328 + uint8_t waflclk_ss_mode; 1329 1329 uint8_t gpuclk_ss_mode; 1330 1330 uint16_t sclk_ss_percentage; 1331 1331 uint16_t sclk_ss_rate_10hz; ··· 1355 1355 uint32_t syspll3_1_vco_freq_10khz; 1356 1356 uint32_t bootup_fclk_10khz; 1357 1357 uint32_t bootup_waflclk_10khz; 1358 - uint32_t reserved[3]; 1358 + uint32_t smu_info_caps; 1359 + uint16_t waflclk_ss_percentage; // in unit of 0.001% 1360 + uint16_t smuinitoffset; 1361 + uint32_t reserved; 1359 1362 }; 1360 1363 1361 1364 /*
+33 -20
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
··· 120 120 data->registry_data.disable_auto_wattman = 1; 121 121 data->registry_data.auto_wattman_debug = 0; 122 122 data->registry_data.auto_wattman_sample_period = 100; 123 + data->registry_data.fclk_gfxclk_ratio = 0x3F6CCCCD; 123 124 data->registry_data.auto_wattman_threshold = 50; 124 125 data->registry_data.gfxoff_controlled_by_driver = 1; 125 126 data->gfxoff_allowed = false; ··· 830 829 return 0; 831 830 } 832 831 832 + static int vega20_notify_smc_display_change(struct pp_hwmgr *hwmgr) 833 + { 834 + struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend); 835 + 836 + if (data->smu_features[GNLD_DPM_UCLK].enabled) 837 + return smum_send_msg_to_smc_with_parameter(hwmgr, 838 + PPSMC_MSG_SetUclkFastSwitch, 839 + 1); 840 + 841 + return 0; 842 + } 843 + 844 + static int vega20_send_clock_ratio(struct pp_hwmgr *hwmgr) 845 + { 846 + struct vega20_hwmgr *data = 847 + (struct vega20_hwmgr *)(hwmgr->backend); 848 + 849 + return smum_send_msg_to_smc_with_parameter(hwmgr, 850 + PPSMC_MSG_SetFclkGfxClkRatio, 851 + data->registry_data.fclk_gfxclk_ratio); 852 + } 853 + 833 854 static int vega20_disable_all_smu_features(struct pp_hwmgr *hwmgr) 834 855 { 835 856 struct vega20_hwmgr *data = ··· 1555 1532 "[EnableDPMTasks] Failed to enable all smu features!", 1556 1533 return result); 1557 1534 1535 + result = vega20_notify_smc_display_change(hwmgr); 1536 + PP_ASSERT_WITH_CODE(!result, 1537 + "[EnableDPMTasks] Failed to notify smc display change!", 1538 + return result); 1539 + 1540 + result = vega20_send_clock_ratio(hwmgr); 1541 + PP_ASSERT_WITH_CODE(!result, 1542 + "[EnableDPMTasks] Failed to send clock ratio!", 1543 + return result); 1544 + 1558 1545 /* Initialize UVD/VCE powergating state */ 1559 1546 vega20_init_powergate_state(hwmgr); 1560 1547 ··· 2005 1972 return ret; 2006 1973 } 2007 1974 2008 - static int vega20_notify_smc_display_change(struct pp_hwmgr *hwmgr, 2009 - bool has_disp) 2010 - { 2011 - struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend); 2012 - 2013 - if (data->smu_features[GNLD_DPM_UCLK].enabled) 2014 - return smum_send_msg_to_smc_with_parameter(hwmgr, 2015 - PPSMC_MSG_SetUclkFastSwitch, 2016 - has_disp ? 1 : 0); 2017 - 2018 - return 0; 2019 - } 2020 - 2021 1975 int vega20_display_clock_voltage_request(struct pp_hwmgr *hwmgr, 2022 1976 struct pp_display_clock_request *clock_req) 2023 1977 { ··· 2063 2043 struct PP_Clocks min_clocks = {0}; 2064 2044 struct pp_display_clock_request clock_req; 2065 2045 int ret = 0; 2066 - 2067 - if ((hwmgr->display_config->num_display > 1) && 2068 - !hwmgr->display_config->multi_monitor_in_sync && 2069 - !hwmgr->display_config->nb_pstate_switch_disable) 2070 - vega20_notify_smc_display_change(hwmgr, false); 2071 - else 2072 - vega20_notify_smc_display_change(hwmgr, true); 2073 2046 2074 2047 min_clocks.dcefClock = hwmgr->display_config->min_dcef_set_clk; 2075 2048 min_clocks.dcefClockInSR = hwmgr->display_config->min_dcef_deep_sleep_set_clk;
+1
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h
··· 328 328 uint8_t disable_auto_wattman; 329 329 uint32_t auto_wattman_debug; 330 330 uint32_t auto_wattman_sample_period; 331 + uint32_t fclk_gfxclk_ratio; 331 332 uint8_t auto_wattman_threshold; 332 333 uint8_t log_avfs_param; 333 334 uint8_t enable_enginess;
+2 -1
drivers/gpu/drm/amd/powerplay/inc/vega20_ppsmc.h
··· 105 105 #define PPSMC_MSG_SetSystemVirtualDramAddrHigh 0x4B 106 106 #define PPSMC_MSG_SetSystemVirtualDramAddrLow 0x4C 107 107 #define PPSMC_MSG_WaflTest 0x4D 108 - // Unused ID 0x4E to 0x50 108 + #define PPSMC_MSG_SetFclkGfxClkRatio 0x4E 109 + // Unused ID 0x4F to 0x50 109 110 #define PPSMC_MSG_AllowGfxOff 0x51 110 111 #define PPSMC_MSG_DisallowGfxOff 0x52 111 112 #define PPSMC_MSG_GetPptLimit 0x53
+1 -1
drivers/gpu/drm/etnaviv/etnaviv_sched.c
··· 93 93 * If the GPU managed to complete this jobs fence, the timout is 94 94 * spurious. Bail out. 95 95 */ 96 - if (fence_completed(gpu, submit->out_fence->seqno)) 96 + if (dma_fence_is_signaled(submit->out_fence)) 97 97 return; 98 98 99 99 /*
-9
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
··· 164 164 return frm; 165 165 } 166 166 167 - static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc) 168 - { 169 - struct decon_context *ctx = crtc->ctx; 170 - 171 - return decon_get_frame_count(ctx, false); 172 - } 173 - 174 167 static void decon_setup_trigger(struct decon_context *ctx) 175 168 { 176 169 if (!ctx->crtc->i80_mode && !(ctx->out_type & I80_HW_TRG)) ··· 529 536 .disable = decon_disable, 530 537 .enable_vblank = decon_enable_vblank, 531 538 .disable_vblank = decon_disable_vblank, 532 - .get_vblank_counter = decon_get_vblank_counter, 533 539 .atomic_begin = decon_atomic_begin, 534 540 .update_plane = decon_update_plane, 535 541 .disable_plane = decon_disable_plane, ··· 546 554 int ret; 547 555 548 556 ctx->drm_dev = drm_dev; 549 - drm_dev->max_vblank_count = 0xffffffff; 550 557 551 558 for (win = ctx->first_win; win < WINDOWS_NR; win++) { 552 559 ctx->configs[win].pixel_formats = decon_formats;
-11
drivers/gpu/drm/exynos/exynos_drm_crtc.c
··· 162 162 exynos_crtc->ops->disable_vblank(exynos_crtc); 163 163 } 164 164 165 - static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc) 166 - { 167 - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); 168 - 169 - if (exynos_crtc->ops->get_vblank_counter) 170 - return exynos_crtc->ops->get_vblank_counter(exynos_crtc); 171 - 172 - return 0; 173 - } 174 - 175 165 static const struct drm_crtc_funcs exynos_crtc_funcs = { 176 166 .set_config = drm_atomic_helper_set_config, 177 167 .page_flip = drm_atomic_helper_page_flip, ··· 171 181 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, 172 182 .enable_vblank = exynos_drm_crtc_enable_vblank, 173 183 .disable_vblank = exynos_drm_crtc_disable_vblank, 174 - .get_vblank_counter = exynos_drm_crtc_get_vblank_counter, 175 184 }; 176 185 177 186 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
-1
drivers/gpu/drm/exynos/exynos_drm_drv.h
··· 135 135 void (*disable)(struct exynos_drm_crtc *crtc); 136 136 int (*enable_vblank)(struct exynos_drm_crtc *crtc); 137 137 void (*disable_vblank)(struct exynos_drm_crtc *crtc); 138 - u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); 139 138 enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, 140 139 const struct drm_display_mode *mode); 141 140 bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
+11 -3
drivers/gpu/drm/exynos/exynos_drm_dsi.c
··· 14 14 15 15 #include <drm/drmP.h> 16 16 #include <drm/drm_crtc_helper.h> 17 + #include <drm/drm_fb_helper.h> 17 18 #include <drm/drm_mipi_dsi.h> 18 19 #include <drm/drm_panel.h> 19 20 #include <drm/drm_atomic_helper.h> ··· 1475 1474 { 1476 1475 struct exynos_dsi *dsi = encoder_to_dsi(encoder); 1477 1476 struct drm_connector *connector = &dsi->connector; 1477 + struct drm_device *drm = encoder->dev; 1478 1478 int ret; 1479 1479 1480 1480 connector->polled = DRM_CONNECTOR_POLL_HPD; 1481 1481 1482 - ret = drm_connector_init(encoder->dev, connector, 1483 - &exynos_dsi_connector_funcs, 1482 + ret = drm_connector_init(drm, connector, &exynos_dsi_connector_funcs, 1484 1483 DRM_MODE_CONNECTOR_DSI); 1485 1484 if (ret) { 1486 1485 DRM_ERROR("Failed to initialize connector with drm\n"); ··· 1490 1489 connector->status = connector_status_disconnected; 1491 1490 drm_connector_helper_add(connector, &exynos_dsi_connector_helper_funcs); 1492 1491 drm_connector_attach_encoder(connector, encoder); 1492 + if (!drm->registered) 1493 + return 0; 1493 1494 1495 + connector->funcs->reset(connector); 1496 + drm_fb_helper_add_one_connector(drm->fb_helper, connector); 1497 + drm_connector_register(connector); 1494 1498 return 0; 1495 1499 } 1496 1500 ··· 1533 1527 } 1534 1528 1535 1529 dsi->panel = of_drm_find_panel(device->dev.of_node); 1536 - if (dsi->panel) { 1530 + if (IS_ERR(dsi->panel)) { 1531 + dsi->panel = NULL; 1532 + } else { 1537 1533 drm_panel_attach(dsi->panel, &dsi->connector); 1538 1534 dsi->connector.status = connector_status_connected; 1539 1535 }
+1 -1
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
··· 192 192 struct drm_fb_helper *helper; 193 193 int ret; 194 194 195 - if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector) 195 + if (!dev->mode_config.num_crtc) 196 196 return 0; 197 197 198 198 fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
+54 -53
drivers/gpu/drm/i915/gvt/gtt.c
··· 1905 1905 vgpu_free_mm(mm); 1906 1906 return ERR_PTR(-ENOMEM); 1907 1907 } 1908 - mm->ggtt_mm.last_partial_off = -1UL; 1909 1908 1910 1909 return mm; 1911 1910 } ··· 1929 1930 invalidate_ppgtt_mm(mm); 1930 1931 } else { 1931 1932 vfree(mm->ggtt_mm.virtual_ggtt); 1932 - mm->ggtt_mm.last_partial_off = -1UL; 1933 1933 } 1934 1934 1935 1935 vgpu_free_mm(mm); ··· 2166 2168 struct intel_gvt_gtt_entry e, m; 2167 2169 dma_addr_t dma_addr; 2168 2170 int ret; 2171 + struct intel_gvt_partial_pte *partial_pte, *pos, *n; 2172 + bool partial_update = false; 2169 2173 2170 2174 if (bytes != 4 && bytes != 8) 2171 2175 return -EINVAL; ··· 2178 2178 if (!vgpu_gmadr_is_valid(vgpu, gma)) 2179 2179 return 0; 2180 2180 2181 - ggtt_get_guest_entry(ggtt_mm, &e, g_gtt_index); 2182 - 2181 + e.type = GTT_TYPE_GGTT_PTE; 2183 2182 memcpy((void *)&e.val64 + (off & (info->gtt_entry_size - 1)), p_data, 2184 2183 bytes); 2185 2184 2186 2185 /* If ggtt entry size is 8 bytes, and it's split into two 4 bytes 2187 - * write, we assume the two 4 bytes writes are consecutive. 2188 - * Otherwise, we abort and report error 2186 + * write, save the first 4 bytes in a list and update virtual 2187 + * PTE. Only update shadow PTE when the second 4 bytes comes. 2189 2188 */ 2190 2189 if (bytes < info->gtt_entry_size) { 2191 - if (ggtt_mm->ggtt_mm.last_partial_off == -1UL) { 2192 - /* the first partial part*/ 2193 - ggtt_mm->ggtt_mm.last_partial_off = off; 2194 - ggtt_mm->ggtt_mm.last_partial_data = e.val64; 2195 - return 0; 2196 - } else if ((g_gtt_index == 2197 - (ggtt_mm->ggtt_mm.last_partial_off >> 2198 - info->gtt_entry_size_shift)) && 2199 - (off != ggtt_mm->ggtt_mm.last_partial_off)) { 2200 - /* the second partial part */ 2190 + bool found = false; 2201 2191 2202 - int last_off = ggtt_mm->ggtt_mm.last_partial_off & 2203 - (info->gtt_entry_size - 1); 2192 + list_for_each_entry_safe(pos, n, 2193 + &ggtt_mm->ggtt_mm.partial_pte_list, list) { 2194 + if (g_gtt_index == pos->offset >> 2195 + info->gtt_entry_size_shift) { 2196 + if (off != pos->offset) { 2197 + /* the second partial part*/ 2198 + int last_off = pos->offset & 2199 + (info->gtt_entry_size - 1); 2204 2200 2205 - memcpy((void *)&e.val64 + last_off, 2206 - (void *)&ggtt_mm->ggtt_mm.last_partial_data + 2207 - last_off, bytes); 2201 + memcpy((void *)&e.val64 + last_off, 2202 + (void *)&pos->data + last_off, 2203 + bytes); 2208 2204 2209 - ggtt_mm->ggtt_mm.last_partial_off = -1UL; 2210 - } else { 2211 - int last_offset; 2205 + list_del(&pos->list); 2206 + kfree(pos); 2207 + found = true; 2208 + break; 2209 + } 2212 2210 2213 - gvt_vgpu_err("failed to populate guest ggtt entry: abnormal ggtt entry write sequence, last_partial_off=%lx, offset=%x, bytes=%d, ggtt entry size=%d\n", 2214 - ggtt_mm->ggtt_mm.last_partial_off, off, 2215 - bytes, info->gtt_entry_size); 2211 + /* update of the first partial part */ 2212 + pos->data = e.val64; 2213 + ggtt_set_guest_entry(ggtt_mm, &e, g_gtt_index); 2214 + return 0; 2215 + } 2216 + } 2216 2217 2217 - /* set host ggtt entry to scratch page and clear 2218 - * virtual ggtt entry as not present for last 2219 - * partially write offset 2220 - */ 2221 - last_offset = ggtt_mm->ggtt_mm.last_partial_off & 2222 - (~(info->gtt_entry_size - 1)); 2223 - 2224 - ggtt_get_host_entry(ggtt_mm, &m, last_offset); 2225 - ggtt_invalidate_pte(vgpu, &m); 2226 - ops->set_pfn(&m, gvt->gtt.scratch_mfn); 2227 - ops->clear_present(&m); 2228 - ggtt_set_host_entry(ggtt_mm, &m, last_offset); 2229 - ggtt_invalidate(gvt->dev_priv); 2230 - 2231 - ggtt_get_guest_entry(ggtt_mm, &e, last_offset); 2232 - ops->clear_present(&e); 2233 - ggtt_set_guest_entry(ggtt_mm, &e, last_offset); 2234 - 2235 - ggtt_mm->ggtt_mm.last_partial_off = off; 2236 - ggtt_mm->ggtt_mm.last_partial_data = e.val64; 2237 - 2238 - return 0; 2218 + if (!found) { 2219 + /* the first partial part */ 2220 + partial_pte = kzalloc(sizeof(*partial_pte), GFP_KERNEL); 2221 + if (!partial_pte) 2222 + return -ENOMEM; 2223 + partial_pte->offset = off; 2224 + partial_pte->data = e.val64; 2225 + list_add_tail(&partial_pte->list, 2226 + &ggtt_mm->ggtt_mm.partial_pte_list); 2227 + partial_update = true; 2239 2228 } 2240 2229 } 2241 2230 2242 - if (ops->test_present(&e)) { 2231 + if (!partial_update && (ops->test_present(&e))) { 2243 2232 gfn = ops->get_pfn(&e); 2244 2233 m = e; 2245 2234 ··· 2252 2263 } else 2253 2264 ops->set_pfn(&m, dma_addr >> PAGE_SHIFT); 2254 2265 } else { 2255 - ggtt_get_host_entry(ggtt_mm, &m, g_gtt_index); 2256 - ggtt_invalidate_pte(vgpu, &m); 2257 2266 ops->set_pfn(&m, gvt->gtt.scratch_mfn); 2258 2267 ops->clear_present(&m); 2259 2268 } 2260 2269 2261 2270 out: 2271 + ggtt_set_guest_entry(ggtt_mm, &e, g_gtt_index); 2272 + 2273 + ggtt_get_host_entry(ggtt_mm, &e, g_gtt_index); 2274 + ggtt_invalidate_pte(vgpu, &e); 2275 + 2262 2276 ggtt_set_host_entry(ggtt_mm, &m, g_gtt_index); 2263 2277 ggtt_invalidate(gvt->dev_priv); 2264 - ggtt_set_guest_entry(ggtt_mm, &e, g_gtt_index); 2265 2278 return 0; 2266 2279 } 2267 2280 ··· 2421 2430 2422 2431 intel_vgpu_reset_ggtt(vgpu, false); 2423 2432 2433 + INIT_LIST_HEAD(&gtt->ggtt_mm->ggtt_mm.partial_pte_list); 2434 + 2424 2435 return create_scratch_page_tree(vgpu); 2425 2436 } 2426 2437 ··· 2447 2454 2448 2455 static void intel_vgpu_destroy_ggtt_mm(struct intel_vgpu *vgpu) 2449 2456 { 2457 + struct intel_gvt_partial_pte *pos; 2458 + 2459 + list_for_each_entry(pos, 2460 + &vgpu->gtt.ggtt_mm->ggtt_mm.partial_pte_list, list) { 2461 + gvt_dbg_mm("partial PTE update on hold 0x%lx : 0x%llx\n", 2462 + pos->offset, pos->data); 2463 + kfree(pos); 2464 + } 2450 2465 intel_vgpu_destroy_mm(vgpu->gtt.ggtt_mm); 2451 2466 vgpu->gtt.ggtt_mm = NULL; 2452 2467 }
+7 -3
drivers/gpu/drm/i915/gvt/gtt.h
··· 35 35 #define _GVT_GTT_H_ 36 36 37 37 #define I915_GTT_PAGE_SHIFT 12 38 - #define I915_GTT_PAGE_MASK (~(I915_GTT_PAGE_SIZE - 1)) 39 38 40 39 struct intel_vgpu_mm; 41 40 ··· 132 133 133 134 #define GVT_RING_CTX_NR_PDPS GEN8_3LVL_PDPES 134 135 136 + struct intel_gvt_partial_pte { 137 + unsigned long offset; 138 + u64 data; 139 + struct list_head list; 140 + }; 141 + 135 142 struct intel_vgpu_mm { 136 143 enum intel_gvt_mm_type type; 137 144 struct intel_vgpu *vgpu; ··· 162 157 } ppgtt_mm; 163 158 struct { 164 159 void *virtual_ggtt; 165 - unsigned long last_partial_off; 166 - u64 last_partial_data; 160 + struct list_head partial_pte_list; 167 161 } ggtt_mm; 168 162 }; 169 163 };
+4 -4
drivers/gpu/drm/i915/gvt/handlers.c
··· 1609 1609 return 0; 1610 1610 } 1611 1611 1612 - static int bxt_edp_psr_imr_iir_write(struct intel_vgpu *vgpu, 1612 + static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu, 1613 1613 unsigned int offset, void *p_data, unsigned int bytes) 1614 1614 { 1615 1615 vgpu_vreg(vgpu, offset) = 0; ··· 2607 2607 MMIO_DFH(_MMIO(0x1a178), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); 2608 2608 MMIO_DFH(_MMIO(0x1a17c), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); 2609 2609 MMIO_DFH(_MMIO(0x2217c), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); 2610 + 2611 + MMIO_DH(EDP_PSR_IMR, D_BDW_PLUS, NULL, edp_psr_imr_iir_write); 2612 + MMIO_DH(EDP_PSR_IIR, D_BDW_PLUS, NULL, edp_psr_imr_iir_write); 2610 2613 return 0; 2611 2614 } 2612 2615 ··· 3207 3204 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_A), D_BXT); 3208 3205 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_B), D_BXT); 3209 3206 MMIO_D(HSW_TVIDEO_DIP_GCP(TRANSCODER_C), D_BXT); 3210 - 3211 - MMIO_DH(EDP_PSR_IMR, D_BXT, NULL, bxt_edp_psr_imr_iir_write); 3212 - MMIO_DH(EDP_PSR_IIR, D_BXT, NULL, bxt_edp_psr_imr_iir_write); 3213 3207 3214 3208 MMIO_D(RC6_CTX_BASE, D_BXT); 3215 3209
+1 -1
drivers/gpu/drm/i915/gvt/mmio_context.c
··· 131 131 {RCS, GAMT_CHKN_BIT_REG, 0x0, false}, /* 0x4ab8 */ 132 132 133 133 {RCS, GEN9_GAMT_ECO_REG_RW_IA, 0x0, false}, /* 0x4ab0 */ 134 - {RCS, GEN9_CSFE_CHICKEN1_RCS, 0x0, false}, /* 0x20d4 */ 134 + {RCS, GEN9_CSFE_CHICKEN1_RCS, 0xffff, false}, /* 0x20d4 */ 135 135 136 136 {RCS, GEN8_GARBCNTL, 0x0, false}, /* 0xb004 */ 137 137 {RCS, GEN7_FF_THREAD_MODE, 0x0, false}, /* 0x20a0 */
+8 -7
drivers/gpu/drm/i915/i915_drv.c
··· 1175 1175 return -EINVAL; 1176 1176 } 1177 1177 1178 - dram_info->valid_dimm = true; 1179 - 1180 1178 /* 1181 1179 * If any of the channel is single rank channel, worst case output 1182 1180 * will be same as if single rank memory, so consider single rank ··· 1191 1193 return -EINVAL; 1192 1194 } 1193 1195 1194 - if (ch0.is_16gb_dimm || ch1.is_16gb_dimm) 1195 - dram_info->is_16gb_dimm = true; 1196 + dram_info->is_16gb_dimm = ch0.is_16gb_dimm || ch1.is_16gb_dimm; 1196 1197 1197 1198 dev_priv->dram_info.symmetric_memory = intel_is_dram_symmetric(val_ch0, 1198 1199 val_ch1, ··· 1311 1314 return -EINVAL; 1312 1315 } 1313 1316 1314 - dram_info->valid_dimm = true; 1315 1317 dram_info->valid = true; 1316 1318 return 0; 1317 1319 } ··· 1323 1327 int ret; 1324 1328 1325 1329 dram_info->valid = false; 1326 - dram_info->valid_dimm = false; 1327 - dram_info->is_16gb_dimm = false; 1328 1330 dram_info->rank = I915_DRAM_RANK_INVALID; 1329 1331 dram_info->bandwidth_kbps = 0; 1330 1332 dram_info->num_channels = 0; 1333 + 1334 + /* 1335 + * Assume 16Gb DIMMs are present until proven otherwise. 1336 + * This is only used for the level 0 watermark latency 1337 + * w/a which does not apply to bxt/glk. 1338 + */ 1339 + dram_info->is_16gb_dimm = !IS_GEN9_LP(dev_priv); 1331 1340 1332 1341 if (INTEL_GEN(dev_priv) < 9 || IS_GEMINILAKE(dev_priv)) 1333 1342 return;
-1
drivers/gpu/drm/i915/i915_drv.h
··· 1948 1948 1949 1949 struct dram_info { 1950 1950 bool valid; 1951 - bool valid_dimm; 1952 1951 bool is_16gb_dimm; 1953 1952 u8 num_channels; 1954 1953 enum dram_rank {
+1 -1
drivers/gpu/drm/i915/i915_gem_execbuffer.c
··· 460 460 * any non-page-aligned or non-canonical addresses. 461 461 */ 462 462 if (unlikely(entry->flags & EXEC_OBJECT_PINNED && 463 - entry->offset != gen8_canonical_addr(entry->offset & PAGE_MASK))) 463 + entry->offset != gen8_canonical_addr(entry->offset & I915_GTT_PAGE_MASK))) 464 464 return -EINVAL; 465 465 466 466 /* pad_to_size was once a reserved field, so sanitize it */
+1 -1
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 1757 1757 if (i == 4) 1758 1758 continue; 1759 1759 1760 - seq_printf(m, "\t\t(%03d, %04d) %08lx: ", 1760 + seq_printf(m, "\t\t(%03d, %04d) %08llx: ", 1761 1761 pde, pte, 1762 1762 (pde * GEN6_PTES + pte) * I915_GTT_PAGE_SIZE); 1763 1763 for (i = 0; i < 4; i++) {
+17 -15
drivers/gpu/drm/i915/i915_gem_gtt.h
··· 42 42 #include "i915_selftest.h" 43 43 #include "i915_timeline.h" 44 44 45 - #define I915_GTT_PAGE_SIZE_4K BIT(12) 46 - #define I915_GTT_PAGE_SIZE_64K BIT(16) 47 - #define I915_GTT_PAGE_SIZE_2M BIT(21) 45 + #define I915_GTT_PAGE_SIZE_4K BIT_ULL(12) 46 + #define I915_GTT_PAGE_SIZE_64K BIT_ULL(16) 47 + #define I915_GTT_PAGE_SIZE_2M BIT_ULL(21) 48 48 49 49 #define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K 50 50 #define I915_GTT_MAX_PAGE_SIZE I915_GTT_PAGE_SIZE_2M 51 + 52 + #define I915_GTT_PAGE_MASK -I915_GTT_PAGE_SIZE 51 53 52 54 #define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE 53 55 ··· 661 659 u64 start, u64 end, unsigned int flags); 662 660 663 661 /* Flags used by pin/bind&friends. */ 664 - #define PIN_NONBLOCK BIT(0) 665 - #define PIN_MAPPABLE BIT(1) 666 - #define PIN_ZONE_4G BIT(2) 667 - #define PIN_NONFAULT BIT(3) 668 - #define PIN_NOEVICT BIT(4) 662 + #define PIN_NONBLOCK BIT_ULL(0) 663 + #define PIN_MAPPABLE BIT_ULL(1) 664 + #define PIN_ZONE_4G BIT_ULL(2) 665 + #define PIN_NONFAULT BIT_ULL(3) 666 + #define PIN_NOEVICT BIT_ULL(4) 669 667 670 - #define PIN_MBZ BIT(5) /* I915_VMA_PIN_OVERFLOW */ 671 - #define PIN_GLOBAL BIT(6) /* I915_VMA_GLOBAL_BIND */ 672 - #define PIN_USER BIT(7) /* I915_VMA_LOCAL_BIND */ 673 - #define PIN_UPDATE BIT(8) 668 + #define PIN_MBZ BIT_ULL(5) /* I915_VMA_PIN_OVERFLOW */ 669 + #define PIN_GLOBAL BIT_ULL(6) /* I915_VMA_GLOBAL_BIND */ 670 + #define PIN_USER BIT_ULL(7) /* I915_VMA_LOCAL_BIND */ 671 + #define PIN_UPDATE BIT_ULL(8) 674 672 675 - #define PIN_HIGH BIT(9) 676 - #define PIN_OFFSET_BIAS BIT(10) 677 - #define PIN_OFFSET_FIXED BIT(11) 673 + #define PIN_HIGH BIT_ULL(9) 674 + #define PIN_OFFSET_BIAS BIT_ULL(10) 675 + #define PIN_OFFSET_FIXED BIT_ULL(11) 678 676 #define PIN_OFFSET_MASK (-I915_GTT_PAGE_SIZE) 679 677 680 678 #endif
+12 -8
drivers/gpu/drm/i915/i915_reg.h
··· 2095 2095 2096 2096 /* ICL PHY DFLEX registers */ 2097 2097 #define PORT_TX_DFLEXDPMLE1 _MMIO(0x1638C0) 2098 - #define DFLEXDPMLE1_DPMLETC_MASK(n) (0xf << (4 * (n))) 2099 - #define DFLEXDPMLE1_DPMLETC(n, x) ((x) << (4 * (n))) 2098 + #define DFLEXDPMLE1_DPMLETC_MASK(tc_port) (0xf << (4 * (tc_port))) 2099 + #define DFLEXDPMLE1_DPMLETC_ML0(tc_port) (1 << (4 * (tc_port))) 2100 + #define DFLEXDPMLE1_DPMLETC_ML1_0(tc_port) (3 << (4 * (tc_port))) 2101 + #define DFLEXDPMLE1_DPMLETC_ML3(tc_port) (8 << (4 * (tc_port))) 2102 + #define DFLEXDPMLE1_DPMLETC_ML3_2(tc_port) (12 << (4 * (tc_port))) 2103 + #define DFLEXDPMLE1_DPMLETC_ML3_0(tc_port) (15 << (4 * (tc_port))) 2100 2104 2101 2105 /* BXT PHY Ref registers */ 2102 2106 #define _PORT_REF_DW3_A 0x16218C ··· 4597 4593 4598 4594 #define DRM_DIP_ENABLE (1 << 28) 4599 4595 #define PSR_VSC_BIT_7_SET (1 << 27) 4600 - #define VSC_SELECT_MASK (0x3 << 26) 4601 - #define VSC_SELECT_SHIFT 26 4602 - #define VSC_DIP_HW_HEA_DATA (0 << 26) 4603 - #define VSC_DIP_HW_HEA_SW_DATA (1 << 26) 4604 - #define VSC_DIP_HW_DATA_SW_HEA (2 << 26) 4605 - #define VSC_DIP_SW_HEA_DATA (3 << 26) 4596 + #define VSC_SELECT_MASK (0x3 << 25) 4597 + #define VSC_SELECT_SHIFT 25 4598 + #define VSC_DIP_HW_HEA_DATA (0 << 25) 4599 + #define VSC_DIP_HW_HEA_SW_DATA (1 << 25) 4600 + #define VSC_DIP_HW_DATA_SW_HEA (2 << 25) 4601 + #define VSC_DIP_SW_HEA_DATA (3 << 25) 4606 4602 #define VDIP_ENABLE_PPS (1 << 24) 4607 4603 4608 4604 /* Panel power sequencing */
+17
drivers/gpu/drm/i915/intel_audio.c
··· 144 144 /* HDMI N/CTS table */ 145 145 #define TMDS_297M 297000 146 146 #define TMDS_296M 296703 147 + #define TMDS_594M 594000 148 + #define TMDS_593M 593407 149 + 147 150 static const struct { 148 151 int sample_rate; 149 152 int clock; ··· 167 164 { 176400, TMDS_297M, 18816, 247500 }, 168 165 { 192000, TMDS_296M, 23296, 281250 }, 169 166 { 192000, TMDS_297M, 20480, 247500 }, 167 + { 44100, TMDS_593M, 8918, 937500 }, 168 + { 44100, TMDS_594M, 9408, 990000 }, 169 + { 48000, TMDS_593M, 5824, 562500 }, 170 + { 48000, TMDS_594M, 6144, 594000 }, 171 + { 32000, TMDS_593M, 5824, 843750 }, 172 + { 32000, TMDS_594M, 3072, 445500 }, 173 + { 88200, TMDS_593M, 17836, 937500 }, 174 + { 88200, TMDS_594M, 18816, 990000 }, 175 + { 96000, TMDS_593M, 11648, 562500 }, 176 + { 96000, TMDS_594M, 12288, 594000 }, 177 + { 176400, TMDS_593M, 35672, 937500 }, 178 + { 176400, TMDS_594M, 37632, 990000 }, 179 + { 192000, TMDS_593M, 23296, 562500 }, 180 + { 192000, TMDS_594M, 24576, 594000 }, 170 181 }; 171 182 172 183 /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+2 -16
drivers/gpu/drm/i915/intel_cdclk.c
··· 2138 2138 static int intel_pixel_rate_to_cdclk(struct drm_i915_private *dev_priv, 2139 2139 int pixel_rate) 2140 2140 { 2141 - if (INTEL_GEN(dev_priv) >= 10) 2141 + if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) 2142 2142 return DIV_ROUND_UP(pixel_rate, 2); 2143 - else if (IS_GEMINILAKE(dev_priv)) 2144 - /* 2145 - * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk 2146 - * as a temporary workaround. Use a higher cdclk instead. (Note that 2147 - * intel_compute_max_dotclk() limits the max pixel clock to 99% of max 2148 - * cdclk.) 2149 - */ 2150 - return DIV_ROUND_UP(pixel_rate * 100, 2 * 99); 2151 2143 else if (IS_GEN9(dev_priv) || 2152 2144 IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) 2153 2145 return pixel_rate; ··· 2535 2543 { 2536 2544 int max_cdclk_freq = dev_priv->max_cdclk_freq; 2537 2545 2538 - if (INTEL_GEN(dev_priv) >= 10) 2546 + if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) 2539 2547 return 2 * max_cdclk_freq; 2540 - else if (IS_GEMINILAKE(dev_priv)) 2541 - /* 2542 - * FIXME: Limiting to 99% as a temporary workaround. See 2543 - * intel_min_cdclk() for details. 2544 - */ 2545 - return 2 * max_cdclk_freq * 99 / 100; 2546 2548 else if (IS_GEN9(dev_priv) || 2547 2549 IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv)) 2548 2550 return max_cdclk_freq;
+7 -12
drivers/gpu/drm/i915/intel_display.c
··· 12768 12768 intel_check_cpu_fifo_underruns(dev_priv); 12769 12769 intel_check_pch_fifo_underruns(dev_priv); 12770 12770 12771 - if (!new_crtc_state->active) { 12772 - /* 12773 - * Make sure we don't call initial_watermarks 12774 - * for ILK-style watermark updates. 12775 - * 12776 - * No clue what this is supposed to achieve. 12777 - */ 12778 - if (INTEL_GEN(dev_priv) >= 9) 12779 - dev_priv->display.initial_watermarks(intel_state, 12780 - to_intel_crtc_state(new_crtc_state)); 12781 - } 12771 + /* FIXME unify this for all platforms */ 12772 + if (!new_crtc_state->active && 12773 + !HAS_GMCH_DISPLAY(dev_priv) && 12774 + dev_priv->display.initial_watermarks) 12775 + dev_priv->display.initial_watermarks(intel_state, 12776 + to_intel_crtc_state(new_crtc_state)); 12782 12777 } 12783 12778 } 12784 12779 ··· 14641 14646 fb->height < SKL_MIN_YUV_420_SRC_H || 14642 14647 (fb->width % 4) != 0 || (fb->height % 4) != 0)) { 14643 14648 DRM_DEBUG_KMS("src dimensions not correct for NV12\n"); 14644 - return -EINVAL; 14649 + goto err; 14645 14650 } 14646 14651 14647 14652 for (i = 0; i < fb->format->num_planes; i++) {
+3 -1
drivers/gpu/drm/i915/intel_lpe_audio.c
··· 297 297 lpe_audio_platdev_destroy(dev_priv); 298 298 299 299 irq_free_desc(dev_priv->lpe_audio.irq); 300 - } 301 300 301 + dev_priv->lpe_audio.irq = -1; 302 + dev_priv->lpe_audio.platdev = NULL; 303 + } 302 304 303 305 /** 304 306 * intel_lpe_audio_notify() - notify lpe audio event
+1 -2
drivers/gpu/drm/i915/intel_pm.c
··· 2881 2881 * any underrun. If not able to get Dimm info assume 16GB dimm 2882 2882 * to avoid any underrun. 2883 2883 */ 2884 - if (!dev_priv->dram_info.valid_dimm || 2885 - dev_priv->dram_info.is_16gb_dimm) 2884 + if (dev_priv->dram_info.is_16gb_dimm) 2886 2885 wm[0] += 1; 2887 2886 2888 2887 } else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
+1 -1
drivers/gpu/drm/i915/selftests/huge_pages.c
··· 551 551 err = igt_check_page_sizes(vma); 552 552 553 553 if (vma->page_sizes.gtt != I915_GTT_PAGE_SIZE_4K) { 554 - pr_err("page_sizes.gtt=%u, expected %lu\n", 554 + pr_err("page_sizes.gtt=%u, expected %llu\n", 555 555 vma->page_sizes.gtt, I915_GTT_PAGE_SIZE_4K); 556 556 err = -EINVAL; 557 557 }
+3 -3
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
··· 1337 1337 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); 1338 1338 if (vma->node.start != total || 1339 1339 vma->node.size != 2*I915_GTT_PAGE_SIZE) { 1340 - pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", 1340 + pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", 1341 1341 vma->node.start, vma->node.size, 1342 1342 total, 2*I915_GTT_PAGE_SIZE); 1343 1343 err = -EINVAL; ··· 1386 1386 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); 1387 1387 if (vma->node.start != total || 1388 1388 vma->node.size != 2*I915_GTT_PAGE_SIZE) { 1389 - pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", 1389 + pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", 1390 1390 vma->node.start, vma->node.size, 1391 1391 total, 2*I915_GTT_PAGE_SIZE); 1392 1392 err = -EINVAL; ··· 1430 1430 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); 1431 1431 if (vma->node.start != offset || 1432 1432 vma->node.size != 2*I915_GTT_PAGE_SIZE) { 1433 - pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", 1433 + pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", 1434 1434 vma->node.start, vma->node.size, 1435 1435 offset, 2*I915_GTT_PAGE_SIZE); 1436 1436 err = -EINVAL;
+2 -2
drivers/gpu/drm/sun4i/sun4i_lvds.c
··· 75 75 76 76 DRM_DEBUG_DRIVER("Enabling LVDS output\n"); 77 77 78 - if (!IS_ERR(tcon->panel)) { 78 + if (tcon->panel) { 79 79 drm_panel_prepare(tcon->panel); 80 80 drm_panel_enable(tcon->panel); 81 81 } ··· 88 88 89 89 DRM_DEBUG_DRIVER("Disabling LVDS output\n"); 90 90 91 - if (!IS_ERR(tcon->panel)) { 91 + if (tcon->panel) { 92 92 drm_panel_disable(tcon->panel); 93 93 drm_panel_unprepare(tcon->panel); 94 94 }
+2 -2
drivers/gpu/drm/sun4i/sun4i_rgb.c
··· 135 135 136 136 DRM_DEBUG_DRIVER("Enabling RGB output\n"); 137 137 138 - if (!IS_ERR(tcon->panel)) { 138 + if (tcon->panel) { 139 139 drm_panel_prepare(tcon->panel); 140 140 drm_panel_enable(tcon->panel); 141 141 } ··· 148 148 149 149 DRM_DEBUG_DRIVER("Disabling RGB output\n"); 150 150 151 - if (!IS_ERR(tcon->panel)) { 151 + if (tcon->panel) { 152 152 drm_panel_disable(tcon->panel); 153 153 drm_panel_unprepare(tcon->panel); 154 154 }
+3 -2
drivers/gpu/drm/sun4i/sun4i_tcon.c
··· 491 491 sun4i_tcon0_mode_set_common(tcon, mode); 492 492 493 493 /* Set dithering if needed */ 494 - sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); 494 + if (tcon->panel) 495 + sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); 495 496 496 497 /* Adjust clock delay */ 497 498 clk_delay = sun4i_tcon_get_clk_delay(mode, 0); ··· 556 555 * Following code is a way to avoid quirks all around TCON 557 556 * and DOTCLOCK drivers. 558 557 */ 559 - if (!IS_ERR(tcon->panel)) { 558 + if (tcon->panel) { 560 559 struct drm_panel *panel = tcon->panel; 561 560 struct drm_connector *connector = panel->connector; 562 561 struct drm_display_info display_info = connector->display_info;
+3
drivers/gpu/vga/vga_switcheroo.c
··· 380 380 mutex_unlock(&vgasr_mutex); 381 381 return -EINVAL; 382 382 } 383 + /* notify if GPU has been already bound */ 384 + if (ops->gpu_bound) 385 + ops->gpu_bound(pdev, id); 383 386 } 384 387 mutex_unlock(&vgasr_mutex); 385 388
+18
drivers/hid/hid-alps.c
··· 660 660 return ret; 661 661 } 662 662 663 + static int alps_sp_open(struct input_dev *dev) 664 + { 665 + struct hid_device *hid = input_get_drvdata(dev); 666 + 667 + return hid_hw_open(hid); 668 + } 669 + 670 + static void alps_sp_close(struct input_dev *dev) 671 + { 672 + struct hid_device *hid = input_get_drvdata(dev); 673 + 674 + hid_hw_close(hid); 675 + } 676 + 663 677 static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) 664 678 { 665 679 struct alps_dev *data = hid_get_drvdata(hdev); ··· 746 732 input2->id.product = input->id.product; 747 733 input2->id.version = input->id.version; 748 734 input2->dev.parent = input->dev.parent; 735 + 736 + input_set_drvdata(input2, hdev); 737 + input2->open = alps_sp_open; 738 + input2->close = alps_sp_close; 749 739 750 740 __set_bit(EV_KEY, input2->evbit); 751 741 data->sp_btn_cnt = (data->sp_btn_info & 0x0F);
+3
drivers/hid/hid-asus.c
··· 359 359 u32 value; 360 360 int ret; 361 361 362 + if (!IS_ENABLED(CONFIG_ASUS_WMI)) 363 + return false; 364 + 362 365 ret = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2, 363 366 ASUS_WMI_DEVID_KBD_BACKLIGHT, 0, &value); 364 367 hid_dbg(hdev, "WMI backlight check: rc %d value %x", ret, value);
+3
drivers/hid/hid-ids.h
··· 927 927 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003 928 928 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 929 929 930 + #define I2C_VENDOR_ID_RAYDIUM 0x2386 931 + #define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33 932 + 930 933 #define USB_VENDOR_ID_RAZER 0x1532 931 934 #define USB_DEVICE_ID_RAZER_BLADE_14 0x011D 932 935
-1
drivers/hid/hid-quirks.c
··· 107 107 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL }, 108 108 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL }, 109 109 { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, 110 - { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS), HID_QUIRK_NOGET }, 111 110 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, 112 111 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, 113 112 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
+19
drivers/hid/i2c-hid/i2c-hid-core.c
··· 49 49 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) 50 50 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) 51 51 #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) 52 + #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) 52 53 53 54 /* flags */ 54 55 #define I2C_HID_STARTED 0 ··· 159 158 160 159 bool irq_wake_enabled; 161 160 struct mutex reset_lock; 161 + 162 + unsigned long sleep_delay; 162 163 }; 163 164 164 165 static const struct i2c_hid_quirks { ··· 175 172 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, 176 173 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | 177 174 I2C_HID_QUIRK_NO_RUNTIME_PM }, 175 + { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_4B33, 176 + I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, 178 177 { 0, 0 } 179 178 }; 180 179 ··· 392 387 { 393 388 struct i2c_hid *ihid = i2c_get_clientdata(client); 394 389 int ret; 390 + unsigned long now, delay; 395 391 396 392 i2c_hid_dbg(ihid, "%s\n", __func__); 397 393 ··· 410 404 goto set_pwr_exit; 411 405 } 412 406 407 + if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP && 408 + power_state == I2C_HID_PWR_ON) { 409 + now = jiffies; 410 + if (time_after(ihid->sleep_delay, now)) { 411 + delay = jiffies_to_usecs(ihid->sleep_delay - now); 412 + usleep_range(delay, delay + 1); 413 + } 414 + } 415 + 413 416 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, 414 417 0, NULL, 0, NULL, 0); 418 + 419 + if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP && 420 + power_state == I2C_HID_PWR_SLEEP) 421 + ihid->sleep_delay = jiffies + msecs_to_jiffies(20); 415 422 416 423 if (ret) 417 424 dev_err(&client->dev, "failed to change power setting.\n");
+8
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
··· 331 331 .driver_data = (void *)&sipodev_desc 332 332 }, 333 333 { 334 + .ident = "Direkt-Tek DTLAPY133-1", 335 + .matches = { 336 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"), 337 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY133-1"), 338 + }, 339 + .driver_data = (void *)&sipodev_desc 340 + }, 341 + { 334 342 .ident = "Mediacom Flexbook Edge 11", 335 343 .matches = { 336 344 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"),
+14 -4
drivers/hid/usbhid/hiddev.c
··· 512 512 if (cmd == HIDIOCGCOLLECTIONINDEX) { 513 513 if (uref->usage_index >= field->maxusage) 514 514 goto inval; 515 + uref->usage_index = 516 + array_index_nospec(uref->usage_index, 517 + field->maxusage); 515 518 } else if (uref->usage_index >= field->report_count) 516 519 goto inval; 517 520 } 518 521 519 - if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && 520 - (uref_multi->num_values > HID_MAX_MULTI_USAGES || 521 - uref->usage_index + uref_multi->num_values > field->report_count)) 522 - goto inval; 522 + if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { 523 + if (uref_multi->num_values > HID_MAX_MULTI_USAGES || 524 + uref->usage_index + uref_multi->num_values > 525 + field->report_count) 526 + goto inval; 527 + 528 + uref->usage_index = 529 + array_index_nospec(uref->usage_index, 530 + field->report_count - 531 + uref_multi->num_values); 532 + } 523 533 524 534 switch (cmd) { 525 535 case HIDIOCGUSAGE:
+4 -4
drivers/hwmon/hwmon.c
··· 649 649 if (info[i]->config[j] & HWMON_T_INPUT) { 650 650 err = hwmon_thermal_add_sensor(dev, 651 651 hwdev, j); 652 - if (err) 653 - goto free_device; 652 + if (err) { 653 + device_unregister(hdev); 654 + goto ida_remove; 655 + } 654 656 } 655 657 } 656 658 } ··· 660 658 661 659 return hdev; 662 660 663 - free_device: 664 - device_unregister(hdev); 665 661 free_hwmon: 666 662 kfree(hwdev); 667 663 ida_remove:
+3 -4
drivers/hwmon/ibmpowernv.c
··· 181 181 return sprintf(buf, "%s\n", sdata->label); 182 182 } 183 183 184 - static int __init get_logical_cpu(int hwcpu) 184 + static int get_logical_cpu(int hwcpu) 185 185 { 186 186 int cpu; 187 187 ··· 192 192 return -ENOENT; 193 193 } 194 194 195 - static void __init make_sensor_label(struct device_node *np, 196 - struct sensor_data *sdata, 197 - const char *label) 195 + static void make_sensor_label(struct device_node *np, 196 + struct sensor_data *sdata, const char *label) 198 197 { 199 198 u32 id; 200 199 size_t n;
+10 -1
drivers/i2c/busses/Kconfig
··· 224 224 This driver can also be built as a module. If so, the module 225 225 will be called i2c-nforce2-s4985. 226 226 227 + config I2C_NVIDIA_GPU 228 + tristate "NVIDIA GPU I2C controller" 229 + depends on PCI 230 + help 231 + If you say yes to this option, support will be included for the 232 + NVIDIA GPU I2C controller which is used to communicate with the GPU's 233 + Type-C controller. This driver can also be built as a module called 234 + i2c-nvidia-gpu. 235 + 227 236 config I2C_SIS5595 228 237 tristate "SiS 5595" 229 238 depends on PCI ··· 761 752 762 753 config I2C_OMAP 763 754 tristate "OMAP I2C adapter" 764 - depends on ARCH_OMAP 755 + depends on ARCH_OMAP || ARCH_K3 765 756 default y if MACH_OMAP_H3 || MACH_OMAP_OSK 766 757 help 767 758 If you say yes to this option, support will be included for the
+1
drivers/i2c/busses/Makefile
··· 19 19 obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o 20 20 obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o 21 21 obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o 22 + obj-$(CONFIG_I2C_NVIDIA_GPU) += i2c-nvidia-gpu.o 22 23 obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o 23 24 obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o 24 25 obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
+368
drivers/i2c/busses/i2c-nvidia-gpu.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Nvidia GPU I2C controller Driver 4 + * 5 + * Copyright (C) 2018 NVIDIA Corporation. All rights reserved. 6 + * Author: Ajay Gupta <ajayg@nvidia.com> 7 + */ 8 + #include <linux/delay.h> 9 + #include <linux/i2c.h> 10 + #include <linux/interrupt.h> 11 + #include <linux/module.h> 12 + #include <linux/pci.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/pm.h> 15 + #include <linux/pm_runtime.h> 16 + 17 + #include <asm/unaligned.h> 18 + 19 + /* I2C definitions */ 20 + #define I2C_MST_CNTL 0x00 21 + #define I2C_MST_CNTL_GEN_START BIT(0) 22 + #define I2C_MST_CNTL_GEN_STOP BIT(1) 23 + #define I2C_MST_CNTL_CMD_READ (1 << 2) 24 + #define I2C_MST_CNTL_CMD_WRITE (2 << 2) 25 + #define I2C_MST_CNTL_BURST_SIZE_SHIFT 6 26 + #define I2C_MST_CNTL_GEN_NACK BIT(28) 27 + #define I2C_MST_CNTL_STATUS GENMASK(30, 29) 28 + #define I2C_MST_CNTL_STATUS_OKAY (0 << 29) 29 + #define I2C_MST_CNTL_STATUS_NO_ACK (1 << 29) 30 + #define I2C_MST_CNTL_STATUS_TIMEOUT (2 << 29) 31 + #define I2C_MST_CNTL_STATUS_BUS_BUSY (3 << 29) 32 + #define I2C_MST_CNTL_CYCLE_TRIGGER BIT(31) 33 + 34 + #define I2C_MST_ADDR 0x04 35 + 36 + #define I2C_MST_I2C0_TIMING 0x08 37 + #define I2C_MST_I2C0_TIMING_SCL_PERIOD_100KHZ 0x10e 38 + #define I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT 16 39 + #define I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT_MAX 255 40 + #define I2C_MST_I2C0_TIMING_TIMEOUT_CHECK BIT(24) 41 + 42 + #define I2C_MST_DATA 0x0c 43 + 44 + #define I2C_MST_HYBRID_PADCTL 0x20 45 + #define I2C_MST_HYBRID_PADCTL_MODE_I2C BIT(0) 46 + #define I2C_MST_HYBRID_PADCTL_I2C_SCL_INPUT_RCV BIT(14) 47 + #define I2C_MST_HYBRID_PADCTL_I2C_SDA_INPUT_RCV BIT(15) 48 + 49 + struct gpu_i2c_dev { 50 + struct device *dev; 51 + void __iomem *regs; 52 + struct i2c_adapter adapter; 53 + struct i2c_board_info *gpu_ccgx_ucsi; 54 + }; 55 + 56 + static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd) 57 + { 58 + u32 val; 59 + 60 + /* enable I2C */ 61 + val = readl(i2cd->regs + I2C_MST_HYBRID_PADCTL); 62 + val |= I2C_MST_HYBRID_PADCTL_MODE_I2C | 63 + I2C_MST_HYBRID_PADCTL_I2C_SCL_INPUT_RCV | 64 + I2C_MST_HYBRID_PADCTL_I2C_SDA_INPUT_RCV; 65 + writel(val, i2cd->regs + I2C_MST_HYBRID_PADCTL); 66 + 67 + /* enable 100KHZ mode */ 68 + val = I2C_MST_I2C0_TIMING_SCL_PERIOD_100KHZ; 69 + val |= (I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT_MAX 70 + << I2C_MST_I2C0_TIMING_TIMEOUT_CLK_CNT); 71 + val |= I2C_MST_I2C0_TIMING_TIMEOUT_CHECK; 72 + writel(val, i2cd->regs + I2C_MST_I2C0_TIMING); 73 + } 74 + 75 + static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd) 76 + { 77 + unsigned long target = jiffies + msecs_to_jiffies(1000); 78 + u32 val; 79 + 80 + do { 81 + val = readl(i2cd->regs + I2C_MST_CNTL); 82 + if (!(val & I2C_MST_CNTL_CYCLE_TRIGGER)) 83 + break; 84 + if ((val & I2C_MST_CNTL_STATUS) != 85 + I2C_MST_CNTL_STATUS_BUS_BUSY) 86 + break; 87 + usleep_range(500, 600); 88 + } while (time_is_after_jiffies(target)); 89 + 90 + if (time_is_before_jiffies(target)) { 91 + dev_err(i2cd->dev, "i2c timeout error %x\n", val); 92 + return -ETIME; 93 + } 94 + 95 + val = readl(i2cd->regs + I2C_MST_CNTL); 96 + switch (val & I2C_MST_CNTL_STATUS) { 97 + case I2C_MST_CNTL_STATUS_OKAY: 98 + return 0; 99 + case I2C_MST_CNTL_STATUS_NO_ACK: 100 + return -EIO; 101 + case I2C_MST_CNTL_STATUS_TIMEOUT: 102 + return -ETIME; 103 + default: 104 + return 0; 105 + } 106 + } 107 + 108 + static int gpu_i2c_read(struct gpu_i2c_dev *i2cd, u8 *data, u16 len) 109 + { 110 + int status; 111 + u32 val; 112 + 113 + val = I2C_MST_CNTL_GEN_START | I2C_MST_CNTL_CMD_READ | 114 + (len << I2C_MST_CNTL_BURST_SIZE_SHIFT) | 115 + I2C_MST_CNTL_CYCLE_TRIGGER | I2C_MST_CNTL_GEN_NACK; 116 + writel(val, i2cd->regs + I2C_MST_CNTL); 117 + 118 + status = gpu_i2c_check_status(i2cd); 119 + if (status < 0) 120 + return status; 121 + 122 + val = readl(i2cd->regs + I2C_MST_DATA); 123 + switch (len) { 124 + case 1: 125 + data[0] = val; 126 + break; 127 + case 2: 128 + put_unaligned_be16(val, data); 129 + break; 130 + case 3: 131 + put_unaligned_be16(val >> 8, data); 132 + data[2] = val; 133 + break; 134 + case 4: 135 + put_unaligned_be32(val, data); 136 + break; 137 + default: 138 + break; 139 + } 140 + return status; 141 + } 142 + 143 + static int gpu_i2c_start(struct gpu_i2c_dev *i2cd) 144 + { 145 + writel(I2C_MST_CNTL_GEN_START, i2cd->regs + I2C_MST_CNTL); 146 + return gpu_i2c_check_status(i2cd); 147 + } 148 + 149 + static int gpu_i2c_stop(struct gpu_i2c_dev *i2cd) 150 + { 151 + writel(I2C_MST_CNTL_GEN_STOP, i2cd->regs + I2C_MST_CNTL); 152 + return gpu_i2c_check_status(i2cd); 153 + } 154 + 155 + static int gpu_i2c_write(struct gpu_i2c_dev *i2cd, u8 data) 156 + { 157 + u32 val; 158 + 159 + writel(data, i2cd->regs + I2C_MST_DATA); 160 + 161 + val = I2C_MST_CNTL_CMD_WRITE | (1 << I2C_MST_CNTL_BURST_SIZE_SHIFT); 162 + writel(val, i2cd->regs + I2C_MST_CNTL); 163 + 164 + return gpu_i2c_check_status(i2cd); 165 + } 166 + 167 + static int gpu_i2c_master_xfer(struct i2c_adapter *adap, 168 + struct i2c_msg *msgs, int num) 169 + { 170 + struct gpu_i2c_dev *i2cd = i2c_get_adapdata(adap); 171 + int status, status2; 172 + int i, j; 173 + 174 + /* 175 + * The controller supports maximum 4 byte read due to known 176 + * limitation of sending STOP after every read. 177 + */ 178 + for (i = 0; i < num; i++) { 179 + if (msgs[i].flags & I2C_M_RD) { 180 + /* program client address before starting read */ 181 + writel(msgs[i].addr, i2cd->regs + I2C_MST_ADDR); 182 + /* gpu_i2c_read has implicit start */ 183 + status = gpu_i2c_read(i2cd, msgs[i].buf, msgs[i].len); 184 + if (status < 0) 185 + goto stop; 186 + } else { 187 + u8 addr = i2c_8bit_addr_from_msg(msgs + i); 188 + 189 + status = gpu_i2c_start(i2cd); 190 + if (status < 0) { 191 + if (i == 0) 192 + return status; 193 + goto stop; 194 + } 195 + 196 + status = gpu_i2c_write(i2cd, addr); 197 + if (status < 0) 198 + goto stop; 199 + 200 + for (j = 0; j < msgs[i].len; j++) { 201 + status = gpu_i2c_write(i2cd, msgs[i].buf[j]); 202 + if (status < 0) 203 + goto stop; 204 + } 205 + } 206 + } 207 + status = gpu_i2c_stop(i2cd); 208 + if (status < 0) 209 + return status; 210 + 211 + return i; 212 + stop: 213 + status2 = gpu_i2c_stop(i2cd); 214 + if (status2 < 0) 215 + dev_err(i2cd->dev, "i2c stop failed %d\n", status2); 216 + return status; 217 + } 218 + 219 + static const struct i2c_adapter_quirks gpu_i2c_quirks = { 220 + .max_read_len = 4, 221 + .flags = I2C_AQ_COMB_WRITE_THEN_READ, 222 + }; 223 + 224 + static u32 gpu_i2c_functionality(struct i2c_adapter *adap) 225 + { 226 + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 227 + } 228 + 229 + static const struct i2c_algorithm gpu_i2c_algorithm = { 230 + .master_xfer = gpu_i2c_master_xfer, 231 + .functionality = gpu_i2c_functionality, 232 + }; 233 + 234 + /* 235 + * This driver is for Nvidia GPU cards with USB Type-C interface. 236 + * We want to identify the cards using vendor ID and class code only 237 + * to avoid dependency of adding product id for any new card which 238 + * requires this driver. 239 + * Currently there is no class code defined for UCSI device over PCI 240 + * so using UNKNOWN class for now and it will be updated when UCSI 241 + * over PCI gets a class code. 242 + * There is no other NVIDIA cards with UNKNOWN class code. Even if the 243 + * driver gets loaded for an undesired card then eventually i2c_read() 244 + * (initiated from UCSI i2c_client) will timeout or UCSI commands will 245 + * timeout. 246 + */ 247 + #define PCI_CLASS_SERIAL_UNKNOWN 0x0c80 248 + static const struct pci_device_id gpu_i2c_ids[] = { 249 + { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 250 + PCI_CLASS_SERIAL_UNKNOWN << 8, 0xffffff00}, 251 + { } 252 + }; 253 + MODULE_DEVICE_TABLE(pci, gpu_i2c_ids); 254 + 255 + static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq) 256 + { 257 + struct i2c_client *ccgx_client; 258 + 259 + i2cd->gpu_ccgx_ucsi = devm_kzalloc(i2cd->dev, 260 + sizeof(*i2cd->gpu_ccgx_ucsi), 261 + GFP_KERNEL); 262 + if (!i2cd->gpu_ccgx_ucsi) 263 + return -ENOMEM; 264 + 265 + strlcpy(i2cd->gpu_ccgx_ucsi->type, "ccgx-ucsi", 266 + sizeof(i2cd->gpu_ccgx_ucsi->type)); 267 + i2cd->gpu_ccgx_ucsi->addr = 0x8; 268 + i2cd->gpu_ccgx_ucsi->irq = irq; 269 + ccgx_client = i2c_new_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi); 270 + if (!ccgx_client) 271 + return -ENODEV; 272 + 273 + return 0; 274 + } 275 + 276 + static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id) 277 + { 278 + struct gpu_i2c_dev *i2cd; 279 + int status; 280 + 281 + i2cd = devm_kzalloc(&pdev->dev, sizeof(*i2cd), GFP_KERNEL); 282 + if (!i2cd) 283 + return -ENOMEM; 284 + 285 + i2cd->dev = &pdev->dev; 286 + dev_set_drvdata(&pdev->dev, i2cd); 287 + 288 + status = pcim_enable_device(pdev); 289 + if (status < 0) { 290 + dev_err(&pdev->dev, "pcim_enable_device failed %d\n", status); 291 + return status; 292 + } 293 + 294 + pci_set_master(pdev); 295 + 296 + i2cd->regs = pcim_iomap(pdev, 0, 0); 297 + if (!i2cd->regs) { 298 + dev_err(&pdev->dev, "pcim_iomap failed\n"); 299 + return -ENOMEM; 300 + } 301 + 302 + status = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); 303 + if (status < 0) { 304 + dev_err(&pdev->dev, "pci_alloc_irq_vectors err %d\n", status); 305 + return status; 306 + } 307 + 308 + gpu_enable_i2c_bus(i2cd); 309 + 310 + i2c_set_adapdata(&i2cd->adapter, i2cd); 311 + i2cd->adapter.owner = THIS_MODULE; 312 + strlcpy(i2cd->adapter.name, "NVIDIA GPU I2C adapter", 313 + sizeof(i2cd->adapter.name)); 314 + i2cd->adapter.algo = &gpu_i2c_algorithm; 315 + i2cd->adapter.quirks = &gpu_i2c_quirks; 316 + i2cd->adapter.dev.parent = &pdev->dev; 317 + status = i2c_add_adapter(&i2cd->adapter); 318 + if (status < 0) 319 + goto free_irq_vectors; 320 + 321 + status = gpu_populate_client(i2cd, pdev->irq); 322 + if (status < 0) { 323 + dev_err(&pdev->dev, "gpu_populate_client failed %d\n", status); 324 + goto del_adapter; 325 + } 326 + 327 + return 0; 328 + 329 + del_adapter: 330 + i2c_del_adapter(&i2cd->adapter); 331 + free_irq_vectors: 332 + pci_free_irq_vectors(pdev); 333 + return status; 334 + } 335 + 336 + static void gpu_i2c_remove(struct pci_dev *pdev) 337 + { 338 + struct gpu_i2c_dev *i2cd = dev_get_drvdata(&pdev->dev); 339 + 340 + i2c_del_adapter(&i2cd->adapter); 341 + pci_free_irq_vectors(pdev); 342 + } 343 + 344 + static int gpu_i2c_resume(struct device *dev) 345 + { 346 + struct gpu_i2c_dev *i2cd = dev_get_drvdata(dev); 347 + 348 + gpu_enable_i2c_bus(i2cd); 349 + return 0; 350 + } 351 + 352 + static UNIVERSAL_DEV_PM_OPS(gpu_i2c_driver_pm, NULL, gpu_i2c_resume, NULL); 353 + 354 + static struct pci_driver gpu_i2c_driver = { 355 + .name = "nvidia-gpu", 356 + .id_table = gpu_i2c_ids, 357 + .probe = gpu_i2c_probe, 358 + .remove = gpu_i2c_remove, 359 + .driver = { 360 + .pm = &gpu_i2c_driver_pm, 361 + }, 362 + }; 363 + 364 + module_pci_driver(gpu_i2c_driver); 365 + 366 + MODULE_AUTHOR("Ajay Gupta <ajayg@nvidia.com>"); 367 + MODULE_DESCRIPTION("Nvidia GPU I2C controller Driver"); 368 + MODULE_LICENSE("GPL v2");
+8 -7
drivers/i2c/busses/i2c-qcom-geni.c
··· 571 571 572 572 dev_dbg(&pdev->dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); 573 573 574 - ret = i2c_add_adapter(&gi2c->adap); 575 - if (ret) { 576 - dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); 577 - return ret; 578 - } 579 - 580 574 gi2c->suspended = 1; 581 575 pm_runtime_set_suspended(gi2c->se.dev); 582 576 pm_runtime_set_autosuspend_delay(gi2c->se.dev, I2C_AUTO_SUSPEND_DELAY); 583 577 pm_runtime_use_autosuspend(gi2c->se.dev); 584 578 pm_runtime_enable(gi2c->se.dev); 579 + 580 + ret = i2c_add_adapter(&gi2c->adap); 581 + if (ret) { 582 + dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); 583 + pm_runtime_disable(gi2c->se.dev); 584 + return ret; 585 + } 585 586 586 587 return 0; 587 588 } ··· 591 590 { 592 591 struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); 593 592 594 - pm_runtime_disable(gi2c->se.dev); 595 593 i2c_del_adapter(&gi2c->adap); 594 + pm_runtime_disable(gi2c->se.dev); 596 595 return 0; 597 596 } 598 597
+8 -19
drivers/leds/trigger/ledtrig-pattern.c
··· 75 75 { 76 76 struct pattern_trig_data *data = from_timer(data, t, timer); 77 77 78 - mutex_lock(&data->lock); 79 - 80 78 for (;;) { 81 79 if (!data->is_indefinite && !data->repeat) 82 80 break; ··· 85 87 data->curr->brightness); 86 88 mod_timer(&data->timer, 87 89 jiffies + msecs_to_jiffies(data->curr->delta_t)); 88 - 89 - /* Skip the tuple with zero duration */ 90 - pattern_trig_update_patterns(data); 90 + if (!data->next->delta_t) { 91 + /* Skip the tuple with zero duration */ 92 + pattern_trig_update_patterns(data); 93 + } 91 94 /* Select next tuple */ 92 95 pattern_trig_update_patterns(data); 93 96 } else { ··· 115 116 116 117 break; 117 118 } 118 - 119 - mutex_unlock(&data->lock); 120 119 } 121 120 122 121 static int pattern_trig_start_pattern(struct led_classdev *led_cdev) ··· 173 176 if (res < -1 || res == 0) 174 177 return -EINVAL; 175 178 176 - /* 177 - * Clear previous patterns' performence firstly, and remove the timer 178 - * without mutex lock to avoid dead lock. 179 - */ 180 - del_timer_sync(&data->timer); 181 - 182 179 mutex_lock(&data->lock); 180 + 181 + del_timer_sync(&data->timer); 183 182 184 183 if (data->is_hw_pattern) 185 184 led_cdev->pattern_clear(led_cdev); ··· 227 234 struct pattern_trig_data *data = led_cdev->trigger_data; 228 235 int ccount, cr, offset = 0, err = 0; 229 236 230 - /* 231 - * Clear previous patterns' performence firstly, and remove the timer 232 - * without mutex lock to avoid dead lock. 233 - */ 234 - del_timer_sync(&data->timer); 235 - 236 237 mutex_lock(&data->lock); 238 + 239 + del_timer_sync(&data->timer); 237 240 238 241 if (data->is_hw_pattern) 239 242 led_cdev->pattern_clear(led_cdev);
+1 -1
drivers/mtd/devices/Kconfig
··· 207 207 config MTD_DOCG3 208 208 tristate "M-Systems Disk-On-Chip G3" 209 209 select BCH 210 - select BCH_CONST_PARAMS 210 + select BCH_CONST_PARAMS if !MTD_NAND_BCH 211 211 select BITREVERSE 212 212 help 213 213 This provides an MTD device driver for the M-Systems DiskOnChip
+9 -1
drivers/mtd/maps/sa1100-flash.c
··· 221 221 info->mtd = info->subdev[0].mtd; 222 222 ret = 0; 223 223 } else if (info->num_subdev > 1) { 224 - struct mtd_info *cdev[nr]; 224 + struct mtd_info **cdev; 225 + 226 + cdev = kmalloc_array(nr, sizeof(*cdev), GFP_KERNEL); 227 + if (!cdev) { 228 + ret = -ENOMEM; 229 + goto err; 230 + } 231 + 225 232 /* 226 233 * We detected multiple devices. Concatenate them together. 227 234 */ ··· 237 230 238 231 info->mtd = mtd_concat_create(cdev, info->num_subdev, 239 232 plat->name); 233 + kfree(cdev); 240 234 if (info->mtd == NULL) { 241 235 ret = -ENXIO; 242 236 goto err;
-1
drivers/mtd/nand/raw/nand_base.c
··· 590 590 591 591 /** 592 592 * panic_nand_wait - [GENERIC] wait until the command is done 593 - * @mtd: MTD device structure 594 593 * @chip: NAND chip structure 595 594 * @timeo: timeout 596 595 *
+1 -1
drivers/mtd/spi-nor/cadence-quadspi.c
··· 996 996 err_unmap: 997 997 dma_unmap_single(nor->dev, dma_dst, len, DMA_FROM_DEVICE); 998 998 999 - return 0; 999 + return ret; 1000 1000 } 1001 1001 1002 1002 static ssize_t cqspi_read(struct spi_nor *nor, loff_t from,
+4 -2
drivers/mtd/spi-nor/spi-nor.c
··· 3250 3250 memcpy(&sfdp_params, params, sizeof(sfdp_params)); 3251 3251 memcpy(&prev_map, &nor->erase_map, sizeof(prev_map)); 3252 3252 3253 - if (spi_nor_parse_sfdp(nor, &sfdp_params)) 3253 + if (spi_nor_parse_sfdp(nor, &sfdp_params)) { 3254 + nor->addr_width = 0; 3254 3255 /* restore previous erase map */ 3255 3256 memcpy(&nor->erase_map, &prev_map, 3256 3257 sizeof(nor->erase_map)); 3257 - else 3258 + } else { 3258 3259 memcpy(params, &sfdp_params, sizeof(*params)); 3260 + } 3259 3261 } 3260 3262 3261 3263 return 0;
+2
drivers/net/dsa/mv88e6xxx/global1.c
··· 567 567 if (err) 568 568 return err; 569 569 570 + /* Keep the histogram mode bits */ 571 + val &= MV88E6XXX_G1_STATS_OP_HIST_RX_TX; 570 572 val |= MV88E6XXX_G1_STATS_OP_BUSY | MV88E6XXX_G1_STATS_OP_FLUSH_ALL; 571 573 572 574 err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);
+4 -4
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
··· 407 407 struct ethtool_pauseparam *pause) 408 408 { 409 409 struct aq_nic_s *aq_nic = netdev_priv(ndev); 410 + u32 fc = aq_nic->aq_nic_cfg.flow_control; 410 411 411 412 pause->autoneg = 0; 412 413 413 - if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX) 414 - pause->rx_pause = 1; 415 - if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_TX) 416 - pause->tx_pause = 1; 414 + pause->rx_pause = !!(fc & AQ_NIC_FC_RX); 415 + pause->tx_pause = !!(fc & AQ_NIC_FC_TX); 416 + 417 417 } 418 418 419 419 static int aq_ethtool_set_pauseparam(struct net_device *ndev,
+6
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
··· 204 204 205 205 int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version); 206 206 207 + int (*hw_set_offload)(struct aq_hw_s *self, 208 + struct aq_nic_cfg_s *aq_nic_cfg); 209 + 210 + int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc); 207 211 }; 208 212 209 213 struct aq_fw_ops { ··· 229 225 int (*update_link_status)(struct aq_hw_s *self); 230 226 231 227 int (*update_stats)(struct aq_hw_s *self); 228 + 229 + u32 (*get_flow_control)(struct aq_hw_s *self, u32 *fcmode); 232 230 233 231 int (*set_flow_control)(struct aq_hw_s *self); 234 232
+8 -2
drivers/net/ethernet/aquantia/atlantic/aq_main.c
··· 99 99 struct aq_nic_s *aq_nic = netdev_priv(ndev); 100 100 struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic); 101 101 bool is_lro = false; 102 + int err = 0; 102 103 103 - if (aq_cfg->hw_features & NETIF_F_LRO) { 104 + aq_cfg->features = features; 105 + 106 + if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) { 104 107 is_lro = features & NETIF_F_LRO; 105 108 106 109 if (aq_cfg->is_lro != is_lro) { ··· 115 112 } 116 113 } 117 114 } 115 + if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM) 116 + err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw, 117 + aq_cfg); 118 118 119 - return 0; 119 + return err; 120 120 } 121 121 122 122 static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr)
+15 -3
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
··· 118 118 } 119 119 120 120 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; 121 - cfg->hw_features = cfg->aq_hw_caps->hw_features; 121 + cfg->features = cfg->aq_hw_caps->hw_features; 122 122 } 123 123 124 124 static int aq_nic_update_link_status(struct aq_nic_s *self) 125 125 { 126 126 int err = self->aq_fw_ops->update_link_status(self->aq_hw); 127 + u32 fc = 0; 127 128 128 129 if (err) 129 130 return err; ··· 134 133 AQ_CFG_DRV_NAME, self->link_status.mbps, 135 134 self->aq_hw->aq_link_status.mbps); 136 135 aq_nic_update_interrupt_moderation_settings(self); 136 + 137 + /* Driver has to update flow control settings on RX block 138 + * on any link event. 139 + * We should query FW whether it negotiated FC. 140 + */ 141 + if (self->aq_fw_ops->get_flow_control) 142 + self->aq_fw_ops->get_flow_control(self->aq_hw, &fc); 143 + if (self->aq_hw_ops->hw_set_fc) 144 + self->aq_hw_ops->hw_set_fc(self->aq_hw, fc, 0); 137 145 } 138 146 139 147 self->link_status = self->aq_hw->aq_link_status; ··· 600 590 } 601 591 } 602 592 603 - if (i > 0 && i < AQ_HW_MULTICAST_ADDRESS_MAX) { 593 + if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) { 604 594 packet_filter |= IFF_MULTICAST; 605 595 self->mc_list.count = i; 606 596 self->aq_hw_ops->hw_multicast_list_set(self->aq_hw, ··· 782 772 ethtool_link_ksettings_add_link_mode(cmd, advertising, 783 773 Pause); 784 774 785 - if (self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX) 775 + /* Asym is when either RX or TX, but not both */ 776 + if (!!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX) ^ 777 + !!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_RX)) 786 778 ethtool_link_ksettings_add_link_mode(cmd, advertising, 787 779 Asym_Pause); 788 780
+1 -1
drivers/net/ethernet/aquantia/atlantic/aq_nic.h
··· 23 23 24 24 struct aq_nic_cfg_s { 25 25 const struct aq_hw_caps_s *aq_hw_caps; 26 - u64 hw_features; 26 + u64 features; 27 27 u32 rxds; /* rx ring size, descriptors # */ 28 28 u32 txds; /* tx ring size, descriptors # */ 29 29 u32 vecs; /* vecs==allocated irqs */
+23 -12
drivers/net/ethernet/aquantia/atlantic/aq_ring.c
··· 172 172 return !!budget; 173 173 } 174 174 175 + static void aq_rx_checksum(struct aq_ring_s *self, 176 + struct aq_ring_buff_s *buff, 177 + struct sk_buff *skb) 178 + { 179 + if (!(self->aq_nic->ndev->features & NETIF_F_RXCSUM)) 180 + return; 181 + 182 + if (unlikely(buff->is_cso_err)) { 183 + ++self->stats.rx.errors; 184 + skb->ip_summed = CHECKSUM_NONE; 185 + return; 186 + } 187 + if (buff->is_ip_cso) { 188 + __skb_incr_checksum_unnecessary(skb); 189 + if (buff->is_udp_cso || buff->is_tcp_cso) 190 + __skb_incr_checksum_unnecessary(skb); 191 + } else { 192 + skb->ip_summed = CHECKSUM_NONE; 193 + } 194 + } 195 + 175 196 #define AQ_SKB_ALIGN SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) 176 197 int aq_ring_rx_clean(struct aq_ring_s *self, 177 198 struct napi_struct *napi, ··· 288 267 } 289 268 290 269 skb->protocol = eth_type_trans(skb, ndev); 291 - if (unlikely(buff->is_cso_err)) { 292 - ++self->stats.rx.errors; 293 - skb->ip_summed = CHECKSUM_NONE; 294 - } else { 295 - if (buff->is_ip_cso) { 296 - __skb_incr_checksum_unnecessary(skb); 297 - if (buff->is_udp_cso || buff->is_tcp_cso) 298 - __skb_incr_checksum_unnecessary(skb); 299 - } else { 300 - skb->ip_summed = CHECKSUM_NONE; 301 - } 302 - } 270 + 271 + aq_rx_checksum(self, buff, skb); 303 272 304 273 skb_set_hash(skb, buff->rss_hash, 305 274 buff->is_hash_l4 ? PKT_HASH_TYPE_L4 :
+38 -23
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 100 100 return err; 101 101 } 102 102 103 + static int hw_atl_b0_set_fc(struct aq_hw_s *self, u32 fc, u32 tc) 104 + { 105 + hw_atl_rpb_rx_xoff_en_per_tc_set(self, !!(fc & AQ_NIC_FC_RX), tc); 106 + return 0; 107 + } 108 + 103 109 static int hw_atl_b0_hw_qos_set(struct aq_hw_s *self) 104 110 { 105 111 u32 tc = 0U; 106 112 u32 buff_size = 0U; 107 113 unsigned int i_priority = 0U; 108 - bool is_rx_flow_control = false; 109 114 110 115 /* TPS Descriptor rate init */ 111 116 hw_atl_tps_tx_pkt_shed_desc_rate_curr_time_res_set(self, 0x0U); ··· 143 138 144 139 /* QoS Rx buf size per TC */ 145 140 tc = 0; 146 - is_rx_flow_control = (AQ_NIC_FC_RX & self->aq_nic_cfg->flow_control); 147 141 buff_size = HW_ATL_B0_RXBUF_MAX; 148 142 149 143 hw_atl_rpb_rx_pkt_buff_size_per_tc_set(self, buff_size, tc); ··· 154 150 (buff_size * 155 151 (1024U / 32U) * 50U) / 156 152 100U, tc); 157 - hw_atl_rpb_rx_xoff_en_per_tc_set(self, is_rx_flow_control ? 1U : 0U, tc); 153 + 154 + hw_atl_b0_set_fc(self, self->aq_nic_cfg->flow_control, tc); 158 155 159 156 /* QoS 802.1p priority -> TC mapping */ 160 157 for (i_priority = 8U; i_priority--;) ··· 234 229 hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1); 235 230 236 231 /* RX checksums offloads*/ 237 - hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1); 238 - hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1); 232 + hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features & 233 + NETIF_F_RXCSUM)); 234 + hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features & 235 + NETIF_F_RXCSUM)); 239 236 240 237 /* LSO offloads*/ 241 238 hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU); ··· 662 655 struct hw_atl_rxd_wb_s *rxd_wb = (struct hw_atl_rxd_wb_s *) 663 656 &ring->dx_ring[ring->hw_head * HW_ATL_B0_RXD_SIZE]; 664 657 665 - unsigned int is_err = 1U; 666 658 unsigned int is_rx_check_sum_enabled = 0U; 667 659 unsigned int pkt_type = 0U; 660 + u8 rx_stat = 0U; 668 661 669 662 if (!(rxd_wb->status & 0x1U)) { /* RxD is not done */ 670 663 break; ··· 672 665 673 666 buff = &ring->buff_ring[ring->hw_head]; 674 667 675 - is_err = (0x0000003CU & rxd_wb->status); 668 + rx_stat = (0x0000003CU & rxd_wb->status) >> 2; 676 669 677 670 is_rx_check_sum_enabled = (rxd_wb->type) & (0x3U << 19); 678 - is_err &= ~0x20U; /* exclude validity bit */ 679 671 680 672 pkt_type = 0xFFU & (rxd_wb->type >> 4); 681 673 682 - if (is_rx_check_sum_enabled) { 683 - if (0x0U == (pkt_type & 0x3U)) 684 - buff->is_ip_cso = (is_err & 0x08U) ? 0U : 1U; 674 + if (is_rx_check_sum_enabled & BIT(0) && 675 + (0x0U == (pkt_type & 0x3U))) 676 + buff->is_ip_cso = (rx_stat & BIT(1)) ? 0U : 1U; 685 677 678 + if (is_rx_check_sum_enabled & BIT(1)) { 686 679 if (0x4U == (pkt_type & 0x1CU)) 687 - buff->is_udp_cso = buff->is_cso_err ? 0U : 1U; 680 + buff->is_udp_cso = (rx_stat & BIT(2)) ? 0U : 681 + !!(rx_stat & BIT(3)); 688 682 else if (0x0U == (pkt_type & 0x1CU)) 689 - buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U; 690 - 691 - /* Checksum offload workaround for small packets */ 692 - if (rxd_wb->pkt_len <= 60) { 693 - buff->is_ip_cso = 0U; 694 - buff->is_cso_err = 0U; 695 - } 683 + buff->is_tcp_cso = (rx_stat & BIT(2)) ? 0U : 684 + !!(rx_stat & BIT(3)); 696 685 } 697 - 698 - is_err &= ~0x18U; 686 + buff->is_cso_err = !!(rx_stat & 0x6); 687 + /* Checksum offload workaround for small packets */ 688 + if (unlikely(rxd_wb->pkt_len <= 60)) { 689 + buff->is_ip_cso = 0U; 690 + buff->is_cso_err = 0U; 691 + } 699 692 700 693 dma_unmap_page(ndev, buff->pa, buff->len, DMA_FROM_DEVICE); 701 694 702 - if (is_err || rxd_wb->type & 0x1000U) { 703 - /* status error or DMA error */ 695 + if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) { 696 + /* MAC error or DMA error */ 704 697 buff->is_error = 1U; 705 698 } else { 706 699 if (self->aq_nic_cfg->is_rss) { ··· 922 915 static int hw_atl_b0_hw_stop(struct aq_hw_s *self) 923 916 { 924 917 hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK); 918 + 919 + /* Invalidate Descriptor Cache to prevent writing to the cached 920 + * descriptors and to the data pointer of those descriptors 921 + */ 922 + hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1); 923 + 925 924 return aq_hw_err_from_flags(self); 926 925 } 927 926 ··· 976 963 .hw_get_regs = hw_atl_utils_hw_get_regs, 977 964 .hw_get_hw_stats = hw_atl_utils_get_hw_stats, 978 965 .hw_get_fw_version = hw_atl_utils_get_fw_version, 966 + .hw_set_offload = hw_atl_b0_hw_offload_set, 967 + .hw_set_fc = hw_atl_b0_set_fc, 979 968 };
+8
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
··· 619 619 HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); 620 620 } 621 621 622 + void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init) 623 + { 624 + aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, 625 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, 626 + HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, 627 + init); 628 + } 629 + 622 630 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, 623 631 u32 rx_pkt_buff_size_per_tc, u32 buffer) 624 632 {
+3
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
··· 325 325 u32 rx_pkt_buff_size_per_tc, 326 326 u32 buffer); 327 327 328 + /* set rdm rx dma descriptor cache init */ 329 + void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init); 330 + 328 331 /* set rx xoff enable (per tc) */ 329 332 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc, 330 333 u32 buffer);
+18
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
··· 293 293 /* default value of bitfield desc{d}_reset */ 294 294 #define HW_ATL_RDM_DESCDRESET_DEFAULT 0x0 295 295 296 + /* rdm_desc_init_i bitfield definitions 297 + * preprocessor definitions for the bitfield rdm_desc_init_i. 298 + * port="pif_rdm_desc_init_i" 299 + */ 300 + 301 + /* register address for bitfield rdm_desc_init_i */ 302 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR 0x00005a00 303 + /* bitmask for bitfield rdm_desc_init_i */ 304 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK 0xffffffff 305 + /* inverted bitmask for bitfield rdm_desc_init_i */ 306 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSKN 0x00000000 307 + /* lower bit position of bitfield rdm_desc_init_i */ 308 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT 0 309 + /* width of bitfield rdm_desc_init_i */ 310 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_WIDTH 32 311 + /* default value of bitfield rdm_desc_init_i */ 312 + #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0 313 + 296 314 /* rx int_desc_wrb_en bitfield definitions 297 315 * preprocessor definitions for the bitfield "int_desc_wrb_en". 298 316 * port="pif_rdm_int_desc_wrb_en_i"
+21
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
··· 30 30 #define HW_ATL_FW2X_MPI_STATE_ADDR 0x370 31 31 #define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374 32 32 33 + #define HW_ATL_FW2X_CAP_PAUSE BIT(CAPS_HI_PAUSE) 34 + #define HW_ATL_FW2X_CAP_ASYM_PAUSE BIT(CAPS_HI_ASYMMETRIC_PAUSE) 33 35 #define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY) 34 36 #define HW_ATL_FW2X_CAP_WOL BIT(CAPS_HI_WOL) 35 37 ··· 453 451 return 0; 454 452 } 455 453 454 + static u32 aq_fw2x_get_flow_control(struct aq_hw_s *self, u32 *fcmode) 455 + { 456 + u32 mpi_state = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_STATE2_ADDR); 457 + 458 + if (mpi_state & HW_ATL_FW2X_CAP_PAUSE) 459 + if (mpi_state & HW_ATL_FW2X_CAP_ASYM_PAUSE) 460 + *fcmode = AQ_NIC_FC_RX; 461 + else 462 + *fcmode = AQ_NIC_FC_RX | AQ_NIC_FC_TX; 463 + else 464 + if (mpi_state & HW_ATL_FW2X_CAP_ASYM_PAUSE) 465 + *fcmode = AQ_NIC_FC_TX; 466 + else 467 + *fcmode = 0; 468 + 469 + return 0; 470 + } 471 + 456 472 const struct aq_fw_ops aq_fw_2x_ops = { 457 473 .init = aq_fw2x_init, 458 474 .deinit = aq_fw2x_deinit, ··· 485 465 .set_eee_rate = aq_fw2x_set_eee_rate, 486 466 .get_eee_rate = aq_fw2x_get_eee_rate, 487 467 .set_flow_control = aq_fw2x_set_flow_control, 468 + .get_flow_control = aq_fw2x_get_flow_control 488 469 };
+2 -1
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 3838 3838 /* Hardware table is only clear when pf resets */ 3839 3839 if (!(handle->flags & HNAE3_SUPPORT_VF)) { 3840 3840 ret = hns3_restore_vlan(netdev); 3841 - return ret; 3841 + if (ret) 3842 + return ret; 3842 3843 } 3843 3844 3844 3845 ret = hns3_restore_fd_rules(netdev);
+1 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 1545 1545 tx_crq.v1.sge_len = cpu_to_be32(skb->len); 1546 1546 tx_crq.v1.ioba = cpu_to_be64(data_dma_addr); 1547 1547 1548 - if (adapter->vlan_header_insertion) { 1548 + if (adapter->vlan_header_insertion && skb_vlan_tag_present(skb)) { 1549 1549 tx_crq.v1.flags2 |= IBMVNIC_TX_VLAN_INSERT; 1550 1550 tx_crq.v1.vlan_id = cpu_to_be16(skb->vlan_tci); 1551 1551 }
+5 -3
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 12249 12249 NETIF_F_GSO_GRE | 12250 12250 NETIF_F_GSO_GRE_CSUM | 12251 12251 NETIF_F_GSO_PARTIAL | 12252 + NETIF_F_GSO_IPXIP4 | 12253 + NETIF_F_GSO_IPXIP6 | 12252 12254 NETIF_F_GSO_UDP_TUNNEL | 12253 12255 NETIF_F_GSO_UDP_TUNNEL_CSUM | 12254 12256 NETIF_F_SCTP_CRC | ··· 12268 12266 /* record features VLANs can make use of */ 12269 12267 netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID; 12270 12268 12271 - if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) 12272 - netdev->hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC; 12273 - 12274 12269 hw_features = hw_enc_features | 12275 12270 NETIF_F_HW_VLAN_CTAG_TX | 12276 12271 NETIF_F_HW_VLAN_CTAG_RX; 12272 + 12273 + if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) 12274 + hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC; 12277 12275 12278 12276 netdev->hw_features |= hw_features; 12279 12277
+3 -1
drivers/net/ethernet/intel/ice/ice.h
··· 76 76 #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1) 77 77 #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1) 78 78 79 + #define ICE_MAX_RESET_WAIT 20 80 + 79 81 #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4) 80 82 81 83 #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK) ··· 191 189 u64 tx_linearize; 192 190 DECLARE_BITMAP(state, __ICE_STATE_NBITS); 193 191 DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS); 194 - unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 195 192 unsigned int current_netdev_flags; 196 193 u32 tx_restart; 197 194 u32 tx_busy; ··· 370 369 int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); 371 370 void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); 372 371 void ice_print_link_msg(struct ice_vsi *vsi, bool isup); 372 + void ice_napi_del(struct ice_vsi *vsi); 373 373 374 374 #endif /* _ICE_H_ */
+3
drivers/net/ethernet/intel/ice/ice_common.c
··· 811 811 /* Attempt to disable FW logging before shutting down control queues */ 812 812 ice_cfg_fw_log(hw, false); 813 813 ice_shutdown_all_ctrlq(hw); 814 + 815 + /* Clear VSI contexts if not already cleared */ 816 + ice_clear_all_vsi_ctx(hw); 814 817 } 815 818 816 819 /**
+6 -1
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 1517 1517 } 1518 1518 1519 1519 if (!test_bit(__ICE_DOWN, pf->state)) { 1520 - /* Give it a little more time to try to come back */ 1520 + /* Give it a little more time to try to come back. If still 1521 + * down, restart autoneg link or reinitialize the interface. 1522 + */ 1521 1523 msleep(75); 1522 1524 if (!test_bit(__ICE_DOWN, pf->state)) 1523 1525 return ice_nway_reset(netdev); 1526 + 1527 + ice_down(vsi); 1528 + ice_up(vsi); 1524 1529 } 1525 1530 1526 1531 return err;
+2
drivers/net/ethernet/intel/ice/ice_hw_autogen.h
··· 242 242 #define GLNVM_ULD 0x000B6008 243 243 #define GLNVM_ULD_CORER_DONE_M BIT(3) 244 244 #define GLNVM_ULD_GLOBR_DONE_M BIT(4) 245 + #define GLPCI_CNF2 0x000BE004 246 + #define GLPCI_CNF2_CACHELINE_SIZE_M BIT(1) 245 247 #define PF_FUNC_RID 0x0009E880 246 248 #define PF_FUNC_RID_FUNC_NUM_S 0 247 249 #define PF_FUNC_RID_FUNC_NUM_M ICE_M(0x7, 0)
+2 -1
drivers/net/ethernet/intel/ice/ice_lib.c
··· 1997 1997 status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL); 1998 1998 if (status) { 1999 1999 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n", 2000 - ena ? "Ena" : "Dis", vsi->idx, vsi->vsi_num, status, 2000 + ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status, 2001 2001 vsi->back->hw.adminq.sq_last_status); 2002 2002 goto err_out; 2003 2003 } ··· 2458 2458 * on this wq 2459 2459 */ 2460 2460 if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) { 2461 + ice_napi_del(vsi); 2461 2462 unregister_netdev(vsi->netdev); 2462 2463 free_netdev(vsi->netdev); 2463 2464 vsi->netdev = NULL;
+48 -38
drivers/net/ethernet/intel/ice/ice_main.c
··· 1465 1465 * ice_napi_del - Remove NAPI handler for the VSI 1466 1466 * @vsi: VSI for which NAPI handler is to be removed 1467 1467 */ 1468 - static void ice_napi_del(struct ice_vsi *vsi) 1468 + void ice_napi_del(struct ice_vsi *vsi) 1469 1469 { 1470 1470 int v_idx; 1471 1471 ··· 1622 1622 { 1623 1623 struct ice_netdev_priv *np = netdev_priv(netdev); 1624 1624 struct ice_vsi *vsi = np->vsi; 1625 - int ret; 1626 1625 1627 1626 if (vid >= VLAN_N_VID) { 1628 1627 netdev_err(netdev, "VLAN id requested %d is out of range %d\n", ··· 1634 1635 1635 1636 /* Enable VLAN pruning when VLAN 0 is added */ 1636 1637 if (unlikely(!vid)) { 1637 - ret = ice_cfg_vlan_pruning(vsi, true); 1638 + int ret = ice_cfg_vlan_pruning(vsi, true); 1639 + 1638 1640 if (ret) 1639 1641 return ret; 1640 1642 } ··· 1644 1644 * needed to continue allowing all untagged packets since VLAN prune 1645 1645 * list is applied to all packets by the switch 1646 1646 */ 1647 - ret = ice_vsi_add_vlan(vsi, vid); 1648 - 1649 - if (!ret) 1650 - set_bit(vid, vsi->active_vlans); 1651 - 1652 - return ret; 1647 + return ice_vsi_add_vlan(vsi, vid); 1653 1648 } 1654 1649 1655 1650 /** ··· 1671 1676 status = ice_vsi_kill_vlan(vsi, vid); 1672 1677 if (status) 1673 1678 return status; 1674 - 1675 - clear_bit(vid, vsi->active_vlans); 1676 1679 1677 1680 /* Disable VLAN pruning when VLAN 0 is removed */ 1678 1681 if (unlikely(!vid)) ··· 1995 2002 } 1996 2003 1997 2004 /** 2005 + * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines 2006 + * @pf: pointer to the PF structure 2007 + * 2008 + * There is no error returned here because the driver should be able to handle 2009 + * 128 Byte cache lines, so we only print a warning in case issues are seen, 2010 + * specifically with Tx. 2011 + */ 2012 + static void ice_verify_cacheline_size(struct ice_pf *pf) 2013 + { 2014 + if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M) 2015 + dev_warn(&pf->pdev->dev, 2016 + "%d Byte cache line assumption is invalid, driver may have Tx timeouts!\n", 2017 + ICE_CACHE_LINE_BYTES); 2018 + } 2019 + 2020 + /** 1998 2021 * ice_probe - Device initialization routine 1999 2022 * @pdev: PCI device information struct 2000 2023 * @ent: entry in ice_pci_tbl ··· 2160 2151 /* since everything is good, start the service timer */ 2161 2152 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period)); 2162 2153 2154 + ice_verify_cacheline_size(pf); 2155 + 2163 2156 return 0; 2164 2157 2165 2158 err_alloc_sw_unroll: ··· 2192 2181 2193 2182 if (!pf) 2194 2183 return; 2184 + 2185 + for (i = 0; i < ICE_MAX_RESET_WAIT; i++) { 2186 + if (!ice_is_reset_in_progress(pf->state)) 2187 + break; 2188 + msleep(100); 2189 + } 2195 2190 2196 2191 set_bit(__ICE_DOWN, pf->state); 2197 2192 ice_service_task_stop(pf); ··· 2527 2510 } 2528 2511 2529 2512 /** 2530 - * ice_restore_vlan - Reinstate VLANs when vsi/netdev comes back up 2531 - * @vsi: the VSI being brought back up 2532 - */ 2533 - static int ice_restore_vlan(struct ice_vsi *vsi) 2534 - { 2535 - int err; 2536 - u16 vid; 2537 - 2538 - if (!vsi->netdev) 2539 - return -EINVAL; 2540 - 2541 - err = ice_vsi_vlan_setup(vsi); 2542 - if (err) 2543 - return err; 2544 - 2545 - for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID) { 2546 - err = ice_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q), vid); 2547 - if (err) 2548 - break; 2549 - } 2550 - 2551 - return err; 2552 - } 2553 - 2554 - /** 2555 2513 * ice_vsi_cfg - Setup the VSI 2556 2514 * @vsi: the VSI being configured 2557 2515 * ··· 2538 2546 2539 2547 if (vsi->netdev) { 2540 2548 ice_set_rx_mode(vsi->netdev); 2541 - err = ice_restore_vlan(vsi); 2549 + 2550 + err = ice_vsi_vlan_setup(vsi); 2551 + 2542 2552 if (err) 2543 2553 return err; 2544 2554 } ··· 3290 3296 struct device *dev = &pf->pdev->dev; 3291 3297 struct ice_hw *hw = &pf->hw; 3292 3298 enum ice_status ret; 3293 - int err; 3299 + int err, i; 3294 3300 3295 3301 if (test_bit(__ICE_DOWN, pf->state)) 3296 3302 goto clear_recovery; ··· 3364 3370 } 3365 3371 3366 3372 ice_reset_all_vfs(pf, true); 3373 + 3374 + for (i = 0; i < pf->num_alloc_vsi; i++) { 3375 + bool link_up; 3376 + 3377 + if (!pf->vsi[i] || pf->vsi[i]->type != ICE_VSI_PF) 3378 + continue; 3379 + ice_get_link_status(pf->vsi[i]->port_info, &link_up); 3380 + if (link_up) { 3381 + netif_carrier_on(pf->vsi[i]->netdev); 3382 + netif_tx_wake_all_queues(pf->vsi[i]->netdev); 3383 + } else { 3384 + netif_carrier_off(pf->vsi[i]->netdev); 3385 + netif_tx_stop_all_queues(pf->vsi[i]->netdev); 3386 + } 3387 + } 3388 + 3367 3389 /* if we get here, reset flow is successful */ 3368 3390 clear_bit(__ICE_RESET_FAILED, pf->state); 3369 3391 return;
+12
drivers/net/ethernet/intel/ice/ice_switch.c
··· 348 348 } 349 349 350 350 /** 351 + * ice_clear_all_vsi_ctx - clear all the VSI context entries 352 + * @hw: pointer to the hw struct 353 + */ 354 + void ice_clear_all_vsi_ctx(struct ice_hw *hw) 355 + { 356 + u16 i; 357 + 358 + for (i = 0; i < ICE_MAX_VSI; i++) 359 + ice_clear_vsi_ctx(hw, i); 360 + } 361 + 362 + /** 351 363 * ice_add_vsi - add VSI context to the hardware and VSI handle list 352 364 * @hw: pointer to the hw struct 353 365 * @vsi_handle: unique VSI handle provided by drivers
+2
drivers/net/ethernet/intel/ice/ice_switch.h
··· 190 190 struct ice_sq_cd *cd); 191 191 bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 192 192 struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 193 + void ice_clear_all_vsi_ctx(struct ice_hw *hw); 194 + /* Switch config */ 193 195 enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); 194 196 195 197 /* Switch/bridge related commands */
+6 -5
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 1520 1520 1521 1521 /* update gso_segs and bytecount */ 1522 1522 first->gso_segs = skb_shinfo(skb)->gso_segs; 1523 - first->bytecount = (first->gso_segs - 1) * off->header_len; 1523 + first->bytecount += (first->gso_segs - 1) * off->header_len; 1524 1524 1525 1525 cd_tso_len = skb->len - off->header_len; 1526 1526 cd_mss = skb_shinfo(skb)->gso_size; ··· 1556 1556 * magnitude greater than our largest possible GSO size. 1557 1557 * 1558 1558 * This would then be implemented as: 1559 - * return (((size >> 12) * 85) >> 8) + 1; 1559 + * return (((size >> 12) * 85) >> 8) + ICE_DESCS_FOR_SKB_DATA_PTR; 1560 1560 * 1561 1561 * Since multiplication and division are commutative, we can reorder 1562 1562 * operations into: 1563 - * return ((size * 85) >> 20) + 1; 1563 + * return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR; 1564 1564 */ 1565 1565 static unsigned int ice_txd_use_count(unsigned int size) 1566 1566 { 1567 - return ((size * 85) >> 20) + 1; 1567 + return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR; 1568 1568 } 1569 1569 1570 1570 /** ··· 1706 1706 * + 1 desc for context descriptor, 1707 1707 * otherwise try next time 1708 1708 */ 1709 - if (ice_maybe_stop_tx(tx_ring, count + 4 + 1)) { 1709 + if (ice_maybe_stop_tx(tx_ring, count + ICE_DESCS_PER_CACHE_LINE + 1710 + ICE_DESCS_FOR_CTX_DESC)) { 1710 1711 tx_ring->tx_stats.tx_busy++; 1711 1712 return NETDEV_TX_BUSY; 1712 1713 }
+15 -2
drivers/net/ethernet/intel/ice/ice_txrx.h
··· 22 22 #define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */ 23 23 #define ICE_MAX_TXQ_PER_TXQG 128 24 24 25 - /* Tx Descriptors needed, worst case */ 26 - #define DESC_NEEDED (MAX_SKB_FRAGS + 4) 25 + /* We are assuming that the cache line is always 64 Bytes here for ice. 26 + * In order to make sure that is a correct assumption there is a check in probe 27 + * to print a warning if the read from GLPCI_CNF2 tells us that the cache line 28 + * size is 128 bytes. We do it this way because we do not want to read the 29 + * GLPCI_CNF2 register or a variable containing the value on every pass through 30 + * the Tx path. 31 + */ 32 + #define ICE_CACHE_LINE_BYTES 64 33 + #define ICE_DESCS_PER_CACHE_LINE (ICE_CACHE_LINE_BYTES / \ 34 + sizeof(struct ice_tx_desc)) 35 + #define ICE_DESCS_FOR_CTX_DESC 1 36 + #define ICE_DESCS_FOR_SKB_DATA_PTR 1 37 + /* Tx descriptors needed, worst case */ 38 + #define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \ 39 + ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR) 27 40 #define ICE_DESC_UNUSED(R) \ 28 41 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ 29 42 (R)->next_to_clean - (R)->next_to_use - 1)
+1 -1
drivers/net/ethernet/intel/ice/ice_type.h
··· 92 92 u64 phy_type_low; 93 93 u16 max_frame_size; 94 94 u16 link_speed; 95 + u16 req_speeds; 95 96 u8 lse_ena; /* Link Status Event notification */ 96 97 u8 link_info; 97 98 u8 an_info; 98 99 u8 ext_info; 99 100 u8 pacing; 100 - u8 req_speeds; 101 101 /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of 102 102 * ice_aqc_get_phy_caps structure 103 103 */
+1 -3
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
··· 348 348 struct ice_vsi_ctx ctxt = { 0 }; 349 349 enum ice_status status; 350 350 351 - ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_TAGGED | 351 + ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED | 352 352 ICE_AQ_VSI_PVLAN_INSERT_PVID | 353 353 ICE_AQ_VSI_VLAN_EMOD_STR; 354 354 ctxt.info.pvid = cpu_to_le16(vid); ··· 2171 2171 2172 2172 if (!ice_vsi_add_vlan(vsi, vid)) { 2173 2173 vf->num_vlan++; 2174 - set_bit(vid, vsi->active_vlans); 2175 2174 2176 2175 /* Enable VLAN pruning when VLAN 0 is added */ 2177 2176 if (unlikely(!vid)) ··· 2189 2190 */ 2190 2191 if (!ice_vsi_kill_vlan(vsi, vid)) { 2191 2192 vf->num_vlan--; 2192 - clear_bit(vid, vsi->active_vlans); 2193 2193 2194 2194 /* Disable VLAN pruning when removing VLAN 0 */ 2195 2195 if (unlikely(!vid))
+7 -5
drivers/net/ethernet/intel/igb/igb_ptp.c
··· 53 53 * 2^40 * 10^-9 / 60 = 18.3 minutes. 54 54 * 55 55 * SYSTIM is converted to real time using a timecounter. As 56 - * timecounter_cyc2time() allows old timestamps, the timecounter 57 - * needs to be updated at least once per half of the SYSTIM interval. 58 - * Scheduling of delayed work is not very accurate, so we aim for 8 59 - * minutes to be sure the actual interval is shorter than 9.16 minutes. 56 + * timecounter_cyc2time() allows old timestamps, the timecounter needs 57 + * to be updated at least once per half of the SYSTIM interval. 58 + * Scheduling of delayed work is not very accurate, and also the NIC 59 + * clock can be adjusted to run up to 6% faster and the system clock 60 + * up to 10% slower, so we aim for 6 minutes to be sure the actual 61 + * interval in the NIC time is shorter than 9.16 minutes. 60 62 */ 61 63 62 - #define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8) 64 + #define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 6) 63 65 #define IGB_PTP_TX_TIMEOUT (HZ * 15) 64 66 #define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT) 65 67 #define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
+2 -2
drivers/net/ethernet/marvell/mvneta.c
··· 494 494 #if defined(__LITTLE_ENDIAN) 495 495 struct mvneta_tx_desc { 496 496 u32 command; /* Options used by HW for packet transmitting.*/ 497 - u16 reserverd1; /* csum_l4 (for future use) */ 497 + u16 reserved1; /* csum_l4 (for future use) */ 498 498 u16 data_size; /* Data size of transmitted packet in bytes */ 499 499 u32 buf_phys_addr; /* Physical addr of transmitted buffer */ 500 500 u32 reserved2; /* hw_cmd - (for future use, PMT) */ ··· 519 519 #else 520 520 struct mvneta_tx_desc { 521 521 u16 data_size; /* Data size of transmitted packet in bytes */ 522 - u16 reserverd1; /* csum_l4 (for future use) */ 522 + u16 reserved1; /* csum_l4 (for future use) */ 523 523 u32 command; /* Options used by HW for packet transmitting.*/ 524 524 u32 reserved2; /* hw_cmd - (for future use, PMT) */ 525 525 u32 buf_phys_addr; /* Physical addr of transmitted buffer */
+8 -3
drivers/net/ethernet/qlogic/qed/qed_fcoe.c
··· 147 147 "Cannot satisfy CQ amount. CQs requested %d, CQs available %d. Aborting function start\n", 148 148 fcoe_pf_params->num_cqs, 149 149 p_hwfn->hw_info.feat_num[QED_FCOE_CQ]); 150 - return -EINVAL; 150 + rc = -EINVAL; 151 + goto err; 151 152 } 152 153 153 154 p_data->mtu = cpu_to_le16(fcoe_pf_params->mtu); ··· 157 156 158 157 rc = qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_FCOE, &dummy_cid); 159 158 if (rc) 160 - return rc; 159 + goto err; 161 160 162 161 cxt_info.iid = dummy_cid; 163 162 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); 164 163 if (rc) { 165 164 DP_NOTICE(p_hwfn, "Cannot find context info for dummy cid=%d\n", 166 165 dummy_cid); 167 - return rc; 166 + goto err; 168 167 } 169 168 p_cxt = cxt_info.p_cxt; 170 169 SET_FIELD(p_cxt->tstorm_ag_context.flags3, ··· 240 239 241 240 rc = qed_spq_post(p_hwfn, p_ent, NULL); 242 241 242 + return rc; 243 + 244 + err: 245 + qed_sp_destroy_request(p_hwfn, p_ent); 243 246 return rc; 244 247 } 245 248
+1
drivers/net/ethernet/qlogic/qed/qed_iscsi.c
··· 200 200 "Cannot satisfy CQ amount. Queues requested %d, CQs available %d. Aborting function start\n", 201 201 p_params->num_queues, 202 202 p_hwfn->hw_info.feat_num[QED_ISCSI_CQ]); 203 + qed_sp_destroy_request(p_hwfn, p_ent); 203 204 return -EINVAL; 204 205 } 205 206
+8 -4
drivers/net/ethernet/qlogic/qed/qed_l2.c
··· 740 740 741 741 rc = qed_sp_vport_update_rss(p_hwfn, p_ramrod, p_rss_params); 742 742 if (rc) { 743 - /* Return spq entry which is taken in qed_sp_init_request()*/ 744 - qed_spq_return_entry(p_hwfn, p_ent); 743 + qed_sp_destroy_request(p_hwfn, p_ent); 745 744 return rc; 746 745 } 747 746 ··· 1354 1355 DP_NOTICE(p_hwfn, 1355 1356 "%d is not supported yet\n", 1356 1357 p_filter_cmd->opcode); 1358 + qed_sp_destroy_request(p_hwfn, *pp_ent); 1357 1359 return -EINVAL; 1358 1360 } 1359 1361 ··· 2056 2056 } else { 2057 2057 rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id); 2058 2058 if (rc) 2059 - return rc; 2059 + goto err; 2060 2060 2061 2061 if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) { 2062 2062 rc = qed_fw_l2_queue(p_hwfn, p_params->qid, 2063 2063 &abs_rx_q_id); 2064 2064 if (rc) 2065 - return rc; 2065 + goto err; 2066 2066 2067 2067 p_ramrod->rx_qid_valid = 1; 2068 2068 p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id); ··· 2083 2083 (u64)p_params->addr, p_params->length); 2084 2084 2085 2085 return qed_spq_post(p_hwfn, p_ent, NULL); 2086 + 2087 + err: 2088 + qed_sp_destroy_request(p_hwfn, p_ent); 2089 + return rc; 2086 2090 } 2087 2091 2088 2092 int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn,
+1
drivers/net/ethernet/qlogic/qed/qed_rdma.c
··· 1514 1514 default: 1515 1515 rc = -EINVAL; 1516 1516 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "rc = %d\n", rc); 1517 + qed_sp_destroy_request(p_hwfn, p_ent); 1517 1518 return rc; 1518 1519 } 1519 1520 SET_FIELD(p_ramrod->flags1,
+1
drivers/net/ethernet/qlogic/qed/qed_roce.c
··· 745 745 DP_NOTICE(p_hwfn, 746 746 "qed destroy responder failed: cannot allocate memory (ramrod). rc = %d\n", 747 747 rc); 748 + qed_sp_destroy_request(p_hwfn, p_ent); 748 749 return rc; 749 750 } 750 751
+14
drivers/net/ethernet/qlogic/qed/qed_sp.h
··· 167 167 enum spq_mode comp_mode; 168 168 struct qed_spq_comp_cb comp_cb; 169 169 struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */ 170 + 171 + /* Posted entry for unlimited list entry in EBLOCK mode */ 172 + struct qed_spq_entry *post_ent; 170 173 }; 171 174 172 175 struct qed_eq { ··· 398 395 enum spq_mode comp_mode; 399 396 struct qed_spq_comp_cb *p_comp_data; 400 397 }; 398 + 399 + /** 400 + * @brief Returns a SPQ entry to the pool / frees the entry if allocated. 401 + * Should be called on in error flows after initializing the SPQ entry 402 + * and before posting it. 403 + * 404 + * @param p_hwfn 405 + * @param p_ent 406 + */ 407 + void qed_sp_destroy_request(struct qed_hwfn *p_hwfn, 408 + struct qed_spq_entry *p_ent); 401 409 402 410 int qed_sp_init_request(struct qed_hwfn *p_hwfn, 403 411 struct qed_spq_entry **pp_ent,
+20 -2
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
··· 47 47 #include "qed_sp.h" 48 48 #include "qed_sriov.h" 49 49 50 + void qed_sp_destroy_request(struct qed_hwfn *p_hwfn, 51 + struct qed_spq_entry *p_ent) 52 + { 53 + /* qed_spq_get_entry() can either get an entry from the free_pool, 54 + * or, if no entries are left, allocate a new entry and add it to 55 + * the unlimited_pending list. 56 + */ 57 + if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending) 58 + kfree(p_ent); 59 + else 60 + qed_spq_return_entry(p_hwfn, p_ent); 61 + } 62 + 50 63 int qed_sp_init_request(struct qed_hwfn *p_hwfn, 51 64 struct qed_spq_entry **pp_ent, 52 65 u8 cmd, u8 protocol, struct qed_sp_init_data *p_data) ··· 93 80 94 81 case QED_SPQ_MODE_BLOCK: 95 82 if (!p_data->p_comp_data) 96 - return -EINVAL; 83 + goto err; 97 84 98 85 p_ent->comp_cb.cookie = p_data->p_comp_data->cookie; 99 86 break; ··· 108 95 default: 109 96 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", 110 97 p_ent->comp_mode); 111 - return -EINVAL; 98 + goto err; 112 99 } 113 100 114 101 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, ··· 122 109 memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod)); 123 110 124 111 return 0; 112 + 113 + err: 114 + qed_sp_destroy_request(p_hwfn, p_ent); 115 + 116 + return -EINVAL; 125 117 } 126 118 127 119 static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type)
+35 -34
drivers/net/ethernet/qlogic/qed/qed_spq.c
··· 142 142 143 143 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); 144 144 rc = qed_mcp_drain(p_hwfn, p_ptt); 145 + qed_ptt_release(p_hwfn, p_ptt); 145 146 if (rc) { 146 147 DP_NOTICE(p_hwfn, "MCP drain failed\n"); 147 148 goto err; ··· 151 150 /* Retry after drain */ 152 151 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); 153 152 if (!rc) 154 - goto out; 153 + return 0; 155 154 156 155 comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie; 157 - if (comp_done->done == 1) 156 + if (comp_done->done == 1) { 158 157 if (p_fw_ret) 159 158 *p_fw_ret = comp_done->fw_return_code; 160 - out: 161 - qed_ptt_release(p_hwfn, p_ptt); 162 - return 0; 163 - 159 + return 0; 160 + } 164 161 err: 165 - qed_ptt_release(p_hwfn, p_ptt); 166 162 DP_NOTICE(p_hwfn, 167 163 "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n", 168 164 le32_to_cpu(p_ent->elem.hdr.cid), ··· 683 685 /* EBLOCK responsible to free the allocated p_ent */ 684 686 if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK) 685 687 kfree(p_ent); 688 + else 689 + p_ent->post_ent = p_en2; 686 690 687 691 p_ent = p_en2; 688 692 } ··· 767 767 SPQ_HIGH_PRI_RESERVE_DEFAULT); 768 768 } 769 769 770 + /* Avoid overriding of SPQ entries when getting out-of-order completions, by 771 + * marking the completions in a bitmap and increasing the chain consumer only 772 + * for the first successive completed entries. 773 + */ 774 + static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo) 775 + { 776 + u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; 777 + struct qed_spq *p_spq = p_hwfn->p_spq; 778 + 779 + __set_bit(pos, p_spq->p_comp_bitmap); 780 + while (test_bit(p_spq->comp_bitmap_idx, 781 + p_spq->p_comp_bitmap)) { 782 + __clear_bit(p_spq->comp_bitmap_idx, 783 + p_spq->p_comp_bitmap); 784 + p_spq->comp_bitmap_idx++; 785 + qed_chain_return_produced(&p_spq->chain); 786 + } 787 + } 788 + 770 789 int qed_spq_post(struct qed_hwfn *p_hwfn, 771 790 struct qed_spq_entry *p_ent, u8 *fw_return_code) 772 791 { ··· 843 824 p_ent->queue == &p_spq->unlimited_pending); 844 825 845 826 if (p_ent->queue == &p_spq->unlimited_pending) { 846 - /* This is an allocated p_ent which does not need to 847 - * return to pool. 848 - */ 827 + struct qed_spq_entry *p_post_ent = p_ent->post_ent; 828 + 849 829 kfree(p_ent); 850 - return rc; 830 + 831 + /* Return the entry which was actually posted */ 832 + p_ent = p_post_ent; 851 833 } 852 834 853 835 if (rc) ··· 862 842 spq_post_fail2: 863 843 spin_lock_bh(&p_spq->lock); 864 844 list_del(&p_ent->list); 865 - qed_chain_return_produced(&p_spq->chain); 845 + qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo); 866 846 867 847 spq_post_fail: 868 848 /* return to the free pool */ ··· 894 874 spin_lock_bh(&p_spq->lock); 895 875 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) { 896 876 if (p_ent->elem.hdr.echo == echo) { 897 - u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; 898 - 899 877 list_del(&p_ent->list); 900 - 901 - /* Avoid overriding of SPQ entries when getting 902 - * out-of-order completions, by marking the completions 903 - * in a bitmap and increasing the chain consumer only 904 - * for the first successive completed entries. 905 - */ 906 - __set_bit(pos, p_spq->p_comp_bitmap); 907 - 908 - while (test_bit(p_spq->comp_bitmap_idx, 909 - p_spq->p_comp_bitmap)) { 910 - __clear_bit(p_spq->comp_bitmap_idx, 911 - p_spq->p_comp_bitmap); 912 - p_spq->comp_bitmap_idx++; 913 - qed_chain_return_produced(&p_spq->chain); 914 - } 915 - 878 + qed_spq_comp_bmap_update(p_hwfn, echo); 916 879 p_spq->comp_count++; 917 880 found = p_ent; 918 881 break; ··· 934 931 QED_MSG_SPQ, 935 932 "Got a completion without a callback function\n"); 936 933 937 - if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) || 938 - (found->queue == &p_spq->unlimited_pending)) 934 + if (found->comp_mode != QED_SPQ_MODE_EBLOCK) 939 935 /* EBLOCK is responsible for returning its own entry into the 940 - * free list, unless it originally added the entry into the 941 - * unlimited pending list. 936 + * free list. 942 937 */ 943 938 qed_spq_return_entry(p_hwfn, found); 944 939
+1
drivers/net/ethernet/qlogic/qed/qed_sriov.c
··· 101 101 default: 102 102 DP_NOTICE(p_hwfn, "Unknown VF personality %d\n", 103 103 p_hwfn->hw_info.personality); 104 + qed_sp_destroy_request(p_hwfn, p_ent); 104 105 return -EINVAL; 105 106 } 106 107
+5 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
··· 459 459 struct cmd_desc_type0 *first_desc, struct sk_buff *skb, 460 460 struct qlcnic_host_tx_ring *tx_ring) 461 461 { 462 - u8 l4proto, opcode = 0, hdr_len = 0; 462 + u8 l4proto, opcode = 0, hdr_len = 0, tag_vlan = 0; 463 463 u16 flags = 0, vlan_tci = 0; 464 464 int copied, offset, copy_len, size; 465 465 struct cmd_desc_type0 *hwdesc; ··· 472 472 flags = QLCNIC_FLAGS_VLAN_TAGGED; 473 473 vlan_tci = ntohs(vh->h_vlan_TCI); 474 474 protocol = ntohs(vh->h_vlan_encapsulated_proto); 475 + tag_vlan = 1; 475 476 } else if (skb_vlan_tag_present(skb)) { 476 477 flags = QLCNIC_FLAGS_VLAN_OOB; 477 478 vlan_tci = skb_vlan_tag_get(skb); 479 + tag_vlan = 1; 478 480 } 479 481 if (unlikely(adapter->tx_pvid)) { 480 - if (vlan_tci && !(adapter->flags & QLCNIC_TAGGING_ENABLED)) 482 + if (tag_vlan && !(adapter->flags & QLCNIC_TAGGING_ENABLED)) 481 483 return -EIO; 482 - if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED)) 484 + if (tag_vlan && (adapter->flags & QLCNIC_TAGGING_ENABLED)) 483 485 goto set_flags; 484 486 485 487 flags = QLCNIC_FLAGS_VLAN_OOB;
+3 -3
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
··· 234 234 struct net_device *real_dev, 235 235 struct rmnet_endpoint *ep) 236 236 { 237 - struct rmnet_priv *priv; 237 + struct rmnet_priv *priv = netdev_priv(rmnet_dev); 238 238 int rc; 239 239 240 240 if (ep->egress_dev) ··· 247 247 rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 248 248 rmnet_dev->hw_features |= NETIF_F_SG; 249 249 250 + priv->real_dev = real_dev; 251 + 250 252 rc = register_netdevice(rmnet_dev); 251 253 if (!rc) { 252 254 ep->egress_dev = rmnet_dev; ··· 257 255 258 256 rmnet_dev->rtnl_link_ops = &rmnet_link_ops; 259 257 260 - priv = netdev_priv(rmnet_dev); 261 258 priv->mux_id = id; 262 - priv->real_dev = real_dev; 263 259 264 260 netdev_dbg(rmnet_dev, "rmnet dev created\n"); 265 261 }
+2 -1
drivers/net/ethernet/stmicro/stmmac/common.h
··· 365 365 366 366 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */ 367 367 #define BUF_SIZE_16KiB 16384 368 - #define BUF_SIZE_8KiB 8192 368 + /* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ 369 + #define BUF_SIZE_8KiB 8188 369 370 #define BUF_SIZE_4KiB 4096 370 371 #define BUF_SIZE_2KiB 2048 371 372
+1 -1
drivers/net/ethernet/stmicro/stmmac/descs_com.h
··· 31 31 /* Enhanced descriptors */ 32 32 static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) 33 33 { 34 - p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1) 34 + p->des1 |= cpu_to_le32((BUF_SIZE_8KiB 35 35 << ERDES1_BUFFER2_SIZE_SHIFT) 36 36 & ERDES1_BUFFER2_SIZE_MASK); 37 37
+1 -1
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
··· 262 262 int mode, int end) 263 263 { 264 264 p->des0 |= cpu_to_le32(RDES0_OWN); 265 - p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK); 265 + p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); 266 266 267 267 if (mode == STMMAC_CHAIN_MODE) 268 268 ehn_desc_rx_set_on_chain(p);
+1 -1
drivers/net/ethernet/stmicro/stmmac/ring_mode.c
··· 140 140 static int set_16kib_bfsize(int mtu) 141 141 { 142 142 int ret = 0; 143 - if (unlikely(mtu >= BUF_SIZE_8KiB)) 143 + if (unlikely(mtu > BUF_SIZE_8KiB)) 144 144 ret = BUF_SIZE_16KiB; 145 145 return ret; 146 146 }
+4 -3
drivers/net/fddi/defza.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0+ 2 2 /* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices. 3 3 * 4 4 * Copyright (c) 2018 Maciej W. Rozycki ··· 56 56 #define DRV_VERSION "v.1.1.4" 57 57 #define DRV_RELDATE "Oct 6 2018" 58 58 59 - static char version[] = 59 + static const char version[] = 60 60 DRV_NAME ": " DRV_VERSION " " DRV_RELDATE " Maciej W. Rozycki\n"; 61 61 62 62 MODULE_AUTHOR("Maciej W. Rozycki <macro@linux-mips.org>"); ··· 784 784 static void fza_tx_smt(struct net_device *dev) 785 785 { 786 786 struct fza_private *fp = netdev_priv(dev); 787 - struct fza_buffer_tx __iomem *smt_tx_ptr, *skb_data_ptr; 787 + struct fza_buffer_tx __iomem *smt_tx_ptr; 788 788 int i, len; 789 789 u32 own; 790 790 ··· 799 799 800 800 if (!netif_queue_stopped(dev)) { 801 801 if (dev_nit_active(dev)) { 802 + struct fza_buffer_tx *skb_data_ptr; 802 803 struct sk_buff *skb; 803 804 804 805 /* Length must be a multiple of 4 as only word
+2 -1
drivers/net/fddi/defza.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 2 /* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices. 3 3 * 4 4 * Copyright (c) 2018 Maciej W. Rozycki ··· 235 235 #define FZA_RING_CMD 0x200400 /* command ring address */ 236 236 #define FZA_RING_CMD_SIZE 0x40 /* command descriptor ring 237 237 * size 238 + */ 238 239 /* Command constants. */ 239 240 #define FZA_RING_CMD_MASK 0x7fffffff 240 241 #define FZA_RING_CMD_NOP 0x00000000 /* nop */
+16 -2
drivers/net/phy/broadcom.c
··· 92 92 return 0; 93 93 } 94 94 95 - static int bcm5481x_config(struct phy_device *phydev) 95 + static int bcm54xx_config_clock_delay(struct phy_device *phydev) 96 96 { 97 97 int rc, val; 98 98 ··· 429 429 ret = genphy_config_aneg(phydev); 430 430 431 431 /* Then we can set up the delay. */ 432 - bcm5481x_config(phydev); 432 + bcm54xx_config_clock_delay(phydev); 433 433 434 434 if (of_property_read_bool(np, "enet-phy-lane-swap")) { 435 435 /* Lane Swap - Undocumented register...magic! */ ··· 438 438 if (ret < 0) 439 439 return ret; 440 440 } 441 + 442 + return ret; 443 + } 444 + 445 + static int bcm54616s_config_aneg(struct phy_device *phydev) 446 + { 447 + int ret; 448 + 449 + /* Aneg firsly. */ 450 + ret = genphy_config_aneg(phydev); 451 + 452 + /* Then we can set up the delay. */ 453 + bcm54xx_config_clock_delay(phydev); 441 454 442 455 return ret; 443 456 } ··· 643 630 .name = "Broadcom BCM54616S", 644 631 .features = PHY_GBIT_FEATURES, 645 632 .config_init = bcm54xx_config_init, 633 + .config_aneg = bcm54616s_config_aneg, 646 634 .ack_interrupt = bcm_phy_ack_intr, 647 635 .config_intr = bcm_phy_config_intr, 648 636 }, {
+2
drivers/net/usb/smsc95xx.c
··· 1321 1321 dev->net->ethtool_ops = &smsc95xx_ethtool_ops; 1322 1322 dev->net->flags |= IFF_MULTICAST; 1323 1323 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1324 + dev->net->min_mtu = ETH_MIN_MTU; 1325 + dev->net->max_mtu = ETH_DATA_LEN; 1324 1326 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 1325 1327 1326 1328 pdata->dev = dev;
+3 -1
drivers/nvme/host/core.c
··· 1519 1519 if (ns->ndev) 1520 1520 nvme_nvm_update_nvm_info(ns); 1521 1521 #ifdef CONFIG_NVME_MULTIPATH 1522 - if (ns->head->disk) 1522 + if (ns->head->disk) { 1523 1523 nvme_update_disk_info(ns->head->disk, ns, id); 1524 + blk_queue_stack_limits(ns->head->disk->queue, ns->queue); 1525 + } 1524 1526 #endif 1525 1527 } 1526 1528
+1
drivers/nvme/host/multipath.c
··· 285 285 blk_queue_flag_set(QUEUE_FLAG_NONROT, q); 286 286 /* set to a default value for 512 until disk is validated */ 287 287 blk_queue_logical_block_size(q, 512); 288 + blk_set_stacking_limits(&q->limits); 288 289 289 290 /* we need to propagate up the VMC settings */ 290 291 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
+1 -1
drivers/nvme/target/core.c
··· 420 420 struct pci_dev *p2p_dev; 421 421 int ret; 422 422 423 - if (!ctrl->p2p_client) 423 + if (!ctrl->p2p_client || !ns->use_p2pmem) 424 424 return; 425 425 426 426 if (ns->p2p_dev) {
+4 -15
drivers/nvme/target/rdma.c
··· 122 122 int inline_page_count; 123 123 }; 124 124 125 - static struct workqueue_struct *nvmet_rdma_delete_wq; 126 125 static bool nvmet_rdma_use_srq; 127 126 module_param_named(use_srq, nvmet_rdma_use_srq, bool, 0444); 128 127 MODULE_PARM_DESC(use_srq, "Use shared receive queue."); ··· 1273 1274 1274 1275 if (queue->host_qid == 0) { 1275 1276 /* Let inflight controller teardown complete */ 1276 - flush_workqueue(nvmet_rdma_delete_wq); 1277 + flush_scheduled_work(); 1277 1278 } 1278 1279 1279 1280 ret = nvmet_rdma_cm_accept(cm_id, queue, &event->param.conn); 1280 1281 if (ret) { 1281 - queue_work(nvmet_rdma_delete_wq, &queue->release_work); 1282 + schedule_work(&queue->release_work); 1282 1283 /* Destroying rdma_cm id is not needed here */ 1283 1284 return 0; 1284 1285 } ··· 1343 1344 1344 1345 if (disconnect) { 1345 1346 rdma_disconnect(queue->cm_id); 1346 - queue_work(nvmet_rdma_delete_wq, &queue->release_work); 1347 + schedule_work(&queue->release_work); 1347 1348 } 1348 1349 } 1349 1350 ··· 1373 1374 mutex_unlock(&nvmet_rdma_queue_mutex); 1374 1375 1375 1376 pr_err("failed to connect queue %d\n", queue->idx); 1376 - queue_work(nvmet_rdma_delete_wq, &queue->release_work); 1377 + schedule_work(&queue->release_work); 1377 1378 } 1378 1379 1379 1380 /** ··· 1655 1656 if (ret) 1656 1657 goto err_ib_client; 1657 1658 1658 - nvmet_rdma_delete_wq = alloc_workqueue("nvmet-rdma-delete-wq", 1659 - WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0); 1660 - if (!nvmet_rdma_delete_wq) { 1661 - ret = -ENOMEM; 1662 - goto err_unreg_transport; 1663 - } 1664 - 1665 1659 return 0; 1666 1660 1667 - err_unreg_transport: 1668 - nvmet_unregister_transport(&nvmet_rdma_ops); 1669 1661 err_ib_client: 1670 1662 ib_unregister_client(&nvmet_rdma_ib_client); 1671 1663 return ret; ··· 1664 1674 1665 1675 static void __exit nvmet_rdma_exit(void) 1666 1676 { 1667 - destroy_workqueue(nvmet_rdma_delete_wq); 1668 1677 nvmet_unregister_transport(&nvmet_rdma_ops); 1669 1678 ib_unregister_client(&nvmet_rdma_ib_client); 1670 1679 WARN_ON_ONCE(!list_empty(&nvmet_rdma_queue_list));
+3 -1
drivers/of/device.c
··· 149 149 * set by the driver. 150 150 */ 151 151 mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1); 152 - dev->bus_dma_mask = mask; 153 152 dev->coherent_dma_mask &= mask; 154 153 *dev->dma_mask &= mask; 154 + /* ...but only set bus mask if we found valid dma-ranges earlier */ 155 + if (!ret) 156 + dev->bus_dma_mask = mask; 155 157 156 158 coherent = of_dma_is_coherent(np); 157 159 dev_dbg(dev, "device is%sdma coherent\n",
+7 -2
drivers/of/of_numa.c
··· 104 104 distance = of_read_number(matrix, 1); 105 105 matrix++; 106 106 107 + if ((nodea == nodeb && distance != LOCAL_DISTANCE) || 108 + (nodea != nodeb && distance <= LOCAL_DISTANCE)) { 109 + pr_err("Invalid distance[node%d -> node%d] = %d\n", 110 + nodea, nodeb, distance); 111 + return -EINVAL; 112 + } 113 + 107 114 numa_set_distance(nodea, nodeb, distance); 108 - pr_debug("distance[node%d -> node%d] = %d\n", 109 - nodea, nodeb, distance); 110 115 111 116 /* Set default distance of node B->A same as A->B */ 112 117 if (nodeb > nodea)
+4 -4
drivers/tty/serial/sh-sci.c
··· 1614 1614 hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1615 1615 s->rx_timer.function = rx_timer_fn; 1616 1616 1617 + s->chan_rx_saved = s->chan_rx = chan; 1618 + 1617 1619 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) 1618 1620 sci_submit_rx(s); 1619 - 1620 - s->chan_rx_saved = s->chan_rx = chan; 1621 1621 } 1622 1622 } 1623 1623 ··· 3102 3102 static int sci_remove(struct platform_device *dev) 3103 3103 { 3104 3104 struct sci_port *port = platform_get_drvdata(dev); 3105 + unsigned int type = port->port.type; /* uart_remove_... clears it */ 3105 3106 3106 3107 sci_ports_in_use &= ~BIT(port->port.line); 3107 3108 uart_remove_one_port(&sci_uart_driver, &port->port); ··· 3113 3112 sysfs_remove_file(&dev->dev.kobj, 3114 3113 &dev_attr_rx_fifo_trigger.attr); 3115 3114 } 3116 - if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB || 3117 - port->port.type == PORT_HSCIF) { 3115 + if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF) { 3118 3116 sysfs_remove_file(&dev->dev.kobj, 3119 3117 &dev_attr_rx_fifo_timeout.attr); 3120 3118 }
+2 -2
drivers/tty/tty_baudrate.c
··· 77 77 else 78 78 cbaud += 15; 79 79 } 80 - return baud_table[cbaud]; 80 + return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; 81 81 } 82 82 EXPORT_SYMBOL(tty_termios_baud_rate); 83 83 ··· 113 113 else 114 114 cbaud += 15; 115 115 } 116 - return baud_table[cbaud]; 116 + return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; 117 117 #else /* IBSHIFT */ 118 118 return tty_termios_baud_rate(termios); 119 119 #endif /* IBSHIFT */
+1 -1
drivers/tty/vt/vt.c
··· 1548 1548 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); 1549 1549 vc->vc_need_wrap = 0; 1550 1550 if (con_should_update(vc)) 1551 - do_update_region(vc, (unsigned long) start, count); 1551 + do_update_region(vc, (unsigned long)(start + offset), count); 1552 1552 } 1553 1553 1554 1554 static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */
+10
drivers/usb/typec/ucsi/Kconfig
··· 23 23 24 24 if TYPEC_UCSI 25 25 26 + config UCSI_CCG 27 + tristate "UCSI Interface Driver for Cypress CCGx" 28 + depends on I2C 29 + help 30 + This driver enables UCSI support on platforms that expose a 31 + Cypress CCGx Type-C controller over I2C interface. 32 + 33 + To compile the driver as a module, choose M here: the module will be 34 + called ucsi_ccg. 35 + 26 36 config UCSI_ACPI 27 37 tristate "UCSI ACPI Interface Driver" 28 38 depends on ACPI
+2
drivers/usb/typec/ucsi/Makefile
··· 8 8 typec_ucsi-$(CONFIG_TRACING) += trace.o 9 9 10 10 obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o 11 + 12 + obj-$(CONFIG_UCSI_CCG) += ucsi_ccg.o
+307
drivers/usb/typec/ucsi/ucsi_ccg.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * UCSI driver for Cypress CCGx Type-C controller 4 + * 5 + * Copyright (C) 2017-2018 NVIDIA Corporation. All rights reserved. 6 + * Author: Ajay Gupta <ajayg@nvidia.com> 7 + * 8 + * Some code borrowed from drivers/usb/typec/ucsi/ucsi_acpi.c 9 + */ 10 + #include <linux/acpi.h> 11 + #include <linux/delay.h> 12 + #include <linux/i2c.h> 13 + #include <linux/module.h> 14 + #include <linux/pci.h> 15 + #include <linux/platform_device.h> 16 + 17 + #include <asm/unaligned.h> 18 + #include "ucsi.h" 19 + 20 + struct ucsi_ccg { 21 + struct device *dev; 22 + struct ucsi *ucsi; 23 + struct ucsi_ppm ppm; 24 + struct i2c_client *client; 25 + }; 26 + 27 + #define CCGX_RAB_INTR_REG 0x06 28 + #define CCGX_RAB_UCSI_CONTROL 0x39 29 + #define CCGX_RAB_UCSI_CONTROL_START BIT(0) 30 + #define CCGX_RAB_UCSI_CONTROL_STOP BIT(1) 31 + #define CCGX_RAB_UCSI_DATA_BLOCK(offset) (0xf000 | ((offset) & 0xff)) 32 + 33 + static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len) 34 + { 35 + struct i2c_client *client = uc->client; 36 + const struct i2c_adapter_quirks *quirks = client->adapter->quirks; 37 + unsigned char buf[2]; 38 + struct i2c_msg msgs[] = { 39 + { 40 + .addr = client->addr, 41 + .flags = 0x0, 42 + .len = sizeof(buf), 43 + .buf = buf, 44 + }, 45 + { 46 + .addr = client->addr, 47 + .flags = I2C_M_RD, 48 + .buf = data, 49 + }, 50 + }; 51 + u32 rlen, rem_len = len, max_read_len = len; 52 + int status; 53 + 54 + /* check any max_read_len limitation on i2c adapter */ 55 + if (quirks && quirks->max_read_len) 56 + max_read_len = quirks->max_read_len; 57 + 58 + while (rem_len > 0) { 59 + msgs[1].buf = &data[len - rem_len]; 60 + rlen = min_t(u16, rem_len, max_read_len); 61 + msgs[1].len = rlen; 62 + put_unaligned_le16(rab, buf); 63 + status = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 64 + if (status < 0) { 65 + dev_err(uc->dev, "i2c_transfer failed %d\n", status); 66 + return status; 67 + } 68 + rab += rlen; 69 + rem_len -= rlen; 70 + } 71 + 72 + return 0; 73 + } 74 + 75 + static int ccg_write(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len) 76 + { 77 + struct i2c_client *client = uc->client; 78 + unsigned char *buf; 79 + struct i2c_msg msgs[] = { 80 + { 81 + .addr = client->addr, 82 + .flags = 0x0, 83 + } 84 + }; 85 + int status; 86 + 87 + buf = kzalloc(len + sizeof(rab), GFP_KERNEL); 88 + if (!buf) 89 + return -ENOMEM; 90 + 91 + put_unaligned_le16(rab, buf); 92 + memcpy(buf + sizeof(rab), data, len); 93 + 94 + msgs[0].len = len + sizeof(rab); 95 + msgs[0].buf = buf; 96 + 97 + status = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 98 + if (status < 0) { 99 + dev_err(uc->dev, "i2c_transfer failed %d\n", status); 100 + kfree(buf); 101 + return status; 102 + } 103 + 104 + kfree(buf); 105 + return 0; 106 + } 107 + 108 + static int ucsi_ccg_init(struct ucsi_ccg *uc) 109 + { 110 + unsigned int count = 10; 111 + u8 data; 112 + int status; 113 + 114 + data = CCGX_RAB_UCSI_CONTROL_STOP; 115 + status = ccg_write(uc, CCGX_RAB_UCSI_CONTROL, &data, sizeof(data)); 116 + if (status < 0) 117 + return status; 118 + 119 + data = CCGX_RAB_UCSI_CONTROL_START; 120 + status = ccg_write(uc, CCGX_RAB_UCSI_CONTROL, &data, sizeof(data)); 121 + if (status < 0) 122 + return status; 123 + 124 + /* 125 + * Flush CCGx RESPONSE queue by acking interrupts. Above ucsi control 126 + * register write will push response which must be cleared. 127 + */ 128 + do { 129 + status = ccg_read(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); 130 + if (status < 0) 131 + return status; 132 + 133 + if (!data) 134 + return 0; 135 + 136 + status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); 137 + if (status < 0) 138 + return status; 139 + 140 + usleep_range(10000, 11000); 141 + } while (--count); 142 + 143 + return -ETIMEDOUT; 144 + } 145 + 146 + static int ucsi_ccg_send_data(struct ucsi_ccg *uc) 147 + { 148 + u8 *ppm = (u8 *)uc->ppm.data; 149 + int status; 150 + u16 rab; 151 + 152 + rab = CCGX_RAB_UCSI_DATA_BLOCK(offsetof(struct ucsi_data, message_out)); 153 + status = ccg_write(uc, rab, ppm + 154 + offsetof(struct ucsi_data, message_out), 155 + sizeof(uc->ppm.data->message_out)); 156 + if (status < 0) 157 + return status; 158 + 159 + rab = CCGX_RAB_UCSI_DATA_BLOCK(offsetof(struct ucsi_data, ctrl)); 160 + return ccg_write(uc, rab, ppm + offsetof(struct ucsi_data, ctrl), 161 + sizeof(uc->ppm.data->ctrl)); 162 + } 163 + 164 + static int ucsi_ccg_recv_data(struct ucsi_ccg *uc) 165 + { 166 + u8 *ppm = (u8 *)uc->ppm.data; 167 + int status; 168 + u16 rab; 169 + 170 + rab = CCGX_RAB_UCSI_DATA_BLOCK(offsetof(struct ucsi_data, cci)); 171 + status = ccg_read(uc, rab, ppm + offsetof(struct ucsi_data, cci), 172 + sizeof(uc->ppm.data->cci)); 173 + if (status < 0) 174 + return status; 175 + 176 + rab = CCGX_RAB_UCSI_DATA_BLOCK(offsetof(struct ucsi_data, message_in)); 177 + return ccg_read(uc, rab, ppm + offsetof(struct ucsi_data, message_in), 178 + sizeof(uc->ppm.data->message_in)); 179 + } 180 + 181 + static int ucsi_ccg_ack_interrupt(struct ucsi_ccg *uc) 182 + { 183 + int status; 184 + unsigned char data; 185 + 186 + status = ccg_read(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); 187 + if (status < 0) 188 + return status; 189 + 190 + return ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data)); 191 + } 192 + 193 + static int ucsi_ccg_sync(struct ucsi_ppm *ppm) 194 + { 195 + struct ucsi_ccg *uc = container_of(ppm, struct ucsi_ccg, ppm); 196 + int status; 197 + 198 + status = ucsi_ccg_recv_data(uc); 199 + if (status < 0) 200 + return status; 201 + 202 + /* ack interrupt to allow next command to run */ 203 + return ucsi_ccg_ack_interrupt(uc); 204 + } 205 + 206 + static int ucsi_ccg_cmd(struct ucsi_ppm *ppm, struct ucsi_control *ctrl) 207 + { 208 + struct ucsi_ccg *uc = container_of(ppm, struct ucsi_ccg, ppm); 209 + 210 + ppm->data->ctrl.raw_cmd = ctrl->raw_cmd; 211 + return ucsi_ccg_send_data(uc); 212 + } 213 + 214 + static irqreturn_t ccg_irq_handler(int irq, void *data) 215 + { 216 + struct ucsi_ccg *uc = data; 217 + 218 + ucsi_notify(uc->ucsi); 219 + 220 + return IRQ_HANDLED; 221 + } 222 + 223 + static int ucsi_ccg_probe(struct i2c_client *client, 224 + const struct i2c_device_id *id) 225 + { 226 + struct device *dev = &client->dev; 227 + struct ucsi_ccg *uc; 228 + int status; 229 + u16 rab; 230 + 231 + uc = devm_kzalloc(dev, sizeof(*uc), GFP_KERNEL); 232 + if (!uc) 233 + return -ENOMEM; 234 + 235 + uc->ppm.data = devm_kzalloc(dev, sizeof(struct ucsi_data), GFP_KERNEL); 236 + if (!uc->ppm.data) 237 + return -ENOMEM; 238 + 239 + uc->ppm.cmd = ucsi_ccg_cmd; 240 + uc->ppm.sync = ucsi_ccg_sync; 241 + uc->dev = dev; 242 + uc->client = client; 243 + 244 + /* reset ccg device and initialize ucsi */ 245 + status = ucsi_ccg_init(uc); 246 + if (status < 0) { 247 + dev_err(uc->dev, "ucsi_ccg_init failed - %d\n", status); 248 + return status; 249 + } 250 + 251 + status = devm_request_threaded_irq(dev, client->irq, NULL, 252 + ccg_irq_handler, 253 + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, 254 + dev_name(dev), uc); 255 + if (status < 0) { 256 + dev_err(uc->dev, "request_threaded_irq failed - %d\n", status); 257 + return status; 258 + } 259 + 260 + uc->ucsi = ucsi_register_ppm(dev, &uc->ppm); 261 + if (IS_ERR(uc->ucsi)) { 262 + dev_err(uc->dev, "ucsi_register_ppm failed\n"); 263 + return PTR_ERR(uc->ucsi); 264 + } 265 + 266 + rab = CCGX_RAB_UCSI_DATA_BLOCK(offsetof(struct ucsi_data, version)); 267 + status = ccg_read(uc, rab, (u8 *)(uc->ppm.data) + 268 + offsetof(struct ucsi_data, version), 269 + sizeof(uc->ppm.data->version)); 270 + if (status < 0) { 271 + ucsi_unregister_ppm(uc->ucsi); 272 + return status; 273 + } 274 + 275 + i2c_set_clientdata(client, uc); 276 + return 0; 277 + } 278 + 279 + static int ucsi_ccg_remove(struct i2c_client *client) 280 + { 281 + struct ucsi_ccg *uc = i2c_get_clientdata(client); 282 + 283 + ucsi_unregister_ppm(uc->ucsi); 284 + 285 + return 0; 286 + } 287 + 288 + static const struct i2c_device_id ucsi_ccg_device_id[] = { 289 + {"ccgx-ucsi", 0}, 290 + {} 291 + }; 292 + MODULE_DEVICE_TABLE(i2c, ucsi_ccg_device_id); 293 + 294 + static struct i2c_driver ucsi_ccg_driver = { 295 + .driver = { 296 + .name = "ucsi_ccg", 297 + }, 298 + .probe = ucsi_ccg_probe, 299 + .remove = ucsi_ccg_remove, 300 + .id_table = ucsi_ccg_device_id, 301 + }; 302 + 303 + module_i2c_driver(ucsi_ccg_driver); 304 + 305 + MODULE_AUTHOR("Ajay Gupta <ajayg@nvidia.com>"); 306 + MODULE_DESCRIPTION("UCSI driver for Cypress CCGx Type-C controller"); 307 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/xen/grant-table.c
··· 914 914 915 915 ret = xenmem_reservation_increase(args->nr_pages, args->frames); 916 916 if (ret != args->nr_pages) { 917 - pr_debug("Failed to decrease reservation for DMA buffer\n"); 917 + pr_debug("Failed to increase reservation for DMA buffer\n"); 918 918 ret = -EFAULT; 919 919 } else { 920 920 ret = 0;
+4 -18
drivers/xen/privcmd-buf.c
··· 21 21 22 22 MODULE_LICENSE("GPL"); 23 23 24 - static unsigned int limit = 64; 25 - module_param(limit, uint, 0644); 26 - MODULE_PARM_DESC(limit, "Maximum number of pages that may be allocated by " 27 - "the privcmd-buf device per open file"); 28 - 29 24 struct privcmd_buf_private { 30 25 struct mutex lock; 31 26 struct list_head list; 32 - unsigned int allocated; 33 27 }; 34 28 35 29 struct privcmd_buf_vma_private { ··· 54 60 { 55 61 unsigned int i; 56 62 57 - vma_priv->file_priv->allocated -= vma_priv->n_pages; 58 - 59 63 list_del(&vma_priv->list); 60 64 61 65 for (i = 0; i < vma_priv->n_pages; i++) 62 - if (vma_priv->pages[i]) 63 - __free_page(vma_priv->pages[i]); 66 + __free_page(vma_priv->pages[i]); 64 67 65 68 kfree(vma_priv); 66 69 } ··· 137 146 unsigned int i; 138 147 int ret = 0; 139 148 140 - if (!(vma->vm_flags & VM_SHARED) || count > limit || 141 - file_priv->allocated + count > limit) 149 + if (!(vma->vm_flags & VM_SHARED)) 142 150 return -EINVAL; 143 151 144 152 vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *), ··· 145 155 if (!vma_priv) 146 156 return -ENOMEM; 147 157 148 - vma_priv->n_pages = count; 149 - count = 0; 150 - for (i = 0; i < vma_priv->n_pages; i++) { 158 + for (i = 0; i < count; i++) { 151 159 vma_priv->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO); 152 160 if (!vma_priv->pages[i]) 153 161 break; 154 - count++; 162 + vma_priv->n_pages++; 155 163 } 156 164 157 165 mutex_lock(&file_priv->lock); 158 - 159 - file_priv->allocated += count; 160 166 161 167 vma_priv->file_priv = file_priv; 162 168 vma_priv->users = 1;
+3
fs/btrfs/ctree.h
··· 3163 3163 int btrfs_drop_inode(struct inode *inode); 3164 3164 int __init btrfs_init_cachep(void); 3165 3165 void __cold btrfs_destroy_cachep(void); 3166 + struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location, 3167 + struct btrfs_root *root, int *new, 3168 + struct btrfs_path *path); 3166 3169 struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, 3167 3170 struct btrfs_root *root, int *was_new); 3168 3171 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
+26 -37
fs/btrfs/disk-io.c
··· 1664 1664 struct btrfs_root *root = arg; 1665 1665 struct btrfs_fs_info *fs_info = root->fs_info; 1666 1666 int again; 1667 - struct btrfs_trans_handle *trans; 1668 1667 1669 - do { 1668 + while (1) { 1670 1669 again = 0; 1671 1670 1672 1671 /* Make the cleaner go to sleep early. */ ··· 1714 1715 */ 1715 1716 btrfs_delete_unused_bgs(fs_info); 1716 1717 sleep: 1718 + if (kthread_should_park()) 1719 + kthread_parkme(); 1720 + if (kthread_should_stop()) 1721 + return 0; 1717 1722 if (!again) { 1718 1723 set_current_state(TASK_INTERRUPTIBLE); 1719 - if (!kthread_should_stop()) 1720 - schedule(); 1724 + schedule(); 1721 1725 __set_current_state(TASK_RUNNING); 1722 1726 } 1723 - } while (!kthread_should_stop()); 1724 - 1725 - /* 1726 - * Transaction kthread is stopped before us and wakes us up. 1727 - * However we might have started a new transaction and COWed some 1728 - * tree blocks when deleting unused block groups for example. So 1729 - * make sure we commit the transaction we started to have a clean 1730 - * shutdown when evicting the btree inode - if it has dirty pages 1731 - * when we do the final iput() on it, eviction will trigger a 1732 - * writeback for it which will fail with null pointer dereferences 1733 - * since work queues and other resources were already released and 1734 - * destroyed by the time the iput/eviction/writeback is made. 1735 - */ 1736 - trans = btrfs_attach_transaction(root); 1737 - if (IS_ERR(trans)) { 1738 - if (PTR_ERR(trans) != -ENOENT) 1739 - btrfs_err(fs_info, 1740 - "cleaner transaction attach returned %ld", 1741 - PTR_ERR(trans)); 1742 - } else { 1743 - int ret; 1744 - 1745 - ret = btrfs_commit_transaction(trans); 1746 - if (ret) 1747 - btrfs_err(fs_info, 1748 - "cleaner open transaction commit returned %d", 1749 - ret); 1750 1727 } 1751 - 1752 - return 0; 1753 1728 } 1754 1729 1755 1730 static int transaction_kthread(void *arg) ··· 3904 3931 int ret; 3905 3932 3906 3933 set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); 3934 + /* 3935 + * We don't want the cleaner to start new transactions, add more delayed 3936 + * iputs, etc. while we're closing. We can't use kthread_stop() yet 3937 + * because that frees the task_struct, and the transaction kthread might 3938 + * still try to wake up the cleaner. 3939 + */ 3940 + kthread_park(fs_info->cleaner_kthread); 3907 3941 3908 3942 /* wait for the qgroup rescan worker to stop */ 3909 3943 btrfs_qgroup_wait_for_completion(fs_info, false); ··· 3938 3958 3939 3959 if (!sb_rdonly(fs_info->sb)) { 3940 3960 /* 3941 - * If the cleaner thread is stopped and there are 3942 - * block groups queued for removal, the deletion will be 3943 - * skipped when we quit the cleaner thread. 3961 + * The cleaner kthread is stopped, so do one final pass over 3962 + * unused block groups. 3944 3963 */ 3945 3964 btrfs_delete_unused_bgs(fs_info); 3946 3965 ··· 4338 4359 unpin = pinned_extents; 4339 4360 again: 4340 4361 while (1) { 4362 + /* 4363 + * The btrfs_finish_extent_commit() may get the same range as 4364 + * ours between find_first_extent_bit and clear_extent_dirty. 4365 + * Hence, hold the unused_bg_unpin_mutex to avoid double unpin 4366 + * the same extent range. 4367 + */ 4368 + mutex_lock(&fs_info->unused_bg_unpin_mutex); 4341 4369 ret = find_first_extent_bit(unpin, 0, &start, &end, 4342 4370 EXTENT_DIRTY, NULL); 4343 - if (ret) 4371 + if (ret) { 4372 + mutex_unlock(&fs_info->unused_bg_unpin_mutex); 4344 4373 break; 4374 + } 4345 4375 4346 4376 clear_extent_dirty(unpin, start, end); 4347 4377 btrfs_error_unpin_extent_range(fs_info, start, end); 4378 + mutex_unlock(&fs_info->unused_bg_unpin_mutex); 4348 4379 cond_resched(); 4349 4380 } 4350 4381
+21 -1
fs/btrfs/free-space-cache.c
··· 75 75 * sure NOFS is set to keep us from deadlocking. 76 76 */ 77 77 nofs_flag = memalloc_nofs_save(); 78 - inode = btrfs_iget(fs_info->sb, &location, root, NULL); 78 + inode = btrfs_iget_path(fs_info->sb, &location, root, NULL, path); 79 + btrfs_release_path(path); 79 80 memalloc_nofs_restore(nofs_flag); 80 81 if (IS_ERR(inode)) 81 82 return inode; ··· 839 838 path->search_commit_root = 1; 840 839 path->skip_locking = 1; 841 840 841 + /* 842 + * We must pass a path with search_commit_root set to btrfs_iget in 843 + * order to avoid a deadlock when allocating extents for the tree root. 844 + * 845 + * When we are COWing an extent buffer from the tree root, when looking 846 + * for a free extent, at extent-tree.c:find_free_extent(), we can find 847 + * block group without its free space cache loaded. When we find one 848 + * we must load its space cache which requires reading its free space 849 + * cache's inode item from the root tree. If this inode item is located 850 + * in the same leaf that we started COWing before, then we end up in 851 + * deadlock on the extent buffer (trying to read lock it when we 852 + * previously write locked it). 853 + * 854 + * It's safe to read the inode item using the commit root because 855 + * block groups, once loaded, stay in memory forever (until they are 856 + * removed) as well as their space caches once loaded. New block groups 857 + * once created get their ->cached field set to BTRFS_CACHE_FINISHED so 858 + * we will never try to read their inode item while the fs is mounted. 859 + */ 842 860 inode = lookup_free_space_inode(fs_info, block_group, path); 843 861 if (IS_ERR(inode)) { 844 862 btrfs_free_path(path);
+24 -13
fs/btrfs/inode.c
··· 1531 1531 } 1532 1532 btrfs_release_path(path); 1533 1533 1534 - if (cur_offset <= end && cow_start == (u64)-1) { 1534 + if (cur_offset <= end && cow_start == (u64)-1) 1535 1535 cow_start = cur_offset; 1536 - cur_offset = end; 1537 - } 1538 1536 1539 1537 if (cow_start != (u64)-1) { 1538 + cur_offset = end; 1540 1539 ret = cow_file_range(inode, locked_page, cow_start, end, end, 1541 1540 page_started, nr_written, 1, NULL); 1542 1541 if (ret) ··· 3569 3570 /* 3570 3571 * read an inode from the btree into the in-memory inode 3571 3572 */ 3572 - static int btrfs_read_locked_inode(struct inode *inode) 3573 + static int btrfs_read_locked_inode(struct inode *inode, 3574 + struct btrfs_path *in_path) 3573 3575 { 3574 3576 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); 3575 - struct btrfs_path *path; 3577 + struct btrfs_path *path = in_path; 3576 3578 struct extent_buffer *leaf; 3577 3579 struct btrfs_inode_item *inode_item; 3578 3580 struct btrfs_root *root = BTRFS_I(inode)->root; ··· 3589 3589 if (!ret) 3590 3590 filled = true; 3591 3591 3592 - path = btrfs_alloc_path(); 3593 - if (!path) 3594 - return -ENOMEM; 3592 + if (!path) { 3593 + path = btrfs_alloc_path(); 3594 + if (!path) 3595 + return -ENOMEM; 3596 + } 3595 3597 3596 3598 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location)); 3597 3599 3598 3600 ret = btrfs_lookup_inode(NULL, root, path, &location, 0); 3599 3601 if (ret) { 3600 - btrfs_free_path(path); 3602 + if (path != in_path) 3603 + btrfs_free_path(path); 3601 3604 return ret; 3602 3605 } 3603 3606 ··· 3725 3722 btrfs_ino(BTRFS_I(inode)), 3726 3723 root->root_key.objectid, ret); 3727 3724 } 3728 - btrfs_free_path(path); 3725 + if (path != in_path) 3726 + btrfs_free_path(path); 3729 3727 3730 3728 if (!maybe_acls) 3731 3729 cache_no_acl(inode); ··· 5648 5644 /* Get an inode object given its location and corresponding root. 5649 5645 * Returns in *is_new if the inode was read from disk 5650 5646 */ 5651 - struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, 5652 - struct btrfs_root *root, int *new) 5647 + struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location, 5648 + struct btrfs_root *root, int *new, 5649 + struct btrfs_path *path) 5653 5650 { 5654 5651 struct inode *inode; 5655 5652 ··· 5661 5656 if (inode->i_state & I_NEW) { 5662 5657 int ret; 5663 5658 5664 - ret = btrfs_read_locked_inode(inode); 5659 + ret = btrfs_read_locked_inode(inode, path); 5665 5660 if (!ret) { 5666 5661 inode_tree_add(inode); 5667 5662 unlock_new_inode(inode); ··· 5681 5676 } 5682 5677 5683 5678 return inode; 5679 + } 5680 + 5681 + struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, 5682 + struct btrfs_root *root, int *new) 5683 + { 5684 + return btrfs_iget_path(s, location, root, new, NULL); 5684 5685 } 5685 5686 5686 5687 static struct inode *new_simple_dir(struct super_block *s,
+12 -2
fs/btrfs/ioctl.c
··· 3488 3488 const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize; 3489 3489 3490 3490 len = round_down(i_size_read(src), sz) - loff; 3491 + if (len == 0) 3492 + return 0; 3491 3493 olen = len; 3492 3494 } 3493 3495 } ··· 4259 4257 goto out_unlock; 4260 4258 if (len == 0) 4261 4259 olen = len = src->i_size - off; 4262 - /* if we extend to eof, continue to block boundary */ 4263 - if (off + len == src->i_size) 4260 + /* 4261 + * If we extend to eof, continue to block boundary if and only if the 4262 + * destination end offset matches the destination file's size, otherwise 4263 + * we would be corrupting data by placing the eof block into the middle 4264 + * of a file. 4265 + */ 4266 + if (off + len == src->i_size) { 4267 + if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size) 4268 + goto out_unlock; 4264 4269 len = ALIGN(src->i_size, bs) - off; 4270 + } 4265 4271 4266 4272 if (len == 0) { 4267 4273 ret = 0;
+3 -3
fs/btrfs/super.c
··· 1916 1916 } 1917 1917 1918 1918 /* Used to sort the devices by max_avail(descending sort) */ 1919 - static int btrfs_cmp_device_free_bytes(const void *dev_info1, 1919 + static inline int btrfs_cmp_device_free_bytes(const void *dev_info1, 1920 1920 const void *dev_info2) 1921 1921 { 1922 1922 if (((struct btrfs_device_info *)dev_info1)->max_avail > ··· 1945 1945 * The helper to calc the free space on the devices that can be used to store 1946 1946 * file data. 1947 1947 */ 1948 - static int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info, 1949 - u64 *free_bytes) 1948 + static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info, 1949 + u64 *free_bytes) 1950 1950 { 1951 1951 struct btrfs_device_info *devices_info; 1952 1952 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+1 -1
fs/btrfs/tree-checker.c
··· 440 440 type != (BTRFS_BLOCK_GROUP_METADATA | 441 441 BTRFS_BLOCK_GROUP_DATA)) { 442 442 block_group_err(fs_info, leaf, slot, 443 - "invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx", 443 + "invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx", 444 444 type, hweight64(type), 445 445 BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA, 446 446 BTRFS_BLOCK_GROUP_SYSTEM,
+17
fs/btrfs/tree-log.c
··· 4396 4396 logged_end = end; 4397 4397 4398 4398 list_for_each_entry_safe(em, n, &tree->modified_extents, list) { 4399 + /* 4400 + * Skip extents outside our logging range. It's important to do 4401 + * it for correctness because if we don't ignore them, we may 4402 + * log them before their ordered extent completes, and therefore 4403 + * we could log them without logging their respective checksums 4404 + * (the checksum items are added to the csum tree at the very 4405 + * end of btrfs_finish_ordered_io()). Also leave such extents 4406 + * outside of our range in the list, since we may have another 4407 + * ranged fsync in the near future that needs them. If an extent 4408 + * outside our range corresponds to a hole, log it to avoid 4409 + * leaving gaps between extents (fsck will complain when we are 4410 + * not using the NO_HOLES feature). 4411 + */ 4412 + if ((em->start > end || em->start + em->len <= start) && 4413 + em->block_start != EXTENT_MAP_HOLE) 4414 + continue; 4415 + 4399 4416 list_del_init(&em->list); 4400 4417 /* 4401 4418 * Just an arbitrary number, this can be really CPU intensive
+9 -2
fs/ceph/file.c
··· 1931 1931 if (!prealloc_cf) 1932 1932 return -ENOMEM; 1933 1933 1934 - /* Start by sync'ing the source file */ 1934 + /* Start by sync'ing the source and destination files */ 1935 1935 ret = file_write_and_wait_range(src_file, src_off, (src_off + len)); 1936 - if (ret < 0) 1936 + if (ret < 0) { 1937 + dout("failed to write src file (%zd)\n", ret); 1937 1938 goto out; 1939 + } 1940 + ret = file_write_and_wait_range(dst_file, dst_off, (dst_off + len)); 1941 + if (ret < 0) { 1942 + dout("failed to write dst file (%zd)\n", ret); 1943 + goto out; 1944 + } 1938 1945 1939 1946 /* 1940 1947 * We need FILE_WR caps for dst_ci and FILE_RD for src_ci as other
+3 -9
fs/ceph/mds_client.c
··· 80 80 info->symlink = *p; 81 81 *p += info->symlink_len; 82 82 83 - if (features & CEPH_FEATURE_DIRLAYOUTHASH) 84 - ceph_decode_copy_safe(p, end, &info->dir_layout, 85 - sizeof(info->dir_layout), bad); 86 - else 87 - memset(&info->dir_layout, 0, sizeof(info->dir_layout)); 88 - 83 + ceph_decode_copy_safe(p, end, &info->dir_layout, 84 + sizeof(info->dir_layout), bad); 89 85 ceph_decode_32_safe(p, end, info->xattr_len, bad); 90 86 ceph_decode_need(p, end, info->xattr_len, bad); 91 87 info->xattr_data = *p; ··· 3178 3182 recon_state.pagelist = pagelist; 3179 3183 if (session->s_con.peer_features & CEPH_FEATURE_MDSENC) 3180 3184 recon_state.msg_version = 3; 3181 - else if (session->s_con.peer_features & CEPH_FEATURE_FLOCK) 3182 - recon_state.msg_version = 2; 3183 3185 else 3184 - recon_state.msg_version = 1; 3186 + recon_state.msg_version = 2; 3185 3187 err = iterate_session_caps(session, encode_caps_cb, &recon_state); 3186 3188 if (err < 0) 3187 3189 goto fail;
+2 -1
fs/ceph/quota.c
··· 237 237 ceph_put_snap_realm(mdsc, realm); 238 238 realm = next; 239 239 } 240 - ceph_put_snap_realm(mdsc, realm); 240 + if (realm) 241 + ceph_put_snap_realm(mdsc, realm); 241 242 up_read(&mdsc->snap_rwsem); 242 243 243 244 return exceeded;
+3 -2
fs/ext4/inode.c
··· 5835 5835 { 5836 5836 int err = 0; 5837 5837 5838 - if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) 5838 + if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { 5839 + put_bh(iloc->bh); 5839 5840 return -EIO; 5840 - 5841 + } 5841 5842 if (IS_I_VERSION(inode)) 5842 5843 inode_inc_iversion(inode); 5843 5844
+4 -1
fs/ext4/namei.c
··· 126 126 if (!is_dx_block && type == INDEX) { 127 127 ext4_error_inode(inode, func, line, block, 128 128 "directory leaf block found instead of index block"); 129 + brelse(bh); 129 130 return ERR_PTR(-EFSCORRUPTED); 130 131 } 131 132 if (!ext4_has_metadata_csum(inode->i_sb) || ··· 2812 2811 list_del_init(&EXT4_I(inode)->i_orphan); 2813 2812 mutex_unlock(&sbi->s_orphan_lock); 2814 2813 } 2815 - } 2814 + } else 2815 + brelse(iloc.bh); 2816 + 2816 2817 jbd_debug(4, "superblock will point to %lu\n", inode->i_ino); 2817 2818 jbd_debug(4, "orphan inode %lu will point to %d\n", 2818 2819 inode->i_ino, NEXT_ORPHAN(inode));
+16 -12
fs/ext4/resize.c
··· 459 459 460 460 BUFFER_TRACE(bh, "get_write_access"); 461 461 err = ext4_journal_get_write_access(handle, bh); 462 - if (err) 462 + if (err) { 463 + brelse(bh); 463 464 return err; 465 + } 464 466 ext4_debug("mark block bitmap %#04llx (+%llu/%u)\n", 465 467 first_cluster, first_cluster - start, count2); 466 468 ext4_set_bits(bh->b_data, first_cluster - start, count2); 467 469 468 470 err = ext4_handle_dirty_metadata(handle, NULL, bh); 471 + brelse(bh); 469 472 if (unlikely(err)) 470 473 return err; 471 - brelse(bh); 472 474 } 473 475 474 476 return 0; ··· 607 605 bh = bclean(handle, sb, block); 608 606 if (IS_ERR(bh)) { 609 607 err = PTR_ERR(bh); 610 - bh = NULL; 611 608 goto out; 612 609 } 613 610 overhead = ext4_group_overhead_blocks(sb, group); ··· 619 618 ext4_mark_bitmap_end(EXT4_B2C(sbi, group_data[i].blocks_count), 620 619 sb->s_blocksize * 8, bh->b_data); 621 620 err = ext4_handle_dirty_metadata(handle, NULL, bh); 621 + brelse(bh); 622 622 if (err) 623 623 goto out; 624 - brelse(bh); 625 624 626 625 handle_ib: 627 626 if (bg_flags[i] & EXT4_BG_INODE_UNINIT) ··· 636 635 bh = bclean(handle, sb, block); 637 636 if (IS_ERR(bh)) { 638 637 err = PTR_ERR(bh); 639 - bh = NULL; 640 638 goto out; 641 639 } 642 640 643 641 ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), 644 642 sb->s_blocksize * 8, bh->b_data); 645 643 err = ext4_handle_dirty_metadata(handle, NULL, bh); 644 + brelse(bh); 646 645 if (err) 647 646 goto out; 648 - brelse(bh); 649 647 } 650 - bh = NULL; 651 648 652 649 /* Mark group tables in block bitmap */ 653 650 for (j = 0; j < GROUP_TABLE_COUNT; j++) { ··· 684 685 } 685 686 686 687 out: 687 - brelse(bh); 688 688 err2 = ext4_journal_stop(handle); 689 689 if (err2 && !err) 690 690 err = err2; ··· 871 873 err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh); 872 874 if (unlikely(err)) { 873 875 ext4_std_error(sb, err); 876 + iloc.bh = NULL; 874 877 goto exit_inode; 875 878 } 876 879 brelse(dind); ··· 923 924 sizeof(struct buffer_head *), 924 925 GFP_NOFS); 925 926 if (!n_group_desc) { 927 + brelse(gdb_bh); 926 928 err = -ENOMEM; 927 929 ext4_warning(sb, "not enough memory for %lu groups", 928 930 gdb_num + 1); ··· 939 939 kvfree(o_group_desc); 940 940 BUFFER_TRACE(gdb_bh, "get_write_access"); 941 941 err = ext4_journal_get_write_access(handle, gdb_bh); 942 - if (unlikely(err)) 943 - brelse(gdb_bh); 944 942 return err; 945 943 } 946 944 ··· 1122 1124 backup_block, backup_block - 1123 1125 ext4_group_first_block_no(sb, group)); 1124 1126 BUFFER_TRACE(bh, "get_write_access"); 1125 - if ((err = ext4_journal_get_write_access(handle, bh))) 1127 + if ((err = ext4_journal_get_write_access(handle, bh))) { 1128 + brelse(bh); 1126 1129 break; 1130 + } 1127 1131 lock_buffer(bh); 1128 1132 memcpy(bh->b_data, data, size); 1129 1133 if (rest) ··· 2023 2023 2024 2024 err = ext4_alloc_flex_bg_array(sb, n_group + 1); 2025 2025 if (err) 2026 - return err; 2026 + goto out; 2027 2027 2028 2028 err = ext4_mb_alloc_groupinfo(sb, n_group + 1); 2029 2029 if (err) ··· 2059 2059 n_blocks_count_retry = 0; 2060 2060 free_flex_gd(flex_gd); 2061 2061 flex_gd = NULL; 2062 + if (resize_inode) { 2063 + iput(resize_inode); 2064 + resize_inode = NULL; 2065 + } 2062 2066 goto retry; 2063 2067 } 2064 2068
+9 -8
fs/ext4/super.c
··· 4075 4075 sbi->s_groups_count = blocks_count; 4076 4076 sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count, 4077 4077 (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); 4078 + if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != 4079 + le32_to_cpu(es->s_inodes_count)) { 4080 + ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", 4081 + le32_to_cpu(es->s_inodes_count), 4082 + ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); 4083 + ret = -EINVAL; 4084 + goto failed_mount; 4085 + } 4078 4086 db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / 4079 4087 EXT4_DESC_PER_BLOCK(sb); 4080 4088 if (ext4_has_feature_meta_bg(sb)) { ··· 4100 4092 if (sbi->s_group_desc == NULL) { 4101 4093 ext4_msg(sb, KERN_ERR, "not enough memory"); 4102 4094 ret = -ENOMEM; 4103 - goto failed_mount; 4104 - } 4105 - if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != 4106 - le32_to_cpu(es->s_inodes_count)) { 4107 - ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", 4108 - le32_to_cpu(es->s_inodes_count), 4109 - ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); 4110 - ret = -EINVAL; 4111 4095 goto failed_mount; 4112 4096 } 4113 4097 ··· 4510 4510 percpu_counter_destroy(&sbi->s_freeinodes_counter); 4511 4511 percpu_counter_destroy(&sbi->s_dirs_counter); 4512 4512 percpu_counter_destroy(&sbi->s_dirtyclusters_counter); 4513 + percpu_free_rwsem(&sbi->s_journal_flag_rwsem); 4513 4514 failed_mount5: 4514 4515 ext4_ext_release(sb); 4515 4516 ext4_release_system_zone(sb);
+19 -8
fs/ext4/xattr.c
··· 1031 1031 inode_lock(ea_inode); 1032 1032 1033 1033 ret = ext4_reserve_inode_write(handle, ea_inode, &iloc); 1034 - if (ret) { 1035 - iloc.bh = NULL; 1034 + if (ret) 1036 1035 goto out; 1037 - } 1038 1036 1039 1037 ref_count = ext4_xattr_inode_get_ref(ea_inode); 1040 1038 ref_count += ref_change; ··· 1078 1080 } 1079 1081 1080 1082 ret = ext4_mark_iloc_dirty(handle, ea_inode, &iloc); 1081 - iloc.bh = NULL; 1082 1083 if (ret) 1083 1084 ext4_warning_inode(ea_inode, 1084 1085 "ext4_mark_iloc_dirty() failed ret=%d", ret); 1085 1086 out: 1086 - brelse(iloc.bh); 1087 1087 inode_unlock(ea_inode); 1088 1088 return ret; 1089 1089 } ··· 1384 1388 bh = ext4_getblk(handle, ea_inode, block, 0); 1385 1389 if (IS_ERR(bh)) 1386 1390 return PTR_ERR(bh); 1391 + if (!bh) { 1392 + WARN_ON_ONCE(1); 1393 + EXT4_ERROR_INODE(ea_inode, 1394 + "ext4_getblk() return bh = NULL"); 1395 + return -EFSCORRUPTED; 1396 + } 1387 1397 ret = ext4_journal_get_write_access(handle, bh); 1388 1398 if (ret) 1389 1399 goto out; ··· 2278 2276 if (!bh) 2279 2277 return ERR_PTR(-EIO); 2280 2278 error = ext4_xattr_check_block(inode, bh); 2281 - if (error) 2279 + if (error) { 2280 + brelse(bh); 2282 2281 return ERR_PTR(error); 2282 + } 2283 2283 return bh; 2284 2284 } 2285 2285 ··· 2401 2397 error = ext4_xattr_block_set(handle, inode, &i, &bs); 2402 2398 } else if (error == -ENOSPC) { 2403 2399 if (EXT4_I(inode)->i_file_acl && !bs.s.base) { 2400 + brelse(bs.bh); 2401 + bs.bh = NULL; 2404 2402 error = ext4_xattr_block_find(inode, &i, &bs); 2405 2403 if (error) 2406 2404 goto cleanup; ··· 2623 2617 kfree(buffer); 2624 2618 if (is) 2625 2619 brelse(is->iloc.bh); 2620 + if (bs) 2621 + brelse(bs->bh); 2626 2622 kfree(is); 2627 2623 kfree(bs); 2628 2624 ··· 2704 2696 struct ext4_inode *raw_inode, handle_t *handle) 2705 2697 { 2706 2698 struct ext4_xattr_ibody_header *header; 2707 - struct buffer_head *bh; 2708 2699 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 2709 2700 static unsigned int mnt_count; 2710 2701 size_t min_offs; ··· 2744 2737 * EA block can hold new_extra_isize bytes. 2745 2738 */ 2746 2739 if (EXT4_I(inode)->i_file_acl) { 2740 + struct buffer_head *bh; 2741 + 2747 2742 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); 2748 2743 error = -EIO; 2749 2744 if (!bh) 2750 2745 goto cleanup; 2751 2746 error = ext4_xattr_check_block(inode, bh); 2752 - if (error) 2747 + if (error) { 2748 + brelse(bh); 2753 2749 goto cleanup; 2750 + } 2754 2751 base = BHDR(bh); 2755 2752 end = bh->b_data + bh->b_size; 2756 2753 min_offs = end - base;
+17 -5
fs/namespace.c
··· 1540 1540 1541 1541 namespace_lock(); 1542 1542 lock_mount_hash(); 1543 - event++; 1544 1543 1544 + /* Recheck MNT_LOCKED with the locks held */ 1545 + retval = -EINVAL; 1546 + if (mnt->mnt.mnt_flags & MNT_LOCKED) 1547 + goto out; 1548 + 1549 + event++; 1545 1550 if (flags & MNT_DETACH) { 1546 1551 if (!list_empty(&mnt->mnt_list)) 1547 1552 umount_tree(mnt, UMOUNT_PROPAGATE); ··· 1560 1555 retval = 0; 1561 1556 } 1562 1557 } 1558 + out: 1563 1559 unlock_mount_hash(); 1564 1560 namespace_unlock(); 1565 1561 return retval; ··· 1651 1645 goto dput_and_out; 1652 1646 if (!check_mnt(mnt)) 1653 1647 goto dput_and_out; 1654 - if (mnt->mnt.mnt_flags & MNT_LOCKED) 1648 + if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */ 1655 1649 goto dput_and_out; 1656 1650 retval = -EPERM; 1657 1651 if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN)) ··· 1734 1728 for (s = r; s; s = next_mnt(s, r)) { 1735 1729 if (!(flag & CL_COPY_UNBINDABLE) && 1736 1730 IS_MNT_UNBINDABLE(s)) { 1737 - s = skip_mnt_tree(s); 1738 - continue; 1731 + if (s->mnt.mnt_flags & MNT_LOCKED) { 1732 + /* Both unbindable and locked. */ 1733 + q = ERR_PTR(-EPERM); 1734 + goto out; 1735 + } else { 1736 + s = skip_mnt_tree(s); 1737 + continue; 1738 + } 1739 1739 } 1740 1740 if (!(flag & CL_COPY_MNT_NS_FILE) && 1741 1741 is_mnt_ns_file(s->mnt.mnt_root)) { ··· 1794 1782 { 1795 1783 namespace_lock(); 1796 1784 lock_mount_hash(); 1797 - umount_tree(real_mount(mnt), UMOUNT_SYNC); 1785 + umount_tree(real_mount(mnt), 0); 1798 1786 unlock_mount_hash(); 1799 1787 namespace_unlock(); 1800 1788 }
+9 -2
fs/xfs/libxfs/xfs_attr_leaf.c
··· 243 243 struct xfs_mount *mp = bp->b_target->bt_mount; 244 244 struct xfs_attr_leafblock *leaf = bp->b_addr; 245 245 struct xfs_attr_leaf_entry *entries; 246 - uint16_t end; 246 + uint32_t end; /* must be 32bit - see below */ 247 247 int i; 248 248 249 249 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); ··· 293 293 /* 294 294 * Quickly check the freemap information. Attribute data has to be 295 295 * aligned to 4-byte boundaries, and likewise for the free space. 296 + * 297 + * Note that for 64k block size filesystems, the freemap entries cannot 298 + * overflow as they are only be16 fields. However, when checking end 299 + * pointer of the freemap, we have to be careful to detect overflows and 300 + * so use uint32_t for those checks. 296 301 */ 297 302 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) { 298 303 if (ichdr.freemap[i].base > mp->m_attr_geo->blksize) ··· 308 303 return __this_address; 309 304 if (ichdr.freemap[i].size & 0x3) 310 305 return __this_address; 311 - end = ichdr.freemap[i].base + ichdr.freemap[i].size; 306 + 307 + /* be care of 16 bit overflows here */ 308 + end = (uint32_t)ichdr.freemap[i].base + ichdr.freemap[i].size; 312 309 if (end < ichdr.freemap[i].base) 313 310 return __this_address; 314 311 if (end > mp->m_attr_geo->blksize)
+1 -1
fs/xfs/xfs_ioctl.c
··· 1608 1608 error = 0; 1609 1609 out_free_buf: 1610 1610 kmem_free(buf); 1611 - return 0; 1611 + return error; 1612 1612 } 1613 1613 1614 1614 struct getfsmap_info {
+1 -1
fs/xfs/xfs_message.c
··· 107 107 void 108 108 xfs_hex_dump(void *p, int length) 109 109 { 110 - print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1); 110 + print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_OFFSET, 16, 1, p, length, 1); 111 111 }
+1 -1
include/asm-generic/4level-fixup.h
··· 3 3 #define _4LEVEL_FIXUP_H 4 4 5 5 #define __ARCH_HAS_4LEVEL_HACK 6 - #define __PAGETABLE_PUD_FOLDED 6 + #define __PAGETABLE_PUD_FOLDED 1 7 7 8 8 #define PUD_SHIFT PGDIR_SHIFT 9 9 #define PUD_SIZE PGDIR_SIZE
+1 -1
include/asm-generic/5level-fixup.h
··· 3 3 #define _5LEVEL_FIXUP_H 4 4 5 5 #define __ARCH_HAS_5LEVEL_HACK 6 - #define __PAGETABLE_P4D_FOLDED 6 + #define __PAGETABLE_P4D_FOLDED 1 7 7 8 8 #define P4D_SHIFT PGDIR_SHIFT 9 9 #define P4D_SIZE PGDIR_SIZE
+1 -1
include/asm-generic/pgtable-nop4d-hack.h
··· 5 5 #ifndef __ASSEMBLY__ 6 6 #include <asm-generic/5level-fixup.h> 7 7 8 - #define __PAGETABLE_PUD_FOLDED 8 + #define __PAGETABLE_PUD_FOLDED 1 9 9 10 10 /* 11 11 * Having the pud type consist of a pgd gets the size right, and allows
+1 -1
include/asm-generic/pgtable-nop4d.h
··· 4 4 5 5 #ifndef __ASSEMBLY__ 6 6 7 - #define __PAGETABLE_P4D_FOLDED 7 + #define __PAGETABLE_P4D_FOLDED 1 8 8 9 9 typedef struct { pgd_t pgd; } p4d_t; 10 10
+1 -1
include/asm-generic/pgtable-nopmd.h
··· 8 8 9 9 struct mm_struct; 10 10 11 - #define __PAGETABLE_PMD_FOLDED 11 + #define __PAGETABLE_PMD_FOLDED 1 12 12 13 13 /* 14 14 * Having the pmd type consist of a pud gets the size right, and allows
+1 -1
include/asm-generic/pgtable-nopud.h
··· 9 9 #else 10 10 #include <asm-generic/pgtable-nop4d.h> 11 11 12 - #define __PAGETABLE_PUD_FOLDED 12 + #define __PAGETABLE_PUD_FOLDED 1 13 13 14 14 /* 15 15 * Having the pud type consist of a p4d gets the size right, and allows
+16
include/asm-generic/pgtable.h
··· 1127 1127 #endif 1128 1128 #endif 1129 1129 1130 + /* 1131 + * On some architectures it depends on the mm if the p4d/pud or pmd 1132 + * layer of the page table hierarchy is folded or not. 1133 + */ 1134 + #ifndef mm_p4d_folded 1135 + #define mm_p4d_folded(mm) __is_defined(__PAGETABLE_P4D_FOLDED) 1136 + #endif 1137 + 1138 + #ifndef mm_pud_folded 1139 + #define mm_pud_folded(mm) __is_defined(__PAGETABLE_PUD_FOLDED) 1140 + #endif 1141 + 1142 + #ifndef mm_pmd_folded 1143 + #define mm_pmd_folded(mm) __is_defined(__PAGETABLE_PMD_FOLDED) 1144 + #endif 1145 + 1130 1146 #endif /* _ASM_GENERIC_PGTABLE_H */
+1 -7
include/linux/ceph/ceph_features.h
··· 213 213 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \ 214 214 CEPH_FEATURE_CEPHX_V2) 215 215 216 - #define CEPH_FEATURES_REQUIRED_DEFAULT \ 217 - (CEPH_FEATURE_NOSRCADDR | \ 218 - CEPH_FEATURE_SUBSCRIBE2 | \ 219 - CEPH_FEATURE_RECONNECT_SEQ | \ 220 - CEPH_FEATURE_PGID64 | \ 221 - CEPH_FEATURE_PGPOOL3 | \ 222 - CEPH_FEATURE_OSDENC) 216 + #define CEPH_FEATURES_REQUIRED_DEFAULT 0 223 217 224 218 #endif
+9 -5
include/linux/compiler_attributes.h
··· 4 4 5 5 /* 6 6 * The attributes in this file are unconditionally defined and they directly 7 - * map to compiler attribute(s) -- except those that are optional. 7 + * map to compiler attribute(s), unless one of the compilers does not support 8 + * the attribute. In that case, __has_attribute is used to check for support 9 + * and the reason is stated in its comment ("Optional: ..."). 8 10 * 9 11 * Any other "attributes" (i.e. those that depend on a configuration option, 10 12 * on a compiler, on an architecture, on plugins, on other attributes...) 11 13 * should be defined elsewhere (e.g. compiler_types.h or compiler-*.h). 14 + * The intention is to keep this file as simple as possible, as well as 15 + * compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks). 12 16 * 13 17 * This file is meant to be sorted (by actual attribute name, 14 18 * not by #define identifier). Use the __attribute__((__name__)) syntax 15 19 * (i.e. with underscores) to avoid future collisions with other macros. 16 - * If an attribute is optional, state the reason in the comment. 20 + * Provide links to the documentation of each supported compiler, if it exists. 17 21 */ 18 22 19 23 /* 20 - * To check for optional attributes, we use __has_attribute, which is supported 21 - * on gcc >= 5, clang >= 2.9 and icc >= 17. In the meantime, to support 22 - * 4.6 <= gcc < 5, we implement __has_attribute by hand. 24 + * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17. 25 + * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute 26 + * by hand. 23 27 * 24 28 * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__ 25 29 * depending on the compiler used to build it; however, these attributes have
+4
include/linux/compiler_types.h
··· 130 130 # define randomized_struct_fields_end 131 131 #endif 132 132 133 + #ifndef asm_volatile_goto 134 + #define asm_volatile_goto(x...) asm goto(x) 135 + #endif 136 + 133 137 /* Are two types/vars the same type (ignoring qualifiers)? */ 134 138 #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) 135 139
+2 -2
include/linux/hid.h
··· 722 722 * input will not be passed to raw_event unless hid_device_io_start is 723 723 * called. 724 724 * 725 - * raw_event and event should return 0 on no action performed, 1 when no 726 - * further processing should be done and negative on error 725 + * raw_event and event should return negative on error, any other value will 726 + * pass the event on to .event() typically return 0 for success. 727 727 * 728 728 * input_mapping shall return a negative value to completely ignore this usage 729 729 * (e.g. doubled or invalid usage), zero to continue with parsing of this
+1
include/linux/i8253.h
··· 21 21 #define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ) 22 22 23 23 extern raw_spinlock_t i8253_lock; 24 + extern bool i8253_clear_counter_on_shutdown; 24 25 extern struct clock_event_device i8253_clockevent; 25 26 extern void clockevent_i8253_init(bool oneshot); 26 27
+8
include/linux/mm.h
··· 1744 1744 1745 1745 static inline void mm_inc_nr_puds(struct mm_struct *mm) 1746 1746 { 1747 + if (mm_pud_folded(mm)) 1748 + return; 1747 1749 atomic_long_add(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes); 1748 1750 } 1749 1751 1750 1752 static inline void mm_dec_nr_puds(struct mm_struct *mm) 1751 1753 { 1754 + if (mm_pud_folded(mm)) 1755 + return; 1752 1756 atomic_long_sub(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes); 1753 1757 } 1754 1758 #endif ··· 1772 1768 1773 1769 static inline void mm_inc_nr_pmds(struct mm_struct *mm) 1774 1770 { 1771 + if (mm_pmd_folded(mm)) 1772 + return; 1775 1773 atomic_long_add(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes); 1776 1774 } 1777 1775 1778 1776 static inline void mm_dec_nr_pmds(struct mm_struct *mm) 1779 1777 { 1778 + if (mm_pmd_folded(mm)) 1779 + return; 1780 1780 atomic_long_sub(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes); 1781 1781 } 1782 1782 #endif
+3 -4
include/linux/mtd/nand.h
··· 324 324 */ 325 325 static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) 326 326 { 327 - return (u64)nand->memorg.luns_per_target * 328 - nand->memorg.eraseblocks_per_lun * 329 - nand->memorg.pages_per_eraseblock; 327 + return nand->memorg.ntargets * nand->memorg.luns_per_target * 328 + nand->memorg.eraseblocks_per_lun; 330 329 } 331 330 332 331 /** ··· 568 569 } 569 570 570 571 /** 571 - * nanddev_pos_next_eraseblock() - Move a position to the next page 572 + * nanddev_pos_next_page() - Move a position to the next page 572 573 * @nand: NAND device 573 574 * @pos: the position to update 574 575 *
+2
include/linux/nmi.h
··· 119 119 void watchdog_nmi_stop(void); 120 120 void watchdog_nmi_start(void); 121 121 int watchdog_nmi_probe(void); 122 + int watchdog_nmi_enable(unsigned int cpu); 123 + void watchdog_nmi_disable(unsigned int cpu); 122 124 123 125 /** 124 126 * touch_nmi_watchdog - restart NMI watchdog timeout.
+9 -9
include/uapi/linux/kfd_ioctl.h
··· 83 83 }; 84 84 85 85 struct kfd_ioctl_get_queue_wave_state_args { 86 - uint64_t ctl_stack_address; /* to KFD */ 87 - uint32_t ctl_stack_used_size; /* from KFD */ 88 - uint32_t save_area_used_size; /* from KFD */ 89 - uint32_t queue_id; /* to KFD */ 90 - uint32_t pad; 86 + __u64 ctl_stack_address; /* to KFD */ 87 + __u32 ctl_stack_used_size; /* from KFD */ 88 + __u32 save_area_used_size; /* from KFD */ 89 + __u32 queue_id; /* to KFD */ 90 + __u32 pad; 91 91 }; 92 92 93 93 /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ ··· 255 255 256 256 /* hw exception data */ 257 257 struct kfd_hsa_hw_exception_data { 258 - uint32_t reset_type; 259 - uint32_t reset_cause; 260 - uint32_t memory_lost; 261 - uint32_t gpu_id; 258 + __u32 reset_type; 259 + __u32 reset_cause; 260 + __u32 memory_lost; 261 + __u32 gpu_id; 262 262 }; 263 263 264 264 /* Event data */
+7 -5
include/xen/xen-ops.h
··· 42 42 43 43 extern unsigned long *xen_contiguous_bitmap; 44 44 45 - #ifdef CONFIG_XEN_PV 45 + #if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) 46 46 int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, 47 47 unsigned int address_bits, 48 48 dma_addr_t *dma_handle); 49 49 50 50 void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order); 51 - 52 - int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr, 53 - xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot, 54 - unsigned int domid, bool no_translate, struct page **pages); 55 51 #else 56 52 static inline int xen_create_contiguous_region(phys_addr_t pstart, 57 53 unsigned int order, ··· 59 63 60 64 static inline void xen_destroy_contiguous_region(phys_addr_t pstart, 61 65 unsigned int order) { } 66 + #endif 62 67 68 + #if defined(CONFIG_XEN_PV) 69 + int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr, 70 + xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot, 71 + unsigned int domid, bool no_translate, struct page **pages); 72 + #else 63 73 static inline int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr, 64 74 xen_pfn_t *pfn, int nr, int *err_ptr, 65 75 pgprot_t prot, unsigned int domid,
+14 -5
kernel/resource.c
··· 319 319 EXPORT_SYMBOL(release_resource); 320 320 321 321 /** 322 - * Finds the lowest iomem resource that covers part of [start..end]. The 323 - * caller must specify start, end, flags, and desc (which may be 322 + * Finds the lowest iomem resource that covers part of [@start..@end]. The 323 + * caller must specify @start, @end, @flags, and @desc (which may be 324 324 * IORES_DESC_NONE). 325 325 * 326 - * If a resource is found, returns 0 and *res is overwritten with the part 327 - * of the resource that's within [start..end]; if none is found, returns 328 - * -1. 326 + * If a resource is found, returns 0 and @*res is overwritten with the part 327 + * of the resource that's within [@start..@end]; if none is found, returns 328 + * -1 or -EINVAL for other invalid parameters. 329 329 * 330 330 * This function walks the whole tree and not just first level children 331 331 * unless @first_lvl is true. 332 + * 333 + * @start: start address of the resource searched for 334 + * @end: end address of same resource 335 + * @flags: flags which the resource must have 336 + * @desc: descriptor the resource must have 337 + * @first_lvl: walk only the first level children, if set 338 + * @res: return ptr, if resource found 332 339 */ 333 340 static int find_next_iomem_res(resource_size_t start, resource_size_t end, 334 341 unsigned long flags, unsigned long desc, ··· 406 399 * @flags: I/O resource flags 407 400 * @start: start addr 408 401 * @end: end addr 402 + * @arg: function argument for the callback @func 403 + * @func: callback function that is called for each qualifying resource area 409 404 * 410 405 * NOTE: For a new descriptor search, define a new IORES_DESC in 411 406 * <linux/ioport.h> and set it in 'desc' of a target resource entry.
+4 -1
kernel/sched/core.c
··· 5851 5851 /* 5852 5852 * There's no userspace yet to cause hotplug operations; hence all the 5853 5853 * CPU masks are stable and all blatant races in the below code cannot 5854 - * happen. 5854 + * happen. The hotplug lock is nevertheless taken to satisfy lockdep, 5855 + * but there won't be any contention on it. 5855 5856 */ 5857 + cpus_read_lock(); 5856 5858 mutex_lock(&sched_domains_mutex); 5857 5859 sched_init_domains(cpu_active_mask); 5858 5860 mutex_unlock(&sched_domains_mutex); 5861 + cpus_read_unlock(); 5859 5862 5860 5863 /* Move init over to a non-isolated CPU */ 5861 5864 if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
+2 -2
kernel/sched/fair.c
··· 2400 2400 local = 1; 2401 2401 2402 2402 /* 2403 - * Retry task to preferred node migration periodically, in case it 2404 - * case it previously failed, or the scheduler moved us. 2403 + * Retry to migrate task to preferred node periodically, in case it 2404 + * previously failed, or the scheduler moved us. 2405 2405 */ 2406 2406 if (time_after(jiffies, p->numa_migrate_retry)) { 2407 2407 task_numa_placement(p);
-3
kernel/time/posix-cpu-timers.c
··· 917 917 struct task_cputime cputime; 918 918 unsigned long soft; 919 919 920 - if (dl_task(tsk)) 921 - check_dl_overrun(tsk); 922 - 923 920 /* 924 921 * If cputimer is not running, then there are no active 925 922 * process wide timers (POSIX 1.b, itimers, RLIMIT_CPU).
+8 -4
kernel/user_namespace.c
··· 974 974 if (!new_idmap_permitted(file, ns, cap_setid, &new_map)) 975 975 goto out; 976 976 977 - ret = sort_idmaps(&new_map); 978 - if (ret < 0) 979 - goto out; 980 - 981 977 ret = -EPERM; 982 978 /* Map the lower ids from the parent user namespace to the 983 979 * kernel global id space. ··· 999 1003 1000 1004 e->lower_first = lower_first; 1001 1005 } 1006 + 1007 + /* 1008 + * If we want to use binary search for lookup, this clones the extent 1009 + * array and sorts both copies. 1010 + */ 1011 + ret = sort_idmaps(&new_map); 1012 + if (ret < 0) 1013 + goto out; 1002 1014 1003 1015 /* Install the map */ 1004 1016 if (new_map.nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) {
+2 -2
lib/raid6/test/Makefile
··· 27 27 CFLAGS += -I../../../arch/arm/include -mfpu=neon 28 28 HAS_NEON = yes 29 29 endif 30 - ifeq ($(ARCH),arm64) 30 + ifeq ($(ARCH),aarch64) 31 31 CFLAGS += -I../../../arch/arm64/include 32 32 HAS_NEON = yes 33 33 endif ··· 41 41 gcc -c -x assembler - >&/dev/null && \ 42 42 rm ./-.o && echo -DCONFIG_AS_AVX512=1) 43 43 else ifeq ($(HAS_NEON),yes) 44 - OBJS += neon.o neon1.o neon2.o neon4.o neon8.o 44 + OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o 45 45 CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 46 46 else 47 47 HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
+2 -2
net/core/flow_dissector.c
··· 1165 1165 break; 1166 1166 } 1167 1167 1168 - if (dissector_uses_key(flow_dissector, 1169 - FLOW_DISSECTOR_KEY_PORTS)) { 1168 + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS) && 1169 + !(key_control->flags & FLOW_DIS_IS_FRAGMENT)) { 1170 1170 key_ports = skb_flow_dissector_target(flow_dissector, 1171 1171 FLOW_DISSECTOR_KEY_PORTS, 1172 1172 target_container);
+15 -14
net/ipv4/inet_fragment.c
··· 178 178 } 179 179 180 180 static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, 181 - void *arg) 181 + void *arg, 182 + struct inet_frag_queue **prev) 182 183 { 183 184 struct inet_frags *f = nf->f; 184 185 struct inet_frag_queue *q; 185 - int err; 186 186 187 187 q = inet_frag_alloc(nf, f, arg); 188 - if (!q) 188 + if (!q) { 189 + *prev = ERR_PTR(-ENOMEM); 189 190 return NULL; 190 - 191 + } 191 192 mod_timer(&q->timer, jiffies + nf->timeout); 192 193 193 - err = rhashtable_insert_fast(&nf->rhashtable, &q->node, 194 - f->rhash_params); 195 - if (err < 0) { 194 + *prev = rhashtable_lookup_get_insert_key(&nf->rhashtable, &q->key, 195 + &q->node, f->rhash_params); 196 + if (*prev) { 196 197 q->flags |= INET_FRAG_COMPLETE; 197 198 inet_frag_kill(q); 198 199 inet_frag_destroy(q); ··· 205 204 /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ 206 205 struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key) 207 206 { 208 - struct inet_frag_queue *fq; 207 + struct inet_frag_queue *fq = NULL, *prev; 209 208 210 209 if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) 211 210 return NULL; 212 211 213 212 rcu_read_lock(); 214 213 215 - fq = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params); 216 - if (fq) { 214 + prev = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params); 215 + if (!prev) 216 + fq = inet_frag_create(nf, key, &prev); 217 + if (prev && !IS_ERR(prev)) { 218 + fq = prev; 217 219 if (!refcount_inc_not_zero(&fq->refcnt)) 218 220 fq = NULL; 219 - rcu_read_unlock(); 220 - return fq; 221 221 } 222 222 rcu_read_unlock(); 223 - 224 - return inet_frag_create(nf, key); 223 + return fq; 225 224 } 226 225 EXPORT_SYMBOL(inet_frag_find);
+2 -1
net/sched/act_mirred.c
··· 258 258 if (is_redirect) { 259 259 skb2->tc_redirected = 1; 260 260 skb2->tc_from_ingress = skb2->tc_at_ingress; 261 - 261 + if (skb2->tc_from_ingress) 262 + skb2->tstamp = 0; 262 263 /* let's the caller reinsert the packet, if possible */ 263 264 if (use_reinsert) { 264 265 res->ingress = want_ingress;
+13 -1
net/sched/cls_flower.c
··· 709 709 struct netlink_ext_ack *extack) 710 710 { 711 711 const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL; 712 - int option_len, key_depth, msk_depth = 0; 712 + int err, option_len, key_depth, msk_depth = 0; 713 + 714 + err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS], 715 + TCA_FLOWER_KEY_ENC_OPTS_MAX, 716 + enc_opts_policy, extack); 717 + if (err) 718 + return err; 713 719 714 720 nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]); 715 721 716 722 if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) { 723 + err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], 724 + TCA_FLOWER_KEY_ENC_OPTS_MAX, 725 + enc_opts_policy, extack); 726 + if (err) 727 + return err; 728 + 717 729 nla_opt_msk = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]); 718 730 msk_depth = nla_len(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]); 719 731 }
-9
net/sched/sch_netem.c
··· 648 648 */ 649 649 skb->dev = qdisc_dev(sch); 650 650 651 - #ifdef CONFIG_NET_CLS_ACT 652 - /* 653 - * If it's at ingress let's pretend the delay is 654 - * from the network (tstamp will be updated). 655 - */ 656 - if (skb->tc_redirected && skb->tc_from_ingress) 657 - skb->tstamp = 0; 658 - #endif 659 - 660 651 if (q->slot.slot_next) { 661 652 q->slot.packets_left--; 662 653 q->slot.bytes_left -= qdisc_pkt_len(skb);
+7 -4
net/tipc/link.c
··· 1598 1598 if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI)) 1599 1599 l->priority = peers_prio; 1600 1600 1601 - /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ 1602 - if (msg_peer_stopping(hdr)) 1601 + /* If peer is going down we want full re-establish cycle */ 1602 + if (msg_peer_stopping(hdr)) { 1603 1603 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); 1604 - else if ((mtyp == RESET_MSG) || !link_is_up(l)) 1604 + break; 1605 + } 1606 + /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ 1607 + if (mtyp == RESET_MSG || !link_is_up(l)) 1605 1608 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); 1606 1609 1607 1610 /* ACTIVATE_MSG takes up link if it was already locally reset */ 1608 - if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING)) 1611 + if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING) 1609 1612 rc = TIPC_LINK_UP_EVT; 1610 1613 1611 1614 l->peer_session = msg_session(hdr);
+4 -3
scripts/kconfig/merge_config.sh
··· 102 102 fi 103 103 104 104 MERGE_LIST=$* 105 - SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" 105 + SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" 106 + SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" 106 107 107 108 TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) 108 109 ··· 117 116 echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 118 117 exit 1 119 118 fi 120 - CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) 119 + CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) 121 120 122 121 for CFG in $CFG_LIST ; do 123 122 grep -q -w $CFG $TMP_FILE || continue ··· 160 159 161 160 162 161 # Check all specified config values took (might have missed-dependency issues) 163 - for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do 162 + for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do 164 163 165 164 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 166 165 ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
+3 -3
scripts/package/builddeb
··· 81 81 cp System.map "$tmpdir/boot/System.map-$version" 82 82 cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version" 83 83 fi 84 - cp "$($MAKE -s image_name)" "$tmpdir/$installed_image_path" 84 + cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path" 85 85 86 - if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then 86 + if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then 87 87 # Only some architectures with OF support have this target 88 - if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then 88 + if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then 89 89 $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install 90 90 fi 91 91 fi
+5 -2
scripts/package/mkdebian
··· 88 88 version=$KERNELRELEASE 89 89 if [ -n "$KDEB_PKGVERSION" ]; then 90 90 packageversion=$KDEB_PKGVERSION 91 + revision=${packageversion##*-} 91 92 else 92 93 revision=$(cat .version 2>/dev/null||echo 1) 93 94 packageversion=$version-$revision ··· 206 205 #!$(command -v $MAKE) -f 207 206 208 207 build: 209 - \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC= 208 + \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ 209 + KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= 210 210 211 211 binary-arch: 212 - \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC= intdeb-pkg 212 + \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ 213 + KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg 213 214 214 215 clean: 215 216 rm -rf debian/*tmp debian/files
+6 -5
scripts/package/mkspec
··· 12 12 # how we were called determines which rpms we build and how we build them 13 13 if [ "$1" = prebuilt ]; then 14 14 S=DEL 15 + MAKE="$MAKE -f $srctree/Makefile" 15 16 else 16 17 S= 17 18 fi ··· 79 78 $S %setup -q 80 79 $S 81 80 $S %build 82 - $S make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} 81 + $S $MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} 83 82 $S 84 83 %install 85 84 mkdir -p %{buildroot}/boot 86 85 %ifarch ia64 87 86 mkdir -p %{buildroot}/boot/efi 88 - cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE 87 + cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE 89 88 ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ 90 89 %else 91 - cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE 90 + cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE 92 91 %endif 93 - $M make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install 94 - make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install 92 + $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install 93 + $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install 95 94 cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE 96 95 cp .config %{buildroot}/boot/config-$KERNELRELEASE 97 96 bzip2 -9 --keep vmlinux
+1 -1
scripts/setlocalversion
··· 74 74 fi 75 75 76 76 # Check for uncommitted changes 77 - if git status -uno --porcelain | grep -qv '^.. scripts/package'; then 77 + if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then 78 78 printf '%s' -dirty 79 79 fi 80 80
+2 -2
sound/pci/hda/thinkpad_helper.c
··· 58 58 removefunc = false; 59 59 } 60 60 if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0 && 61 - snd_hda_gen_add_micmute_led(codec, 62 - update_tpacpi_micmute) > 0) 61 + !snd_hda_gen_add_micmute_led(codec, 62 + update_tpacpi_micmute)) 63 63 removefunc = false; 64 64 } 65 65
+67 -66
tools/arch/arm64/include/asm/barrier.h
··· 14 14 #define wmb() asm volatile("dmb ishst" ::: "memory") 15 15 #define rmb() asm volatile("dmb ishld" ::: "memory") 16 16 17 - #define smp_store_release(p, v) \ 18 - do { \ 19 - union { typeof(*p) __val; char __c[1]; } __u = \ 20 - { .__val = (__force typeof(*p)) (v) }; \ 21 - \ 22 - switch (sizeof(*p)) { \ 23 - case 1: \ 24 - asm volatile ("stlrb %w1, %0" \ 25 - : "=Q" (*p) \ 26 - : "r" (*(__u8 *)__u.__c) \ 27 - : "memory"); \ 28 - break; \ 29 - case 2: \ 30 - asm volatile ("stlrh %w1, %0" \ 31 - : "=Q" (*p) \ 32 - : "r" (*(__u16 *)__u.__c) \ 33 - : "memory"); \ 34 - break; \ 35 - case 4: \ 36 - asm volatile ("stlr %w1, %0" \ 37 - : "=Q" (*p) \ 38 - : "r" (*(__u32 *)__u.__c) \ 39 - : "memory"); \ 40 - break; \ 41 - case 8: \ 42 - asm volatile ("stlr %1, %0" \ 43 - : "=Q" (*p) \ 44 - : "r" (*(__u64 *)__u.__c) \ 45 - : "memory"); \ 46 - break; \ 47 - default: \ 48 - /* Only to shut up gcc ... */ \ 49 - mb(); \ 50 - break; \ 51 - } \ 17 + #define smp_store_release(p, v) \ 18 + do { \ 19 + union { typeof(*p) __val; char __c[1]; } __u = \ 20 + { .__val = (v) }; \ 21 + \ 22 + switch (sizeof(*p)) { \ 23 + case 1: \ 24 + asm volatile ("stlrb %w1, %0" \ 25 + : "=Q" (*p) \ 26 + : "r" (*(__u8_alias_t *)__u.__c) \ 27 + : "memory"); \ 28 + break; \ 29 + case 2: \ 30 + asm volatile ("stlrh %w1, %0" \ 31 + : "=Q" (*p) \ 32 + : "r" (*(__u16_alias_t *)__u.__c) \ 33 + : "memory"); \ 34 + break; \ 35 + case 4: \ 36 + asm volatile ("stlr %w1, %0" \ 37 + : "=Q" (*p) \ 38 + : "r" (*(__u32_alias_t *)__u.__c) \ 39 + : "memory"); \ 40 + break; \ 41 + case 8: \ 42 + asm volatile ("stlr %1, %0" \ 43 + : "=Q" (*p) \ 44 + : "r" (*(__u64_alias_t *)__u.__c) \ 45 + : "memory"); \ 46 + break; \ 47 + default: \ 48 + /* Only to shut up gcc ... */ \ 49 + mb(); \ 50 + break; \ 51 + } \ 52 52 } while (0) 53 53 54 - #define smp_load_acquire(p) \ 55 - ({ \ 56 - union { typeof(*p) __val; char __c[1]; } __u; \ 57 - \ 58 - switch (sizeof(*p)) { \ 59 - case 1: \ 60 - asm volatile ("ldarb %w0, %1" \ 61 - : "=r" (*(__u8 *)__u.__c) \ 62 - : "Q" (*p) : "memory"); \ 63 - break; \ 64 - case 2: \ 65 - asm volatile ("ldarh %w0, %1" \ 66 - : "=r" (*(__u16 *)__u.__c) \ 67 - : "Q" (*p) : "memory"); \ 68 - break; \ 69 - case 4: \ 70 - asm volatile ("ldar %w0, %1" \ 71 - : "=r" (*(__u32 *)__u.__c) \ 72 - : "Q" (*p) : "memory"); \ 73 - break; \ 74 - case 8: \ 75 - asm volatile ("ldar %0, %1" \ 76 - : "=r" (*(__u64 *)__u.__c) \ 77 - : "Q" (*p) : "memory"); \ 78 - break; \ 79 - default: \ 80 - /* Only to shut up gcc ... */ \ 81 - mb(); \ 82 - break; \ 83 - } \ 84 - __u.__val; \ 54 + #define smp_load_acquire(p) \ 55 + ({ \ 56 + union { typeof(*p) __val; char __c[1]; } __u = \ 57 + { .__c = { 0 } }; \ 58 + \ 59 + switch (sizeof(*p)) { \ 60 + case 1: \ 61 + asm volatile ("ldarb %w0, %1" \ 62 + : "=r" (*(__u8_alias_t *)__u.__c) \ 63 + : "Q" (*p) : "memory"); \ 64 + break; \ 65 + case 2: \ 66 + asm volatile ("ldarh %w0, %1" \ 67 + : "=r" (*(__u16_alias_t *)__u.__c) \ 68 + : "Q" (*p) : "memory"); \ 69 + break; \ 70 + case 4: \ 71 + asm volatile ("ldar %w0, %1" \ 72 + : "=r" (*(__u32_alias_t *)__u.__c) \ 73 + : "Q" (*p) : "memory"); \ 74 + break; \ 75 + case 8: \ 76 + asm volatile ("ldar %0, %1" \ 77 + : "=r" (*(__u64_alias_t *)__u.__c) \ 78 + : "Q" (*p) : "memory"); \ 79 + break; \ 80 + default: \ 81 + /* Only to shut up gcc ... */ \ 82 + mb(); \ 83 + break; \ 84 + } \ 85 + __u.__val; \ 85 86 }) 86 87 87 88 #endif /* _TOOLS_LINUX_ASM_AARCH64_BARRIER_H */
-1
tools/perf/Documentation/perf-list.txt
··· 55 55 S - read sample value (PERF_SAMPLE_READ) 56 56 D - pin the event to the PMU 57 57 W - group is weak and will fallback to non-group if not schedulable, 58 - only supported in 'perf stat' for now. 59 58 60 59 The 'p' modifier can be used for specifying how precise the instruction 61 60 address should be. The 'p' modifier can be specified multiple times:
+1 -1
tools/perf/Makefile.perf
··· 387 387 388 388 linux_uapi_dir := $(srctree)/tools/include/uapi/linux 389 389 asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic 390 - arch_asm_uapi_dir := $(srctree)/tools/arch/$(ARCH)/include/uapi/asm/ 390 + arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/ 391 391 392 392 beauty_outdir := $(OUTPUT)trace/beauty/generated 393 393 beauty_ioctl_outdir := $(beauty_outdir)/ioctl
+6 -1
tools/perf/builtin-record.c
··· 391 391 ui__warning("%s\n", msg); 392 392 goto try_again; 393 393 } 394 - 394 + if ((errno == EINVAL || errno == EBADF) && 395 + pos->leader != pos && 396 + pos->weak_group) { 397 + pos = perf_evlist__reset_weak_group(evlist, pos); 398 + goto try_again; 399 + } 395 400 rc = -errno; 396 401 perf_evsel__open_strerror(pos, &opts->target, 397 402 errno, msg, sizeof(msg));
+1 -27
tools/perf/builtin-stat.c
··· 383 383 return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID; 384 384 } 385 385 386 - static struct perf_evsel *perf_evsel__reset_weak_group(struct perf_evsel *evsel) 387 - { 388 - struct perf_evsel *c2, *leader; 389 - bool is_open = true; 390 - 391 - leader = evsel->leader; 392 - pr_debug("Weak group for %s/%d failed\n", 393 - leader->name, leader->nr_members); 394 - 395 - /* 396 - * for_each_group_member doesn't work here because it doesn't 397 - * include the first entry. 398 - */ 399 - evlist__for_each_entry(evsel_list, c2) { 400 - if (c2 == evsel) 401 - is_open = false; 402 - if (c2->leader == leader) { 403 - if (is_open) 404 - perf_evsel__close(c2); 405 - c2->leader = c2; 406 - c2->nr_members = 0; 407 - } 408 - } 409 - return leader; 410 - } 411 - 412 386 static bool is_target_alive(struct target *_target, 413 387 struct thread_map *threads) 414 388 { ··· 451 477 if ((errno == EINVAL || errno == EBADF) && 452 478 counter->leader != counter && 453 479 counter->weak_group) { 454 - counter = perf_evsel__reset_weak_group(counter); 480 + counter = perf_evlist__reset_weak_group(evsel_list, counter); 455 481 goto try_again; 456 482 } 457 483
+3
tools/perf/builtin-top.c
··· 1429 1429 } 1430 1430 } 1431 1431 1432 + if (opts->branch_stack && callchain_param.enabled) 1433 + symbol_conf.show_branchflag_count = true; 1434 + 1432 1435 sort__mode = SORT_MODE__TOP; 1433 1436 /* display thread wants entries to be collapsed in a different tree */ 1434 1437 perf_hpp_list.need_collapse = 1;
+29 -5
tools/perf/builtin-trace.c
··· 108 108 } stats; 109 109 unsigned int max_stack; 110 110 unsigned int min_stack; 111 + bool raw_augmented_syscalls; 111 112 bool not_ev_qualifier; 112 113 bool live; 113 114 bool full_time; ··· 1725 1724 return printed; 1726 1725 } 1727 1726 1728 - static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented_args_size) 1727 + static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented_args_size, bool raw_augmented) 1729 1728 { 1730 1729 void *augmented_args = NULL; 1730 + /* 1731 + * For now with BPF raw_augmented we hook into raw_syscalls:sys_enter 1732 + * and there we get all 6 syscall args plus the tracepoint common 1733 + * fields (sizeof(long)) and the syscall_nr (another long). So we check 1734 + * if that is the case and if so don't look after the sc->args_size, 1735 + * but always after the full raw_syscalls:sys_enter payload, which is 1736 + * fixed. 1737 + * 1738 + * We'll revisit this later to pass s->args_size to the BPF augmenter 1739 + * (now tools/perf/examples/bpf/augmented_raw_syscalls.c, so that it 1740 + * copies only what we need for each syscall, like what happens when we 1741 + * use syscalls:sys_enter_NAME, so that we reduce the kernel/userspace 1742 + * traffic to just what is needed for each syscall. 1743 + */ 1744 + int args_size = raw_augmented ? (8 * (int)sizeof(long)) : sc->args_size; 1731 1745 1732 - *augmented_args_size = sample->raw_size - sc->args_size; 1746 + *augmented_args_size = sample->raw_size - args_size; 1733 1747 if (*augmented_args_size > 0) 1734 - augmented_args = sample->raw_data + sc->args_size; 1748 + augmented_args = sample->raw_data + args_size; 1735 1749 1736 1750 return augmented_args; 1737 1751 } ··· 1796 1780 * here and avoid using augmented syscalls when the evsel is the raw_syscalls one. 1797 1781 */ 1798 1782 if (evsel != trace->syscalls.events.sys_enter) 1799 - augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size); 1783 + augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_syscalls); 1800 1784 ttrace->entry_time = sample->time; 1801 1785 msg = ttrace->entry_str; 1802 1786 printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name); ··· 1849 1833 goto out_put; 1850 1834 1851 1835 args = perf_evsel__sc_tp_ptr(evsel, args, sample); 1852 - augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size); 1836 + augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_syscalls); 1853 1837 syscall__scnprintf_args(sc, msg, sizeof(msg), args, augmented_args, augmented_args_size, trace, thread); 1854 1838 fprintf(trace->output, "%s", msg); 1855 1839 err = 0; ··· 3517 3501 evsel->handler = trace__sys_enter; 3518 3502 3519 3503 evlist__for_each_entry(trace.evlist, evsel) { 3504 + bool raw_syscalls_sys_exit = strcmp(perf_evsel__name(evsel), "raw_syscalls:sys_exit") == 0; 3505 + 3506 + if (raw_syscalls_sys_exit) { 3507 + trace.raw_augmented_syscalls = true; 3508 + goto init_augmented_syscall_tp; 3509 + } 3510 + 3520 3511 if (strstarts(perf_evsel__name(evsel), "syscalls:sys_exit_")) { 3512 + init_augmented_syscall_tp: 3521 3513 perf_evsel__init_augmented_syscall_tp(evsel); 3522 3514 perf_evsel__init_augmented_syscall_tp_ret(evsel); 3523 3515 evsel->handler = trace__sys_exit;
+131
tools/perf/examples/bpf/augmented_raw_syscalls.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Augment the raw_syscalls tracepoints with the contents of the pointer arguments. 4 + * 5 + * Test it with: 6 + * 7 + * perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c cat /etc/passwd > /dev/null 8 + * 9 + * This exactly matches what is marshalled into the raw_syscall:sys_enter 10 + * payload expected by the 'perf trace' beautifiers. 11 + * 12 + * For now it just uses the existing tracepoint augmentation code in 'perf 13 + * trace', in the next csets we'll hook up these with the sys_enter/sys_exit 14 + * code that will combine entry/exit in a strace like way. 15 + */ 16 + 17 + #include <stdio.h> 18 + #include <linux/socket.h> 19 + 20 + /* bpf-output associated map */ 21 + struct bpf_map SEC("maps") __augmented_syscalls__ = { 22 + .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, 23 + .key_size = sizeof(int), 24 + .value_size = sizeof(u32), 25 + .max_entries = __NR_CPUS__, 26 + }; 27 + 28 + struct syscall_enter_args { 29 + unsigned long long common_tp_fields; 30 + long syscall_nr; 31 + unsigned long args[6]; 32 + }; 33 + 34 + struct syscall_exit_args { 35 + unsigned long long common_tp_fields; 36 + long syscall_nr; 37 + long ret; 38 + }; 39 + 40 + struct augmented_filename { 41 + unsigned int size; 42 + int reserved; 43 + char value[256]; 44 + }; 45 + 46 + #define SYS_OPEN 2 47 + #define SYS_OPENAT 257 48 + 49 + SEC("raw_syscalls:sys_enter") 50 + int sys_enter(struct syscall_enter_args *args) 51 + { 52 + struct { 53 + struct syscall_enter_args args; 54 + struct augmented_filename filename; 55 + } augmented_args; 56 + unsigned int len = sizeof(augmented_args); 57 + const void *filename_arg = NULL; 58 + 59 + probe_read(&augmented_args.args, sizeof(augmented_args.args), args); 60 + /* 61 + * Yonghong and Edward Cree sayz: 62 + * 63 + * https://www.spinics.net/lists/netdev/msg531645.html 64 + * 65 + * >> R0=inv(id=0) R1=inv2 R6=ctx(id=0,off=0,imm=0) R7=inv64 R10=fp0,call_-1 66 + * >> 10: (bf) r1 = r6 67 + * >> 11: (07) r1 += 16 68 + * >> 12: (05) goto pc+2 69 + * >> 15: (79) r3 = *(u64 *)(r1 +0) 70 + * >> dereference of modified ctx ptr R1 off=16 disallowed 71 + * > Aha, we at least got a different error message this time. 72 + * > And indeed llvm has done that optimisation, rather than the more obvious 73 + * > 11: r3 = *(u64 *)(r1 +16) 74 + * > because it wants to have lots of reads share a single insn. You may be able 75 + * > to defeat that optimisation by adding compiler barriers, idk. Maybe someone 76 + * > with llvm knowledge can figure out how to stop it (ideally, llvm would know 77 + * > when it's generating for bpf backend and not do that). -O0? ¯\_(ツ)_/¯ 78 + * 79 + * The optimization mostly likes below: 80 + * 81 + * br1: 82 + * ... 83 + * r1 += 16 84 + * goto merge 85 + * br2: 86 + * ... 87 + * r1 += 20 88 + * goto merge 89 + * merge: 90 + * *(u64 *)(r1 + 0) 91 + * 92 + * The compiler tries to merge common loads. There is no easy way to 93 + * stop this compiler optimization without turning off a lot of other 94 + * optimizations. The easiest way is to add barriers: 95 + * 96 + * __asm__ __volatile__("": : :"memory") 97 + * 98 + * after the ctx memory access to prevent their down stream merging. 99 + */ 100 + switch (augmented_args.args.syscall_nr) { 101 + case SYS_OPEN: filename_arg = (const void *)args->args[0]; 102 + __asm__ __volatile__("": : :"memory"); 103 + break; 104 + case SYS_OPENAT: filename_arg = (const void *)args->args[1]; 105 + break; 106 + } 107 + 108 + if (filename_arg != NULL) { 109 + augmented_args.filename.reserved = 0; 110 + augmented_args.filename.size = probe_read_str(&augmented_args.filename.value, 111 + sizeof(augmented_args.filename.value), 112 + filename_arg); 113 + if (augmented_args.filename.size < sizeof(augmented_args.filename.value)) { 114 + len -= sizeof(augmented_args.filename.value) - augmented_args.filename.size; 115 + len &= sizeof(augmented_args.filename.value) - 1; 116 + } 117 + } else { 118 + len = sizeof(augmented_args.args); 119 + } 120 + 121 + perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, &augmented_args, len); 122 + return 0; 123 + } 124 + 125 + SEC("raw_syscalls:sys_exit") 126 + int sys_exit(struct syscall_exit_args *args) 127 + { 128 + return 1; /* 0 as soon as we start copying data returned by the kernel, e.g. 'read' */ 129 + } 130 + 131 + license(GPL);
+38 -11
tools/perf/jvmti/jvmti_agent.c
··· 125 125 } 126 126 127 127 static int 128 - debug_cache_init(void) 128 + create_jit_cache_dir(void) 129 129 { 130 130 char str[32]; 131 131 char *base, *p; ··· 144 144 145 145 strftime(str, sizeof(str), JIT_LANG"-jit-%Y%m%d", &tm); 146 146 147 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/", base); 148 - 147 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/", base); 148 + if (ret >= PATH_MAX) { 149 + warnx("jvmti: cannot generate jit cache dir because %s/.debug/" 150 + " is too long, please check the cwd, JITDUMPDIR, and" 151 + " HOME variables", base); 152 + return -1; 153 + } 149 154 ret = mkdir(jit_path, 0755); 150 155 if (ret == -1) { 151 156 if (errno != EEXIST) { ··· 159 154 } 160 155 } 161 156 162 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit", base); 157 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit", base); 158 + if (ret >= PATH_MAX) { 159 + warnx("jvmti: cannot generate jit cache dir because" 160 + " %s/.debug/jit is too long, please check the cwd," 161 + " JITDUMPDIR, and HOME variables", base); 162 + return -1; 163 + } 163 164 ret = mkdir(jit_path, 0755); 164 165 if (ret == -1) { 165 166 if (errno != EEXIST) { 166 - warn("cannot create jit cache dir %s", jit_path); 167 + warn("jvmti: cannot create jit cache dir %s", jit_path); 167 168 return -1; 168 169 } 169 170 } 170 171 171 - snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit/%s.XXXXXXXX", base, str); 172 - 172 + ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit/%s.XXXXXXXX", base, str); 173 + if (ret >= PATH_MAX) { 174 + warnx("jvmti: cannot generate jit cache dir because" 175 + " %s/.debug/jit/%s.XXXXXXXX is too long, please check" 176 + " the cwd, JITDUMPDIR, and HOME variables", 177 + base, str); 178 + return -1; 179 + } 173 180 p = mkdtemp(jit_path); 174 181 if (p != jit_path) { 175 - warn("cannot create jit cache dir %s", jit_path); 182 + warn("jvmti: cannot create jit cache dir %s", jit_path); 176 183 return -1; 177 184 } 178 185 ··· 245 228 { 246 229 char dump_path[PATH_MAX]; 247 230 struct jitheader header; 248 - int fd; 231 + int fd, ret; 249 232 FILE *fp; 250 233 251 234 init_arch_timestamp(); ··· 262 245 263 246 memset(&header, 0, sizeof(header)); 264 247 265 - debug_cache_init(); 248 + /* 249 + * jitdump file dir 250 + */ 251 + if (create_jit_cache_dir() < 0) 252 + return NULL; 266 253 267 254 /* 268 255 * jitdump file name 269 256 */ 270 - scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); 257 + ret = snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); 258 + if (ret >= PATH_MAX) { 259 + warnx("jvmti: cannot generate jitdump file full path because" 260 + " %s/jit-%i.dump is too long, please check the cwd," 261 + " JITDUMPDIR, and HOME variables", jit_path, getpid()); 262 + return NULL; 263 + } 271 264 272 265 fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); 273 266 if (fd == -1)
+490 -3
tools/perf/scripts/python/exported-sql-viewer.py
··· 119 119 return "[kernel]" 120 120 return name 121 121 122 + def findnth(s, sub, n, offs=0): 123 + pos = s.find(sub) 124 + if pos < 0: 125 + return pos 126 + if n <= 1: 127 + return offs + pos 128 + return findnth(s[pos + 1:], sub, n - 1, offs + pos + 1) 129 + 122 130 # Percent to one decimal place 123 131 124 132 def PercentToOneDP(n, d): ··· 1472 1464 else: 1473 1465 self.find_bar.NotFound() 1474 1466 1467 + # Dialog data item converted and validated using a SQL table 1468 + 1469 + class SQLTableDialogDataItem(): 1470 + 1471 + def __init__(self, glb, label, placeholder_text, table_name, match_column, column_name1, column_name2, parent): 1472 + self.glb = glb 1473 + self.label = label 1474 + self.placeholder_text = placeholder_text 1475 + self.table_name = table_name 1476 + self.match_column = match_column 1477 + self.column_name1 = column_name1 1478 + self.column_name2 = column_name2 1479 + self.parent = parent 1480 + 1481 + self.value = "" 1482 + 1483 + self.widget = QLineEdit() 1484 + self.widget.editingFinished.connect(self.Validate) 1485 + self.widget.textChanged.connect(self.Invalidate) 1486 + self.red = False 1487 + self.error = "" 1488 + self.validated = True 1489 + 1490 + self.last_id = 0 1491 + self.first_time = 0 1492 + self.last_time = 2 ** 64 1493 + if self.table_name == "<timeranges>": 1494 + query = QSqlQuery(self.glb.db) 1495 + QueryExec(query, "SELECT id, time FROM samples ORDER BY id DESC LIMIT 1") 1496 + if query.next(): 1497 + self.last_id = int(query.value(0)) 1498 + self.last_time = int(query.value(1)) 1499 + QueryExec(query, "SELECT time FROM samples WHERE time != 0 ORDER BY id LIMIT 1") 1500 + if query.next(): 1501 + self.first_time = int(query.value(0)) 1502 + if placeholder_text: 1503 + placeholder_text += ", between " + str(self.first_time) + " and " + str(self.last_time) 1504 + 1505 + if placeholder_text: 1506 + self.widget.setPlaceholderText(placeholder_text) 1507 + 1508 + def ValueToIds(self, value): 1509 + ids = [] 1510 + query = QSqlQuery(self.glb.db) 1511 + stmt = "SELECT id FROM " + self.table_name + " WHERE " + self.match_column + " = '" + value + "'" 1512 + ret = query.exec_(stmt) 1513 + if ret: 1514 + while query.next(): 1515 + ids.append(str(query.value(0))) 1516 + return ids 1517 + 1518 + def IdBetween(self, query, lower_id, higher_id, order): 1519 + QueryExec(query, "SELECT id FROM samples WHERE id > " + str(lower_id) + " AND id < " + str(higher_id) + " ORDER BY id " + order + " LIMIT 1") 1520 + if query.next(): 1521 + return True, int(query.value(0)) 1522 + else: 1523 + return False, 0 1524 + 1525 + def BinarySearchTime(self, lower_id, higher_id, target_time, get_floor): 1526 + query = QSqlQuery(self.glb.db) 1527 + while True: 1528 + next_id = int((lower_id + higher_id) / 2) 1529 + QueryExec(query, "SELECT time FROM samples WHERE id = " + str(next_id)) 1530 + if not query.next(): 1531 + ok, dbid = self.IdBetween(query, lower_id, next_id, "DESC") 1532 + if not ok: 1533 + ok, dbid = self.IdBetween(query, next_id, higher_id, "") 1534 + if not ok: 1535 + return str(higher_id) 1536 + next_id = dbid 1537 + QueryExec(query, "SELECT time FROM samples WHERE id = " + str(next_id)) 1538 + next_time = int(query.value(0)) 1539 + if get_floor: 1540 + if target_time > next_time: 1541 + lower_id = next_id 1542 + else: 1543 + higher_id = next_id 1544 + if higher_id <= lower_id + 1: 1545 + return str(higher_id) 1546 + else: 1547 + if target_time >= next_time: 1548 + lower_id = next_id 1549 + else: 1550 + higher_id = next_id 1551 + if higher_id <= lower_id + 1: 1552 + return str(lower_id) 1553 + 1554 + def ConvertRelativeTime(self, val): 1555 + print "val ", val 1556 + mult = 1 1557 + suffix = val[-2:] 1558 + if suffix == "ms": 1559 + mult = 1000000 1560 + elif suffix == "us": 1561 + mult = 1000 1562 + elif suffix == "ns": 1563 + mult = 1 1564 + else: 1565 + return val 1566 + val = val[:-2].strip() 1567 + if not self.IsNumber(val): 1568 + return val 1569 + val = int(val) * mult 1570 + if val >= 0: 1571 + val += self.first_time 1572 + else: 1573 + val += self.last_time 1574 + return str(val) 1575 + 1576 + def ConvertTimeRange(self, vrange): 1577 + print "vrange ", vrange 1578 + if vrange[0] == "": 1579 + vrange[0] = str(self.first_time) 1580 + if vrange[1] == "": 1581 + vrange[1] = str(self.last_time) 1582 + vrange[0] = self.ConvertRelativeTime(vrange[0]) 1583 + vrange[1] = self.ConvertRelativeTime(vrange[1]) 1584 + print "vrange2 ", vrange 1585 + if not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]): 1586 + return False 1587 + print "ok1" 1588 + beg_range = max(int(vrange[0]), self.first_time) 1589 + end_range = min(int(vrange[1]), self.last_time) 1590 + if beg_range > self.last_time or end_range < self.first_time: 1591 + return False 1592 + print "ok2" 1593 + vrange[0] = self.BinarySearchTime(0, self.last_id, beg_range, True) 1594 + vrange[1] = self.BinarySearchTime(1, self.last_id + 1, end_range, False) 1595 + print "vrange3 ", vrange 1596 + return True 1597 + 1598 + def AddTimeRange(self, value, ranges): 1599 + print "value ", value 1600 + n = value.count("-") 1601 + if n == 1: 1602 + pass 1603 + elif n == 2: 1604 + if value.split("-")[1].strip() == "": 1605 + n = 1 1606 + elif n == 3: 1607 + n = 2 1608 + else: 1609 + return False 1610 + pos = findnth(value, "-", n) 1611 + vrange = [value[:pos].strip() ,value[pos+1:].strip()] 1612 + if self.ConvertTimeRange(vrange): 1613 + ranges.append(vrange) 1614 + return True 1615 + return False 1616 + 1617 + def InvalidValue(self, value): 1618 + self.value = "" 1619 + palette = QPalette() 1620 + palette.setColor(QPalette.Text,Qt.red) 1621 + self.widget.setPalette(palette) 1622 + self.red = True 1623 + self.error = self.label + " invalid value '" + value + "'" 1624 + self.parent.ShowMessage(self.error) 1625 + 1626 + def IsNumber(self, value): 1627 + try: 1628 + x = int(value) 1629 + except: 1630 + x = 0 1631 + return str(x) == value 1632 + 1633 + def Invalidate(self): 1634 + self.validated = False 1635 + 1636 + def Validate(self): 1637 + input_string = self.widget.text() 1638 + self.validated = True 1639 + if self.red: 1640 + palette = QPalette() 1641 + self.widget.setPalette(palette) 1642 + self.red = False 1643 + if not len(input_string.strip()): 1644 + self.error = "" 1645 + self.value = "" 1646 + return 1647 + if self.table_name == "<timeranges>": 1648 + ranges = [] 1649 + for value in [x.strip() for x in input_string.split(",")]: 1650 + if not self.AddTimeRange(value, ranges): 1651 + return self.InvalidValue(value) 1652 + ranges = [("(" + self.column_name1 + " >= " + r[0] + " AND " + self.column_name1 + " <= " + r[1] + ")") for r in ranges] 1653 + self.value = " OR ".join(ranges) 1654 + elif self.table_name == "<ranges>": 1655 + singles = [] 1656 + ranges = [] 1657 + for value in [x.strip() for x in input_string.split(",")]: 1658 + if "-" in value: 1659 + vrange = value.split("-") 1660 + if len(vrange) != 2 or not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]): 1661 + return self.InvalidValue(value) 1662 + ranges.append(vrange) 1663 + else: 1664 + if not self.IsNumber(value): 1665 + return self.InvalidValue(value) 1666 + singles.append(value) 1667 + ranges = [("(" + self.column_name1 + " >= " + r[0] + " AND " + self.column_name1 + " <= " + r[1] + ")") for r in ranges] 1668 + if len(singles): 1669 + ranges.append(self.column_name1 + " IN (" + ",".join(singles) + ")") 1670 + self.value = " OR ".join(ranges) 1671 + elif self.table_name: 1672 + all_ids = [] 1673 + for value in [x.strip() for x in input_string.split(",")]: 1674 + ids = self.ValueToIds(value) 1675 + if len(ids): 1676 + all_ids.extend(ids) 1677 + else: 1678 + return self.InvalidValue(value) 1679 + self.value = self.column_name1 + " IN (" + ",".join(all_ids) + ")" 1680 + if self.column_name2: 1681 + self.value = "( " + self.value + " OR " + self.column_name2 + " IN (" + ",".join(all_ids) + ") )" 1682 + else: 1683 + self.value = input_string.strip() 1684 + self.error = "" 1685 + self.parent.ClearMessage() 1686 + 1687 + def IsValid(self): 1688 + if not self.validated: 1689 + self.Validate() 1690 + if len(self.error): 1691 + self.parent.ShowMessage(self.error) 1692 + return False 1693 + return True 1694 + 1695 + # Selected branch report creation dialog 1696 + 1697 + class SelectedBranchDialog(QDialog): 1698 + 1699 + def __init__(self, glb, parent=None): 1700 + super(SelectedBranchDialog, self).__init__(parent) 1701 + 1702 + self.glb = glb 1703 + 1704 + self.name = "" 1705 + self.where_clause = "" 1706 + 1707 + self.setWindowTitle("Selected Branches") 1708 + self.setMinimumWidth(600) 1709 + 1710 + items = ( 1711 + ("Report name:", "Enter a name to appear in the window title bar", "", "", "", ""), 1712 + ("Time ranges:", "Enter time ranges", "<timeranges>", "", "samples.id", ""), 1713 + ("CPUs:", "Enter CPUs or ranges e.g. 0,5-6", "<ranges>", "", "cpu", ""), 1714 + ("Commands:", "Only branches with these commands will be included", "comms", "comm", "comm_id", ""), 1715 + ("PIDs:", "Only branches with these process IDs will be included", "threads", "pid", "thread_id", ""), 1716 + ("TIDs:", "Only branches with these thread IDs will be included", "threads", "tid", "thread_id", ""), 1717 + ("DSOs:", "Only branches with these DSOs will be included", "dsos", "short_name", "samples.dso_id", "to_dso_id"), 1718 + ("Symbols:", "Only branches with these symbols will be included", "symbols", "name", "symbol_id", "to_symbol_id"), 1719 + ("Raw SQL clause: ", "Enter a raw SQL WHERE clause", "", "", "", ""), 1720 + ) 1721 + self.data_items = [SQLTableDialogDataItem(glb, *x, parent=self) for x in items] 1722 + 1723 + self.grid = QGridLayout() 1724 + 1725 + for row in xrange(len(self.data_items)): 1726 + self.grid.addWidget(QLabel(self.data_items[row].label), row, 0) 1727 + self.grid.addWidget(self.data_items[row].widget, row, 1) 1728 + 1729 + self.status = QLabel() 1730 + 1731 + self.ok_button = QPushButton("Ok", self) 1732 + self.ok_button.setDefault(True) 1733 + self.ok_button.released.connect(self.Ok) 1734 + self.ok_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) 1735 + 1736 + self.cancel_button = QPushButton("Cancel", self) 1737 + self.cancel_button.released.connect(self.reject) 1738 + self.cancel_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) 1739 + 1740 + self.hbox = QHBoxLayout() 1741 + #self.hbox.addStretch() 1742 + self.hbox.addWidget(self.status) 1743 + self.hbox.addWidget(self.ok_button) 1744 + self.hbox.addWidget(self.cancel_button) 1745 + 1746 + self.vbox = QVBoxLayout() 1747 + self.vbox.addLayout(self.grid) 1748 + self.vbox.addLayout(self.hbox) 1749 + 1750 + self.setLayout(self.vbox); 1751 + 1752 + def Ok(self): 1753 + self.name = self.data_items[0].value 1754 + if not self.name: 1755 + self.ShowMessage("Report name is required") 1756 + return 1757 + for d in self.data_items: 1758 + if not d.IsValid(): 1759 + return 1760 + for d in self.data_items[1:]: 1761 + if len(d.value): 1762 + if len(self.where_clause): 1763 + self.where_clause += " AND " 1764 + self.where_clause += d.value 1765 + if len(self.where_clause): 1766 + self.where_clause = " AND ( " + self.where_clause + " ) " 1767 + else: 1768 + self.ShowMessage("No selection") 1769 + return 1770 + self.accept() 1771 + 1772 + def ShowMessage(self, msg): 1773 + self.status.setText("<font color=#FF0000>" + msg) 1774 + 1775 + def ClearMessage(self): 1776 + self.status.setText("") 1777 + 1475 1778 # Event list 1476 1779 1477 1780 def GetEventList(db): ··· 1975 1656 def FindDone(self, row): 1976 1657 self.find_bar.Idle() 1977 1658 if row >= 0: 1978 - self.view.setCurrentIndex(self.model.index(row, 0, QModelIndex())) 1659 + self.view.setCurrentIndex(self.model.mapFromSource(self.data_model.index(row, 0, QModelIndex()))) 1979 1660 else: 1980 1661 self.find_bar.NotFound() 1981 1662 ··· 2084 1765 def setActiveSubWindow(self, nr): 2085 1766 self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1]) 2086 1767 1768 + # Help text 1769 + 1770 + glb_help_text = """ 1771 + <h1>Contents</h1> 1772 + <style> 1773 + p.c1 { 1774 + text-indent: 40px; 1775 + } 1776 + p.c2 { 1777 + text-indent: 80px; 1778 + } 1779 + } 1780 + </style> 1781 + <p class=c1><a href=#reports>1. Reports</a></p> 1782 + <p class=c2><a href=#callgraph>1.1 Context-Sensitive Call Graph</a></p> 1783 + <p class=c2><a href=#allbranches>1.2 All branches</a></p> 1784 + <p class=c2><a href=#selectedbranches>1.3 Selected branches</a></p> 1785 + <p class=c1><a href=#tables>2. Tables</a></p> 1786 + <h1 id=reports>1. Reports</h1> 1787 + <h2 id=callgraph>1.1 Context-Sensitive Call Graph</h2> 1788 + The result is a GUI window with a tree representing a context-sensitive 1789 + call-graph. Expanding a couple of levels of the tree and adjusting column 1790 + widths to suit will display something like: 1791 + <pre> 1792 + Call Graph: pt_example 1793 + Call Path Object Count Time(ns) Time(%) Branch Count Branch Count(%) 1794 + v- ls 1795 + v- 2638:2638 1796 + v- _start ld-2.19.so 1 10074071 100.0 211135 100.0 1797 + |- unknown unknown 1 13198 0.1 1 0.0 1798 + >- _dl_start ld-2.19.so 1 1400980 13.9 19637 9.3 1799 + >- _d_linit_internal ld-2.19.so 1 448152 4.4 11094 5.3 1800 + v-__libc_start_main@plt ls 1 8211741 81.5 180397 85.4 1801 + >- _dl_fixup ld-2.19.so 1 7607 0.1 108 0.1 1802 + >- __cxa_atexit libc-2.19.so 1 11737 0.1 10 0.0 1803 + >- __libc_csu_init ls 1 10354 0.1 10 0.0 1804 + |- _setjmp libc-2.19.so 1 0 0.0 4 0.0 1805 + v- main ls 1 8182043 99.6 180254 99.9 1806 + </pre> 1807 + <h3>Points to note:</h3> 1808 + <ul> 1809 + <li>The top level is a command name (comm)</li> 1810 + <li>The next level is a thread (pid:tid)</li> 1811 + <li>Subsequent levels are functions</li> 1812 + <li>'Count' is the number of calls</li> 1813 + <li>'Time' is the elapsed time until the function returns</li> 1814 + <li>Percentages are relative to the level above</li> 1815 + <li>'Branch Count' is the total number of branches for that function and all functions that it calls 1816 + </ul> 1817 + <h3>Find</h3> 1818 + Ctrl-F displays a Find bar which finds function names by either an exact match or a pattern match. 1819 + The pattern matching symbols are ? for any character and * for zero or more characters. 1820 + <h2 id=allbranches>1.2 All branches</h2> 1821 + The All branches report displays all branches in chronological order. 1822 + Not all data is fetched immediately. More records can be fetched using the Fetch bar provided. 1823 + <h3>Disassembly</h3> 1824 + Open a branch to display disassembly. This only works if: 1825 + <ol> 1826 + <li>The disassembler is available. Currently, only Intel XED is supported - see <a href=#xed>Intel XED Setup</a></li> 1827 + <li>The object code is available. Currently, only the perf build ID cache is searched for object code. 1828 + The default directory ~/.debug can be overridden by setting environment variable PERF_BUILDID_DIR. 1829 + One exception is kcore where the DSO long name is used (refer dsos_view on the Tables menu), 1830 + or alternatively, set environment variable PERF_KCORE to the kcore file name.</li> 1831 + </ol> 1832 + <h4 id=xed>Intel XED Setup</h4> 1833 + To use Intel XED, libxed.so must be present. To build and install libxed.so: 1834 + <pre> 1835 + git clone https://github.com/intelxed/mbuild.git mbuild 1836 + git clone https://github.com/intelxed/xed 1837 + cd xed 1838 + ./mfile.py --share 1839 + sudo ./mfile.py --prefix=/usr/local install 1840 + sudo ldconfig 1841 + </pre> 1842 + <h3>Find</h3> 1843 + Ctrl-F displays a Find bar which finds substrings by either an exact match or a regular expression match. 1844 + Refer to Python documentation for the regular expression syntax. 1845 + All columns are searched, but only currently fetched rows are searched. 1846 + <h2 id=selectedbranches>1.3 Selected branches</h2> 1847 + This is the same as the <a href=#allbranches>All branches</a> report but with the data reduced 1848 + by various selection criteria. A dialog box displays available criteria which are AND'ed together. 1849 + <h3>1.3.1 Time ranges</h3> 1850 + The time ranges hint text shows the total time range. Relative time ranges can also be entered in 1851 + ms, us or ns. Also, negative values are relative to the end of trace. Examples: 1852 + <pre> 1853 + 81073085947329-81073085958238 From 81073085947329 to 81073085958238 1854 + 100us-200us From 100us to 200us 1855 + 10ms- From 10ms to the end 1856 + -100ns The first 100ns 1857 + -10ms- The last 10ms 1858 + </pre> 1859 + N.B. Due to the granularity of timestamps, there could be no branches in any given time range. 1860 + <h1 id=tables>2. Tables</h1> 1861 + The Tables menu shows all tables and views in the database. Most tables have an associated view 1862 + which displays the information in a more friendly way. Not all data for large tables is fetched 1863 + immediately. More records can be fetched using the Fetch bar provided. Columns can be sorted, 1864 + but that can be slow for large tables. 1865 + <p>There are also tables of database meta-information. 1866 + For SQLite3 databases, the sqlite_master table is included. 1867 + For PostgreSQL databases, information_schema.tables/views/columns are included. 1868 + <h3>Find</h3> 1869 + Ctrl-F displays a Find bar which finds substrings by either an exact match or a regular expression match. 1870 + Refer to Python documentation for the regular expression syntax. 1871 + All columns are searched, but only currently fetched rows are searched. 1872 + <p>N.B. Results are found in id order, so if the table is re-ordered, find-next and find-previous 1873 + will go to the next/previous result in id order, instead of display order. 1874 + """ 1875 + 1876 + # Help window 1877 + 1878 + class HelpWindow(QMdiSubWindow): 1879 + 1880 + def __init__(self, glb, parent=None): 1881 + super(HelpWindow, self).__init__(parent) 1882 + 1883 + self.text = QTextBrowser() 1884 + self.text.setHtml(glb_help_text) 1885 + self.text.setReadOnly(True) 1886 + self.text.setOpenExternalLinks(True) 1887 + 1888 + self.setWidget(self.text) 1889 + 1890 + AddSubWindow(glb.mainwindow.mdi_area, self, "Exported SQL Viewer Help") 1891 + 1892 + # Main window that only displays the help text 1893 + 1894 + class HelpOnlyWindow(QMainWindow): 1895 + 1896 + def __init__(self, parent=None): 1897 + super(HelpOnlyWindow, self).__init__(parent) 1898 + 1899 + self.setMinimumSize(200, 100) 1900 + self.resize(800, 600) 1901 + self.setWindowTitle("Exported SQL Viewer Help") 1902 + self.setWindowIcon(self.style().standardIcon(QStyle.SP_MessageBoxInformation)) 1903 + 1904 + self.text = QTextBrowser() 1905 + self.text.setHtml(glb_help_text) 1906 + self.text.setReadOnly(True) 1907 + self.text.setOpenExternalLinks(True) 1908 + 1909 + self.setCentralWidget(self.text) 1910 + 2087 1911 # Font resize 2088 1912 2089 1913 def ResizeFont(widget, diff): ··· 2313 1851 2314 1852 self.window_menu = WindowMenu(self.mdi_area, menu) 2315 1853 1854 + help_menu = menu.addMenu("&Help") 1855 + help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents)) 1856 + 2316 1857 def Find(self): 2317 1858 win = self.mdi_area.activeSubWindow() 2318 1859 if win: ··· 2353 1888 if event == "branches": 2354 1889 label = "All branches" if branches_events == 1 else "All branches " + "(id=" + dbid + ")" 2355 1890 reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewBranchView(x), self)) 1891 + label = "Selected branches" if branches_events == 1 else "Selected branches " + "(id=" + dbid + ")" 1892 + reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewSelectedBranchView(x), self)) 2356 1893 2357 1894 def TableMenu(self, tables, menu): 2358 1895 table_menu = menu.addMenu("&Tables") ··· 2367 1900 def NewBranchView(self, event_id): 2368 1901 BranchWindow(self.glb, event_id, "", "", self) 2369 1902 1903 + def NewSelectedBranchView(self, event_id): 1904 + dialog = SelectedBranchDialog(self.glb, self) 1905 + ret = dialog.exec_() 1906 + if ret: 1907 + BranchWindow(self.glb, event_id, dialog.name, dialog.where_clause, self) 1908 + 2370 1909 def NewTableView(self, table_name): 2371 1910 TableWindow(self.glb, table_name, self) 1911 + 1912 + def Help(self): 1913 + HelpWindow(self.glb, self) 2372 1914 2373 1915 # XED Disassembler 2374 1916 ··· 2405 1929 class LibXED(): 2406 1930 2407 1931 def __init__(self): 2408 - self.libxed = CDLL("libxed.so") 1932 + try: 1933 + self.libxed = CDLL("libxed.so") 1934 + except: 1935 + self.libxed = None 1936 + if not self.libxed: 1937 + self.libxed = CDLL("/usr/local/lib/libxed.so") 2409 1938 2410 1939 self.xed_tables_init = self.libxed.xed_tables_init 2411 1940 self.xed_tables_init.restype = None ··· 2578 2097 2579 2098 def Main(): 2580 2099 if (len(sys.argv) < 2): 2581 - print >> sys.stderr, "Usage is: exported-sql-viewer.py <database name>" 2100 + print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}" 2582 2101 raise Exception("Too few arguments") 2583 2102 2584 2103 dbname = sys.argv[1] 2104 + if dbname == "--help-only": 2105 + app = QApplication(sys.argv) 2106 + mainwindow = HelpOnlyWindow() 2107 + mainwindow.show() 2108 + err = app.exec_() 2109 + sys.exit(err) 2585 2110 2586 2111 is_sqlite3 = False 2587 2112 try:
-1
tools/perf/tests/attr/test-record-group-sampling
··· 37 37 sample_period=0 38 38 freq=0 39 39 write_backward=0 40 - sample_id_all=0
+27
tools/perf/util/evlist.c
··· 1810 1810 leader->forced_leader = true; 1811 1811 } 1812 1812 } 1813 + 1814 + struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evsel_list, 1815 + struct perf_evsel *evsel) 1816 + { 1817 + struct perf_evsel *c2, *leader; 1818 + bool is_open = true; 1819 + 1820 + leader = evsel->leader; 1821 + pr_debug("Weak group for %s/%d failed\n", 1822 + leader->name, leader->nr_members); 1823 + 1824 + /* 1825 + * for_each_group_member doesn't work here because it doesn't 1826 + * include the first entry. 1827 + */ 1828 + evlist__for_each_entry(evsel_list, c2) { 1829 + if (c2 == evsel) 1830 + is_open = false; 1831 + if (c2->leader == leader) { 1832 + if (is_open) 1833 + perf_evsel__close(c2); 1834 + c2->leader = c2; 1835 + c2->nr_members = 0; 1836 + } 1837 + } 1838 + return leader; 1839 + }
+3
tools/perf/util/evlist.h
··· 312 312 313 313 void perf_evlist__force_leader(struct perf_evlist *evlist); 314 314 315 + struct perf_evsel *perf_evlist__reset_weak_group(struct perf_evlist *evlist, 316 + struct perf_evsel *evsel); 317 + 315 318 #endif /* __PERF_EVLIST_H */
-1
tools/perf/util/evsel.c
··· 956 956 attr->sample_freq = 0; 957 957 attr->sample_period = 0; 958 958 attr->write_backward = 0; 959 - attr->sample_id_all = 0; 960 959 } 961 960 962 961 if (opts->no_samples)
+4
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
··· 1474 1474 decoder->have_calc_cyc_to_tsc = false; 1475 1475 intel_pt_calc_cyc_to_tsc(decoder, true); 1476 1476 } 1477 + 1478 + intel_pt_log_to("Setting timestamp", decoder->timestamp); 1477 1479 } 1478 1480 1479 1481 static void intel_pt_calc_cbr(struct intel_pt_decoder *decoder) ··· 1516 1514 decoder->timestamp = timestamp; 1517 1515 1518 1516 decoder->timestamp_insn_cnt = 0; 1517 + 1518 + intel_pt_log_to("Setting timestamp", decoder->timestamp); 1519 1519 } 1520 1520 1521 1521 /* Walk PSB+ packets when already in sync. */
+5
tools/perf/util/intel-pt-decoder/intel-pt-log.c
··· 31 31 static char log_name[MAX_LOG_NAME]; 32 32 bool intel_pt_enable_logging; 33 33 34 + void *intel_pt_log_fp(void) 35 + { 36 + return f; 37 + } 38 + 34 39 void intel_pt_log_enable(void) 35 40 { 36 41 intel_pt_enable_logging = true;
+1
tools/perf/util/intel-pt-decoder/intel-pt-log.h
··· 22 22 23 23 struct intel_pt_pkt; 24 24 25 + void *intel_pt_log_fp(void); 25 26 void intel_pt_log_enable(void); 26 27 void intel_pt_log_disable(void); 27 28 void intel_pt_log_set_name(const char *name);
+13 -3
tools/perf/util/intel-pt.c
··· 206 206 intel_pt_dump(pt, buf, len); 207 207 } 208 208 209 + static void intel_pt_log_event(union perf_event *event) 210 + { 211 + FILE *f = intel_pt_log_fp(); 212 + 213 + if (!intel_pt_enable_logging || !f) 214 + return; 215 + 216 + perf_event__fprintf(event, f); 217 + } 218 + 209 219 static int intel_pt_do_fix_overlap(struct intel_pt *pt, struct auxtrace_buffer *a, 210 220 struct auxtrace_buffer *b) 211 221 { ··· 2020 2010 event->header.type == PERF_RECORD_SWITCH_CPU_WIDE) 2021 2011 err = intel_pt_context_switch(pt, event, sample); 2022 2012 2023 - intel_pt_log("event %s (%u): cpu %d time %"PRIu64" tsc %#"PRIx64"\n", 2024 - perf_event__name(event->header.type), event->header.type, 2025 - sample->cpu, sample->time, timestamp); 2013 + intel_pt_log("event %u: cpu %d time %"PRIu64" tsc %#"PRIx64" ", 2014 + event->header.type, sample->cpu, sample->time, timestamp); 2015 + intel_pt_log_event(event); 2026 2016 2027 2017 return err; 2028 2018 }
+1 -1
tools/perf/util/pmu.c
··· 773 773 774 774 if (!is_arm_pmu_core(name)) { 775 775 pname = pe->pmu ? pe->pmu : "cpu"; 776 - if (strncmp(pname, name, strlen(pname))) 776 + if (strcmp(pname, name)) 777 777 continue; 778 778 } 779 779