Minor overlapping changes in the conflicts. In the macsec case, the change of the default ID macro name overlapped with the 64-bit netlink attribute alignment fixes in net-next.
Unified · Split
| @@ -192,7 +192,6 @@ nodes to be present and contain the properties described below. · 191 unmodified lines | |||
| 192 | can be one of: | 192 | can be one of: |
| 193 | "allwinner,sun6i-a31" | 193 | "allwinner,sun6i-a31" |
| 194 | "allwinner,sun8i-a23" | 194 | "allwinner,sun8i-a23" |
| 195 | "arm,psci" | ||
| 196 | "arm,realview-smp" | 195 | "arm,realview-smp" |
| 197 | "brcm,bcm-nsp-smp" | 196 | "brcm,bcm-nsp-smp" |
| 198 | "brcm,brahma-b15" | 197 | "brcm,brahma-b15" |
| @@ -8,15 +8,19 @@ Required properties: · 7 unmodified lines | |||
| 8 | of memory mapped region. | 8 | of memory mapped region. |
| 9 | - clock-names: from common clock binding: | 9 | - clock-names: from common clock binding: |
| 10 | Required elements: "24m" | 10 | Required elements: "24m" |
| 11 | - rockchip,grf: phandle to the syscon managing the "general register files" | ||
| 12 | - #phy-cells : from the generic PHY bindings, must be 0; | 11 | - #phy-cells : from the generic PHY bindings, must be 0; |
| 13 | 12 | ||
| 14 | Example: | 13 | Example: |
| 15 | 14 | ||
| 16 | edp_phy: edp-phy { | 15 | grf: syscon@ff770000 { |
| 17 | compatible = "rockchip,rk3288-dp-phy"; | 16 | compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd"; |
| 18 | rockchip,grf = <&grf>; | 17 | |
| 19 | clocks = <&cru SCLK_EDP_24M>; | 18 | ... |
| 20 | clock-names = "24m"; | 19 | |
| 21 | #phy-cells = <0>; | 20 | edp_phy: edp-phy { |
| 21 | compatible = "rockchip,rk3288-dp-phy"; | ||
| 22 | clocks = <&cru SCLK_EDP_24M>; | ||
| 23 | clock-names = "24m"; | ||
| 24 | #phy-cells = <0>; | ||
| 25 | }; | ||
| 22 | }; | 26 | }; |
| @@ -3,17 +3,23 @@ Rockchip EMMC PHY · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | Required properties: | 4 | Required properties: |
| 5 | - compatible: rockchip,rk3399-emmc-phy | 5 | - compatible: rockchip,rk3399-emmc-phy |
| 6 | - rockchip,grf : phandle to the syscon managing the "general | ||
| 7 | register files" | ||
| 8 | - #phy-cells: must be 0 | 6 | - #phy-cells: must be 0 |
| 9 | - reg: PHY configure reg address offset in "general | 7 | - reg: PHY register address offset and length in "general |
| 10 | register files" | 8 | register files" |
| 11 | 9 | ||
| 12 | Example: | 10 | Example: |
| 13 | 11 | ||
| 14 | emmcphy: phy { | 12 | |
| 15 | compatible = "rockchip,rk3399-emmc-phy"; | 13 | grf: syscon@ff770000 { |
| 16 | rockchip,grf = <&grf>; | 14 | compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; |
| 17 | reg = <0xf780>; | 15 | #address-cells = <1>; |
| 18 | #phy-cells = <0>; | 16 | #size-cells = <1>; |
| 17 | |||
| 18 | ... | ||
| 19 | |||
| 20 | emmcphy: phy@f780 { | ||
| 21 | compatible = "rockchip,rk3399-emmc-phy"; | ||
| 22 | reg = <0xf780 0x20>; | ||
| 23 | #phy-cells = <0>; | ||
| 24 | }; | ||
| 19 | }; | 25 | }; |
| @@ -173,6 +173,10 @@ A few EV_ABS codes have special meanings: · 172 unmodified lines | |||
| 173 | proximity of the device and while the value of the BTN_TOUCH code is 0. If | 173 | proximity of the device and while the value of the BTN_TOUCH code is 0. If |
| 174 | the input device may be used freely in three dimensions, consider ABS_Z | 174 | the input device may be used freely in three dimensions, consider ABS_Z |
| 175 | instead. | 175 | instead. |
| 176 | - BTN_TOOL_<name> should be set to 1 when the tool comes into detectable | ||
| 177 | proximity and set to 0 when the tool leaves detectable proximity. | ||
| 178 | BTN_TOOL_<name> signals the type of tool that is currently detected by the | ||
| 179 | hardware and is otherwise independent of ABS_DISTANCE and/or BTN_TOUCH. | ||
| 176 | 180 | ||
| 177 | * ABS_MT_<name>: | 181 | * ABS_MT_<name>: |
| 178 | - Used to describe multitouch input events. Please see | 182 | - Used to describe multitouch input events. Please see |
| @@ -19,7 +19,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks · 18 unmodified lines | |||
| 19 | ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space | 19 | ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space |
| 20 | ... unused hole ... | 20 | ... unused hole ... |
| 21 | ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 | 21 | ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 |
| 22 | ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space | 22 | ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space |
| 23 | ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls | 23 | ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls |
| 24 | ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole | 24 | ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole |
| 25 | 25 | ||
| @@ -31,8 +31,8 @@ vmalloc space is lazily synchronized into the different PML4 pages of · 5 unmodified lines | |||
| 31 | the processes using the page fault handler, with init_level4_pgt as | 31 | the processes using the page fault handler, with init_level4_pgt as |
| 32 | reference. | 32 | reference. |
| 33 | 33 | ||
| 34 | Current X86-64 implementations only support 40 bits of address space, | 34 | Current X86-64 implementations support up to 46 bits of address space (64 TB), |
| 35 | but we support up to 46 bits. This expands into MBZ space in the page tables. | 35 | which is our current limit. This expands into MBZ space in the page tables. |
| 36 | 36 | ||
| 37 | We map EFI runtime services in the 'efi_pgd' PGD in a 64Gb large virtual | 37 | We map EFI runtime services in the 'efi_pgd' PGD in a 64Gb large virtual |
| 38 | memory window (this size is arbitrary, it can be raised later if needed). | 38 | memory window (this size is arbitrary, it can be raised later if needed). |
| @@ -11072,6 +11072,15 @@ S: Maintained · 11071 unmodified lines | |||
| 11072 | F: drivers/clk/ti/ | 11072 | F: drivers/clk/ti/ |
| 11073 | F: include/linux/clk/ti.h | 11073 | F: include/linux/clk/ti.h |
| 11074 | 11074 | ||
| 11075 | TI ETHERNET SWITCH DRIVER (CPSW) | ||
| 11076 | M: Mugunthan V N <mugunthanvnm@ti.com> | ||
| 11077 | R: Grygorii Strashko <grygorii.strashko@ti.com> | ||
| 11078 | L: linux-omap@vger.kernel.org | ||
| 11079 | L: netdev@vger.kernel.org | ||
| 11080 | S: Maintained | ||
| 11081 | F: drivers/net/ethernet/ti/cpsw* | ||
| 11082 | F: drivers/net/ethernet/ti/davinci* | ||
| 11083 | |||
| 11075 | TI FLASH MEDIA INTERFACE DRIVER | 11084 | TI FLASH MEDIA INTERFACE DRIVER |
| 11076 | M: Alex Dubov <oakad@yahoo.com> | 11085 | M: Alex Dubov <oakad@yahoo.com> |
| 11077 | S: Maintained | 11086 | S: Maintained |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
| 5 | NAME = Blurry Fish Butt | 5 | NAME = Blurry Fish Butt |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -1008,7 +1008,8 @@ prepare0: archprepare FORCE · 1000 unmodified lines | |||
| 1008 | prepare: prepare0 prepare-objtool | 1008 | prepare: prepare0 prepare-objtool |
| 1009 | 1009 | ||
| 1010 | ifdef CONFIG_STACK_VALIDATION | 1010 | ifdef CONFIG_STACK_VALIDATION |
| 1011 | has_libelf := $(shell echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf - &> /dev/null && echo 1 || echo 0) | 1011 | has_libelf := $(call try-run,\ |
| 1012 | echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0) | ||
| 1012 | ifeq ($(has_libelf),1) | 1013 | ifeq ($(has_libelf),1) |
| 1013 | objtool_target := tools/objtool FORCE | 1014 | objtool_target := tools/objtool FORCE |
| 1014 | else | 1015 | else |
| @@ -860,7 +860,7 @@ · 859 unmodified lines | |||
| 860 | ti,no-idle-on-init; | 860 | ti,no-idle-on-init; |
| 861 | reg = <0x50000000 0x2000>; | 861 | reg = <0x50000000 0x2000>; |
| 862 | interrupts = <100>; | 862 | interrupts = <100>; |
| 863 | dmas = <&edma 52>; | 863 | dmas = <&edma 52 0>; |
| 864 | dma-names = "rxtx"; | 864 | dma-names = "rxtx"; |
| 865 | gpmc,num-cs = <7>; | 865 | gpmc,num-cs = <7>; |
| 866 | gpmc,num-waitpins = <2>; | 866 | gpmc,num-waitpins = <2>; |
| @@ -884,7 +884,7 @@ · 883 unmodified lines | |||
| 884 | gpmc: gpmc@50000000 { | 884 | gpmc: gpmc@50000000 { |
| 885 | compatible = "ti,am3352-gpmc"; | 885 | compatible = "ti,am3352-gpmc"; |
| 886 | ti,hwmods = "gpmc"; | 886 | ti,hwmods = "gpmc"; |
| 887 | dmas = <&edma 52>; | 887 | dmas = <&edma 52 0>; |
| 888 | dma-names = "rxtx"; | 888 | dma-names = "rxtx"; |
| 889 | clocks = <&l3s_gclk>; | 889 | clocks = <&l3s_gclk>; |
| 890 | clock-names = "fck"; | 890 | clock-names = "fck"; |
| @@ -99,13 +99,6 @@ · 98 unmodified lines | |||
| 99 | #cooling-cells = <2>; | 99 | #cooling-cells = <2>; |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | extcon_usb1: extcon_usb1 { | ||
| 103 | compatible = "linux,extcon-usb-gpio"; | ||
| 104 | id-gpio = <&gpio7 25 GPIO_ACTIVE_HIGH>; | ||
| 105 | pinctrl-names = "default"; | ||
| 106 | pinctrl-0 = <&extcon_usb1_pins>; | ||
| 107 | }; | ||
| 108 | |||
| 109 | hdmi0: connector { | 102 | hdmi0: connector { |
| 110 | compatible = "hdmi-connector"; | 103 | compatible = "hdmi-connector"; |
| 111 | label = "hdmi"; | 104 | label = "hdmi"; |
| @@ -349,12 +342,6 @@ · 237 unmodified lines | |||
| 349 | >; | 342 | >; |
| 350 | }; | 343 | }; |
| 351 | 344 | ||
| 352 | extcon_usb1_pins: extcon_usb1_pins { | ||
| 353 | pinctrl-single,pins = < | ||
| 354 | DRA7XX_CORE_IOPAD(0x37ec, PIN_INPUT_PULLUP | MUX_MODE14) /* uart1_rtsn.gpio7_25 */ | ||
| 355 | >; | ||
| 356 | }; | ||
| 357 | |||
| 358 | tpd12s015_pins: pinmux_tpd12s015_pins { | 345 | tpd12s015_pins: pinmux_tpd12s015_pins { |
| 359 | pinctrl-single,pins = < | 346 | pinctrl-single,pins = < |
| 360 | DRA7XX_CORE_IOPAD(0x37b0, PIN_OUTPUT | MUX_MODE14) /* gpio7_10 CT_CP_HPD */ | 347 | DRA7XX_CORE_IOPAD(0x37b0, PIN_OUTPUT | MUX_MODE14) /* gpio7_10 CT_CP_HPD */ |
| @@ -706,10 +693,6 @@ · 345 unmodified lines | |||
| 706 | pinctrl-0 = <&usb1_pins>; | 693 | pinctrl-0 = <&usb1_pins>; |
| 707 | }; | 694 | }; |
| 708 | 695 | ||
| 709 | &omap_dwc3_1 { | ||
| 710 | extcon = <&extcon_usb1>; | ||
| 711 | }; | ||
| 712 | |||
| 713 | &omap_dwc3_2 { | 696 | &omap_dwc3_2 { |
| 714 | extcon = <&extcon_usb2>; | 697 | extcon = <&extcon_usb2>; |
| 715 | }; | 698 | }; |
| @@ -4,6 +4,157 @@ · 3 unmodified lines | |||
| 4 | * published by the Free Software Foundation. | 4 | * published by the Free Software Foundation. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | &pllss { | ||
| 8 | /* | ||
| 9 | * See TRM "2.6.10 Connected outputso DPLLS" and | ||
| 10 | * "2.6.11 Connected Outputs of DPLLJ". Only clkout is | ||
| 11 | * connected except for hdmi and usb. | ||
| 12 | */ | ||
| 13 | adpll_mpu_ck: adpll@40 { | ||
| 14 | #clock-cells = <1>; | ||
| 15 | compatible = "ti,dm814-adpll-s-clock"; | ||
| 16 | reg = <0x40 0x40>; | ||
| 17 | clocks = <&devosc_ck &devosc_ck &devosc_ck>; | ||
| 18 | clock-names = "clkinp", "clkinpulow", "clkinphif"; | ||
| 19 | clock-output-names = "481c5040.adpll.dcoclkldo", | ||
| 20 | "481c5040.adpll.clkout", | ||
| 21 | "481c5040.adpll.clkoutx2", | ||
| 22 | "481c5040.adpll.clkouthif"; | ||
| 23 | }; | ||
| 24 | |||
| 25 | adpll_dsp_ck: adpll@80 { | ||
| 26 | #clock-cells = <1>; | ||
| 27 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 28 | reg = <0x80 0x30>; | ||
| 29 | clocks = <&devosc_ck &devosc_ck>; | ||
| 30 | clock-names = "clkinp", "clkinpulow"; | ||
| 31 | clock-output-names = "481c5080.adpll.dcoclkldo", | ||
| 32 | "481c5080.adpll.clkout", | ||
| 33 | "481c5080.adpll.clkoutldo"; | ||
| 34 | }; | ||
| 35 | |||
| 36 | adpll_sgx_ck: adpll@b0 { | ||
| 37 | #clock-cells = <1>; | ||
| 38 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 39 | reg = <0xb0 0x30>; | ||
| 40 | clocks = <&devosc_ck &devosc_ck>; | ||
| 41 | clock-names = "clkinp", "clkinpulow"; | ||
| 42 | clock-output-names = "481c50b0.adpll.dcoclkldo", | ||
| 43 | "481c50b0.adpll.clkout", | ||
| 44 | "481c50b0.adpll.clkoutldo"; | ||
| 45 | }; | ||
| 46 | |||
| 47 | adpll_hdvic_ck: adpll@e0 { | ||
| 48 | #clock-cells = <1>; | ||
| 49 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 50 | reg = <0xe0 0x30>; | ||
| 51 | clocks = <&devosc_ck &devosc_ck>; | ||
| 52 | clock-names = "clkinp", "clkinpulow"; | ||
| 53 | clock-output-names = "481c50e0.adpll.dcoclkldo", | ||
| 54 | "481c50e0.adpll.clkout", | ||
| 55 | "481c50e0.adpll.clkoutldo"; | ||
| 56 | }; | ||
| 57 | |||
| 58 | adpll_l3_ck: adpll@110 { | ||
| 59 | #clock-cells = <1>; | ||
| 60 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 61 | reg = <0x110 0x30>; | ||
| 62 | clocks = <&devosc_ck &devosc_ck>; | ||
| 63 | clock-names = "clkinp", "clkinpulow"; | ||
| 64 | clock-output-names = "481c5110.adpll.dcoclkldo", | ||
| 65 | "481c5110.adpll.clkout", | ||
| 66 | "481c5110.adpll.clkoutldo"; | ||
| 67 | }; | ||
| 68 | |||
| 69 | adpll_isp_ck: adpll@140 { | ||
| 70 | #clock-cells = <1>; | ||
| 71 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 72 | reg = <0x140 0x30>; | ||
| 73 | clocks = <&devosc_ck &devosc_ck>; | ||
| 74 | clock-names = "clkinp", "clkinpulow"; | ||
| 75 | clock-output-names = "481c5140.adpll.dcoclkldo", | ||
| 76 | "481c5140.adpll.clkout", | ||
| 77 | "481c5140.adpll.clkoutldo"; | ||
| 78 | }; | ||
| 79 | |||
| 80 | adpll_dss_ck: adpll@170 { | ||
| 81 | #clock-cells = <1>; | ||
| 82 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 83 | reg = <0x170 0x30>; | ||
| 84 | clocks = <&devosc_ck &devosc_ck>; | ||
| 85 | clock-names = "clkinp", "clkinpulow"; | ||
| 86 | clock-output-names = "481c5170.adpll.dcoclkldo", | ||
| 87 | "481c5170.adpll.clkout", | ||
| 88 | "481c5170.adpll.clkoutldo"; | ||
| 89 | }; | ||
| 90 | |||
| 91 | adpll_video0_ck: adpll@1a0 { | ||
| 92 | #clock-cells = <1>; | ||
| 93 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 94 | reg = <0x1a0 0x30>; | ||
| 95 | clocks = <&devosc_ck &devosc_ck>; | ||
| 96 | clock-names = "clkinp", "clkinpulow"; | ||
| 97 | clock-output-names = "481c51a0.adpll.dcoclkldo", | ||
| 98 | "481c51a0.adpll.clkout", | ||
| 99 | "481c51a0.adpll.clkoutldo"; | ||
| 100 | }; | ||
| 101 | |||
| 102 | adpll_video1_ck: adpll@1d0 { | ||
| 103 | #clock-cells = <1>; | ||
| 104 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 105 | reg = <0x1d0 0x30>; | ||
| 106 | clocks = <&devosc_ck &devosc_ck>; | ||
| 107 | clock-names = "clkinp", "clkinpulow"; | ||
| 108 | clock-output-names = "481c51d0.adpll.dcoclkldo", | ||
| 109 | "481c51d0.adpll.clkout", | ||
| 110 | "481c51d0.adpll.clkoutldo"; | ||
| 111 | }; | ||
| 112 | |||
| 113 | adpll_hdmi_ck: adpll@200 { | ||
| 114 | #clock-cells = <1>; | ||
| 115 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 116 | reg = <0x200 0x30>; | ||
| 117 | clocks = <&devosc_ck &devosc_ck>; | ||
| 118 | clock-names = "clkinp", "clkinpulow"; | ||
| 119 | clock-output-names = "481c5200.adpll.dcoclkldo", | ||
| 120 | "481c5200.adpll.clkout", | ||
| 121 | "481c5200.adpll.clkoutldo"; | ||
| 122 | }; | ||
| 123 | |||
| 124 | adpll_audio_ck: adpll@230 { | ||
| 125 | #clock-cells = <1>; | ||
| 126 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 127 | reg = <0x230 0x30>; | ||
| 128 | clocks = <&devosc_ck &devosc_ck>; | ||
| 129 | clock-names = "clkinp", "clkinpulow"; | ||
| 130 | clock-output-names = "481c5230.adpll.dcoclkldo", | ||
| 131 | "481c5230.adpll.clkout", | ||
| 132 | "481c5230.adpll.clkoutldo"; | ||
| 133 | }; | ||
| 134 | |||
| 135 | adpll_usb_ck: adpll@260 { | ||
| 136 | #clock-cells = <1>; | ||
| 137 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 138 | reg = <0x260 0x30>; | ||
| 139 | clocks = <&devosc_ck &devosc_ck>; | ||
| 140 | clock-names = "clkinp", "clkinpulow"; | ||
| 141 | clock-output-names = "481c5260.adpll.dcoclkldo", | ||
| 142 | "481c5260.adpll.clkout", | ||
| 143 | "481c5260.adpll.clkoutldo"; | ||
| 144 | }; | ||
| 145 | |||
| 146 | adpll_ddr_ck: adpll@290 { | ||
| 147 | #clock-cells = <1>; | ||
| 148 | compatible = "ti,dm814-adpll-lj-clock"; | ||
| 149 | reg = <0x290 0x30>; | ||
| 150 | clocks = <&devosc_ck &devosc_ck>; | ||
| 151 | clock-names = "clkinp", "clkinpulow"; | ||
| 152 | clock-output-names = "481c5290.adpll.dcoclkldo", | ||
| 153 | "481c5290.adpll.clkout", | ||
| 154 | "481c5290.adpll.clkoutldo"; | ||
| 155 | }; | ||
| 156 | }; | ||
| 157 | |||
| 7 | &pllss_clocks { | 158 | &pllss_clocks { |
| 8 | timer1_fck: timer1_fck { | 159 | timer1_fck: timer1_fck { |
| 9 | #clock-cells = <0>; | 160 | #clock-cells = <0>; |
| @@ -23,6 +174,24 @@ · 13 unmodified lines | |||
| 23 | reg = <0x2e0>; | 174 | reg = <0x2e0>; |
| 24 | }; | 175 | }; |
| 25 | 176 | ||
| 177 | /* CPTS_RFT_CLK in RMII_REFCLK_SRC, usually sourced from auiod */ | ||
| 178 | cpsw_cpts_rft_clk: cpsw_cpts_rft_clk { | ||
| 179 | #clock-cells = <0>; | ||
| 180 | compatible = "ti,mux-clock"; | ||
| 181 | clocks = <&adpll_video0_ck 1 | ||
| 182 | &adpll_video1_ck 1 | ||
| 183 | &adpll_audio_ck 1>; | ||
| 184 | ti,bit-shift = <1>; | ||
| 185 | reg = <0x2e8>; | ||
| 186 | }; | ||
| 187 | |||
| 188 | /* REVISIT: Set up with a proper mux using RMII_REFCLK_SRC */ | ||
| 189 | cpsw_125mhz_gclk: cpsw_125mhz_gclk { | ||
| 190 | #clock-cells = <0>; | ||
| 191 | compatible = "fixed-clock"; | ||
| 192 | clock-frequency = <125000000>; | ||
| 193 | }; | ||
| 194 | |||
| 26 | sysclk18_ck: sysclk18_ck { | 195 | sysclk18_ck: sysclk18_ck { |
| 27 | #clock-cells = <0>; | 196 | #clock-cells = <0>; |
| 28 | compatible = "ti,mux-clock"; | 197 | compatible = "ti,mux-clock"; |
| @@ -79,37 +248,6 @@ · 50 unmodified lines | |||
| 79 | compatible = "fixed-clock"; | 248 | compatible = "fixed-clock"; |
| 80 | clock-frequency = <1000000000>; | 249 | clock-frequency = <1000000000>; |
| 81 | }; | 250 | }; |
| 82 | |||
| 83 | sysclk4_ck: sysclk4_ck { | ||
| 84 | #clock-cells = <0>; | ||
| 85 | compatible = "fixed-clock"; | ||
| 86 | clock-frequency = <222000000>; | ||
| 87 | }; | ||
| 88 | |||
| 89 | sysclk6_ck: sysclk6_ck { | ||
| 90 | #clock-cells = <0>; | ||
| 91 | compatible = "fixed-clock"; | ||
| 92 | clock-frequency = <100000000>; | ||
| 93 | }; | ||
| 94 | |||
| 95 | sysclk10_ck: sysclk10_ck { | ||
| 96 | #clock-cells = <0>; | ||
| 97 | compatible = "fixed-clock"; | ||
| 98 | clock-frequency = <48000000>; | ||
| 99 | }; | ||
| 100 | |||
| 101 | cpsw_125mhz_gclk: cpsw_125mhz_gclk { | ||
| 102 | #clock-cells = <0>; | ||
| 103 | compatible = "fixed-clock"; | ||
| 104 | clock-frequency = <125000000>; | ||
| 105 | }; | ||
| 106 | |||
| 107 | cpsw_cpts_rft_clk: cpsw_cpts_rft_clk { | ||
| 108 | #clock-cells = <0>; | ||
| 109 | compatible = "fixed-clock"; | ||
| 110 | clock-frequency = <250000000>; | ||
| 111 | }; | ||
| 112 | |||
| 113 | }; | 251 | }; |
| 114 | 252 | ||
| 115 | &prcm_clocks { | 253 | &prcm_clocks { |
| @@ -138,6 +276,49 @@ · 22 unmodified lines | |||
| 138 | clock-div = <78125>; | 276 | clock-div = <78125>; |
| 139 | }; | 277 | }; |
| 140 | 278 | ||
| 279 | /* L4_HS 220 MHz*/ | ||
| 280 | sysclk4_ck: sysclk4_ck { | ||
| 281 | #clock-cells = <0>; | ||
| 282 | compatible = "ti,fixed-factor-clock"; | ||
| 283 | clocks = <&adpll_l3_ck 1>; | ||
| 284 | ti,clock-mult = <1>; | ||
| 285 | ti,clock-div = <1>; | ||
| 286 | }; | ||
| 287 | |||
| 288 | /* L4_FWCFG */ | ||
| 289 | sysclk5_ck: sysclk5_ck { | ||
| 290 | #clock-cells = <0>; | ||
| 291 | compatible = "ti,fixed-factor-clock"; | ||
| 292 | clocks = <&adpll_l3_ck 1>; | ||
| 293 | ti,clock-mult = <1>; | ||
| 294 | ti,clock-div = <2>; | ||
| 295 | }; | ||
| 296 | |||
| 297 | /* L4_LS 110 MHz */ | ||
| 298 | sysclk6_ck: sysclk6_ck { | ||
| 299 | #clock-cells = <0>; | ||
| 300 | compatible = "ti,fixed-factor-clock"; | ||
| 301 | clocks = <&adpll_l3_ck 1>; | ||
| 302 | ti,clock-mult = <1>; | ||
| 303 | ti,clock-div = <2>; | ||
| 304 | }; | ||
| 305 | |||
| 306 | sysclk8_ck: sysclk8_ck { | ||
| 307 | #clock-cells = <0>; | ||
| 308 | compatible = "ti,fixed-factor-clock"; | ||
| 309 | clocks = <&adpll_usb_ck 1>; | ||
| 310 | ti,clock-mult = <1>; | ||
| 311 | ti,clock-div = <1>; | ||
| 312 | }; | ||
| 313 | |||
| 314 | sysclk10_ck: sysclk10_ck { | ||
| 315 | compatible = "ti,divider-clock"; | ||
| 316 | reg = <0x324>; | ||
| 317 | ti,max-div = <7>; | ||
| 318 | #clock-cells = <0>; | ||
| 319 | clocks = <&adpll_usb_ck 1>; | ||
| 320 | }; | ||
| 321 | |||
| 141 | aud_clkin0_ck: aud_clkin0_ck { | 322 | aud_clkin0_ck: aud_clkin0_ck { |
| 142 | #clock-cells = <0>; | 323 | #clock-cells = <0>; |
| 143 | compatible = "fixed-clock"; | 324 | compatible = "fixed-clock"; |
| @@ -6,6 +6,32 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | #include "dm814x-clocks.dtsi" | 7 | #include "dm814x-clocks.dtsi" |
| 8 | 8 | ||
| 9 | /* Compared to dm814x, dra62x does not have hdic, l3 or dss PLLs */ | ||
| 10 | &adpll_hdvic_ck { | ||
| 11 | status = "disabled"; | ||
| 12 | }; | ||
| 13 | |||
| 14 | &adpll_l3_ck { | ||
| 15 | status = "disabled"; | ||
| 16 | }; | ||
| 17 | |||
| 18 | &adpll_dss_ck { | ||
| 19 | status = "disabled"; | ||
| 20 | }; | ||
| 21 | |||
| 22 | /* Compared to dm814x, dra62x has interconnect clocks on isp PLL */ | ||
| 23 | &sysclk4_ck { | ||
| 24 | clocks = <&adpll_isp_ck 1>; | ||
| 25 | }; | ||
| 26 | |||
| 27 | &sysclk5_ck { | ||
| 28 | clocks = <&adpll_isp_ck 1>; | ||
| 29 | }; | ||
| 30 | |||
| 31 | &sysclk6_ck { | ||
| 32 | clocks = <&adpll_isp_ck 1>; | ||
| 33 | }; | ||
| 34 | |||
| 9 | /* | 35 | /* |
| 10 | * Compared to dm814x, dra62x has different shifts and more mux options. | 36 | * Compared to dm814x, dra62x has different shifts and more mux options. |
| 11 | * Please add the extra options for ysclk_14 and 16 if really needed. | 37 | * Please add the extra options for ysclk_14 and 16 if really needed. |
| @@ -98,12 +98,20 @@ · 97 unmodified lines | |||
| 98 | clock-frequency = <32768>; | 98 | clock-frequency = <32768>; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | sys_32k_ck: sys_32k_ck { | 101 | sys_clk32_crystal_ck: sys_clk32_crystal_ck { |
| 102 | #clock-cells = <0>; | 102 | #clock-cells = <0>; |
| 103 | compatible = "fixed-clock"; | 103 | compatible = "fixed-clock"; |
| 104 | clock-frequency = <32768>; | 104 | clock-frequency = <32768>; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | sys_clk32_pseudo_ck: sys_clk32_pseudo_ck { | ||
| 108 | #clock-cells = <0>; | ||
| 109 | compatible = "fixed-factor-clock"; | ||
| 110 | clocks = <&sys_clkin1>; | ||
| 111 | clock-mult = <1>; | ||
| 112 | clock-div = <610>; | ||
| 113 | }; | ||
| 114 | |||
| 107 | virt_12000000_ck: virt_12000000_ck { | 115 | virt_12000000_ck: virt_12000000_ck { |
| 108 | #clock-cells = <0>; | 116 | #clock-cells = <0>; |
| 109 | compatible = "fixed-clock"; | 117 | compatible = "fixed-clock"; |
| @@ -2170,4 +2178,12 @@ · 2060 unmodified lines | |||
| 2170 | ti,bit-shift = <22>; | 2178 | ti,bit-shift = <22>; |
| 2171 | reg = <0x0558>; | 2179 | reg = <0x0558>; |
| 2172 | }; | 2180 | }; |
| 2181 | |||
| 2182 | sys_32k_ck: sys_32k_ck { | ||
| 2183 | #clock-cells = <0>; | ||
| 2184 | compatible = "ti,mux-clock"; | ||
| 2185 | clocks = <&sys_clk32_crystal_ck>, <&sys_clk32_pseudo_ck>, <&sys_clk32_pseudo_ck>, <&sys_clk32_pseudo_ck>; | ||
| 2186 | ti,bit-shift = <8>; | ||
| 2187 | reg = <0x6c4>; | ||
| 2188 | }; | ||
| 2173 | }; | 2189 | }; |
| @@ -1,6 +1,6 @@ | |||
| 1 | /dts-v1/; | 1 | /dts-v1/; |
| 2 | 2 | ||
| 3 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 3 | #include <dt-bindings/interrupt-controller/irq.h> |
| 4 | #include <dt-bindings/clock/qcom,gcc-msm8974.h> | 4 | #include <dt-bindings/clock/qcom,gcc-msm8974.h> |
| 5 | #include "skeleton.dtsi" | 5 | #include "skeleton.dtsi" |
| 6 | 6 | ||
| @@ -460,8 +460,6 @@ · 453 unmodified lines | |||
| 460 | clock-names = "core", "iface"; | 460 | clock-names = "core", "iface"; |
| 461 | #address-cells = <1>; | 461 | #address-cells = <1>; |
| 462 | #size-cells = <0>; | 462 | #size-cells = <0>; |
| 463 | dmas = <&blsp2_dma 20>, <&blsp2_dma 21>; | ||
| 464 | dma-names = "tx", "rx"; | ||
| 465 | }; | 463 | }; |
| 466 | 464 | ||
| 467 | spmi_bus: spmi@fc4cf000 { | 465 | spmi_bus: spmi@fc4cf000 { |
| @@ -479,16 +477,6 @@ · 11 unmodified lines | |||
| 479 | interrupt-controller; | 477 | interrupt-controller; |
| 480 | #interrupt-cells = <4>; | 478 | #interrupt-cells = <4>; |
| 481 | }; | 479 | }; |
| 482 | |||
| 483 | blsp2_dma: dma-controller@f9944000 { | ||
| 484 | compatible = "qcom,bam-v1.4.0"; | ||
| 485 | reg = <0xf9944000 0x19000>; | ||
| 486 | interrupts = <GIC_SPI 239 IRQ_TYPE_LEVEL_HIGH>; | ||
| 487 | clocks = <&gcc GCC_BLSP2_AHB_CLK>; | ||
| 488 | clock-names = "bam_clk"; | ||
| 489 | #dma-cells = <1>; | ||
| 490 | qcom,ee = <0>; | ||
| 491 | }; | ||
| 492 | }; | 480 | }; |
| 493 | 481 | ||
| 494 | smd { | 482 | smd { |
| @@ -661,6 +661,7 @@ · 660 unmodified lines | |||
| 661 | }; | 661 | }; |
| 662 | 662 | ||
| 663 | &pcie_bus_clk { | 663 | &pcie_bus_clk { |
| 664 | clock-frequency = <100000000>; | ||
| 664 | status = "okay"; | 665 | status = "okay"; |
| 665 | }; | 666 | }; |
| 666 | 667 | ||
| @@ -143,19 +143,11 @@ · 142 unmodified lines | |||
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | &pfc { | 145 | &pfc { |
| 146 | pinctrl-0 = <&scif_clk_pins>; | ||
| 147 | pinctrl-names = "default"; | ||
| 148 | |||
| 149 | scif0_pins: serial0 { | 146 | scif0_pins: serial0 { |
| 150 | renesas,groups = "scif0_data_d"; | 147 | renesas,groups = "scif0_data_d"; |
| 151 | renesas,function = "scif0"; | 148 | renesas,function = "scif0"; |
| 152 | }; | 149 | }; |
| 153 | 150 | ||
| 154 | scif_clk_pins: scif_clk { | ||
| 155 | renesas,groups = "scif_clk"; | ||
| 156 | renesas,function = "scif_clk"; | ||
| 157 | }; | ||
| 158 | |||
| 159 | ether_pins: ether { | 151 | ether_pins: ether { |
| 160 | renesas,groups = "eth_link", "eth_mdio", "eth_rmii"; | 152 | renesas,groups = "eth_link", "eth_mdio", "eth_rmii"; |
| 161 | renesas,function = "eth"; | 153 | renesas,function = "eth"; |
| @@ -229,11 +221,6 @@ · 67 unmodified lines | |||
| 229 | status = "okay"; | 221 | status = "okay"; |
| 230 | }; | 222 | }; |
| 231 | 223 | ||
| 232 | &scif_clk { | ||
| 233 | clock-frequency = <14745600>; | ||
| 234 | status = "okay"; | ||
| 235 | }; | ||
| 236 | |||
| 237 | ðer { | 224 | ðer { |
| 238 | pinctrl-0 = <ðer_pins &phy1_pins>; | 225 | pinctrl-0 = <ðer_pins &phy1_pins>; |
| 239 | pinctrl-names = "default"; | 226 | pinctrl-names = "default"; |
| @@ -414,6 +401,7 @@ · 174 unmodified lines | |||
| 414 | }; | 401 | }; |
| 415 | 402 | ||
| 416 | &pcie_bus_clk { | 403 | &pcie_bus_clk { |
| 404 | clock-frequency = <100000000>; | ||
| 417 | status = "okay"; | 405 | status = "okay"; |
| 418 | }; | 406 | }; |
| 419 | 407 | ||
| @@ -1083,9 +1083,8 @@ · 1082 unmodified lines | |||
| 1083 | pcie_bus_clk: pcie_bus_clk { | 1083 | pcie_bus_clk: pcie_bus_clk { |
| 1084 | compatible = "fixed-clock"; | 1084 | compatible = "fixed-clock"; |
| 1085 | #clock-cells = <0>; | 1085 | #clock-cells = <0>; |
| 1086 | clock-frequency = <100000000>; | 1086 | clock-frequency = <0>; |
| 1087 | clock-output-names = "pcie_bus"; | 1087 | clock-output-names = "pcie_bus"; |
| 1088 | status = "disabled"; | ||
| 1089 | }; | 1088 | }; |
| 1090 | 1089 | ||
| 1091 | /* External SCIF clock */ | 1090 | /* External SCIF clock */ |
| @@ -1094,7 +1093,6 @@ · 2 unmodified lines | |||
| 1094 | #clock-cells = <0>; | 1093 | #clock-cells = <0>; |
| 1095 | /* This value must be overridden by the board. */ | 1094 | /* This value must be overridden by the board. */ |
| 1096 | clock-frequency = <0>; | 1095 | clock-frequency = <0>; |
| 1097 | status = "disabled"; | ||
| 1098 | }; | 1096 | }; |
| 1099 | 1097 | ||
| 1100 | /* External USB clock - can be overridden by the board */ | 1098 | /* External USB clock - can be overridden by the board */ |
| @@ -1112,7 +1110,6 @@ · 11 unmodified lines | |||
| 1112 | /* This value must be overridden by the board. */ | 1110 | /* This value must be overridden by the board. */ |
| 1113 | clock-frequency = <0>; | 1111 | clock-frequency = <0>; |
| 1114 | clock-output-names = "can_clk"; | 1112 | clock-output-names = "can_clk"; |
| 1115 | status = "disabled"; | ||
| 1116 | }; | 1113 | }; |
| 1117 | 1114 | ||
| 1118 | /* Special CPG clocks */ | 1115 | /* Special CPG clocks */ |
| @@ -71,6 +71,7 @@ struct platform_device *__init imx_add_sdhci_esdhc_imx( · 70 unmodified lines | |||
| 71 | if (!pdata) | 71 | if (!pdata) |
| 72 | pdata = &default_esdhc_pdata; | 72 | pdata = &default_esdhc_pdata; |
| 73 | 73 | ||
| 74 | return imx_add_platform_device(data->devid, data->id, res, | 74 | return imx_add_platform_device_dmamask(data->devid, data->id, res, |
| 75 | ARRAY_SIZE(res), pdata, sizeof(*pdata)); | 75 | ARRAY_SIZE(res), pdata, sizeof(*pdata), |
| 76 | DMA_BIT_MASK(32)); | ||
| 76 | } | 77 | } |
| @@ -461,7 +461,7 @@ static struct clockdomain ipu_7xx_clkdm = { · 460 unmodified lines | |||
| 461 | .cm_inst = DRA7XX_CM_CORE_AON_IPU_INST, | 461 | .cm_inst = DRA7XX_CM_CORE_AON_IPU_INST, |
| 462 | .clkdm_offs = DRA7XX_CM_CORE_AON_IPU_IPU_CDOFFS, | 462 | .clkdm_offs = DRA7XX_CM_CORE_AON_IPU_IPU_CDOFFS, |
| 463 | .dep_bit = DRA7XX_IPU_STATDEP_SHIFT, | 463 | .dep_bit = DRA7XX_IPU_STATDEP_SHIFT, |
| 464 | .flags = CLKDM_CAN_HWSUP_SWSUP, | 464 | .flags = CLKDM_CAN_SWSUP, |
| 465 | }; | 465 | }; |
| 466 | 466 | ||
| 467 | static struct clockdomain mpu1_7xx_clkdm = { | 467 | static struct clockdomain mpu1_7xx_clkdm = { |
| @@ -737,7 +737,8 @@ void __init omap5_init_late(void) · 736 unmodified lines | |||
| 737 | #ifdef CONFIG_SOC_DRA7XX | 737 | #ifdef CONFIG_SOC_DRA7XX |
| 738 | void __init dra7xx_init_early(void) | 738 | void __init dra7xx_init_early(void) |
| 739 | { | 739 | { |
| 740 | omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); | 740 | omap2_set_globals_tap(DRA7XX_CLASS, |
| 741 | OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE)); | ||
| 741 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); | 742 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); |
| 742 | omap2_control_base_init(); | 743 | omap2_control_base_init(); |
| 743 | omap4_pm_init_early(); | 744 | omap4_pm_init_early(); |
| @@ -274,6 +274,10 @@ static inline void omap5_irq_save_context(void) · 273 unmodified lines | |||
| 274 | */ | 274 | */ |
| 275 | static void irq_save_context(void) | 275 | static void irq_save_context(void) |
| 276 | { | 276 | { |
| 277 | /* DRA7 has no SAR to save */ | ||
| 278 | if (soc_is_dra7xx()) | ||
| 279 | return; | ||
| 280 | |||
| 277 | if (!sar_base) | 281 | if (!sar_base) |
| 278 | sar_base = omap4_get_sar_ram_base(); | 282 | sar_base = omap4_get_sar_ram_base(); |
| 279 | 283 | ||
| @@ -290,6 +294,9 @@ static void irq_sar_clear(void) · 10 unmodified lines | |||
| 290 | { | 294 | { |
| 291 | u32 val; | 295 | u32 val; |
| 292 | u32 offset = SAR_BACKUP_STATUS_OFFSET; | 296 | u32 offset = SAR_BACKUP_STATUS_OFFSET; |
| 297 | /* DRA7 has no SAR to save */ | ||
| 298 | if (soc_is_dra7xx()) | ||
| 299 | return; | ||
| 293 | 300 | ||
| 294 | if (soc_is_omap54xx()) | 301 | if (soc_is_omap54xx()) |
| 295 | offset = OMAP5_SAR_BACKUP_STATUS_OFFSET; | 302 | offset = OMAP5_SAR_BACKUP_STATUS_OFFSET; |
| @@ -198,7 +198,6 @@ void omap_sram_idle(void) · 197 unmodified lines | |||
| 198 | int per_next_state = PWRDM_POWER_ON; | 198 | int per_next_state = PWRDM_POWER_ON; |
| 199 | int core_next_state = PWRDM_POWER_ON; | 199 | int core_next_state = PWRDM_POWER_ON; |
| 200 | int per_going_off; | 200 | int per_going_off; |
| 201 | int core_prev_state; | ||
| 202 | u32 sdrc_pwr = 0; | 201 | u32 sdrc_pwr = 0; |
| 203 | 202 | ||
| 204 | mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); | 203 | mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); |
| @@ -278,16 +277,20 @@ void omap_sram_idle(void) · 73 unmodified lines | |||
| 278 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); | 277 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); |
| 279 | 278 | ||
| 280 | /* CORE */ | 279 | /* CORE */ |
| 281 | if (core_next_state < PWRDM_POWER_ON) { | 280 | if (core_next_state < PWRDM_POWER_ON && |
| 282 | core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm); | 281 | pwrdm_read_prev_pwrst(core_pwrdm) == PWRDM_POWER_OFF) { |
| 283 | if (core_prev_state == PWRDM_POWER_OFF) { | 282 | omap3_core_restore_context(); |
| 284 | omap3_core_restore_context(); | 283 | omap3_cm_restore_context(); |
| 285 | omap3_cm_restore_context(); | 284 | omap3_sram_restore_context(); |
| 286 | omap3_sram_restore_context(); | 285 | omap2_sms_restore_context(); |
| 287 | omap2_sms_restore_context(); | 286 | } else { |
| 288 | } | 287 | /* |
| 288 | * In off-mode resume path above, omap3_core_restore_context | ||
| 289 | * also handles the INTC autoidle restore done here so limit | ||
| 290 | * this to non-off mode resume paths so we don't do it twice. | ||
| 291 | */ | ||
| 292 | omap3_intc_resume_idle(); | ||
| 289 | } | 293 | } |
| 290 | omap3_intc_resume_idle(); | ||
| 291 | 294 | ||
| 292 | pwrdm_post_transition(NULL); | 295 | pwrdm_post_transition(NULL); |
| 293 | 296 | ||
| @@ -40,8 +40,7 @@ static void __init shmobile_setup_delay_hz(unsigned int max_cpu_core_hz, · 39 unmodified lines | |||
| 40 | void __init shmobile_init_delay(void) | 40 | void __init shmobile_init_delay(void) |
| 41 | { | 41 | { |
| 42 | struct device_node *np, *cpus; | 42 | struct device_node *np, *cpus; |
| 43 | bool is_a7_a8_a9 = false; | 43 | unsigned int div = 0; |
| 44 | bool is_a15 = false; | ||
| 45 | bool has_arch_timer = false; | 44 | bool has_arch_timer = false; |
| 46 | u32 max_freq = 0; | 45 | u32 max_freq = 0; |
| 47 | 46 | ||
| @@ -55,27 +54,22 @@ void __init shmobile_init_delay(void) · 7 unmodified lines | |||
| 55 | if (!of_property_read_u32(np, "clock-frequency", &freq)) | 54 | if (!of_property_read_u32(np, "clock-frequency", &freq)) |
| 56 | max_freq = max(max_freq, freq); | 55 | max_freq = max(max_freq, freq); |
| 57 | 56 | ||
| 58 | if (of_device_is_compatible(np, "arm,cortex-a8") || | 57 | if (of_device_is_compatible(np, "arm,cortex-a8")) { |
| 59 | of_device_is_compatible(np, "arm,cortex-a9")) { | 58 | div = 2; |
| 60 | is_a7_a8_a9 = true; | 59 | } else if (of_device_is_compatible(np, "arm,cortex-a9")) { |
| 61 | } else if (of_device_is_compatible(np, "arm,cortex-a7")) { | 60 | div = 1; |
| 62 | is_a7_a8_a9 = true; | 61 | } else if (of_device_is_compatible(np, "arm,cortex-a7") || |
| 63 | has_arch_timer = true; | 62 | of_device_is_compatible(np, "arm,cortex-a15")) { |
| 64 | } else if (of_device_is_compatible(np, "arm,cortex-a15")) { | 63 | div = 1; |
| 65 | is_a15 = true; | ||
| 66 | has_arch_timer = true; | 64 | has_arch_timer = true; |
| 67 | } | 65 | } |
| 68 | } | 66 | } |
| 69 | 67 | ||
| 70 | of_node_put(cpus); | 68 | of_node_put(cpus); |
| 71 | 69 | ||
| 72 | if (!max_freq) | 70 | if (!max_freq || !div) |
| 73 | return; | 71 | return; |
| 74 | 72 | ||
| 75 | if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) { | 73 | if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) |
| 76 | if (is_a7_a8_a9) | 74 | shmobile_setup_delay_hz(max_freq, 1, div); |
| 77 | shmobile_setup_delay_hz(max_freq, 1, 3); | ||
| 78 | else if (is_a15) | ||
| 79 | shmobile_setup_delay_hz(max_freq, 2, 4); | ||
| 80 | } | ||
| 81 | } | 75 | } |
| @@ -70,7 +70,6 @@ · 69 unmodified lines | |||
| 70 | i2c3 = &i2c3; | 70 | i2c3 = &i2c3; |
| 71 | i2c4 = &i2c4; | 71 | i2c4 = &i2c4; |
| 72 | i2c5 = &i2c5; | 72 | i2c5 = &i2c5; |
| 73 | i2c6 = &i2c6; | ||
| 74 | }; | 73 | }; |
| 75 | }; | 74 | }; |
| 76 | 75 | ||
| @@ -201,15 +201,12 @@ · 200 unmodified lines | |||
| 201 | 201 | ||
| 202 | i2c2: i2c@58782000 { | 202 | i2c2: i2c@58782000 { |
| 203 | compatible = "socionext,uniphier-fi2c"; | 203 | compatible = "socionext,uniphier-fi2c"; |
| 204 | status = "disabled"; | ||
| 205 | reg = <0x58782000 0x80>; | 204 | reg = <0x58782000 0x80>; |
| 206 | #address-cells = <1>; | 205 | #address-cells = <1>; |
| 207 | #size-cells = <0>; | 206 | #size-cells = <0>; |
| 208 | interrupts = <0 43 4>; | 207 | interrupts = <0 43 4>; |
| 209 | pinctrl-names = "default"; | ||
| 210 | pinctrl-0 = <&pinctrl_i2c2>; | ||
| 211 | clocks = <&i2c_clk>; | 208 | clocks = <&i2c_clk>; |
| 212 | clock-frequency = <100000>; | 209 | clock-frequency = <400000>; |
| 213 | }; | 210 | }; |
| 214 | 211 | ||
| 215 | i2c3: i2c@58783000 { | 212 | i2c3: i2c@58783000 { |
| @@ -227,12 +224,15 @@ · 11 unmodified lines | |||
| 227 | 224 | ||
| 228 | i2c4: i2c@58784000 { | 225 | i2c4: i2c@58784000 { |
| 229 | compatible = "socionext,uniphier-fi2c"; | 226 | compatible = "socionext,uniphier-fi2c"; |
| 227 | status = "disabled"; | ||
| 230 | reg = <0x58784000 0x80>; | 228 | reg = <0x58784000 0x80>; |
| 231 | #address-cells = <1>; | 229 | #address-cells = <1>; |
| 232 | #size-cells = <0>; | 230 | #size-cells = <0>; |
| 233 | interrupts = <0 45 4>; | 231 | interrupts = <0 45 4>; |
| 232 | pinctrl-names = "default"; | ||
| 233 | pinctrl-0 = <&pinctrl_i2c4>; | ||
| 234 | clocks = <&i2c_clk>; | 234 | clocks = <&i2c_clk>; |
| 235 | clock-frequency = <400000>; | 235 | clock-frequency = <100000>; |
| 236 | }; | 236 | }; |
| 237 | 237 | ||
| 238 | i2c5: i2c@58785000 { | 238 | i2c5: i2c@58785000 { |
| @@ -245,16 +245,6 @@ · 6 unmodified lines | |||
| 245 | clock-frequency = <400000>; | 245 | clock-frequency = <400000>; |
| 246 | }; | 246 | }; |
| 247 | 247 | ||
| 248 | i2c6: i2c@58786000 { | ||
| 249 | compatible = "socionext,uniphier-fi2c"; | ||
| 250 | reg = <0x58786000 0x80>; | ||
| 251 | #address-cells = <1>; | ||
| 252 | #size-cells = <0>; | ||
| 253 | interrupts = <0 26 4>; | ||
| 254 | clocks = <&i2c_clk>; | ||
| 255 | clock-frequency = <400000>; | ||
| 256 | }; | ||
| 257 | |||
| 258 | system_bus: system-bus@58c00000 { | 248 | system_bus: system-bus@58c00000 { |
| 259 | compatible = "socionext,uniphier-system-bus"; | 249 | compatible = "socionext,uniphier-system-bus"; |
| 260 | status = "disabled"; | 250 | status = "disabled"; |
| @@ -588,6 +588,15 @@ set_hcr: · 587 unmodified lines | |||
| 588 | msr vpidr_el2, x0 | 588 | msr vpidr_el2, x0 |
| 589 | msr vmpidr_el2, x1 | 589 | msr vmpidr_el2, x1 |
| 590 | 590 | ||
| 591 | /* | ||
| 592 | * When VHE is not in use, early init of EL2 and EL1 needs to be | ||
| 593 | * done here. | ||
| 594 | * When VHE _is_ in use, EL1 will not be used in the host and | ||
| 595 | * requires no configuration, and all non-hyp-specific EL2 setup | ||
| 596 | * will be done via the _EL1 system register aliases in __cpu_setup. | ||
| 597 | */ | ||
| 598 | cbnz x2, 1f | ||
| 599 | |||
| 591 | /* sctlr_el1 */ | 600 | /* sctlr_el1 */ |
| 592 | mov x0, #0x0800 // Set/clear RES{1,0} bits | 601 | mov x0, #0x0800 // Set/clear RES{1,0} bits |
| 593 | CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems | 602 | CPU_BE( movk x0, #0x33d0, lsl #16 ) // Set EE and E0E on BE systems |
| @@ -597,6 +606,7 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems · 3 unmodified lines | |||
| 597 | /* Coprocessor traps. */ | 606 | /* Coprocessor traps. */ |
| 598 | mov x0, #0x33ff | 607 | mov x0, #0x33ff |
| 599 | msr cptr_el2, x0 // Disable copro. traps to EL2 | 608 | msr cptr_el2, x0 // Disable copro. traps to EL2 |
| 609 | 1: | ||
| 600 | 610 | ||
| 601 | #ifdef CONFIG_COMPAT | 611 | #ifdef CONFIG_COMPAT |
| 602 | msr hstr_el2, xzr // Disable CP15 traps to EL2 | 612 | msr hstr_el2, xzr // Disable CP15 traps to EL2 |
| @@ -734,7 +744,8 @@ ENDPROC(__secondary_switched) · 131 unmodified lines | |||
| 734 | 744 | ||
| 735 | .macro update_early_cpu_boot_status status, tmp1, tmp2 | 745 | .macro update_early_cpu_boot_status status, tmp1, tmp2 |
| 736 | mov \tmp2, #\status | 746 | mov \tmp2, #\status |
| 737 | str_l \tmp2, __early_cpu_boot_status, \tmp1 | 747 | adr_l \tmp1, __early_cpu_boot_status |
| 748 | str \tmp2, [\tmp1] | ||
| 738 | dmb sy | 749 | dmb sy |
| 739 | dc ivac, \tmp1 // Invalidate potentially stale cache line | 750 | dc ivac, \tmp1 // Invalidate potentially stale cache line |
| 740 | .endm | 751 | .endm |
| @@ -52,6 +52,7 @@ static void write_pen_release(u64 val) · 51 unmodified lines | |||
| 52 | static int smp_spin_table_cpu_init(unsigned int cpu) | 52 | static int smp_spin_table_cpu_init(unsigned int cpu) |
| 53 | { | 53 | { |
| 54 | struct device_node *dn; | 54 | struct device_node *dn; |
| 55 | int ret; | ||
| 55 | 56 | ||
| 56 | dn = of_get_cpu_node(cpu, NULL); | 57 | dn = of_get_cpu_node(cpu, NULL); |
| 57 | if (!dn) | 58 | if (!dn) |
| @@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu) · 2 unmodified lines | |||
| 60 | /* | 61 | /* |
| 61 | * Determine the address from which the CPU is polling. | 62 | * Determine the address from which the CPU is polling. |
| 62 | */ | 63 | */ |
| 63 | if (of_property_read_u64(dn, "cpu-release-addr", | 64 | ret = of_property_read_u64(dn, "cpu-release-addr", |
| 64 | &cpu_release_addr[cpu])) { | 65 | &cpu_release_addr[cpu]); |
| 66 | if (ret) | ||
| 65 | pr_err("CPU %d: missing or invalid cpu-release-addr property\n", | 67 | pr_err("CPU %d: missing or invalid cpu-release-addr property\n", |
| 66 | cpu); | 68 | cpu); |
| 67 | 69 | ||
| 68 | return -1; | 70 | of_node_put(dn); |
| 69 | } | ||
| 70 | 71 | ||
| 71 | return 0; | 72 | return ret; |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | static int smp_spin_table_cpu_prepare(unsigned int cpu) | 75 | static int smp_spin_table_cpu_prepare(unsigned int cpu) |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ | 31 | #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ |
| 32 | 0x00000040 | 32 | 0x00000040 |
| 33 | 33 | ||
| 34 | /* Reserved - do not use 0x00000004 */ | ||
| 34 | #define PPC_FEATURE_TRUE_LE 0x00000002 | 35 | #define PPC_FEATURE_TRUE_LE 0x00000002 |
| 35 | #define PPC_FEATURE_PPC_LE 0x00000001 | 36 | #define PPC_FEATURE_PPC_LE 0x00000001 |
| 36 | 37 | ||
| @@ -148,23 +148,25 @@ static struct ibm_pa_feature { · 147 unmodified lines | |||
| 148 | unsigned long cpu_features; /* CPU_FTR_xxx bit */ | 148 | unsigned long cpu_features; /* CPU_FTR_xxx bit */ |
| 149 | unsigned long mmu_features; /* MMU_FTR_xxx bit */ | 149 | unsigned long mmu_features; /* MMU_FTR_xxx bit */ |
| 150 | unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */ | 150 | unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */ |
| 151 | unsigned int cpu_user_ftrs2; /* PPC_FEATURE2_xxx bit */ | ||
| 151 | unsigned char pabyte; /* byte number in ibm,pa-features */ | 152 | unsigned char pabyte; /* byte number in ibm,pa-features */ |
| 152 | unsigned char pabit; /* bit number (big-endian) */ | 153 | unsigned char pabit; /* bit number (big-endian) */ |
| 153 | unsigned char invert; /* if 1, pa bit set => clear feature */ | 154 | unsigned char invert; /* if 1, pa bit set => clear feature */ |
| 154 | } ibm_pa_features[] __initdata = { | 155 | } ibm_pa_features[] __initdata = { |
| 155 | {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0}, | 156 | {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0, 0}, |
| 156 | {0, 0, PPC_FEATURE_HAS_FPU, 0, 1, 0}, | 157 | {0, 0, PPC_FEATURE_HAS_FPU, 0, 0, 1, 0}, |
| 157 | {CPU_FTR_CTRL, 0, 0, 0, 3, 0}, | 158 | {CPU_FTR_CTRL, 0, 0, 0, 0, 3, 0}, |
| 158 | {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0}, | 159 | {CPU_FTR_NOEXECUTE, 0, 0, 0, 0, 6, 0}, |
| 159 | {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1}, | 160 | {CPU_FTR_NODSISRALIGN, 0, 0, 0, 1, 1, 1}, |
| 160 | {0, MMU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, | 161 | {0, MMU_FTR_CI_LARGE_PAGE, 0, 0, 1, 2, 0}, |
| 161 | {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, | 162 | {CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 0, 5, 0, 0}, |
| 162 | /* | 163 | /* |
| 163 | * If the kernel doesn't support TM (ie. CONFIG_PPC_TRANSACTIONAL_MEM=n), | 164 | * If the kernel doesn't support TM (ie CONFIG_PPC_TRANSACTIONAL_MEM=n), |
| 164 | * we don't want to turn on CPU_FTR_TM here, so we use CPU_FTR_TM_COMP | 165 | * we don't want to turn on TM here, so we use the *_COMP versions |
| 165 | * which is 0 if the kernel doesn't support TM. | 166 | * which are 0 if the kernel doesn't support TM. |
| 166 | */ | 167 | */ |
| 167 | {CPU_FTR_TM_COMP, 0, 0, 22, 0, 0}, | 168 | {CPU_FTR_TM_COMP, 0, 0, |
| 169 | PPC_FEATURE2_HTM_COMP|PPC_FEATURE2_HTM_NOSC_COMP, 22, 0, 0}, | ||
| 168 | }; | 170 | }; |
| 169 | 171 | ||
| 170 | static void __init scan_features(unsigned long node, const unsigned char *ftrs, | 172 | static void __init scan_features(unsigned long node, const unsigned char *ftrs, |
| @@ -195,10 +197,12 @@ static void __init scan_features(unsigned long node, const unsigned char *ftrs, · 24 unmodified lines | |||
| 195 | if (bit ^ fp->invert) { | 197 | if (bit ^ fp->invert) { |
| 196 | cur_cpu_spec->cpu_features |= fp->cpu_features; | 198 | cur_cpu_spec->cpu_features |= fp->cpu_features; |
| 197 | cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs; | 199 | cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs; |
| 200 | cur_cpu_spec->cpu_user_features2 |= fp->cpu_user_ftrs2; | ||
| 198 | cur_cpu_spec->mmu_features |= fp->mmu_features; | 201 | cur_cpu_spec->mmu_features |= fp->mmu_features; |
| 199 | } else { | 202 | } else { |
| 200 | cur_cpu_spec->cpu_features &= ~fp->cpu_features; | 203 | cur_cpu_spec->cpu_features &= ~fp->cpu_features; |
| 201 | cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs; | 204 | cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs; |
| 205 | cur_cpu_spec->cpu_user_features2 &= ~fp->cpu_user_ftrs2; | ||
| 202 | cur_cpu_spec->mmu_features &= ~fp->mmu_features; | 206 | cur_cpu_spec->mmu_features &= ~fp->mmu_features; |
| 203 | } | 207 | } |
| 204 | } | 208 | } |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
| 5 | #include <asm-generic/hugetlb.h> | 5 | #include <asm-generic/hugetlb.h> |
| 6 | 6 | ||
| 7 | #define hugepages_supported() cpu_has_pse | ||
| 7 | 8 | ||
| 8 | static inline int is_hugepage_only_range(struct mm_struct *mm, | 9 | static inline int is_hugepage_only_range(struct mm_struct *mm, |
| 9 | unsigned long addr, | 10 | unsigned long addr, |
| @@ -152,6 +152,11 @@ static struct clocksource hyperv_cs = { · 151 unmodified lines | |||
| 152 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 152 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | static unsigned char hv_get_nmi_reason(void) | ||
| 156 | { | ||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | |||
| 155 | static void __init ms_hyperv_init_platform(void) | 160 | static void __init ms_hyperv_init_platform(void) |
| 156 | { | 161 | { |
| 157 | /* | 162 | /* |
| @@ -191,6 +196,13 @@ static void __init ms_hyperv_init_platform(void) · 33 unmodified lines | |||
| 191 | machine_ops.crash_shutdown = hv_machine_crash_shutdown; | 196 | machine_ops.crash_shutdown = hv_machine_crash_shutdown; |
| 192 | #endif | 197 | #endif |
| 193 | mark_tsc_unstable("running on Hyper-V"); | 198 | mark_tsc_unstable("running on Hyper-V"); |
| 199 | |||
| 200 | /* | ||
| 201 | * Generation 2 instances don't support reading the NMI status from | ||
| 202 | * 0x61 port. | ||
| 203 | */ | ||
| 204 | if (efi_enabled(EFI_BOOT)) | ||
| 205 | x86_platform.get_nmi_reason = hv_get_nmi_reason; | ||
| 194 | } | 206 | } |
| 195 | 207 | ||
| 196 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { | 208 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
| @@ -42,7 +42,7 @@ static void __init tango_clocksource_init(struct device_node *np) · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, | 43 | ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, |
| 44 | 32, clocksource_mmio_readl_up); | 44 | 32, clocksource_mmio_readl_up); |
| 45 | if (!ret) { | 45 | if (ret) { |
| 46 | pr_err("%s: registration failed\n", np->full_name); | 46 | pr_err("%s: registration failed\n", np->full_name); |
| 47 | return; | 47 | return; |
| 48 | } | 48 | } |
| @@ -63,6 +63,14 @@ static void to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr, · 62 unmodified lines | |||
| 63 | ptr->eptr = upper_32_bits(dma_addr); | 63 | ptr->eptr = upper_32_bits(dma_addr); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static void copy_talitos_ptr(struct talitos_ptr *dst_ptr, | ||
| 67 | struct talitos_ptr *src_ptr, bool is_sec1) | ||
| 68 | { | ||
| 69 | dst_ptr->ptr = src_ptr->ptr; | ||
| 70 | if (!is_sec1) | ||
| 71 | dst_ptr->eptr = src_ptr->eptr; | ||
| 72 | } | ||
| 73 | |||
| 66 | static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len, | 74 | static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len, |
| 67 | bool is_sec1) | 75 | bool is_sec1) |
| 68 | { | 76 | { |
| @@ -1083,21 +1091,20 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 1014 unmodified lines | |||
| 1083 | sg_count = dma_map_sg(dev, areq->src, edesc->src_nents ?: 1, | 1091 | sg_count = dma_map_sg(dev, areq->src, edesc->src_nents ?: 1, |
| 1084 | (areq->src == areq->dst) ? DMA_BIDIRECTIONAL | 1092 | (areq->src == areq->dst) ? DMA_BIDIRECTIONAL |
| 1085 | : DMA_TO_DEVICE); | 1093 | : DMA_TO_DEVICE); |
| 1086 | |||
| 1087 | /* hmac data */ | 1094 | /* hmac data */ |
| 1088 | desc->ptr[1].len = cpu_to_be16(areq->assoclen); | 1095 | desc->ptr[1].len = cpu_to_be16(areq->assoclen); |
| 1089 | if (sg_count > 1 && | 1096 | if (sg_count > 1 && |
| 1090 | (ret = sg_to_link_tbl_offset(areq->src, sg_count, 0, | 1097 | (ret = sg_to_link_tbl_offset(areq->src, sg_count, 0, |
| 1091 | areq->assoclen, | 1098 | areq->assoclen, |
| 1092 | &edesc->link_tbl[tbl_off])) > 1) { | 1099 | &edesc->link_tbl[tbl_off])) > 1) { |
| 1093 | tbl_off += ret; | ||
| 1094 | |||
| 1095 | to_talitos_ptr(&desc->ptr[1], edesc->dma_link_tbl + tbl_off * | 1100 | to_talitos_ptr(&desc->ptr[1], edesc->dma_link_tbl + tbl_off * |
| 1096 | sizeof(struct talitos_ptr), 0); | 1101 | sizeof(struct talitos_ptr), 0); |
| 1097 | desc->ptr[1].j_extent = DESC_PTR_LNKTBL_JUMP; | 1102 | desc->ptr[1].j_extent = DESC_PTR_LNKTBL_JUMP; |
| 1098 | 1103 | ||
| 1099 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, | 1104 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
| 1100 | edesc->dma_len, DMA_BIDIRECTIONAL); | 1105 | edesc->dma_len, DMA_BIDIRECTIONAL); |
| 1106 | |||
| 1107 | tbl_off += ret; | ||
| 1101 | } else { | 1108 | } else { |
| 1102 | to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->src), 0); | 1109 | to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->src), 0); |
| 1103 | desc->ptr[1].j_extent = 0; | 1110 | desc->ptr[1].j_extent = 0; |
| @@ -1126,11 +1133,13 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 22 unmodified lines | |||
| 1126 | if (edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) | 1133 | if (edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) |
| 1127 | sg_link_tbl_len += authsize; | 1134 | sg_link_tbl_len += authsize; |
| 1128 | 1135 | ||
| 1129 | if (sg_count > 1 && | 1136 | if (sg_count == 1) { |
| 1130 | (ret = sg_to_link_tbl_offset(areq->src, sg_count, areq->assoclen, | 1137 | to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->src) + |
| 1131 | sg_link_tbl_len, | 1138 | areq->assoclen, 0); |
| 1132 | &edesc->link_tbl[tbl_off])) > 1) { | 1139 | } else if ((ret = sg_to_link_tbl_offset(areq->src, sg_count, |
| 1133 | tbl_off += ret; | 1140 | areq->assoclen, sg_link_tbl_len, |
| 1141 | &edesc->link_tbl[tbl_off])) > | ||
| 1142 | 1) { | ||
| 1134 | desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; | 1143 | desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; |
| 1135 | to_talitos_ptr(&desc->ptr[4], edesc->dma_link_tbl + | 1144 | to_talitos_ptr(&desc->ptr[4], edesc->dma_link_tbl + |
| 1136 | tbl_off * | 1145 | tbl_off * |
| @@ -1138,8 +1147,10 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 1 unmodified line | |||
| 1138 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, | 1147 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
| 1139 | edesc->dma_len, | 1148 | edesc->dma_len, |
| 1140 | DMA_BIDIRECTIONAL); | 1149 | DMA_BIDIRECTIONAL); |
| 1141 | } else | 1150 | tbl_off += ret; |
| 1142 | to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->src), 0); | 1151 | } else { |
| 1152 | copy_talitos_ptr(&desc->ptr[4], &edesc->link_tbl[tbl_off], 0); | ||
| 1153 | } | ||
| 1143 | 1154 | ||
| 1144 | /* cipher out */ | 1155 | /* cipher out */ |
| 1145 | desc->ptr[5].len = cpu_to_be16(cryptlen); | 1156 | desc->ptr[5].len = cpu_to_be16(cryptlen); |
| @@ -1151,11 +1162,13 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 5 unmodified lines | |||
| 1151 | 1162 | ||
| 1152 | edesc->icv_ool = false; | 1163 | edesc->icv_ool = false; |
| 1153 | 1164 | ||
| 1154 | if (sg_count > 1 && | 1165 | if (sg_count == 1) { |
| 1155 | (sg_count = sg_to_link_tbl_offset(areq->dst, sg_count, | 1166 | to_talitos_ptr(&desc->ptr[5], sg_dma_address(areq->dst) + |
| 1167 | areq->assoclen, 0); | ||
| 1168 | } else if ((sg_count = | ||
| 1169 | sg_to_link_tbl_offset(areq->dst, sg_count, | ||
| 1156 | areq->assoclen, cryptlen, | 1170 | areq->assoclen, cryptlen, |
| 1157 | &edesc->link_tbl[tbl_off])) > | 1171 | &edesc->link_tbl[tbl_off])) > 1) { |
| 1158 | 1) { | ||
| 1159 | struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; | 1172 | struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; |
| 1160 | 1173 | ||
| 1161 | to_talitos_ptr(&desc->ptr[5], edesc->dma_link_tbl + | 1174 | to_talitos_ptr(&desc->ptr[5], edesc->dma_link_tbl + |
| @@ -1178,8 +1191,9 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 16 unmodified lines | |||
| 1178 | edesc->dma_len, DMA_BIDIRECTIONAL); | 1191 | edesc->dma_len, DMA_BIDIRECTIONAL); |
| 1179 | 1192 | ||
| 1180 | edesc->icv_ool = true; | 1193 | edesc->icv_ool = true; |
| 1181 | } else | 1194 | } else { |
| 1182 | to_talitos_ptr(&desc->ptr[5], sg_dma_address(areq->dst), 0); | 1195 | copy_talitos_ptr(&desc->ptr[5], &edesc->link_tbl[tbl_off], 0); |
| 1196 | } | ||
| 1183 | 1197 | ||
| 1184 | /* iv out */ | 1198 | /* iv out */ |
| 1185 | map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, | 1199 | map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, |
| @@ -2629,21 +2643,11 @@ struct talitos_crypto_alg { · 1443 unmodified lines | |||
| 2629 | struct talitos_alg_template algt; | 2643 | struct talitos_alg_template algt; |
| 2630 | }; | 2644 | }; |
| 2631 | 2645 | ||
| 2632 | static int talitos_cra_init(struct crypto_tfm *tfm) | 2646 | static int talitos_init_common(struct talitos_ctx *ctx, |
| 2647 | struct talitos_crypto_alg *talitos_alg) | ||
| 2633 | { | 2648 | { |
| 2634 | struct crypto_alg *alg = tfm->__crt_alg; | ||
| 2635 | struct talitos_crypto_alg *talitos_alg; | ||
| 2636 | struct talitos_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 2637 | struct talitos_private *priv; | 2649 | struct talitos_private *priv; |
| 2638 | 2650 | ||
| 2639 | if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_AHASH) | ||
| 2640 | talitos_alg = container_of(__crypto_ahash_alg(alg), | ||
| 2641 | struct talitos_crypto_alg, | ||
| 2642 | algt.alg.hash); | ||
| 2643 | else | ||
| 2644 | talitos_alg = container_of(alg, struct talitos_crypto_alg, | ||
| 2645 | algt.alg.crypto); | ||
| 2646 | |||
| 2647 | /* update context with ptr to dev */ | 2651 | /* update context with ptr to dev */ |
| 2648 | ctx->dev = talitos_alg->dev; | 2652 | ctx->dev = talitos_alg->dev; |
| 2649 | 2653 | ||
| @@ -2661,10 +2665,33 @@ static int talitos_cra_init(struct crypto_tfm *tfm) · 11 unmodified lines | |||
| 2661 | return 0; | 2665 | return 0; |
| 2662 | } | 2666 | } |
| 2663 | 2667 | ||
| 2668 | static int talitos_cra_init(struct crypto_tfm *tfm) | ||
| 2669 | { | ||
| 2670 | struct crypto_alg *alg = tfm->__crt_alg; | ||
| 2671 | struct talitos_crypto_alg *talitos_alg; | ||
| 2672 | struct talitos_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 2673 | |||
| 2674 | if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_AHASH) | ||
| 2675 | talitos_alg = container_of(__crypto_ahash_alg(alg), | ||
| 2676 | struct talitos_crypto_alg, | ||
| 2677 | algt.alg.hash); | ||
| 2678 | else | ||
| 2679 | talitos_alg = container_of(alg, struct talitos_crypto_alg, | ||
| 2680 | algt.alg.crypto); | ||
| 2681 | |||
| 2682 | return talitos_init_common(ctx, talitos_alg); | ||
| 2683 | } | ||
| 2684 | |||
| 2664 | static int talitos_cra_init_aead(struct crypto_aead *tfm) | 2685 | static int talitos_cra_init_aead(struct crypto_aead *tfm) |
| 2665 | { | 2686 | { |
| 2666 | talitos_cra_init(crypto_aead_tfm(tfm)); | 2687 | struct aead_alg *alg = crypto_aead_alg(tfm); |
| 2667 | return 0; | 2688 | struct talitos_crypto_alg *talitos_alg; |
| 2689 | struct talitos_ctx *ctx = crypto_aead_ctx(tfm); | ||
| 2690 | |||
| 2691 | talitos_alg = container_of(alg, struct talitos_crypto_alg, | ||
| 2692 | algt.alg.aead); | ||
| 2693 | |||
| 2694 | return talitos_init_common(ctx, talitos_alg); | ||
| 2668 | } | 2695 | } |
| 2669 | 2696 | ||
| 2670 | static int talitos_cra_init_ahash(struct crypto_tfm *tfm) | 2697 | static int talitos_cra_init_ahash(struct crypto_tfm *tfm) |
| @@ -362,6 +362,7 @@ struct sbridge_pvt { · 361 unmodified lines | |||
| 362 | 362 | ||
| 363 | /* Memory type detection */ | 363 | /* Memory type detection */ |
| 364 | bool is_mirrored, is_lockstep, is_close_pg; | 364 | bool is_mirrored, is_lockstep, is_close_pg; |
| 365 | bool is_chan_hash; | ||
| 365 | 366 | ||
| 366 | /* Fifo double buffers */ | 367 | /* Fifo double buffers */ |
| 367 | struct mce mce_entry[MCE_LOG_LEN]; | 368 | struct mce mce_entry[MCE_LOG_LEN]; |
| @@ -1060,6 +1061,20 @@ static inline u8 sad_pkg_ha(u8 pkg) · 692 unmodified lines | |||
| 1060 | return (pkg >> 2) & 0x1; | 1061 | return (pkg >> 2) & 0x1; |
| 1061 | } | 1062 | } |
| 1062 | 1063 | ||
| 1064 | static int haswell_chan_hash(int idx, u64 addr) | ||
| 1065 | { | ||
| 1066 | int i; | ||
| 1067 | |||
| 1068 | /* | ||
| 1069 | * XOR even bits from 12:26 to bit0 of idx, | ||
| 1070 | * odd bits from 13:27 to bit1 | ||
| 1071 | */ | ||
| 1072 | for (i = 12; i < 28; i += 2) | ||
| 1073 | idx ^= (addr >> i) & 3; | ||
| 1074 | |||
| 1075 | return idx; | ||
| 1076 | } | ||
| 1077 | |||
| 1063 | /**************************************************************************** | 1078 | /**************************************************************************** |
| 1064 | Memory check routines | 1079 | Memory check routines |
| 1065 | ****************************************************************************/ | 1080 | ****************************************************************************/ |
| @@ -1616,6 +1631,10 @@ static int get_dimm_config(struct mem_ctl_info *mci) · 550 unmodified lines | |||
| 1616 | KNL_MAX_CHANNELS : NUM_CHANNELS; | 1631 | KNL_MAX_CHANNELS : NUM_CHANNELS; |
| 1617 | u64 knl_mc_sizes[KNL_MAX_CHANNELS]; | 1632 | u64 knl_mc_sizes[KNL_MAX_CHANNELS]; |
| 1618 | 1633 | ||
| 1634 | if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL) { | ||
| 1635 | pci_read_config_dword(pvt->pci_ha0, HASWELL_HASYSDEFEATURE2, ®); | ||
| 1636 | pvt->is_chan_hash = GET_BITFIELD(reg, 21, 21); | ||
| 1637 | } | ||
| 1619 | if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL || | 1638 | if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL || |
| 1620 | pvt->info.type == KNIGHTS_LANDING) | 1639 | pvt->info.type == KNIGHTS_LANDING) |
| 1621 | pci_read_config_dword(pvt->pci_sad1, SAD_TARGET, ®); | 1640 | pci_read_config_dword(pvt->pci_sad1, SAD_TARGET, ®); |
| @@ -2118,12 +2137,15 @@ static int get_memory_error_data(struct mem_ctl_info *mci, · 496 unmodified lines | |||
| 2118 | } | 2137 | } |
| 2119 | 2138 | ||
| 2120 | ch_way = TAD_CH(reg) + 1; | 2139 | ch_way = TAD_CH(reg) + 1; |
| 2121 | sck_way = 1 << TAD_SOCK(reg); | 2140 | sck_way = TAD_SOCK(reg); |
| 2122 | 2141 | ||
| 2123 | if (ch_way == 3) | 2142 | if (ch_way == 3) |
| 2124 | idx = addr >> 6; | 2143 | idx = addr >> 6; |
| 2125 | else | 2144 | else { |
| 2126 | idx = (addr >> (6 + sck_way + shiftup)) & 0x3; | 2145 | idx = (addr >> (6 + sck_way + shiftup)) & 0x3; |
| 2146 | if (pvt->is_chan_hash) | ||
| 2147 | idx = haswell_chan_hash(idx, addr); | ||
| 2148 | } | ||
| 2127 | idx = idx % ch_way; | 2149 | idx = idx % ch_way; |
| 2128 | 2150 | ||
| 2129 | /* | 2151 | /* |
| @@ -2157,7 +2179,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, · 27 unmodified lines | |||
| 2157 | switch(ch_way) { | 2179 | switch(ch_way) { |
| 2158 | case 2: | 2180 | case 2: |
| 2159 | case 4: | 2181 | case 4: |
| 2160 | sck_xch = 1 << sck_way * (ch_way >> 1); | 2182 | sck_xch = (1 << sck_way) * (ch_way >> 1); |
| 2161 | break; | 2183 | break; |
| 2162 | default: | 2184 | default: |
| 2163 | sprintf(msg, "Invalid mirror set. Can't decode addr"); | 2185 | sprintf(msg, "Invalid mirror set. Can't decode addr"); |
| @@ -2193,7 +2215,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, · 29 unmodified lines | |||
| 2193 | 2215 | ||
| 2194 | ch_addr = addr - offset; | 2216 | ch_addr = addr - offset; |
| 2195 | ch_addr >>= (6 + shiftup); | 2217 | ch_addr >>= (6 + shiftup); |
| 2196 | ch_addr /= ch_way * sck_way; | 2218 | ch_addr /= sck_xch; |
| 2197 | ch_addr <<= (6 + shiftup); | 2219 | ch_addr <<= (6 + shiftup); |
| 2198 | ch_addr |= addr & ((1 << (6 + shiftup)) - 1); | 2220 | ch_addr |= addr & ((1 << (6 + shiftup)) - 1); |
| 2199 | 2221 | ||
| @@ -360,7 +360,7 @@ static struct cpuidle_ops psci_cpuidle_ops __initdata = { · 359 unmodified lines | |||
| 360 | .init = psci_dt_cpu_init_idle, | 360 | .init = psci_dt_cpu_init_idle, |
| 361 | }; | 361 | }; |
| 362 | 362 | ||
| 363 | CPUIDLE_METHOD_OF_DECLARE(psci, "arm,psci", &psci_cpuidle_ops); | 363 | CPUIDLE_METHOD_OF_DECLARE(psci, "psci", &psci_cpuidle_ops); |
| 364 | #endif | 364 | #endif |
| 365 | #endif | 365 | #endif |
| 366 | 366 | ||
| @@ -1591,6 +1591,7 @@ struct amdgpu_uvd { · 1590 unmodified lines | |||
| 1591 | struct amdgpu_bo *vcpu_bo; | 1591 | struct amdgpu_bo *vcpu_bo; |
| 1592 | void *cpu_addr; | 1592 | void *cpu_addr; |
| 1593 | uint64_t gpu_addr; | 1593 | uint64_t gpu_addr; |
| 1594 | unsigned fw_version; | ||
| 1594 | void *saved_bo; | 1595 | void *saved_bo; |
| 1595 | atomic_t handles[AMDGPU_MAX_UVD_HANDLES]; | 1596 | atomic_t handles[AMDGPU_MAX_UVD_HANDLES]; |
| 1596 | struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES]; | 1597 | struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES]; |
| @@ -425,6 +425,10 @@ static int acp_resume(void *handle) · 424 unmodified lines | |||
| 425 | struct acp_pm_domain *apd; | 425 | struct acp_pm_domain *apd; |
| 426 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 426 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 427 | 427 | ||
| 428 | /* return early if no ACP */ | ||
| 429 | if (!adev->acp.acp_genpd) | ||
| 430 | return 0; | ||
| 431 | |||
| 428 | /* SMU block will power on ACP irrespective of ACP runtime status. | 432 | /* SMU block will power on ACP irrespective of ACP runtime status. |
| 429 | * Power off explicitly based on genpd ACP runtime status so that ACP | 433 | * Power off explicitly based on genpd ACP runtime status so that ACP |
| 430 | * hw and ACP-genpd status are in sync. | 434 | * hw and ACP-genpd status are in sync. |
| @@ -303,7 +303,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 302 unmodified lines | |||
| 303 | fw_info.feature = adev->vce.fb_version; | 303 | fw_info.feature = adev->vce.fb_version; |
| 304 | break; | 304 | break; |
| 305 | case AMDGPU_INFO_FW_UVD: | 305 | case AMDGPU_INFO_FW_UVD: |
| 306 | fw_info.ver = 0; | 306 | fw_info.ver = adev->uvd.fw_version; |
| 307 | fw_info.feature = 0; | 307 | fw_info.feature = 0; |
| 308 | break; | 308 | break; |
| 309 | case AMDGPU_INFO_FW_GMC: | 309 | case AMDGPU_INFO_FW_GMC: |
| @@ -53,7 +53,7 @@ struct amdgpu_hpd; · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | #define AMDGPU_MAX_HPD_PINS 6 | 54 | #define AMDGPU_MAX_HPD_PINS 6 |
| 55 | #define AMDGPU_MAX_CRTCS 6 | 55 | #define AMDGPU_MAX_CRTCS 6 |
| 56 | #define AMDGPU_MAX_AFMT_BLOCKS 7 | 56 | #define AMDGPU_MAX_AFMT_BLOCKS 9 |
| 57 | 57 | ||
| 58 | enum amdgpu_rmx_type { | 58 | enum amdgpu_rmx_type { |
| 59 | RMX_OFF, | 59 | RMX_OFF, |
| @@ -309,8 +309,8 @@ struct amdgpu_mode_info { · 249 unmodified lines | |||
| 309 | struct atom_context *atom_context; | 309 | struct atom_context *atom_context; |
| 310 | struct card_info *atom_card_info; | 310 | struct card_info *atom_card_info; |
| 311 | bool mode_config_initialized; | 311 | bool mode_config_initialized; |
| 312 | struct amdgpu_crtc *crtcs[6]; | 312 | struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS]; |
| 313 | struct amdgpu_afmt *afmt[7]; | 313 | struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS]; |
| 314 | /* DVI-I properties */ | 314 | /* DVI-I properties */ |
| 315 | struct drm_property *coherent_mode_property; | 315 | struct drm_property *coherent_mode_property; |
| 316 | /* DAC enable load detect */ | 316 | /* DAC enable load detect */ |
| @@ -223,6 +223,8 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) · 222 unmodified lines | |||
| 223 | { | 223 | { |
| 224 | struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo); | 224 | struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo); |
| 225 | 225 | ||
| 226 | if (amdgpu_ttm_tt_get_usermm(bo->ttm)) | ||
| 227 | return -EPERM; | ||
| 226 | return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp); | 228 | return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp); |
| 227 | } | 229 | } |
| 228 | 230 | ||
| @@ -158,6 +158,9 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · 157 unmodified lines | |||
| 158 | DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n", | 158 | DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n", |
| 159 | version_major, version_minor, family_id); | 159 | version_major, version_minor, family_id); |
| 160 | 160 | ||
| 161 | adev->uvd.fw_version = ((version_major << 24) | (version_minor << 16) | | ||
| 162 | (family_id << 8)); | ||
| 163 | |||
| 161 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) | 164 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) |
| 162 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE; | 165 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE; |
| 163 | r = amdgpu_bo_create(adev, bo_size, PAGE_SIZE, true, | 166 | r = amdgpu_bo_create(adev, bo_size, PAGE_SIZE, true, |
| @@ -255,6 +258,8 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev) · 91 unmodified lines | |||
| 255 | if (i == AMDGPU_MAX_UVD_HANDLES) | 258 | if (i == AMDGPU_MAX_UVD_HANDLES) |
| 256 | return 0; | 259 | return 0; |
| 257 | 260 | ||
| 261 | cancel_delayed_work_sync(&adev->uvd.idle_work); | ||
| 262 | |||
| 258 | size = amdgpu_bo_size(adev->uvd.vcpu_bo); | 263 | size = amdgpu_bo_size(adev->uvd.vcpu_bo); |
| 259 | ptr = adev->uvd.cpu_addr; | 264 | ptr = adev->uvd.cpu_addr; |
| 260 | 265 | ||
| @@ -234,6 +234,7 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev) · 233 unmodified lines | |||
| 234 | if (i == AMDGPU_MAX_VCE_HANDLES) | 234 | if (i == AMDGPU_MAX_VCE_HANDLES) |
| 235 | return 0; | 235 | return 0; |
| 236 | 236 | ||
| 237 | cancel_delayed_work_sync(&adev->vce.idle_work); | ||
| 237 | /* TODO: suspending running encoding sessions isn't supported */ | 238 | /* TODO: suspending running encoding sessions isn't supported */ |
| 238 | return -EINVAL; | 239 | return -EINVAL; |
| 239 | } | 240 | } |
| @@ -1672,13 +1672,19 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr, · 1671 unmodified lines | |||
| 1672 | u8 sinks[DRM_DP_MAX_SDP_STREAMS]; | 1672 | u8 sinks[DRM_DP_MAX_SDP_STREAMS]; |
| 1673 | int i; | 1673 | int i; |
| 1674 | 1674 | ||
| 1675 | port = drm_dp_get_validated_port_ref(mgr, port); | ||
| 1676 | if (!port) | ||
| 1677 | return -EINVAL; | ||
| 1678 | |||
| 1675 | port_num = port->port_num; | 1679 | port_num = port->port_num; |
| 1676 | mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); | 1680 | mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); |
| 1677 | if (!mstb) { | 1681 | if (!mstb) { |
| 1678 | mstb = drm_dp_get_last_connected_port_and_mstb(mgr, port->parent, &port_num); | 1682 | mstb = drm_dp_get_last_connected_port_and_mstb(mgr, port->parent, &port_num); |
| 1679 | 1683 | ||
| 1680 | if (!mstb) | 1684 | if (!mstb) { |
| 1685 | drm_dp_put_port(port); | ||
| 1681 | return -EINVAL; | 1686 | return -EINVAL; |
| 1687 | } | ||
| 1682 | } | 1688 | } |
| 1683 | 1689 | ||
| 1684 | txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); | 1690 | txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); |
| @@ -1707,6 +1713,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr, · 22 unmodified lines | |||
| 1707 | kfree(txmsg); | 1713 | kfree(txmsg); |
| 1708 | fail_put: | 1714 | fail_put: |
| 1709 | drm_dp_put_mst_branch_device(mstb); | 1715 | drm_dp_put_mst_branch_device(mstb); |
| 1716 | drm_dp_put_port(port); | ||
| 1710 | return ret; | 1717 | return ret; |
| 1711 | } | 1718 | } |
| 1712 | 1719 | ||
| @@ -2634,8 +2634,9 @@ struct drm_i915_cmd_table { · 2633 unmodified lines | |||
| 2634 | 2634 | ||
| 2635 | /* WaRsDisableCoarsePowerGating:skl,bxt */ | 2635 | /* WaRsDisableCoarsePowerGating:skl,bxt */ |
| 2636 | #define NEEDS_WaRsDisableCoarsePowerGating(dev) (IS_BXT_REVID(dev, 0, BXT_REVID_A1) || \ | 2636 | #define NEEDS_WaRsDisableCoarsePowerGating(dev) (IS_BXT_REVID(dev, 0, BXT_REVID_A1) || \ |
| 2637 | ((IS_SKL_GT3(dev) || IS_SKL_GT4(dev)) && \ | 2637 | IS_SKL_GT3(dev) || \ |
| 2638 | IS_SKL_REVID(dev, 0, SKL_REVID_F0))) | 2638 | IS_SKL_GT4(dev)) |
| 2639 | |||
| 2639 | /* | 2640 | /* |
| 2640 | * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts | 2641 | * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts |
| 2641 | * even when in MSI mode. This results in spurious interrupt warnings if the | 2642 | * even when in MSI mode. This results in spurious interrupt warnings if the |
| @@ -501,19 +501,24 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) · 500 unmodified lines | |||
| 501 | if (pvec != NULL) { | 501 | if (pvec != NULL) { |
| 502 | struct mm_struct *mm = obj->userptr.mm->mm; | 502 | struct mm_struct *mm = obj->userptr.mm->mm; |
| 503 | 503 | ||
| 504 | down_read(&mm->mmap_sem); | 504 | ret = -EFAULT; |
| 505 | while (pinned < npages) { | 505 | if (atomic_inc_not_zero(&mm->mm_users)) { |
| 506 | ret = get_user_pages_remote(work->task, mm, | 506 | down_read(&mm->mmap_sem); |
| 507 | obj->userptr.ptr + pinned * PAGE_SIZE, | 507 | while (pinned < npages) { |
| 508 | npages - pinned, | 508 | ret = get_user_pages_remote |
| 509 | !obj->userptr.read_only, 0, | 509 | (work->task, mm, |
| 510 | pvec + pinned, NULL); | 510 | obj->userptr.ptr + pinned * PAGE_SIZE, |
| 511 | if (ret < 0) | 511 | npages - pinned, |
| 512 | break; | 512 | !obj->userptr.read_only, 0, |
| 513 | 513 | pvec + pinned, NULL); | |
| 514 | pinned += ret; | 514 | if (ret < 0) |
| 515 | break; | ||
| 516 | |||
| 517 | pinned += ret; | ||
| 518 | } | ||
| 519 | up_read(&mm->mmap_sem); | ||
| 520 | mmput(mm); | ||
| 515 | } | 521 | } |
| 516 | up_read(&mm->mmap_sem); | ||
| 517 | } | 522 | } |
| 518 | 523 | ||
| 519 | mutex_lock(&dev->struct_mutex); | 524 | mutex_lock(&dev->struct_mutex); |
| @@ -841,11 +841,11 @@ static int logical_ring_prepare(struct drm_i915_gem_request *req, int bytes) · 840 unmodified lines | |||
| 841 | if (unlikely(total_bytes > remain_usable)) { | 841 | if (unlikely(total_bytes > remain_usable)) { |
| 842 | /* | 842 | /* |
| 843 | * The base request will fit but the reserved space | 843 | * The base request will fit but the reserved space |
| 844 | * falls off the end. So only need to to wait for the | 844 | * falls off the end. So don't need an immediate wrap |
| 845 | * reserved size after flushing out the remainder. | 845 | * and only need to effectively wait for the reserved |
| 846 | * size space from the start of ringbuffer. | ||
| 846 | */ | 847 | */ |
| 847 | wait_bytes = remain_actual + ringbuf->reserved_size; | 848 | wait_bytes = remain_actual + ringbuf->reserved_size; |
| 848 | need_wrap = true; | ||
| 849 | } else if (total_bytes > ringbuf->space) { | 849 | } else if (total_bytes > ringbuf->space) { |
| 850 | /* No wrapping required, just waiting. */ | 850 | /* No wrapping required, just waiting. */ |
| 851 | wait_bytes = total_bytes; | 851 | wait_bytes = total_bytes; |
| @@ -1913,15 +1913,18 @@ static int gen8_emit_request_render(struct drm_i915_gem_request *request) · 1061 unmodified lines | |||
| 1913 | struct intel_ringbuffer *ringbuf = request->ringbuf; | 1913 | struct intel_ringbuffer *ringbuf = request->ringbuf; |
| 1914 | int ret; | 1914 | int ret; |
| 1915 | 1915 | ||
| 1916 | ret = intel_logical_ring_begin(request, 6 + WA_TAIL_DWORDS); | 1916 | ret = intel_logical_ring_begin(request, 8 + WA_TAIL_DWORDS); |
| 1917 | if (ret) | 1917 | if (ret) |
| 1918 | return ret; | 1918 | return ret; |
| 1919 | 1919 | ||
| 1920 | /* We're using qword write, seqno should be aligned to 8 bytes. */ | ||
| 1921 | BUILD_BUG_ON(I915_GEM_HWS_INDEX & 1); | ||
| 1922 | |||
| 1920 | /* w/a for post sync ops following a GPGPU operation we | 1923 | /* w/a for post sync ops following a GPGPU operation we |
| 1921 | * need a prior CS_STALL, which is emitted by the flush | 1924 | * need a prior CS_STALL, which is emitted by the flush |
| 1922 | * following the batch. | 1925 | * following the batch. |
| 1923 | */ | 1926 | */ |
| 1924 | intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(5)); | 1927 | intel_logical_ring_emit(ringbuf, GFX_OP_PIPE_CONTROL(6)); |
| 1925 | intel_logical_ring_emit(ringbuf, | 1928 | intel_logical_ring_emit(ringbuf, |
| 1926 | (PIPE_CONTROL_GLOBAL_GTT_IVB | | 1929 | (PIPE_CONTROL_GLOBAL_GTT_IVB | |
| 1927 | PIPE_CONTROL_CS_STALL | | 1930 | PIPE_CONTROL_CS_STALL | |
| @@ -1929,7 +1932,10 @@ static int gen8_emit_request_render(struct drm_i915_gem_request *request) · 1 unmodified line | |||
| 1929 | intel_logical_ring_emit(ringbuf, hws_seqno_address(request->ring)); | 1932 | intel_logical_ring_emit(ringbuf, hws_seqno_address(request->ring)); |
| 1930 | intel_logical_ring_emit(ringbuf, 0); | 1933 | intel_logical_ring_emit(ringbuf, 0); |
| 1931 | intel_logical_ring_emit(ringbuf, i915_gem_request_get_seqno(request)); | 1934 | intel_logical_ring_emit(ringbuf, i915_gem_request_get_seqno(request)); |
| 1935 | /* We're thrashing one dword of HWS. */ | ||
| 1936 | intel_logical_ring_emit(ringbuf, 0); | ||
| 1932 | intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT); | 1937 | intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT); |
| 1938 | intel_logical_ring_emit(ringbuf, MI_NOOP); | ||
| 1933 | return intel_logical_ring_advance_and_submit(request); | 1939 | return intel_logical_ring_advance_and_submit(request); |
| 1934 | } | 1940 | } |
| 1935 | 1941 | ||
| @@ -2876,25 +2876,28 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate, · 2875 unmodified lines | |||
| 2876 | const struct drm_plane_state *pstate, | 2876 | const struct drm_plane_state *pstate, |
| 2877 | int y) | 2877 | int y) |
| 2878 | { | 2878 | { |
| 2879 | struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc); | 2879 | struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate); |
| 2880 | struct drm_framebuffer *fb = pstate->fb; | 2880 | struct drm_framebuffer *fb = pstate->fb; |
| 2881 | uint32_t width = 0, height = 0; | ||
| 2882 | |||
| 2883 | width = drm_rect_width(&intel_pstate->src) >> 16; | ||
| 2884 | height = drm_rect_height(&intel_pstate->src) >> 16; | ||
| 2885 | |||
| 2886 | if (intel_rotation_90_or_270(pstate->rotation)) | ||
| 2887 | swap(width, height); | ||
| 2881 | 2888 | ||
| 2882 | /* for planar format */ | 2889 | /* for planar format */ |
| 2883 | if (fb->pixel_format == DRM_FORMAT_NV12) { | 2890 | if (fb->pixel_format == DRM_FORMAT_NV12) { |
| 2884 | if (y) /* y-plane data rate */ | 2891 | if (y) /* y-plane data rate */ |
| 2885 | return intel_crtc->config->pipe_src_w * | 2892 | return width * height * |
| 2886 | intel_crtc->config->pipe_src_h * | ||
| 2887 | drm_format_plane_cpp(fb->pixel_format, 0); | 2893 | drm_format_plane_cpp(fb->pixel_format, 0); |
| 2888 | else /* uv-plane data rate */ | 2894 | else /* uv-plane data rate */ |
| 2889 | return (intel_crtc->config->pipe_src_w/2) * | 2895 | return (width / 2) * (height / 2) * |
| 2890 | (intel_crtc->config->pipe_src_h/2) * | ||
| 2891 | drm_format_plane_cpp(fb->pixel_format, 1); | 2896 | drm_format_plane_cpp(fb->pixel_format, 1); |
| 2892 | } | 2897 | } |
| 2893 | 2898 | ||
| 2894 | /* for packed formats */ | 2899 | /* for packed formats */ |
| 2895 | return intel_crtc->config->pipe_src_w * | 2900 | return width * height * drm_format_plane_cpp(fb->pixel_format, 0); |
| 2896 | intel_crtc->config->pipe_src_h * | ||
| 2897 | drm_format_plane_cpp(fb->pixel_format, 0); | ||
| 2898 | } | 2901 | } |
| 2899 | 2902 | ||
| 2900 | /* | 2903 | /* |
| @@ -2973,8 +2976,9 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, · 72 unmodified lines | |||
| 2973 | struct drm_framebuffer *fb = plane->state->fb; | 2976 | struct drm_framebuffer *fb = plane->state->fb; |
| 2974 | int id = skl_wm_plane_id(intel_plane); | 2977 | int id = skl_wm_plane_id(intel_plane); |
| 2975 | 2978 | ||
| 2976 | if (fb == NULL) | 2979 | if (!to_intel_plane_state(plane->state)->visible) |
| 2977 | continue; | 2980 | continue; |
| 2981 | |||
| 2978 | if (plane->type == DRM_PLANE_TYPE_CURSOR) | 2982 | if (plane->type == DRM_PLANE_TYPE_CURSOR) |
| 2979 | continue; | 2983 | continue; |
| 2980 | 2984 | ||
| @@ -3000,7 +3004,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, · 19 unmodified lines | |||
| 3000 | uint16_t plane_blocks, y_plane_blocks = 0; | 3004 | uint16_t plane_blocks, y_plane_blocks = 0; |
| 3001 | int id = skl_wm_plane_id(intel_plane); | 3005 | int id = skl_wm_plane_id(intel_plane); |
| 3002 | 3006 | ||
| 3003 | if (pstate->fb == NULL) | 3007 | if (!to_intel_plane_state(pstate)->visible) |
| 3004 | continue; | 3008 | continue; |
| 3005 | if (plane->type == DRM_PLANE_TYPE_CURSOR) | 3009 | if (plane->type == DRM_PLANE_TYPE_CURSOR) |
| 3006 | continue; | 3010 | continue; |
| @@ -3123,26 +3127,36 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv, · 116 unmodified lines | |||
| 3123 | { | 3127 | { |
| 3124 | struct drm_plane *plane = &intel_plane->base; | 3128 | struct drm_plane *plane = &intel_plane->base; |
| 3125 | struct drm_framebuffer *fb = plane->state->fb; | 3129 | struct drm_framebuffer *fb = plane->state->fb; |
| 3130 | struct intel_plane_state *intel_pstate = | ||
| 3131 | to_intel_plane_state(plane->state); | ||
| 3126 | uint32_t latency = dev_priv->wm.skl_latency[level]; | 3132 | uint32_t latency = dev_priv->wm.skl_latency[level]; |
| 3127 | uint32_t method1, method2; | 3133 | uint32_t method1, method2; |
| 3128 | uint32_t plane_bytes_per_line, plane_blocks_per_line; | 3134 | uint32_t plane_bytes_per_line, plane_blocks_per_line; |
| 3129 | uint32_t res_blocks, res_lines; | 3135 | uint32_t res_blocks, res_lines; |
| 3130 | uint32_t selected_result; | 3136 | uint32_t selected_result; |
| 3131 | uint8_t cpp; | 3137 | uint8_t cpp; |
| 3138 | uint32_t width = 0, height = 0; | ||
| 3132 | 3139 | ||
| 3133 | if (latency == 0 || !cstate->base.active || !fb) | 3140 | if (latency == 0 || !cstate->base.active || !intel_pstate->visible) |
| 3134 | return false; | 3141 | return false; |
| 3135 | 3142 | ||
| 3143 | width = drm_rect_width(&intel_pstate->src) >> 16; | ||
| 3144 | height = drm_rect_height(&intel_pstate->src) >> 16; | ||
| 3145 | |||
| 3146 | if (intel_rotation_90_or_270(plane->state->rotation)) | ||
| 3147 | swap(width, height); | ||
| 3148 | |||
| 3136 | cpp = drm_format_plane_cpp(fb->pixel_format, 0); | 3149 | cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
| 3137 | method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate), | 3150 | method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate), |
| 3138 | cpp, latency); | 3151 | cpp, latency); |
| 3139 | method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate), | 3152 | method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate), |
| 3140 | cstate->base.adjusted_mode.crtc_htotal, | 3153 | cstate->base.adjusted_mode.crtc_htotal, |
| 3141 | cstate->pipe_src_w, | 3154 | width, |
| 3142 | cpp, fb->modifier[0], | 3155 | cpp, |
| 3156 | fb->modifier[0], | ||
| 3143 | latency); | 3157 | latency); |
| 3144 | 3158 | ||
| 3145 | plane_bytes_per_line = cstate->pipe_src_w * cpp; | 3159 | plane_bytes_per_line = width * cpp; |
| 3146 | plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512); | 3160 | plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512); |
| 3147 | 3161 | ||
| 3148 | if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || | 3162 | if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || |
| @@ -968,7 +968,7 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring) · 967 unmodified lines | |||
| 968 | 968 | ||
| 969 | /* WaForceContextSaveRestoreNonCoherent:skl,bxt */ | 969 | /* WaForceContextSaveRestoreNonCoherent:skl,bxt */ |
| 970 | tmp = HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT; | 970 | tmp = HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT; |
| 971 | if (IS_SKL_REVID(dev, SKL_REVID_F0, SKL_REVID_F0) || | 971 | if (IS_SKL_REVID(dev, SKL_REVID_F0, REVID_FOREVER) || |
| 972 | IS_BXT_REVID(dev, BXT_REVID_B0, REVID_FOREVER)) | 972 | IS_BXT_REVID(dev, BXT_REVID_B0, REVID_FOREVER)) |
| 973 | tmp |= HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE; | 973 | tmp |= HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE; |
| 974 | WA_SET_BIT_MASKED(HDC_CHICKEN0, tmp); | 974 | WA_SET_BIT_MASKED(HDC_CHICKEN0, tmp); |
| @@ -1085,7 +1085,8 @@ static int skl_init_workarounds(struct intel_engine_cs *ring) · 110 unmodified lines | |||
| 1085 | WA_SET_BIT_MASKED(HIZ_CHICKEN, | 1085 | WA_SET_BIT_MASKED(HIZ_CHICKEN, |
| 1086 | BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE); | 1086 | BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE); |
| 1087 | 1087 | ||
| 1088 | if (IS_SKL_REVID(dev, 0, SKL_REVID_F0)) { | 1088 | /* This is tied to WaForceContextSaveRestoreNonCoherent */ |
| 1089 | if (IS_SKL_REVID(dev, 0, REVID_FOREVER)) { | ||
| 1089 | /* | 1090 | /* |
| 1090 | *Use Force Non-Coherent whenever executing a 3D context. This | 1091 | *Use Force Non-Coherent whenever executing a 3D context. This |
| 1091 | * is a workaround for a possible hang in the unlikely event | 1092 | * is a workaround for a possible hang in the unlikely event |
| @@ -2090,10 +2091,12 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, · 998 unmodified lines | |||
| 2090 | { | 2091 | { |
| 2091 | struct drm_i915_private *dev_priv = to_i915(dev); | 2092 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 2092 | struct drm_i915_gem_object *obj = ringbuf->obj; | 2093 | struct drm_i915_gem_object *obj = ringbuf->obj; |
| 2094 | /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ | ||
| 2095 | unsigned flags = PIN_OFFSET_BIAS | 4096; | ||
| 2093 | int ret; | 2096 | int ret; |
| 2094 | 2097 | ||
| 2095 | if (HAS_LLC(dev_priv) && !obj->stolen) { | 2098 | if (HAS_LLC(dev_priv) && !obj->stolen) { |
| 2096 | ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, 0); | 2099 | ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, flags); |
| 2097 | if (ret) | 2100 | if (ret) |
| 2098 | return ret; | 2101 | return ret; |
| 2099 | 2102 | ||
| @@ -2109,7 +2112,8 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, · 9 unmodified lines | |||
| 2109 | return -ENOMEM; | 2112 | return -ENOMEM; |
| 2110 | } | 2113 | } |
| 2111 | } else { | 2114 | } else { |
| 2112 | ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, PIN_MAPPABLE); | 2115 | ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, |
| 2116 | flags | PIN_MAPPABLE); | ||
| 2113 | if (ret) | 2117 | if (ret) |
| 2114 | return ret; | 2118 | return ret; |
| 2115 | 2119 | ||
| @@ -2454,11 +2458,11 @@ static int __intel_ring_prepare(struct intel_engine_cs *ring, int bytes) · 338 unmodified lines | |||
| 2454 | if (unlikely(total_bytes > remain_usable)) { | 2458 | if (unlikely(total_bytes > remain_usable)) { |
| 2455 | /* | 2459 | /* |
| 2456 | * The base request will fit but the reserved space | 2460 | * The base request will fit but the reserved space |
| 2457 | * falls off the end. So only need to to wait for the | 2461 | * falls off the end. So don't need an immediate wrap |
| 2458 | * reserved size after flushing out the remainder. | 2462 | * and only need to effectively wait for the reserved |
| 2463 | * size space from the start of ringbuffer. | ||
| 2459 | */ | 2464 | */ |
| 2460 | wait_bytes = remain_actual + ringbuf->reserved_size; | 2465 | wait_bytes = remain_actual + ringbuf->reserved_size; |
| 2461 | need_wrap = true; | ||
| 2462 | } else if (total_bytes > ringbuf->space) { | 2466 | } else if (total_bytes > ringbuf->space) { |
| 2463 | /* No wrapping required, just waiting. */ | 2467 | /* No wrapping required, just waiting. */ |
| 2464 | wait_bytes = total_bytes; | 2468 | wait_bytes = total_bytes; |
| @@ -1189,7 +1189,11 @@ static void intel_uncore_fw_domains_init(struct drm_device *dev) · 1188 unmodified lines | |||
| 1189 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { | 1189 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { |
| 1190 | dev_priv->uncore.funcs.force_wake_get = | 1190 | dev_priv->uncore.funcs.force_wake_get = |
| 1191 | fw_domains_get_with_thread_status; | 1191 | fw_domains_get_with_thread_status; |
| 1192 | dev_priv->uncore.funcs.force_wake_put = fw_domains_put; | 1192 | if (IS_HASWELL(dev)) |
| 1193 | dev_priv->uncore.funcs.force_wake_put = | ||
| 1194 | fw_domains_put_with_fifo; | ||
| 1195 | else | ||
| 1196 | dev_priv->uncore.funcs.force_wake_put = fw_domains_put; | ||
| 1193 | fw_domain_init(dev_priv, FW_DOMAIN_ID_RENDER, | 1197 | fw_domain_init(dev_priv, FW_DOMAIN_ID_RENDER, |
| 1194 | FORCEWAKE_MT, FORCEWAKE_ACK_HSW); | 1198 | FORCEWAKE_MT, FORCEWAKE_ACK_HSW); |
| 1195 | } else if (IS_IVYBRIDGE(dev)) { | 1199 | } else if (IS_IVYBRIDGE(dev)) { |
| @@ -1276,18 +1276,18 @@ nouveau_connector_create(struct drm_device *dev, int index) · 1275 unmodified lines | |||
| 1276 | break; | 1276 | break; |
| 1277 | default: | 1277 | default: |
| 1278 | if (disp->dithering_mode) { | 1278 | if (disp->dithering_mode) { |
| 1279 | nv_connector->dithering_mode = DITHERING_MODE_AUTO; | ||
| 1279 | drm_object_attach_property(&connector->base, | 1280 | drm_object_attach_property(&connector->base, |
| 1280 | disp->dithering_mode, | 1281 | disp->dithering_mode, |
| 1281 | nv_connector-> | 1282 | nv_connector-> |
| 1282 | dithering_mode); | 1283 | dithering_mode); |
| 1283 | nv_connector->dithering_mode = DITHERING_MODE_AUTO; | ||
| 1284 | } | 1284 | } |
| 1285 | if (disp->dithering_depth) { | 1285 | if (disp->dithering_depth) { |
| 1286 | nv_connector->dithering_depth = DITHERING_DEPTH_AUTO; | ||
| 1286 | drm_object_attach_property(&connector->base, | 1287 | drm_object_attach_property(&connector->base, |
| 1287 | disp->dithering_depth, | 1288 | disp->dithering_depth, |
| 1288 | nv_connector-> | 1289 | nv_connector-> |
| 1289 | dithering_depth); | 1290 | dithering_depth); |
| 1290 | nv_connector->dithering_depth = DITHERING_DEPTH_AUTO; | ||
| 1291 | } | 1291 | } |
| 1292 | break; | 1292 | break; |
| 1293 | } | 1293 | } |
| @@ -1832,6 +1832,8 @@ gf100_gr_init(struct gf100_gr *gr) · 1831 unmodified lines | |||
| 1832 | 1832 | ||
| 1833 | gf100_gr_mmio(gr, gr->func->mmio); | 1833 | gf100_gr_mmio(gr, gr->func->mmio); |
| 1834 | 1834 | ||
| 1835 | nvkm_mask(device, TPC_UNIT(0, 0, 0x05c), 0x00000001, 0x00000001); | ||
| 1836 | |||
| 1835 | memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr)); | 1837 | memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr)); |
| 1836 | for (i = 0, gpc = -1; i < gr->tpc_total; i++) { | 1838 | for (i = 0, gpc = -1; i < gr->tpc_total; i++) { |
| 1837 | do { | 1839 | do { |
| @@ -62,10 +62,6 @@ bool radeon_has_atpx(void) { · 61 unmodified lines | |||
| 62 | return radeon_atpx_priv.atpx_detected; | 62 | return radeon_atpx_priv.atpx_detected; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | bool radeon_has_atpx_dgpu_power_cntl(void) { | ||
| 66 | return radeon_atpx_priv.atpx.functions.power_cntl; | ||
| 67 | } | ||
| 68 | |||
| 69 | /** | 65 | /** |
| 70 | * radeon_atpx_call - call an ATPX method | 66 | * radeon_atpx_call - call an ATPX method |
| 71 | * | 67 | * |
| @@ -145,6 +141,13 @@ static void radeon_atpx_parse_functions(struct radeon_atpx_functions *f, u32 mas · 73 unmodified lines | |||
| 145 | */ | 141 | */ |
| 146 | static int radeon_atpx_validate(struct radeon_atpx *atpx) | 142 | static int radeon_atpx_validate(struct radeon_atpx *atpx) |
| 147 | { | 143 | { |
| 144 | /* make sure required functions are enabled */ | ||
| 145 | /* dGPU power control is required */ | ||
| 146 | if (atpx->functions.power_cntl == false) { | ||
| 147 | printk("ATPX dGPU power cntl not present, forcing\n"); | ||
| 148 | atpx->functions.power_cntl = true; | ||
| 149 | } | ||
| 150 | |||
| 148 | if (atpx->functions.px_params) { | 151 | if (atpx->functions.px_params) { |
| 149 | union acpi_object *info; | 152 | union acpi_object *info; |
| 150 | struct atpx_px_params output; | 153 | struct atpx_px_params output; |
| @@ -2002,10 +2002,12 @@ radeon_add_atom_connector(struct drm_device *dev, · 2001 unmodified lines | |||
| 2002 | rdev->mode_info.dither_property, | 2002 | rdev->mode_info.dither_property, |
| 2003 | RADEON_FMT_DITHER_DISABLE); | 2003 | RADEON_FMT_DITHER_DISABLE); |
| 2004 | 2004 | ||
| 2005 | if (radeon_audio != 0) | 2005 | if (radeon_audio != 0) { |
| 2006 | drm_object_attach_property(&radeon_connector->base.base, | 2006 | drm_object_attach_property(&radeon_connector->base.base, |
| 2007 | rdev->mode_info.audio_property, | 2007 | rdev->mode_info.audio_property, |
| 2008 | RADEON_AUDIO_AUTO); | 2008 | RADEON_AUDIO_AUTO); |
| 2009 | radeon_connector->audio = RADEON_AUDIO_AUTO; | ||
| 2010 | } | ||
| 2009 | if (ASIC_IS_DCE5(rdev)) | 2011 | if (ASIC_IS_DCE5(rdev)) |
| 2010 | drm_object_attach_property(&radeon_connector->base.base, | 2012 | drm_object_attach_property(&radeon_connector->base.base, |
| 2011 | rdev->mode_info.output_csc_property, | 2013 | rdev->mode_info.output_csc_property, |
| @@ -2130,6 +2132,7 @@ radeon_add_atom_connector(struct drm_device *dev, · 118 unmodified lines | |||
| 2130 | drm_object_attach_property(&radeon_connector->base.base, | 2132 | drm_object_attach_property(&radeon_connector->base.base, |
| 2131 | rdev->mode_info.audio_property, | 2133 | rdev->mode_info.audio_property, |
| 2132 | RADEON_AUDIO_AUTO); | 2134 | RADEON_AUDIO_AUTO); |
| 2135 | radeon_connector->audio = RADEON_AUDIO_AUTO; | ||
| 2133 | } | 2136 | } |
| 2134 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | 2137 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
| 2135 | radeon_connector->dac_load_detect = true; | 2138 | radeon_connector->dac_load_detect = true; |
| @@ -2185,6 +2188,7 @@ radeon_add_atom_connector(struct drm_device *dev, · 49 unmodified lines | |||
| 2185 | drm_object_attach_property(&radeon_connector->base.base, | 2188 | drm_object_attach_property(&radeon_connector->base.base, |
| 2186 | rdev->mode_info.audio_property, | 2189 | rdev->mode_info.audio_property, |
| 2187 | RADEON_AUDIO_AUTO); | 2190 | RADEON_AUDIO_AUTO); |
| 2191 | radeon_connector->audio = RADEON_AUDIO_AUTO; | ||
| 2188 | } | 2192 | } |
| 2189 | if (ASIC_IS_DCE5(rdev)) | 2193 | if (ASIC_IS_DCE5(rdev)) |
| 2190 | drm_object_attach_property(&radeon_connector->base.base, | 2194 | drm_object_attach_property(&radeon_connector->base.base, |
| @@ -2237,6 +2241,7 @@ radeon_add_atom_connector(struct drm_device *dev, · 46 unmodified lines | |||
| 2237 | drm_object_attach_property(&radeon_connector->base.base, | 2241 | drm_object_attach_property(&radeon_connector->base.base, |
| 2238 | rdev->mode_info.audio_property, | 2242 | rdev->mode_info.audio_property, |
| 2239 | RADEON_AUDIO_AUTO); | 2243 | RADEON_AUDIO_AUTO); |
| 2244 | radeon_connector->audio = RADEON_AUDIO_AUTO; | ||
| 2240 | } | 2245 | } |
| 2241 | if (ASIC_IS_DCE5(rdev)) | 2246 | if (ASIC_IS_DCE5(rdev)) |
| 2242 | drm_object_attach_property(&radeon_connector->base.base, | 2247 | drm_object_attach_property(&radeon_connector->base.base, |
| @@ -103,12 +103,6 @@ static const char radeon_family_name[][16] = { · 102 unmodified lines | |||
| 103 | "LAST", | 103 | "LAST", |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
| 107 | bool radeon_has_atpx_dgpu_power_cntl(void); | ||
| 108 | #else | ||
| 109 | static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; } | ||
| 110 | #endif | ||
| 111 | |||
| 112 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) | 106 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) |
| 113 | #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1) | 107 | #define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1) |
| 114 | 108 | ||
| @@ -1305,9 +1299,9 @@ int radeon_device_init(struct radeon_device *rdev, · 1190 unmodified lines | |||
| 1305 | } | 1299 | } |
| 1306 | rdev->fence_context = fence_context_alloc(RADEON_NUM_RINGS); | 1300 | rdev->fence_context = fence_context_alloc(RADEON_NUM_RINGS); |
| 1307 | 1301 | ||
| 1308 | DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X).\n", | 1302 | DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X 0x%02X).\n", |
| 1309 | radeon_family_name[rdev->family], pdev->vendor, pdev->device, | 1303 | radeon_family_name[rdev->family], pdev->vendor, pdev->device, |
| 1310 | pdev->subsystem_vendor, pdev->subsystem_device); | 1304 | pdev->subsystem_vendor, pdev->subsystem_device, pdev->revision); |
| 1311 | 1305 | ||
| 1312 | /* mutex initialization are all done here so we | 1306 | /* mutex initialization are all done here so we |
| 1313 | * can recall function without having locking issues */ | 1307 | * can recall function without having locking issues */ |
| @@ -1439,7 +1433,7 @@ int radeon_device_init(struct radeon_device *rdev, · 125 unmodified lines | |||
| 1439 | * ignore it */ | 1433 | * ignore it */ |
| 1440 | vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); | 1434 | vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); |
| 1441 | 1435 | ||
| 1442 | if ((rdev->flags & RADEON_IS_PX) && radeon_has_atpx_dgpu_power_cntl()) | 1436 | if (rdev->flags & RADEON_IS_PX) |
| 1443 | runtime = true; | 1437 | runtime = true; |
| 1444 | vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); | 1438 | vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); |
| 1445 | if (runtime) | 1439 | if (runtime) |
| @@ -235,6 +235,8 @@ static int radeon_verify_access(struct ttm_buffer_object *bo, struct file *filp) · 234 unmodified lines | |||
| 235 | { | 235 | { |
| 236 | struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo); | 236 | struct radeon_bo *rbo = container_of(bo, struct radeon_bo, tbo); |
| 237 | 237 | ||
| 238 | if (radeon_ttm_tt_has_userptr(bo->ttm)) | ||
| 239 | return -EPERM; | ||
| 238 | return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp); | 240 | return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp); |
| 239 | } | 241 | } |
| 240 | 242 | ||
| @@ -2931,6 +2931,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { · 2930 unmodified lines | |||
| 2931 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 }, | 2931 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 }, |
| 2932 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, | 2932 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, |
| 2933 | { PCI_VENDOR_ID_ATI, 0x6811, 0x148c, 0x2015, 0, 120000 }, | 2933 | { PCI_VENDOR_ID_ATI, 0x6811, 0x148c, 0x2015, 0, 120000 }, |
| 2934 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1682, 0x9275, 0, 120000 }, | ||
| 2934 | { 0, 0, 0, 0 }, | 2935 | { 0, 0, 0, 0 }, |
| 2935 | }; | 2936 | }; |
| 2936 | 2937 | ||
| @@ -671,8 +671,8 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port, · 670 unmodified lines | |||
| 671 | struct mlx5_ib_dev *dev = to_mdev(ibdev); | 671 | struct mlx5_ib_dev *dev = to_mdev(ibdev); |
| 672 | struct mlx5_core_dev *mdev = dev->mdev; | 672 | struct mlx5_core_dev *mdev = dev->mdev; |
| 673 | struct mlx5_hca_vport_context *rep; | 673 | struct mlx5_hca_vport_context *rep; |
| 674 | int max_mtu; | 674 | u16 max_mtu; |
| 675 | int oper_mtu; | 675 | u16 oper_mtu; |
| 676 | int err; | 676 | int err; |
| 677 | u8 ib_link_width_oper; | 677 | u8 ib_link_width_oper; |
| 678 | u8 vl_hw_cap; | 678 | u8 vl_hw_cap; |
| @@ -153,6 +153,7 @@ static const struct xpad_device { · 152 unmodified lines | |||
| 153 | { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 153 | { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 154 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 154 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 155 | { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, | 155 | { 0x0738, 0x4740, "Mad Catz Beat Pad", 0, XTYPE_XBOX360 }, |
| 156 | { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, | ||
| 156 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 157 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
| 157 | { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, | 158 | { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, |
| 158 | { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 }, | 159 | { 0x0738, 0xbeef, "Mad Catz JOYTECH NEO SE Advanced GamePad", XTYPE_XBOX360 }, |
| @@ -304,6 +305,7 @@ static struct usb_device_id xpad_table[] = { · 145 unmodified lines | |||
| 304 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ | 305 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ |
| 305 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ | 306 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ |
| 306 | { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ | 307 | { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ |
| 308 | XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ | ||
| 307 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ | 309 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ |
| 308 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ | 310 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 309 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ | 311 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
| @@ -178,7 +178,6 @@ static int arizona_haptics_probe(struct platform_device *pdev) · 177 unmodified lines | |||
| 178 | input_set_drvdata(haptics->input_dev, haptics); | 178 | input_set_drvdata(haptics->input_dev, haptics); |
| 179 | 179 | ||
| 180 | haptics->input_dev->name = "arizona:haptics"; | 180 | haptics->input_dev->name = "arizona:haptics"; |
| 181 | haptics->input_dev->dev.parent = pdev->dev.parent; | ||
| 182 | haptics->input_dev->close = arizona_haptics_close; | 181 | haptics->input_dev->close = arizona_haptics_close; |
| 183 | __set_bit(FF_RUMBLE, haptics->input_dev->ffbit); | 182 | __set_bit(FF_RUMBLE, haptics->input_dev->ffbit); |
| 184 | 183 | ||
| @@ -353,7 +353,8 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) · 352 unmodified lines | |||
| 353 | if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) | 353 | if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) |
| 354 | kpd_delay = 15625; | 354 | kpd_delay = 15625; |
| 355 | 355 | ||
| 356 | if (kpd_delay > 62500 || kpd_delay == 0) { | 356 | /* Valid range of pwr key trigger delay is 1/64 sec to 2 seconds. */ |
| 357 | if (kpd_delay > USEC_PER_SEC * 2 || kpd_delay < USEC_PER_SEC / 64) { | ||
| 357 | dev_err(&pdev->dev, "invalid power key trigger delay\n"); | 358 | dev_err(&pdev->dev, "invalid power key trigger delay\n"); |
| 358 | return -EINVAL; | 359 | return -EINVAL; |
| 359 | } | 360 | } |
| @@ -385,8 +386,8 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) · 25 unmodified lines | |||
| 385 | pwr->name = "pmic8xxx_pwrkey"; | 386 | pwr->name = "pmic8xxx_pwrkey"; |
| 386 | pwr->phys = "pmic8xxx_pwrkey/input0"; | 387 | pwr->phys = "pmic8xxx_pwrkey/input0"; |
| 387 | 388 | ||
| 388 | delay = (kpd_delay << 10) / USEC_PER_SEC; | 389 | delay = (kpd_delay << 6) / USEC_PER_SEC; |
| 389 | delay = 1 + ilog2(delay); | 390 | delay = ilog2(delay); |
| 390 | 391 | ||
| 391 | err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); | 392 | err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); |
| 392 | if (err < 0) { | 393 | if (err < 0) { |
| @@ -222,7 +222,6 @@ static int twl4030_vibra_probe(struct platform_device *pdev) · 221 unmodified lines | |||
| 222 | 222 | ||
| 223 | info->input_dev->name = "twl4030:vibrator"; | 223 | info->input_dev->name = "twl4030:vibrator"; |
| 224 | info->input_dev->id.version = 1; | 224 | info->input_dev->id.version = 1; |
| 225 | info->input_dev->dev.parent = pdev->dev.parent; | ||
| 226 | info->input_dev->close = twl4030_vibra_close; | 225 | info->input_dev->close = twl4030_vibra_close; |
| 227 | __set_bit(FF_RUMBLE, info->input_dev->ffbit); | 226 | __set_bit(FF_RUMBLE, info->input_dev->ffbit); |
| 228 | 227 | ||
| @@ -45,7 +45,6 @@ · 44 unmodified lines | |||
| 45 | struct vibra_info { | 45 | struct vibra_info { |
| 46 | struct device *dev; | 46 | struct device *dev; |
| 47 | struct input_dev *input_dev; | 47 | struct input_dev *input_dev; |
| 48 | struct workqueue_struct *workqueue; | ||
| 49 | struct work_struct play_work; | 48 | struct work_struct play_work; |
| 50 | struct mutex mutex; | 49 | struct mutex mutex; |
| 51 | int irq; | 50 | int irq; |
| @@ -213,11 +212,7 @@ static int vibra_play(struct input_dev *input, void *data, · 161 unmodified lines | |||
| 213 | info->strong_speed = effect->u.rumble.strong_magnitude; | 212 | info->strong_speed = effect->u.rumble.strong_magnitude; |
| 214 | info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; | 213 | info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; |
| 215 | 214 | ||
| 216 | ret = queue_work(info->workqueue, &info->play_work); | 215 | schedule_work(&info->play_work); |
| 217 | if (!ret) { | ||
| 218 | dev_info(&input->dev, "work is already on queue\n"); | ||
| 219 | return ret; | ||
| 220 | } | ||
| 221 | 216 | ||
| 222 | return 0; | 217 | return 0; |
| 223 | } | 218 | } |
| @@ -362,7 +357,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev) · 138 unmodified lines | |||
| 362 | 357 | ||
| 363 | info->input_dev->name = "twl6040:vibrator"; | 358 | info->input_dev->name = "twl6040:vibrator"; |
| 364 | info->input_dev->id.version = 1; | 359 | info->input_dev->id.version = 1; |
| 365 | info->input_dev->dev.parent = pdev->dev.parent; | ||
| 366 | info->input_dev->close = twl6040_vibra_close; | 360 | info->input_dev->close = twl6040_vibra_close; |
| 367 | __set_bit(FF_RUMBLE, info->input_dev->ffbit); | 361 | __set_bit(FF_RUMBLE, info->input_dev->ffbit); |
| 368 | 362 | ||
| @@ -858,6 +858,14 @@ static int gtco_probe(struct usb_interface *usbinterface, · 857 unmodified lines | |||
| 858 | goto err_free_buf; | 858 | goto err_free_buf; |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | /* Sanity check that a device has an endpoint */ | ||
| 862 | if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) { | ||
| 863 | dev_err(&usbinterface->dev, | ||
| 864 | "Invalid number of endpoints\n"); | ||
| 865 | error = -EINVAL; | ||
| 866 | goto err_free_urb; | ||
| 867 | } | ||
| 868 | |||
| 861 | /* | 869 | /* |
| 862 | * The endpoint is always altsetting 0, we know this since we know | 870 | * The endpoint is always altsetting 0, we know this since we know |
| 863 | * this device only has one interrupt endpoint | 871 | * this device only has one interrupt endpoint |
| @@ -879,7 +887,7 @@ static int gtco_probe(struct usb_interface *usbinterface, · 15 unmodified lines | |||
| 879 | * HID report descriptor | 887 | * HID report descriptor |
| 880 | */ | 888 | */ |
| 881 | if (usb_get_extra_descriptor(usbinterface->cur_altsetting, | 889 | if (usb_get_extra_descriptor(usbinterface->cur_altsetting, |
| 882 | HID_DEVICE_TYPE, &hid_desc) != 0){ | 890 | HID_DEVICE_TYPE, &hid_desc) != 0) { |
| 883 | dev_err(&usbinterface->dev, | 891 | dev_err(&usbinterface->dev, |
| 884 | "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); | 892 | "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); |
| 885 | error = -EIO; | 893 | error = -EIO; |
| @@ -92,6 +92,7 @@ struct iommu_dev_data { · 91 unmodified lines | |||
| 92 | struct list_head dev_data_list; /* For global dev_data_list */ | 92 | struct list_head dev_data_list; /* For global dev_data_list */ |
| 93 | struct protection_domain *domain; /* Domain the device is bound to */ | 93 | struct protection_domain *domain; /* Domain the device is bound to */ |
| 94 | u16 devid; /* PCI Device ID */ | 94 | u16 devid; /* PCI Device ID */ |
| 95 | u16 alias; /* Alias Device ID */ | ||
| 95 | bool iommu_v2; /* Device can make use of IOMMUv2 */ | 96 | bool iommu_v2; /* Device can make use of IOMMUv2 */ |
| 96 | bool passthrough; /* Device is identity mapped */ | 97 | bool passthrough; /* Device is identity mapped */ |
| 97 | struct { | 98 | struct { |
| @@ -166,6 +167,13 @@ static struct protection_domain *to_pdomain(struct iommu_domain *dom) · 68 unmodified lines | |||
| 166 | return container_of(dom, struct protection_domain, domain); | 167 | return container_of(dom, struct protection_domain, domain); |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 170 | static inline u16 get_device_id(struct device *dev) | ||
| 171 | { | ||
| 172 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 173 | |||
| 174 | return PCI_DEVID(pdev->bus->number, pdev->devfn); | ||
| 175 | } | ||
| 176 | |||
| 169 | static struct iommu_dev_data *alloc_dev_data(u16 devid) | 177 | static struct iommu_dev_data *alloc_dev_data(u16 devid) |
| 170 | { | 178 | { |
| 171 | struct iommu_dev_data *dev_data; | 179 | struct iommu_dev_data *dev_data; |
| @@ -203,6 +211,68 @@ out_unlock: · 31 unmodified lines | |||
| 203 | return dev_data; | 211 | return dev_data; |
| 204 | } | 212 | } |
| 205 | 213 | ||
| 214 | static int __last_alias(struct pci_dev *pdev, u16 alias, void *data) | ||
| 215 | { | ||
| 216 | *(u16 *)data = alias; | ||
| 217 | return 0; | ||
| 218 | } | ||
| 219 | |||
| 220 | static u16 get_alias(struct device *dev) | ||
| 221 | { | ||
| 222 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 223 | u16 devid, ivrs_alias, pci_alias; | ||
| 224 | |||
| 225 | devid = get_device_id(dev); | ||
| 226 | ivrs_alias = amd_iommu_alias_table[devid]; | ||
| 227 | pci_for_each_dma_alias(pdev, __last_alias, &pci_alias); | ||
| 228 | |||
| 229 | if (ivrs_alias == pci_alias) | ||
| 230 | return ivrs_alias; | ||
| 231 | |||
| 232 | /* | ||
| 233 | * DMA alias showdown | ||
| 234 | * | ||
| 235 | * The IVRS is fairly reliable in telling us about aliases, but it | ||
| 236 | * can't know about every screwy device. If we don't have an IVRS | ||
| 237 | * reported alias, use the PCI reported alias. In that case we may | ||
| 238 | * still need to initialize the rlookup and dev_table entries if the | ||
| 239 | * alias is to a non-existent device. | ||
| 240 | */ | ||
| 241 | if (ivrs_alias == devid) { | ||
| 242 | if (!amd_iommu_rlookup_table[pci_alias]) { | ||
| 243 | amd_iommu_rlookup_table[pci_alias] = | ||
| 244 | amd_iommu_rlookup_table[devid]; | ||
| 245 | memcpy(amd_iommu_dev_table[pci_alias].data, | ||
| 246 | amd_iommu_dev_table[devid].data, | ||
| 247 | sizeof(amd_iommu_dev_table[pci_alias].data)); | ||
| 248 | } | ||
| 249 | |||
| 250 | return pci_alias; | ||
| 251 | } | ||
| 252 | |||
| 253 | pr_info("AMD-Vi: Using IVRS reported alias %02x:%02x.%d " | ||
| 254 | "for device %s[%04x:%04x], kernel reported alias " | ||
| 255 | "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias), | ||
| 256 | PCI_FUNC(ivrs_alias), dev_name(dev), pdev->vendor, pdev->device, | ||
| 257 | PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias), | ||
| 258 | PCI_FUNC(pci_alias)); | ||
| 259 | |||
| 260 | /* | ||
| 261 | * If we don't have a PCI DMA alias and the IVRS alias is on the same | ||
| 262 | * bus, then the IVRS table may know about a quirk that we don't. | ||
| 263 | */ | ||
| 264 | if (pci_alias == devid && | ||
| 265 | PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) { | ||
| 266 | pdev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; | ||
| 267 | pdev->dma_alias_devfn = ivrs_alias & 0xff; | ||
| 268 | pr_info("AMD-Vi: Added PCI DMA alias %02x.%d for %s\n", | ||
| 269 | PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias), | ||
| 270 | dev_name(dev)); | ||
| 271 | } | ||
| 272 | |||
| 273 | return ivrs_alias; | ||
| 274 | } | ||
| 275 | |||
| 206 | static struct iommu_dev_data *find_dev_data(u16 devid) | 276 | static struct iommu_dev_data *find_dev_data(u16 devid) |
| 207 | { | 277 | { |
| 208 | struct iommu_dev_data *dev_data; | 278 | struct iommu_dev_data *dev_data; |
| @@ -215,13 +285,6 @@ static struct iommu_dev_data *find_dev_data(u16 devid) · 6 unmodified lines | |||
| 215 | return dev_data; | 285 | return dev_data; |
| 216 | } | 286 | } |
| 217 | 287 | ||
| 218 | static inline u16 get_device_id(struct device *dev) | ||
| 219 | { | ||
| 220 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 221 | |||
| 222 | return PCI_DEVID(pdev->bus->number, pdev->devfn); | ||
| 223 | } | ||
| 224 | |||
| 225 | static struct iommu_dev_data *get_dev_data(struct device *dev) | 288 | static struct iommu_dev_data *get_dev_data(struct device *dev) |
| 226 | { | 289 | { |
| 227 | return dev->archdata.iommu; | 290 | return dev->archdata.iommu; |
| @@ -349,6 +412,8 @@ static int iommu_init_device(struct device *dev) · 121 unmodified lines | |||
| 349 | if (!dev_data) | 412 | if (!dev_data) |
| 350 | return -ENOMEM; | 413 | return -ENOMEM; |
| 351 | 414 | ||
| 415 | dev_data->alias = get_alias(dev); | ||
| 416 | |||
| 352 | if (pci_iommuv2_capable(pdev)) { | 417 | if (pci_iommuv2_capable(pdev)) { |
| 353 | struct amd_iommu *iommu; | 418 | struct amd_iommu *iommu; |
| 354 | 419 | ||
| @@ -369,7 +434,7 @@ static void iommu_ignore_device(struct device *dev) · 14 unmodified lines | |||
| 369 | u16 devid, alias; | 434 | u16 devid, alias; |
| 370 | 435 | ||
| 371 | devid = get_device_id(dev); | 436 | devid = get_device_id(dev); |
| 372 | alias = amd_iommu_alias_table[devid]; | 437 | alias = get_alias(dev); |
| 373 | 438 | ||
| 374 | memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); | 439 | memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); |
| 375 | memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry)); | 440 | memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry)); |
| @@ -1061,7 +1126,7 @@ static int device_flush_dte(struct iommu_dev_data *dev_data) · 685 unmodified lines | |||
| 1061 | int ret; | 1126 | int ret; |
| 1062 | 1127 | ||
| 1063 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 1128 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 1064 | alias = amd_iommu_alias_table[dev_data->devid]; | 1129 | alias = dev_data->alias; |
| 1065 | 1130 | ||
| 1066 | ret = iommu_flush_dte(iommu, dev_data->devid); | 1131 | ret = iommu_flush_dte(iommu, dev_data->devid); |
| 1067 | if (!ret && alias != dev_data->devid) | 1132 | if (!ret && alias != dev_data->devid) |
| @@ -2039,7 +2104,7 @@ static void do_attach(struct iommu_dev_data *dev_data, · 971 unmodified lines | |||
| 2039 | bool ats; | 2104 | bool ats; |
| 2040 | 2105 | ||
| 2041 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 2106 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 2042 | alias = amd_iommu_alias_table[dev_data->devid]; | 2107 | alias = dev_data->alias; |
| 2043 | ats = dev_data->ats.enabled; | 2108 | ats = dev_data->ats.enabled; |
| 2044 | 2109 | ||
| 2045 | /* Update data structures */ | 2110 | /* Update data structures */ |
| @@ -2073,7 +2138,7 @@ static void do_detach(struct iommu_dev_data *dev_data) · 27 unmodified lines | |||
| 2073 | return; | 2138 | return; |
| 2074 | 2139 | ||
| 2075 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 2140 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 2076 | alias = amd_iommu_alias_table[dev_data->devid]; | 2141 | alias = dev_data->alias; |
| 2077 | 2142 | ||
| 2078 | /* decrease reference counters */ | 2143 | /* decrease reference counters */ |
| 2079 | dev_data->domain->dev_iommu[iommu->index] -= 1; | 2144 | dev_data->domain->dev_iommu[iommu->index] -= 1; |
| @@ -826,6 +826,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, · 825 unmodified lines | |||
| 826 | if (smmu_domain->smmu) | 826 | if (smmu_domain->smmu) |
| 827 | goto out_unlock; | 827 | goto out_unlock; |
| 828 | 828 | ||
| 829 | /* We're bypassing these SIDs, so don't allocate an actual context */ | ||
| 830 | if (domain->type == IOMMU_DOMAIN_DMA) { | ||
| 831 | smmu_domain->smmu = smmu; | ||
| 832 | goto out_unlock; | ||
| 833 | } | ||
| 834 | |||
| 829 | /* | 835 | /* |
| 830 | * Mapping the requested stage onto what we support is surprisingly | 836 | * Mapping the requested stage onto what we support is surprisingly |
| 831 | * complicated, mainly because the spec allows S1+S2 SMMUs without | 837 | * complicated, mainly because the spec allows S1+S2 SMMUs without |
| @@ -948,7 +954,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) · 116 unmodified lines | |||
| 948 | void __iomem *cb_base; | 954 | void __iomem *cb_base; |
| 949 | int irq; | 955 | int irq; |
| 950 | 956 | ||
| 951 | if (!smmu) | 957 | if (!smmu || domain->type == IOMMU_DOMAIN_DMA) |
| 952 | return; | 958 | return; |
| 953 | 959 | ||
| 954 | /* | 960 | /* |
| @@ -1089,18 +1095,20 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, · 134 unmodified lines | |||
| 1089 | struct arm_smmu_device *smmu = smmu_domain->smmu; | 1095 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
| 1090 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | 1096 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); |
| 1091 | 1097 | ||
| 1092 | /* Devices in an IOMMU group may already be configured */ | ||
| 1093 | ret = arm_smmu_master_configure_smrs(smmu, cfg); | ||
| 1094 | if (ret) | ||
| 1095 | return ret == -EEXIST ? 0 : ret; | ||
| 1096 | |||
| 1097 | /* | 1098 | /* |
| 1098 | * FIXME: This won't be needed once we have IOMMU-backed DMA ops | 1099 | * FIXME: This won't be needed once we have IOMMU-backed DMA ops |
| 1099 | * for all devices behind the SMMU. | 1100 | * for all devices behind the SMMU. Note that we need to take |
| 1101 | * care configuring SMRs for devices both a platform_device and | ||
| 1102 | * and a PCI device (i.e. a PCI host controller) | ||
| 1100 | */ | 1103 | */ |
| 1101 | if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA) | 1104 | if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA) |
| 1102 | return 0; | 1105 | return 0; |
| 1103 | 1106 | ||
| 1107 | /* Devices in an IOMMU group may already be configured */ | ||
| 1108 | ret = arm_smmu_master_configure_smrs(smmu, cfg); | ||
| 1109 | if (ret) | ||
| 1110 | return ret == -EEXIST ? 0 : ret; | ||
| 1111 | |||
| 1104 | for (i = 0; i < cfg->num_streamids; ++i) { | 1112 | for (i = 0; i < cfg->num_streamids; ++i) { |
| 1105 | u32 idx, s2cr; | 1113 | u32 idx, s2cr; |
| 1106 | 1114 | ||
| @@ -467,7 +467,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, · 466 unmodified lines | |||
| 467 | gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp))); | 467 | gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp))); |
| 468 | 468 | ||
| 469 | /* Update the pcpu_masks */ | 469 | /* Update the pcpu_masks */ |
| 470 | for (i = 0; i < gic_vpes; i++) | 470 | for (i = 0; i < min(gic_vpes, NR_CPUS); i++) |
| 471 | clear_bit(irq, pcpu_masks[i].pcpu_mask); | 471 | clear_bit(irq, pcpu_masks[i].pcpu_mask); |
| 472 | set_bit(irq, pcpu_masks[cpumask_first(&tmp)].pcpu_mask); | 472 | set_bit(irq, pcpu_masks[cpumask_first(&tmp)].pcpu_mask); |
| 473 | 473 | ||
| @@ -707,7 +707,7 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, · 233 unmodified lines | |||
| 707 | spin_lock_irqsave(&gic_lock, flags); | 707 | spin_lock_irqsave(&gic_lock, flags); |
| 708 | gic_map_to_pin(intr, gic_cpu_pin); | 708 | gic_map_to_pin(intr, gic_cpu_pin); |
| 709 | gic_map_to_vpe(intr, vpe); | 709 | gic_map_to_vpe(intr, vpe); |
| 710 | for (i = 0; i < gic_vpes; i++) | 710 | for (i = 0; i < min(gic_vpes, NR_CPUS); i++) |
| 711 | clear_bit(intr, pcpu_masks[i].pcpu_mask); | 711 | clear_bit(intr, pcpu_masks[i].pcpu_mask); |
| 712 | set_bit(intr, pcpu_masks[vpe].pcpu_mask); | 712 | set_bit(intr, pcpu_masks[vpe].pcpu_mask); |
| 713 | spin_unlock_irqrestore(&gic_lock, flags); | 713 | spin_unlock_irqrestore(&gic_lock, flags); |
| @@ -62,9 +62,8 @@ config DUMMY · 61 unmodified lines | |||
| 62 | this device is consigned into oblivion) with a configurable IP | 62 | this device is consigned into oblivion) with a configurable IP |
| 63 | address. It is most commonly used in order to make your currently | 63 | address. It is most commonly used in order to make your currently |
| 64 | inactive SLIP address seem like a real address for local programs. | 64 | inactive SLIP address seem like a real address for local programs. |
| 65 | If you use SLIP or PPP, you might want to say Y here. Since this | 65 | If you use SLIP or PPP, you might want to say Y here. It won't |
| 66 | thing often comes in handy, the default is Y. It won't enlarge your | 66 | enlarge your kernel. What a deal. Read about it in the Network |
| 67 | kernel either. What a deal. Read about it in the Network | ||
| 68 | Administrator's Guide, available from | 67 | Administrator's Guide, available from |
| 69 | <http://www.tldp.org/docs.html#guide>. | 68 | <http://www.tldp.org/docs.html#guide>. |
| 70 | 69 | ||
| @@ -405,7 +405,6 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev, · 404 unmodified lines | |||
| 405 | u32 packets = 0; | 405 | u32 packets = 0; |
| 406 | u32 bytes = 0; | 406 | u32 bytes = 0; |
| 407 | int factor = priv->cqe_factor; | 407 | int factor = priv->cqe_factor; |
| 408 | u64 timestamp = 0; | ||
| 409 | int done = 0; | 408 | int done = 0; |
| 410 | int budget = priv->tx_work_limit; | 409 | int budget = priv->tx_work_limit; |
| 411 | u32 last_nr_txbb; | 410 | u32 last_nr_txbb; |
| @@ -445,9 +444,12 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev, · 33 unmodified lines | |||
| 445 | new_index = be16_to_cpu(cqe->wqe_index) & size_mask; | 444 | new_index = be16_to_cpu(cqe->wqe_index) & size_mask; |
| 446 | 445 | ||
| 447 | do { | 446 | do { |
| 447 | u64 timestamp = 0; | ||
| 448 | |||
| 448 | txbbs_skipped += last_nr_txbb; | 449 | txbbs_skipped += last_nr_txbb; |
| 449 | ring_index = (ring_index + last_nr_txbb) & size_mask; | 450 | ring_index = (ring_index + last_nr_txbb) & size_mask; |
| 450 | if (ring->tx_info[ring_index].ts_requested) | 451 | |
| 452 | if (unlikely(ring->tx_info[ring_index].ts_requested)) | ||
| 451 | timestamp = mlx4_en_get_cqe_ts(cqe); | 453 | timestamp = mlx4_en_get_cqe_ts(cqe); |
| 452 | 454 | ||
| 453 | /* free next descriptor */ | 455 | /* free next descriptor */ |
| @@ -510,7 +510,7 @@ enum mlx5e_link_mode { · 509 unmodified lines | |||
| 510 | MLX5E_100GBASE_KR4 = 22, | 510 | MLX5E_100GBASE_KR4 = 22, |
| 511 | MLX5E_100GBASE_LR4 = 23, | 511 | MLX5E_100GBASE_LR4 = 23, |
| 512 | MLX5E_100BASE_TX = 24, | 512 | MLX5E_100BASE_TX = 24, |
| 513 | MLX5E_100BASE_T = 25, | 513 | MLX5E_1000BASE_T = 25, |
| 514 | MLX5E_10GBASE_T = 26, | 514 | MLX5E_10GBASE_T = 26, |
| 515 | MLX5E_25GBASE_CR = 27, | 515 | MLX5E_25GBASE_CR = 27, |
| 516 | MLX5E_25GBASE_KR = 28, | 516 | MLX5E_25GBASE_KR = 28, |
| @@ -138,10 +138,10 @@ static const struct { · 137 unmodified lines | |||
| 138 | [MLX5E_100BASE_TX] = { | 138 | [MLX5E_100BASE_TX] = { |
| 139 | .speed = 100, | 139 | .speed = 100, |
| 140 | }, | 140 | }, |
| 141 | [MLX5E_100BASE_T] = { | 141 | [MLX5E_1000BASE_T] = { |
| 142 | .supported = SUPPORTED_100baseT_Full, | 142 | .supported = SUPPORTED_1000baseT_Full, |
| 143 | .advertised = ADVERTISED_100baseT_Full, | 143 | .advertised = ADVERTISED_1000baseT_Full, |
| 144 | .speed = 100, | 144 | .speed = 1000, |
| 145 | }, | 145 | }, |
| 146 | [MLX5E_10GBASE_T] = { | 146 | [MLX5E_10GBASE_T] = { |
| 147 | .supported = SUPPORTED_10000baseT_Full, | 147 | .supported = SUPPORTED_10000baseT_Full, |
| @@ -1542,24 +1542,50 @@ static int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5e_priv *priv) · 1541 unmodified lines | |||
| 1542 | return 0; | 1542 | return 0; |
| 1543 | } | 1543 | } |
| 1544 | 1544 | ||
| 1545 | static int mlx5e_set_dev_port_mtu(struct net_device *netdev) | 1545 | static int mlx5e_set_mtu(struct mlx5e_priv *priv, u16 mtu) |
| 1546 | { | 1546 | { |
| 1547 | struct mlx5e_priv *priv = netdev_priv(netdev); | ||
| 1548 | struct mlx5_core_dev *mdev = priv->mdev; | 1547 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1549 | int hw_mtu; | 1548 | u16 hw_mtu = MLX5E_SW2HW_MTU(mtu); |
| 1550 | int err; | 1549 | int err; |
| 1551 | 1550 | ||
| 1552 | err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(netdev->mtu), 1); | 1551 | err = mlx5_set_port_mtu(mdev, hw_mtu, 1); |
| 1553 | if (err) | 1552 | if (err) |
| 1554 | return err; | 1553 | return err; |
| 1555 | 1554 | ||
| 1556 | mlx5_query_port_oper_mtu(mdev, &hw_mtu, 1); | 1555 | /* Update vport context MTU */ |
| 1556 | mlx5_modify_nic_vport_mtu(mdev, hw_mtu); | ||
| 1557 | return 0; | ||
| 1558 | } | ||
| 1557 | 1559 | ||
| 1558 | if (MLX5E_HW2SW_MTU(hw_mtu) != netdev->mtu) | 1560 | static void mlx5e_query_mtu(struct mlx5e_priv *priv, u16 *mtu) |
| 1559 | netdev_warn(netdev, "%s: Port MTU %d is different than netdev mtu %d\n", | 1561 | { |
| 1560 | __func__, MLX5E_HW2SW_MTU(hw_mtu), netdev->mtu); | 1562 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1563 | u16 hw_mtu = 0; | ||
| 1564 | int err; | ||
| 1561 | 1565 | ||
| 1562 | netdev->mtu = MLX5E_HW2SW_MTU(hw_mtu); | 1566 | err = mlx5_query_nic_vport_mtu(mdev, &hw_mtu); |
| 1567 | if (err || !hw_mtu) /* fallback to port oper mtu */ | ||
| 1568 | mlx5_query_port_oper_mtu(mdev, &hw_mtu, 1); | ||
| 1569 | |||
| 1570 | *mtu = MLX5E_HW2SW_MTU(hw_mtu); | ||
| 1571 | } | ||
| 1572 | |||
| 1573 | static int mlx5e_set_dev_port_mtu(struct net_device *netdev) | ||
| 1574 | { | ||
| 1575 | struct mlx5e_priv *priv = netdev_priv(netdev); | ||
| 1576 | u16 mtu; | ||
| 1577 | int err; | ||
| 1578 | |||
| 1579 | err = mlx5e_set_mtu(priv, netdev->mtu); | ||
| 1580 | if (err) | ||
| 1581 | return err; | ||
| 1582 | |||
| 1583 | mlx5e_query_mtu(priv, &mtu); | ||
| 1584 | if (mtu != netdev->mtu) | ||
| 1585 | netdev_warn(netdev, "%s: VPort MTU %d is different than netdev mtu %d\n", | ||
| 1586 | __func__, mtu, netdev->mtu); | ||
| 1587 | |||
| 1588 | netdev->mtu = mtu; | ||
| 1563 | return 0; | 1589 | return 0; |
| 1564 | } | 1590 | } |
| 1565 | 1591 | ||
| @@ -2257,22 +2283,27 @@ static int mlx5e_set_features(struct net_device *netdev, · 691 unmodified lines | |||
| 2257 | return err ? -EINVAL : 0; | 2283 | return err ? -EINVAL : 0; |
| 2258 | } | 2284 | } |
| 2259 | 2285 | ||
| 2286 | #define MXL5_HW_MIN_MTU 64 | ||
| 2287 | #define MXL5E_MIN_MTU (MXL5_HW_MIN_MTU + ETH_FCS_LEN) | ||
| 2288 | |||
| 2260 | static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) | 2289 | static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) |
| 2261 | { | 2290 | { |
| 2262 | struct mlx5e_priv *priv = netdev_priv(netdev); | 2291 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 2263 | struct mlx5_core_dev *mdev = priv->mdev; | 2292 | struct mlx5_core_dev *mdev = priv->mdev; |
| 2264 | bool was_opened; | 2293 | bool was_opened; |
| 2265 | int max_mtu; | 2294 | u16 max_mtu; |
| 2295 | u16 min_mtu; | ||
| 2266 | int err = 0; | 2296 | int err = 0; |
| 2267 | 2297 | ||
| 2268 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); | 2298 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); |
| 2269 | 2299 | ||
| 2270 | max_mtu = MLX5E_HW2SW_MTU(max_mtu); | 2300 | max_mtu = MLX5E_HW2SW_MTU(max_mtu); |
| 2301 | min_mtu = MLX5E_HW2SW_MTU(MXL5E_MIN_MTU); | ||
| 2271 | 2302 | ||
| 2272 | if (new_mtu > max_mtu) { | 2303 | if (new_mtu > max_mtu || new_mtu < min_mtu) { |
| 2273 | netdev_err(netdev, | 2304 | netdev_err(netdev, |
| 2274 | "%s: Bad MTU (%d) > (%d) Max\n", | 2305 | "%s: Bad MTU (%d), valid range is: [%d..%d]\n", |
| 2275 | __func__, new_mtu, max_mtu); | 2306 | __func__, new_mtu, min_mtu, max_mtu); |
| 2276 | return -EINVAL; | 2307 | return -EINVAL; |
| 2277 | } | 2308 | } |
| 2278 | 2309 | ||
| @@ -2966,7 +2997,16 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) · 687 unmodified lines | |||
| 2966 | schedule_work(&priv->set_rx_mode_work); | 2997 | schedule_work(&priv->set_rx_mode_work); |
| 2967 | mlx5e_disable_async_events(priv); | 2998 | mlx5e_disable_async_events(priv); |
| 2968 | flush_scheduled_work(); | 2999 | flush_scheduled_work(); |
| 2969 | unregister_netdev(netdev); | 3000 | if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) { |
| 3001 | netif_device_detach(netdev); | ||
| 3002 | mutex_lock(&priv->state_lock); | ||
| 3003 | if (test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
| 3004 | mlx5e_close_locked(netdev); | ||
| 3005 | mutex_unlock(&priv->state_lock); | ||
| 3006 | } else { | ||
| 3007 | unregister_netdev(netdev); | ||
| 3008 | } | ||
| 3009 | |||
| 2970 | mlx5e_tc_cleanup(priv); | 3010 | mlx5e_tc_cleanup(priv); |
| 2971 | mlx5e_vxlan_cleanup(priv); | 3011 | mlx5e_vxlan_cleanup(priv); |
| 2972 | mlx5e_destroy_q_counter(priv); | 3012 | mlx5e_destroy_q_counter(priv); |
| @@ -2981,7 +3021,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) · 8 unmodified lines | |||
| 2981 | mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); | 3021 | mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); |
| 2982 | mlx5_core_dealloc_pd(priv->mdev, priv->pdn); | 3022 | mlx5_core_dealloc_pd(priv->mdev, priv->pdn); |
| 2983 | mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); | 3023 | mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); |
| 2984 | free_netdev(netdev); | 3024 | |
| 3025 | if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) | ||
| 3026 | free_netdev(netdev); | ||
| 2985 | } | 3027 | } |
| 2986 | 3028 | ||
| 2987 | static void *mlx5e_get_netdev(void *vpriv) | 3029 | static void *mlx5e_get_netdev(void *vpriv) |
| @@ -1065,33 +1065,6 @@ unlock_fg: · 1064 unmodified lines | |||
| 1065 | return rule; | 1065 | return rule; |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | static struct mlx5_flow_rule *add_rule_to_auto_fg(struct mlx5_flow_table *ft, | ||
| 1069 | u8 match_criteria_enable, | ||
| 1070 | u32 *match_criteria, | ||
| 1071 | u32 *match_value, | ||
| 1072 | u8 action, | ||
| 1073 | u32 flow_tag, | ||
| 1074 | struct mlx5_flow_destination *dest) | ||
| 1075 | { | ||
| 1076 | struct mlx5_flow_rule *rule; | ||
| 1077 | struct mlx5_flow_group *g; | ||
| 1078 | |||
| 1079 | g = create_autogroup(ft, match_criteria_enable, match_criteria); | ||
| 1080 | if (IS_ERR(g)) | ||
| 1081 | return (void *)g; | ||
| 1082 | |||
| 1083 | rule = add_rule_fg(g, match_value, | ||
| 1084 | action, flow_tag, dest); | ||
| 1085 | if (IS_ERR(rule)) { | ||
| 1086 | /* Remove assumes refcount > 0 and autogroup creates a group | ||
| 1087 | * with a refcount = 0. | ||
| 1088 | */ | ||
| 1089 | tree_get_node(&g->node); | ||
| 1090 | tree_remove_node(&g->node); | ||
| 1091 | } | ||
| 1092 | return rule; | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | static struct mlx5_flow_rule * | 1068 | static struct mlx5_flow_rule * |
| 1096 | _mlx5_add_flow_rule(struct mlx5_flow_table *ft, | 1069 | _mlx5_add_flow_rule(struct mlx5_flow_table *ft, |
| 1097 | u8 match_criteria_enable, | 1070 | u8 match_criteria_enable, |
| @@ -1119,8 +1092,23 @@ _mlx5_add_flow_rule(struct mlx5_flow_table *ft, · 21 unmodified lines | |||
| 1119 | goto unlock; | 1092 | goto unlock; |
| 1120 | } | 1093 | } |
| 1121 | 1094 | ||
| 1122 | rule = add_rule_to_auto_fg(ft, match_criteria_enable, match_criteria, | 1095 | g = create_autogroup(ft, match_criteria_enable, match_criteria); |
| 1123 | match_value, action, flow_tag, dest); | 1096 | if (IS_ERR(g)) { |
| 1097 | rule = (void *)g; | ||
| 1098 | goto unlock; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | rule = add_rule_fg(g, match_value, | ||
| 1102 | action, flow_tag, dest); | ||
| 1103 | if (IS_ERR(rule)) { | ||
| 1104 | /* Remove assumes refcount > 0 and autogroup creates a group | ||
| 1105 | * with a refcount = 0. | ||
| 1106 | */ | ||
| 1107 | unlock_ref_node(&ft->node); | ||
| 1108 | tree_get_node(&g->node); | ||
| 1109 | tree_remove_node(&g->node); | ||
| 1110 | return rule; | ||
| 1111 | } | ||
| 1124 | unlock: | 1112 | unlock: |
| 1125 | unlock_ref_node(&ft->node); | 1113 | unlock_ref_node(&ft->node); |
| 1126 | return rule; | 1114 | return rule; |
| @@ -1288,7 +1276,7 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev, · 161 unmodified lines | |||
| 1288 | { | 1276 | { |
| 1289 | struct mlx5_flow_root_namespace *root_ns = dev->priv.root_ns; | 1277 | struct mlx5_flow_root_namespace *root_ns = dev->priv.root_ns; |
| 1290 | int prio; | 1278 | int prio; |
| 1291 | static struct fs_prio *fs_prio; | 1279 | struct fs_prio *fs_prio; |
| 1292 | struct mlx5_flow_namespace *ns; | 1280 | struct mlx5_flow_namespace *ns; |
| 1293 | 1281 | ||
| 1294 | if (!root_ns) | 1282 | if (!root_ns) |
| @@ -966,7 +966,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 965 unmodified lines | |||
| 966 | int err; | 966 | int err; |
| 967 | 967 | ||
| 968 | mutex_lock(&dev->intf_state_mutex); | 968 | mutex_lock(&dev->intf_state_mutex); |
| 969 | if (dev->interface_state == MLX5_INTERFACE_STATE_UP) { | 969 | if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { |
| 970 | dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", | 970 | dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", |
| 971 | __func__); | 971 | __func__); |
| 972 | goto out; | 972 | goto out; |
| @@ -1133,7 +1133,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 160 unmodified lines | |||
| 1133 | if (err) | 1133 | if (err) |
| 1134 | pr_info("failed request module on %s\n", MLX5_IB_MOD); | 1134 | pr_info("failed request module on %s\n", MLX5_IB_MOD); |
| 1135 | 1135 | ||
| 1136 | dev->interface_state = MLX5_INTERFACE_STATE_UP; | 1136 | clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); |
| 1137 | set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); | ||
| 1137 | out: | 1138 | out: |
| 1138 | mutex_unlock(&dev->intf_state_mutex); | 1139 | mutex_unlock(&dev->intf_state_mutex); |
| 1139 | 1140 | ||
| @@ -1207,7 +1208,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 67 unmodified lines | |||
| 1207 | } | 1208 | } |
| 1208 | 1209 | ||
| 1209 | mutex_lock(&dev->intf_state_mutex); | 1210 | mutex_lock(&dev->intf_state_mutex); |
| 1210 | if (dev->interface_state == MLX5_INTERFACE_STATE_DOWN) { | 1211 | if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { |
| 1211 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", | 1212 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", |
| 1212 | __func__); | 1213 | __func__); |
| 1213 | goto out; | 1214 | goto out; |
| @@ -1241,7 +1242,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) · 27 unmodified lines | |||
| 1241 | mlx5_cmd_cleanup(dev); | 1242 | mlx5_cmd_cleanup(dev); |
| 1242 | 1243 | ||
| 1243 | out: | 1244 | out: |
| 1244 | dev->interface_state = MLX5_INTERFACE_STATE_DOWN; | 1245 | clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); |
| 1246 | set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); | ||
| 1245 | mutex_unlock(&dev->intf_state_mutex); | 1247 | mutex_unlock(&dev->intf_state_mutex); |
| 1246 | return err; | 1248 | return err; |
| 1247 | } | 1249 | } |
| @@ -1452,6 +1454,18 @@ static const struct pci_error_handlers mlx5_err_handler = { · 204 unmodified lines | |||
| 1452 | .resume = mlx5_pci_resume | 1454 | .resume = mlx5_pci_resume |
| 1453 | }; | 1455 | }; |
| 1454 | 1456 | ||
| 1457 | static void shutdown(struct pci_dev *pdev) | ||
| 1458 | { | ||
| 1459 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | ||
| 1460 | struct mlx5_priv *priv = &dev->priv; | ||
| 1461 | |||
| 1462 | dev_info(&pdev->dev, "Shutdown was called\n"); | ||
| 1463 | /* Notify mlx5 clients that the kernel is being shut down */ | ||
| 1464 | set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); | ||
| 1465 | mlx5_unload_one(dev, priv); | ||
| 1466 | mlx5_pci_disable_device(dev); | ||
| 1467 | } | ||
| 1468 | |||
| 1455 | static const struct pci_device_id mlx5_core_pci_table[] = { | 1469 | static const struct pci_device_id mlx5_core_pci_table[] = { |
| 1456 | { PCI_VDEVICE(MELLANOX, 0x1011) }, /* Connect-IB */ | 1470 | { PCI_VDEVICE(MELLANOX, 0x1011) }, /* Connect-IB */ |
| 1457 | { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ | 1471 | { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ |
| @@ -1459,6 +1473,8 @@ static const struct pci_device_id mlx5_core_pci_table[] = { · 1 unmodified line | |||
| 1459 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ | 1473 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ |
| 1460 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ | 1474 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ |
| 1461 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ | 1475 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ |
| 1476 | { PCI_VDEVICE(MELLANOX, 0x1017) }, /* ConnectX-5 */ | ||
| 1477 | { PCI_VDEVICE(MELLANOX, 0x1018), MLX5_PCI_DEV_IS_VF}, /* ConnectX-5 VF */ | ||
| 1462 | { 0, } | 1478 | { 0, } |
| 1463 | }; | 1479 | }; |
| 1464 | 1480 | ||
| @@ -1469,6 +1485,7 @@ static struct pci_driver mlx5_core_driver = { · 4 unmodified lines | |||
| 1469 | .id_table = mlx5_core_pci_table, | 1485 | .id_table = mlx5_core_pci_table, |
| 1470 | .probe = init_one, | 1486 | .probe = init_one, |
| 1471 | .remove = remove_one, | 1487 | .remove = remove_one, |
| 1488 | .shutdown = shutdown, | ||
| 1472 | .err_handler = &mlx5_err_handler, | 1489 | .err_handler = &mlx5_err_handler, |
| 1473 | .sriov_configure = mlx5_core_sriov_configure, | 1490 | .sriov_configure = mlx5_core_sriov_configure, |
| 1474 | }; | 1491 | }; |
| @@ -260,8 +260,8 @@ int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, · 259 unmodified lines | |||
| 260 | } | 260 | } |
| 261 | EXPORT_SYMBOL_GPL(mlx5_query_port_admin_status); | 261 | EXPORT_SYMBOL_GPL(mlx5_query_port_admin_status); |
| 262 | 262 | ||
| 263 | static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, int *admin_mtu, | 263 | static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, u16 *admin_mtu, |
| 264 | int *max_mtu, int *oper_mtu, u8 port) | 264 | u16 *max_mtu, u16 *oper_mtu, u8 port) |
| 265 | { | 265 | { |
| 266 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; | 266 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
| 267 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; | 267 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; |
| @@ -281,7 +281,7 @@ static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, int *admin_mtu, · 13 unmodified lines | |||
| 281 | *admin_mtu = MLX5_GET(pmtu_reg, out, admin_mtu); | 281 | *admin_mtu = MLX5_GET(pmtu_reg, out, admin_mtu); |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port) | 284 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, u16 mtu, u8 port) |
| 285 | { | 285 | { |
| 286 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; | 286 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
| 287 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; | 287 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; |
| @@ -296,14 +296,14 @@ int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port) · 8 unmodified lines | |||
| 296 | } | 296 | } |
| 297 | EXPORT_SYMBOL_GPL(mlx5_set_port_mtu); | 297 | EXPORT_SYMBOL_GPL(mlx5_set_port_mtu); |
| 298 | 298 | ||
| 299 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, | 299 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, u16 *max_mtu, |
| 300 | u8 port) | 300 | u8 port) |
| 301 | { | 301 | { |
| 302 | mlx5_query_port_mtu(dev, NULL, max_mtu, NULL, port); | 302 | mlx5_query_port_mtu(dev, NULL, max_mtu, NULL, port); |
| 303 | } | 303 | } |
| 304 | EXPORT_SYMBOL_GPL(mlx5_query_port_max_mtu); | 304 | EXPORT_SYMBOL_GPL(mlx5_query_port_max_mtu); |
| 305 | 305 | ||
| 306 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu, | 306 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, u16 *oper_mtu, |
| 307 | u8 port) | 307 | u8 port) |
| 308 | { | 308 | { |
| 309 | mlx5_query_port_mtu(dev, NULL, NULL, oper_mtu, port); | 309 | mlx5_query_port_mtu(dev, NULL, NULL, oper_mtu, port); |
| @@ -196,6 +196,46 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev, · 195 unmodified lines | |||
| 196 | } | 196 | } |
| 197 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_address); | 197 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_address); |
| 198 | 198 | ||
| 199 | int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu) | ||
| 200 | { | ||
| 201 | int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); | ||
| 202 | u32 *out; | ||
| 203 | int err; | ||
| 204 | |||
| 205 | out = mlx5_vzalloc(outlen); | ||
| 206 | if (!out) | ||
| 207 | return -ENOMEM; | ||
| 208 | |||
| 209 | err = mlx5_query_nic_vport_context(mdev, 0, out, outlen); | ||
| 210 | if (!err) | ||
| 211 | *mtu = MLX5_GET(query_nic_vport_context_out, out, | ||
| 212 | nic_vport_context.mtu); | ||
| 213 | |||
| 214 | kvfree(out); | ||
| 215 | return err; | ||
| 216 | } | ||
| 217 | EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mtu); | ||
| 218 | |||
| 219 | int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu) | ||
| 220 | { | ||
| 221 | int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); | ||
| 222 | void *in; | ||
| 223 | int err; | ||
| 224 | |||
| 225 | in = mlx5_vzalloc(inlen); | ||
| 226 | if (!in) | ||
| 227 | return -ENOMEM; | ||
| 228 | |||
| 229 | MLX5_SET(modify_nic_vport_context_in, in, field_select.mtu, 1); | ||
| 230 | MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.mtu, mtu); | ||
| 231 | |||
| 232 | err = mlx5_modify_nic_vport_context(mdev, in, inlen); | ||
| 233 | |||
| 234 | kvfree(in); | ||
| 235 | return err; | ||
| 236 | } | ||
| 237 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mtu); | ||
| 238 | |||
| 199 | int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, | 239 | int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, |
| 200 | u32 vport, | 240 | u32 vport, |
| 201 | enum mlx5_list_type list_type, | 241 | enum mlx5_list_type list_type, |
| @@ -37,8 +37,8 @@ · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | #define _QLCNIC_LINUX_MAJOR 5 | 38 | #define _QLCNIC_LINUX_MAJOR 5 |
| 39 | #define _QLCNIC_LINUX_MINOR 3 | 39 | #define _QLCNIC_LINUX_MINOR 3 |
| 40 | #define _QLCNIC_LINUX_SUBVERSION 63 | 40 | #define _QLCNIC_LINUX_SUBVERSION 64 |
| 41 | #define QLCNIC_LINUX_VERSIONID "5.3.63" | 41 | #define QLCNIC_LINUX_VERSIONID "5.3.64" |
| 42 | #define QLCNIC_DRV_IDC_VER 0x01 | 42 | #define QLCNIC_DRV_IDC_VER 0x01 |
| 43 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ | 43 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ |
| 44 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) | 44 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) |
| @@ -49,7 +49,6 @@ struct socfpga_dwmac { · 48 unmodified lines | |||
| 49 | u32 reg_shift; | 49 | u32 reg_shift; |
| 50 | struct device *dev; | 50 | struct device *dev; |
| 51 | struct regmap *sys_mgr_base_addr; | 51 | struct regmap *sys_mgr_base_addr; |
| 52 | struct reset_control *stmmac_rst; | ||
| 53 | void __iomem *splitter_base; | 52 | void __iomem *splitter_base; |
| 54 | bool f2h_ptp_ref_clk; | 53 | bool f2h_ptp_ref_clk; |
| 55 | }; | 54 | }; |
| @@ -92,15 +91,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device * · 36 unmodified lines | |||
| 92 | struct device_node *np_splitter; | 91 | struct device_node *np_splitter; |
| 93 | struct resource res_splitter; | 92 | struct resource res_splitter; |
| 94 | 93 | ||
| 95 | dwmac->stmmac_rst = devm_reset_control_get(dev, | ||
| 96 | STMMAC_RESOURCE_NAME); | ||
| 97 | if (IS_ERR(dwmac->stmmac_rst)) { | ||
| 98 | dev_info(dev, "Could not get reset control!\n"); | ||
| 99 | if (PTR_ERR(dwmac->stmmac_rst) == -EPROBE_DEFER) | ||
| 100 | return -EPROBE_DEFER; | ||
| 101 | dwmac->stmmac_rst = NULL; | ||
| 102 | } | ||
| 103 | |||
| 104 | dwmac->interface = of_get_phy_mode(np); | 94 | dwmac->interface = of_get_phy_mode(np); |
| 105 | 95 | ||
| 106 | sys_mgr_base_addr = syscon_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon"); | 96 | sys_mgr_base_addr = syscon_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon"); |
| @@ -194,30 +184,23 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac) · 87 unmodified lines | |||
| 194 | return 0; | 184 | return 0; |
| 195 | } | 185 | } |
| 196 | 186 | ||
| 197 | static void socfpga_dwmac_exit(struct platform_device *pdev, void *priv) | ||
| 198 | { | ||
| 199 | struct socfpga_dwmac *dwmac = priv; | ||
| 200 | |||
| 201 | /* On socfpga platform exit, assert and hold reset to the | ||
| 202 | * enet controller - the default state after a hard reset. | ||
| 203 | */ | ||
| 204 | if (dwmac->stmmac_rst) | ||
| 205 | reset_control_assert(dwmac->stmmac_rst); | ||
| 206 | } | ||
| 207 | |||
| 208 | static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) | 187 | static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) |
| 209 | { | 188 | { |
| 210 | struct socfpga_dwmac *dwmac = priv; | 189 | struct socfpga_dwmac *dwmac = priv; |
| 211 | struct net_device *ndev = platform_get_drvdata(pdev); | 190 | struct net_device *ndev = platform_get_drvdata(pdev); |
| 212 | struct stmmac_priv *stpriv = NULL; | 191 | struct stmmac_priv *stpriv = NULL; |
| 213 | int ret = 0; | 192 | int ret = 0; |
| 214 | 193 | ||
| 215 | if (ndev) | 194 | if (!ndev) |
| 216 | stpriv = netdev_priv(ndev); | 195 | return -EINVAL; |
| 196 | |||
| 197 | stpriv = netdev_priv(ndev); | ||
| 198 | if (!stpriv) | ||
| 199 | return -EINVAL; | ||
| 217 | 200 | ||
| 218 | /* Assert reset to the enet controller before changing the phy mode */ | 201 | /* Assert reset to the enet controller before changing the phy mode */ |
| 219 | if (dwmac->stmmac_rst) | 202 | if (stpriv->stmmac_rst) |
| 220 | reset_control_assert(dwmac->stmmac_rst); | 203 | reset_control_assert(stpriv->stmmac_rst); |
| 221 | 204 | ||
| 222 | /* Setup the phy mode in the system manager registers according to | 205 | /* Setup the phy mode in the system manager registers according to |
| 223 | * devicetree configuration | 206 | * devicetree configuration |
| @@ -227,8 +210,8 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) · 3 unmodified lines | |||
| 227 | /* Deassert reset for the phy configuration to be sampled by | 210 | /* Deassert reset for the phy configuration to be sampled by |
| 228 | * the enet controller, and operation to start in requested mode | 211 | * the enet controller, and operation to start in requested mode |
| 229 | */ | 212 | */ |
| 230 | if (dwmac->stmmac_rst) | 213 | if (stpriv->stmmac_rst) |
| 231 | reset_control_deassert(dwmac->stmmac_rst); | 214 | reset_control_deassert(stpriv->stmmac_rst); |
| 232 | 215 | ||
| 233 | /* Before the enet controller is suspended, the phy is suspended. | 216 | /* Before the enet controller is suspended, the phy is suspended. |
| 234 | * This causes the phy clock to be gated. The enet controller is | 217 | * This causes the phy clock to be gated. The enet controller is |
| @@ -245,7 +228,7 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) · 10 unmodified lines | |||
| 245 | * control register 0, and can be modified by the phy driver | 228 | * control register 0, and can be modified by the phy driver |
| 246 | * framework. | 229 | * framework. |
| 247 | */ | 230 | */ |
| 248 | if (stpriv && stpriv->phydev) | 231 | if (stpriv->phydev) |
| 249 | phy_resume(stpriv->phydev); | 232 | phy_resume(stpriv->phydev); |
| 250 | 233 | ||
| 251 | return ret; | 234 | return ret; |
| @@ -279,14 +262,13 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) · 27 unmodified lines | |||
| 279 | 262 | ||
| 280 | plat_dat->bsp_priv = dwmac; | 263 | plat_dat->bsp_priv = dwmac; |
| 281 | plat_dat->init = socfpga_dwmac_init; | 264 | plat_dat->init = socfpga_dwmac_init; |
| 282 | plat_dat->exit = socfpga_dwmac_exit; | ||
| 283 | plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; | 265 | plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; |
| 284 | 266 | ||
| 285 | ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv); | 267 | ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
| 286 | if (ret) | 268 | if (!ret) |
| 287 | return ret; | 269 | ret = socfpga_dwmac_init(pdev, dwmac); |
| 288 | 270 | ||
| 289 | return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | 271 | return ret; |
| 290 | } | 272 | } |
| 291 | 273 | ||
| 292 | static const struct of_device_id socfpga_dwmac_match[] = { | 274 | static const struct of_device_id socfpga_dwmac_match[] = { |
| @@ -880,12 +880,12 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb, · 879 unmodified lines | |||
| 880 | macsec_skb_cb(skb)->valid = false; | 880 | macsec_skb_cb(skb)->valid = false; |
| 881 | skb = skb_share_check(skb, GFP_ATOMIC); | 881 | skb = skb_share_check(skb, GFP_ATOMIC); |
| 882 | if (!skb) | 882 | if (!skb) |
| 883 | return NULL; | 883 | return ERR_PTR(-ENOMEM); |
| 884 | 884 | ||
| 885 | req = aead_request_alloc(rx_sa->key.tfm, GFP_ATOMIC); | 885 | req = aead_request_alloc(rx_sa->key.tfm, GFP_ATOMIC); |
| 886 | if (!req) { | 886 | if (!req) { |
| 887 | kfree_skb(skb); | 887 | kfree_skb(skb); |
| 888 | return NULL; | 888 | return ERR_PTR(-ENOMEM); |
| 889 | } | 889 | } |
| 890 | 890 | ||
| 891 | hdr = (struct macsec_eth_header *)skb->data; | 891 | hdr = (struct macsec_eth_header *)skb->data; |
| @@ -905,7 +905,7 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb, · 13 unmodified lines | |||
| 905 | skb = skb_unshare(skb, GFP_ATOMIC); | 905 | skb = skb_unshare(skb, GFP_ATOMIC); |
| 906 | if (!skb) { | 906 | if (!skb) { |
| 907 | aead_request_free(req); | 907 | aead_request_free(req); |
| 908 | return NULL; | 908 | return ERR_PTR(-ENOMEM); |
| 909 | } | 909 | } |
| 910 | } else { | 910 | } else { |
| 911 | /* integrity only: all headers + data authenticated */ | 911 | /* integrity only: all headers + data authenticated */ |
| @@ -921,14 +921,14 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb, · 9 unmodified lines | |||
| 921 | dev_hold(dev); | 921 | dev_hold(dev); |
| 922 | ret = crypto_aead_decrypt(req); | 922 | ret = crypto_aead_decrypt(req); |
| 923 | if (ret == -EINPROGRESS) { | 923 | if (ret == -EINPROGRESS) { |
| 924 | return NULL; | 924 | return ERR_PTR(ret); |
| 925 | } else if (ret != 0) { | 925 | } else if (ret != 0) { |
| 926 | /* decryption/authentication failed | 926 | /* decryption/authentication failed |
| 927 | * 10.6 if validateFrames is disabled, deliver anyway | 927 | * 10.6 if validateFrames is disabled, deliver anyway |
| 928 | */ | 928 | */ |
| 929 | if (ret != -EBADMSG) { | 929 | if (ret != -EBADMSG) { |
| 930 | kfree_skb(skb); | 930 | kfree_skb(skb); |
| 931 | skb = NULL; | 931 | skb = ERR_PTR(ret); |
| 932 | } | 932 | } |
| 933 | } else { | 933 | } else { |
| 934 | macsec_skb_cb(skb)->valid = true; | 934 | macsec_skb_cb(skb)->valid = true; |
| @@ -1146,8 +1146,10 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb) · 211 unmodified lines | |||
| 1146 | secy->validate_frames != MACSEC_VALIDATE_DISABLED) | 1146 | secy->validate_frames != MACSEC_VALIDATE_DISABLED) |
| 1147 | skb = macsec_decrypt(skb, dev, rx_sa, sci, secy); | 1147 | skb = macsec_decrypt(skb, dev, rx_sa, sci, secy); |
| 1148 | 1148 | ||
| 1149 | if (!skb) { | 1149 | if (IS_ERR(skb)) { |
| 1150 | macsec_rxsa_put(rx_sa); | 1150 | /* the decrypt callback needs the reference */ |
| 1151 | if (PTR_ERR(skb) != -EINPROGRESS) | ||
| 1152 | macsec_rxsa_put(rx_sa); | ||
| 1151 | rcu_read_unlock(); | 1153 | rcu_read_unlock(); |
| 1152 | *pskb = NULL; | 1154 | *pskb = NULL; |
| 1153 | return RX_HANDLER_CONSUMED; | 1155 | return RX_HANDLER_CONSUMED; |
| @@ -1161,7 +1163,8 @@ deliver: · 7 unmodified lines | |||
| 1161 | macsec_extra_len(macsec_skb_cb(skb)->has_sci)); | 1163 | macsec_extra_len(macsec_skb_cb(skb)->has_sci)); |
| 1162 | macsec_reset_skb(skb, secy->netdev); | 1164 | macsec_reset_skb(skb, secy->netdev); |
| 1163 | 1165 | ||
| 1164 | macsec_rxsa_put(rx_sa); | 1166 | if (rx_sa) |
| 1167 | macsec_rxsa_put(rx_sa); | ||
| 1165 | count_rx(dev, skb->len); | 1168 | count_rx(dev, skb->len); |
| 1166 | 1169 | ||
| 1167 | rcu_read_unlock(); | 1170 | rcu_read_unlock(); |
| @@ -1623,8 +1626,9 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) · 455 unmodified lines | |||
| 1623 | } | 1626 | } |
| 1624 | 1627 | ||
| 1625 | rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL); | 1628 | rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL); |
| 1626 | if (init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), secy->key_len, | 1629 | if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), |
| 1627 | secy->icv_len)) { | 1630 | secy->key_len, secy->icv_len)) { |
| 1631 | kfree(rx_sa); | ||
| 1628 | rtnl_unlock(); | 1632 | rtnl_unlock(); |
| 1629 | return -ENOMEM; | 1633 | return -ENOMEM; |
| 1630 | } | 1634 | } |
| @@ -1769,6 +1773,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) · 138 unmodified lines | |||
| 1769 | tx_sa = kmalloc(sizeof(*tx_sa), GFP_KERNEL); | 1773 | tx_sa = kmalloc(sizeof(*tx_sa), GFP_KERNEL); |
| 1770 | if (!tx_sa || init_tx_sa(tx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), | 1774 | if (!tx_sa || init_tx_sa(tx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), |
| 1771 | secy->key_len, secy->icv_len)) { | 1775 | secy->key_len, secy->icv_len)) { |
| 1776 | kfree(tx_sa); | ||
| 1772 | rtnl_unlock(); | 1777 | rtnl_unlock(); |
| 1773 | return -ENOMEM; | 1778 | return -ENOMEM; |
| 1774 | } | 1779 | } |
| @@ -2274,7 +2279,7 @@ static int nla_put_secy(struct macsec_secy *secy, struct sk_buff *skb) · 499 unmodified lines | |||
| 2274 | if (nla_put_sci(skb, MACSEC_SECY_ATTR_SCI, secy->sci, | 2279 | if (nla_put_sci(skb, MACSEC_SECY_ATTR_SCI, secy->sci, |
| 2275 | MACSEC_SECY_ATTR_PAD) || | 2280 | MACSEC_SECY_ATTR_PAD) || |
| 2276 | nla_put_u64_64bit(skb, MACSEC_SECY_ATTR_CIPHER_SUITE, | 2281 | nla_put_u64_64bit(skb, MACSEC_SECY_ATTR_CIPHER_SUITE, |
| 2277 | DEFAULT_CIPHER_ID, | 2282 | MACSEC_DEFAULT_CIPHER_ID, |
| 2278 | MACSEC_SECY_ATTR_PAD) || | 2283 | MACSEC_SECY_ATTR_PAD) || |
| 2279 | nla_put_u8(skb, MACSEC_SECY_ATTR_ICV_LEN, secy->icv_len) || | 2284 | nla_put_u8(skb, MACSEC_SECY_ATTR_ICV_LEN, secy->icv_len) || |
| 2280 | nla_put_u8(skb, MACSEC_SECY_ATTR_OPER, secy->operational) || | 2285 | nla_put_u8(skb, MACSEC_SECY_ATTR_OPER, secy->operational) || |
| @@ -2316,7 +2321,7 @@ static int dump_secy(struct macsec_secy *secy, struct net_device *dev, · 35 unmodified lines | |||
| 2316 | if (!hdr) | 2321 | if (!hdr) |
| 2317 | return -EMSGSIZE; | 2322 | return -EMSGSIZE; |
| 2318 | 2323 | ||
| 2319 | rtnl_lock(); | 2324 | genl_dump_check_consistent(cb, hdr, &macsec_fam); |
| 2320 | 2325 | ||
| 2321 | if (nla_put_u32(skb, MACSEC_ATTR_IFINDEX, dev->ifindex)) | 2326 | if (nla_put_u32(skb, MACSEC_ATTR_IFINDEX, dev->ifindex)) |
| 2322 | goto nla_put_failure; | 2327 | goto nla_put_failure; |
| @@ -2482,18 +2487,17 @@ static int dump_secy(struct macsec_secy *secy, struct net_device *dev, · 159 unmodified lines | |||
| 2482 | 2487 | ||
| 2483 | nla_nest_end(skb, rxsc_list); | 2488 | nla_nest_end(skb, rxsc_list); |
| 2484 | 2489 | ||
| 2485 | rtnl_unlock(); | ||
| 2486 | |||
| 2487 | genlmsg_end(skb, hdr); | 2490 | genlmsg_end(skb, hdr); |
| 2488 | 2491 | ||
| 2489 | return 0; | 2492 | return 0; |
| 2490 | 2493 | ||
| 2491 | nla_put_failure: | 2494 | nla_put_failure: |
| 2492 | rtnl_unlock(); | ||
| 2493 | genlmsg_cancel(skb, hdr); | 2495 | genlmsg_cancel(skb, hdr); |
| 2494 | return -EMSGSIZE; | 2496 | return -EMSGSIZE; |
| 2495 | } | 2497 | } |
| 2496 | 2498 | ||
| 2499 | static int macsec_generation = 1; /* protected by RTNL */ | ||
| 2500 | |||
| 2497 | static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb) | 2501 | static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb) |
| 2498 | { | 2502 | { |
| 2499 | struct net *net = sock_net(skb->sk); | 2503 | struct net *net = sock_net(skb->sk); |
| @@ -2503,6 +2507,10 @@ static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb) · 3 unmodified lines | |||
| 2503 | dev_idx = cb->args[0]; | 2507 | dev_idx = cb->args[0]; |
| 2504 | 2508 | ||
| 2505 | d = 0; | 2509 | d = 0; |
| 2510 | rtnl_lock(); | ||
| 2511 | |||
| 2512 | cb->seq = macsec_generation; | ||
| 2513 | |||
| 2506 | for_each_netdev(net, dev) { | 2514 | for_each_netdev(net, dev) { |
| 2507 | struct macsec_secy *secy; | 2515 | struct macsec_secy *secy; |
| 2508 | 2516 | ||
| @@ -2520,6 +2528,7 @@ next: · 11 unmodified lines | |||
| 2520 | } | 2528 | } |
| 2521 | 2529 | ||
| 2522 | done: | 2530 | done: |
| 2531 | rtnl_unlock(); | ||
| 2523 | cb->args[0] = d; | 2532 | cb->args[0] = d; |
| 2524 | return skb->len; | 2533 | return skb->len; |
| 2525 | } | 2534 | } |
| @@ -2973,10 +2982,14 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head) · 447 unmodified lines | |||
| 2973 | struct net_device *real_dev = macsec->real_dev; | 2982 | struct net_device *real_dev = macsec->real_dev; |
| 2974 | struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); | 2983 | struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); |
| 2975 | 2984 | ||
| 2985 | macsec_generation++; | ||
| 2986 | |||
| 2976 | unregister_netdevice_queue(dev, head); | 2987 | unregister_netdevice_queue(dev, head); |
| 2977 | list_del_rcu(&macsec->secys); | 2988 | list_del_rcu(&macsec->secys); |
| 2978 | if (list_empty(&rxd->secys)) | 2989 | if (list_empty(&rxd->secys)) { |
| 2979 | netdev_rx_handler_unregister(real_dev); | 2990 | netdev_rx_handler_unregister(real_dev); |
| 2991 | kfree(rxd); | ||
| 2992 | } | ||
| 2980 | 2993 | ||
| 2981 | macsec_del_dev(macsec); | 2994 | macsec_del_dev(macsec); |
| 2982 | } | 2995 | } |
| @@ -2998,8 +3011,10 @@ static int register_macsec_dev(struct net_device *real_dev, · 15 unmodified lines | |||
| 2998 | 3011 | ||
| 2999 | err = netdev_rx_handler_register(real_dev, macsec_handle_frame, | 3012 | err = netdev_rx_handler_register(real_dev, macsec_handle_frame, |
| 3000 | rxd); | 3013 | rxd); |
| 3001 | if (err < 0) | 3014 | if (err < 0) { |
| 3015 | kfree(rxd); | ||
| 3002 | return err; | 3016 | return err; |
| 3017 | } | ||
| 3003 | } | 3018 | } |
| 3004 | 3019 | ||
| 3005 | list_add_tail_rcu(&macsec->secys, &rxd->secys); | 3020 | list_add_tail_rcu(&macsec->secys, &rxd->secys); |
| @@ -3119,6 +3134,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 113 unmodified lines | |||
| 3119 | if (err < 0) | 3134 | if (err < 0) |
| 3120 | goto del_dev; | 3135 | goto del_dev; |
| 3121 | 3136 | ||
| 3137 | macsec_generation++; | ||
| 3138 | |||
| 3122 | dev_hold(real_dev); | 3139 | dev_hold(real_dev); |
| 3123 | 3140 | ||
| 3124 | return 0; | 3141 | return 0; |
| @@ -3132,7 +3149,7 @@ unregister: · 7 unmodified lines | |||
| 3132 | 3149 | ||
| 3133 | static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) | 3150 | static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) |
| 3134 | { | 3151 | { |
| 3135 | u64 csid = DEFAULT_CIPHER_ID; | 3152 | u64 csid = MACSEC_DEFAULT_CIPHER_ID; |
| 3136 | u8 icv_len = DEFAULT_ICV_LEN; | 3153 | u8 icv_len = DEFAULT_ICV_LEN; |
| 3137 | int flag; | 3154 | int flag; |
| 3138 | bool es, scb, sci; | 3155 | bool es, scb, sci; |
| @@ -3147,8 +3164,8 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) · 8 unmodified lines | |||
| 3147 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); | 3164 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
| 3148 | 3165 | ||
| 3149 | switch (csid) { | 3166 | switch (csid) { |
| 3150 | case DEFAULT_CIPHER_ID: | 3167 | case MACSEC_DEFAULT_CIPHER_ID: |
| 3151 | case DEFAULT_CIPHER_ALT: | 3168 | case MACSEC_DEFAULT_CIPHER_ALT: |
| 3152 | if (icv_len < MACSEC_MIN_ICV_LEN || | 3169 | if (icv_len < MACSEC_MIN_ICV_LEN || |
| 3153 | icv_len > MACSEC_MAX_ICV_LEN) | 3170 | icv_len > MACSEC_MAX_ICV_LEN) |
| 3154 | return -EINVAL; | 3171 | return -EINVAL; |
| @@ -3182,8 +3199,8 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) · 27 unmodified lines | |||
| 3182 | nla_get_u8(data[IFLA_MACSEC_VALIDATION]) > MACSEC_VALIDATE_MAX) | 3199 | nla_get_u8(data[IFLA_MACSEC_VALIDATION]) > MACSEC_VALIDATE_MAX) |
| 3183 | return -EINVAL; | 3200 | return -EINVAL; |
| 3184 | 3201 | ||
| 3185 | if ((data[IFLA_MACSEC_PROTECT] && | 3202 | if ((data[IFLA_MACSEC_REPLAY_PROTECT] && |
| 3186 | nla_get_u8(data[IFLA_MACSEC_PROTECT])) && | 3203 | nla_get_u8(data[IFLA_MACSEC_REPLAY_PROTECT])) && |
| 3187 | !data[IFLA_MACSEC_WINDOW]) | 3204 | !data[IFLA_MACSEC_WINDOW]) |
| 3188 | return -EINVAL; | 3205 | return -EINVAL; |
| 3189 | 3206 | ||
| @@ -3223,7 +3240,7 @@ static int macsec_fill_info(struct sk_buff *skb, · 33 unmodified lines | |||
| 3223 | IFLA_MACSEC_PAD) || | 3240 | IFLA_MACSEC_PAD) || |
| 3224 | nla_put_u8(skb, IFLA_MACSEC_ICV_LEN, secy->icv_len) || | 3241 | nla_put_u8(skb, IFLA_MACSEC_ICV_LEN, secy->icv_len) || |
| 3225 | nla_put_u64_64bit(skb, IFLA_MACSEC_CIPHER_SUITE, | 3242 | nla_put_u64_64bit(skb, IFLA_MACSEC_CIPHER_SUITE, |
| 3226 | DEFAULT_CIPHER_ID, IFLA_MACSEC_PAD) || | 3243 | MACSEC_DEFAULT_CIPHER_ID, IFLA_MACSEC_PAD) || |
| 3227 | nla_put_u8(skb, IFLA_MACSEC_ENCODING_SA, tx_sc->encoding_sa) || | 3244 | nla_put_u8(skb, IFLA_MACSEC_ENCODING_SA, tx_sc->encoding_sa) || |
| 3228 | nla_put_u8(skb, IFLA_MACSEC_ENCRYPT, tx_sc->encrypt) || | 3245 | nla_put_u8(skb, IFLA_MACSEC_ENCRYPT, tx_sc->encrypt) || |
| 3229 | nla_put_u8(skb, IFLA_MACSEC_PROTECT, secy->protect_frames) || | 3246 | nla_put_u8(skb, IFLA_MACSEC_PROTECT, secy->protect_frames) || |
| @@ -737,8 +737,19 @@ static void cpu_pm_pmu_setup(struct arm_pmu *armpmu, unsigned long cmd) · 736 unmodified lines | |||
| 737 | break; | 737 | break; |
| 738 | case CPU_PM_EXIT: | 738 | case CPU_PM_EXIT: |
| 739 | case CPU_PM_ENTER_FAILED: | 739 | case CPU_PM_ENTER_FAILED: |
| 740 | /* Restore and enable the counter */ | 740 | /* |
| 741 | armpmu_start(event, PERF_EF_RELOAD); | 741 | * Restore and enable the counter. |
| 742 | * armpmu_start() indirectly calls | ||
| 743 | * | ||
| 744 | * perf_event_update_userpage() | ||
| 745 | * | ||
| 746 | * that requires RCU read locking to be functional, | ||
| 747 | * wrap the call within RCU_NONIDLE to make the | ||
| 748 | * RCU subsystem aware this cpu is not idle from | ||
| 749 | * an RCU perspective for the armpmu_start() call | ||
| 750 | * duration. | ||
| 751 | */ | ||
| 752 | RCU_NONIDLE(armpmu_start(event, PERF_EF_RELOAD)); | ||
| 742 | break; | 753 | break; |
| 743 | default: | 754 | default: |
| 744 | break; | 755 | break; |
| @@ -86,6 +86,9 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) · 85 unmodified lines | |||
| 86 | if (!np) | 86 | if (!np) |
| 87 | return -ENODEV; | 87 | return -ENODEV; |
| 88 | 88 | ||
| 89 | if (!dev->parent || !dev->parent->of_node) | ||
| 90 | return -ENODEV; | ||
| 91 | |||
| 89 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); | 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); |
| 90 | if (IS_ERR(dp)) | 93 | if (IS_ERR(dp)) |
| 91 | return -ENOMEM; | 94 | return -ENOMEM; |
| @@ -104,9 +107,9 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 104 | return ret; | 107 | return ret; |
| 105 | } | 108 | } |
| 106 | 109 | ||
| 107 | dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); | 110 | dp->grf = syscon_node_to_regmap(dev->parent->of_node); |
| 108 | if (IS_ERR(dp->grf)) { | 111 | if (IS_ERR(dp->grf)) { |
| 109 | dev_err(dev, "rk3288-dp needs rockchip,grf property\n"); | 112 | dev_err(dev, "rk3288-dp needs the General Register Files syscon\n"); |
| 110 | return PTR_ERR(dp->grf); | 113 | return PTR_ERR(dp->grf); |
| 111 | } | 114 | } |
| 112 | 115 | ||
| @@ -176,7 +176,10 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev) · 175 unmodified lines | |||
| 176 | struct regmap *grf; | 176 | struct regmap *grf; |
| 177 | unsigned int reg_offset; | 177 | unsigned int reg_offset; |
| 178 | 178 | ||
| 179 | grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); | 179 | if (!dev->parent || !dev->parent->of_node) |
| 180 | return -ENODEV; | ||
| 181 | |||
| 182 | grf = syscon_node_to_regmap(dev->parent->of_node); | ||
| 180 | if (IS_ERR(grf)) { | 183 | if (IS_ERR(grf)) { |
| 181 | dev_err(dev, "Missing rockchip,grf property\n"); | 184 | dev_err(dev, "Missing rockchip,grf property\n"); |
| 182 | return PTR_ERR(grf); | 185 | return PTR_ERR(grf); |
| @@ -2,6 +2,7 @@ config PINCTRL_IMX · 1 unmodified line | |||
| 2 | bool | 2 | bool |
| 3 | select PINMUX | 3 | select PINMUX |
| 4 | select PINCONF | 4 | select PINCONF |
| 5 | select REGMAP | ||
| 5 | 6 | ||
| 6 | config PINCTRL_IMX1_CORE | 7 | config PINCTRL_IMX1_CORE |
| 7 | bool | 8 | bool |
| @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, · 1003 unmodified lines | |||
| 1004 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); | 1004 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); |
| 1005 | int eint_num, virq, eint_offset; | 1005 | int eint_num, virq, eint_offset; |
| 1006 | unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc; | 1006 | unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc; |
| 1007 | static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256}; | 1007 | static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000, |
| 1008 | 128000, 256000}; | ||
| 1008 | const struct mtk_desc_pin *pin; | 1009 | const struct mtk_desc_pin *pin; |
| 1009 | struct irq_data *d; | 1010 | struct irq_data *d; |
| 1010 | 1011 | ||
| @@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, · 11 unmodified lines | |||
| 1022 | if (!mtk_eint_can_en_debounce(pctl, eint_num)) | 1023 | if (!mtk_eint_can_en_debounce(pctl, eint_num)) |
| 1023 | return -ENOSYS; | 1024 | return -ENOSYS; |
| 1024 | 1025 | ||
| 1025 | dbnc = ARRAY_SIZE(dbnc_arr); | 1026 | dbnc = ARRAY_SIZE(debounce_time); |
| 1026 | for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) { | 1027 | for (i = 0; i < ARRAY_SIZE(debounce_time); i++) { |
| 1027 | if (debounce <= dbnc_arr[i]) { | 1028 | if (debounce <= debounce_time[i]) { |
| 1028 | dbnc = i; | 1029 | dbnc = i; |
| 1029 | break; | 1030 | break; |
| 1030 | } | 1031 | } |
| @@ -1280,9 +1280,9 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, · 1279 unmodified lines | |||
| 1280 | 1280 | ||
| 1281 | /* Parse pins in each row from LSB */ | 1281 | /* Parse pins in each row from LSB */ |
| 1282 | while (mask) { | 1282 | while (mask) { |
| 1283 | bit_pos = ffs(mask); | 1283 | bit_pos = __ffs(mask); |
| 1284 | pin_num_from_lsb = bit_pos / pcs->bits_per_pin; | 1284 | pin_num_from_lsb = bit_pos / pcs->bits_per_pin; |
| 1285 | mask_pos = ((pcs->fmask) << (bit_pos - 1)); | 1285 | mask_pos = ((pcs->fmask) << bit_pos); |
| 1286 | val_pos = val & mask_pos; | 1286 | val_pos = val & mask_pos; |
| 1287 | submask = mask & mask_pos; | 1287 | submask = mask & mask_pos; |
| 1288 | 1288 | ||
| @@ -1852,7 +1852,7 @@ static int pcs_probe(struct platform_device *pdev) · 563 unmodified lines | |||
| 1852 | ret = of_property_read_u32(np, "pinctrl-single,function-mask", | 1852 | ret = of_property_read_u32(np, "pinctrl-single,function-mask", |
| 1853 | &pcs->fmask); | 1853 | &pcs->fmask); |
| 1854 | if (!ret) { | 1854 | if (!ret) { |
| 1855 | pcs->fshift = ffs(pcs->fmask) - 1; | 1855 | pcs->fshift = __ffs(pcs->fmask); |
| 1856 | pcs->fmax = pcs->fmask >> pcs->fshift; | 1856 | pcs->fmax = pcs->fmask >> pcs->fshift; |
| 1857 | } else { | 1857 | } else { |
| 1858 | /* If mask property doesn't exist, function mux is invalid. */ | 1858 | /* If mask property doesn't exist, function mux is invalid. */ |
| @@ -688,6 +688,7 @@ static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr, · 687 unmodified lines | |||
| 688 | { | 688 | { |
| 689 | struct flowi6 fl; | 689 | struct flowi6 fl; |
| 690 | 690 | ||
| 691 | memset(&fl, 0, sizeof(fl)); | ||
| 691 | if (saddr) | 692 | if (saddr) |
| 692 | memcpy(&fl.saddr, saddr, sizeof(struct in6_addr)); | 693 | memcpy(&fl.saddr, saddr, sizeof(struct in6_addr)); |
| 693 | if (daddr) | 694 | if (daddr) |
| @@ -491,13 +491,14 @@ static int scpsys_probe(struct platform_device *pdev) · 490 unmodified lines | |||
| 491 | genpd->dev_ops.active_wakeup = scpsys_active_wakeup; | 491 | genpd->dev_ops.active_wakeup = scpsys_active_wakeup; |
| 492 | 492 | ||
| 493 | /* | 493 | /* |
| 494 | * With CONFIG_PM disabled turn on all domains to make the | 494 | * Initially turn on all domains to make the domains usable |
| 495 | * hardware usable. | 495 | * with !CONFIG_PM and to get the hardware in sync with the |
| 496 | * software. The unused domains will be switched off during | ||
| 497 | * late_init time. | ||
| 496 | */ | 498 | */ |
| 497 | if (!IS_ENABLED(CONFIG_PM)) | 499 | genpd->power_on(genpd); |
| 498 | genpd->power_on(genpd); | ||
| 499 | 500 | ||
| 500 | pm_genpd_init(genpd, NULL, true); | 501 | pm_genpd_init(genpd, NULL, false); |
| 501 | } | 502 | } |
| 502 | 503 | ||
| 503 | /* | 504 | /* |
| @@ -376,6 +376,8 @@ config MTK_THERMAL · 375 unmodified lines | |||
| 376 | tristate "Temperature sensor driver for mediatek SoCs" | 376 | tristate "Temperature sensor driver for mediatek SoCs" |
| 377 | depends on ARCH_MEDIATEK || COMPILE_TEST | 377 | depends on ARCH_MEDIATEK || COMPILE_TEST |
| 378 | depends on HAS_IOMEM | 378 | depends on HAS_IOMEM |
| 379 | depends on NVMEM || NVMEM=n | ||
| 380 | depends on RESET_CONTROLLER | ||
| 379 | default y | 381 | default y |
| 380 | help | 382 | help |
| 381 | Enable this option if you want to have support for thermal management | 383 | Enable this option if you want to have support for thermal management |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | |||
| 27 | #include <linux/thermal.h> | 27 | #include <linux/thermal.h> |
| 28 | #include <linux/reset.h> | 28 | #include <linux/reset.h> |
| 29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
| 30 | #include <linux/nvmem-consumer.h> | ||
| 31 | 30 | ||
| 32 | /* AUXADC Registers */ | 31 | /* AUXADC Registers */ |
| 33 | #define AUXADC_CON0_V 0x000 | 32 | #define AUXADC_CON0_V 0x000 |
| @@ -619,7 +618,7 @@ static struct platform_driver mtk_thermal_driver = { · 585 unmodified lines | |||
| 619 | 618 | ||
| 620 | module_platform_driver(mtk_thermal_driver); | 619 | module_platform_driver(mtk_thermal_driver); |
| 621 | 620 | ||
| 622 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de"); | 621 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); |
| 623 | MODULE_AUTHOR("Hanyi Wu <hanyi.wu@mediatek.com>"); | 622 | MODULE_AUTHOR("Hanyi Wu <hanyi.wu@mediatek.com>"); |
| 624 | MODULE_DESCRIPTION("Mediatek thermal driver"); | 623 | MODULE_DESCRIPTION("Mediatek thermal driver"); |
| 625 | MODULE_LICENSE("GPL v2"); | 624 | MODULE_LICENSE("GPL v2"); |
| @@ -803,8 +803,8 @@ static int thermal_of_populate_trip(struct device_node *np, · 802 unmodified lines | |||
| 803 | * otherwise, it returns a corresponding ERR_PTR(). Caller must | 803 | * otherwise, it returns a corresponding ERR_PTR(). Caller must |
| 804 | * check the return value with help of IS_ERR() helper. | 804 | * check the return value with help of IS_ERR() helper. |
| 805 | */ | 805 | */ |
| 806 | static struct __thermal_zone * | 806 | static struct __thermal_zone |
| 807 | thermal_of_build_thermal_zone(struct device_node *np) | 807 | __init *thermal_of_build_thermal_zone(struct device_node *np) |
| 808 | { | 808 | { |
| 809 | struct device_node *child = NULL, *gchild; | 809 | struct device_node *child = NULL, *gchild; |
| 810 | struct __thermal_zone *tz; | 810 | struct __thermal_zone *tz; |
| @@ -301,7 +301,7 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors, · 300 unmodified lines | |||
| 301 | capped_extra_power = 0; | 301 | capped_extra_power = 0; |
| 302 | extra_power = 0; | 302 | extra_power = 0; |
| 303 | for (i = 0; i < num_actors; i++) { | 303 | for (i = 0; i < num_actors; i++) { |
| 304 | u64 req_range = req_power[i] * power_range; | 304 | u64 req_range = (u64)req_power[i] * power_range; |
| 305 | 305 | ||
| 306 | granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range, | 306 | granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range, |
| 307 | total_req_power); | 307 | total_req_power); |
| @@ -688,7 +688,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr, · 687 unmodified lines | |||
| 688 | { | 688 | { |
| 689 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 689 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 690 | int trip, ret; | 690 | int trip, ret; |
| 691 | unsigned long temperature; | 691 | int temperature; |
| 692 | 692 | ||
| 693 | if (!tz->ops->set_trip_temp) | 693 | if (!tz->ops->set_trip_temp) |
| 694 | return -EPERM; | 694 | return -EPERM; |
| @@ -696,7 +696,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr, · 1 unmodified line | |||
| 696 | if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip)) | 696 | if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip)) |
| 697 | return -EINVAL; | 697 | return -EINVAL; |
| 698 | 698 | ||
| 699 | if (kstrtoul(buf, 10, &temperature)) | 699 | if (kstrtoint(buf, 10, &temperature)) |
| 700 | return -EINVAL; | 700 | return -EINVAL; |
| 701 | 701 | ||
| 702 | ret = tz->ops->set_trip_temp(tz, trip, temperature); | 702 | ret = tz->ops->set_trip_temp(tz, trip, temperature); |
| @@ -899,9 +899,9 @@ emul_temp_store(struct device *dev, struct device_attribute *attr, · 196 unmodified lines | |||
| 899 | { | 899 | { |
| 900 | struct thermal_zone_device *tz = to_thermal_zone(dev); | 900 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 901 | int ret = 0; | 901 | int ret = 0; |
| 902 | unsigned long temperature; | 902 | int temperature; |
| 903 | 903 | ||
| 904 | if (kstrtoul(buf, 10, &temperature)) | 904 | if (kstrtoint(buf, 10, &temperature)) |
| 905 | return -EINVAL; | 905 | return -EINVAL; |
| 906 | 906 | ||
| 907 | if (!tz->ops->set_emul_temp) { | 907 | if (!tz->ops->set_emul_temp) { |
| @@ -626,7 +626,7 @@ static int pty_unix98_ioctl(struct tty_struct *tty, · 625 unmodified lines | |||
| 626 | */ | 626 | */ |
| 627 | 627 | ||
| 628 | static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, | 628 | static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, |
| 629 | struct inode *ptm_inode, int idx) | 629 | struct file *file, int idx) |
| 630 | { | 630 | { |
| 631 | /* Master must be open via /dev/ptmx */ | 631 | /* Master must be open via /dev/ptmx */ |
| 632 | return ERR_PTR(-EIO); | 632 | return ERR_PTR(-EIO); |
| @@ -642,12 +642,12 @@ static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, · 9 unmodified lines | |||
| 642 | */ | 642 | */ |
| 643 | 643 | ||
| 644 | static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, | 644 | static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, |
| 645 | struct inode *pts_inode, int idx) | 645 | struct file *file, int idx) |
| 646 | { | 646 | { |
| 647 | struct tty_struct *tty; | 647 | struct tty_struct *tty; |
| 648 | 648 | ||
| 649 | mutex_lock(&devpts_mutex); | 649 | mutex_lock(&devpts_mutex); |
| 650 | tty = devpts_get_priv(pts_inode); | 650 | tty = devpts_get_priv(file->f_path.dentry); |
| 651 | mutex_unlock(&devpts_mutex); | 651 | mutex_unlock(&devpts_mutex); |
| 652 | /* Master must be open before slave */ | 652 | /* Master must be open before slave */ |
| 653 | if (!tty) | 653 | if (!tty) |
| @@ -722,7 +722,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) · 68 unmodified lines | |||
| 722 | { | 722 | { |
| 723 | struct pts_fs_info *fsi; | 723 | struct pts_fs_info *fsi; |
| 724 | struct tty_struct *tty; | 724 | struct tty_struct *tty; |
| 725 | struct inode *slave_inode; | 725 | struct dentry *dentry; |
| 726 | int retval; | 726 | int retval; |
| 727 | int index; | 727 | int index; |
| 728 | 728 | ||
| @@ -769,14 +769,12 @@ static int ptmx_open(struct inode *inode, struct file *filp) · 40 unmodified lines | |||
| 769 | 769 | ||
| 770 | tty_add_file(tty, filp); | 770 | tty_add_file(tty, filp); |
| 771 | 771 | ||
| 772 | slave_inode = devpts_pty_new(fsi, | 772 | dentry = devpts_pty_new(fsi, index, tty->link); |
| 773 | MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index, | 773 | if (IS_ERR(dentry)) { |
| 774 | tty->link); | 774 | retval = PTR_ERR(dentry); |
| 775 | if (IS_ERR(slave_inode)) { | ||
| 776 | retval = PTR_ERR(slave_inode); | ||
| 777 | goto err_release; | 775 | goto err_release; |
| 778 | } | 776 | } |
| 779 | tty->link->driver_data = slave_inode; | 777 | tty->link->driver_data = dentry; |
| 780 | 778 | ||
| 781 | retval = ptm_driver->ops->open(tty, filp); | 779 | retval = ptm_driver->ops->open(tty, filp); |
| 782 | if (retval) | 780 | if (retval) |
| @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p) · 1402 unmodified lines | |||
| 1403 | /* | 1403 | /* |
| 1404 | * Empty the RX FIFO, we are not interested in anything | 1404 | * Empty the RX FIFO, we are not interested in anything |
| 1405 | * received during the half-duplex transmission. | 1405 | * received during the half-duplex transmission. |
| 1406 | * Enable previously disabled RX interrupts. | ||
| 1406 | */ | 1407 | */ |
| 1407 | if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) | 1408 | if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) { |
| 1408 | serial8250_clear_fifos(p); | 1409 | serial8250_clear_fifos(p); |
| 1410 | |||
| 1411 | serial8250_rpm_get(p); | ||
| 1412 | |||
| 1413 | p->ier |= UART_IER_RLSI | UART_IER_RDI; | ||
| 1414 | serial_port_out(&p->port, UART_IER, p->ier); | ||
| 1415 | |||
| 1416 | serial8250_rpm_put(p); | ||
| 1417 | } | ||
| 1409 | } | 1418 | } |
| 1410 | 1419 | ||
| 1411 | static void serial8250_em485_handle_stop_tx(unsigned long arg) | 1420 | static void serial8250_em485_handle_stop_tx(unsigned long arg) |
| @@ -324,7 +324,6 @@ config SERIAL_8250_EM · 323 unmodified lines | |||
| 324 | config SERIAL_8250_RT288X | 324 | config SERIAL_8250_RT288X |
| 325 | bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support" | 325 | bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support" |
| 326 | depends on SERIAL_8250 | 326 | depends on SERIAL_8250 |
| 327 | depends on MIPS || COMPILE_TEST | ||
| 328 | default y if MIPS_ALCHEMY || SOC_RT288X || SOC_RT305X || SOC_RT3883 || SOC_MT7620 | 327 | default y if MIPS_ALCHEMY || SOC_RT288X || SOC_RT305X || SOC_RT3883 || SOC_MT7620 |
| 329 | help | 328 | help |
| 330 | Selecting this option will add support for the alternate register | 329 | Selecting this option will add support for the alternate register |
| @@ -72,7 +72,7 @@ static void uartlite_outbe32(u32 val, void __iomem *addr) · 71 unmodified lines | |||
| 72 | iowrite32be(val, addr); | 72 | iowrite32be(val, addr); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static const struct uartlite_reg_ops uartlite_be = { | 75 | static struct uartlite_reg_ops uartlite_be = { |
| 76 | .in = uartlite_inbe32, | 76 | .in = uartlite_inbe32, |
| 77 | .out = uartlite_outbe32, | 77 | .out = uartlite_outbe32, |
| 78 | }; | 78 | }; |
| @@ -87,21 +87,21 @@ static void uartlite_outle32(u32 val, void __iomem *addr) · 8 unmodified lines | |||
| 87 | iowrite32(val, addr); | 87 | iowrite32(val, addr); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static const struct uartlite_reg_ops uartlite_le = { | 90 | static struct uartlite_reg_ops uartlite_le = { |
| 91 | .in = uartlite_inle32, | 91 | .in = uartlite_inle32, |
| 92 | .out = uartlite_outle32, | 92 | .out = uartlite_outle32, |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static inline u32 uart_in32(u32 offset, struct uart_port *port) | 95 | static inline u32 uart_in32(u32 offset, struct uart_port *port) |
| 96 | { | 96 | { |
| 97 | const struct uartlite_reg_ops *reg_ops = port->private_data; | 97 | struct uartlite_reg_ops *reg_ops = port->private_data; |
| 98 | 98 | ||
| 99 | return reg_ops->in(port->membase + offset); | 99 | return reg_ops->in(port->membase + offset); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static inline void uart_out32(u32 val, u32 offset, struct uart_port *port) | 102 | static inline void uart_out32(u32 val, u32 offset, struct uart_port *port) |
| 103 | { | 103 | { |
| 104 | const struct uartlite_reg_ops *reg_ops = port->private_data; | 104 | struct uartlite_reg_ops *reg_ops = port->private_data; |
| 105 | 105 | ||
| 106 | reg_ops->out(val, port->membase + offset); | 106 | reg_ops->out(val, port->membase + offset); |
| 107 | } | 107 | } |
| @@ -1367,12 +1367,12 @@ static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p) · 1366 unmodified lines | |||
| 1367 | * Locking: tty_mutex must be held. If the tty is found, bump the tty kref. | 1367 | * Locking: tty_mutex must be held. If the tty is found, bump the tty kref. |
| 1368 | */ | 1368 | */ |
| 1369 | static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver, | 1369 | static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver, |
| 1370 | struct inode *inode, int idx) | 1370 | struct file *file, int idx) |
| 1371 | { | 1371 | { |
| 1372 | struct tty_struct *tty; | 1372 | struct tty_struct *tty; |
| 1373 | 1373 | ||
| 1374 | if (driver->ops->lookup) | 1374 | if (driver->ops->lookup) |
| 1375 | tty = driver->ops->lookup(driver, inode, idx); | 1375 | tty = driver->ops->lookup(driver, file, idx); |
| 1376 | else | 1376 | else |
| 1377 | tty = driver->ttys[idx]; | 1377 | tty = driver->ttys[idx]; |
| 1378 | 1378 | ||
| @@ -2040,7 +2040,7 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, · 661 unmodified lines | |||
| 2040 | } | 2040 | } |
| 2041 | 2041 | ||
| 2042 | /* check whether we're reopening an existing tty */ | 2042 | /* check whether we're reopening an existing tty */ |
| 2043 | tty = tty_driver_lookup_tty(driver, inode, index); | 2043 | tty = tty_driver_lookup_tty(driver, filp, index); |
| 2044 | if (IS_ERR(tty)) { | 2044 | if (IS_ERR(tty)) { |
| 2045 | mutex_unlock(&tty_mutex); | 2045 | mutex_unlock(&tty_mutex); |
| 2046 | goto out; | 2046 | goto out; |
| @@ -1150,6 +1150,11 @@ static int dwc3_suspend(struct device *dev) · 1149 unmodified lines | |||
| 1150 | phy_exit(dwc->usb2_generic_phy); | 1150 | phy_exit(dwc->usb2_generic_phy); |
| 1151 | phy_exit(dwc->usb3_generic_phy); | 1151 | phy_exit(dwc->usb3_generic_phy); |
| 1152 | 1152 | ||
| 1153 | usb_phy_set_suspend(dwc->usb2_phy, 1); | ||
| 1154 | usb_phy_set_suspend(dwc->usb3_phy, 1); | ||
| 1155 | WARN_ON(phy_power_off(dwc->usb2_generic_phy) < 0); | ||
| 1156 | WARN_ON(phy_power_off(dwc->usb3_generic_phy) < 0); | ||
| 1157 | |||
| 1153 | pinctrl_pm_select_sleep_state(dev); | 1158 | pinctrl_pm_select_sleep_state(dev); |
| 1154 | 1159 | ||
| 1155 | return 0; | 1160 | return 0; |
| @@ -1163,11 +1168,21 @@ static int dwc3_resume(struct device *dev) · 7 unmodified lines | |||
| 1163 | 1168 | ||
| 1164 | pinctrl_pm_select_default_state(dev); | 1169 | pinctrl_pm_select_default_state(dev); |
| 1165 | 1170 | ||
| 1171 | usb_phy_set_suspend(dwc->usb2_phy, 0); | ||
| 1172 | usb_phy_set_suspend(dwc->usb3_phy, 0); | ||
| 1173 | ret = phy_power_on(dwc->usb2_generic_phy); | ||
| 1174 | if (ret < 0) | ||
| 1175 | return ret; | ||
| 1176 | |||
| 1177 | ret = phy_power_on(dwc->usb3_generic_phy); | ||
| 1178 | if (ret < 0) | ||
| 1179 | goto err_usb2phy_power; | ||
| 1180 | |||
| 1166 | usb_phy_init(dwc->usb3_phy); | 1181 | usb_phy_init(dwc->usb3_phy); |
| 1167 | usb_phy_init(dwc->usb2_phy); | 1182 | usb_phy_init(dwc->usb2_phy); |
| 1168 | ret = phy_init(dwc->usb2_generic_phy); | 1183 | ret = phy_init(dwc->usb2_generic_phy); |
| 1169 | if (ret < 0) | 1184 | if (ret < 0) |
| 1170 | return ret; | 1185 | goto err_usb3phy_power; |
| 1171 | 1186 | ||
| 1172 | ret = phy_init(dwc->usb3_generic_phy); | 1187 | ret = phy_init(dwc->usb3_generic_phy); |
| 1173 | if (ret < 0) | 1188 | if (ret < 0) |
| @@ -1200,6 +1215,12 @@ static int dwc3_resume(struct device *dev) · 26 unmodified lines | |||
| 1200 | err_usb2phy_init: | 1215 | err_usb2phy_init: |
| 1201 | phy_exit(dwc->usb2_generic_phy); | 1216 | phy_exit(dwc->usb2_generic_phy); |
| 1202 | 1217 | ||
| 1218 | err_usb3phy_power: | ||
| 1219 | phy_power_off(dwc->usb3_generic_phy); | ||
| 1220 | |||
| 1221 | err_usb2phy_power: | ||
| 1222 | phy_power_off(dwc->usb2_generic_phy); | ||
| 1223 | |||
| 1203 | return ret; | 1224 | return ret; |
| 1204 | } | 1225 | } |
| 1205 | 1226 | ||
| @@ -645,7 +645,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc) · 644 unmodified lines | |||
| 645 | file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); | 645 | file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); |
| 646 | if (!file) { | 646 | if (!file) { |
| 647 | ret = -ENOMEM; | 647 | ret = -ENOMEM; |
| 648 | goto err1; | 648 | goto err2; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { | 651 | if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { |
| @@ -653,7 +653,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc) · 1 unmodified line | |||
| 653 | dwc, &dwc3_mode_fops); | 653 | dwc, &dwc3_mode_fops); |
| 654 | if (!file) { | 654 | if (!file) { |
| 655 | ret = -ENOMEM; | 655 | ret = -ENOMEM; |
| 656 | goto err1; | 656 | goto err2; |
| 657 | } | 657 | } |
| 658 | } | 658 | } |
| 659 | 659 | ||
| @@ -663,19 +663,22 @@ int dwc3_debugfs_init(struct dwc3 *dwc) · 3 unmodified lines | |||
| 663 | dwc, &dwc3_testmode_fops); | 663 | dwc, &dwc3_testmode_fops); |
| 664 | if (!file) { | 664 | if (!file) { |
| 665 | ret = -ENOMEM; | 665 | ret = -ENOMEM; |
| 666 | goto err1; | 666 | goto err2; |
| 667 | } | 667 | } |
| 668 | 668 | ||
| 669 | file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, | 669 | file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, |
| 670 | dwc, &dwc3_link_state_fops); | 670 | dwc, &dwc3_link_state_fops); |
| 671 | if (!file) { | 671 | if (!file) { |
| 672 | ret = -ENOMEM; | 672 | ret = -ENOMEM; |
| 673 | goto err1; | 673 | goto err2; |
| 674 | } | 674 | } |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | return 0; | 677 | return 0; |
| 678 | 678 | ||
| 679 | err2: | ||
| 680 | kfree(dwc->regset); | ||
| 681 | |||
| 679 | err1: | 682 | err1: |
| 680 | debugfs_remove_recursive(root); | 683 | debugfs_remove_recursive(root); |
| 681 | 684 | ||
| @@ -686,5 +689,5 @@ err0: · 4 unmodified lines | |||
| 686 | void dwc3_debugfs_exit(struct dwc3 *dwc) | 689 | void dwc3_debugfs_exit(struct dwc3 *dwc) |
| 687 | { | 690 | { |
| 688 | debugfs_remove_recursive(dwc->root); | 691 | debugfs_remove_recursive(dwc->root); |
| 689 | dwc->root = NULL; | 692 | kfree(dwc->regset); |
| 690 | } | 693 | } |
| @@ -496,7 +496,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) · 495 unmodified lines | |||
| 496 | ret = pm_runtime_get_sync(dev); | 496 | ret = pm_runtime_get_sync(dev); |
| 497 | if (ret < 0) { | 497 | if (ret < 0) { |
| 498 | dev_err(dev, "get_sync failed with err %d\n", ret); | 498 | dev_err(dev, "get_sync failed with err %d\n", ret); |
| 499 | goto err0; | 499 | goto err1; |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | dwc3_omap_map_offset(omap); | 502 | dwc3_omap_map_offset(omap); |
| @@ -516,28 +516,24 @@ static int dwc3_omap_probe(struct platform_device *pdev) · 13 unmodified lines | |||
| 516 | 516 | ||
| 517 | ret = dwc3_omap_extcon_register(omap); | 517 | ret = dwc3_omap_extcon_register(omap); |
| 518 | if (ret < 0) | 518 | if (ret < 0) |
| 519 | goto err2; | 519 | goto err1; |
| 520 | 520 | ||
| 521 | ret = of_platform_populate(node, NULL, NULL, dev); | 521 | ret = of_platform_populate(node, NULL, NULL, dev); |
| 522 | if (ret) { | 522 | if (ret) { |
| 523 | dev_err(&pdev->dev, "failed to create dwc3 core\n"); | 523 | dev_err(&pdev->dev, "failed to create dwc3 core\n"); |
| 524 | goto err3; | 524 | goto err2; |
| 525 | } | 525 | } |
| 526 | 526 | ||
| 527 | dwc3_omap_enable_irqs(omap); | 527 | dwc3_omap_enable_irqs(omap); |
| 528 | 528 | ||
| 529 | return 0; | 529 | return 0; |
| 530 | 530 | ||
| 531 | err3: | 531 | err2: |
| 532 | extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); | 532 | extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); |
| 533 | extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); | 533 | extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); |
| 534 | err2: | ||
| 535 | dwc3_omap_disable_irqs(omap); | ||
| 536 | 534 | ||
| 537 | err1: | 535 | err1: |
| 538 | pm_runtime_put_sync(dev); | 536 | pm_runtime_put_sync(dev); |
| 539 | |||
| 540 | err0: | ||
| 541 | pm_runtime_disable(dev); | 537 | pm_runtime_disable(dev); |
| 542 | 538 | ||
| 543 | return ret; | 539 | return ret; |
| @@ -2936,6 +2936,9 @@ void dwc3_gadget_exit(struct dwc3 *dwc) · 2935 unmodified lines | |||
| 2936 | 2936 | ||
| 2937 | int dwc3_gadget_suspend(struct dwc3 *dwc) | 2937 | int dwc3_gadget_suspend(struct dwc3 *dwc) |
| 2938 | { | 2938 | { |
| 2939 | if (!dwc->gadget_driver) | ||
| 2940 | return 0; | ||
| 2941 | |||
| 2939 | if (dwc->pullups_connected) { | 2942 | if (dwc->pullups_connected) { |
| 2940 | dwc3_gadget_disable_irq(dwc); | 2943 | dwc3_gadget_disable_irq(dwc); |
| 2941 | dwc3_gadget_run_stop(dwc, true, true); | 2944 | dwc3_gadget_run_stop(dwc, true, true); |
| @@ -2954,6 +2957,9 @@ int dwc3_gadget_resume(struct dwc3 *dwc) · 12 unmodified lines | |||
| 2954 | struct dwc3_ep *dep; | 2957 | struct dwc3_ep *dep; |
| 2955 | int ret; | 2958 | int ret; |
| 2956 | 2959 | ||
| 2960 | if (!dwc->gadget_driver) | ||
| 2961 | return 0; | ||
| 2962 | |||
| 2957 | /* Start with SuperSpeed Default */ | 2963 | /* Start with SuperSpeed Default */ |
| 2958 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512); | 2964 | dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512); |
| 2959 | 2965 | ||
| @@ -651,6 +651,8 @@ static int bos_desc(struct usb_composite_dev *cdev) · 650 unmodified lines | |||
| 651 | ssp_cap->bLength = USB_DT_USB_SSP_CAP_SIZE(1); | 651 | ssp_cap->bLength = USB_DT_USB_SSP_CAP_SIZE(1); |
| 652 | ssp_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; | 652 | ssp_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; |
| 653 | ssp_cap->bDevCapabilityType = USB_SSP_CAP_TYPE; | 653 | ssp_cap->bDevCapabilityType = USB_SSP_CAP_TYPE; |
| 654 | ssp_cap->bReserved = 0; | ||
| 655 | ssp_cap->wReserved = 0; | ||
| 654 | 656 | ||
| 655 | /* SSAC = 1 (2 attributes) */ | 657 | /* SSAC = 1 (2 attributes) */ |
| 656 | ssp_cap->bmAttributes = cpu_to_le32(1); | 658 | ssp_cap->bmAttributes = cpu_to_le32(1); |
| @@ -646,6 +646,7 @@ static void ffs_user_copy_worker(struct work_struct *work) · 645 unmodified lines | |||
| 646 | work); | 646 | work); |
| 647 | int ret = io_data->req->status ? io_data->req->status : | 647 | int ret = io_data->req->status ? io_data->req->status : |
| 648 | io_data->req->actual; | 648 | io_data->req->actual; |
| 649 | bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; | ||
| 649 | 650 | ||
| 650 | if (io_data->read && ret > 0) { | 651 | if (io_data->read && ret > 0) { |
| 651 | use_mm(io_data->mm); | 652 | use_mm(io_data->mm); |
| @@ -657,13 +658,11 @@ static void ffs_user_copy_worker(struct work_struct *work) · 5 unmodified lines | |||
| 657 | 658 | ||
| 658 | io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); | 659 | io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); |
| 659 | 660 | ||
| 660 | if (io_data->ffs->ffs_eventfd && | 661 | if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) |
| 661 | !(io_data->kiocb->ki_flags & IOCB_EVENTFD)) | ||
| 662 | eventfd_signal(io_data->ffs->ffs_eventfd, 1); | 662 | eventfd_signal(io_data->ffs->ffs_eventfd, 1); |
| 663 | 663 | ||
| 664 | usb_ep_free_request(io_data->ep, io_data->req); | 664 | usb_ep_free_request(io_data->ep, io_data->req); |
| 665 | 665 | ||
| 666 | io_data->kiocb->private = NULL; | ||
| 667 | if (io_data->read) | 666 | if (io_data->read) |
| 668 | kfree(io_data->to_free); | 667 | kfree(io_data->to_free); |
| 669 | kfree(io_data->buf); | 668 | kfree(io_data->buf); |
| @@ -604,8 +604,7 @@ void devpts_put_ref(struct pts_fs_info *fsi) · 603 unmodified lines | |||
| 604 | * | 604 | * |
| 605 | * The created inode is returned. Remove it from /dev/pts/ by devpts_pty_kill. | 605 | * The created inode is returned. Remove it from /dev/pts/ by devpts_pty_kill. |
| 606 | */ | 606 | */ |
| 607 | struct inode *devpts_pty_new(struct pts_fs_info *fsi, dev_t device, int index, | 607 | struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv) |
| 608 | void *priv) | ||
| 609 | { | 608 | { |
| 610 | struct dentry *dentry; | 609 | struct dentry *dentry; |
| 611 | struct super_block *sb; | 610 | struct super_block *sb; |
| @@ -629,25 +628,21 @@ struct inode *devpts_pty_new(struct pts_fs_info *fsi, dev_t device, int index, · 17 unmodified lines | |||
| 629 | inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); | 628 | inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); |
| 630 | inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); | 629 | inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); |
| 631 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 630 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
| 632 | init_special_inode(inode, S_IFCHR|opts->mode, device); | 631 | init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index)); |
| 633 | inode->i_private = priv; | ||
| 634 | 632 | ||
| 635 | sprintf(s, "%d", index); | 633 | sprintf(s, "%d", index); |
| 636 | 634 | ||
| 637 | inode_lock(d_inode(root)); | ||
| 638 | |||
| 639 | dentry = d_alloc_name(root, s); | 635 | dentry = d_alloc_name(root, s); |
| 640 | if (dentry) { | 636 | if (dentry) { |
| 637 | dentry->d_fsdata = priv; | ||
| 641 | d_add(dentry, inode); | 638 | d_add(dentry, inode); |
| 642 | fsnotify_create(d_inode(root), dentry); | 639 | fsnotify_create(d_inode(root), dentry); |
| 643 | } else { | 640 | } else { |
| 644 | iput(inode); | 641 | iput(inode); |
| 645 | inode = ERR_PTR(-ENOMEM); | 642 | dentry = ERR_PTR(-ENOMEM); |
| 646 | } | 643 | } |
| 647 | 644 | ||
| 648 | inode_unlock(d_inode(root)); | 645 | return dentry; |
| 649 | |||
| 650 | return inode; | ||
| 651 | } | 646 | } |
| 652 | 647 | ||
| 653 | /** | 648 | /** |
| @@ -656,24 +651,10 @@ struct inode *devpts_pty_new(struct pts_fs_info *fsi, dev_t device, int index, · 2 unmodified lines | |||
| 656 | * | 651 | * |
| 657 | * Returns whatever was passed as priv in devpts_pty_new for a given inode. | 652 | * Returns whatever was passed as priv in devpts_pty_new for a given inode. |
| 658 | */ | 653 | */ |
| 659 | void *devpts_get_priv(struct inode *pts_inode) | 654 | void *devpts_get_priv(struct dentry *dentry) |
| 660 | { | 655 | { |
| 661 | struct dentry *dentry; | 656 | WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); |
| 662 | void *priv = NULL; | 657 | return dentry->d_fsdata; |
| 663 | |||
| 664 | BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); | ||
| 665 | |||
| 666 | /* Ensure dentry has not been deleted by devpts_pty_kill() */ | ||
| 667 | dentry = d_find_alias(pts_inode); | ||
| 668 | if (!dentry) | ||
| 669 | return NULL; | ||
| 670 | |||
| 671 | if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) | ||
| 672 | priv = pts_inode->i_private; | ||
| 673 | |||
| 674 | dput(dentry); | ||
| 675 | |||
| 676 | return priv; | ||
| 677 | } | 658 | } |
| 678 | 659 | ||
| 679 | /** | 660 | /** |
| @@ -682,24 +663,14 @@ void *devpts_get_priv(struct inode *pts_inode) · 2 unmodified lines | |||
| 682 | * | 663 | * |
| 683 | * This is an inverse operation of devpts_pty_new. | 664 | * This is an inverse operation of devpts_pty_new. |
| 684 | */ | 665 | */ |
| 685 | void devpts_pty_kill(struct inode *inode) | 666 | void devpts_pty_kill(struct dentry *dentry) |
| 686 | { | 667 | { |
| 687 | struct super_block *sb = pts_sb_from_inode(inode); | 668 | WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); |
| 688 | struct dentry *root = sb->s_root; | ||
| 689 | struct dentry *dentry; | ||
| 690 | 669 | ||
| 691 | BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); | 670 | dentry->d_fsdata = NULL; |
| 692 | 671 | drop_nlink(dentry->d_inode); | |
| 693 | inode_lock(d_inode(root)); | ||
| 694 | |||
| 695 | dentry = d_find_alias(inode); | ||
| 696 | |||
| 697 | drop_nlink(inode); | ||
| 698 | d_delete(dentry); | 672 | d_delete(dentry); |
| 699 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ | 673 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ |
| 700 | dput(dentry); /* d_find_alias above */ | ||
| 701 | |||
| 702 | inode_unlock(d_inode(root)); | ||
| 703 | } | 674 | } |
| 704 | 675 | ||
| 705 | static int __init init_devpts_fs(void) | 676 | static int __init init_devpts_fs(void) |
| @@ -108,11 +108,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, · 107 unmodified lines | |||
| 108 | u32 val; | 108 | u32 val; |
| 109 | 109 | ||
| 110 | preempt_disable(); | 110 | preempt_disable(); |
| 111 | if (unlikely(get_user(val, uaddr) != 0)) | 111 | if (unlikely(get_user(val, uaddr) != 0)) { |
| 112 | preempt_enable(); | ||
| 112 | return -EFAULT; | 113 | return -EFAULT; |
| 114 | } | ||
| 113 | 115 | ||
| 114 | if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) | 116 | if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) { |
| 117 | preempt_enable(); | ||
| 115 | return -EFAULT; | 118 | return -EFAULT; |
| 119 | } | ||
| 116 | 120 | ||
| 117 | *uval = val; | 121 | *uval = val; |
| 118 | preempt_enable(); | 122 | preempt_enable(); |
| @@ -39,6 +39,8 @@ static inline bool drm_arch_can_wc_memory(void) · 38 unmodified lines | |||
| 39 | { | 39 | { |
| 40 | #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) | 40 | #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) |
| 41 | return false; | 41 | return false; |
| 42 | #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) | ||
| 43 | return false; | ||
| 42 | #else | 44 | #else |
| 43 | return true; | 45 | return true; |
| 44 | #endif | 46 | #endif |
| @@ -27,11 +27,11 @@ int devpts_new_index(struct pts_fs_info *); · 26 unmodified lines | |||
| 27 | void devpts_kill_index(struct pts_fs_info *, int); | 27 | void devpts_kill_index(struct pts_fs_info *, int); |
| 28 | 28 | ||
| 29 | /* mknod in devpts */ | 29 | /* mknod in devpts */ |
| 30 | struct inode *devpts_pty_new(struct pts_fs_info *, dev_t, int, void *); | 30 | struct dentry *devpts_pty_new(struct pts_fs_info *, int, void *); |
| 31 | /* get private structure */ | 31 | /* get private structure */ |
| 32 | void *devpts_get_priv(struct inode *pts_inode); | 32 | void *devpts_get_priv(struct dentry *); |
| 33 | /* unlink */ | 33 | /* unlink */ |
| 34 | void devpts_pty_kill(struct inode *inode); | 34 | void devpts_pty_kill(struct dentry *); |
| 35 | 35 | ||
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| @@ -526,8 +526,9 @@ enum mlx5_device_state { · 525 unmodified lines | |||
| 526 | }; | 526 | }; |
| 527 | 527 | ||
| 528 | enum mlx5_interface_state { | 528 | enum mlx5_interface_state { |
| 529 | MLX5_INTERFACE_STATE_DOWN, | 529 | MLX5_INTERFACE_STATE_DOWN = BIT(0), |
| 530 | MLX5_INTERFACE_STATE_UP, | 530 | MLX5_INTERFACE_STATE_UP = BIT(1), |
| 531 | MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2), | ||
| 531 | }; | 532 | }; |
| 532 | 533 | ||
| 533 | enum mlx5_pci_status { | 534 | enum mlx5_pci_status { |
| @@ -551,7 +552,7 @@ struct mlx5_core_dev { · 17 unmodified lines | |||
| 551 | enum mlx5_device_state state; | 552 | enum mlx5_device_state state; |
| 552 | /* sync interface state */ | 553 | /* sync interface state */ |
| 553 | struct mutex intf_state_mutex; | 554 | struct mutex intf_state_mutex; |
| 554 | enum mlx5_interface_state interface_state; | 555 | unsigned long intf_state; |
| 555 | void (*event) (struct mlx5_core_dev *dev, | 556 | void (*event) (struct mlx5_core_dev *dev, |
| 556 | enum mlx5_dev_event event, | 557 | enum mlx5_dev_event event, |
| 557 | unsigned long param); | 558 | unsigned long param); |
| @@ -73,9 +73,9 @@ int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, · 72 unmodified lines | |||
| 73 | enum mlx5_port_status *status); | 73 | enum mlx5_port_status *status); |
| 74 | int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration); | 74 | int mlx5_set_port_beacon(struct mlx5_core_dev *dev, u16 beacon_duration); |
| 75 | 75 | ||
| 76 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port); | 76 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, u16 mtu, u8 port); |
| 77 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port); | 77 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, u16 *max_mtu, u8 port); |
| 78 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu, | 78 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, u16 *oper_mtu, |
| 79 | u8 port); | 79 | u8 port); |
| 80 | 80 | ||
| 81 | int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev, | 81 | int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev, |
| @@ -45,6 +45,8 @@ int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, · 44 unmodified lines | |||
| 45 | u16 vport, u8 *addr); | 45 | u16 vport, u8 *addr); |
| 46 | int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, | 46 | int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, |
| 47 | u16 vport, u8 *addr); | 47 | u16 vport, u8 *addr); |
| 48 | int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu); | ||
| 49 | int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu); | ||
| 48 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, | 50 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, |
| 49 | u64 *system_image_guid); | 51 | u64 *system_image_guid); |
| 50 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); | 52 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); |
| @@ -352,8 +352,8 @@ struct thermal_zone_of_device_ops { · 351 unmodified lines | |||
| 352 | 352 | ||
| 353 | struct thermal_trip { | 353 | struct thermal_trip { |
| 354 | struct device_node *np; | 354 | struct device_node *np; |
| 355 | unsigned long int temperature; | 355 | int temperature; |
| 356 | unsigned long int hysteresis; | 356 | int hysteresis; |
| 357 | enum thermal_trip_type type; | 357 | enum thermal_trip_type type; |
| 358 | }; | 358 | }; |
| 359 | 359 | ||
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * defined; unless noted otherwise, they are optional, and can be | 7 | * defined; unless noted otherwise, they are optional, and can be |
| 8 | * filled in with a null pointer. | 8 | * filled in with a null pointer. |
| 9 | * | 9 | * |
| 10 | * struct tty_struct * (*lookup)(struct tty_driver *self, int idx) | 10 | * struct tty_struct * (*lookup)(struct tty_driver *self, struct file *, int idx) |
| 11 | * | 11 | * |
| 12 | * Return the tty device corresponding to idx, NULL if there is not | 12 | * Return the tty device corresponding to idx, NULL if there is not |
| 13 | * one currently in use and an ERR_PTR value on error. Called under | 13 | * one currently in use and an ERR_PTR value on error. Called under |
| @@ -250,7 +250,7 @@ struct serial_icounter_struct; · 236 unmodified lines | |||
| 250 | 250 | ||
| 251 | struct tty_operations { | 251 | struct tty_operations { |
| 252 | struct tty_struct * (*lookup)(struct tty_driver *driver, | 252 | struct tty_struct * (*lookup)(struct tty_driver *driver, |
| 253 | struct inode *inode, int idx); | 253 | struct file *filp, int idx); |
| 254 | int (*install)(struct tty_driver *driver, struct tty_struct *tty); | 254 | int (*install)(struct tty_driver *driver, struct tty_struct *tty); |
| 255 | void (*remove)(struct tty_driver *driver, struct tty_struct *tty); | 255 | void (*remove)(struct tty_driver *driver, struct tty_struct *tty); |
| 256 | int (*open)(struct tty_struct * tty, struct file * filp); | 256 | int (*open)(struct tty_struct * tty, struct file * filp); |
| @@ -54,6 +54,8 @@ struct switchdev_attr { · 53 unmodified lines | |||
| 54 | struct net_device *orig_dev; | 54 | struct net_device *orig_dev; |
| 55 | enum switchdev_attr_id id; | 55 | enum switchdev_attr_id id; |
| 56 | u32 flags; | 56 | u32 flags; |
| 57 | void *complete_priv; | ||
| 58 | void (*complete)(struct net_device *dev, int err, void *priv); | ||
| 57 | union { | 59 | union { |
| 58 | struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */ | 60 | struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */ |
| 59 | u8 stp_state; /* PORT_STP_STATE */ | 61 | u8 stp_state; /* PORT_STP_STATE */ |
| @@ -75,6 +77,8 @@ struct switchdev_obj { · 15 unmodified lines | |||
| 75 | struct net_device *orig_dev; | 77 | struct net_device *orig_dev; |
| 76 | enum switchdev_obj_id id; | 78 | enum switchdev_obj_id id; |
| 77 | u32 flags; | 79 | u32 flags; |
| 80 | void *complete_priv; | ||
| 81 | void (*complete)(struct net_device *dev, int err, void *priv); | ||
| 78 | }; | 82 | }; |
| 79 | 83 | ||
| 80 | /* SWITCHDEV_OBJ_ID_PORT_VLAN */ | 84 | /* SWITCHDEV_OBJ_ID_PORT_VLAN */ |
| @@ -17,6 +17,8 @@ int snd_hdac_regmap_add_vendor_verb(struct hdac_device *codec, · 16 unmodified lines | |||
| 17 | unsigned int verb); | 17 | unsigned int verb); |
| 18 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, | 18 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, |
| 19 | unsigned int *val); | 19 | unsigned int *val); |
| 20 | int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec, | ||
| 21 | unsigned int reg, unsigned int *val); | ||
| 20 | int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg, | 22 | int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg, |
| 21 | unsigned int val); | 23 | unsigned int val); |
| 22 | int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg, | 24 | int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg, |
| @@ -717,9 +717,13 @@ __SYSCALL(__NR_membarrier, sys_membarrier) · 716 unmodified lines | |||
| 717 | __SYSCALL(__NR_mlock2, sys_mlock2) | 717 | __SYSCALL(__NR_mlock2, sys_mlock2) |
| 718 | #define __NR_copy_file_range 285 | 718 | #define __NR_copy_file_range 285 |
| 719 | __SYSCALL(__NR_copy_file_range, sys_copy_file_range) | 719 | __SYSCALL(__NR_copy_file_range, sys_copy_file_range) |
| 720 | #define __NR_preadv2 286 | ||
| 721 | __SYSCALL(__NR_preadv2, sys_preadv2) | ||
| 722 | #define __NR_pwritev2 287 | ||
| 723 | __SYSCALL(__NR_pwritev2, sys_pwritev2) | ||
| 720 | 724 | ||
| 721 | #undef __NR_syscalls | 725 | #undef __NR_syscalls |
| 722 | #define __NR_syscalls 286 | 726 | #define __NR_syscalls 288 |
| 723 | 727 | ||
| 724 | /* | 728 | /* |
| 725 | * All syscalls below here should go away really, | 729 | * All syscalls below here should go away really, |
| @@ -19,8 +19,8 @@ · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | #define MACSEC_MAX_KEY_LEN 128 | 20 | #define MACSEC_MAX_KEY_LEN 128 |
| 21 | 21 | ||
| 22 | #define DEFAULT_CIPHER_ID 0x0080020001000001ULL | 22 | #define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL |
| 23 | #define DEFAULT_CIPHER_ALT 0x0080C20001000001ULL | 23 | #define MACSEC_DEFAULT_CIPHER_ALT 0x0080C20001000001ULL |
| 24 | 24 | ||
| 25 | #define MACSEC_MIN_ICV_LEN 8 | 25 | #define MACSEC_MIN_ICV_LEN 8 |
| 26 | #define MACSEC_MAX_ICV_LEN 32 | 26 | #define MACSEC_MAX_ICV_LEN 32 |
| @@ -2092,7 +2092,6 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env) · 2091 unmodified lines | |||
| 2092 | if (IS_ERR(map)) { | 2092 | if (IS_ERR(map)) { |
| 2093 | verbose("fd %d is not pointing to valid bpf_map\n", | 2093 | verbose("fd %d is not pointing to valid bpf_map\n", |
| 2094 | insn->imm); | 2094 | insn->imm); |
| 2095 | fdput(f); | ||
| 2096 | return PTR_ERR(map); | 2095 | return PTR_ERR(map); |
| 2097 | } | 2096 | } |
| 2098 | 2097 | ||
| @@ -36,6 +36,7 @@ · 35 unmodified lines | |||
| 36 | * @target: The target state | 36 | * @target: The target state |
| 37 | * @thread: Pointer to the hotplug thread | 37 | * @thread: Pointer to the hotplug thread |
| 38 | * @should_run: Thread should execute | 38 | * @should_run: Thread should execute |
| 39 | * @rollback: Perform a rollback | ||
| 39 | * @cb_stat: The state for a single callback (install/uninstall) | 40 | * @cb_stat: The state for a single callback (install/uninstall) |
| 40 | * @cb: Single callback function (install/uninstall) | 41 | * @cb: Single callback function (install/uninstall) |
| 41 | * @result: Result of the operation | 42 | * @result: Result of the operation |
| @@ -47,6 +48,7 @@ struct cpuhp_cpu_state { · 5 unmodified lines | |||
| 47 | #ifdef CONFIG_SMP | 48 | #ifdef CONFIG_SMP |
| 48 | struct task_struct *thread; | 49 | struct task_struct *thread; |
| 49 | bool should_run; | 50 | bool should_run; |
| 51 | bool rollback; | ||
| 50 | enum cpuhp_state cb_state; | 52 | enum cpuhp_state cb_state; |
| 51 | int (*cb)(unsigned int cpu); | 53 | int (*cb)(unsigned int cpu); |
| 52 | int result; | 54 | int result; |
| @@ -301,6 +303,11 @@ static int cpu_notify(unsigned long val, unsigned int cpu) · 248 unmodified lines | |||
| 301 | return __cpu_notify(val, cpu, -1, NULL); | 303 | return __cpu_notify(val, cpu, -1, NULL); |
| 302 | } | 304 | } |
| 303 | 305 | ||
| 306 | static void cpu_notify_nofail(unsigned long val, unsigned int cpu) | ||
| 307 | { | ||
| 308 | BUG_ON(cpu_notify(val, cpu)); | ||
| 309 | } | ||
| 310 | |||
| 304 | /* Notifier wrappers for transitioning to state machine */ | 311 | /* Notifier wrappers for transitioning to state machine */ |
| 305 | static int notify_prepare(unsigned int cpu) | 312 | static int notify_prepare(unsigned int cpu) |
| 306 | { | 313 | { |
| @@ -477,6 +484,16 @@ static void cpuhp_thread_fun(unsigned int cpu) · 170 unmodified lines | |||
| 477 | } else { | 484 | } else { |
| 478 | ret = cpuhp_invoke_callback(cpu, st->cb_state, st->cb); | 485 | ret = cpuhp_invoke_callback(cpu, st->cb_state, st->cb); |
| 479 | } | 486 | } |
| 487 | } else if (st->rollback) { | ||
| 488 | BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE); | ||
| 489 | |||
| 490 | undo_cpu_down(cpu, st, cpuhp_ap_states); | ||
| 491 | /* | ||
| 492 | * This is a momentary workaround to keep the notifier users | ||
| 493 | * happy. Will go away once we got rid of the notifiers. | ||
| 494 | */ | ||
| 495 | cpu_notify_nofail(CPU_DOWN_FAILED, cpu); | ||
| 496 | st->rollback = false; | ||
| 480 | } else { | 497 | } else { |
| 481 | /* Cannot happen .... */ | 498 | /* Cannot happen .... */ |
| 482 | BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE); | 499 | BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE); |
| @@ -636,11 +653,6 @@ static inline void check_for_tasks(int dead_cpu) · 153 unmodified lines | |||
| 636 | read_unlock(&tasklist_lock); | 653 | read_unlock(&tasklist_lock); |
| 637 | } | 654 | } |
| 638 | 655 | ||
| 639 | static void cpu_notify_nofail(unsigned long val, unsigned int cpu) | ||
| 640 | { | ||
| 641 | BUG_ON(cpu_notify(val, cpu)); | ||
| 642 | } | ||
| 643 | |||
| 644 | static int notify_down_prepare(unsigned int cpu) | 656 | static int notify_down_prepare(unsigned int cpu) |
| 645 | { | 657 | { |
| 646 | int err, nr_calls = 0; | 658 | int err, nr_calls = 0; |
| @@ -721,9 +733,10 @@ static int takedown_cpu(unsigned int cpu) · 74 unmodified lines | |||
| 721 | */ | 733 | */ |
| 722 | err = stop_machine(take_cpu_down, NULL, cpumask_of(cpu)); | 734 | err = stop_machine(take_cpu_down, NULL, cpumask_of(cpu)); |
| 723 | if (err) { | 735 | if (err) { |
| 724 | /* CPU didn't die: tell everyone. Can't complain. */ | 736 | /* CPU refused to die */ |
| 725 | cpu_notify_nofail(CPU_DOWN_FAILED, cpu); | ||
| 726 | irq_unlock_sparse(); | 737 | irq_unlock_sparse(); |
| 738 | /* Unpark the hotplug thread so we can rollback there */ | ||
| 739 | kthread_unpark(per_cpu_ptr(&cpuhp_state, cpu)->thread); | ||
| 727 | return err; | 740 | return err; |
| 728 | } | 741 | } |
| 729 | BUG_ON(cpu_online(cpu)); | 742 | BUG_ON(cpu_online(cpu)); |
| @@ -832,6 +845,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, · 102 unmodified lines | |||
| 832 | * to do the further cleanups. | 845 | * to do the further cleanups. |
| 833 | */ | 846 | */ |
| 834 | ret = cpuhp_down_callbacks(cpu, st, cpuhp_bp_states, target); | 847 | ret = cpuhp_down_callbacks(cpu, st, cpuhp_bp_states, target); |
| 848 | if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { | ||
| 849 | st->target = prev_state; | ||
| 850 | st->rollback = true; | ||
| 851 | cpuhp_kick_ap_work(cpu); | ||
| 852 | } | ||
| 835 | 853 | ||
| 836 | hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE; | 854 | hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE; |
| 837 | out: | 855 | out: |
| @@ -1249,6 +1267,7 @@ static struct cpuhp_step cpuhp_ap_states[] = { · 411 unmodified lines | |||
| 1249 | .name = "notify:online", | 1267 | .name = "notify:online", |
| 1250 | .startup = notify_online, | 1268 | .startup = notify_online, |
| 1251 | .teardown = notify_down_prepare, | 1269 | .teardown = notify_down_prepare, |
| 1270 | .skip_onerr = true, | ||
| 1252 | }, | 1271 | }, |
| 1253 | #endif | 1272 | #endif |
| 1254 | /* | 1273 | /* |
| @@ -1295,10 +1295,20 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this, · 1294 unmodified lines | |||
| 1295 | if (unlikely(should_fail_futex(true))) | 1295 | if (unlikely(should_fail_futex(true))) |
| 1296 | ret = -EFAULT; | 1296 | ret = -EFAULT; |
| 1297 | 1297 | ||
| 1298 | if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) | 1298 | if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) { |
| 1299 | ret = -EFAULT; | 1299 | ret = -EFAULT; |
| 1300 | else if (curval != uval) | 1300 | } else if (curval != uval) { |
| 1301 | ret = -EINVAL; | 1301 | /* |
| 1302 | * If a unconditional UNLOCK_PI operation (user space did not | ||
| 1303 | * try the TID->0 transition) raced with a waiter setting the | ||
| 1304 | * FUTEX_WAITERS flag between get_user() and locking the hash | ||
| 1305 | * bucket lock, retry the operation. | ||
| 1306 | */ | ||
| 1307 | if ((FUTEX_TID_MASK & curval) == uval) | ||
| 1308 | ret = -EAGAIN; | ||
| 1309 | else | ||
| 1310 | ret = -EINVAL; | ||
| 1311 | } | ||
| 1302 | if (ret) { | 1312 | if (ret) { |
| 1303 | raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); | 1313 | raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); |
| 1304 | return ret; | 1314 | return ret; |
| @@ -1525,8 +1535,8 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, · 220 unmodified lines | |||
| 1525 | if (likely(&hb1->chain != &hb2->chain)) { | 1535 | if (likely(&hb1->chain != &hb2->chain)) { |
| 1526 | plist_del(&q->list, &hb1->chain); | 1536 | plist_del(&q->list, &hb1->chain); |
| 1527 | hb_waiters_dec(hb1); | 1537 | hb_waiters_dec(hb1); |
| 1528 | plist_add(&q->list, &hb2->chain); | ||
| 1529 | hb_waiters_inc(hb2); | 1538 | hb_waiters_inc(hb2); |
| 1539 | plist_add(&q->list, &hb2->chain); | ||
| 1530 | q->lock_ptr = &hb2->lock; | 1540 | q->lock_ptr = &hb2->lock; |
| 1531 | } | 1541 | } |
| 1532 | get_futex_key_refs(key2); | 1542 | get_futex_key_refs(key2); |
| @@ -2622,6 +2632,15 @@ retry: · 1089 unmodified lines | |||
| 2622 | */ | 2632 | */ |
| 2623 | if (ret == -EFAULT) | 2633 | if (ret == -EFAULT) |
| 2624 | goto pi_faulted; | 2634 | goto pi_faulted; |
| 2635 | /* | ||
| 2636 | * A unconditional UNLOCK_PI op raced against a waiter | ||
| 2637 | * setting the FUTEX_WAITERS bit. Try again. | ||
| 2638 | */ | ||
| 2639 | if (ret == -EAGAIN) { | ||
| 2640 | spin_unlock(&hb->lock); | ||
| 2641 | put_futex_key(&key); | ||
| 2642 | goto retry; | ||
| 2643 | } | ||
| 2625 | /* | 2644 | /* |
| 2626 | * wake_futex_pi has detected invalid state. Tell user | 2645 | * wake_futex_pi has detected invalid state. Tell user |
| 2627 | * space. | 2646 | * space. |
| @@ -94,6 +94,7 @@ unsigned int irq_reserve_ipi(struct irq_domain *domain, · 93 unmodified lines | |||
| 94 | data = irq_get_irq_data(virq + i); | 94 | data = irq_get_irq_data(virq + i); |
| 95 | cpumask_copy(data->common->affinity, dest); | 95 | cpumask_copy(data->common->affinity, dest); |
| 96 | data->common->ipi_offset = offset; | 96 | data->common->ipi_offset = offset; |
| 97 | irq_set_status_flags(virq + i, IRQ_NO_BALANCING); | ||
| 97 | } | 98 | } |
| 98 | return virq; | 99 | return virq; |
| 99 | 100 | ||
| @@ -136,10 +136,12 @@ static ssize_t qstat_read(struct file *file, char __user *user_buf, · 135 unmodified lines | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | if (counter == qstat_pv_hash_hops) { | 138 | if (counter == qstat_pv_hash_hops) { |
| 139 | u64 frac; | 139 | u64 frac = 0; |
| 140 | 140 | ||
| 141 | frac = 100ULL * do_div(stat, kicks); | 141 | if (kicks) { |
| 142 | frac = DIV_ROUND_CLOSEST_ULL(frac, kicks); | 142 | frac = 100ULL * do_div(stat, kicks); |
| 143 | frac = DIV_ROUND_CLOSEST_ULL(frac, kicks); | ||
| 144 | } | ||
| 143 | 145 | ||
| 144 | /* | 146 | /* |
| 145 | * Return a X.XX decimal number | 147 | * Return a X.XX decimal number |
| @@ -61,6 +61,19 @@ static void __mdb_entry_fill_flags(struct br_mdb_entry *e, unsigned char flags) · 60 unmodified lines | |||
| 61 | e->flags |= MDB_FLAGS_OFFLOAD; | 61 | e->flags |= MDB_FLAGS_OFFLOAD; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static void __mdb_entry_to_br_ip(struct br_mdb_entry *entry, struct br_ip *ip) | ||
| 65 | { | ||
| 66 | memset(ip, 0, sizeof(struct br_ip)); | ||
| 67 | ip->vid = entry->vid; | ||
| 68 | ip->proto = entry->addr.proto; | ||
| 69 | if (ip->proto == htons(ETH_P_IP)) | ||
| 70 | ip->u.ip4 = entry->addr.u.ip4; | ||
| 71 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 72 | else | ||
| 73 | ip->u.ip6 = entry->addr.u.ip6; | ||
| 74 | #endif | ||
| 75 | } | ||
| 76 | |||
| 64 | static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, | 77 | static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, |
| 65 | struct net_device *dev) | 78 | struct net_device *dev) |
| 66 | { | 79 | { |
| @@ -243,9 +256,45 @@ static inline size_t rtnl_mdb_nlmsg_size(void) · 176 unmodified lines | |||
| 243 | + nla_total_size(sizeof(struct br_mdb_entry)); | 256 | + nla_total_size(sizeof(struct br_mdb_entry)); |
| 244 | } | 257 | } |
| 245 | 258 | ||
| 246 | static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry, | 259 | struct br_mdb_complete_info { |
| 247 | int type, struct net_bridge_port_group *pg) | 260 | struct net_bridge_port *port; |
| 261 | struct br_ip ip; | ||
| 262 | }; | ||
| 263 | |||
| 264 | static void br_mdb_complete(struct net_device *dev, int err, void *priv) | ||
| 248 | { | 265 | { |
| 266 | struct br_mdb_complete_info *data = priv; | ||
| 267 | struct net_bridge_port_group __rcu **pp; | ||
| 268 | struct net_bridge_port_group *p; | ||
| 269 | struct net_bridge_mdb_htable *mdb; | ||
| 270 | struct net_bridge_mdb_entry *mp; | ||
| 271 | struct net_bridge_port *port = data->port; | ||
| 272 | struct net_bridge *br = port->br; | ||
| 273 | |||
| 274 | if (err) | ||
| 275 | goto err; | ||
| 276 | |||
| 277 | spin_lock_bh(&br->multicast_lock); | ||
| 278 | mdb = mlock_dereference(br->mdb, br); | ||
| 279 | mp = br_mdb_ip_get(mdb, &data->ip); | ||
| 280 | if (!mp) | ||
| 281 | goto out; | ||
| 282 | for (pp = &mp->ports; (p = mlock_dereference(*pp, br)) != NULL; | ||
| 283 | pp = &p->next) { | ||
| 284 | if (p->port != port) | ||
| 285 | continue; | ||
| 286 | p->flags |= MDB_PG_FLAGS_OFFLOAD; | ||
| 287 | } | ||
| 288 | out: | ||
| 289 | spin_unlock_bh(&br->multicast_lock); | ||
| 290 | err: | ||
| 291 | kfree(priv); | ||
| 292 | } | ||
| 293 | |||
| 294 | static void __br_mdb_notify(struct net_device *dev, struct net_bridge_port *p, | ||
| 295 | struct br_mdb_entry *entry, int type) | ||
| 296 | { | ||
| 297 | struct br_mdb_complete_info *complete_info; | ||
| 249 | struct switchdev_obj_port_mdb mdb = { | 298 | struct switchdev_obj_port_mdb mdb = { |
| 250 | .obj = { | 299 | .obj = { |
| 251 | .id = SWITCHDEV_OBJ_ID_PORT_MDB, | 300 | .id = SWITCHDEV_OBJ_ID_PORT_MDB, |
| @@ -268,9 +317,14 @@ static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry, · 16 unmodified lines | |||
| 268 | 317 | ||
| 269 | mdb.obj.orig_dev = port_dev; | 318 | mdb.obj.orig_dev = port_dev; |
| 270 | if (port_dev && type == RTM_NEWMDB) { | 319 | if (port_dev && type == RTM_NEWMDB) { |
| 271 | err = switchdev_port_obj_add(port_dev, &mdb.obj); | 320 | complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); |
| 272 | if (!err && pg) | 321 | if (complete_info) { |
| 273 | pg->flags |= MDB_PG_FLAGS_OFFLOAD; | 322 | complete_info->port = p; |
| 323 | __mdb_entry_to_br_ip(entry, &complete_info->ip); | ||
| 324 | mdb.obj.complete_priv = complete_info; | ||
| 325 | mdb.obj.complete = br_mdb_complete; | ||
| 326 | switchdev_port_obj_add(port_dev, &mdb.obj); | ||
| 327 | } | ||
| 274 | } else if (port_dev && type == RTM_DELMDB) { | 328 | } else if (port_dev && type == RTM_DELMDB) { |
| 275 | switchdev_port_obj_del(port_dev, &mdb.obj); | 329 | switchdev_port_obj_del(port_dev, &mdb.obj); |
| 276 | } | 330 | } |
| @@ -291,21 +345,21 @@ errout: · 14 unmodified lines | |||
| 291 | rtnl_set_sk_err(net, RTNLGRP_MDB, err); | 345 | rtnl_set_sk_err(net, RTNLGRP_MDB, err); |
| 292 | } | 346 | } |
| 293 | 347 | ||
| 294 | void br_mdb_notify(struct net_device *dev, struct net_bridge_port_group *pg, | 348 | void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, |
| 295 | int type) | 349 | struct br_ip *group, int type, u8 flags) |
| 296 | { | 350 | { |
| 297 | struct br_mdb_entry entry; | 351 | struct br_mdb_entry entry; |
| 298 | 352 | ||
| 299 | memset(&entry, 0, sizeof(entry)); | 353 | memset(&entry, 0, sizeof(entry)); |
| 300 | entry.ifindex = pg->port->dev->ifindex; | 354 | entry.ifindex = port->dev->ifindex; |
| 301 | entry.addr.proto = pg->addr.proto; | 355 | entry.addr.proto = group->proto; |
| 302 | entry.addr.u.ip4 = pg->addr.u.ip4; | 356 | entry.addr.u.ip4 = group->u.ip4; |
| 303 | #if IS_ENABLED(CONFIG_IPV6) | 357 | #if IS_ENABLED(CONFIG_IPV6) |
| 304 | entry.addr.u.ip6 = pg->addr.u.ip6; | 358 | entry.addr.u.ip6 = group->u.ip6; |
| 305 | #endif | 359 | #endif |
| 306 | entry.vid = pg->addr.vid; | 360 | entry.vid = group->vid; |
| 307 | __mdb_entry_fill_flags(&entry, pg->flags); | 361 | __mdb_entry_fill_flags(&entry, flags); |
| 308 | __br_mdb_notify(dev, &entry, type, pg); | 362 | __br_mdb_notify(dev, port, &entry, type); |
| 309 | } | 363 | } |
| 310 | 364 | ||
| 311 | static int nlmsg_populate_rtr_fill(struct sk_buff *skb, | 365 | static int nlmsg_populate_rtr_fill(struct sk_buff *skb, |
| @@ -450,8 +504,7 @@ static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh, · 138 unmodified lines | |||
| 450 | } | 504 | } |
| 451 | 505 | ||
| 452 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | 506 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, |
| 453 | struct br_ip *group, unsigned char state, | 507 | struct br_ip *group, unsigned char state) |
| 454 | struct net_bridge_port_group **pg) | ||
| 455 | { | 508 | { |
| 456 | struct net_bridge_mdb_entry *mp; | 509 | struct net_bridge_mdb_entry *mp; |
| 457 | struct net_bridge_port_group *p; | 510 | struct net_bridge_port_group *p; |
| @@ -482,7 +535,6 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, · 24 unmodified lines | |||
| 482 | if (unlikely(!p)) | 535 | if (unlikely(!p)) |
| 483 | return -ENOMEM; | 536 | return -ENOMEM; |
| 484 | rcu_assign_pointer(*pp, p); | 537 | rcu_assign_pointer(*pp, p); |
| 485 | *pg = p; | ||
| 486 | if (state == MDB_TEMPORARY) | 538 | if (state == MDB_TEMPORARY) |
| 487 | mod_timer(&p->timer, now + br->multicast_membership_interval); | 539 | mod_timer(&p->timer, now + br->multicast_membership_interval); |
| 488 | 540 | ||
| @@ -490,8 +542,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, · 1 unmodified line | |||
| 490 | } | 542 | } |
| 491 | 543 | ||
| 492 | static int __br_mdb_add(struct net *net, struct net_bridge *br, | 544 | static int __br_mdb_add(struct net *net, struct net_bridge *br, |
| 493 | struct br_mdb_entry *entry, | 545 | struct br_mdb_entry *entry) |
| 494 | struct net_bridge_port_group **pg) | ||
| 495 | { | 546 | { |
| 496 | struct br_ip ip; | 547 | struct br_ip ip; |
| 497 | struct net_device *dev; | 548 | struct net_device *dev; |
| @@ -509,18 +560,10 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, · 11 unmodified lines | |||
| 509 | if (!p || p->br != br || p->state == BR_STATE_DISABLED) | 560 | if (!p || p->br != br || p->state == BR_STATE_DISABLED) |
| 510 | return -EINVAL; | 561 | return -EINVAL; |
| 511 | 562 | ||
| 512 | memset(&ip, 0, sizeof(ip)); | 563 | __mdb_entry_to_br_ip(entry, &ip); |
| 513 | ip.vid = entry->vid; | ||
| 514 | ip.proto = entry->addr.proto; | ||
| 515 | if (ip.proto == htons(ETH_P_IP)) | ||
| 516 | ip.u.ip4 = entry->addr.u.ip4; | ||
| 517 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 518 | else | ||
| 519 | ip.u.ip6 = entry->addr.u.ip6; | ||
| 520 | #endif | ||
| 521 | 564 | ||
| 522 | spin_lock_bh(&br->multicast_lock); | 565 | spin_lock_bh(&br->multicast_lock); |
| 523 | ret = br_mdb_add_group(br, p, &ip, entry->state, pg); | 566 | ret = br_mdb_add_group(br, p, &ip, entry->state); |
| 524 | spin_unlock_bh(&br->multicast_lock); | 567 | spin_unlock_bh(&br->multicast_lock); |
| 525 | return ret; | 568 | return ret; |
| 526 | } | 569 | } |
| @@ -528,7 +571,6 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, · 1 unmodified line | |||
| 528 | static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) | 571 | static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) |
| 529 | { | 572 | { |
| 530 | struct net *net = sock_net(skb->sk); | 573 | struct net *net = sock_net(skb->sk); |
| 531 | struct net_bridge_port_group *pg; | ||
| 532 | struct net_bridge_vlan_group *vg; | 574 | struct net_bridge_vlan_group *vg; |
| 533 | struct net_device *dev, *pdev; | 575 | struct net_device *dev, *pdev; |
| 534 | struct br_mdb_entry *entry; | 576 | struct br_mdb_entry *entry; |
| @@ -558,15 +600,15 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) · 23 unmodified lines | |||
| 558 | if (br_vlan_enabled(br) && vg && entry->vid == 0) { | 600 | if (br_vlan_enabled(br) && vg && entry->vid == 0) { |
| 559 | list_for_each_entry(v, &vg->vlan_list, vlist) { | 601 | list_for_each_entry(v, &vg->vlan_list, vlist) { |
| 560 | entry->vid = v->vid; | 602 | entry->vid = v->vid; |
| 561 | err = __br_mdb_add(net, br, entry, &pg); | 603 | err = __br_mdb_add(net, br, entry); |
| 562 | if (err) | 604 | if (err) |
| 563 | break; | 605 | break; |
| 564 | __br_mdb_notify(dev, entry, RTM_NEWMDB, pg); | 606 | __br_mdb_notify(dev, p, entry, RTM_NEWMDB); |
| 565 | } | 607 | } |
| 566 | } else { | 608 | } else { |
| 567 | err = __br_mdb_add(net, br, entry, &pg); | 609 | err = __br_mdb_add(net, br, entry); |
| 568 | if (!err) | 610 | if (!err) |
| 569 | __br_mdb_notify(dev, entry, RTM_NEWMDB, pg); | 611 | __br_mdb_notify(dev, p, entry, RTM_NEWMDB); |
| 570 | } | 612 | } |
| 571 | 613 | ||
| 572 | return err; | 614 | return err; |
| @@ -584,15 +626,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) · 11 unmodified lines | |||
| 584 | if (!netif_running(br->dev) || br->multicast_disabled) | 626 | if (!netif_running(br->dev) || br->multicast_disabled) |
| 585 | return -EINVAL; | 627 | return -EINVAL; |
| 586 | 628 | ||
| 587 | memset(&ip, 0, sizeof(ip)); | 629 | __mdb_entry_to_br_ip(entry, &ip); |
| 588 | ip.vid = entry->vid; | ||
| 589 | ip.proto = entry->addr.proto; | ||
| 590 | if (ip.proto == htons(ETH_P_IP)) | ||
| 591 | ip.u.ip4 = entry->addr.u.ip4; | ||
| 592 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 593 | else | ||
| 594 | ip.u.ip6 = entry->addr.u.ip6; | ||
| 595 | #endif | ||
| 596 | 630 | ||
| 597 | spin_lock_bh(&br->multicast_lock); | 631 | spin_lock_bh(&br->multicast_lock); |
| 598 | mdb = mlock_dereference(br->mdb, br); | 632 | mdb = mlock_dereference(br->mdb, br); |
| @@ -662,12 +696,12 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh) · 63 unmodified lines | |||
| 662 | entry->vid = v->vid; | 696 | entry->vid = v->vid; |
| 663 | err = __br_mdb_del(br, entry); | 697 | err = __br_mdb_del(br, entry); |
| 664 | if (!err) | 698 | if (!err) |
| 665 | __br_mdb_notify(dev, entry, RTM_DELMDB, NULL); | 699 | __br_mdb_notify(dev, p, entry, RTM_DELMDB); |
| 666 | } | 700 | } |
| 667 | } else { | 701 | } else { |
| 668 | err = __br_mdb_del(br, entry); | 702 | err = __br_mdb_del(br, entry); |
| 669 | if (!err) | 703 | if (!err) |
| 670 | __br_mdb_notify(dev, entry, RTM_DELMDB, NULL); | 704 | __br_mdb_notify(dev, p, entry, RTM_DELMDB); |
| 671 | } | 705 | } |
| 672 | 706 | ||
| 673 | return err; | 707 | return err; |
| @@ -283,7 +283,8 @@ static void br_multicast_del_pg(struct net_bridge *br, · 282 unmodified lines | |||
| 283 | rcu_assign_pointer(*pp, p->next); | 283 | rcu_assign_pointer(*pp, p->next); |
| 284 | hlist_del_init(&p->mglist); | 284 | hlist_del_init(&p->mglist); |
| 285 | del_timer(&p->timer); | 285 | del_timer(&p->timer); |
| 286 | br_mdb_notify(br->dev, p, RTM_DELMDB); | 286 | br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB, |
| 287 | p->flags); | ||
| 287 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 288 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
| 288 | 289 | ||
| 289 | if (!mp->ports && !mp->mglist && | 290 | if (!mp->ports && !mp->mglist && |
| @@ -705,7 +706,7 @@ static int br_multicast_add_group(struct net_bridge *br, · 415 unmodified lines | |||
| 705 | if (unlikely(!p)) | 706 | if (unlikely(!p)) |
| 706 | goto err; | 707 | goto err; |
| 707 | rcu_assign_pointer(*pp, p); | 708 | rcu_assign_pointer(*pp, p); |
| 708 | br_mdb_notify(br->dev, p, RTM_NEWMDB); | 709 | br_mdb_notify(br->dev, port, group, RTM_NEWMDB, 0); |
| 709 | 710 | ||
| 710 | found: | 711 | found: |
| 711 | mod_timer(&p->timer, now + br->multicast_membership_interval); | 712 | mod_timer(&p->timer, now + br->multicast_membership_interval); |
| @@ -1461,7 +1462,8 @@ br_multicast_leave_group(struct net_bridge *br, · 749 unmodified lines | |||
| 1461 | hlist_del_init(&p->mglist); | 1462 | hlist_del_init(&p->mglist); |
| 1462 | del_timer(&p->timer); | 1463 | del_timer(&p->timer); |
| 1463 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 1464 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
| 1464 | br_mdb_notify(br->dev, p, RTM_DELMDB); | 1465 | br_mdb_notify(br->dev, port, group, RTM_DELMDB, |
| 1466 | p->flags); | ||
| 1465 | 1467 | ||
| 1466 | if (!mp->ports && !mp->mglist && | 1468 | if (!mp->ports && !mp->mglist && |
| 1467 | netif_running(br->dev)) | 1469 | netif_running(br->dev)) |
| @@ -560,8 +560,8 @@ br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, · 559 unmodified lines | |||
| 560 | unsigned char flags); | 560 | unsigned char flags); |
| 561 | void br_mdb_init(void); | 561 | void br_mdb_init(void); |
| 562 | void br_mdb_uninit(void); | 562 | void br_mdb_uninit(void); |
| 563 | void br_mdb_notify(struct net_device *dev, struct net_bridge_port_group *pg, | 563 | void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, |
| 564 | int type); | 564 | struct br_ip *group, int type, u8 flags); |
| 565 | void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port, | 565 | void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port, |
| 566 | int type); | 566 | int type); |
| 567 | 567 | ||
| @@ -904,7 +904,11 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim) · 903 unmodified lines | |||
| 904 | if (ifa->ifa_flags & IFA_F_SECONDARY) { | 904 | if (ifa->ifa_flags & IFA_F_SECONDARY) { |
| 905 | prim = inet_ifa_byprefix(in_dev, any, ifa->ifa_mask); | 905 | prim = inet_ifa_byprefix(in_dev, any, ifa->ifa_mask); |
| 906 | if (!prim) { | 906 | if (!prim) { |
| 907 | pr_warn("%s: bug: prim == NULL\n", __func__); | 907 | /* if the device has been deleted, we don't perform |
| 908 | * address promotion | ||
| 909 | */ | ||
| 910 | if (!in_dev->dead) | ||
| 911 | pr_warn("%s: bug: prim == NULL\n", __func__); | ||
| 908 | return; | 912 | return; |
| 909 | } | 913 | } |
| 910 | if (iprim && iprim != prim) { | 914 | if (iprim && iprim != prim) { |
| @@ -3175,35 +3175,9 @@ static void addrconf_gre_config(struct net_device *dev) · 3174 unmodified lines | |||
| 3175 | } | 3175 | } |
| 3176 | #endif | 3176 | #endif |
| 3177 | 3177 | ||
| 3178 | #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) | ||
| 3179 | /* If the host route is cached on the addr struct make sure it is associated | ||
| 3180 | * with the proper table. e.g., enslavement can change and if so the cached | ||
| 3181 | * host route needs to move to the new table. | ||
| 3182 | */ | ||
| 3183 | static void l3mdev_check_host_rt(struct inet6_dev *idev, | ||
| 3184 | struct inet6_ifaddr *ifp) | ||
| 3185 | { | ||
| 3186 | if (ifp->rt) { | ||
| 3187 | u32 tb_id = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL; | ||
| 3188 | |||
| 3189 | if (tb_id != ifp->rt->rt6i_table->tb6_id) { | ||
| 3190 | ip6_del_rt(ifp->rt); | ||
| 3191 | ifp->rt = NULL; | ||
| 3192 | } | ||
| 3193 | } | ||
| 3194 | } | ||
| 3195 | #else | ||
| 3196 | static void l3mdev_check_host_rt(struct inet6_dev *idev, | ||
| 3197 | struct inet6_ifaddr *ifp) | ||
| 3198 | { | ||
| 3199 | } | ||
| 3200 | #endif | ||
| 3201 | |||
| 3202 | static int fixup_permanent_addr(struct inet6_dev *idev, | 3178 | static int fixup_permanent_addr(struct inet6_dev *idev, |
| 3203 | struct inet6_ifaddr *ifp) | 3179 | struct inet6_ifaddr *ifp) |
| 3204 | { | 3180 | { |
| 3205 | l3mdev_check_host_rt(idev, ifp); | ||
| 3206 | |||
| 3207 | if (!ifp->rt) { | 3181 | if (!ifp->rt) { |
| 3208 | struct rt6_info *rt; | 3182 | struct rt6_info *rt; |
| 3209 | 3183 | ||
| @@ -3303,6 +3277,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, · 93 unmodified lines | |||
| 3303 | break; | 3277 | break; |
| 3304 | 3278 | ||
| 3305 | if (event == NETDEV_UP) { | 3279 | if (event == NETDEV_UP) { |
| 3280 | /* restore routes for permanent addresses */ | ||
| 3281 | addrconf_permanent_addr(dev); | ||
| 3282 | |||
| 3306 | if (!addrconf_qdisc_ok(dev)) { | 3283 | if (!addrconf_qdisc_ok(dev)) { |
| 3307 | /* device is not ready yet. */ | 3284 | /* device is not ready yet. */ |
| 3308 | pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n", | 3285 | pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n", |
| @@ -3336,9 +3313,6 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, · 27 unmodified lines | |||
| 3336 | run_pending = 1; | 3313 | run_pending = 1; |
| 3337 | } | 3314 | } |
| 3338 | 3315 | ||
| 3339 | /* restore routes for permanent addresses */ | ||
| 3340 | addrconf_permanent_addr(dev); | ||
| 3341 | |||
| 3342 | switch (dev->type) { | 3316 | switch (dev->type) { |
| 3343 | #if IS_ENABLED(CONFIG_IPV6_SIT) | 3317 | #if IS_ENABLED(CONFIG_IPV6_SIT) |
| 3344 | case ARPHRD_SIT: | 3318 | case ARPHRD_SIT: |
| @@ -3555,6 +3529,8 @@ restart: · 210 unmodified lines | |||
| 3555 | 3529 | ||
| 3556 | INIT_LIST_HEAD(&del_list); | 3530 | INIT_LIST_HEAD(&del_list); |
| 3557 | list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { | 3531 | list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { |
| 3532 | struct rt6_info *rt = NULL; | ||
| 3533 | |||
| 3558 | addrconf_del_dad_work(ifa); | 3534 | addrconf_del_dad_work(ifa); |
| 3559 | 3535 | ||
| 3560 | write_unlock_bh(&idev->lock); | 3536 | write_unlock_bh(&idev->lock); |
| @@ -3567,6 +3543,9 @@ restart: · 6 unmodified lines | |||
| 3567 | ifa->state = 0; | 3543 | ifa->state = 0; |
| 3568 | if (!(ifa->flags & IFA_F_NODAD)) | 3544 | if (!(ifa->flags & IFA_F_NODAD)) |
| 3569 | ifa->flags |= IFA_F_TENTATIVE; | 3545 | ifa->flags |= IFA_F_TENTATIVE; |
| 3546 | |||
| 3547 | rt = ifa->rt; | ||
| 3548 | ifa->rt = NULL; | ||
| 3570 | } else { | 3549 | } else { |
| 3571 | state = ifa->state; | 3550 | state = ifa->state; |
| 3572 | ifa->state = INET6_IFADDR_STATE_DEAD; | 3551 | ifa->state = INET6_IFADDR_STATE_DEAD; |
| @@ -3577,6 +3556,9 @@ restart: · 4 unmodified lines | |||
| 3577 | 3556 | ||
| 3578 | spin_unlock_bh(&ifa->lock); | 3557 | spin_unlock_bh(&ifa->lock); |
| 3579 | 3558 | ||
| 3559 | if (rt) | ||
| 3560 | ip6_del_rt(rt); | ||
| 3561 | |||
| 3580 | if (state != INET6_IFADDR_STATE_DEAD) { | 3562 | if (state != INET6_IFADDR_STATE_DEAD) { |
| 3581 | __ipv6_ifa_notify(RTM_DELADDR, ifa); | 3563 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
| 3582 | inet6addr_notifier_call_chain(NETDEV_DOWN, ifa); | 3564 | inet6addr_notifier_call_chain(NETDEV_DOWN, ifa); |
| @@ -5344,10 +5326,10 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) · 1761 unmodified lines | |||
| 5344 | if (rt) | 5326 | if (rt) |
| 5345 | ip6_del_rt(rt); | 5327 | ip6_del_rt(rt); |
| 5346 | } | 5328 | } |
| 5347 | dst_hold(&ifp->rt->dst); | 5329 | if (ifp->rt) { |
| 5348 | 5330 | dst_hold(&ifp->rt->dst); | |
| 5349 | ip6_del_rt(ifp->rt); | 5331 | ip6_del_rt(ifp->rt); |
| 5350 | 5332 | } | |
| 5351 | rt_genid_bump_ipv6(net); | 5333 | rt_genid_bump_ipv6(net); |
| 5352 | break; | 5334 | break; |
| 5353 | } | 5335 | } |
| @@ -305,6 +305,8 @@ static void switchdev_port_attr_set_deferred(struct net_device *dev, · 304 unmodified lines | |||
| 305 | if (err && err != -EOPNOTSUPP) | 305 | if (err && err != -EOPNOTSUPP) |
| 306 | netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", | 306 | netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", |
| 307 | err, attr->id); | 307 | err, attr->id); |
| 308 | if (attr->complete) | ||
| 309 | attr->complete(dev, err, attr->complete_priv); | ||
| 308 | } | 310 | } |
| 309 | 311 | ||
| 310 | static int switchdev_port_attr_set_defer(struct net_device *dev, | 312 | static int switchdev_port_attr_set_defer(struct net_device *dev, |
| @@ -434,6 +436,8 @@ static void switchdev_port_obj_add_deferred(struct net_device *dev, · 123 unmodified lines | |||
| 434 | if (err && err != -EOPNOTSUPP) | 436 | if (err && err != -EOPNOTSUPP) |
| 435 | netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", | 437 | netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", |
| 436 | err, obj->id); | 438 | err, obj->id); |
| 439 | if (obj->complete) | ||
| 440 | obj->complete(dev, err, obj->complete_priv); | ||
| 437 | } | 441 | } |
| 438 | 442 | ||
| 439 | static int switchdev_port_obj_add_defer(struct net_device *dev, | 443 | static int switchdev_port_obj_add_defer(struct net_device *dev, |
| @@ -502,6 +506,8 @@ static void switchdev_port_obj_del_deferred(struct net_device *dev, · 62 unmodified lines | |||
| 502 | if (err && err != -EOPNOTSUPP) | 506 | if (err && err != -EOPNOTSUPP) |
| 503 | netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", | 507 | netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", |
| 504 | err, obj->id); | 508 | err, obj->id); |
| 509 | if (obj->complete) | ||
| 510 | obj->complete(dev, err, obj->complete_priv); | ||
| 505 | } | 511 | } |
| 506 | 512 | ||
| 507 | static int switchdev_port_obj_del_defer(struct net_device *dev, | 513 | static int switchdev_port_obj_del_defer(struct net_device *dev, |
| @@ -299,13 +299,11 @@ EXPORT_SYMBOL_GPL(_snd_hdac_read_parm); · 298 unmodified lines | |||
| 299 | int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, | 299 | int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, |
| 300 | int parm) | 300 | int parm) |
| 301 | { | 301 | { |
| 302 | int val; | 302 | unsigned int cmd, val; |
| 303 | 303 | ||
| 304 | if (codec->regmap) | 304 | cmd = snd_hdac_regmap_encode_verb(nid, AC_VERB_PARAMETERS) | parm; |
| 305 | regcache_cache_bypass(codec->regmap, true); | 305 | if (snd_hdac_regmap_read_raw_uncached(codec, cmd, &val) < 0) |
| 306 | val = snd_hdac_read_parm(codec, nid, parm); | 306 | return -1; |
| 307 | if (codec->regmap) | ||
| 308 | regcache_cache_bypass(codec->regmap, false); | ||
| 309 | return val; | 307 | return val; |
| 310 | } | 308 | } |
| 311 | EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached); | 309 | EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached); |
| @@ -453,14 +453,30 @@ int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg, · 452 unmodified lines | |||
| 453 | EXPORT_SYMBOL_GPL(snd_hdac_regmap_write_raw); | 453 | EXPORT_SYMBOL_GPL(snd_hdac_regmap_write_raw); |
| 454 | 454 | ||
| 455 | static int reg_raw_read(struct hdac_device *codec, unsigned int reg, | 455 | static int reg_raw_read(struct hdac_device *codec, unsigned int reg, |
| 456 | unsigned int *val) | 456 | unsigned int *val, bool uncached) |
| 457 | { | 457 | { |
| 458 | if (!codec->regmap) | 458 | if (uncached || !codec->regmap) |
| 459 | return hda_reg_read(codec, reg, val); | 459 | return hda_reg_read(codec, reg, val); |
| 460 | else | 460 | else |
| 461 | return regmap_read(codec->regmap, reg, val); | 461 | return regmap_read(codec->regmap, reg, val); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | static int __snd_hdac_regmap_read_raw(struct hdac_device *codec, | ||
| 465 | unsigned int reg, unsigned int *val, | ||
| 466 | bool uncached) | ||
| 467 | { | ||
| 468 | int err; | ||
| 469 | |||
| 470 | err = reg_raw_read(codec, reg, val, uncached); | ||
| 471 | if (err == -EAGAIN) { | ||
| 472 | err = snd_hdac_power_up_pm(codec); | ||
| 473 | if (!err) | ||
| 474 | err = reg_raw_read(codec, reg, val, uncached); | ||
| 475 | snd_hdac_power_down_pm(codec); | ||
| 476 | } | ||
| 477 | return err; | ||
| 478 | } | ||
| 479 | |||
| 464 | /** | 480 | /** |
| 465 | * snd_hdac_regmap_read_raw - read a pseudo register with power mgmt | 481 | * snd_hdac_regmap_read_raw - read a pseudo register with power mgmt |
| 466 | * @codec: the codec object | 482 | * @codec: the codec object |
| @@ -472,19 +488,19 @@ static int reg_raw_read(struct hdac_device *codec, unsigned int reg, · 5 unmodified lines | |||
| 472 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, | 488 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, |
| 473 | unsigned int *val) | 489 | unsigned int *val) |
| 474 | { | 490 | { |
| 475 | int err; | 491 | return __snd_hdac_regmap_read_raw(codec, reg, val, false); |
| 476 | |||
| 477 | err = reg_raw_read(codec, reg, val); | ||
| 478 | if (err == -EAGAIN) { | ||
| 479 | err = snd_hdac_power_up_pm(codec); | ||
| 480 | if (!err) | ||
| 481 | err = reg_raw_read(codec, reg, val); | ||
| 482 | snd_hdac_power_down_pm(codec); | ||
| 483 | } | ||
| 484 | return err; | ||
| 485 | } | 492 | } |
| 486 | EXPORT_SYMBOL_GPL(snd_hdac_regmap_read_raw); | 493 | EXPORT_SYMBOL_GPL(snd_hdac_regmap_read_raw); |
| 487 | 494 | ||
| 495 | /* Works like snd_hdac_regmap_read_raw(), but this doesn't read from the | ||
| 496 | * cache but always via hda verbs. | ||
| 497 | */ | ||
| 498 | int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec, | ||
| 499 | unsigned int reg, unsigned int *val) | ||
| 500 | { | ||
| 501 | return __snd_hdac_regmap_read_raw(codec, reg, val, true); | ||
| 502 | } | ||
| 503 | |||
| 488 | /** | 504 | /** |
| 489 | * snd_hdac_regmap_update_raw - update a pseudo register with power mgmt | 505 | * snd_hdac_regmap_update_raw - update a pseudo register with power mgmt |
| 490 | * @codec: the codec object | 506 | * @codec: the codec object |
| @@ -826,7 +826,7 @@ static hda_nid_t path_power_update(struct hda_codec *codec, · 825 unmodified lines | |||
| 826 | bool allow_powerdown) | 826 | bool allow_powerdown) |
| 827 | { | 827 | { |
| 828 | hda_nid_t nid, changed = 0; | 828 | hda_nid_t nid, changed = 0; |
| 829 | int i, state; | 829 | int i, state, power; |
| 830 | 830 | ||
| 831 | for (i = 0; i < path->depth; i++) { | 831 | for (i = 0; i < path->depth; i++) { |
| 832 | nid = path->path[i]; | 832 | nid = path->path[i]; |
| @@ -838,7 +838,9 @@ static hda_nid_t path_power_update(struct hda_codec *codec, · 5 unmodified lines | |||
| 838 | state = AC_PWRST_D0; | 838 | state = AC_PWRST_D0; |
| 839 | else | 839 | else |
| 840 | state = AC_PWRST_D3; | 840 | state = AC_PWRST_D3; |
| 841 | if (!snd_hda_check_power_state(codec, nid, state)) { | 841 | power = snd_hda_codec_read(codec, nid, 0, |
| 842 | AC_VERB_GET_POWER_STATE, 0); | ||
| 843 | if (power != (state | (state << 4))) { | ||
| 842 | snd_hda_codec_write(codec, nid, 0, | 844 | snd_hda_codec_write(codec, nid, 0, |
| 843 | AC_VERB_SET_POWER_STATE, state); | 845 | AC_VERB_SET_POWER_STATE, state); |
| 844 | changed = nid; | 846 | changed = nid; |
| @@ -2232,6 +2232,9 @@ static const struct pci_device_id azx_ids[] = { · 2231 unmodified lines | |||
| 2232 | /* Broxton-P(Apollolake) */ | 2232 | /* Broxton-P(Apollolake) */ |
| 2233 | { PCI_DEVICE(0x8086, 0x5a98), | 2233 | { PCI_DEVICE(0x8086, 0x5a98), |
| 2234 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON }, | 2234 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON }, |
| 2235 | /* Broxton-T */ | ||
| 2236 | { PCI_DEVICE(0x8086, 0x1a98), | ||
| 2237 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON }, | ||
| 2235 | /* Haswell */ | 2238 | /* Haswell */ |
| 2236 | { PCI_DEVICE(0x8086, 0x0a0c), | 2239 | { PCI_DEVICE(0x8086, 0x0a0c), |
| 2237 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, | 2240 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, |
| @@ -361,6 +361,7 @@ static int cs_parse_auto_config(struct hda_codec *codec) · 360 unmodified lines | |||
| 361 | { | 361 | { |
| 362 | struct cs_spec *spec = codec->spec; | 362 | struct cs_spec *spec = codec->spec; |
| 363 | int err; | 363 | int err; |
| 364 | int i; | ||
| 364 | 365 | ||
| 365 | err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); | 366 | err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); |
| 366 | if (err < 0) | 367 | if (err < 0) |
| @@ -370,6 +371,19 @@ static int cs_parse_auto_config(struct hda_codec *codec) · 3 unmodified lines | |||
| 370 | if (err < 0) | 371 | if (err < 0) |
| 371 | return err; | 372 | return err; |
| 372 | 373 | ||
| 374 | /* keep the ADCs powered up when it's dynamically switchable */ | ||
| 375 | if (spec->gen.dyn_adc_switch) { | ||
| 376 | unsigned int done = 0; | ||
| 377 | for (i = 0; i < spec->gen.input_mux.num_items; i++) { | ||
| 378 | int idx = spec->gen.dyn_adc_idx[i]; | ||
| 379 | if (done & (1 << idx)) | ||
| 380 | continue; | ||
| 381 | snd_hda_gen_fix_pin_power(codec, | ||
| 382 | spec->gen.adc_nids[idx]); | ||
| 383 | done |= 1 << idx; | ||
| 384 | } | ||
| 385 | } | ||
| 386 | |||
| 373 | return 0; | 387 | return 0; |
| 374 | } | 388 | } |
| 375 | 389 | ||
| @@ -1858,6 +1858,8 @@ static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, · 1857 unmodified lines | |||
| 1858 | struct hdmi_spec *spec = codec->spec; | 1858 | struct hdmi_spec *spec = codec->spec; |
| 1859 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); | 1859 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
| 1860 | 1860 | ||
| 1861 | if (!per_pin) | ||
| 1862 | return; | ||
| 1861 | mutex_lock(&per_pin->lock); | 1863 | mutex_lock(&per_pin->lock); |
| 1862 | per_pin->chmap_set = true; | 1864 | per_pin->chmap_set = true; |
| 1863 | memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap)); | 1865 | memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap)); |
| @@ -5449,6 +5449,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5448 unmodified lines | |||
| 5449 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5449 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5450 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5450 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5451 | SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13), | 5451 | SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13), |
| 5452 | SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
| 5452 | SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK), | 5453 | SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK), |
| 5453 | SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | 5454 | SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5454 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 5455 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| @@ -1341,5 +1341,6 @@ irqreturn_t pcxhr_threaded_irq(int irq, void *dev_id) · 1340 unmodified lines | |||
| 1341 | } | 1341 | } |
| 1342 | 1342 | ||
| 1343 | pcxhr_msg_thread(mgr); | 1343 | pcxhr_msg_thread(mgr); |
| 1344 | mutex_unlock(&mgr->lock); | ||
| 1344 | return IRQ_HANDLED; | 1345 | return IRQ_HANDLED; |
| 1345 | } | 1346 | } |
| @@ -299,18 +299,38 @@ they mean, and suggestions for how to fix them. · 298 unmodified lines | |||
| 299 | Errors in .c files | 299 | Errors in .c files |
| 300 | ------------------ | 300 | ------------------ |
| 301 | 301 | ||
| 302 | If you're getting an objtool error in a compiled .c file, chances are | 302 | 1. c_file.o: warning: objtool: funcA() falls through to next function funcB() |
| 303 | the file uses an asm() statement which has a "call" instruction. An | ||
| 304 | asm() statement with a call instruction must declare the use of the | ||
| 305 | stack pointer in its output operand. For example, on x86_64: | ||
| 306 | 303 | ||
| 307 | register void *__sp asm("rsp"); | 304 | This means that funcA() doesn't end with a return instruction or an |
| 308 | asm volatile("call func" : "+r" (__sp)); | 305 | unconditional jump, and that objtool has determined that the function |
| 306 | can fall through into the next function. There could be different | ||
| 307 | reasons for this: | ||
| 309 | 308 | ||
| 310 | Otherwise the stack frame may not get created before the call. | 309 | 1) funcA()'s last instruction is a call to a "noreturn" function like |
| 310 | panic(). In this case the noreturn function needs to be added to | ||
| 311 | objtool's hard-coded global_noreturns array. Feel free to bug the | ||
| 312 | objtool maintainer, or you can submit a patch. | ||
| 311 | 313 | ||
| 312 | Another possible cause for errors in C code is if the Makefile removes | 314 | 2) funcA() uses the unreachable() annotation in a section of code |
| 313 | -fno-omit-frame-pointer or adds -fomit-frame-pointer to the gcc options. | 315 | that is actually reachable. |
| 316 | |||
| 317 | 3) If funcA() calls an inline function, the object code for funcA() | ||
| 318 | might be corrupt due to a gcc bug. For more details, see: | ||
| 319 | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646 | ||
| 320 | |||
| 321 | 2. If you're getting any other objtool error in a compiled .c file, it | ||
| 322 | may be because the file uses an asm() statement which has a "call" | ||
| 323 | instruction. An asm() statement with a call instruction must declare | ||
| 324 | the use of the stack pointer in its output operand. For example, on | ||
| 325 | x86_64: | ||
| 326 | |||
| 327 | register void *__sp asm("rsp"); | ||
| 328 | asm volatile("call func" : "+r" (__sp)); | ||
| 329 | |||
| 330 | Otherwise the stack frame may not get created before the call. | ||
| 331 | |||
| 332 | 3. Another possible cause for errors in C code is if the Makefile removes | ||
| 333 | -fno-omit-frame-pointer or adds -fomit-frame-pointer to the gcc options. | ||
| 314 | 334 | ||
| 315 | Also see the above section for .S file errors for more information what | 335 | Also see the above section for .S file errors for more information what |
| 316 | the individual error messages mean. | 336 | the individual error messages mean. |
| @@ -54,6 +54,7 @@ struct instruction { · 53 unmodified lines | |||
| 54 | struct symbol *call_dest; | 54 | struct symbol *call_dest; |
| 55 | struct instruction *jump_dest; | 55 | struct instruction *jump_dest; |
| 56 | struct list_head alts; | 56 | struct list_head alts; |
| 57 | struct symbol *func; | ||
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | struct alternative { | 60 | struct alternative { |
| @@ -66,6 +67,7 @@ struct objtool_file { · 6 unmodified lines | |||
| 66 | struct list_head insn_list; | 67 | struct list_head insn_list; |
| 67 | DECLARE_HASHTABLE(insn_hash, 16); | 68 | DECLARE_HASHTABLE(insn_hash, 16); |
| 68 | struct section *rodata, *whitelist; | 69 | struct section *rodata, *whitelist; |
| 70 | bool ignore_unreachables, c_file; | ||
| 69 | }; | 71 | }; |
| 70 | 72 | ||
| 71 | const char *objname; | 73 | const char *objname; |
| @@ -228,7 +230,7 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func, · 156 unmodified lines | |||
| 228 | } | 230 | } |
| 229 | } | 231 | } |
| 230 | 232 | ||
| 231 | if (insn->type == INSN_JUMP_DYNAMIC) | 233 | if (insn->type == INSN_JUMP_DYNAMIC && list_empty(&insn->alts)) |
| 232 | /* sibling call */ | 234 | /* sibling call */ |
| 233 | return 0; | 235 | return 0; |
| 234 | } | 236 | } |
| @@ -248,6 +250,7 @@ static int dead_end_function(struct objtool_file *file, struct symbol *func) · 13 unmodified lines | |||
| 248 | static int decode_instructions(struct objtool_file *file) | 250 | static int decode_instructions(struct objtool_file *file) |
| 249 | { | 251 | { |
| 250 | struct section *sec; | 252 | struct section *sec; |
| 253 | struct symbol *func; | ||
| 251 | unsigned long offset; | 254 | unsigned long offset; |
| 252 | struct instruction *insn; | 255 | struct instruction *insn; |
| 253 | int ret; | 256 | int ret; |
| @@ -281,6 +284,21 @@ static int decode_instructions(struct objtool_file *file) · 27 unmodified lines | |||
| 281 | hash_add(file->insn_hash, &insn->hash, insn->offset); | 284 | hash_add(file->insn_hash, &insn->hash, insn->offset); |
| 282 | list_add_tail(&insn->list, &file->insn_list); | 285 | list_add_tail(&insn->list, &file->insn_list); |
| 283 | } | 286 | } |
| 287 | |||
| 288 | list_for_each_entry(func, &sec->symbol_list, list) { | ||
| 289 | if (func->type != STT_FUNC) | ||
| 290 | continue; | ||
| 291 | |||
| 292 | if (!find_insn(file, sec, func->offset)) { | ||
| 293 | WARN("%s(): can't find starting instruction", | ||
| 294 | func->name); | ||
| 295 | return -1; | ||
| 296 | } | ||
| 297 | |||
| 298 | func_for_each_insn(file, func, insn) | ||
| 299 | if (!insn->func) | ||
| 300 | insn->func = func; | ||
| 301 | } | ||
| 284 | } | 302 | } |
| 285 | 303 | ||
| 286 | return 0; | 304 | return 0; |
| @@ -664,13 +682,40 @@ static int add_func_switch_tables(struct objtool_file *file, · 377 unmodified lines | |||
| 664 | text_rela->addend); | 682 | text_rela->addend); |
| 665 | 683 | ||
| 666 | /* | 684 | /* |
| 667 | * TODO: Document where this is needed, or get rid of it. | ||
| 668 | * | ||
| 669 | * rare case: jmpq *[addr](%rip) | 685 | * rare case: jmpq *[addr](%rip) |
| 686 | * | ||
| 687 | * This check is for a rare gcc quirk, currently only seen in | ||
| 688 | * three driver functions in the kernel, only with certain | ||
| 689 | * obscure non-distro configs. | ||
| 690 | * | ||
| 691 | * As part of an optimization, gcc makes a copy of an existing | ||
| 692 | * switch jump table, modifies it, and then hard-codes the jump | ||
| 693 | * (albeit with an indirect jump) to use a single entry in the | ||
| 694 | * table. The rest of the jump table and some of its jump | ||
| 695 | * targets remain as dead code. | ||
| 696 | * | ||
| 697 | * In such a case we can just crudely ignore all unreachable | ||
| 698 | * instruction warnings for the entire object file. Ideally we | ||
| 699 | * would just ignore them for the function, but that would | ||
| 700 | * require redesigning the code quite a bit. And honestly | ||
| 701 | * that's just not worth doing: unreachable instruction | ||
| 702 | * warnings are of questionable value anyway, and this is such | ||
| 703 | * a rare issue. | ||
| 704 | * | ||
| 705 | * kbuild reports: | ||
| 706 | * - https://lkml.kernel.org/r/201603231906.LWcVUpxm%25fengguang.wu@intel.com | ||
| 707 | * - https://lkml.kernel.org/r/201603271114.K9i45biy%25fengguang.wu@intel.com | ||
| 708 | * - https://lkml.kernel.org/r/201603291058.zuJ6ben1%25fengguang.wu@intel.com | ||
| 709 | * | ||
| 710 | * gcc bug: | ||
| 711 | * - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70604 | ||
| 670 | */ | 712 | */ |
| 671 | if (!rodata_rela) | 713 | if (!rodata_rela) { |
| 672 | rodata_rela = find_rela_by_dest(file->rodata, | 714 | rodata_rela = find_rela_by_dest(file->rodata, |
| 673 | text_rela->addend + 4); | 715 | text_rela->addend + 4); |
| 716 | if (rodata_rela) | ||
| 717 | file->ignore_unreachables = true; | ||
| 718 | } | ||
| 674 | 719 | ||
| 675 | if (!rodata_rela) | 720 | if (!rodata_rela) |
| 676 | continue; | 721 | continue; |
| @@ -732,9 +777,6 @@ static int decode_sections(struct objtool_file *file) · 55 unmodified lines | |||
| 732 | { | 777 | { |
| 733 | int ret; | 778 | int ret; |
| 734 | 779 | ||
| 735 | file->whitelist = find_section_by_name(file->elf, "__func_stack_frame_non_standard"); | ||
| 736 | file->rodata = find_section_by_name(file->elf, ".rodata"); | ||
| 737 | |||
| 738 | ret = decode_instructions(file); | 780 | ret = decode_instructions(file); |
| 739 | if (ret) | 781 | if (ret) |
| 740 | return ret; | 782 | return ret; |
| @@ -799,6 +841,7 @@ static int validate_branch(struct objtool_file *file, · 58 unmodified lines | |||
| 799 | struct alternative *alt; | 841 | struct alternative *alt; |
| 800 | struct instruction *insn; | 842 | struct instruction *insn; |
| 801 | struct section *sec; | 843 | struct section *sec; |
| 844 | struct symbol *func = NULL; | ||
| 802 | unsigned char state; | 845 | unsigned char state; |
| 803 | int ret; | 846 | int ret; |
| 804 | 847 | ||
| @@ -813,6 +856,16 @@ static int validate_branch(struct objtool_file *file, · 8 unmodified lines | |||
| 813 | } | 856 | } |
| 814 | 857 | ||
| 815 | while (1) { | 858 | while (1) { |
| 859 | if (file->c_file && insn->func) { | ||
| 860 | if (func && func != insn->func) { | ||
| 861 | WARN("%s() falls through to next function %s()", | ||
| 862 | func->name, insn->func->name); | ||
| 863 | return 1; | ||
| 864 | } | ||
| 865 | |||
| 866 | func = insn->func; | ||
| 867 | } | ||
| 868 | |||
| 816 | if (insn->visited) { | 869 | if (insn->visited) { |
| 817 | if (frame_state(insn->state) != frame_state(state)) { | 870 | if (frame_state(insn->state) != frame_state(state)) { |
| 818 | WARN_FUNC("frame pointer state mismatch", | 871 | WARN_FUNC("frame pointer state mismatch", |
| @@ -823,13 +876,6 @@ static int validate_branch(struct objtool_file *file, · 4 unmodified lines | |||
| 823 | return 0; | 876 | return 0; |
| 824 | } | 877 | } |
| 825 | 878 | ||
| 826 | /* | ||
| 827 | * Catch a rare case where a noreturn function falls through to | ||
| 828 | * the next function. | ||
| 829 | */ | ||
| 830 | if (is_fentry_call(insn) && (state & STATE_FENTRY)) | ||
| 831 | return 0; | ||
| 832 | |||
| 833 | insn->visited = true; | 879 | insn->visited = true; |
| 834 | insn->state = state; | 880 | insn->state = state; |
| 835 | 881 | ||
| @@ -1035,12 +1081,8 @@ static int validate_functions(struct objtool_file *file) · 199 unmodified lines | |||
| 1035 | continue; | 1081 | continue; |
| 1036 | 1082 | ||
| 1037 | insn = find_insn(file, sec, func->offset); | 1083 | insn = find_insn(file, sec, func->offset); |
| 1038 | if (!insn) { | 1084 | if (!insn) |
| 1039 | WARN("%s(): can't find starting instruction", | ||
| 1040 | func->name); | ||
| 1041 | warnings++; | ||
| 1042 | continue; | 1085 | continue; |
| 1043 | } | ||
| 1044 | 1086 | ||
| 1045 | ret = validate_branch(file, insn, 0); | 1087 | ret = validate_branch(file, insn, 0); |
| 1046 | warnings += ret; | 1088 | warnings += ret; |
| @@ -1056,13 +1098,14 @@ static int validate_functions(struct objtool_file *file) · 9 unmodified lines | |||
| 1056 | if (insn->visited) | 1098 | if (insn->visited) |
| 1057 | continue; | 1099 | continue; |
| 1058 | 1100 | ||
| 1059 | if (!ignore_unreachable_insn(func, insn) && | ||
| 1060 | !warnings) { | ||
| 1061 | WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset); | ||
| 1062 | warnings++; | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | insn->visited = true; | 1101 | insn->visited = true; |
| 1102 | |||
| 1103 | if (file->ignore_unreachables || warnings || | ||
| 1104 | ignore_unreachable_insn(func, insn)) | ||
| 1105 | continue; | ||
| 1106 | |||
| 1107 | WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset); | ||
| 1108 | warnings++; | ||
| 1066 | } | 1109 | } |
| 1067 | } | 1110 | } |
| 1068 | } | 1111 | } |
| @@ -1133,6 +1176,10 @@ int cmd_check(int argc, const char **argv) · 64 unmodified lines | |||
| 1133 | 1176 | ||
| 1134 | INIT_LIST_HEAD(&file.insn_list); | 1177 | INIT_LIST_HEAD(&file.insn_list); |
| 1135 | hash_init(file.insn_hash); | 1178 | hash_init(file.insn_hash); |
| 1179 | file.whitelist = find_section_by_name(file.elf, "__func_stack_frame_non_standard"); | ||
| 1180 | file.rodata = find_section_by_name(file.elf, ".rodata"); | ||
| 1181 | file.ignore_unreachables = false; | ||
| 1182 | file.c_file = find_section_by_name(file.elf, ".comment"); | ||
| 1136 | 1183 | ||
| 1137 | ret = decode_sections(&file); | 1184 | ret = decode_sections(&file); |
| 1138 | if (ret < 0) | 1185 | if (ret < 0) |
| @@ -1130,7 +1130,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq) · 1129 unmodified lines | |||
| 1130 | pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n", | 1130 | pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n", |
| 1131 | ret); | 1131 | ret); |
| 1132 | 1132 | ||
| 1133 | if (pt->synth_opts.callchain) | 1133 | if (pt->synth_opts.last_branch) |
| 1134 | intel_pt_reset_last_branch_rb(ptq); | 1134 | intel_pt_reset_last_branch_rb(ptq); |
| 1135 | 1135 | ||
| 1136 | return ret; | 1136 | return ret; |