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 | 192 | can be one of: |
| 193 | 193 | "allwinner,sun6i-a31" |
| 194 | 194 | "allwinner,sun8i-a23" |
| 195 | − "arm,psci" | |
| 196 | 195 | "arm,realview-smp" |
| 197 | 196 | "brcm,bcm-nsp-smp" |
| 198 | 197 | "brcm,brahma-b15" |
| @@ -8,15 +8,19 @@ Required properties: · 7 unmodified lines | ||
| 8 | 8 | of memory mapped region. |
| 9 | 9 | - clock-names: from common clock binding: |
| 10 | 10 | Required elements: "24m" |
| 11 | −- rockchip,grf: phandle to the syscon managing the "general register files" | |
| 12 | 11 | - #phy-cells : from the generic PHY bindings, must be 0; |
| 13 | 12 | |
| 14 | 13 | Example: |
| 15 | 14 | |
| 16 | −edp_phy: edp-phy { | |
| 17 | − compatible = "rockchip,rk3288-dp-phy"; | |
| 18 | − rockchip,grf = <&grf>; | |
| 19 | − clocks = <&cru SCLK_EDP_24M>; | |
| 20 | − clock-names = "24m"; | |
| 21 | − #phy-cells = <0>; | |
| 15 | +grf: syscon@ff770000 { | |
| 16 | + compatible = "rockchip,rk3288-grf", "syscon", "simple-mfd"; | |
| 17 | + | |
| 18 | +... | |
| 19 | + | |
| 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 | 4 | Required properties: |
| 5 | 5 | - compatible: rockchip,rk3399-emmc-phy |
| 6 | − - rockchip,grf : phandle to the syscon managing the "general | |
| 7 | − register files" | |
| 8 | 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 | 8 | register files" |
| 11 | 9 | |
| 12 | 10 | Example: |
| 13 | 11 | |
| 14 | −emmcphy: phy { | |
| 15 | − compatible = "rockchip,rk3399-emmc-phy"; | |
| 16 | − rockchip,grf = <&grf>; | |
| 17 | − reg = <0xf780>; | |
| 18 | − #phy-cells = <0>; | |
| 12 | + | |
| 13 | +grf: syscon@ff770000 { | |
| 14 | + compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; | |
| 15 | + #address-cells = <1>; | |
| 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 | 173 | proximity of the device and while the value of the BTN_TOUCH code is 0. If |
| 174 | 174 | the input device may be used freely in three dimensions, consider ABS_Z |
| 175 | 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 | 181 | * ABS_MT_<name>: |
| 178 | 182 | - Used to describe multitouch input events. Please see |
| @@ -19,7 +19,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks · 18 unmodified lines | ||
| 19 | 19 | ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space |
| 20 | 20 | ... unused hole ... |
| 21 | 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 | 23 | ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls |
| 24 | 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 | 31 | the processes using the page fault handler, with init_level4_pgt as |
| 32 | 32 | reference. |
| 33 | 33 | |
| 34 | −Current X86-64 implementations only support 40 bits of address space, | |
| 35 | −but we support up to 46 bits. This expands into MBZ space in the page tables. | |
| 34 | +Current X86-64 implementations support up to 46 bits of address space (64 TB), | |
| 35 | +which is our current limit. This expands into MBZ space in the page tables. | |
| 36 | 36 | |
| 37 | 37 | We map EFI runtime services in the 'efi_pgd' PGD in a 64Gb large virtual |
| 38 | 38 | memory window (this size is arbitrary, it can be raised later if needed). |
| @@ -11072,6 +11072,15 @@ S: Maintained · 11071 unmodified lines | ||
| 11072 | 11072 | F: drivers/clk/ti/ |
| 11073 | 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 | 11084 | TI FLASH MEDIA INTERFACE DRIVER |
| 11076 | 11085 | M: Alex Dubov <oakad@yahoo.com> |
| 11077 | 11086 | S: Maintained |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 6 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc4 | |
| 4 | +EXTRAVERSION = -rc5 | |
| 5 | 5 | NAME = Blurry Fish Butt |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -1008,7 +1008,8 @@ prepare0: archprepare FORCE · 1000 unmodified lines | ||
| 1008 | 1008 | prepare: prepare0 prepare-objtool |
| 1009 | 1009 | |
| 1010 | 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 | 1013 | ifeq ($(has_libelf),1) |
| 1013 | 1014 | objtool_target := tools/objtool FORCE |
| 1014 | 1015 | else |
| @@ -860,7 +860,7 @@ · 859 unmodified lines | ||
| 860 | 860 | ti,no-idle-on-init; |
| 861 | 861 | reg = <0x50000000 0x2000>; |
| 862 | 862 | interrupts = <100>; |
| 863 | − dmas = <&edma 52>; | |
| 863 | + dmas = <&edma 52 0>; | |
| 864 | 864 | dma-names = "rxtx"; |
| 865 | 865 | gpmc,num-cs = <7>; |
| 866 | 866 | gpmc,num-waitpins = <2>; |
| @@ -884,7 +884,7 @@ · 883 unmodified lines | ||
| 884 | 884 | gpmc: gpmc@50000000 { |
| 885 | 885 | compatible = "ti,am3352-gpmc"; |
| 886 | 886 | ti,hwmods = "gpmc"; |
| 887 | − dmas = <&edma 52>; | |
| 887 | + dmas = <&edma 52 0>; | |
| 888 | 888 | dma-names = "rxtx"; |
| 889 | 889 | clocks = <&l3s_gclk>; |
| 890 | 890 | clock-names = "fck"; |
| @@ -99,13 +99,6 @@ · 98 unmodified lines | ||
| 99 | 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 | 102 | hdmi0: connector { |
| 110 | 103 | compatible = "hdmi-connector"; |
| 111 | 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 | 345 | tpd12s015_pins: pinmux_tpd12s015_pins { |
| 359 | 346 | pinctrl-single,pins = < |
| 360 | 347 | DRA7XX_CORE_IOPAD(0x37b0, PIN_OUTPUT | MUX_MODE14) /* gpio7_10 CT_CP_HPD */ |
| @@ -706,10 +693,6 @@ · 345 unmodified lines | ||
| 706 | 693 | pinctrl-0 = <&usb1_pins>; |
| 707 | 694 | }; |
| 708 | 695 | |
| 709 | −&omap_dwc3_1 { | |
| 710 | − extcon = <&extcon_usb1>; | |
| 711 | −}; | |
| 712 | − | |
| 713 | 696 | &omap_dwc3_2 { |
| 714 | 697 | extcon = <&extcon_usb2>; |
| 715 | 698 | }; |
| @@ -4,6 +4,157 @@ · 3 unmodified lines | ||
| 4 | 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 | 158 | &pllss_clocks { |
| 8 | 159 | timer1_fck: timer1_fck { |
| 9 | 160 | #clock-cells = <0>; |
| @@ -23,6 +174,24 @@ · 13 unmodified lines | ||
| 23 | 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 | 195 | sysclk18_ck: sysclk18_ck { |
| 27 | 196 | #clock-cells = <0>; |
| 28 | 197 | compatible = "ti,mux-clock"; |
| @@ -79,37 +248,6 @@ · 50 unmodified lines | ||
| 79 | 248 | compatible = "fixed-clock"; |
| 80 | 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 | 253 | &prcm_clocks { |
| @@ -138,6 +276,49 @@ · 22 unmodified lines | ||
| 138 | 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 | 322 | aud_clkin0_ck: aud_clkin0_ck { |
| 142 | 323 | #clock-cells = <0>; |
| 143 | 324 | compatible = "fixed-clock"; |
| @@ -6,6 +6,32 @@ · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 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 | 36 | * Compared to dm814x, dra62x has different shifts and more mux options. |
| 11 | 37 | * Please add the extra options for ysclk_14 and 16 if really needed. |
| @@ -98,12 +98,20 @@ · 97 unmodified lines | ||
| 98 | 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 | 102 | #clock-cells = <0>; |
| 103 | 103 | compatible = "fixed-clock"; |
| 104 | 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 | 115 | virt_12000000_ck: virt_12000000_ck { |
| 108 | 116 | #clock-cells = <0>; |
| 109 | 117 | compatible = "fixed-clock"; |
| @@ -2170,4 +2178,12 @@ · 2060 unmodified lines | ||
| 2170 | 2178 | ti,bit-shift = <22>; |
| 2171 | 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 | 1 | /dts-v1/; |
| 2 | 2 | |
| 3 | −#include <dt-bindings/interrupt-controller/arm-gic.h> | |
| 3 | +#include <dt-bindings/interrupt-controller/irq.h> | |
| 4 | 4 | #include <dt-bindings/clock/qcom,gcc-msm8974.h> |
| 5 | 5 | #include "skeleton.dtsi" |
| 6 | 6 | |
| @@ -460,8 +460,6 @@ · 453 unmodified lines | ||
| 460 | 460 | clock-names = "core", "iface"; |
| 461 | 461 | #address-cells = <1>; |
| 462 | 462 | #size-cells = <0>; |
| 463 | − dmas = <&blsp2_dma 20>, <&blsp2_dma 21>; | |
| 464 | − dma-names = "tx", "rx"; | |
| 465 | 463 | }; |
| 466 | 464 | |
| 467 | 465 | spmi_bus: spmi@fc4cf000 { |
| @@ -479,16 +477,6 @@ · 11 unmodified lines | ||
| 479 | 477 | interrupt-controller; |
| 480 | 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 | 482 | smd { |
| @@ -661,6 +661,7 @@ · 660 unmodified lines | ||
| 661 | 661 | }; |
| 662 | 662 | |
| 663 | 663 | &pcie_bus_clk { |
| 664 | + clock-frequency = <100000000>; | |
| 664 | 665 | status = "okay"; |
| 665 | 666 | }; |
| 666 | 667 | |
| @@ -143,19 +143,11 @@ · 142 unmodified lines | ||
| 143 | 143 | }; |
| 144 | 144 | |
| 145 | 145 | &pfc { |
| 146 | − pinctrl-0 = <&scif_clk_pins>; | |
| 147 | − pinctrl-names = "default"; | |
| 148 | − | |
| 149 | 146 | scif0_pins: serial0 { |
| 150 | 147 | renesas,groups = "scif0_data_d"; |
| 151 | 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 | 151 | ether_pins: ether { |
| 160 | 152 | renesas,groups = "eth_link", "eth_mdio", "eth_rmii"; |
| 161 | 153 | renesas,function = "eth"; |
| @@ -229,11 +221,6 @@ · 67 unmodified lines | ||
| 229 | 221 | status = "okay"; |
| 230 | 222 | }; |
| 231 | 223 | |
| 232 | −&scif_clk { | |
| 233 | − clock-frequency = <14745600>; | |
| 234 | − status = "okay"; | |
| 235 | −}; | |
| 236 | − | |
| 237 | 224 | ðer { |
| 238 | 225 | pinctrl-0 = <ðer_pins &phy1_pins>; |
| 239 | 226 | pinctrl-names = "default"; |
| @@ -414,6 +401,7 @@ · 174 unmodified lines | ||
| 414 | 401 | }; |
| 415 | 402 | |
| 416 | 403 | &pcie_bus_clk { |
| 404 | + clock-frequency = <100000000>; | |
| 417 | 405 | status = "okay"; |
| 418 | 406 | }; |
| 419 | 407 | |
| @@ -1083,9 +1083,8 @@ · 1082 unmodified lines | ||
| 1083 | 1083 | pcie_bus_clk: pcie_bus_clk { |
| 1084 | 1084 | compatible = "fixed-clock"; |
| 1085 | 1085 | #clock-cells = <0>; |
| 1086 | − clock-frequency = <100000000>; | |
| 1086 | + clock-frequency = <0>; | |
| 1087 | 1087 | clock-output-names = "pcie_bus"; |
| 1088 | − status = "disabled"; | |
| 1089 | 1088 | }; |
| 1090 | 1089 | |
| 1091 | 1090 | /* External SCIF clock */ |
| @@ -1094,7 +1093,6 @@ · 2 unmodified lines | ||
| 1094 | 1093 | #clock-cells = <0>; |
| 1095 | 1094 | /* This value must be overridden by the board. */ |
| 1096 | 1095 | clock-frequency = <0>; |
| 1097 | − status = "disabled"; | |
| 1098 | 1096 | }; |
| 1099 | 1097 | |
| 1100 | 1098 | /* External USB clock - can be overridden by the board */ |
| @@ -1112,7 +1110,6 @@ · 11 unmodified lines | ||
| 1112 | 1110 | /* This value must be overridden by the board. */ |
| 1113 | 1111 | clock-frequency = <0>; |
| 1114 | 1112 | clock-output-names = "can_clk"; |
| 1115 | − status = "disabled"; | |
| 1116 | 1113 | }; |
| 1117 | 1114 | |
| 1118 | 1115 | /* Special CPG clocks */ |
| @@ -71,6 +71,7 @@ struct platform_device *__init imx_add_sdhci_esdhc_imx( · 70 unmodified lines | ||
| 71 | 71 | if (!pdata) |
| 72 | 72 | pdata = &default_esdhc_pdata; |
| 73 | 73 | |
| 74 | − return imx_add_platform_device(data->devid, data->id, res, | |
| 75 | − ARRAY_SIZE(res), pdata, sizeof(*pdata)); | |
| 74 | + return imx_add_platform_device_dmamask(data->devid, data->id, res, | |
| 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 | 461 | .cm_inst = DRA7XX_CM_CORE_AON_IPU_INST, |
| 462 | 462 | .clkdm_offs = DRA7XX_CM_CORE_AON_IPU_IPU_CDOFFS, |
| 463 | 463 | .dep_bit = DRA7XX_IPU_STATDEP_SHIFT, |
| 464 | − .flags = CLKDM_CAN_HWSUP_SWSUP, | |
| 464 | + .flags = CLKDM_CAN_SWSUP, | |
| 465 | 465 | }; |
| 466 | 466 | |
| 467 | 467 | static struct clockdomain mpu1_7xx_clkdm = { |
| @@ -737,7 +737,8 @@ void __init omap5_init_late(void) · 736 unmodified lines | ||
| 737 | 737 | #ifdef CONFIG_SOC_DRA7XX |
| 738 | 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 | 742 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); |
| 742 | 743 | omap2_control_base_init(); |
| 743 | 744 | omap4_pm_init_early(); |
| @@ -274,6 +274,10 @@ static inline void omap5_irq_save_context(void) · 273 unmodified lines | ||
| 274 | 274 | */ |
| 275 | 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 | 281 | if (!sar_base) |
| 278 | 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 | 295 | u32 val; |
| 292 | 296 | u32 offset = SAR_BACKUP_STATUS_OFFSET; |
| 297 | + /* DRA7 has no SAR to save */ | |
| 298 | + if (soc_is_dra7xx()) | |
| 299 | + return; | |
| 293 | 300 | |
| 294 | 301 | if (soc_is_omap54xx()) |
| 295 | 302 | offset = OMAP5_SAR_BACKUP_STATUS_OFFSET; |
| @@ -198,7 +198,6 @@ void omap_sram_idle(void) · 197 unmodified lines | ||
| 198 | 198 | int per_next_state = PWRDM_POWER_ON; |
| 199 | 199 | int core_next_state = PWRDM_POWER_ON; |
| 200 | 200 | int per_going_off; |
| 201 | − int core_prev_state; | |
| 202 | 201 | u32 sdrc_pwr = 0; |
| 203 | 202 | |
| 204 | 203 | mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); |
| @@ -278,16 +277,20 @@ void omap_sram_idle(void) · 73 unmodified lines | ||
| 278 | 277 | sdrc_write_reg(sdrc_pwr, SDRC_POWER); |
| 279 | 278 | |
| 280 | 279 | /* CORE */ |
| 281 | − if (core_next_state < PWRDM_POWER_ON) { | |
| 282 | − core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm); | |
| 283 | − if (core_prev_state == PWRDM_POWER_OFF) { | |
| 284 | − omap3_core_restore_context(); | |
| 285 | − omap3_cm_restore_context(); | |
| 286 | − omap3_sram_restore_context(); | |
| 287 | − omap2_sms_restore_context(); | |
| 288 | − } | |
| 280 | + if (core_next_state < PWRDM_POWER_ON && | |
| 281 | + pwrdm_read_prev_pwrst(core_pwrdm) == PWRDM_POWER_OFF) { | |
| 282 | + omap3_core_restore_context(); | |
| 283 | + omap3_cm_restore_context(); | |
| 284 | + omap3_sram_restore_context(); | |
| 285 | + omap2_sms_restore_context(); | |
| 286 | + } else { | |
| 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 | 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 | 40 | void __init shmobile_init_delay(void) |
| 41 | 41 | { |
| 42 | 42 | struct device_node *np, *cpus; |
| 43 | − bool is_a7_a8_a9 = false; | |
| 44 | − bool is_a15 = false; | |
| 43 | + unsigned int div = 0; | |
| 45 | 44 | bool has_arch_timer = false; |
| 46 | 45 | u32 max_freq = 0; |
| 47 | 46 | |
| @@ -55,27 +54,22 @@ void __init shmobile_init_delay(void) · 7 unmodified lines | ||
| 55 | 54 | if (!of_property_read_u32(np, "clock-frequency", &freq)) |
| 56 | 55 | max_freq = max(max_freq, freq); |
| 57 | 56 | |
| 58 | − if (of_device_is_compatible(np, "arm,cortex-a8") || | |
| 59 | − of_device_is_compatible(np, "arm,cortex-a9")) { | |
| 60 | − is_a7_a8_a9 = true; | |
| 61 | − } else if (of_device_is_compatible(np, "arm,cortex-a7")) { | |
| 62 | − is_a7_a8_a9 = true; | |
| 63 | − has_arch_timer = true; | |
| 64 | − } else if (of_device_is_compatible(np, "arm,cortex-a15")) { | |
| 65 | − is_a15 = true; | |
| 57 | + if (of_device_is_compatible(np, "arm,cortex-a8")) { | |
| 58 | + div = 2; | |
| 59 | + } else if (of_device_is_compatible(np, "arm,cortex-a9")) { | |
| 60 | + div = 1; | |
| 61 | + } else if (of_device_is_compatible(np, "arm,cortex-a7") || | |
| 62 | + of_device_is_compatible(np, "arm,cortex-a15")) { | |
| 63 | + div = 1; | |
| 66 | 64 | has_arch_timer = true; |
| 67 | 65 | } |
| 68 | 66 | } |
| 69 | 67 | |
| 70 | 68 | of_node_put(cpus); |
| 71 | 69 | |
| 72 | − if (!max_freq) | |
| 70 | + if (!max_freq || !div) | |
| 73 | 71 | return; |
| 74 | 72 | |
| 75 | − if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) { | |
| 76 | − if (is_a7_a8_a9) | |
| 77 | − shmobile_setup_delay_hz(max_freq, 1, 3); | |
| 78 | − else if (is_a15) | |
| 79 | − shmobile_setup_delay_hz(max_freq, 2, 4); | |
| 80 | − } | |
| 73 | + if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | |
| 74 | + shmobile_setup_delay_hz(max_freq, 1, div); | |
| 81 | 75 | } |
| @@ -70,7 +70,6 @@ · 69 unmodified lines | ||
| 70 | 70 | i2c3 = &i2c3; |
| 71 | 71 | i2c4 = &i2c4; |
| 72 | 72 | i2c5 = &i2c5; |
| 73 | − i2c6 = &i2c6; | |
| 74 | 73 | }; |
| 75 | 74 | }; |
| 76 | 75 | |
| @@ -201,15 +201,12 @@ · 200 unmodified lines | ||
| 201 | 201 | |
| 202 | 202 | i2c2: i2c@58782000 { |
| 203 | 203 | compatible = "socionext,uniphier-fi2c"; |
| 204 | − status = "disabled"; | |
| 205 | 204 | reg = <0x58782000 0x80>; |
| 206 | 205 | #address-cells = <1>; |
| 207 | 206 | #size-cells = <0>; |
| 208 | 207 | interrupts = <0 43 4>; |
| 209 | − pinctrl-names = "default"; | |
| 210 | − pinctrl-0 = <&pinctrl_i2c2>; | |
| 211 | 208 | clocks = <&i2c_clk>; |
| 212 | − clock-frequency = <100000>; | |
| 209 | + clock-frequency = <400000>; | |
| 213 | 210 | }; |
| 214 | 211 | |
| 215 | 212 | i2c3: i2c@58783000 { |
| @@ -227,12 +224,15 @@ · 11 unmodified lines | ||
| 227 | 224 | |
| 228 | 225 | i2c4: i2c@58784000 { |
| 229 | 226 | compatible = "socionext,uniphier-fi2c"; |
| 227 | + status = "disabled"; | |
| 230 | 228 | reg = <0x58784000 0x80>; |
| 231 | 229 | #address-cells = <1>; |
| 232 | 230 | #size-cells = <0>; |
| 233 | 231 | interrupts = <0 45 4>; |
| 232 | + pinctrl-names = "default"; | |
| 233 | + pinctrl-0 = <&pinctrl_i2c4>; | |
| 234 | 234 | clocks = <&i2c_clk>; |
| 235 | − clock-frequency = <400000>; | |
| 235 | + clock-frequency = <100000>; | |
| 236 | 236 | }; |
| 237 | 237 | |
| 238 | 238 | i2c5: i2c@58785000 { |
| @@ -245,16 +245,6 @@ · 6 unmodified lines | ||
| 245 | 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 | 248 | system_bus: system-bus@58c00000 { |
| 259 | 249 | compatible = "socionext,uniphier-system-bus"; |
| 260 | 250 | status = "disabled"; |
| @@ -588,6 +588,15 @@ set_hcr: · 587 unmodified lines | ||
| 588 | 588 | msr vpidr_el2, x0 |
| 589 | 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 | 600 | /* sctlr_el1 */ |
| 592 | 601 | mov x0, #0x0800 // Set/clear RES{1,0} bits |
| 593 | 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 | 606 | /* Coprocessor traps. */ |
| 598 | 607 | mov x0, #0x33ff |
| 599 | 608 | msr cptr_el2, x0 // Disable copro. traps to EL2 |
| 609 | +1: | |
| 600 | 610 | |
| 601 | 611 | #ifdef CONFIG_COMPAT |
| 602 | 612 | msr hstr_el2, xzr // Disable CP15 traps to EL2 |
| @@ -734,7 +744,8 @@ ENDPROC(__secondary_switched) · 131 unmodified lines | ||
| 734 | 744 | |
| 735 | 745 | .macro update_early_cpu_boot_status status, tmp1, tmp2 |
| 736 | 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 | 749 | dmb sy |
| 739 | 750 | dc ivac, \tmp1 // Invalidate potentially stale cache line |
| 740 | 751 | .endm |
| @@ -52,6 +52,7 @@ static void write_pen_release(u64 val) · 51 unmodified lines | ||
| 52 | 52 | static int smp_spin_table_cpu_init(unsigned int cpu) |
| 53 | 53 | { |
| 54 | 54 | struct device_node *dn; |
| 55 | + int ret; | |
| 55 | 56 | |
| 56 | 57 | dn = of_get_cpu_node(cpu, NULL); |
| 57 | 58 | if (!dn) |
| @@ -60,15 +61,15 @@ static int smp_spin_table_cpu_init(unsigned int cpu) · 2 unmodified lines | ||
| 60 | 61 | /* |
| 61 | 62 | * Determine the address from which the CPU is polling. |
| 62 | 63 | */ |
| 63 | − if (of_property_read_u64(dn, "cpu-release-addr", | |
| 64 | − &cpu_release_addr[cpu])) { | |
| 64 | + ret = of_property_read_u64(dn, "cpu-release-addr", | |
| 65 | + &cpu_release_addr[cpu]); | |
| 66 | + if (ret) | |
| 65 | 67 | pr_err("CPU %d: missing or invalid cpu-release-addr property\n", |
| 66 | 68 | cpu); |
| 67 | 69 | |
| 68 | − return -1; | |
| 69 | − } | |
| 70 | + of_node_put(dn); | |
| 70 | 71 | |
| 71 | − return 0; | |
| 72 | + return ret; | |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | static int smp_spin_table_cpu_prepare(unsigned int cpu) |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ |
| 32 | 32 | 0x00000040 |
| 33 | 33 | |
| 34 | +/* Reserved - do not use 0x00000004 */ | |
| 34 | 35 | #define PPC_FEATURE_TRUE_LE 0x00000002 |
| 35 | 36 | #define PPC_FEATURE_PPC_LE 0x00000001 |
| 36 | 37 | |
| @@ -148,23 +148,25 @@ static struct ibm_pa_feature { · 147 unmodified lines | ||
| 148 | 148 | unsigned long cpu_features; /* CPU_FTR_xxx bit */ |
| 149 | 149 | unsigned long mmu_features; /* MMU_FTR_xxx bit */ |
| 150 | 150 | unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */ |
| 151 | + unsigned int cpu_user_ftrs2; /* PPC_FEATURE2_xxx bit */ | |
| 151 | 152 | unsigned char pabyte; /* byte number in ibm,pa-features */ |
| 152 | 153 | unsigned char pabit; /* bit number (big-endian) */ |
| 153 | 154 | unsigned char invert; /* if 1, pa bit set => clear feature */ |
| 154 | 155 | } ibm_pa_features[] __initdata = { |
| 155 | − {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0}, | |
| 156 | − {0, 0, PPC_FEATURE_HAS_FPU, 0, 1, 0}, | |
| 157 | − {CPU_FTR_CTRL, 0, 0, 0, 3, 0}, | |
| 158 | − {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0}, | |
| 159 | − {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1}, | |
| 160 | − {0, MMU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, | |
| 161 | − {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, | |
| 156 | + {0, 0, PPC_FEATURE_HAS_MMU, 0, 0, 0, 0}, | |
| 157 | + {0, 0, PPC_FEATURE_HAS_FPU, 0, 0, 1, 0}, | |
| 158 | + {CPU_FTR_CTRL, 0, 0, 0, 0, 3, 0}, | |
| 159 | + {CPU_FTR_NOEXECUTE, 0, 0, 0, 0, 6, 0}, | |
| 160 | + {CPU_FTR_NODSISRALIGN, 0, 0, 0, 1, 1, 1}, | |
| 161 | + {0, MMU_FTR_CI_LARGE_PAGE, 0, 0, 1, 2, 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 | − * we don't want to turn on CPU_FTR_TM here, so we use CPU_FTR_TM_COMP | |
| 165 | − * which is 0 if the kernel doesn't support TM. | |
| 164 | + * If the kernel doesn't support TM (ie CONFIG_PPC_TRANSACTIONAL_MEM=n), | |
| 165 | + * we don't want to turn on TM here, so we use the *_COMP versions | |
| 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 | 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 | 197 | if (bit ^ fp->invert) { |
| 196 | 198 | cur_cpu_spec->cpu_features |= fp->cpu_features; |
| 197 | 199 | cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs; |
| 200 | + cur_cpu_spec->cpu_user_features2 |= fp->cpu_user_ftrs2; | |
| 198 | 201 | cur_cpu_spec->mmu_features |= fp->mmu_features; |
| 199 | 202 | } else { |
| 200 | 203 | cur_cpu_spec->cpu_features &= ~fp->cpu_features; |
| 201 | 204 | cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs; |
| 205 | + cur_cpu_spec->cpu_user_features2 &= ~fp->cpu_user_ftrs2; | |
| 202 | 206 | cur_cpu_spec->mmu_features &= ~fp->mmu_features; |
| 203 | 207 | } |
| 204 | 208 | } |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <asm/page.h> |
| 5 | 5 | #include <asm-generic/hugetlb.h> |
| 6 | 6 | |
| 7 | +#define hugepages_supported() cpu_has_pse | |
| 7 | 8 | |
| 8 | 9 | static inline int is_hugepage_only_range(struct mm_struct *mm, |
| 9 | 10 | unsigned long addr, |
| @@ -152,6 +152,11 @@ static struct clocksource hyperv_cs = { · 151 unmodified lines | ||
| 152 | 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 | 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 | 196 | machine_ops.crash_shutdown = hv_machine_crash_shutdown; |
| 192 | 197 | #endif |
| 193 | 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 | 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 | 43 | ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, |
| 44 | 44 | 32, clocksource_mmio_readl_up); |
| 45 | − if (!ret) { | |
| 45 | + if (ret) { | |
| 46 | 46 | pr_err("%s: registration failed\n", np->full_name); |
| 47 | 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 | 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 | 74 | static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len, |
| 67 | 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 | 1091 | sg_count = dma_map_sg(dev, areq->src, edesc->src_nents ?: 1, |
| 1084 | 1092 | (areq->src == areq->dst) ? DMA_BIDIRECTIONAL |
| 1085 | 1093 | : DMA_TO_DEVICE); |
| 1086 | − | |
| 1087 | 1094 | /* hmac data */ |
| 1088 | 1095 | desc->ptr[1].len = cpu_to_be16(areq->assoclen); |
| 1089 | 1096 | if (sg_count > 1 && |
| 1090 | 1097 | (ret = sg_to_link_tbl_offset(areq->src, sg_count, 0, |
| 1091 | 1098 | areq->assoclen, |
| 1092 | 1099 | &edesc->link_tbl[tbl_off])) > 1) { |
| 1093 | − tbl_off += ret; | |
| 1094 | − | |
| 1095 | 1100 | to_talitos_ptr(&desc->ptr[1], edesc->dma_link_tbl + tbl_off * |
| 1096 | 1101 | sizeof(struct talitos_ptr), 0); |
| 1097 | 1102 | desc->ptr[1].j_extent = DESC_PTR_LNKTBL_JUMP; |
| 1098 | 1103 | |
| 1099 | 1104 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
| 1100 | 1105 | edesc->dma_len, DMA_BIDIRECTIONAL); |
| 1106 | + | |
| 1107 | + tbl_off += ret; | |
| 1101 | 1108 | } else { |
| 1102 | 1109 | to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->src), 0); |
| 1103 | 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 | 1133 | if (edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) |
| 1127 | 1134 | sg_link_tbl_len += authsize; |
| 1128 | 1135 | |
| 1129 | − if (sg_count > 1 && | |
| 1130 | − (ret = sg_to_link_tbl_offset(areq->src, sg_count, areq->assoclen, | |
| 1131 | − sg_link_tbl_len, | |
| 1132 | − &edesc->link_tbl[tbl_off])) > 1) { | |
| 1133 | − tbl_off += ret; | |
| 1136 | + if (sg_count == 1) { | |
| 1137 | + to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->src) + | |
| 1138 | + areq->assoclen, 0); | |
| 1139 | + } else if ((ret = sg_to_link_tbl_offset(areq->src, sg_count, | |
| 1140 | + areq->assoclen, sg_link_tbl_len, | |
| 1141 | + &edesc->link_tbl[tbl_off])) > | |
| 1142 | + 1) { | |
| 1134 | 1143 | desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; |
| 1135 | 1144 | to_talitos_ptr(&desc->ptr[4], edesc->dma_link_tbl + |
| 1136 | 1145 | tbl_off * |
| @@ -1138,8 +1147,10 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, · 1 unmodified line | ||
| 1138 | 1147 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
| 1139 | 1148 | edesc->dma_len, |
| 1140 | 1149 | DMA_BIDIRECTIONAL); |
| 1141 | − } else | |
| 1142 | − to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->src), 0); | |
| 1150 | + tbl_off += ret; | |
| 1151 | + } else { | |
| 1152 | + copy_talitos_ptr(&desc->ptr[4], &edesc->link_tbl[tbl_off], 0); | |
| 1153 | + } | |
| 1143 | 1154 | |
| 1144 | 1155 | /* cipher out */ |
| 1145 | 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 | 1163 | edesc->icv_ool = false; |
| 1153 | 1164 | |
| 1154 | − if (sg_count > 1 && | |
| 1155 | − (sg_count = sg_to_link_tbl_offset(areq->dst, sg_count, | |
| 1165 | + if (sg_count == 1) { | |
| 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 | 1170 | areq->assoclen, cryptlen, |
| 1157 | − &edesc->link_tbl[tbl_off])) > | |
| 1158 | − 1) { | |
| 1171 | + &edesc->link_tbl[tbl_off])) > 1) { | |
| 1159 | 1172 | struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; |
| 1160 | 1173 | |
| 1161 | 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 | 1191 | edesc->dma_len, DMA_BIDIRECTIONAL); |
| 1179 | 1192 | |
| 1180 | 1193 | edesc->icv_ool = true; |
| 1181 | − } else | |
| 1182 | − to_talitos_ptr(&desc->ptr[5], sg_dma_address(areq->dst), 0); | |
| 1194 | + } else { | |
| 1195 | + copy_talitos_ptr(&desc->ptr[5], &edesc->link_tbl[tbl_off], 0); | |
| 1196 | + } | |
| 1183 | 1197 | |
| 1184 | 1198 | /* iv out */ |
| 1185 | 1199 | map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, |
| @@ -2629,21 +2643,11 @@ struct talitos_crypto_alg { · 1443 unmodified lines | ||
| 2629 | 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 | 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 | 2651 | /* update context with ptr to dev */ |
| 2648 | 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 | 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 | 2685 | static int talitos_cra_init_aead(struct crypto_aead *tfm) |
| 2665 | 2686 | { |
| 2666 | − talitos_cra_init(crypto_aead_tfm(tfm)); | |
| 2667 | − return 0; | |
| 2687 | + struct aead_alg *alg = crypto_aead_alg(tfm); | |
| 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 | 2697 | static int talitos_cra_init_ahash(struct crypto_tfm *tfm) |
| @@ -362,6 +362,7 @@ struct sbridge_pvt { · 361 unmodified lines | ||
| 362 | 362 | |
| 363 | 363 | /* Memory type detection */ |
| 364 | 364 | bool is_mirrored, is_lockstep, is_close_pg; |
| 365 | + bool is_chan_hash; | |
| 365 | 366 | |
| 366 | 367 | /* Fifo double buffers */ |
| 367 | 368 | struct mce mce_entry[MCE_LOG_LEN]; |
| @@ -1060,6 +1061,20 @@ static inline u8 sad_pkg_ha(u8 pkg) · 692 unmodified lines | ||
| 1060 | 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 | 1079 | Memory check routines |
| 1065 | 1080 | ****************************************************************************/ |
| @@ -1616,6 +1631,10 @@ static int get_dimm_config(struct mem_ctl_info *mci) · 550 unmodified lines | ||
| 1616 | 1631 | KNL_MAX_CHANNELS : NUM_CHANNELS; |
| 1617 | 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 | 1638 | if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL || |
| 1620 | 1639 | pvt->info.type == KNIGHTS_LANDING) |
| 1621 | 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 | 2139 | ch_way = TAD_CH(reg) + 1; |
| 2121 | − sck_way = 1 << TAD_SOCK(reg); | |
| 2140 | + sck_way = TAD_SOCK(reg); | |
| 2122 | 2141 | |
| 2123 | 2142 | if (ch_way == 3) |
| 2124 | 2143 | idx = addr >> 6; |
| 2125 | − else | |
| 2144 | + else { | |
| 2126 | 2145 | idx = (addr >> (6 + sck_way + shiftup)) & 0x3; |
| 2146 | + if (pvt->is_chan_hash) | |
| 2147 | + idx = haswell_chan_hash(idx, addr); | |
| 2148 | + } | |
| 2127 | 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 | 2179 | switch(ch_way) { |
| 2158 | 2180 | case 2: |
| 2159 | 2181 | case 4: |
| 2160 | − sck_xch = 1 << sck_way * (ch_way >> 1); | |
| 2182 | + sck_xch = (1 << sck_way) * (ch_way >> 1); | |
| 2161 | 2183 | break; |
| 2162 | 2184 | default: |
| 2163 | 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 | 2216 | ch_addr = addr - offset; |
| 2195 | 2217 | ch_addr >>= (6 + shiftup); |
| 2196 | − ch_addr /= ch_way * sck_way; | |
| 2218 | + ch_addr /= sck_xch; | |
| 2197 | 2219 | ch_addr <<= (6 + shiftup); |
| 2198 | 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 | 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 | 364 | #endif |
| 365 | 365 | #endif |
| 366 | 366 | |
| @@ -1591,6 +1591,7 @@ struct amdgpu_uvd { · 1590 unmodified lines | ||
| 1591 | 1591 | struct amdgpu_bo *vcpu_bo; |
| 1592 | 1592 | void *cpu_addr; |
| 1593 | 1593 | uint64_t gpu_addr; |
| 1594 | + unsigned fw_version; | |
| 1594 | 1595 | void *saved_bo; |
| 1595 | 1596 | atomic_t handles[AMDGPU_MAX_UVD_HANDLES]; |
| 1596 | 1597 | struct drm_file *filp[AMDGPU_MAX_UVD_HANDLES]; |
| @@ -425,6 +425,10 @@ static int acp_resume(void *handle) · 424 unmodified lines | ||
| 425 | 425 | struct acp_pm_domain *apd; |
| 426 | 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 | 432 | /* SMU block will power on ACP irrespective of ACP runtime status. |
| 429 | 433 | * Power off explicitly based on genpd ACP runtime status so that ACP |
| 430 | 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 | 303 | fw_info.feature = adev->vce.fb_version; |
| 304 | 304 | break; |
| 305 | 305 | case AMDGPU_INFO_FW_UVD: |
| 306 | − fw_info.ver = 0; | |
| 306 | + fw_info.ver = adev->uvd.fw_version; | |
| 307 | 307 | fw_info.feature = 0; |
| 308 | 308 | break; |
| 309 | 309 | case AMDGPU_INFO_FW_GMC: |
| @@ -53,7 +53,7 @@ struct amdgpu_hpd; · 52 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | #define AMDGPU_MAX_HPD_PINS 6 |
| 55 | 55 | #define AMDGPU_MAX_CRTCS 6 |
| 56 | −#define AMDGPU_MAX_AFMT_BLOCKS 7 | |
| 56 | +#define AMDGPU_MAX_AFMT_BLOCKS 9 | |
| 57 | 57 | |
| 58 | 58 | enum amdgpu_rmx_type { |
| 59 | 59 | RMX_OFF, |
| @@ -309,8 +309,8 @@ struct amdgpu_mode_info { · 249 unmodified lines | ||
| 309 | 309 | struct atom_context *atom_context; |
| 310 | 310 | struct card_info *atom_card_info; |
| 311 | 311 | bool mode_config_initialized; |
| 312 | − struct amdgpu_crtc *crtcs[6]; | |
| 313 | − struct amdgpu_afmt *afmt[7]; | |
| 312 | + struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS]; | |
| 313 | + struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS]; | |
| 314 | 314 | /* DVI-I properties */ |
| 315 | 315 | struct drm_property *coherent_mode_property; |
| 316 | 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 | 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 | 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 | 158 | DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n", |
| 159 | 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 | 164 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) |
| 162 | 165 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE; |
| 163 | 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 | 258 | if (i == AMDGPU_MAX_UVD_HANDLES) |
| 256 | 259 | return 0; |
| 257 | 260 | |
| 261 | + cancel_delayed_work_sync(&adev->uvd.idle_work); | |
| 262 | + | |
| 258 | 263 | size = amdgpu_bo_size(adev->uvd.vcpu_bo); |
| 259 | 264 | ptr = adev->uvd.cpu_addr; |
| 260 | 265 | |
| @@ -234,6 +234,7 @@ int amdgpu_vce_suspend(struct amdgpu_device *adev) · 233 unmodified lines | ||
| 234 | 234 | if (i == AMDGPU_MAX_VCE_HANDLES) |
| 235 | 235 | return 0; |
| 236 | 236 | |
| 237 | + cancel_delayed_work_sync(&adev->vce.idle_work); | |
| 237 | 238 | /* TODO: suspending running encoding sessions isn't supported */ |
| 238 | 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 | 1672 | u8 sinks[DRM_DP_MAX_SDP_STREAMS]; |
| 1673 | 1673 | int i; |
| 1674 | 1674 | |
| 1675 | + port = drm_dp_get_validated_port_ref(mgr, port); | |
| 1676 | + if (!port) | |
| 1677 | + return -EINVAL; | |
| 1678 | + | |
| 1675 | 1679 | port_num = port->port_num; |
| 1676 | 1680 | mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); |
| 1677 | 1681 | if (!mstb) { |
| 1678 | 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 | 1686 | return -EINVAL; |
| 1687 | + } | |
| 1682 | 1688 | } |
| 1683 | 1689 | |
| 1684 | 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 | 1713 | kfree(txmsg); |
| 1708 | 1714 | fail_put: |
| 1709 | 1715 | drm_dp_put_mst_branch_device(mstb); |
| 1716 | + drm_dp_put_port(port); | |
| 1710 | 1717 | return ret; |
| 1711 | 1718 | } |
| 1712 | 1719 | |
| @@ -2634,8 +2634,9 @@ struct drm_i915_cmd_table { · 2633 unmodified lines | ||
| 2634 | 2634 | |
| 2635 | 2635 | /* WaRsDisableCoarsePowerGating:skl,bxt */ |
| 2636 | 2636 | #define NEEDS_WaRsDisableCoarsePowerGating(dev) (IS_BXT_REVID(dev, 0, BXT_REVID_A1) || \ |
| 2637 | − ((IS_SKL_GT3(dev) || IS_SKL_GT4(dev)) && \ | |
| 2638 | − IS_SKL_REVID(dev, 0, SKL_REVID_F0))) | |
| 2637 | + IS_SKL_GT3(dev) || \ | |
| 2638 | + IS_SKL_GT4(dev)) | |
| 2639 | + | |
| 2639 | 2640 | /* |
| 2640 | 2641 | * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts |
| 2641 | 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 | 501 | if (pvec != NULL) { |
| 502 | 502 | struct mm_struct *mm = obj->userptr.mm->mm; |
| 503 | 503 | |
| 504 | − down_read(&mm->mmap_sem); | |
| 505 | − while (pinned < npages) { | |
| 506 | − ret = get_user_pages_remote(work->task, mm, | |
| 507 | − obj->userptr.ptr + pinned * PAGE_SIZE, | |
| 508 | − npages - pinned, | |
| 509 | − !obj->userptr.read_only, 0, | |
| 510 | − pvec + pinned, NULL); | |
| 511 | − if (ret < 0) | |
| 512 | − break; | |
| 513 | − | |
| 514 | − pinned += ret; | |
| 504 | + ret = -EFAULT; | |
| 505 | + if (atomic_inc_not_zero(&mm->mm_users)) { | |
| 506 | + down_read(&mm->mmap_sem); | |
| 507 | + while (pinned < npages) { | |
| 508 | + ret = get_user_pages_remote | |
| 509 | + (work->task, mm, | |
| 510 | + obj->userptr.ptr + pinned * PAGE_SIZE, | |
| 511 | + npages - pinned, | |
| 512 | + !obj->userptr.read_only, 0, | |
| 513 | + pvec + pinned, NULL); | |
| 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 | 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 | 841 | if (unlikely(total_bytes > remain_usable)) { |
| 842 | 842 | /* |
| 843 | 843 | * The base request will fit but the reserved space |
| 844 | − * falls off the end. So only need to to wait for the | |
| 845 | − * reserved size after flushing out the remainder. | |
| 844 | + * falls off the end. So don't need an immediate wrap | |
| 845 | + * and only need to effectively wait for the reserved | |
| 846 | + * size space from the start of ringbuffer. | |
| 846 | 847 | */ |
| 847 | 848 | wait_bytes = remain_actual + ringbuf->reserved_size; |
| 848 | − need_wrap = true; | |
| 849 | 849 | } else if (total_bytes > ringbuf->space) { |
| 850 | 850 | /* No wrapping required, just waiting. */ |
| 851 | 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 | 1913 | struct intel_ringbuffer *ringbuf = request->ringbuf; |
| 1914 | 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 | 1917 | if (ret) |
| 1918 | 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 | 1923 | /* w/a for post sync ops following a GPGPU operation we |
| 1921 | 1924 | * need a prior CS_STALL, which is emitted by the flush |
| 1922 | 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 | 1928 | intel_logical_ring_emit(ringbuf, |
| 1926 | 1929 | (PIPE_CONTROL_GLOBAL_GTT_IVB | |
| 1927 | 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 | 1932 | intel_logical_ring_emit(ringbuf, hws_seqno_address(request->ring)); |
| 1930 | 1933 | intel_logical_ring_emit(ringbuf, 0); |
| 1931 | 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 | 1937 | intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT); |
| 1938 | + intel_logical_ring_emit(ringbuf, MI_NOOP); | |
| 1933 | 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 | 2876 | const struct drm_plane_state *pstate, |
| 2877 | 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 | 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 | 2889 | /* for planar format */ |
| 2883 | 2890 | if (fb->pixel_format == DRM_FORMAT_NV12) { |
| 2884 | 2891 | if (y) /* y-plane data rate */ |
| 2885 | − return intel_crtc->config->pipe_src_w * | |
| 2886 | − intel_crtc->config->pipe_src_h * | |
| 2892 | + return width * height * | |
| 2887 | 2893 | drm_format_plane_cpp(fb->pixel_format, 0); |
| 2888 | 2894 | else /* uv-plane data rate */ |
| 2889 | − return (intel_crtc->config->pipe_src_w/2) * | |
| 2890 | − (intel_crtc->config->pipe_src_h/2) * | |
| 2895 | + return (width / 2) * (height / 2) * | |
| 2891 | 2896 | drm_format_plane_cpp(fb->pixel_format, 1); |
| 2892 | 2897 | } |
| 2893 | 2898 | |
| 2894 | 2899 | /* for packed formats */ |
| 2895 | − return intel_crtc->config->pipe_src_w * | |
| 2896 | − intel_crtc->config->pipe_src_h * | |
| 2897 | − drm_format_plane_cpp(fb->pixel_format, 0); | |
| 2900 | + return width * height * 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 | 2976 | struct drm_framebuffer *fb = plane->state->fb; |
| 2974 | 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 | 2980 | continue; |
| 2981 | + | |
| 2978 | 2982 | if (plane->type == DRM_PLANE_TYPE_CURSOR) |
| 2979 | 2983 | continue; |
| 2980 | 2984 | |
| @@ -3000,7 +3004,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate, · 19 unmodified lines | ||
| 3000 | 3004 | uint16_t plane_blocks, y_plane_blocks = 0; |
| 3001 | 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 | 3008 | continue; |
| 3005 | 3009 | if (plane->type == DRM_PLANE_TYPE_CURSOR) |
| 3006 | 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 | 3128 | struct drm_plane *plane = &intel_plane->base; |
| 3125 | 3129 | struct drm_framebuffer *fb = plane->state->fb; |
| 3130 | + struct intel_plane_state *intel_pstate = | |
| 3131 | + to_intel_plane_state(plane->state); | |
| 3126 | 3132 | uint32_t latency = dev_priv->wm.skl_latency[level]; |
| 3127 | 3133 | uint32_t method1, method2; |
| 3128 | 3134 | uint32_t plane_bytes_per_line, plane_blocks_per_line; |
| 3129 | 3135 | uint32_t res_blocks, res_lines; |
| 3130 | 3136 | uint32_t selected_result; |
| 3131 | 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 | 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 | 3149 | cpp = drm_format_plane_cpp(fb->pixel_format, 0); |
| 3137 | 3150 | method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate), |
| 3138 | 3151 | cpp, latency); |
| 3139 | 3152 | method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate), |
| 3140 | 3153 | cstate->base.adjusted_mode.crtc_htotal, |
| 3141 | − cstate->pipe_src_w, | |
| 3142 | − cpp, fb->modifier[0], | |
| 3154 | + width, | |
| 3155 | + cpp, | |
| 3156 | + fb->modifier[0], | |
| 3143 | 3157 | latency); |
| 3144 | 3158 | |
| 3145 | − plane_bytes_per_line = cstate->pipe_src_w * cpp; | |
| 3159 | + plane_bytes_per_line = width * cpp; | |
| 3146 | 3160 | plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512); |
| 3147 | 3161 | |
| 3148 | 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 | 969 | /* WaForceContextSaveRestoreNonCoherent:skl,bxt */ |
| 970 | 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 | 972 | IS_BXT_REVID(dev, BXT_REVID_B0, REVID_FOREVER)) |
| 973 | 973 | tmp |= HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE; |
| 974 | 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 | 1085 | WA_SET_BIT_MASKED(HIZ_CHICKEN, |
| 1086 | 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 | 1091 | *Use Force Non-Coherent whenever executing a 3D context. This |
| 1091 | 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 | 2092 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 2092 | 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 | 2096 | int ret; |
| 2094 | 2097 | |
| 2095 | 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 | 2100 | if (ret) |
| 2098 | 2101 | return ret; |
| 2099 | 2102 | |
| @@ -2109,7 +2112,8 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, · 9 unmodified lines | ||
| 2109 | 2112 | return -ENOMEM; |
| 2110 | 2113 | } |
| 2111 | 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 | 2117 | if (ret) |
| 2114 | 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 | 2458 | if (unlikely(total_bytes > remain_usable)) { |
| 2455 | 2459 | /* |
| 2456 | 2460 | * The base request will fit but the reserved space |
| 2457 | − * falls off the end. So only need to to wait for the | |
| 2458 | − * reserved size after flushing out the remainder. | |
| 2461 | + * falls off the end. So don't need an immediate wrap | |
| 2462 | + * and only need to effectively wait for the reserved | |
| 2463 | + * size space from the start of ringbuffer. | |
| 2459 | 2464 | */ |
| 2460 | 2465 | wait_bytes = remain_actual + ringbuf->reserved_size; |
| 2461 | − need_wrap = true; | |
| 2462 | 2466 | } else if (total_bytes > ringbuf->space) { |
| 2463 | 2467 | /* No wrapping required, just waiting. */ |
| 2464 | 2468 | wait_bytes = total_bytes; |
| @@ -1189,7 +1189,11 @@ static void intel_uncore_fw_domains_init(struct drm_device *dev) · 1188 unmodified lines | ||
| 1189 | 1189 | } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) { |
| 1190 | 1190 | dev_priv->uncore.funcs.force_wake_get = |
| 1191 | 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 | 1197 | fw_domain_init(dev_priv, FW_DOMAIN_ID_RENDER, |
| 1194 | 1198 | FORCEWAKE_MT, FORCEWAKE_ACK_HSW); |
| 1195 | 1199 | } else if (IS_IVYBRIDGE(dev)) { |
| @@ -1276,18 +1276,18 @@ nouveau_connector_create(struct drm_device *dev, int index) · 1275 unmodified lines | ||
| 1276 | 1276 | break; |
| 1277 | 1277 | default: |
| 1278 | 1278 | if (disp->dithering_mode) { |
| 1279 | + nv_connector->dithering_mode = DITHERING_MODE_AUTO; | |
| 1279 | 1280 | drm_object_attach_property(&connector->base, |
| 1280 | 1281 | disp->dithering_mode, |
| 1281 | 1282 | nv_connector-> |
| 1282 | 1283 | dithering_mode); |
| 1283 | − nv_connector->dithering_mode = DITHERING_MODE_AUTO; | |
| 1284 | 1284 | } |
| 1285 | 1285 | if (disp->dithering_depth) { |
| 1286 | + nv_connector->dithering_depth = DITHERING_DEPTH_AUTO; | |
| 1286 | 1287 | drm_object_attach_property(&connector->base, |
| 1287 | 1288 | disp->dithering_depth, |
| 1288 | 1289 | nv_connector-> |
| 1289 | 1290 | dithering_depth); |
| 1290 | − nv_connector->dithering_depth = DITHERING_DEPTH_AUTO; | |
| 1291 | 1291 | } |
| 1292 | 1292 | break; |
| 1293 | 1293 | } |
| @@ -1832,6 +1832,8 @@ gf100_gr_init(struct gf100_gr *gr) · 1831 unmodified lines | ||
| 1832 | 1832 | |
| 1833 | 1833 | gf100_gr_mmio(gr, gr->func->mmio); |
| 1834 | 1834 | |
| 1835 | + nvkm_mask(device, TPC_UNIT(0, 0, 0x05c), 0x00000001, 0x00000001); | |
| 1836 | + | |
| 1835 | 1837 | memcpy(tpcnr, gr->tpc_nr, sizeof(gr->tpc_nr)); |
| 1836 | 1838 | for (i = 0, gpc = -1; i < gr->tpc_total; i++) { |
| 1837 | 1839 | do { |
| @@ -62,10 +62,6 @@ bool radeon_has_atpx(void) { · 61 unmodified lines | ||
| 62 | 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 | 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 | 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 | 151 | if (atpx->functions.px_params) { |
| 149 | 152 | union acpi_object *info; |
| 150 | 153 | struct atpx_px_params output; |
| @@ -2002,10 +2002,12 @@ radeon_add_atom_connector(struct drm_device *dev, · 2001 unmodified lines | ||
| 2002 | 2002 | rdev->mode_info.dither_property, |
| 2003 | 2003 | RADEON_FMT_DITHER_DISABLE); |
| 2004 | 2004 | |
| 2005 | − if (radeon_audio != 0) | |
| 2005 | + if (radeon_audio != 0) { | |
| 2006 | 2006 | drm_object_attach_property(&radeon_connector->base.base, |
| 2007 | 2007 | rdev->mode_info.audio_property, |
| 2008 | 2008 | RADEON_AUDIO_AUTO); |
| 2009 | + radeon_connector->audio = RADEON_AUDIO_AUTO; | |
| 2010 | + } | |
| 2009 | 2011 | if (ASIC_IS_DCE5(rdev)) |
| 2010 | 2012 | drm_object_attach_property(&radeon_connector->base.base, |
| 2011 | 2013 | rdev->mode_info.output_csc_property, |
| @@ -2130,6 +2132,7 @@ radeon_add_atom_connector(struct drm_device *dev, · 118 unmodified lines | ||
| 2130 | 2132 | drm_object_attach_property(&radeon_connector->base.base, |
| 2131 | 2133 | rdev->mode_info.audio_property, |
| 2132 | 2134 | RADEON_AUDIO_AUTO); |
| 2135 | + radeon_connector->audio = RADEON_AUDIO_AUTO; | |
| 2133 | 2136 | } |
| 2134 | 2137 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
| 2135 | 2138 | radeon_connector->dac_load_detect = true; |
| @@ -2185,6 +2188,7 @@ radeon_add_atom_connector(struct drm_device *dev, · 49 unmodified lines | ||
| 2185 | 2188 | drm_object_attach_property(&radeon_connector->base.base, |
| 2186 | 2189 | rdev->mode_info.audio_property, |
| 2187 | 2190 | RADEON_AUDIO_AUTO); |
| 2191 | + radeon_connector->audio = RADEON_AUDIO_AUTO; | |
| 2188 | 2192 | } |
| 2189 | 2193 | if (ASIC_IS_DCE5(rdev)) |
| 2190 | 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 | 2241 | drm_object_attach_property(&radeon_connector->base.base, |
| 2238 | 2242 | rdev->mode_info.audio_property, |
| 2239 | 2243 | RADEON_AUDIO_AUTO); |
| 2244 | + radeon_connector->audio = RADEON_AUDIO_AUTO; | |
| 2240 | 2245 | } |
| 2241 | 2246 | if (ASIC_IS_DCE5(rdev)) |
| 2242 | 2247 | drm_object_attach_property(&radeon_connector->base.base, |
| @@ -103,12 +103,6 @@ static const char radeon_family_name[][16] = { · 102 unmodified lines | ||
| 103 | 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 | 106 | #define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) |
| 113 | 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 | 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", | |
| 1309 | − radeon_family_name[rdev->family], pdev->vendor, pdev->device, | |
| 1310 | − pdev->subsystem_vendor, pdev->subsystem_device); | |
| 1302 | + DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 0x%04X:0x%04X 0x%02X).\n", | |
| 1303 | + radeon_family_name[rdev->family], pdev->vendor, pdev->device, | |
| 1304 | + pdev->subsystem_vendor, pdev->subsystem_device, pdev->revision); | |
| 1311 | 1305 | |
| 1312 | 1306 | /* mutex initialization are all done here so we |
| 1313 | 1307 | * can recall function without having locking issues */ |
| @@ -1439,7 +1433,7 @@ int radeon_device_init(struct radeon_device *rdev, · 125 unmodified lines | ||
| 1439 | 1433 | * ignore it */ |
| 1440 | 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 | 1437 | runtime = true; |
| 1444 | 1438 | vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime); |
| 1445 | 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 | 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 | 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 | 2931 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 }, |
| 2932 | 2932 | { PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 }, |
| 2933 | 2933 | { PCI_VENDOR_ID_ATI, 0x6811, 0x148c, 0x2015, 0, 120000 }, |
| 2934 | + { PCI_VENDOR_ID_ATI, 0x6810, 0x1682, 0x9275, 0, 120000 }, | |
| 2934 | 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 | 671 | struct mlx5_ib_dev *dev = to_mdev(ibdev); |
| 672 | 672 | struct mlx5_core_dev *mdev = dev->mdev; |
| 673 | 673 | struct mlx5_hca_vport_context *rep; |
| 674 | − int max_mtu; | |
| 675 | − int oper_mtu; | |
| 674 | + u16 max_mtu; | |
| 675 | + u16 oper_mtu; | |
| 676 | 676 | int err; |
| 677 | 677 | u8 ib_link_width_oper; |
| 678 | 678 | u8 vl_hw_cap; |
| @@ -153,6 +153,7 @@ static const struct xpad_device { · 152 unmodified lines | ||
| 153 | 153 | { 0x0738, 0x4728, "Mad Catz Street Fighter IV FightPad", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 154 | 154 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 155 | 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 | 157 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
| 157 | 158 | { 0x0738, 0xb726, "Mad Catz Xbox controller - MW2", 0, XTYPE_XBOX360 }, |
| 158 | 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 | 305 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ |
| 305 | 306 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ |
| 306 | 307 | { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ |
| 308 | + XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ | |
| 307 | 309 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ |
| 308 | 310 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 309 | 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 | 178 | input_set_drvdata(haptics->input_dev, haptics); |
| 179 | 179 | |
| 180 | 180 | haptics->input_dev->name = "arizona:haptics"; |
| 181 | − haptics->input_dev->dev.parent = pdev->dev.parent; | |
| 182 | 181 | haptics->input_dev->close = arizona_haptics_close; |
| 183 | 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 | 353 | if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) |
| 354 | 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 | 358 | dev_err(&pdev->dev, "invalid power key trigger delay\n"); |
| 358 | 359 | return -EINVAL; |
| 359 | 360 | } |
| @@ -385,8 +386,8 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) · 25 unmodified lines | ||
| 385 | 386 | pwr->name = "pmic8xxx_pwrkey"; |
| 386 | 387 | pwr->phys = "pmic8xxx_pwrkey/input0"; |
| 387 | 388 | |
| 388 | − delay = (kpd_delay << 10) / USEC_PER_SEC; | |
| 389 | − delay = 1 + ilog2(delay); | |
| 389 | + delay = (kpd_delay << 6) / USEC_PER_SEC; | |
| 390 | + delay = ilog2(delay); | |
| 390 | 391 | |
| 391 | 392 | err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); |
| 392 | 393 | if (err < 0) { |
| @@ -222,7 +222,6 @@ static int twl4030_vibra_probe(struct platform_device *pdev) · 221 unmodified lines | ||
| 222 | 222 | |
| 223 | 223 | info->input_dev->name = "twl4030:vibrator"; |
| 224 | 224 | info->input_dev->id.version = 1; |
| 225 | − info->input_dev->dev.parent = pdev->dev.parent; | |
| 226 | 225 | info->input_dev->close = twl4030_vibra_close; |
| 227 | 226 | __set_bit(FF_RUMBLE, info->input_dev->ffbit); |
| 228 | 227 | |
| @@ -45,7 +45,6 @@ · 44 unmodified lines | ||
| 45 | 45 | struct vibra_info { |
| 46 | 46 | struct device *dev; |
| 47 | 47 | struct input_dev *input_dev; |
| 48 | − struct workqueue_struct *workqueue; | |
| 49 | 48 | struct work_struct play_work; |
| 50 | 49 | struct mutex mutex; |
| 51 | 50 | int irq; |
| @@ -213,11 +212,7 @@ static int vibra_play(struct input_dev *input, void *data, · 161 unmodified lines | ||
| 213 | 212 | info->strong_speed = effect->u.rumble.strong_magnitude; |
| 214 | 213 | info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; |
| 215 | 214 | |
| 216 | − ret = queue_work(info->workqueue, &info->play_work); | |
| 217 | − if (!ret) { | |
| 218 | − dev_info(&input->dev, "work is already on queue\n"); | |
| 219 | − return ret; | |
| 220 | − } | |
| 215 | + schedule_work(&info->play_work); | |
| 221 | 216 | |
| 222 | 217 | return 0; |
| 223 | 218 | } |
| @@ -362,7 +357,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev) · 138 unmodified lines | ||
| 362 | 357 | |
| 363 | 358 | info->input_dev->name = "twl6040:vibrator"; |
| 364 | 359 | info->input_dev->id.version = 1; |
| 365 | − info->input_dev->dev.parent = pdev->dev.parent; | |
| 366 | 360 | info->input_dev->close = twl6040_vibra_close; |
| 367 | 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 | 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 | 870 | * The endpoint is always altsetting 0, we know this since we know |
| 863 | 871 | * this device only has one interrupt endpoint |
| @@ -879,7 +887,7 @@ static int gtco_probe(struct usb_interface *usbinterface, · 15 unmodified lines | ||
| 879 | 887 | * HID report descriptor |
| 880 | 888 | */ |
| 881 | 889 | if (usb_get_extra_descriptor(usbinterface->cur_altsetting, |
| 882 | − HID_DEVICE_TYPE, &hid_desc) != 0){ | |
| 890 | + HID_DEVICE_TYPE, &hid_desc) != 0) { | |
| 883 | 891 | dev_err(&usbinterface->dev, |
| 884 | 892 | "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); |
| 885 | 893 | error = -EIO; |
| @@ -92,6 +92,7 @@ struct iommu_dev_data { · 91 unmodified lines | ||
| 92 | 92 | struct list_head dev_data_list; /* For global dev_data_list */ |
| 93 | 93 | struct protection_domain *domain; /* Domain the device is bound to */ |
| 94 | 94 | u16 devid; /* PCI Device ID */ |
| 95 | + u16 alias; /* Alias Device ID */ | |
| 95 | 96 | bool iommu_v2; /* Device can make use of IOMMUv2 */ |
| 96 | 97 | bool passthrough; /* Device is identity mapped */ |
| 97 | 98 | struct { |
| @@ -166,6 +167,13 @@ static struct protection_domain *to_pdomain(struct iommu_domain *dom) · 68 unmodified lines | ||
| 166 | 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 | 177 | static struct iommu_dev_data *alloc_dev_data(u16 devid) |
| 170 | 178 | { |
| 171 | 179 | struct iommu_dev_data *dev_data; |
| @@ -203,6 +211,68 @@ out_unlock: · 31 unmodified lines | ||
| 203 | 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 | 276 | static struct iommu_dev_data *find_dev_data(u16 devid) |
| 207 | 277 | { |
| 208 | 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 | 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 | 288 | static struct iommu_dev_data *get_dev_data(struct device *dev) |
| 226 | 289 | { |
| 227 | 290 | return dev->archdata.iommu; |
| @@ -349,6 +412,8 @@ static int iommu_init_device(struct device *dev) · 121 unmodified lines | ||
| 349 | 412 | if (!dev_data) |
| 350 | 413 | return -ENOMEM; |
| 351 | 414 | |
| 415 | + dev_data->alias = get_alias(dev); | |
| 416 | + | |
| 352 | 417 | if (pci_iommuv2_capable(pdev)) { |
| 353 | 418 | struct amd_iommu *iommu; |
| 354 | 419 | |
| @@ -369,7 +434,7 @@ static void iommu_ignore_device(struct device *dev) · 14 unmodified lines | ||
| 369 | 434 | u16 devid, alias; |
| 370 | 435 | |
| 371 | 436 | devid = get_device_id(dev); |
| 372 | − alias = amd_iommu_alias_table[devid]; | |
| 437 | + alias = get_alias(dev); | |
| 373 | 438 | |
| 374 | 439 | memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); |
| 375 | 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 | 1126 | int ret; |
| 1062 | 1127 | |
| 1063 | 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 | 1131 | ret = iommu_flush_dte(iommu, dev_data->devid); |
| 1067 | 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 | 2104 | bool ats; |
| 2040 | 2105 | |
| 2041 | 2106 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 2042 | − alias = amd_iommu_alias_table[dev_data->devid]; | |
| 2107 | + alias = dev_data->alias; | |
| 2043 | 2108 | ats = dev_data->ats.enabled; |
| 2044 | 2109 | |
| 2045 | 2110 | /* Update data structures */ |
| @@ -2073,7 +2138,7 @@ static void do_detach(struct iommu_dev_data *dev_data) · 27 unmodified lines | ||
| 2073 | 2138 | return; |
| 2074 | 2139 | |
| 2075 | 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 | 2143 | /* decrease reference counters */ |
| 2079 | 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 | 826 | if (smmu_domain->smmu) |
| 827 | 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 | 836 | * Mapping the requested stage onto what we support is surprisingly |
| 831 | 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 | 954 | void __iomem *cb_base; |
| 949 | 955 | int irq; |
| 950 | 956 | |
| 951 | − if (!smmu) | |
| 957 | + if (!smmu || domain->type == IOMMU_DOMAIN_DMA) | |
| 952 | 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 | 1095 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
| 1090 | 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 | 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 | 1104 | if (smmu_domain->domain.type == IOMMU_DOMAIN_DMA) |
| 1102 | 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 | 1112 | for (i = 0; i < cfg->num_streamids; ++i) { |
| 1105 | 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 | 467 | gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp))); |
| 468 | 468 | |
| 469 | 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 | 471 | clear_bit(irq, pcpu_masks[i].pcpu_mask); |
| 472 | 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 | 707 | spin_lock_irqsave(&gic_lock, flags); |
| 708 | 708 | gic_map_to_pin(intr, gic_cpu_pin); |
| 709 | 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 | 711 | clear_bit(intr, pcpu_masks[i].pcpu_mask); |
| 712 | 712 | set_bit(intr, pcpu_masks[vpe].pcpu_mask); |
| 713 | 713 | spin_unlock_irqrestore(&gic_lock, flags); |
| @@ -62,9 +62,8 @@ config DUMMY · 61 unmodified lines | ||
| 62 | 62 | this device is consigned into oblivion) with a configurable IP |
| 63 | 63 | address. It is most commonly used in order to make your currently |
| 64 | 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 | |
| 66 | − thing often comes in handy, the default is Y. It won't enlarge your | |
| 67 | − kernel either. What a deal. Read about it in the Network | |
| 65 | + If you use SLIP or PPP, you might want to say Y here. It won't | |
| 66 | + enlarge your kernel. What a deal. Read about it in the Network | |
| 68 | 67 | Administrator's Guide, available from |
| 69 | 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 | 405 | u32 packets = 0; |
| 406 | 406 | u32 bytes = 0; |
| 407 | 407 | int factor = priv->cqe_factor; |
| 408 | − u64 timestamp = 0; | |
| 409 | 408 | int done = 0; |
| 410 | 409 | int budget = priv->tx_work_limit; |
| 411 | 410 | u32 last_nr_txbb; |
| @@ -445,9 +444,12 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev, · 33 unmodified lines | ||
| 445 | 444 | new_index = be16_to_cpu(cqe->wqe_index) & size_mask; |
| 446 | 445 | |
| 447 | 446 | do { |
| 447 | + u64 timestamp = 0; | |
| 448 | + | |
| 448 | 449 | txbbs_skipped += last_nr_txbb; |
| 449 | 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 | 453 | timestamp = mlx4_en_get_cqe_ts(cqe); |
| 452 | 454 | |
| 453 | 455 | /* free next descriptor */ |
| @@ -510,7 +510,7 @@ enum mlx5e_link_mode { · 509 unmodified lines | ||
| 510 | 510 | MLX5E_100GBASE_KR4 = 22, |
| 511 | 511 | MLX5E_100GBASE_LR4 = 23, |
| 512 | 512 | MLX5E_100BASE_TX = 24, |
| 513 | − MLX5E_100BASE_T = 25, | |
| 513 | + MLX5E_1000BASE_T = 25, | |
| 514 | 514 | MLX5E_10GBASE_T = 26, |
| 515 | 515 | MLX5E_25GBASE_CR = 27, |
| 516 | 516 | MLX5E_25GBASE_KR = 28, |
| @@ -138,10 +138,10 @@ static const struct { · 137 unmodified lines | ||
| 138 | 138 | [MLX5E_100BASE_TX] = { |
| 139 | 139 | .speed = 100, |
| 140 | 140 | }, |
| 141 | − [MLX5E_100BASE_T] = { | |
| 142 | − .supported = SUPPORTED_100baseT_Full, | |
| 143 | − .advertised = ADVERTISED_100baseT_Full, | |
| 144 | − .speed = 100, | |
| 141 | + [MLX5E_1000BASE_T] = { | |
| 142 | + .supported = SUPPORTED_1000baseT_Full, | |
| 143 | + .advertised = ADVERTISED_1000baseT_Full, | |
| 144 | + .speed = 1000, | |
| 145 | 145 | }, |
| 146 | 146 | [MLX5E_10GBASE_T] = { |
| 147 | 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 | 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 | 1547 | struct mlx5_core_dev *mdev = priv->mdev; |
| 1549 | − int hw_mtu; | |
| 1548 | + u16 hw_mtu = MLX5E_SW2HW_MTU(mtu); | |
| 1550 | 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 | 1552 | if (err) |
| 1554 | 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) | |
| 1559 | − netdev_warn(netdev, "%s: Port MTU %d is different than netdev mtu %d\n", | |
| 1560 | − __func__, MLX5E_HW2SW_MTU(hw_mtu), netdev->mtu); | |
| 1560 | +static void mlx5e_query_mtu(struct mlx5e_priv *priv, u16 *mtu) | |
| 1561 | +{ | |
| 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 | 1589 | return 0; |
| 1564 | 1590 | } |
| 1565 | 1591 | |
| @@ -2257,22 +2283,27 @@ static int mlx5e_set_features(struct net_device *netdev, · 691 unmodified lines | ||
| 2257 | 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 | 2289 | static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) |
| 2261 | 2290 | { |
| 2262 | 2291 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 2263 | 2292 | struct mlx5_core_dev *mdev = priv->mdev; |
| 2264 | 2293 | bool was_opened; |
| 2265 | − int max_mtu; | |
| 2294 | + u16 max_mtu; | |
| 2295 | + u16 min_mtu; | |
| 2266 | 2296 | int err = 0; |
| 2267 | 2297 | |
| 2268 | 2298 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); |
| 2269 | 2299 | |
| 2270 | 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 | 2304 | netdev_err(netdev, |
| 2274 | − "%s: Bad MTU (%d) > (%d) Max\n", | |
| 2275 | − __func__, new_mtu, max_mtu); | |
| 2305 | + "%s: Bad MTU (%d), valid range is: [%d..%d]\n", | |
| 2306 | + __func__, new_mtu, min_mtu, max_mtu); | |
| 2276 | 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 | 2997 | schedule_work(&priv->set_rx_mode_work); |
| 2967 | 2998 | mlx5e_disable_async_events(priv); |
| 2968 | 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 | 3010 | mlx5e_tc_cleanup(priv); |
| 2971 | 3011 | mlx5e_vxlan_cleanup(priv); |
| 2972 | 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 | 3021 | mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); |
| 2982 | 3022 | mlx5_core_dealloc_pd(priv->mdev, priv->pdn); |
| 2983 | 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 | 3029 | static void *mlx5e_get_netdev(void *vpriv) |
| @@ -1065,33 +1065,6 @@ unlock_fg: · 1064 unmodified lines | ||
| 1065 | 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 | 1068 | static struct mlx5_flow_rule * |
| 1096 | 1069 | _mlx5_add_flow_rule(struct mlx5_flow_table *ft, |
| 1097 | 1070 | u8 match_criteria_enable, |
| @@ -1119,8 +1092,23 @@ _mlx5_add_flow_rule(struct mlx5_flow_table *ft, · 21 unmodified lines | ||
| 1119 | 1092 | goto unlock; |
| 1120 | 1093 | } |
| 1121 | 1094 | |
| 1122 | − rule = add_rule_to_auto_fg(ft, match_criteria_enable, match_criteria, | |
| 1123 | − match_value, action, flow_tag, dest); | |
| 1095 | + g = create_autogroup(ft, match_criteria_enable, match_criteria); | |
| 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 | 1112 | unlock: |
| 1125 | 1113 | unlock_ref_node(&ft->node); |
| 1126 | 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 | 1277 | struct mlx5_flow_root_namespace *root_ns = dev->priv.root_ns; |
| 1290 | 1278 | int prio; |
| 1291 | − static struct fs_prio *fs_prio; | |
| 1279 | + struct fs_prio *fs_prio; | |
| 1292 | 1280 | struct mlx5_flow_namespace *ns; |
| 1293 | 1281 | |
| 1294 | 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 | 966 | int err; |
| 967 | 967 | |
| 968 | 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 | 970 | dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", |
| 971 | 971 | __func__); |
| 972 | 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 | 1133 | if (err) |
| 1134 | 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 | 1138 | out: |
| 1138 | 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 | 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 | 1212 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", |
| 1212 | 1213 | __func__); |
| 1213 | 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 | 1242 | mlx5_cmd_cleanup(dev); |
| 1242 | 1243 | |
| 1243 | 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 | 1247 | mutex_unlock(&dev->intf_state_mutex); |
| 1246 | 1248 | return err; |
| 1247 | 1249 | } |
| @@ -1452,6 +1454,18 @@ static const struct pci_error_handlers mlx5_err_handler = { · 204 unmodified lines | ||
| 1452 | 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 | 1469 | static const struct pci_device_id mlx5_core_pci_table[] = { |
| 1456 | 1470 | { PCI_VDEVICE(MELLANOX, 0x1011) }, /* Connect-IB */ |
| 1457 | 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 | 1473 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ |
| 1460 | 1474 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ |
| 1461 | 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 | 1478 | { 0, } |
| 1463 | 1479 | }; |
| 1464 | 1480 | |
| @@ -1469,6 +1485,7 @@ static struct pci_driver mlx5_core_driver = { · 4 unmodified lines | ||
| 1469 | 1485 | .id_table = mlx5_core_pci_table, |
| 1470 | 1486 | .probe = init_one, |
| 1471 | 1487 | .remove = remove_one, |
| 1488 | + .shutdown = shutdown, | |
| 1472 | 1489 | .err_handler = &mlx5_err_handler, |
| 1473 | 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 | 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, | |
| 264 | − int *max_mtu, int *oper_mtu, u8 port) | |
| 263 | +static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, u16 *admin_mtu, | |
| 264 | + u16 *max_mtu, u16 *oper_mtu, u8 port) | |
| 265 | 265 | { |
| 266 | 266 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
| 267 | 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 | 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 | 286 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
| 287 | 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 | 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 | 300 | u8 port) |
| 301 | 301 | { |
| 302 | 302 | mlx5_query_port_mtu(dev, NULL, max_mtu, NULL, port); |
| 303 | 303 | } |
| 304 | 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 | 307 | u8 port) |
| 308 | 308 | { |
| 309 | 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 | 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 | 239 | int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, |
| 200 | 240 | u32 vport, |
| 201 | 241 | enum mlx5_list_type list_type, |
| @@ -37,8 +37,8 @@ · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | #define _QLCNIC_LINUX_MAJOR 5 |
| 39 | 39 | #define _QLCNIC_LINUX_MINOR 3 |
| 40 | −#define _QLCNIC_LINUX_SUBVERSION 63 | |
| 41 | −#define QLCNIC_LINUX_VERSIONID "5.3.63" | |
| 40 | +#define _QLCNIC_LINUX_SUBVERSION 64 | |
| 41 | +#define QLCNIC_LINUX_VERSIONID "5.3.64" | |
| 42 | 42 | #define QLCNIC_DRV_IDC_VER 0x01 |
| 43 | 43 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ |
| 44 | 44 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) |
| @@ -49,7 +49,6 @@ struct socfpga_dwmac { · 48 unmodified lines | ||
| 49 | 49 | u32 reg_shift; |
| 50 | 50 | struct device *dev; |
| 51 | 51 | struct regmap *sys_mgr_base_addr; |
| 52 | − struct reset_control *stmmac_rst; | |
| 53 | 52 | void __iomem *splitter_base; |
| 54 | 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 | 91 | struct device_node *np_splitter; |
| 93 | 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 | 94 | dwmac->interface = of_get_phy_mode(np); |
| 105 | 95 | |
| 106 | 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 | 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 | 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 | 190 | struct net_device *ndev = platform_get_drvdata(pdev); |
| 212 | 191 | struct stmmac_priv *stpriv = NULL; |
| 213 | 192 | int ret = 0; |
| 214 | 193 | |
| 215 | − if (ndev) | |
| 216 | − stpriv = netdev_priv(ndev); | |
| 194 | + if (!ndev) | |
| 195 | + return -EINVAL; | |
| 196 | + | |
| 197 | + stpriv = netdev_priv(ndev); | |
| 198 | + if (!stpriv) | |
| 199 | + return -EINVAL; | |
| 217 | 200 | |
| 218 | 201 | /* Assert reset to the enet controller before changing the phy mode */ |
| 219 | − if (dwmac->stmmac_rst) | |
| 220 | − reset_control_assert(dwmac->stmmac_rst); | |
| 202 | + if (stpriv->stmmac_rst) | |
| 203 | + reset_control_assert(stpriv->stmmac_rst); | |
| 221 | 204 | |
| 222 | 205 | /* Setup the phy mode in the system manager registers according to |
| 223 | 206 | * devicetree configuration |
| @@ -227,8 +210,8 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv) · 3 unmodified lines | ||
| 227 | 210 | /* Deassert reset for the phy configuration to be sampled by |
| 228 | 211 | * the enet controller, and operation to start in requested mode |
| 229 | 212 | */ |
| 230 | − if (dwmac->stmmac_rst) | |
| 231 | − reset_control_deassert(dwmac->stmmac_rst); | |
| 213 | + if (stpriv->stmmac_rst) | |
| 214 | + reset_control_deassert(stpriv->stmmac_rst); | |
| 232 | 215 | |
| 233 | 216 | /* Before the enet controller is suspended, the phy is suspended. |
| 234 | 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 | 228 | * control register 0, and can be modified by the phy driver |
| 246 | 229 | * framework. |
| 247 | 230 | */ |
| 248 | − if (stpriv && stpriv->phydev) | |
| 231 | + if (stpriv->phydev) | |
| 249 | 232 | phy_resume(stpriv->phydev); |
| 250 | 233 | |
| 251 | 234 | return ret; |
| @@ -279,14 +262,13 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) · 27 unmodified lines | ||
| 279 | 262 | |
| 280 | 263 | plat_dat->bsp_priv = dwmac; |
| 281 | 264 | plat_dat->init = socfpga_dwmac_init; |
| 282 | − plat_dat->exit = socfpga_dwmac_exit; | |
| 283 | 265 | plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed; |
| 284 | 266 | |
| 285 | − ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv); | |
| 286 | − if (ret) | |
| 287 | − return ret; | |
| 267 | + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | |
| 268 | + if (!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 | 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 | 880 | macsec_skb_cb(skb)->valid = false; |
| 881 | 881 | skb = skb_share_check(skb, GFP_ATOMIC); |
| 882 | 882 | if (!skb) |
| 883 | − return NULL; | |
| 883 | + return ERR_PTR(-ENOMEM); | |
| 884 | 884 | |
| 885 | 885 | req = aead_request_alloc(rx_sa->key.tfm, GFP_ATOMIC); |
| 886 | 886 | if (!req) { |
| 887 | 887 | kfree_skb(skb); |
| 888 | − return NULL; | |
| 888 | + return ERR_PTR(-ENOMEM); | |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 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 | 905 | skb = skb_unshare(skb, GFP_ATOMIC); |
| 906 | 906 | if (!skb) { |
| 907 | 907 | aead_request_free(req); |
| 908 | − return NULL; | |
| 908 | + return ERR_PTR(-ENOMEM); | |
| 909 | 909 | } |
| 910 | 910 | } else { |
| 911 | 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 | 921 | dev_hold(dev); |
| 922 | 922 | ret = crypto_aead_decrypt(req); |
| 923 | 923 | if (ret == -EINPROGRESS) { |
| 924 | − return NULL; | |
| 924 | + return ERR_PTR(ret); | |
| 925 | 925 | } else if (ret != 0) { |
| 926 | 926 | /* decryption/authentication failed |
| 927 | 927 | * 10.6 if validateFrames is disabled, deliver anyway |
| 928 | 928 | */ |
| 929 | 929 | if (ret != -EBADMSG) { |
| 930 | 930 | kfree_skb(skb); |
| 931 | − skb = NULL; | |
| 931 | + skb = ERR_PTR(ret); | |
| 932 | 932 | } |
| 933 | 933 | } else { |
| 934 | 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 | 1146 | secy->validate_frames != MACSEC_VALIDATE_DISABLED) |
| 1147 | 1147 | skb = macsec_decrypt(skb, dev, rx_sa, sci, secy); |
| 1148 | 1148 | |
| 1149 | − if (!skb) { | |
| 1150 | − macsec_rxsa_put(rx_sa); | |
| 1149 | + if (IS_ERR(skb)) { | |
| 1150 | + /* the decrypt callback needs the reference */ | |
| 1151 | + if (PTR_ERR(skb) != -EINPROGRESS) | |
| 1152 | + macsec_rxsa_put(rx_sa); | |
| 1151 | 1153 | rcu_read_unlock(); |
| 1152 | 1154 | *pskb = NULL; |
| 1153 | 1155 | return RX_HANDLER_CONSUMED; |
| @@ -1161,7 +1163,8 @@ deliver: · 7 unmodified lines | ||
| 1161 | 1163 | macsec_extra_len(macsec_skb_cb(skb)->has_sci)); |
| 1162 | 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 | 1168 | count_rx(dev, skb->len); |
| 1166 | 1169 | |
| 1167 | 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 | 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, | |
| 1627 | − secy->icv_len)) { | |
| 1629 | + if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), | |
| 1630 | + secy->key_len, secy->icv_len)) { | |
| 1631 | + kfree(rx_sa); | |
| 1628 | 1632 | rtnl_unlock(); |
| 1629 | 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 | 1773 | tx_sa = kmalloc(sizeof(*tx_sa), GFP_KERNEL); |
| 1770 | 1774 | if (!tx_sa || init_tx_sa(tx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), |
| 1771 | 1775 | secy->key_len, secy->icv_len)) { |
| 1776 | + kfree(tx_sa); | |
| 1772 | 1777 | rtnl_unlock(); |
| 1773 | 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 | 2279 | if (nla_put_sci(skb, MACSEC_SECY_ATTR_SCI, secy->sci, |
| 2275 | 2280 | MACSEC_SECY_ATTR_PAD) || |
| 2276 | 2281 | nla_put_u64_64bit(skb, MACSEC_SECY_ATTR_CIPHER_SUITE, |
| 2277 | − DEFAULT_CIPHER_ID, | |
| 2282 | + MACSEC_DEFAULT_CIPHER_ID, | |
| 2278 | 2283 | MACSEC_SECY_ATTR_PAD) || |
| 2279 | 2284 | nla_put_u8(skb, MACSEC_SECY_ATTR_ICV_LEN, secy->icv_len) || |
| 2280 | 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 | 2321 | if (!hdr) |
| 2317 | 2322 | return -EMSGSIZE; |
| 2318 | 2323 | |
| 2319 | − rtnl_lock(); | |
| 2324 | + genl_dump_check_consistent(cb, hdr, &macsec_fam); | |
| 2320 | 2325 | |
| 2321 | 2326 | if (nla_put_u32(skb, MACSEC_ATTR_IFINDEX, dev->ifindex)) |
| 2322 | 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 | 2488 | nla_nest_end(skb, rxsc_list); |
| 2484 | 2489 | |
| 2485 | − rtnl_unlock(); | |
| 2486 | − | |
| 2487 | 2490 | genlmsg_end(skb, hdr); |
| 2488 | 2491 | |
| 2489 | 2492 | return 0; |
| 2490 | 2493 | |
| 2491 | 2494 | nla_put_failure: |
| 2492 | − rtnl_unlock(); | |
| 2493 | 2495 | genlmsg_cancel(skb, hdr); |
| 2494 | 2496 | return -EMSGSIZE; |
| 2495 | 2497 | } |
| 2496 | 2498 | |
| 2499 | +static int macsec_generation = 1; /* protected by RTNL */ | |
| 2500 | + | |
| 2497 | 2501 | static int macsec_dump_txsc(struct sk_buff *skb, struct netlink_callback *cb) |
| 2498 | 2502 | { |
| 2499 | 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 | 2507 | dev_idx = cb->args[0]; |
| 2504 | 2508 | |
| 2505 | 2509 | d = 0; |
| 2510 | + rtnl_lock(); | |
| 2511 | + | |
| 2512 | + cb->seq = macsec_generation; | |
| 2513 | + | |
| 2506 | 2514 | for_each_netdev(net, dev) { |
| 2507 | 2515 | struct macsec_secy *secy; |
| 2508 | 2516 | |
| @@ -2520,6 +2528,7 @@ next: · 11 unmodified lines | ||
| 2520 | 2528 | } |
| 2521 | 2529 | |
| 2522 | 2530 | done: |
| 2531 | + rtnl_unlock(); | |
| 2523 | 2532 | cb->args[0] = d; |
| 2524 | 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 | 2982 | struct net_device *real_dev = macsec->real_dev; |
| 2974 | 2983 | struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev); |
| 2975 | 2984 | |
| 2985 | + macsec_generation++; | |
| 2986 | + | |
| 2976 | 2987 | unregister_netdevice_queue(dev, head); |
| 2977 | 2988 | list_del_rcu(&macsec->secys); |
| 2978 | − if (list_empty(&rxd->secys)) | |
| 2989 | + if (list_empty(&rxd->secys)) { | |
| 2979 | 2990 | netdev_rx_handler_unregister(real_dev); |
| 2991 | + kfree(rxd); | |
| 2992 | + } | |
| 2980 | 2993 | |
| 2981 | 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 | 3012 | err = netdev_rx_handler_register(real_dev, macsec_handle_frame, |
| 3000 | 3013 | rxd); |
| 3001 | − if (err < 0) | |
| 3014 | + if (err < 0) { | |
| 3015 | + kfree(rxd); | |
| 3002 | 3016 | return err; |
| 3017 | + } | |
| 3003 | 3018 | } |
| 3004 | 3019 | |
| 3005 | 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 | 3134 | if (err < 0) |
| 3120 | 3135 | goto del_dev; |
| 3121 | 3136 | |
| 3137 | + macsec_generation++; | |
| 3138 | + | |
| 3122 | 3139 | dev_hold(real_dev); |
| 3123 | 3140 | |
| 3124 | 3141 | return 0; |
| @@ -3132,7 +3149,7 @@ unregister: · 7 unmodified lines | ||
| 3132 | 3149 | |
| 3133 | 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 | 3153 | u8 icv_len = DEFAULT_ICV_LEN; |
| 3137 | 3154 | int flag; |
| 3138 | 3155 | bool es, scb, sci; |
| @@ -3147,8 +3164,8 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) · 8 unmodified lines | ||
| 3147 | 3164 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
| 3148 | 3165 | |
| 3149 | 3166 | switch (csid) { |
| 3150 | − case DEFAULT_CIPHER_ID: | |
| 3151 | − case DEFAULT_CIPHER_ALT: | |
| 3167 | + case MACSEC_DEFAULT_CIPHER_ID: | |
| 3168 | + case MACSEC_DEFAULT_CIPHER_ALT: | |
| 3152 | 3169 | if (icv_len < MACSEC_MIN_ICV_LEN || |
| 3153 | 3170 | icv_len > MACSEC_MAX_ICV_LEN) |
| 3154 | 3171 | return -EINVAL; |
| @@ -3182,8 +3199,8 @@ static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[]) · 27 unmodified lines | ||
| 3182 | 3199 | nla_get_u8(data[IFLA_MACSEC_VALIDATION]) > MACSEC_VALIDATE_MAX) |
| 3183 | 3200 | return -EINVAL; |
| 3184 | 3201 | |
| 3185 | − if ((data[IFLA_MACSEC_PROTECT] && | |
| 3186 | − nla_get_u8(data[IFLA_MACSEC_PROTECT])) && | |
| 3202 | + if ((data[IFLA_MACSEC_REPLAY_PROTECT] && | |
| 3203 | + nla_get_u8(data[IFLA_MACSEC_REPLAY_PROTECT])) && | |
| 3187 | 3204 | !data[IFLA_MACSEC_WINDOW]) |
| 3188 | 3205 | return -EINVAL; |
| 3189 | 3206 | |
| @@ -3223,7 +3240,7 @@ static int macsec_fill_info(struct sk_buff *skb, · 33 unmodified lines | ||
| 3223 | 3240 | IFLA_MACSEC_PAD) || |
| 3224 | 3241 | nla_put_u8(skb, IFLA_MACSEC_ICV_LEN, secy->icv_len) || |
| 3225 | 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 | 3244 | nla_put_u8(skb, IFLA_MACSEC_ENCODING_SA, tx_sc->encoding_sa) || |
| 3228 | 3245 | nla_put_u8(skb, IFLA_MACSEC_ENCRYPT, tx_sc->encrypt) || |
| 3229 | 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 | 737 | break; |
| 738 | 738 | case CPU_PM_EXIT: |
| 739 | 739 | case CPU_PM_ENTER_FAILED: |
| 740 | − /* Restore and enable the counter */ | |
| 741 | − armpmu_start(event, PERF_EF_RELOAD); | |
| 740 | + /* | |
| 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 | 753 | break; |
| 743 | 754 | default: |
| 744 | 755 | break; |
| @@ -86,6 +86,9 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) · 85 unmodified lines | ||
| 86 | 86 | if (!np) |
| 87 | 87 | return -ENODEV; |
| 88 | 88 | |
| 89 | + if (!dev->parent || !dev->parent->of_node) | |
| 90 | + return -ENODEV; | |
| 91 | + | |
| 89 | 92 | dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); |
| 90 | 93 | if (IS_ERR(dp)) |
| 91 | 94 | return -ENOMEM; |
| @@ -104,9 +107,9 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) · 12 unmodified lines | ||
| 104 | 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 | 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 | 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 | 176 | struct regmap *grf; |
| 177 | 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 | 183 | if (IS_ERR(grf)) { |
| 181 | 184 | dev_err(dev, "Missing rockchip,grf property\n"); |
| 182 | 185 | return PTR_ERR(grf); |
| @@ -2,6 +2,7 @@ config PINCTRL_IMX · 1 unmodified line | ||
| 2 | 2 | bool |
| 3 | 3 | select PINMUX |
| 4 | 4 | select PINCONF |
| 5 | + select REGMAP | |
| 5 | 6 | |
| 6 | 7 | config PINCTRL_IMX1_CORE |
| 7 | 8 | bool |
| @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, · 1003 unmodified lines | ||
| 1004 | 1004 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); |
| 1005 | 1005 | int eint_num, virq, eint_offset; |
| 1006 | 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 | 1009 | const struct mtk_desc_pin *pin; |
| 1009 | 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 | 1023 | if (!mtk_eint_can_en_debounce(pctl, eint_num)) |
| 1023 | 1024 | return -ENOSYS; |
| 1024 | 1025 | |
| 1025 | − dbnc = ARRAY_SIZE(dbnc_arr); | |
| 1026 | − for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) { | |
| 1027 | − if (debounce <= dbnc_arr[i]) { | |
| 1026 | + dbnc = ARRAY_SIZE(debounce_time); | |
| 1027 | + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) { | |
| 1028 | + if (debounce <= debounce_time[i]) { | |
| 1028 | 1029 | dbnc = i; |
| 1029 | 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 | 1281 | /* Parse pins in each row from LSB */ |
| 1282 | 1282 | while (mask) { |
| 1283 | − bit_pos = ffs(mask); | |
| 1283 | + bit_pos = __ffs(mask); | |
| 1284 | 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 | 1286 | val_pos = val & mask_pos; |
| 1287 | 1287 | submask = mask & mask_pos; |
| 1288 | 1288 | |
| @@ -1852,7 +1852,7 @@ static int pcs_probe(struct platform_device *pdev) · 563 unmodified lines | ||
| 1852 | 1852 | ret = of_property_read_u32(np, "pinctrl-single,function-mask", |
| 1853 | 1853 | &pcs->fmask); |
| 1854 | 1854 | if (!ret) { |
| 1855 | − pcs->fshift = ffs(pcs->fmask) - 1; | |
| 1855 | + pcs->fshift = __ffs(pcs->fmask); | |
| 1856 | 1856 | pcs->fmax = pcs->fmask >> pcs->fshift; |
| 1857 | 1857 | } else { |
| 1858 | 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 | 689 | struct flowi6 fl; |
| 690 | 690 | |
| 691 | + memset(&fl, 0, sizeof(fl)); | |
| 691 | 692 | if (saddr) |
| 692 | 693 | memcpy(&fl.saddr, saddr, sizeof(struct in6_addr)); |
| 693 | 694 | if (daddr) |
| @@ -491,13 +491,14 @@ static int scpsys_probe(struct platform_device *pdev) · 490 unmodified lines | ||
| 491 | 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 | |
| 495 | − * hardware usable. | |
| 494 | + * Initially turn on all domains to make the domains 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)) | |
| 498 | − genpd->power_on(genpd); | |
| 499 | + 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 | 376 | tristate "Temperature sensor driver for mediatek SoCs" |
| 377 | 377 | depends on ARCH_MEDIATEK || COMPILE_TEST |
| 378 | 378 | depends on HAS_IOMEM |
| 379 | + depends on NVMEM || NVMEM=n | |
| 380 | + depends on RESET_CONTROLLER | |
| 379 | 381 | default y |
| 380 | 382 | help |
| 381 | 383 | Enable this option if you want to have support for thermal management |
| @@ -27,7 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/thermal.h> |
| 28 | 28 | #include <linux/reset.h> |
| 29 | 29 | #include <linux/types.h> |
| 30 | −#include <linux/nvmem-consumer.h> | |
| 31 | 30 | |
| 32 | 31 | /* AUXADC Registers */ |
| 33 | 32 | #define AUXADC_CON0_V 0x000 |
| @@ -619,7 +618,7 @@ static struct platform_driver mtk_thermal_driver = { · 585 unmodified lines | ||
| 619 | 618 | |
| 620 | 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 | 622 | MODULE_AUTHOR("Hanyi Wu <hanyi.wu@mediatek.com>"); |
| 624 | 623 | MODULE_DESCRIPTION("Mediatek thermal driver"); |
| 625 | 624 | MODULE_LICENSE("GPL v2"); |
| @@ -803,8 +803,8 @@ static int thermal_of_populate_trip(struct device_node *np, · 802 unmodified lines | ||
| 803 | 803 | * otherwise, it returns a corresponding ERR_PTR(). Caller must |
| 804 | 804 | * check the return value with help of IS_ERR() helper. |
| 805 | 805 | */ |
| 806 | −static struct __thermal_zone * | |
| 807 | −thermal_of_build_thermal_zone(struct device_node *np) | |
| 806 | +static struct __thermal_zone | |
| 807 | +__init *thermal_of_build_thermal_zone(struct device_node *np) | |
| 808 | 808 | { |
| 809 | 809 | struct device_node *child = NULL, *gchild; |
| 810 | 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 | 301 | capped_extra_power = 0; |
| 302 | 302 | extra_power = 0; |
| 303 | 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 | 306 | granted_power[i] = DIV_ROUND_CLOSEST_ULL(req_range, |
| 307 | 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 | 689 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 690 | 690 | int trip, ret; |
| 691 | − unsigned long temperature; | |
| 691 | + int temperature; | |
| 692 | 692 | |
| 693 | 693 | if (!tz->ops->set_trip_temp) |
| 694 | 694 | return -EPERM; |
| @@ -696,7 +696,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr, · 1 unmodified line | ||
| 696 | 696 | if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip)) |
| 697 | 697 | return -EINVAL; |
| 698 | 698 | |
| 699 | − if (kstrtoul(buf, 10, &temperature)) | |
| 699 | + if (kstrtoint(buf, 10, &temperature)) | |
| 700 | 700 | return -EINVAL; |
| 701 | 701 | |
| 702 | 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 | 900 | struct thermal_zone_device *tz = to_thermal_zone(dev); |
| 901 | 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 | 905 | return -EINVAL; |
| 906 | 906 | |
| 907 | 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 | 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 | 631 | /* Master must be open via /dev/ptmx */ |
| 632 | 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 | 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 | 647 | struct tty_struct *tty; |
| 648 | 648 | |
| 649 | 649 | mutex_lock(&devpts_mutex); |
| 650 | − tty = devpts_get_priv(pts_inode); | |
| 650 | + tty = devpts_get_priv(file->f_path.dentry); | |
| 651 | 651 | mutex_unlock(&devpts_mutex); |
| 652 | 652 | /* Master must be open before slave */ |
| 653 | 653 | if (!tty) |
| @@ -722,7 +722,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) · 68 unmodified lines | ||
| 722 | 722 | { |
| 723 | 723 | struct pts_fs_info *fsi; |
| 724 | 724 | struct tty_struct *tty; |
| 725 | − struct inode *slave_inode; | |
| 725 | + struct dentry *dentry; | |
| 726 | 726 | int retval; |
| 727 | 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 | 770 | tty_add_file(tty, filp); |
| 771 | 771 | |
| 772 | − slave_inode = devpts_pty_new(fsi, | |
| 773 | − MKDEV(UNIX98_PTY_SLAVE_MAJOR, index), index, | |
| 774 | − tty->link); | |
| 775 | − if (IS_ERR(slave_inode)) { | |
| 776 | − retval = PTR_ERR(slave_inode); | |
| 772 | + dentry = devpts_pty_new(fsi, index, tty->link); | |
| 773 | + if (IS_ERR(dentry)) { | |
| 774 | + retval = PTR_ERR(dentry); | |
| 777 | 775 | goto err_release; |
| 778 | 776 | } |
| 779 | − tty->link->driver_data = slave_inode; | |
| 777 | + tty->link->driver_data = dentry; | |
| 780 | 778 | |
| 781 | 779 | retval = ptm_driver->ops->open(tty, filp); |
| 782 | 780 | if (retval) |
| @@ -1403,9 +1403,18 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p) · 1402 unmodified lines | ||
| 1403 | 1403 | /* |
| 1404 | 1404 | * Empty the RX FIFO, we are not interested in anything |
| 1405 | 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 | 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 | 1420 | static void serial8250_em485_handle_stop_tx(unsigned long arg) |
| @@ -324,7 +324,6 @@ config SERIAL_8250_EM · 323 unmodified lines | ||
| 324 | 324 | config SERIAL_8250_RT288X |
| 325 | 325 | bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support" |
| 326 | 326 | depends on SERIAL_8250 |
| 327 | − depends on MIPS || COMPILE_TEST | |
| 328 | 327 | default y if MIPS_ALCHEMY || SOC_RT288X || SOC_RT305X || SOC_RT3883 || SOC_MT7620 |
| 329 | 328 | help |
| 330 | 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 | 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 | 76 | .in = uartlite_inbe32, |
| 77 | 77 | .out = uartlite_outbe32, |
| 78 | 78 | }; |
| @@ -87,21 +87,21 @@ static void uartlite_outle32(u32 val, void __iomem *addr) · 8 unmodified lines | ||
| 87 | 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 | 91 | .in = uartlite_inle32, |
| 92 | 92 | .out = uartlite_outle32, |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 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 | 99 | return reg_ops->in(port->membase + offset); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 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 | 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 | 1367 | * Locking: tty_mutex must be held. If the tty is found, bump the tty kref. |
| 1368 | 1368 | */ |
| 1369 | 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 | 1372 | struct tty_struct *tty; |
| 1373 | 1373 | |
| 1374 | 1374 | if (driver->ops->lookup) |
| 1375 | − tty = driver->ops->lookup(driver, inode, idx); | |
| 1375 | + tty = driver->ops->lookup(driver, file, idx); | |
| 1376 | 1376 | else |
| 1377 | 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 | 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 | 2044 | if (IS_ERR(tty)) { |
| 2045 | 2045 | mutex_unlock(&tty_mutex); |
| 2046 | 2046 | goto out; |
| @@ -1150,6 +1150,11 @@ static int dwc3_suspend(struct device *dev) · 1149 unmodified lines | ||
| 1150 | 1150 | phy_exit(dwc->usb2_generic_phy); |
| 1151 | 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 | 1158 | pinctrl_pm_select_sleep_state(dev); |
| 1154 | 1159 | |
| 1155 | 1160 | return 0; |
| @@ -1163,11 +1168,21 @@ static int dwc3_resume(struct device *dev) · 7 unmodified lines | ||
| 1163 | 1168 | |
| 1164 | 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 | 1181 | usb_phy_init(dwc->usb3_phy); |
| 1167 | 1182 | usb_phy_init(dwc->usb2_phy); |
| 1168 | 1183 | ret = phy_init(dwc->usb2_generic_phy); |
| 1169 | 1184 | if (ret < 0) |
| 1170 | − return ret; | |
| 1185 | + goto err_usb3phy_power; | |
| 1171 | 1186 | |
| 1172 | 1187 | ret = phy_init(dwc->usb3_generic_phy); |
| 1173 | 1188 | if (ret < 0) |
| @@ -1200,6 +1215,12 @@ static int dwc3_resume(struct device *dev) · 26 unmodified lines | ||
| 1200 | 1215 | err_usb2phy_init: |
| 1201 | 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 | 1224 | return ret; |
| 1204 | 1225 | } |
| 1205 | 1226 | |
| @@ -645,7 +645,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc) · 644 unmodified lines | ||
| 645 | 645 | file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); |
| 646 | 646 | if (!file) { |
| 647 | 647 | ret = -ENOMEM; |
| 648 | − goto err1; | |
| 648 | + goto err2; | |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { |
| @@ -653,7 +653,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc) · 1 unmodified line | ||
| 653 | 653 | dwc, &dwc3_mode_fops); |
| 654 | 654 | if (!file) { |
| 655 | 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 | 663 | dwc, &dwc3_testmode_fops); |
| 664 | 664 | if (!file) { |
| 665 | 665 | ret = -ENOMEM; |
| 666 | − goto err1; | |
| 666 | + goto err2; | |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, |
| 670 | 670 | dwc, &dwc3_link_state_fops); |
| 671 | 671 | if (!file) { |
| 672 | 672 | ret = -ENOMEM; |
| 673 | − goto err1; | |
| 673 | + goto err2; | |
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | return 0; |
| 678 | 678 | |
| 679 | +err2: | |
| 680 | + kfree(dwc->regset); | |
| 681 | + | |
| 679 | 682 | err1: |
| 680 | 683 | debugfs_remove_recursive(root); |
| 681 | 684 | |
| @@ -686,5 +689,5 @@ err0: · 4 unmodified lines | ||
| 686 | 689 | void dwc3_debugfs_exit(struct dwc3 *dwc) |
| 687 | 690 | { |
| 688 | 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 | 496 | ret = pm_runtime_get_sync(dev); |
| 497 | 497 | if (ret < 0) { |
| 498 | 498 | dev_err(dev, "get_sync failed with err %d\n", ret); |
| 499 | − goto err0; | |
| 499 | + goto err1; | |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 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 | 517 | ret = dwc3_omap_extcon_register(omap); |
| 518 | 518 | if (ret < 0) |
| 519 | − goto err2; | |
| 519 | + goto err1; | |
| 520 | 520 | |
| 521 | 521 | ret = of_platform_populate(node, NULL, NULL, dev); |
| 522 | 522 | if (ret) { |
| 523 | 523 | dev_err(&pdev->dev, "failed to create dwc3 core\n"); |
| 524 | − goto err3; | |
| 524 | + goto err2; | |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | dwc3_omap_enable_irqs(omap); |
| 528 | 528 | |
| 529 | 529 | return 0; |
| 530 | 530 | |
| 531 | −err3: | |
| 531 | +err2: | |
| 532 | 532 | extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb); |
| 533 | 533 | extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb); |
| 534 | −err2: | |
| 535 | − dwc3_omap_disable_irqs(omap); | |
| 536 | 534 | |
| 537 | 535 | err1: |
| 538 | 536 | pm_runtime_put_sync(dev); |
| 539 | − | |
| 540 | −err0: | |
| 541 | 537 | pm_runtime_disable(dev); |
| 542 | 538 | |
| 543 | 539 | return ret; |
| @@ -2936,6 +2936,9 @@ void dwc3_gadget_exit(struct dwc3 *dwc) · 2935 unmodified lines | ||
| 2936 | 2936 | |
| 2937 | 2937 | int dwc3_gadget_suspend(struct dwc3 *dwc) |
| 2938 | 2938 | { |
| 2939 | + if (!dwc->gadget_driver) | |
| 2940 | + return 0; | |
| 2941 | + | |
| 2939 | 2942 | if (dwc->pullups_connected) { |
| 2940 | 2943 | dwc3_gadget_disable_irq(dwc); |
| 2941 | 2944 | dwc3_gadget_run_stop(dwc, true, true); |
| @@ -2954,6 +2957,9 @@ int dwc3_gadget_resume(struct dwc3 *dwc) · 12 unmodified lines | ||
| 2954 | 2957 | struct dwc3_ep *dep; |
| 2955 | 2958 | int ret; |
| 2956 | 2959 | |
| 2960 | + if (!dwc->gadget_driver) | |
| 2961 | + return 0; | |
| 2962 | + | |
| 2957 | 2963 | /* Start with SuperSpeed Default */ |
| 2958 | 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 | 651 | ssp_cap->bLength = USB_DT_USB_SSP_CAP_SIZE(1); |
| 652 | 652 | ssp_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; |
| 653 | 653 | ssp_cap->bDevCapabilityType = USB_SSP_CAP_TYPE; |
| 654 | + ssp_cap->bReserved = 0; | |
| 655 | + ssp_cap->wReserved = 0; | |
| 654 | 656 | |
| 655 | 657 | /* SSAC = 1 (2 attributes) */ |
| 656 | 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 | 646 | work); |
| 647 | 647 | int ret = io_data->req->status ? io_data->req->status : |
| 648 | 648 | io_data->req->actual; |
| 649 | + bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; | |
| 649 | 650 | |
| 650 | 651 | if (io_data->read && ret > 0) { |
| 651 | 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 | 659 | io_data->kiocb->ki_complete(io_data->kiocb, ret, ret); |
| 659 | 660 | |
| 660 | − if (io_data->ffs->ffs_eventfd && | |
| 661 | − !(io_data->kiocb->ki_flags & IOCB_EVENTFD)) | |
| 661 | + if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) | |
| 662 | 662 | eventfd_signal(io_data->ffs->ffs_eventfd, 1); |
| 663 | 663 | |
| 664 | 664 | usb_ep_free_request(io_data->ep, io_data->req); |
| 665 | 665 | |
| 666 | − io_data->kiocb->private = NULL; | |
| 667 | 666 | if (io_data->read) |
| 668 | 667 | kfree(io_data->to_free); |
| 669 | 668 | kfree(io_data->buf); |
| @@ -604,8 +604,7 @@ void devpts_put_ref(struct pts_fs_info *fsi) · 603 unmodified lines | ||
| 604 | 604 | * |
| 605 | 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, | |
| 608 | − void *priv) | |
| 607 | +struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv) | |
| 609 | 608 | { |
| 610 | 609 | struct dentry *dentry; |
| 611 | 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 | 628 | inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); |
| 630 | 629 | inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); |
| 631 | 630 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
| 632 | − init_special_inode(inode, S_IFCHR|opts->mode, device); | |
| 633 | − inode->i_private = priv; | |
| 631 | + init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index)); | |
| 634 | 632 | |
| 635 | 633 | sprintf(s, "%d", index); |
| 636 | 634 | |
| 637 | − inode_lock(d_inode(root)); | |
| 638 | − | |
| 639 | 635 | dentry = d_alloc_name(root, s); |
| 640 | 636 | if (dentry) { |
| 637 | + dentry->d_fsdata = priv; | |
| 641 | 638 | d_add(dentry, inode); |
| 642 | 639 | fsnotify_create(d_inode(root), dentry); |
| 643 | 640 | } else { |
| 644 | 641 | iput(inode); |
| 645 | − inode = ERR_PTR(-ENOMEM); | |
| 642 | + dentry = ERR_PTR(-ENOMEM); | |
| 646 | 643 | } |
| 647 | 644 | |
| 648 | − inode_unlock(d_inode(root)); | |
| 649 | − | |
| 650 | − return inode; | |
| 645 | + return dentry; | |
| 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 | 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; | |
| 662 | − void *priv = NULL; | |
| 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; | |
| 656 | + WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); | |
| 657 | + return dentry->d_fsdata; | |
| 677 | 658 | } |
| 678 | 659 | |
| 679 | 660 | /** |
| @@ -682,24 +663,14 @@ void *devpts_get_priv(struct inode *pts_inode) · 2 unmodified lines | ||
| 682 | 663 | * |
| 683 | 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); | |
| 688 | − struct dentry *root = sb->s_root; | |
| 689 | − struct dentry *dentry; | |
| 668 | + WARN_ON_ONCE(dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC); | |
| 690 | 669 | |
| 691 | − BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); | |
| 692 | − | |
| 693 | − inode_lock(d_inode(root)); | |
| 694 | − | |
| 695 | − dentry = d_find_alias(inode); | |
| 696 | − | |
| 697 | − drop_nlink(inode); | |
| 670 | + dentry->d_fsdata = NULL; | |
| 671 | + drop_nlink(dentry->d_inode); | |
| 698 | 672 | d_delete(dentry); |
| 699 | 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 | 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 | 108 | u32 val; |
| 109 | 109 | |
| 110 | 110 | preempt_disable(); |
| 111 | − if (unlikely(get_user(val, uaddr) != 0)) | |
| 111 | + if (unlikely(get_user(val, uaddr) != 0)) { | |
| 112 | + preempt_enable(); | |
| 112 | 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 | 118 | return -EFAULT; |
| 119 | + } | |
| 116 | 120 | |
| 117 | 121 | *uval = val; |
| 118 | 122 | preempt_enable(); |
| @@ -39,6 +39,8 @@ static inline bool drm_arch_can_wc_memory(void) · 38 unmodified lines | ||
| 39 | 39 | { |
| 40 | 40 | #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) |
| 41 | 41 | return false; |
| 42 | +#elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) | |
| 43 | + return false; | |
| 42 | 44 | #else |
| 43 | 45 | return true; |
| 44 | 46 | #endif |
| @@ -27,11 +27,11 @@ int devpts_new_index(struct pts_fs_info *); · 26 unmodified lines | ||
| 27 | 27 | void devpts_kill_index(struct pts_fs_info *, int); |
| 28 | 28 | |
| 29 | 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 | 31 | /* get private structure */ |
| 32 | −void *devpts_get_priv(struct inode *pts_inode); | |
| 32 | +void *devpts_get_priv(struct dentry *); | |
| 33 | 33 | /* unlink */ |
| 34 | −void devpts_pty_kill(struct inode *inode); | |
| 34 | +void devpts_pty_kill(struct dentry *); | |
| 35 | 35 | |
| 36 | 36 | #endif |
| 37 | 37 | |
| @@ -526,8 +526,9 @@ enum mlx5_device_state { · 525 unmodified lines | ||
| 526 | 526 | }; |
| 527 | 527 | |
| 528 | 528 | enum mlx5_interface_state { |
| 529 | − MLX5_INTERFACE_STATE_DOWN, | |
| 530 | − MLX5_INTERFACE_STATE_UP, | |
| 529 | + MLX5_INTERFACE_STATE_DOWN = BIT(0), | |
| 530 | + MLX5_INTERFACE_STATE_UP = BIT(1), | |
| 531 | + MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2), | |
| 531 | 532 | }; |
| 532 | 533 | |
| 533 | 534 | enum mlx5_pci_status { |
| @@ -551,7 +552,7 @@ struct mlx5_core_dev { · 17 unmodified lines | ||
| 551 | 552 | enum mlx5_device_state state; |
| 552 | 553 | /* sync interface state */ |
| 553 | 554 | struct mutex intf_state_mutex; |
| 554 | − enum mlx5_interface_state interface_state; | |
| 555 | + unsigned long intf_state; | |
| 555 | 556 | void (*event) (struct mlx5_core_dev *dev, |
| 556 | 557 | enum mlx5_dev_event event, |
| 557 | 558 | unsigned long param); |
| @@ -73,9 +73,9 @@ int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, · 72 unmodified lines | ||
| 73 | 73 | enum mlx5_port_status *status); |
| 74 | 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); | |
| 77 | −void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port); | |
| 78 | −void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu, | |
| 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, u16 *max_mtu, u8 port); | |
| 78 | +void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, u16 *oper_mtu, | |
| 79 | 79 | u8 port); |
| 80 | 80 | |
| 81 | 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 | 45 | u16 vport, u8 *addr); |
| 46 | 46 | int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, |
| 47 | 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 | 50 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, |
| 49 | 51 | u64 *system_image_guid); |
| 50 | 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 | 353 | struct thermal_trip { |
| 354 | 354 | struct device_node *np; |
| 355 | − unsigned long int temperature; | |
| 356 | − unsigned long int hysteresis; | |
| 355 | + int temperature; | |
| 356 | + int hysteresis; | |
| 357 | 357 | enum thermal_trip_type type; |
| 358 | 358 | }; |
| 359 | 359 | |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * defined; unless noted otherwise, they are optional, and can be |
| 8 | 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 | 12 | * Return the tty device corresponding to idx, NULL if there is not |
| 13 | 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 | 251 | struct tty_operations { |
| 252 | 252 | struct tty_struct * (*lookup)(struct tty_driver *driver, |
| 253 | − struct inode *inode, int idx); | |
| 253 | + struct file *filp, int idx); | |
| 254 | 254 | int (*install)(struct tty_driver *driver, struct tty_struct *tty); |
| 255 | 255 | void (*remove)(struct tty_driver *driver, struct tty_struct *tty); |
| 256 | 256 | int (*open)(struct tty_struct * tty, struct file * filp); |
| @@ -54,6 +54,8 @@ struct switchdev_attr { · 53 unmodified lines | ||
| 54 | 54 | struct net_device *orig_dev; |
| 55 | 55 | enum switchdev_attr_id id; |
| 56 | 56 | u32 flags; |
| 57 | + void *complete_priv; | |
| 58 | + void (*complete)(struct net_device *dev, int err, void *priv); | |
| 57 | 59 | union { |
| 58 | 60 | struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */ |
| 59 | 61 | u8 stp_state; /* PORT_STP_STATE */ |
| @@ -75,6 +77,8 @@ struct switchdev_obj { · 15 unmodified lines | ||
| 75 | 77 | struct net_device *orig_dev; |
| 76 | 78 | enum switchdev_obj_id id; |
| 77 | 79 | u32 flags; |
| 80 | + void *complete_priv; | |
| 81 | + void (*complete)(struct net_device *dev, int err, void *priv); | |
| 78 | 82 | }; |
| 79 | 83 | |
| 80 | 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 | 17 | unsigned int verb); |
| 18 | 18 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, |
| 19 | 19 | unsigned int *val); |
| 20 | +int snd_hdac_regmap_read_raw_uncached(struct hdac_device *codec, | |
| 21 | + unsigned int reg, unsigned int *val); | |
| 20 | 22 | int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg, |
| 21 | 23 | unsigned int val); |
| 22 | 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 | 717 | __SYSCALL(__NR_mlock2, sys_mlock2) |
| 718 | 718 | #define __NR_copy_file_range 285 |
| 719 | 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 | 725 | #undef __NR_syscalls |
| 722 | −#define __NR_syscalls 286 | |
| 726 | +#define __NR_syscalls 288 | |
| 723 | 727 | |
| 724 | 728 | /* |
| 725 | 729 | * All syscalls below here should go away really, |
| @@ -19,8 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #define MACSEC_MAX_KEY_LEN 128 |
| 21 | 21 | |
| 22 | −#define DEFAULT_CIPHER_ID 0x0080020001000001ULL | |
| 23 | −#define DEFAULT_CIPHER_ALT 0x0080C20001000001ULL | |
| 22 | +#define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL | |
| 23 | +#define MACSEC_DEFAULT_CIPHER_ALT 0x0080C20001000001ULL | |
| 24 | 24 | |
| 25 | 25 | #define MACSEC_MIN_ICV_LEN 8 |
| 26 | 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 | 2092 | if (IS_ERR(map)) { |
| 2093 | 2093 | verbose("fd %d is not pointing to valid bpf_map\n", |
| 2094 | 2094 | insn->imm); |
| 2095 | − fdput(f); | |
| 2096 | 2095 | return PTR_ERR(map); |
| 2097 | 2096 | } |
| 2098 | 2097 | |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | * @target: The target state |
| 37 | 37 | * @thread: Pointer to the hotplug thread |
| 38 | 38 | * @should_run: Thread should execute |
| 39 | + * @rollback: Perform a rollback | |
| 39 | 40 | * @cb_stat: The state for a single callback (install/uninstall) |
| 40 | 41 | * @cb: Single callback function (install/uninstall) |
| 41 | 42 | * @result: Result of the operation |
| @@ -47,6 +48,7 @@ struct cpuhp_cpu_state { · 5 unmodified lines | ||
| 47 | 48 | #ifdef CONFIG_SMP |
| 48 | 49 | struct task_struct *thread; |
| 49 | 50 | bool should_run; |
| 51 | + bool rollback; | |
| 50 | 52 | enum cpuhp_state cb_state; |
| 51 | 53 | int (*cb)(unsigned int cpu); |
| 52 | 54 | int result; |
| @@ -301,6 +303,11 @@ static int cpu_notify(unsigned long val, unsigned int cpu) · 248 unmodified lines | ||
| 301 | 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 | 311 | /* Notifier wrappers for transitioning to state machine */ |
| 305 | 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 | 484 | } else { |
| 478 | 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 | 497 | } else { |
| 481 | 498 | /* Cannot happen .... */ |
| 482 | 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 | 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 | 656 | static int notify_down_prepare(unsigned int cpu) |
| 645 | 657 | { |
| 646 | 658 | int err, nr_calls = 0; |
| @@ -721,9 +733,10 @@ static int takedown_cpu(unsigned int cpu) · 74 unmodified lines | ||
| 721 | 733 | */ |
| 722 | 734 | err = stop_machine(take_cpu_down, NULL, cpumask_of(cpu)); |
| 723 | 735 | if (err) { |
| 724 | − /* CPU didn't die: tell everyone. Can't complain. */ | |
| 725 | − cpu_notify_nofail(CPU_DOWN_FAILED, cpu); | |
| 736 | + /* CPU refused to die */ | |
| 726 | 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 | 740 | return err; |
| 728 | 741 | } |
| 729 | 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 | 845 | * to do the further cleanups. |
| 833 | 846 | */ |
| 834 | 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 | 854 | hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE; |
| 837 | 855 | out: |
| @@ -1249,6 +1267,7 @@ static struct cpuhp_step cpuhp_ap_states[] = { · 411 unmodified lines | ||
| 1249 | 1267 | .name = "notify:online", |
| 1250 | 1268 | .startup = notify_online, |
| 1251 | 1269 | .teardown = notify_down_prepare, |
| 1270 | + .skip_onerr = true, | |
| 1252 | 1271 | }, |
| 1253 | 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 | 1295 | if (unlikely(should_fail_futex(true))) |
| 1296 | 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 | 1299 | ret = -EFAULT; |
| 1300 | − else if (curval != uval) | |
| 1301 | − ret = -EINVAL; | |
| 1300 | + } else if (curval != uval) { | |
| 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 | 1312 | if (ret) { |
| 1303 | 1313 | raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); |
| 1304 | 1314 | return ret; |
| @@ -1525,8 +1535,8 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, · 220 unmodified lines | ||
| 1525 | 1535 | if (likely(&hb1->chain != &hb2->chain)) { |
| 1526 | 1536 | plist_del(&q->list, &hb1->chain); |
| 1527 | 1537 | hb_waiters_dec(hb1); |
| 1528 | − plist_add(&q->list, &hb2->chain); | |
| 1529 | 1538 | hb_waiters_inc(hb2); |
| 1539 | + plist_add(&q->list, &hb2->chain); | |
| 1530 | 1540 | q->lock_ptr = &hb2->lock; |
| 1531 | 1541 | } |
| 1532 | 1542 | get_futex_key_refs(key2); |
| @@ -2622,6 +2632,15 @@ retry: · 1089 unmodified lines | ||
| 2622 | 2632 | */ |
| 2623 | 2633 | if (ret == -EFAULT) |
| 2624 | 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 | 2645 | * wake_futex_pi has detected invalid state. Tell user |
| 2627 | 2646 | * space. |
| @@ -94,6 +94,7 @@ unsigned int irq_reserve_ipi(struct irq_domain *domain, · 93 unmodified lines | ||
| 94 | 94 | data = irq_get_irq_data(virq + i); |
| 95 | 95 | cpumask_copy(data->common->affinity, dest); |
| 96 | 96 | data->common->ipi_offset = offset; |
| 97 | + irq_set_status_flags(virq + i, IRQ_NO_BALANCING); | |
| 97 | 98 | } |
| 98 | 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 | 138 | if (counter == qstat_pv_hash_hops) { |
| 139 | − u64 frac; | |
| 139 | + u64 frac = 0; | |
| 140 | 140 | |
| 141 | − frac = 100ULL * do_div(stat, kicks); | |
| 142 | − frac = DIV_ROUND_CLOSEST_ULL(frac, kicks); | |
| 141 | + if (kicks) { | |
| 142 | + frac = 100ULL * do_div(stat, kicks); | |
| 143 | + frac = DIV_ROUND_CLOSEST_ULL(frac, kicks); | |
| 144 | + } | |
| 143 | 145 | |
| 144 | 146 | /* |
| 145 | 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 | 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 | 77 | static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, |
| 65 | 78 | struct net_device *dev) |
| 66 | 79 | { |
| @@ -243,9 +256,45 @@ static inline size_t rtnl_mdb_nlmsg_size(void) · 176 unmodified lines | ||
| 243 | 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, | |
| 247 | − int type, struct net_bridge_port_group *pg) | |
| 259 | +struct br_mdb_complete_info { | |
| 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 | 298 | struct switchdev_obj_port_mdb mdb = { |
| 250 | 299 | .obj = { |
| 251 | 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 | 318 | mdb.obj.orig_dev = port_dev; |
| 270 | 319 | if (port_dev && type == RTM_NEWMDB) { |
| 271 | − err = switchdev_port_obj_add(port_dev, &mdb.obj); | |
| 272 | − if (!err && pg) | |
| 273 | − pg->flags |= MDB_PG_FLAGS_OFFLOAD; | |
| 320 | + complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); | |
| 321 | + if (complete_info) { | |
| 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 | 328 | } else if (port_dev && type == RTM_DELMDB) { |
| 275 | 329 | switchdev_port_obj_del(port_dev, &mdb.obj); |
| 276 | 330 | } |
| @@ -291,21 +345,21 @@ errout: · 14 unmodified lines | ||
| 291 | 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, | |
| 295 | − int type) | |
| 348 | +void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, | |
| 349 | + struct br_ip *group, int type, u8 flags) | |
| 296 | 350 | { |
| 297 | 351 | struct br_mdb_entry entry; |
| 298 | 352 | |
| 299 | 353 | memset(&entry, 0, sizeof(entry)); |
| 300 | − entry.ifindex = pg->port->dev->ifindex; | |
| 301 | − entry.addr.proto = pg->addr.proto; | |
| 302 | − entry.addr.u.ip4 = pg->addr.u.ip4; | |
| 354 | + entry.ifindex = port->dev->ifindex; | |
| 355 | + entry.addr.proto = group->proto; | |
| 356 | + entry.addr.u.ip4 = group->u.ip4; | |
| 303 | 357 | #if IS_ENABLED(CONFIG_IPV6) |
| 304 | − entry.addr.u.ip6 = pg->addr.u.ip6; | |
| 358 | + entry.addr.u.ip6 = group->u.ip6; | |
| 305 | 359 | #endif |
| 306 | − entry.vid = pg->addr.vid; | |
| 307 | − __mdb_entry_fill_flags(&entry, pg->flags); | |
| 308 | − __br_mdb_notify(dev, &entry, type, pg); | |
| 360 | + entry.vid = group->vid; | |
| 361 | + __mdb_entry_fill_flags(&entry, flags); | |
| 362 | + __br_mdb_notify(dev, port, &entry, type); | |
| 309 | 363 | } |
| 310 | 364 | |
| 311 | 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 | 506 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, |
| 453 | − struct br_ip *group, unsigned char state, | |
| 454 | − struct net_bridge_port_group **pg) | |
| 507 | + struct br_ip *group, unsigned char state) | |
| 455 | 508 | { |
| 456 | 509 | struct net_bridge_mdb_entry *mp; |
| 457 | 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 | 535 | if (unlikely(!p)) |
| 483 | 536 | return -ENOMEM; |
| 484 | 537 | rcu_assign_pointer(*pp, p); |
| 485 | − *pg = p; | |
| 486 | 538 | if (state == MDB_TEMPORARY) |
| 487 | 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 | 544 | static int __br_mdb_add(struct net *net, struct net_bridge *br, |
| 493 | − struct br_mdb_entry *entry, | |
| 494 | − struct net_bridge_port_group **pg) | |
| 545 | + struct br_mdb_entry *entry) | |
| 495 | 546 | { |
| 496 | 547 | struct br_ip ip; |
| 497 | 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 | 560 | if (!p || p->br != br || p->state == BR_STATE_DISABLED) |
| 510 | 561 | return -EINVAL; |
| 511 | 562 | |
| 512 | − memset(&ip, 0, sizeof(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 | |
| 563 | + __mdb_entry_to_br_ip(entry, &ip); | |
| 521 | 564 | |
| 522 | 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 | 567 | spin_unlock_bh(&br->multicast_lock); |
| 525 | 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 | 571 | static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) |
| 529 | 572 | { |
| 530 | 573 | struct net *net = sock_net(skb->sk); |
| 531 | − struct net_bridge_port_group *pg; | |
| 532 | 574 | struct net_bridge_vlan_group *vg; |
| 533 | 575 | struct net_device *dev, *pdev; |
| 534 | 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 | 600 | if (br_vlan_enabled(br) && vg && entry->vid == 0) { |
| 559 | 601 | list_for_each_entry(v, &vg->vlan_list, vlist) { |
| 560 | 602 | entry->vid = v->vid; |
| 561 | − err = __br_mdb_add(net, br, entry, &pg); | |
| 603 | + err = __br_mdb_add(net, br, entry); | |
| 562 | 604 | if (err) |
| 563 | 605 | break; |
| 564 | − __br_mdb_notify(dev, entry, RTM_NEWMDB, pg); | |
| 606 | + __br_mdb_notify(dev, p, entry, RTM_NEWMDB); | |
| 565 | 607 | } |
| 566 | 608 | } else { |
| 567 | − err = __br_mdb_add(net, br, entry, &pg); | |
| 609 | + err = __br_mdb_add(net, br, entry); | |
| 568 | 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 | 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 | 626 | if (!netif_running(br->dev) || br->multicast_disabled) |
| 585 | 627 | return -EINVAL; |
| 586 | 628 | |
| 587 | − memset(&ip, 0, sizeof(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 | |
| 629 | + __mdb_entry_to_br_ip(entry, &ip); | |
| 596 | 630 | |
| 597 | 631 | spin_lock_bh(&br->multicast_lock); |
| 598 | 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 | 696 | entry->vid = v->vid; |
| 663 | 697 | err = __br_mdb_del(br, entry); |
| 664 | 698 | if (!err) |
| 665 | − __br_mdb_notify(dev, entry, RTM_DELMDB, NULL); | |
| 699 | + __br_mdb_notify(dev, p, entry, RTM_DELMDB); | |
| 666 | 700 | } |
| 667 | 701 | } else { |
| 668 | 702 | err = __br_mdb_del(br, entry); |
| 669 | 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 | 707 | return err; |
| @@ -283,7 +283,8 @@ static void br_multicast_del_pg(struct net_bridge *br, · 282 unmodified lines | ||
| 283 | 283 | rcu_assign_pointer(*pp, p->next); |
| 284 | 284 | hlist_del_init(&p->mglist); |
| 285 | 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 | 288 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
| 288 | 289 | |
| 289 | 290 | if (!mp->ports && !mp->mglist && |
| @@ -705,7 +706,7 @@ static int br_multicast_add_group(struct net_bridge *br, · 415 unmodified lines | ||
| 705 | 706 | if (unlikely(!p)) |
| 706 | 707 | goto err; |
| 707 | 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 | 711 | found: |
| 711 | 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 | 1462 | hlist_del_init(&p->mglist); |
| 1462 | 1463 | del_timer(&p->timer); |
| 1463 | 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 | 1468 | if (!mp->ports && !mp->mglist && |
| 1467 | 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 | 560 | unsigned char flags); |
| 561 | 561 | void br_mdb_init(void); |
| 562 | 562 | void br_mdb_uninit(void); |
| 563 | −void br_mdb_notify(struct net_device *dev, struct net_bridge_port_group *pg, | |
| 564 | − int type); | |
| 563 | +void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, | |
| 564 | + struct br_ip *group, int type, u8 flags); | |
| 565 | 565 | void br_rtr_notify(struct net_device *dev, struct net_bridge_port *port, |
| 566 | 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 | 904 | if (ifa->ifa_flags & IFA_F_SECONDARY) { |
| 905 | 905 | prim = inet_ifa_byprefix(in_dev, any, ifa->ifa_mask); |
| 906 | 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 | 912 | return; |
| 909 | 913 | } |
| 910 | 914 | if (iprim && iprim != prim) { |
| @@ -3175,35 +3175,9 @@ static void addrconf_gre_config(struct net_device *dev) · 3174 unmodified lines | ||
| 3175 | 3175 | } |
| 3176 | 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 | 3178 | static int fixup_permanent_addr(struct inet6_dev *idev, |
| 3203 | 3179 | struct inet6_ifaddr *ifp) |
| 3204 | 3180 | { |
| 3205 | − l3mdev_check_host_rt(idev, ifp); | |
| 3206 | − | |
| 3207 | 3181 | if (!ifp->rt) { |
| 3208 | 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 | 3277 | break; |
| 3304 | 3278 | |
| 3305 | 3279 | if (event == NETDEV_UP) { |
| 3280 | + /* restore routes for permanent addresses */ | |
| 3281 | + addrconf_permanent_addr(dev); | |
| 3282 | + | |
| 3306 | 3283 | if (!addrconf_qdisc_ok(dev)) { |
| 3307 | 3284 | /* device is not ready yet. */ |
| 3308 | 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 | 3313 | run_pending = 1; |
| 3337 | 3314 | } |
| 3338 | 3315 | |
| 3339 | − /* restore routes for permanent addresses */ | |
| 3340 | − addrconf_permanent_addr(dev); | |
| 3341 | − | |
| 3342 | 3316 | switch (dev->type) { |
| 3343 | 3317 | #if IS_ENABLED(CONFIG_IPV6_SIT) |
| 3344 | 3318 | case ARPHRD_SIT: |
| @@ -3555,6 +3529,8 @@ restart: · 210 unmodified lines | ||
| 3555 | 3529 | |
| 3556 | 3530 | INIT_LIST_HEAD(&del_list); |
| 3557 | 3531 | list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { |
| 3532 | + struct rt6_info *rt = NULL; | |
| 3533 | + | |
| 3558 | 3534 | addrconf_del_dad_work(ifa); |
| 3559 | 3535 | |
| 3560 | 3536 | write_unlock_bh(&idev->lock); |
| @@ -3567,6 +3543,9 @@ restart: · 6 unmodified lines | ||
| 3567 | 3543 | ifa->state = 0; |
| 3568 | 3544 | if (!(ifa->flags & IFA_F_NODAD)) |
| 3569 | 3545 | ifa->flags |= IFA_F_TENTATIVE; |
| 3546 | + | |
| 3547 | + rt = ifa->rt; | |
| 3548 | + ifa->rt = NULL; | |
| 3570 | 3549 | } else { |
| 3571 | 3550 | state = ifa->state; |
| 3572 | 3551 | ifa->state = INET6_IFADDR_STATE_DEAD; |
| @@ -3577,6 +3556,9 @@ restart: · 4 unmodified lines | ||
| 3577 | 3556 | |
| 3578 | 3557 | spin_unlock_bh(&ifa->lock); |
| 3579 | 3558 | |
| 3559 | + if (rt) | |
| 3560 | + ip6_del_rt(rt); | |
| 3561 | + | |
| 3580 | 3562 | if (state != INET6_IFADDR_STATE_DEAD) { |
| 3581 | 3563 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
| 3582 | 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 | 5326 | if (rt) |
| 5345 | 5327 | ip6_del_rt(rt); |
| 5346 | 5328 | } |
| 5347 | − dst_hold(&ifp->rt->dst); | |
| 5348 | − | |
| 5349 | − ip6_del_rt(ifp->rt); | |
| 5350 | − | |
| 5329 | + if (ifp->rt) { | |
| 5330 | + dst_hold(&ifp->rt->dst); | |
| 5331 | + ip6_del_rt(ifp->rt); | |
| 5332 | + } | |
| 5351 | 5333 | rt_genid_bump_ipv6(net); |
| 5352 | 5334 | break; |
| 5353 | 5335 | } |
| @@ -305,6 +305,8 @@ static void switchdev_port_attr_set_deferred(struct net_device *dev, · 304 unmodified lines | ||
| 305 | 305 | if (err && err != -EOPNOTSUPP) |
| 306 | 306 | netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", |
| 307 | 307 | err, attr->id); |
| 308 | + if (attr->complete) | |
| 309 | + attr->complete(dev, err, attr->complete_priv); | |
| 308 | 310 | } |
| 309 | 311 | |
| 310 | 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 | 436 | if (err && err != -EOPNOTSUPP) |
| 435 | 437 | netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", |
| 436 | 438 | err, obj->id); |
| 439 | + if (obj->complete) | |
| 440 | + obj->complete(dev, err, obj->complete_priv); | |
| 437 | 441 | } |
| 438 | 442 | |
| 439 | 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 | 506 | if (err && err != -EOPNOTSUPP) |
| 503 | 507 | netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", |
| 504 | 508 | err, obj->id); |
| 509 | + if (obj->complete) | |
| 510 | + obj->complete(dev, err, obj->complete_priv); | |
| 505 | 511 | } |
| 506 | 512 | |
| 507 | 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 | 299 | int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, |
| 300 | 300 | int parm) |
| 301 | 301 | { |
| 302 | − int val; | |
| 302 | + unsigned int cmd, val; | |
| 303 | 303 | |
| 304 | − if (codec->regmap) | |
| 305 | − regcache_cache_bypass(codec->regmap, true); | |
| 306 | − val = snd_hdac_read_parm(codec, nid, parm); | |
| 307 | − if (codec->regmap) | |
| 308 | − regcache_cache_bypass(codec->regmap, false); | |
| 304 | + cmd = snd_hdac_regmap_encode_verb(nid, AC_VERB_PARAMETERS) | parm; | |
| 305 | + if (snd_hdac_regmap_read_raw_uncached(codec, cmd, &val) < 0) | |
| 306 | + return -1; | |
| 309 | 307 | return val; |
| 310 | 308 | } |
| 311 | 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 | 453 | EXPORT_SYMBOL_GPL(snd_hdac_regmap_write_raw); |
| 454 | 454 | |
| 455 | 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 | 459 | return hda_reg_read(codec, reg, val); |
| 460 | 460 | else |
| 461 | 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 | 481 | * snd_hdac_regmap_read_raw - read a pseudo register with power mgmt |
| 466 | 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 | 488 | int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg, |
| 473 | 489 | unsigned int *val) |
| 474 | 490 | { |
| 475 | − int err; | |
| 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; | |
| 491 | + return __snd_hdac_regmap_read_raw(codec, reg, val, false); | |
| 485 | 492 | } |
| 486 | 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 | 505 | * snd_hdac_regmap_update_raw - update a pseudo register with power mgmt |
| 490 | 506 | * @codec: the codec object |
| @@ -826,7 +826,7 @@ static hda_nid_t path_power_update(struct hda_codec *codec, · 825 unmodified lines | ||
| 826 | 826 | bool allow_powerdown) |
| 827 | 827 | { |
| 828 | 828 | hda_nid_t nid, changed = 0; |
| 829 | − int i, state; | |
| 829 | + int i, state, power; | |
| 830 | 830 | |
| 831 | 831 | for (i = 0; i < path->depth; i++) { |
| 832 | 832 | nid = path->path[i]; |
| @@ -838,7 +838,9 @@ static hda_nid_t path_power_update(struct hda_codec *codec, · 5 unmodified lines | ||
| 838 | 838 | state = AC_PWRST_D0; |
| 839 | 839 | else |
| 840 | 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 | 844 | snd_hda_codec_write(codec, nid, 0, |
| 843 | 845 | AC_VERB_SET_POWER_STATE, state); |
| 844 | 846 | changed = nid; |
| @@ -2232,6 +2232,9 @@ static const struct pci_device_id azx_ids[] = { · 2231 unmodified lines | ||
| 2232 | 2232 | /* Broxton-P(Apollolake) */ |
| 2233 | 2233 | { PCI_DEVICE(0x8086, 0x5a98), |
| 2234 | 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 | 2238 | /* Haswell */ |
| 2236 | 2239 | { PCI_DEVICE(0x8086, 0x0a0c), |
| 2237 | 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 | 362 | struct cs_spec *spec = codec->spec; |
| 363 | 363 | int err; |
| 364 | + int i; | |
| 364 | 365 | |
| 365 | 366 | err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); |
| 366 | 367 | if (err < 0) |
| @@ -370,6 +371,19 @@ static int cs_parse_auto_config(struct hda_codec *codec) · 3 unmodified lines | ||
| 370 | 371 | if (err < 0) |
| 371 | 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 | 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 | 1858 | struct hdmi_spec *spec = codec->spec; |
| 1859 | 1859 | struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx); |
| 1860 | 1860 | |
| 1861 | + if (!per_pin) | |
| 1862 | + return; | |
| 1861 | 1863 | mutex_lock(&per_pin->lock); |
| 1862 | 1864 | per_pin->chmap_set = true; |
| 1863 | 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 | 5449 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5450 | 5450 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5451 | 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 | 5453 | SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK), |
| 5453 | 5454 | SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 5454 | 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 | 1343 | pcxhr_msg_thread(mgr); |
| 1344 | + mutex_unlock(&mgr->lock); | |
| 1344 | 1345 | return IRQ_HANDLED; |
| 1345 | 1346 | } |
| @@ -299,18 +299,38 @@ they mean, and suggestions for how to fix them. · 298 unmodified lines | ||
| 299 | 299 | Errors in .c files |
| 300 | 300 | ------------------ |
| 301 | 301 | |
| 302 | −If you're getting an objtool error in a compiled .c file, chances are | |
| 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: | |
| 302 | +1. c_file.o: warning: objtool: funcA() falls through to next function funcB() | |
| 306 | 303 | |
| 307 | − register void *__sp asm("rsp"); | |
| 308 | − asm volatile("call func" : "+r" (__sp)); | |
| 304 | + This means that funcA() doesn't end with a return instruction or an | |
| 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 | |
| 313 | −-fno-omit-frame-pointer or adds -fomit-frame-pointer to the gcc options. | |
| 314 | + 2) funcA() uses the unreachable() annotation in a section of code | |
| 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 | 335 | Also see the above section for .S file errors for more information what |
| 316 | 336 | the individual error messages mean. |
| @@ -54,6 +54,7 @@ struct instruction { · 53 unmodified lines | ||
| 54 | 54 | struct symbol *call_dest; |
| 55 | 55 | struct instruction *jump_dest; |
| 56 | 56 | struct list_head alts; |
| 57 | + struct symbol *func; | |
| 57 | 58 | }; |
| 58 | 59 | |
| 59 | 60 | struct alternative { |
| @@ -66,6 +67,7 @@ struct objtool_file { · 6 unmodified lines | ||
| 66 | 67 | struct list_head insn_list; |
| 67 | 68 | DECLARE_HASHTABLE(insn_hash, 16); |
| 68 | 69 | struct section *rodata, *whitelist; |
| 70 | + bool ignore_unreachables, c_file; | |
| 69 | 71 | }; |
| 70 | 72 | |
| 71 | 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 | 234 | /* sibling call */ |
| 233 | 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 | 250 | static int decode_instructions(struct objtool_file *file) |
| 249 | 251 | { |
| 250 | 252 | struct section *sec; |
| 253 | + struct symbol *func; | |
| 251 | 254 | unsigned long offset; |
| 252 | 255 | struct instruction *insn; |
| 253 | 256 | int ret; |
| @@ -281,6 +284,21 @@ static int decode_instructions(struct objtool_file *file) · 27 unmodified lines | ||
| 281 | 284 | hash_add(file->insn_hash, &insn->hash, insn->offset); |
| 282 | 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 | 304 | return 0; |
| @@ -664,13 +682,40 @@ static int add_func_switch_tables(struct objtool_file *file, · 377 unmodified lines | ||
| 664 | 682 | text_rela->addend); |
| 665 | 683 | |
| 666 | 684 | /* |
| 667 | − * TODO: Document where this is needed, or get rid of it. | |
| 668 | − * | |
| 669 | 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 | 714 | rodata_rela = find_rela_by_dest(file->rodata, |
| 673 | 715 | text_rela->addend + 4); |
| 716 | + if (rodata_rela) | |
| 717 | + file->ignore_unreachables = true; | |
| 718 | + } | |
| 674 | 719 | |
| 675 | 720 | if (!rodata_rela) |
| 676 | 721 | continue; |
| @@ -732,9 +777,6 @@ static int decode_sections(struct objtool_file *file) · 55 unmodified lines | ||
| 732 | 777 | { |
| 733 | 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 | 780 | ret = decode_instructions(file); |
| 739 | 781 | if (ret) |
| 740 | 782 | return ret; |
| @@ -799,6 +841,7 @@ static int validate_branch(struct objtool_file *file, · 58 unmodified lines | ||
| 799 | 841 | struct alternative *alt; |
| 800 | 842 | struct instruction *insn; |
| 801 | 843 | struct section *sec; |
| 844 | + struct symbol *func = NULL; | |
| 802 | 845 | unsigned char state; |
| 803 | 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 | 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 | 869 | if (insn->visited) { |
| 817 | 870 | if (frame_state(insn->state) != frame_state(state)) { |
| 818 | 871 | WARN_FUNC("frame pointer state mismatch", |
| @@ -823,13 +876,6 @@ static int validate_branch(struct objtool_file *file, · 4 unmodified lines | ||
| 823 | 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 | 879 | insn->visited = true; |
| 834 | 880 | insn->state = state; |
| 835 | 881 | |
| @@ -1035,12 +1081,8 @@ static int validate_functions(struct objtool_file *file) · 199 unmodified lines | ||
| 1035 | 1081 | continue; |
| 1036 | 1082 | |
| 1037 | 1083 | insn = find_insn(file, sec, func->offset); |
| 1038 | − if (!insn) { | |
| 1039 | − WARN("%s(): can't find starting instruction", | |
| 1040 | − func->name); | |
| 1041 | − warnings++; | |
| 1084 | + if (!insn) | |
| 1042 | 1085 | continue; |
| 1043 | − } | |
| 1044 | 1086 | |
| 1045 | 1087 | ret = validate_branch(file, insn, 0); |
| 1046 | 1088 | warnings += ret; |
| @@ -1056,13 +1098,14 @@ static int validate_functions(struct objtool_file *file) · 9 unmodified lines | ||
| 1056 | 1098 | if (insn->visited) |
| 1057 | 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 | 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 | 1177 | INIT_LIST_HEAD(&file.insn_list); |
| 1135 | 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 | 1184 | ret = decode_sections(&file); |
| 1138 | 1185 | if (ret < 0) |
| @@ -1130,7 +1130,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq) · 1129 unmodified lines | ||
| 1130 | 1130 | pr_err("Intel Processor Trace: failed to deliver transaction event, error %d\n", |
| 1131 | 1131 | ret); |
| 1132 | 1132 | |
| 1133 | − if (pt->synth_opts.callchain) | |
| 1133 | + if (pt->synth_opts.last_branch) | |
| 1134 | 1134 | intel_pt_reset_last_branch_rb(ptq); |
| 1135 | 1135 | |
| 1136 | 1136 | return ret; |