ASoC: Updates for v4.9 Apart from the cleanups done by Morimoto-san this has very much been a driver focused release with very little generic change: - A big factoring out of the simple-card code to allow it to be shared more with the rcar generic card from Kuninori Morimoto. - Removal of some operations duplicated on the CODEC level, again by Kuninori Morimoto. - Lots more machine support for x86 systems. - New drivers for Nuvoton NAU88C10, Realtek RT5660 and RT5663.
Unified · Split
| @@ -88,6 +88,7 @@ Kay Sievers <kay.sievers@vrfy.org> · 87 unmodified lines | |||
| 88 | Kenneth W Chen <kenneth.w.chen@intel.com> | 88 | Kenneth W Chen <kenneth.w.chen@intel.com> |
| 89 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> | 89 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> |
| 90 | Koushik <raghavendra.koushik@neterion.com> | 90 | Koushik <raghavendra.koushik@neterion.com> |
| 91 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski@samsung.com> | ||
| 91 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com> | 92 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com> |
| 92 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 93 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 93 | Leonid I Ananiev <leonid.i.ananiev@intel.com> | 94 | Leonid I Ananiev <leonid.i.ananiev@intel.com> |
| @@ -158,6 +159,8 @@ Valdis Kletnieks <Valdis.Kletnieks@vt.edu> · 64 unmodified lines | |||
| 158 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com> | 159 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com> |
| 159 | Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> | 160 | Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> |
| 160 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com> | 161 | Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com> |
| 162 | Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com> | ||
| 163 | Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com> | ||
| 161 | Takashi YOSHII <takashi.yoshii.zj@renesas.com> | 164 | Takashi YOSHII <takashi.yoshii.zj@renesas.com> |
| 162 | Yusuke Goda <goda.yusuke@renesas.com> | 165 | Yusuke Goda <goda.yusuke@renesas.com> |
| 163 | Gustavo Padovan <gustavo@las.ic.unicamp.br> | 166 | Gustavo Padovan <gustavo@las.ic.unicamp.br> |
| @@ -1,7 +1,7 @@ | |||
| 1 | # Note: This documents additional properties of any device beyond what | 1 | # Note: This documents additional properties of any device beyond what |
| 2 | # is documented in Documentation/sysfs-rules.txt | 2 | # is documented in Documentation/sysfs-rules.txt |
| 3 | 3 | ||
| 4 | What: /sys/devices/*/of_path | 4 | What: /sys/devices/*/of_node |
| 5 | Date: February 2015 | 5 | Date: February 2015 |
| 6 | Contact: Device Tree mailing list <devicetree@vger.kernel.org> | 6 | Contact: Device Tree mailing list <devicetree@vger.kernel.org> |
| 7 | Description: | 7 | Description: |
| @@ -94,14 +94,11 @@ has a requirements for a minimum number of vectors the driver can pass a · 93 unmodified lines | |||
| 94 | min_vecs argument set to this limit, and the PCI core will return -ENOSPC | 94 | min_vecs argument set to this limit, and the PCI core will return -ENOSPC |
| 95 | if it can't meet the minimum number of vectors. | 95 | if it can't meet the minimum number of vectors. |
| 96 | 96 | ||
| 97 | The flags argument should normally be set to 0, but can be used to pass the | 97 | The flags argument is used to specify which type of interrupt can be used |
| 98 | PCI_IRQ_NOMSI and PCI_IRQ_NOMSIX flag in case a device claims to support | 98 | by the device and the driver (PCI_IRQ_LEGACY, PCI_IRQ_MSI, PCI_IRQ_MSIX). |
| 99 | MSI or MSI-X, but the support is broken, or to pass PCI_IRQ_NOLEGACY in | 99 | A convenient short-hand (PCI_IRQ_ALL_TYPES) is also available to ask for |
| 100 | case the device does not support legacy interrupt lines. | 100 | any possible kind of interrupt. If the PCI_IRQ_AFFINITY flag is set, |
| 101 | 101 | pci_alloc_irq_vectors() will spread the interrupts around the available CPUs. | |
| 102 | By default this function will spread the interrupts around the available | ||
| 103 | CPUs, but this feature can be disabled by passing the PCI_IRQ_NOAFFINITY | ||
| 104 | flag. | ||
| 105 | 102 | ||
| 106 | To get the Linux IRQ numbers passed to request_irq() and free_irq() and the | 103 | To get the Linux IRQ numbers passed to request_irq() and free_irq() and the |
| 107 | vectors, use the following function: | 104 | vectors, use the following function: |
| @@ -131,7 +128,7 @@ larger than the number supported by the device it will automatically be · 23 unmodified lines | |||
| 131 | capped to the supported limit, so there is no need to query the number of | 128 | capped to the supported limit, so there is no need to query the number of |
| 132 | vectors supported beforehand: | 129 | vectors supported beforehand: |
| 133 | 130 | ||
| 134 | nvec = pci_alloc_irq_vectors(pdev, 1, nvec, 0); | 131 | nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_ALL_TYPES) |
| 135 | if (nvec < 0) | 132 | if (nvec < 0) |
| 136 | goto out_err; | 133 | goto out_err; |
| 137 | 134 | ||
| @@ -140,7 +137,7 @@ interrupts it can request a particular number of interrupts by passing that · 2 unmodified lines | |||
| 140 | number to pci_alloc_irq_vectors() function as both 'min_vecs' and | 137 | number to pci_alloc_irq_vectors() function as both 'min_vecs' and |
| 141 | 'max_vecs' parameters: | 138 | 'max_vecs' parameters: |
| 142 | 139 | ||
| 143 | ret = pci_alloc_irq_vectors(pdev, nvec, nvec, 0); | 140 | ret = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_ALL_TYPES); |
| 144 | if (ret < 0) | 141 | if (ret < 0) |
| 145 | goto out_err; | 142 | goto out_err; |
| 146 | 143 | ||
| @@ -148,15 +145,14 @@ The most notorious example of the request type described above is enabling · 1 unmodified line | |||
| 148 | the single MSI mode for a device. It could be done by passing two 1s as | 145 | the single MSI mode for a device. It could be done by passing two 1s as |
| 149 | 'min_vecs' and 'max_vecs': | 146 | 'min_vecs' and 'max_vecs': |
| 150 | 147 | ||
| 151 | ret = pci_alloc_irq_vectors(pdev, 1, 1, 0); | 148 | ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); |
| 152 | if (ret < 0) | 149 | if (ret < 0) |
| 153 | goto out_err; | 150 | goto out_err; |
| 154 | 151 | ||
| 155 | Some devices might not support using legacy line interrupts, in which case | 152 | Some devices might not support using legacy line interrupts, in which case |
| 156 | the PCI_IRQ_NOLEGACY flag can be used to fail the request if the platform | 153 | the driver can specify that only MSI or MSI-X is acceptable: |
| 157 | can't provide MSI or MSI-X interrupts: | ||
| 158 | 154 | ||
| 159 | nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_NOLEGACY); | 155 | nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX); |
| 160 | if (nvec < 0) | 156 | if (nvec < 0) |
| 161 | goto out_err; | 157 | goto out_err; |
| 162 | 158 | ||
| @@ -124,7 +124,6 @@ initialization with a pointer to a structure describing the driver · 123 unmodified lines | |||
| 124 | 124 | ||
| 125 | The ID table is an array of struct pci_device_id entries ending with an | 125 | The ID table is an array of struct pci_device_id entries ending with an |
| 126 | all-zero entry. Definitions with static const are generally preferred. | 126 | all-zero entry. Definitions with static const are generally preferred. |
| 127 | Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. | ||
| 128 | 127 | ||
| 129 | Each entry consists of: | 128 | Each entry consists of: |
| 130 | 129 | ||
| @@ -18,13 +18,17 @@ and config2 fields of the perf_event_attr structure. The "events" · 17 unmodified lines | |||
| 18 | directory provides configuration templates for all documented | 18 | directory provides configuration templates for all documented |
| 19 | events, that can be used with perf tool. For example "xp_valid_flit" | 19 | events, that can be used with perf tool. For example "xp_valid_flit" |
| 20 | is an equivalent of "type=0x8,event=0x4". Other parameters must be | 20 | is an equivalent of "type=0x8,event=0x4". Other parameters must be |
| 21 | explicitly specified. For events originating from device, "node" | 21 | explicitly specified. |
| 22 | defines its index. All crosspoint events require "xp" (index), | ||
| 23 | "port" (device port number) and "vc" (virtual channel ID) and | ||
| 24 | "dir" (direction). Watchpoints (special "event" value 0xfe) also | ||
| 25 | require comparator values ("cmp_l" and "cmp_h") and "mask", being | ||
| 26 | index of the comparator mask. | ||
| 27 | 22 | ||
| 23 | For events originating from device, "node" defines its index. | ||
| 24 | |||
| 25 | Crosspoint PMU events require "xp" (index), "bus" (bus number) | ||
| 26 | and "vc" (virtual channel ID). | ||
| 27 | |||
| 28 | Crosspoint watchpoint-based events (special "event" value 0xfe) | ||
| 29 | require "xp" and "vc" as as above plus "port" (device port index), | ||
| 30 | "dir" (transmit/receive direction), comparator values ("cmp_l" | ||
| 31 | and "cmp_h") and "mask", being index of the comparator mask. | ||
| 28 | Masks are defined separately from the event description | 32 | Masks are defined separately from the event description |
| 29 | (due to limited number of the config values) in the "cmp_mask" | 33 | (due to limited number of the config values) in the "cmp_mask" |
| 30 | directory, with first 8 configurable by user and additional | 34 | directory, with first 8 configurable by user and additional |
| @@ -53,6 +53,7 @@ stable kernels. · 52 unmodified lines | |||
| 53 | | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | | 53 | | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | |
| 54 | | ARM | Cortex-A57 | #852523 | N/A | | 54 | | ARM | Cortex-A57 | #852523 | N/A | |
| 55 | | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | | 55 | | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | |
| 56 | | ARM | Cortex-A72 | #853709 | N/A | | ||
| 56 | | ARM | MMU-500 | #841119,#826419 | N/A | | 57 | | ARM | MMU-500 | #841119,#826419 | N/A | |
| 57 | | | | | | | 58 | | | | | | |
| 58 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | 59 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | |
| @@ -103,7 +103,7 @@ Config Main Menu · 102 unmodified lines | |||
| 103 | Power management options (ACPI, APM) ---> | 103 | Power management options (ACPI, APM) ---> |
| 104 | CPU Frequency scaling ---> | 104 | CPU Frequency scaling ---> |
| 105 | [*] CPU Frequency scaling | 105 | [*] CPU Frequency scaling |
| 106 | <*> CPU frequency translation statistics | 106 | [*] CPU frequency translation statistics |
| 107 | [*] CPU frequency translation statistics details | 107 | [*] CPU frequency translation statistics details |
| 108 | 108 | ||
| 109 | 109 | ||
| @@ -16,6 +16,11 @@ Required properties: · 15 unmodified lines | |||
| 16 | - vref-supply: The regulator supply ADC reference voltage. | 16 | - vref-supply: The regulator supply ADC reference voltage. |
| 17 | - #io-channel-cells: Should be 1, see ../iio-bindings.txt | 17 | - #io-channel-cells: Should be 1, see ../iio-bindings.txt |
| 18 | 18 | ||
| 19 | Optional properties: | ||
| 20 | - resets: Must contain an entry for each entry in reset-names if need support | ||
| 21 | this option. See ../reset/reset.txt for details. | ||
| 22 | - reset-names: Must include the name "saradc-apb". | ||
| 23 | |||
| 19 | Example: | 24 | Example: |
| 20 | saradc: saradc@2006c000 { | 25 | saradc: saradc@2006c000 { |
| 21 | compatible = "rockchip,saradc"; | 26 | compatible = "rockchip,saradc"; |
| @@ -23,6 +28,8 @@ Example: · 1 unmodified line | |||
| 23 | interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; | 28 | interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; |
| 24 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; | 29 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
| 25 | clock-names = "saradc", "apb_pclk"; | 30 | clock-names = "saradc", "apb_pclk"; |
| 31 | resets = <&cru SRST_SARADC>; | ||
| 32 | reset-names = "saradc-apb"; | ||
| 26 | #io-channel-cells = <1>; | 33 | #io-channel-cells = <1>; |
| 27 | vref-supply = <&vcc18>; | 34 | vref-supply = <&vcc18>; |
| 28 | }; | 35 | }; |
| @@ -13,6 +13,7 @@ Required properties: · 12 unmodified lines | |||
| 13 | - touchscreen-size-y : See touchscreen.txt | 13 | - touchscreen-size-y : See touchscreen.txt |
| 14 | 14 | ||
| 15 | Optional properties: | 15 | Optional properties: |
| 16 | - firmware-name : File basename (string) for board specific firmware | ||
| 16 | - touchscreen-inverted-x : See touchscreen.txt | 17 | - touchscreen-inverted-x : See touchscreen.txt |
| 17 | - touchscreen-inverted-y : See touchscreen.txt | 18 | - touchscreen-inverted-y : See touchscreen.txt |
| 18 | - touchscreen-swapped-x-y : See touchscreen.txt | 19 | - touchscreen-swapped-x-y : See touchscreen.txt |
| @@ -10,7 +10,7 @@ Required properties: · 9 unmodified lines | |||
| 10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC | 10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC |
| 11 | family). | 11 | family). |
| 12 | 12 | ||
| 13 | - clock-names: Should be "mmc". | 13 | - clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory) |
| 14 | See: Documentation/devicetree/bindings/resource-names.txt | 14 | See: Documentation/devicetree/bindings/resource-names.txt |
| 15 | - clocks: Phandle to the clock. | 15 | - clocks: Phandle to the clock. |
| 16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt | 16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt |
| @@ -42,9 +42,6 @@ Optional properties: · 41 unmodified lines | |||
| 42 | - auto-flow-control: one way to enable automatic flow control support. The | 42 | - auto-flow-control: one way to enable automatic flow control support. The |
| 43 | driver is allowed to detect support for the capability even without this | 43 | driver is allowed to detect support for the capability even without this |
| 44 | property. | 44 | property. |
| 45 | - {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD | ||
| 46 | line respectively. It will use specified GPIO instead of the peripheral | ||
| 47 | function pin for the UART feature. If unsure, don't specify this property. | ||
| 48 | 45 | ||
| 49 | Note: | 46 | Note: |
| 50 | * fsl,ns16550: | 47 | * fsl,ns16550: |
| @@ -66,19 +63,3 @@ Example: · 15 unmodified lines | |||
| 66 | interrupts = <10>; | 63 | interrupts = <10>; |
| 67 | reg-shift = <2>; | 64 | reg-shift = <2>; |
| 68 | }; | 65 | }; |
| 69 | |||
| 70 | Example for OMAP UART using GPIO-based modem control signals: | ||
| 71 | |||
| 72 | uart4: serial@49042000 { | ||
| 73 | compatible = "ti,omap3-uart"; | ||
| 74 | reg = <0x49042000 0x400>; | ||
| 75 | interrupts = <80>; | ||
| 76 | ti,hwmods = "uart4"; | ||
| 77 | clock-frequency = <48000000>; | ||
| 78 | cts-gpios = <&gpio3 5 GPIO_ACTIVE_LOW>; | ||
| 79 | rts-gpios = <&gpio3 6 GPIO_ACTIVE_LOW>; | ||
| 80 | dtr-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; | ||
| 81 | dsr-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; | ||
| 82 | dcd-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; | ||
| 83 | rng-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; | ||
| 84 | }; | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | NAU8810 audio CODEC | ||
| 2 | |||
| 3 | This device supports I2C only. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "nuvoton,nau8810" | ||
| 8 | |||
| 9 | - reg : the I2C address of the device. | ||
| 10 | |||
| 11 | Example: | ||
| 12 | |||
| 13 | codec: nau8810@1a { | ||
| 14 | compatible = "nuvoton,nau8810"; | ||
| 15 | reg = <0x1a>; | ||
| 16 | }; | ||
| @@ -0,0 +1,42 @@ | |||
| 1 | NVIDIA Tegra audio complex, with SGTL5000 CODEC | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible : "nvidia,tegra-audio-sgtl5000" | ||
| 5 | - clocks : Must contain an entry for each entry in clock-names. | ||
| 6 | See ../clocks/clock-bindings.txt for details. | ||
| 7 | - clock-names : Must include the following entries: | ||
| 8 | - pll_a | ||
| 9 | - pll_a_out0 | ||
| 10 | - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk) | ||
| 11 | - nvidia,model : The user-visible name of this sound complex. | ||
| 12 | - nvidia,audio-routing : A list of the connections between audio components. | ||
| 13 | Each entry is a pair of strings, the first being the connection's sink, | ||
| 14 | the second being the connection's source. Valid names for sources and | ||
| 15 | sinks are the SGTL5000's pins (as documented in its binding), and the jacks | ||
| 16 | on the board: | ||
| 17 | |||
| 18 | * Headphone Jack | ||
| 19 | * Line In Jack | ||
| 20 | * Mic Jack | ||
| 21 | |||
| 22 | - nvidia,i2s-controller : The phandle of the Tegra I2S controller that's | ||
| 23 | connected to the CODEC. | ||
| 24 | - nvidia,audio-codec : The phandle of the SGTL5000 audio codec. | ||
| 25 | |||
| 26 | Example: | ||
| 27 | |||
| 28 | sound { | ||
| 29 | compatible = "toradex,tegra-audio-sgtl5000-apalis_t30", | ||
| 30 | "nvidia,tegra-audio-sgtl5000"; | ||
| 31 | nvidia,model = "Toradex Apalis T30"; | ||
| 32 | nvidia,audio-routing = | ||
| 33 | "Headphone Jack", "HP_OUT", | ||
| 34 | "LINE_IN", "Line In Jack", | ||
| 35 | "MIC_IN", "Mic Jack"; | ||
| 36 | nvidia,i2s-controller = <&tegra_i2s2>; | ||
| 37 | nvidia,audio-codec = <&sgtl5000>; | ||
| 38 | clocks = <&tegra_car TEGRA30_CLK_PLL_A>, | ||
| 39 | <&tegra_car TEGRA30_CLK_PLL_A_OUT0>, | ||
| 40 | <&tegra_car TEGRA30_CLK_EXTERN1>; | ||
| 41 | clock-names = "pll_a", "pll_a_out0", "mclk"; | ||
| 42 | }; | ||
| @@ -16,6 +16,24 @@ Required properties: · 15 unmodified lines | |||
| 16 | * "spkr-iomux" | 16 | * "spkr-iomux" |
| 17 | - qcom,model : Name of the sound card. | 17 | - qcom,model : Name of the sound card. |
| 18 | 18 | ||
| 19 | - qcom,audio-routing : A list of the connections between audio components. | ||
| 20 | Each entry is a pair of strings, the first being the | ||
| 21 | connection's sink, the second being the connection's | ||
| 22 | source. Valid names could be power supplies, MicBias | ||
| 23 | of msm8x16_wcd codec and the jacks on the board: | ||
| 24 | |||
| 25 | Power supplies: | ||
| 26 | * MIC BIAS External1 | ||
| 27 | * MIC BIAS External2 | ||
| 28 | * MIC BIAS Internal1 | ||
| 29 | * MIC BIAS Internal2 | ||
| 30 | |||
| 31 | Board connectors: | ||
| 32 | * Headset Mic | ||
| 33 | * Secondary Mic", | ||
| 34 | * DMIC | ||
| 35 | * Ext Spk | ||
| 36 | |||
| 19 | Dai-link subnode properties and subnodes: | 37 | Dai-link subnode properties and subnodes: |
| 20 | 38 | ||
| 21 | Required dai-link subnodes: | 39 | Required dai-link subnodes: |
| @@ -37,6 +55,18 @@ sound: sound { · 15 unmodified lines | |||
| 37 | reg-names = "mic-iomux", "spkr-iomux"; | 55 | reg-names = "mic-iomux", "spkr-iomux"; |
| 38 | qcom,model = "DB410c"; | 56 | qcom,model = "DB410c"; |
| 39 | 57 | ||
| 58 | qcom,audio-routing = | ||
| 59 | "MIC BIAS External1", "Handset Mic", | ||
| 60 | "MIC BIAS Internal2", "Headset Mic", | ||
| 61 | "MIC BIAS External1", "Secondary Mic", | ||
| 62 | "AMIC1", "MIC BIAS External1", | ||
| 63 | "AMIC2", "MIC BIAS Internal2", | ||
| 64 | "AMIC3", "MIC BIAS External1", | ||
| 65 | "DMIC1", "MIC BIAS Internal1", | ||
| 66 | "MIC BIAS Internal1", "Digital Mic1", | ||
| 67 | "DMIC2", "MIC BIAS Internal1", | ||
| 68 | "MIC BIAS Internal1", "Digital Mic2"; | ||
| 69 | |||
| 40 | /* I2S - Internal codec */ | 70 | /* I2S - Internal codec */ |
| 41 | internal-dai-link@0 { | 71 | internal-dai-link@0 { |
| 42 | cpu { /* PRIMARY */ | 72 | cpu { /* PRIMARY */ |
| @@ -1,75 +0,0 @@ | |||
| 1 | Renesas Sampling Rate Convert Sound Card: | ||
| 2 | |||
| 3 | Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC <-> codec. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "renesas,rsrc-card{,<board>}" | ||
| 8 | Examples with boards are: | ||
| 9 | - "renesas,rsrc-card" | ||
| 10 | - "renesas,rsrc-card,lager" | ||
| 11 | - "renesas,rsrc-card,koelsch" | ||
| 12 | Optional properties: | ||
| 13 | |||
| 14 | - card_name : User specified audio sound card name, one string | ||
| 15 | property. | ||
| 16 | - cpu : CPU sub-node | ||
| 17 | - codec : CODEC sub-node | ||
| 18 | |||
| 19 | Optional subnode properties: | ||
| 20 | |||
| 21 | - format : CPU/CODEC common audio format. | ||
| 22 | "i2s", "right_j", "left_j" , "dsp_a" | ||
| 23 | "dsp_b", "ac97", "pdm", "msb", "lsb" | ||
| 24 | - frame-master : Indicates dai-link frame master. | ||
| 25 | phandle to a cpu or codec subnode. | ||
| 26 | - bitclock-master : Indicates dai-link bit clock master. | ||
| 27 | phandle to a cpu or codec subnode. | ||
| 28 | - bitclock-inversion : bool property. Add this if the | ||
| 29 | dai-link uses bit clock inversion. | ||
| 30 | - frame-inversion : bool property. Add this if the | ||
| 31 | dai-link uses frame clock inversion. | ||
| 32 | - convert-rate : platform specified sampling rate convert | ||
| 33 | - convert-channels : platform specified converted channel size (2 - 8 ch) | ||
| 34 | - audio-prefix : see audio-routing | ||
| 35 | - audio-routing : A list of the connections between audio components. | ||
| 36 | Each entry is a pair of strings, the first being the connection's sink, | ||
| 37 | the second being the connection's source. Valid names for sources. | ||
| 38 | use audio-prefix if some components is using same sink/sources naming. | ||
| 39 | it can be used if compatible was "renesas,rsrc-card"; | ||
| 40 | |||
| 41 | Required CPU/CODEC subnodes properties: | ||
| 42 | |||
| 43 | - sound-dai : phandle and port of CPU/CODEC | ||
| 44 | |||
| 45 | Optional CPU/CODEC subnodes properties: | ||
| 46 | |||
| 47 | - clocks / system-clock-frequency : specify subnode's clock if needed. | ||
| 48 | it can be specified via "clocks" if system has | ||
| 49 | clock node (= common clock), or "system-clock-frequency" | ||
| 50 | (if system doens't support common clock) | ||
| 51 | If a clock is specified, it is | ||
| 52 | enabled with clk_prepare_enable() | ||
| 53 | in dai startup() and disabled with | ||
| 54 | clk_disable_unprepare() in dai | ||
| 55 | shutdown(). | ||
| 56 | |||
| 57 | Example | ||
| 58 | |||
| 59 | sound { | ||
| 60 | compatible = "renesas,rsrc-card,lager"; | ||
| 61 | |||
| 62 | card-name = "rsnd-ak4643"; | ||
| 63 | format = "left_j"; | ||
| 64 | bitclock-master = <&sndcodec>; | ||
| 65 | frame-master = <&sndcodec>; | ||
| 66 | |||
| 67 | sndcpu: cpu { | ||
| 68 | sound-dai = <&rcar_sound>; | ||
| 69 | }; | ||
| 70 | |||
| 71 | sndcodec: codec { | ||
| 72 | sound-dai = <&ak4643>; | ||
| 73 | system-clock-frequency = <11289600>; | ||
| 74 | }; | ||
| 75 | }; | ||
| @@ -0,0 +1,22 @@ | |||
| 1 | ROCKCHIP with MAX98357A/RT5514/DA7219 codecs on GRU boards | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: "rockchip,rk3399-gru-sound" | ||
| 5 | - rockchip,cpu: The phandle of the Rockchip I2S controller that's | ||
| 6 | connected to the codecs | ||
| 7 | - rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs | ||
| 8 | |||
| 9 | Optional properties: | ||
| 10 | - dmic-wakeup-delay-ms : specify delay time (ms) for DMIC ready. | ||
| 11 | If this option is specified, which means it's required dmic need | ||
| 12 | delay for DMIC to ready so that rt5514 can avoid recording before | ||
| 13 | DMIC send valid data | ||
| 14 | |||
| 15 | Example: | ||
| 16 | |||
| 17 | sound { | ||
| 18 | compatible = "rockchip,rk3399-gru-sound"; | ||
| 19 | rockchip,cpu = <&i2s0>; | ||
| 20 | rockchip,codec = <&max98357a &rt5514 &da7219>; | ||
| 21 | dmic-wakeup-delay-ms = <20>; | ||
| 22 | }; | ||
| @@ -12,6 +12,9 @@ Required properties: · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | Optional properties: | 13 | Optional properties: |
| 14 | 14 | ||
| 15 | - clocks: The phandle of the master clock to the CODEC | ||
| 16 | - clock-names: Should be "mclk" | ||
| 17 | |||
| 15 | - realtek,in1-differential | 18 | - realtek,in1-differential |
| 16 | - realtek,in3-differential | 19 | - realtek,in3-differential |
| 17 | - realtek,in4-differential | 20 | - realtek,in4-differential |
| @@ -0,0 +1,47 @@ | |||
| 1 | RT5660 audio CODEC | ||
| 2 | |||
| 3 | This device supports I2C only. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "realtek,rt5660". | ||
| 8 | |||
| 9 | - reg : The I2C address of the device. | ||
| 10 | |||
| 11 | Optional properties: | ||
| 12 | |||
| 13 | - clocks: The phandle of the master clock to the CODEC | ||
| 14 | - clock-names: Should be "mclk" | ||
| 15 | |||
| 16 | - realtek,in1-differential | ||
| 17 | - realtek,in3-differential | ||
| 18 | Boolean. Indicate MIC1/3 input are differential, rather than single-ended. | ||
| 19 | |||
| 20 | - realtek,poweroff-in-suspend | ||
| 21 | Boolean. If the codec will be powered off in suspend, the resume should be | ||
| 22 | added delay time for waiting codec power ready. | ||
| 23 | |||
| 24 | - realtek,dmic1-data-pin | ||
| 25 | 0: dmic1 is not used | ||
| 26 | 1: using GPIO2 pin as dmic1 data pin | ||
| 27 | 2: using IN1P pin as dmic1 data pin | ||
| 28 | |||
| 29 | Pins on the device (for linking into audio routes) for RT5660: | ||
| 30 | |||
| 31 | * DMIC L1 | ||
| 32 | * DMIC R1 | ||
| 33 | * IN1P | ||
| 34 | * IN1N | ||
| 35 | * IN2P | ||
| 36 | * IN3P | ||
| 37 | * IN3N | ||
| 38 | * SPO | ||
| 39 | * LOUTL | ||
| 40 | * LOUTR | ||
| 41 | |||
| 42 | Example: | ||
| 43 | |||
| 44 | rt5660 { | ||
| 45 | compatible = "realtek,rt5660"; | ||
| 46 | reg = <0x1c>; | ||
| 47 | }; | ||
| @@ -0,0 +1,30 @@ | |||
| 1 | RT5663/RT5668 audio CODEC | ||
| 2 | |||
| 3 | This device supports I2C only. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : One of "realtek,rt5663" or "realtek,rt5668". | ||
| 8 | |||
| 9 | - reg : The I2C address of the device. | ||
| 10 | |||
| 11 | - interrupts : The CODEC's interrupt output. | ||
| 12 | |||
| 13 | Optional properties: | ||
| 14 | |||
| 15 | Pins on the device (for linking into audio routes) for RT5663/RT5668: | ||
| 16 | |||
| 17 | * IN1P | ||
| 18 | * IN1N | ||
| 19 | * IN2P | ||
| 20 | * IN2N | ||
| 21 | * HPOL | ||
| 22 | * HPOR | ||
| 23 | |||
| 24 | Example: | ||
| 25 | |||
| 26 | codec: rt5663@12 { | ||
| 27 | compatible = "realtek,rt5663"; | ||
| 28 | reg = <0x12>; | ||
| 29 | interrupts = <7 IRQ_TYPE_EDGE_FALLING>; | ||
| 30 | }; | ||
| @@ -22,6 +22,8 @@ Optional properties: · 21 unmodified lines | |||
| 22 | headphones are attached. | 22 | headphones are attached. |
| 23 | - simple-audio-card,mic-det-gpio : Reference to GPIO that signals when | 23 | - simple-audio-card,mic-det-gpio : Reference to GPIO that signals when |
| 24 | a microphone is attached. | 24 | a microphone is attached. |
| 25 | - simple-audio-card,aux-devs : List of phandles pointing to auxiliary devices, such | ||
| 26 | as amplifiers, to be added to the sound card. | ||
| 25 | 27 | ||
| 26 | Optional subnodes: | 28 | Optional subnodes: |
| 27 | 29 | ||
| @@ -162,3 +164,38 @@ sound { · 134 unmodified lines | |||
| 162 | }; | 164 | }; |
| 163 | }; | 165 | }; |
| 164 | }; | 166 | }; |
| 167 | |||
| 168 | Example 3 - route audio from IMX6 SSI2 through TLV320DAC3100 codec | ||
| 169 | through TPA6130A2 amplifier to headphones: | ||
| 170 | |||
| 171 | &i2c0 { | ||
| 172 | codec: tlv320dac3100@18 { | ||
| 173 | compatible = "ti,tlv320dac3100"; | ||
| 174 | ... | ||
| 175 | } | ||
| 176 | |||
| 177 | amp: tpa6130a2@60 { | ||
| 178 | compatible = "ti,tpa6130a2"; | ||
| 179 | ... | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | sound { | ||
| 184 | compatible = "simple-audio-card"; | ||
| 185 | ... | ||
| 186 | simple-audio-card,widgets = | ||
| 187 | "Headphone", "Headphone Jack"; | ||
| 188 | simple-audio-card,routing = | ||
| 189 | "Headphone Jack", "HPLEFT", | ||
| 190 | "Headphone Jack", "HPRIGHT", | ||
| 191 | "LEFTIN", "HPL", | ||
| 192 | "RIGHTIN", "HPR"; | ||
| 193 | simple-audio-card,aux-devs = <&>; | ||
| 194 | simple-audio-card,cpu { | ||
| 195 | sound-dai = <&ssi2>; | ||
| 196 | }; | ||
| 197 | simple-audio-card,codec { | ||
| 198 | sound-dai = <&codec>; | ||
| 199 | clocks = ... | ||
| 200 | }; | ||
| 201 | }; | ||
| @@ -0,0 +1,110 @@ | |||
| 1 | ASoC simple SCU Sound Card | ||
| 2 | |||
| 3 | Simple-Card specifies audio DAI connections of SoC <-> codec. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "simple-scu-audio-card" | ||
| 8 | "renesas,rsrc-card" | ||
| 9 | |||
| 10 | Optional properties: | ||
| 11 | |||
| 12 | - simple-audio-card,name : User specified audio sound card name, one string | ||
| 13 | property. | ||
| 14 | - simple-audio-card,cpu : CPU sub-node | ||
| 15 | - simple-audio-card,codec : CODEC sub-node | ||
| 16 | |||
| 17 | Optional subnode properties: | ||
| 18 | |||
| 19 | - simple-audio-card,format : CPU/CODEC common audio format. | ||
| 20 | "i2s", "right_j", "left_j" , "dsp_a" | ||
| 21 | "dsp_b", "ac97", "pdm", "msb", "lsb" | ||
| 22 | - simple-audio-card,frame-master : Indicates dai-link frame master. | ||
| 23 | phandle to a cpu or codec subnode. | ||
| 24 | - simple-audio-card,bitclock-master : Indicates dai-link bit clock master. | ||
| 25 | phandle to a cpu or codec subnode. | ||
| 26 | - simple-audio-card,bitclock-inversion : bool property. Add this if the | ||
| 27 | dai-link uses bit clock inversion. | ||
| 28 | - simple-audio-card,frame-inversion : bool property. Add this if the | ||
| 29 | dai-link uses frame clock inversion. | ||
| 30 | - simple-audio-card,convert-rate : platform specified sampling rate convert | ||
| 31 | - simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch) | ||
| 32 | - simple-audio-card,prefix : see audio-routing | ||
| 33 | - simple-audio-card,routing : A list of the connections between audio components. | ||
| 34 | Each entry is a pair of strings, the first being the connection's sink, | ||
| 35 | the second being the connection's source. Valid names for sources. | ||
| 36 | use audio-prefix if some components is using same sink/sources naming. | ||
| 37 | it can be used if compatible was "renesas,rsrc-card"; | ||
| 38 | |||
| 39 | Required CPU/CODEC subnodes properties: | ||
| 40 | |||
| 41 | - sound-dai : phandle and port of CPU/CODEC | ||
| 42 | |||
| 43 | Optional CPU/CODEC subnodes properties: | ||
| 44 | |||
| 45 | - clocks / system-clock-frequency : specify subnode's clock if needed. | ||
| 46 | it can be specified via "clocks" if system has | ||
| 47 | clock node (= common clock), or "system-clock-frequency" | ||
| 48 | (if system doens't support common clock) | ||
| 49 | If a clock is specified, it is | ||
| 50 | enabled with clk_prepare_enable() | ||
| 51 | in dai startup() and disabled with | ||
| 52 | clk_disable_unprepare() in dai | ||
| 53 | shutdown(). | ||
| 54 | |||
| 55 | Example 1. Sampling Rate Covert | ||
| 56 | |||
| 57 | sound { | ||
| 58 | compatible = "simple-scu-audio-card"; | ||
| 59 | |||
| 60 | simple-audio-card,name = "rsnd-ak4643"; | ||
| 61 | simple-audio-card,format = "left_j"; | ||
| 62 | simple-audio-card,format = "left_j"; | ||
| 63 | simple-audio-card,bitclock-master = <&sndcodec>; | ||
| 64 | simple-audio-card,frame-master = <&sndcodec>; | ||
| 65 | |||
| 66 | simple-audio-card,convert-rate = <48000>; /* see audio_clk_a */ | ||
| 67 | |||
| 68 | simple-audio-card,prefix = "ak4642"; | ||
| 69 | simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback", | ||
| 70 | "DAI0 Capture", "ak4642 Capture"; | ||
| 71 | |||
| 72 | sndcpu: simple-audio-card,cpu { | ||
| 73 | sound-dai = <&rcar_sound>; | ||
| 74 | }; | ||
| 75 | |||
| 76 | sndcodec: simple-audio-card,codec { | ||
| 77 | sound-dai = <&ak4643>; | ||
| 78 | system-clock-frequency = <11289600>; | ||
| 79 | }; | ||
| 80 | }; | ||
| 81 | |||
| 82 | Example 2. 2 CPU 1 Codec | ||
| 83 | |||
| 84 | sound { | ||
| 85 | compatible = "renesas,rsrc-card"; | ||
| 86 | |||
| 87 | card-name = "rsnd-ak4643"; | ||
| 88 | format = "left_j"; | ||
| 89 | bitclock-master = <&dpcmcpu>; | ||
| 90 | frame-master = <&dpcmcpu>; | ||
| 91 | |||
| 92 | convert-rate = <48000>; /* see audio_clk_a */ | ||
| 93 | |||
| 94 | audio-prefix = "ak4642"; | ||
| 95 | audio-routing = "ak4642 Playback", "DAI0 Playback", | ||
| 96 | "ak4642 Playback", "DAI1 Playback"; | ||
| 97 | |||
| 98 | dpcmcpu: cpu@0 { | ||
| 99 | sound-dai = <&rcar_sound 0>; | ||
| 100 | }; | ||
| 101 | |||
| 102 | cpu@1 { | ||
| 103 | sound-dai = <&rcar_sound 1>; | ||
| 104 | }; | ||
| 105 | |||
| 106 | codec { | ||
| 107 | sound-dai = <&ak4643>; | ||
| 108 | clocks = <&audio_clock>; | ||
| 109 | }; | ||
| 110 | }; | ||
| @@ -11,7 +11,9 @@ Documentation/devicetree/bindings/sound/simple-card.txt. · 10 unmodified lines | |||
| 11 | --------------------------------------- | 11 | --------------------------------------- |
| 12 | 12 | ||
| 13 | Required properties: | 13 | Required properties: |
| 14 | - compatible: "st,sti-uni-player" or "st,sti-uni-reader" | 14 | - compatible: "st,stih407-uni-player-hdmi", "st,stih407-uni-player-pcm-out", |
| 15 | "st,stih407-uni-player-dac", "st,stih407-uni-player-spdif", | ||
| 16 | "st,stih407-uni-reader-pcm_in", "st,stih407-uni-reader-hdmi", | ||
| 15 | 17 | ||
| 16 | - st,syscfg: phandle to boot-device system configuration registers | 18 | - st,syscfg: phandle to boot-device system configuration registers |
| 17 | 19 | ||
| @@ -33,32 +35,24 @@ Required properties: · 15 unmodified lines | |||
| 33 | "tx" for "st,sti-uni-player" compatibility | 35 | "tx" for "st,sti-uni-player" compatibility |
| 34 | "rx" for "st,sti-uni-reader" compatibility | 36 | "rx" for "st,sti-uni-reader" compatibility |
| 35 | 37 | ||
| 36 | - st,version: IP version integrated in SOC. | ||
| 37 | |||
| 38 | - dai-name: DAI name that describes the IP. | ||
| 39 | |||
| 40 | - st,mode: IP working mode depending on associated codec. | ||
| 41 | "HDMI" connected to HDMI codec and support IEC HDMI formats (player only). | ||
| 42 | "SPDIF" connected to SPDIF codec and support SPDIF formats (player only). | ||
| 43 | "PCM" PCM standard mode for I2S or TDM bus. | ||
| 44 | "TDM" TDM mode for TDM bus. | ||
| 45 | |||
| 46 | Required properties ("st,sti-uni-player" compatibility only): | 38 | Required properties ("st,sti-uni-player" compatibility only): |
| 47 | - clocks: CPU_DAI IP clock source, listed in the same order than the | 39 | - clocks: CPU_DAI IP clock source, listed in the same order than the |
| 48 | CPU_DAI properties. | 40 | CPU_DAI properties. |
| 49 | 41 | ||
| 50 | - st,uniperiph-id: internal SOC IP instance ID. | ||
| 51 | |||
| 52 | Optional properties: | 42 | Optional properties: |
| 53 | - pinctrl-0: defined for CPU_DAI@1 and CPU_DAI@4 to describe I2S PIOs for | 43 | - pinctrl-0: defined for CPU_DAI@1 and CPU_DAI@4 to describe I2S PIOs for |
| 54 | external codecs connection. | 44 | external codecs connection. |
| 55 | 45 | ||
| 56 | - pinctrl-names: should contain only one value - "default". | 46 | - pinctrl-names: should contain only one value - "default". |
| 57 | 47 | ||
| 48 | - st,tdm-mode: to declare to set TDM mode for unireader and uniplayer IPs. | ||
| 49 | Only compartible with IPs in charge of the external I2S/TDM bus. | ||
| 50 | Should be declared depending on associated codec. | ||
| 51 | |||
| 58 | Example: | 52 | Example: |
| 59 | 53 | ||
| 60 | sti_uni_player1: sti-uni-player@1 { | 54 | sti_uni_player1: sti-uni-player@0x8D81000 { |
| 61 | compatible = "st,sti-uni-player"; | 55 | compatible = "st,stih407-uni-player-hdmi"; |
| 62 | status = "okay"; | 56 | status = "okay"; |
| 63 | #sound-dai-cells = <0>; | 57 | #sound-dai-cells = <0>; |
| 64 | st,syscfg = <&syscfg_core>; | 58 | st,syscfg = <&syscfg_core>; |
| @@ -66,15 +60,12 @@ Example: · 1 unmodified line | |||
| 66 | reg = <0x8D81000 0x158>; | 60 | reg = <0x8D81000 0x158>; |
| 67 | interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>; | 61 | interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>; |
| 68 | dmas = <&fdma0 3 0 1>; | 62 | dmas = <&fdma0 3 0 1>; |
| 69 | st,dai-name = "Uni Player #1 (I2S)"; | ||
| 70 | dma-names = "tx"; | 63 | dma-names = "tx"; |
| 71 | st,uniperiph-id = <1>; | 64 | st,tdm-mode = <1>; |
| 72 | st,version = <5>; | ||
| 73 | st,mode = "TDM"; | ||
| 74 | }; | 65 | }; |
| 75 | 66 | ||
| 76 | sti_uni_player2: sti-uni-player@2 { | 67 | sti_uni_player2: sti-uni-player@0x8D82000 { |
| 77 | compatible = "st,sti-uni-player"; | 68 | compatible = "st,stih407-uni-player-pcm-out"; |
| 78 | status = "okay"; | 69 | status = "okay"; |
| 79 | #sound-dai-cells = <0>; | 70 | #sound-dai-cells = <0>; |
| 80 | st,syscfg = <&syscfg_core>; | 71 | st,syscfg = <&syscfg_core>; |
| @@ -82,15 +73,11 @@ Example: · 1 unmodified line | |||
| 82 | reg = <0x8D82000 0x158>; | 73 | reg = <0x8D82000 0x158>; |
| 83 | interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>; | 74 | interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>; |
| 84 | dmas = <&fdma0 4 0 1>; | 75 | dmas = <&fdma0 4 0 1>; |
| 85 | dai-name = "Uni Player #2 (DAC)"; | ||
| 86 | dma-names = "tx"; | 76 | dma-names = "tx"; |
| 87 | st,uniperiph-id = <2>; | ||
| 88 | st,version = <5>; | ||
| 89 | st,mode = "PCM"; | ||
| 90 | }; | 77 | }; |
| 91 | 78 | ||
| 92 | sti_uni_player3: sti-uni-player@3 { | 79 | sti_uni_player3: sti-uni-player@0x8D85000 { |
| 93 | compatible = "st,sti-uni-player"; | 80 | compatible = "st,stih407-uni-player-spdif"; |
| 94 | status = "okay"; | 81 | status = "okay"; |
| 95 | #sound-dai-cells = <0>; | 82 | #sound-dai-cells = <0>; |
| 96 | st,syscfg = <&syscfg_core>; | 83 | st,syscfg = <&syscfg_core>; |
| @@ -99,14 +86,10 @@ Example: · 2 unmodified lines | |||
| 99 | interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>; | 86 | interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>; |
| 100 | dmas = <&fdma0 7 0 1>; | 87 | dmas = <&fdma0 7 0 1>; |
| 101 | dma-names = "tx"; | 88 | dma-names = "tx"; |
| 102 | dai-name = "Uni Player #3 (SPDIF)"; | ||
| 103 | st,uniperiph-id = <3>; | ||
| 104 | st,version = <5>; | ||
| 105 | st,mode = "SPDIF"; | ||
| 106 | }; | 89 | }; |
| 107 | 90 | ||
| 108 | sti_uni_reader1: sti-uni-reader@1 { | 91 | sti_uni_reader1: sti-uni-reader@0x8D84000 { |
| 109 | compatible = "st,sti-uni-reader"; | 92 | compatible = "st,stih407-uni-reader-hdmi"; |
| 110 | status = "disabled"; | 93 | status = "disabled"; |
| 111 | #sound-dai-cells = <0>; | 94 | #sound-dai-cells = <0>; |
| 112 | st,syscfg = <&syscfg_core>; | 95 | st,syscfg = <&syscfg_core>; |
| @@ -114,9 +97,6 @@ Example: · 1 unmodified line | |||
| 114 | interrupts = <GIC_SPI 88 IRQ_TYPE_NONE>; | 97 | interrupts = <GIC_SPI 88 IRQ_TYPE_NONE>; |
| 115 | dmas = <&fdma0 6 0 1>; | 98 | dmas = <&fdma0 6 0 1>; |
| 116 | dma-names = "rx"; | 99 | dma-names = "rx"; |
| 117 | dai-name = "Uni Reader #1 (HDMI RX)"; | ||
| 118 | st,version = <3>; | ||
| 119 | st,mode = "PCM"; | ||
| 120 | }; | 100 | }; |
| 121 | 101 | ||
| 122 | 2) sti-sas-codec: internal audio codec IPs driver | 102 | 2) sti-sas-codec: internal audio codec IPs driver |
| @@ -9,6 +9,7 @@ Required properties: · 8 unmodified lines | |||
| 9 | 9 | ||
| 10 | - compatible : should be one of the following: | 10 | - compatible : should be one of the following: |
| 11 | - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC | 11 | - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC |
| 12 | - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC | ||
| 12 | 13 | ||
| 13 | - reg : Offset and length of the register set for the device. | 14 | - reg : Offset and length of the register set for the device. |
| 14 | 15 | ||
| @@ -25,6 +26,8 @@ Required properties: · 10 unmodified lines | |||
| 25 | "apb" clock for the spdif bus. | 26 | "apb" clock for the spdif bus. |
| 26 | "spdif" clock for spdif controller. | 27 | "spdif" clock for spdif controller. |
| 27 | 28 | ||
| 29 | - resets : reset specifier for the ahb reset (A31 and newer only) | ||
| 30 | |||
| 28 | Example: | 31 | Example: |
| 29 | 32 | ||
| 30 | spdif: spdif@01c21000 { | 33 | spdif: spdif@01c21000 { |
| @@ -11,6 +11,7 @@ Required properties: · 10 unmodified lines | |||
| 11 | "ti,tlv320aic3110" - TLV320AIC3110 (stereo speaker amp, no MiniDSP) | 11 | "ti,tlv320aic3110" - TLV320AIC3110 (stereo speaker amp, no MiniDSP) |
| 12 | "ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP) | 12 | "ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP) |
| 13 | "ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP) | 13 | "ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP) |
| 14 | "ti,tlv320dac3100" - TLV320DAC3100 (no ADC, mono speaker amp, no MiniDSP) | ||
| 14 | 15 | ||
| 15 | - reg - <int> - I2C slave address | 16 | - reg - <int> - I2C slave address |
| 16 | - HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply, | 17 | - HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply, |
| @@ -37,9 +38,11 @@ CODEC output pins: · 20 unmodified lines | |||
| 37 | * MICBIAS | 38 | * MICBIAS |
| 38 | 39 | ||
| 39 | CODEC input pins: | 40 | CODEC input pins: |
| 40 | * MIC1LP | 41 | * MIC1LP, devices with ADC |
| 41 | * MIC1RP | 42 | * MIC1RP, devices with ADC |
| 42 | * MIC1LM | 43 | * MIC1LM, devices with ADC |
| 44 | * AIN1, devices without ADC | ||
| 45 | * AIN2, devices without ADC | ||
| 43 | 46 | ||
| 44 | The pins can be used in referring sound node's audio-routing property. | 47 | The pins can be used in referring sound node's audio-routing property. |
| 45 | 48 | ||
| @@ -62,7 +62,7 @@ For more examples of cooling devices, refer to the example sections below. · 61 unmodified lines | |||
| 62 | Required properties: | 62 | Required properties: |
| 63 | - #cooling-cells: Used to provide cooling device specific information | 63 | - #cooling-cells: Used to provide cooling device specific information |
| 64 | Type: unsigned while referring to it. Must be at least 2, in order | 64 | Type: unsigned while referring to it. Must be at least 2, in order |
| 65 | Size: one cell to specify minimum and maximum cooling state used | 65 | Size: one cell to specify minimum and maximum cooling state used |
| 66 | in the reference. The first cell is the minimum | 66 | in the reference. The first cell is the minimum |
| 67 | cooling state requested and the second cell is | 67 | cooling state requested and the second cell is |
| 68 | the maximum cooling state requested in the reference. | 68 | the maximum cooling state requested in the reference. |
| @@ -119,7 +119,7 @@ Required properties: · 50 unmodified lines | |||
| 119 | Optional property: | 119 | Optional property: |
| 120 | - contribution: The cooling contribution to the thermal zone of the | 120 | - contribution: The cooling contribution to the thermal zone of the |
| 121 | Type: unsigned referred cooling device at the referred trip point. | 121 | Type: unsigned referred cooling device at the referred trip point. |
| 122 | Size: one cell The contribution is a ratio of the sum | 122 | Size: one cell The contribution is a ratio of the sum |
| 123 | of all cooling contributions within a thermal zone. | 123 | of all cooling contributions within a thermal zone. |
| 124 | 124 | ||
| 125 | Note: Using the THERMAL_NO_LIMIT (-1UL) constant in the cooling-device phandle | 125 | Note: Using the THERMAL_NO_LIMIT (-1UL) constant in the cooling-device phandle |
| @@ -145,7 +145,7 @@ Required properties: · 19 unmodified lines | |||
| 145 | Size: one cell | 145 | Size: one cell |
| 146 | 146 | ||
| 147 | - thermal-sensors: A list of thermal sensor phandles and sensor specifier | 147 | - thermal-sensors: A list of thermal sensor phandles and sensor specifier |
| 148 | Type: list of used while monitoring the thermal zone. | 148 | Type: list of used while monitoring the thermal zone. |
| 149 | phandles + sensor | 149 | phandles + sensor |
| 150 | specifier | 150 | specifier |
| 151 | 151 | ||
| @@ -473,7 +473,7 @@ thermal-zones { · 321 unmodified lines | |||
| 473 | <&adc>; /* pcb north */ | 473 | <&adc>; /* pcb north */ |
| 474 | 474 | ||
| 475 | /* hotspot = 100 * bandgap - 120 * adc + 484 */ | 475 | /* hotspot = 100 * bandgap - 120 * adc + 484 */ |
| 476 | coefficients = <100 -120 484>; | 476 | coefficients = <100 -120 484>; |
| 477 | 477 | ||
| 478 | trips { | 478 | trips { |
| 479 | ... | 479 | ... |
| @@ -502,7 +502,7 @@ from the ADC sensor. The binding would be then: · 22 unmodified lines | |||
| 502 | thermal-sensors = <&adc>; | 502 | thermal-sensors = <&adc>; |
| 503 | 503 | ||
| 504 | /* hotspot = 1 * adc + 6000 */ | 504 | /* hotspot = 1 * adc + 6000 */ |
| 505 | coefficients = <1 6000>; | 505 | coefficients = <1 6000>; |
| 506 | 506 | ||
| 507 | (d) - Board thermal | 507 | (d) - Board thermal |
| 508 | 508 | ||
| @@ -183,12 +183,10 @@ The copy_up operation essentially creates a new, identical file and · 182 unmodified lines | |||
| 183 | moves it over to the old name. The new file may be on a different | 183 | moves it over to the old name. The new file may be on a different |
| 184 | filesystem, so both st_dev and st_ino of the file may change. | 184 | filesystem, so both st_dev and st_ino of the file may change. |
| 185 | 185 | ||
| 186 | Any open files referring to this inode will access the old data and | 186 | Any open files referring to this inode will access the old data. |
| 187 | metadata. Similarly any file locks obtained before copy_up will not | ||
| 188 | apply to the copied up file. | ||
| 189 | 187 | ||
| 190 | On a file opened with O_RDONLY fchmod(2), fchown(2), futimesat(2) and | 188 | Any file locks (and leases) obtained before copy_up will not apply |
| 191 | fsetxattr(2) will fail with EROFS. | 189 | to the copied up file. |
| 192 | 190 | ||
| 193 | If a file with multiple hard links is copied up, then this will | 191 | If a file with multiple hard links is copied up, then this will |
| 194 | "break" the link. Changes will not be propagated to other names | 192 | "break" the link. Changes will not be propagated to other names |
| @@ -145,6 +145,11 @@ If you want to add slave support to the bus driver: · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | * Catch the slave interrupts and send appropriate i2c_slave_events to the backend. | 146 | * Catch the slave interrupts and send appropriate i2c_slave_events to the backend. |
| 147 | 147 | ||
| 148 | Note that most hardware supports being master _and_ slave on the same bus. So, | ||
| 149 | if you extend a bus driver, please make sure that the driver supports that as | ||
| 150 | well. In almost all cases, slave support does not need to disable the master | ||
| 151 | functionality. | ||
| 152 | |||
| 148 | Check the i2c-rcar driver as an example. | 153 | Check the i2c-rcar driver as an example. |
| 149 | 154 | ||
| 150 | 155 | ||
| @@ -3032,6 +3032,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 3031 unmodified lines | |||
| 3032 | PAGE_SIZE is used as alignment. | 3032 | PAGE_SIZE is used as alignment. |
| 3033 | PCI-PCI bridge can be specified, if resource | 3033 | PCI-PCI bridge can be specified, if resource |
| 3034 | windows need to be expanded. | 3034 | windows need to be expanded. |
| 3035 | To specify the alignment for several | ||
| 3036 | instances of a device, the PCI vendor, | ||
| 3037 | device, subvendor, and subdevice may be | ||
| 3038 | specified, e.g., 4096@pci:8086:9c22:103c:198f | ||
| 3035 | ecrc= Enable/disable PCIe ECRC (transaction layer | 3039 | ecrc= Enable/disable PCIe ECRC (transaction layer |
| 3036 | end-to-end CRC checking). | 3040 | end-to-end CRC checking). |
| 3037 | bios: Use BIOS/firmware settings. This is the | 3041 | bios: Use BIOS/firmware settings. This is the |
| @@ -144,7 +144,7 @@ logical address types are already defined will return with error ``EBUSY``. · 143 unmodified lines | |||
| 144 | 144 | ||
| 145 | - ``flags`` | 145 | - ``flags`` |
| 146 | 146 | ||
| 147 | - Flags. No flags are defined yet, so set this to 0. | 147 | - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags. |
| 148 | 148 | ||
| 149 | - .. row 7 | 149 | - .. row 7 |
| 150 | 150 | ||
| @@ -201,6 +201,25 @@ logical address types are already defined will return with error ``EBUSY``. · 50 unmodified lines | |||
| 201 | give the CEC framework more information about the device type, even | 201 | give the CEC framework more information about the device type, even |
| 202 | though the framework won't use it directly in the CEC message. | 202 | though the framework won't use it directly in the CEC message. |
| 203 | 203 | ||
| 204 | .. _cec-log-addrs-flags: | ||
| 205 | |||
| 206 | .. flat-table:: Flags for struct cec_log_addrs | ||
| 207 | :header-rows: 0 | ||
| 208 | :stub-columns: 0 | ||
| 209 | :widths: 3 1 4 | ||
| 210 | |||
| 211 | |||
| 212 | - .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`: | ||
| 213 | |||
| 214 | - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK`` | ||
| 215 | |||
| 216 | - 1 | ||
| 217 | |||
| 218 | - By default if no logical address of the requested type can be claimed, then | ||
| 219 | it will go back to the unconfigured state. If this flag is set, then it will | ||
| 220 | fallback to the Unregistered logical address. Note that if the Unregistered | ||
| 221 | logical address was explicitly requested, then this flag has no effect. | ||
| 222 | |||
| 204 | .. _cec-versions: | 223 | .. _cec-versions: |
| 205 | 224 | ||
| 206 | .. flat-table:: CEC Versions | 225 | .. flat-table:: CEC Versions |
| @@ -64,7 +64,8 @@ it is guaranteed that the state did change in between the two events. · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | - ``phys_addr`` | 65 | - ``phys_addr`` |
| 66 | 66 | ||
| 67 | - The current physical address. | 67 | - The current physical address. This is ``CEC_PHYS_ADDR_INVALID`` if no |
| 68 | valid physical address is set. | ||
| 68 | 69 | ||
| 69 | - .. row 2 | 70 | - .. row 2 |
| 70 | 71 | ||
| @@ -72,7 +73,10 @@ it is guaranteed that the state did change in between the two events. · 1 unmodified line | |||
| 72 | 73 | ||
| 73 | - ``log_addr_mask`` | 74 | - ``log_addr_mask`` |
| 74 | 75 | ||
| 75 | - The current set of claimed logical addresses. | 76 | - The current set of claimed logical addresses. This is 0 if no logical |
| 77 | addresses are claimed or if ``phys_addr`` is ``CEC_PHYS_ADDR_INVALID``. | ||
| 78 | If bit 15 is set (``1 << CEC_LOG_ADDR_UNREGISTERED``) then this device | ||
| 79 | has the unregistered logical address. In that case all other bits are 0. | ||
| 76 | 80 | ||
| 77 | 81 | ||
| 78 | 82 | ||
| @@ -587,26 +587,6 @@ of DSA, would be the its port-based VLAN, used by the associated bridge device. · 586 unmodified lines | |||
| 587 | TODO | 587 | TODO |
| 588 | ==== | 588 | ==== |
| 589 | 589 | ||
| 590 | The platform device problem | ||
| 591 | --------------------------- | ||
| 592 | DSA is currently implemented as a platform device driver which is far from ideal | ||
| 593 | as was discussed in this thread: | ||
| 594 | |||
| 595 | http://permalink.gmane.org/gmane.linux.network/329848 | ||
| 596 | |||
| 597 | This basically prevents the device driver model to be properly used and applied, | ||
| 598 | and support non-MDIO, non-MMIO Ethernet connected switches. | ||
| 599 | |||
| 600 | Another problem with the platform device driver approach is that it prevents the | ||
| 601 | use of a modular switch drivers build due to a circular dependency, illustrated | ||
| 602 | here: | ||
| 603 | |||
| 604 | http://comments.gmane.org/gmane.linux.network/345803 | ||
| 605 | |||
| 606 | Attempts of reworking this has been done here: | ||
| 607 | |||
| 608 | https://lwn.net/Articles/643149/ | ||
| 609 | |||
| 610 | Making SWITCHDEV and DSA converge towards an unified codebase | 590 | Making SWITCHDEV and DSA converge towards an unified codebase |
| 611 | ------------------------------------------------------------- | 591 | ------------------------------------------------------------- |
| 612 | 592 | ||
| @@ -167,6 +167,8 @@ signal will be rolled back anyway. · 166 unmodified lines | |||
| 167 | For signals taken in non-TM or suspended mode, we use the | 167 | For signals taken in non-TM or suspended mode, we use the |
| 168 | normal/non-checkpointed stack pointer. | 168 | normal/non-checkpointed stack pointer. |
| 169 | 169 | ||
| 170 | Any transaction initiated inside a sighandler and suspended on return | ||
| 171 | from the sighandler to the kernel will get reclaimed and discarded. | ||
| 170 | 172 | ||
| 171 | Failure cause codes used by kernel | 173 | Failure cause codes used by kernel |
| 172 | ================================== | 174 | ================================== |
| @@ -80,6 +80,10 @@ functionality of their platform when planning to use this driver: · 79 unmodified lines | |||
| 80 | 80 | ||
| 81 | III. Module parameters | 81 | III. Module parameters |
| 82 | 82 | ||
| 83 | - 'dma_timeout' - DMA transfer completion timeout (in msec, default value 3000). | ||
| 84 | This parameter set a maximum completion wait time for SYNC mode DMA | ||
| 85 | transfer requests and for RIO_WAIT_FOR_ASYNC ioctl requests. | ||
| 86 | |||
| 83 | - 'dbg_level' - This parameter allows to control amount of debug information | 87 | - 'dbg_level' - This parameter allows to control amount of debug information |
| 84 | generated by this device driver. This parameter is formed by set of | 88 | generated by this device driver. This parameter is formed by set of |
| 85 | bit masks that correspond to the specific functional blocks. | 89 | bit masks that correspond to the specific functional blocks. |
| @@ -798,6 +798,7 @@ M: Laura Abbott <labbott@redhat.com> · 797 unmodified lines | |||
| 798 | M: Sumit Semwal <sumit.semwal@linaro.org> | 798 | M: Sumit Semwal <sumit.semwal@linaro.org> |
| 799 | L: devel@driverdev.osuosl.org | 799 | L: devel@driverdev.osuosl.org |
| 800 | S: Supported | 800 | S: Supported |
| 801 | F: Documentation/devicetree/bindings/staging/ion/ | ||
| 801 | F: drivers/staging/android/ion | 802 | F: drivers/staging/android/ion |
| 802 | F: drivers/staging/android/uapi/ion.h | 803 | F: drivers/staging/android/uapi/ion.h |
| 803 | F: drivers/staging/android/uapi/ion_test.h | 804 | F: drivers/staging/android/uapi/ion_test.h |
| @@ -881,6 +882,15 @@ S: Supported · 77 unmodified lines | |||
| 881 | F: drivers/gpu/drm/arc/ | 882 | F: drivers/gpu/drm/arc/ |
| 882 | F: Documentation/devicetree/bindings/display/snps,arcpgu.txt | 883 | F: Documentation/devicetree/bindings/display/snps,arcpgu.txt |
| 883 | 884 | ||
| 885 | ARM ARCHITECTED TIMER DRIVER | ||
| 886 | M: Mark Rutland <mark.rutland@arm.com> | ||
| 887 | M: Marc Zyngier <marc.zyngier@arm.com> | ||
| 888 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 889 | S: Maintained | ||
| 890 | F: arch/arm/include/asm/arch_timer.h | ||
| 891 | F: arch/arm64/include/asm/arch_timer.h | ||
| 892 | F: drivers/clocksource/arm_arch_timer.c | ||
| 893 | |||
| 884 | ARM HDLCD DRM DRIVER | 894 | ARM HDLCD DRM DRIVER |
| 885 | M: Liviu Dudau <liviu.dudau@arm.com> | 895 | M: Liviu Dudau <liviu.dudau@arm.com> |
| 886 | S: Supported | 896 | S: Supported |
| @@ -1614,7 +1624,8 @@ N: rockchip · 727 unmodified lines | |||
| 1614 | 1624 | ||
| 1615 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES | 1625 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES |
| 1616 | M: Kukjin Kim <kgene@kernel.org> | 1626 | M: Kukjin Kim <kgene@kernel.org> |
| 1617 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 1627 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 1628 | R: Javier Martinez Canillas <javier@osg.samsung.com> | ||
| 1618 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1629 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1619 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 1630 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
| 1620 | S: Maintained | 1631 | S: Maintained |
| @@ -1634,7 +1645,6 @@ F: drivers/*/*s3c64xx* · 13 unmodified lines | |||
| 1634 | F: drivers/*/*s5pv210* | 1645 | F: drivers/*/*s5pv210* |
| 1635 | F: drivers/memory/samsung/* | 1646 | F: drivers/memory/samsung/* |
| 1636 | F: drivers/soc/samsung/* | 1647 | F: drivers/soc/samsung/* |
| 1637 | F: drivers/spi/spi-s3c* | ||
| 1638 | F: Documentation/arm/Samsung/ | 1648 | F: Documentation/arm/Samsung/ |
| 1639 | F: Documentation/devicetree/bindings/arm/samsung/ | 1649 | F: Documentation/devicetree/bindings/arm/samsung/ |
| 1640 | F: Documentation/devicetree/bindings/sram/samsung-sram.txt | 1650 | F: Documentation/devicetree/bindings/sram/samsung-sram.txt |
| @@ -1822,6 +1832,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git · 181 unmodified lines | |||
| 1822 | ARM/UNIPHIER ARCHITECTURE | 1832 | ARM/UNIPHIER ARCHITECTURE |
| 1823 | M: Masahiro Yamada <yamada.masahiro@socionext.com> | 1833 | M: Masahiro Yamada <yamada.masahiro@socionext.com> |
| 1824 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1834 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1835 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git | ||
| 1825 | S: Maintained | 1836 | S: Maintained |
| 1826 | F: arch/arm/boot/dts/uniphier* | 1837 | F: arch/arm/boot/dts/uniphier* |
| 1827 | F: arch/arm/include/asm/hardware/cache-uniphier.h | 1838 | F: arch/arm/include/asm/hardware/cache-uniphier.h |
| @@ -2475,7 +2486,7 @@ F: include/net/bluetooth/ · 647 unmodified lines | |||
| 2475 | BONDING DRIVER | 2486 | BONDING DRIVER |
| 2476 | M: Jay Vosburgh <j.vosburgh@gmail.com> | 2487 | M: Jay Vosburgh <j.vosburgh@gmail.com> |
| 2477 | M: Veaceslav Falico <vfalico@gmail.com> | 2488 | M: Veaceslav Falico <vfalico@gmail.com> |
| 2478 | M: Andy Gospodarek <gospo@cumulusnetworks.com> | 2489 | M: Andy Gospodarek <andy@greyhouse.net> |
| 2479 | L: netdev@vger.kernel.org | 2490 | L: netdev@vger.kernel.org |
| 2480 | W: http://sourceforge.net/projects/bonding/ | 2491 | W: http://sourceforge.net/projects/bonding/ |
| 2481 | S: Supported | 2492 | S: Supported |
| @@ -2490,7 +2501,7 @@ S: Supported · 8 unmodified lines | |||
| 2490 | F: kernel/bpf/ | 2501 | F: kernel/bpf/ |
| 2491 | 2502 | ||
| 2492 | BROADCOM B44 10/100 ETHERNET DRIVER | 2503 | BROADCOM B44 10/100 ETHERNET DRIVER |
| 2493 | M: Gary Zambrano <zambrano@broadcom.com> | 2504 | M: Michael Chan <michael.chan@broadcom.com> |
| 2494 | L: netdev@vger.kernel.org | 2505 | L: netdev@vger.kernel.org |
| 2495 | S: Supported | 2506 | S: Supported |
| 2496 | F: drivers/net/ethernet/broadcom/b44.* | 2507 | F: drivers/net/ethernet/broadcom/b44.* |
| @@ -3238,7 +3249,7 @@ F: kernel/cpuset.c · 741 unmodified lines | |||
| 3238 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) | 3249 | CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) |
| 3239 | M: Johannes Weiner <hannes@cmpxchg.org> | 3250 | M: Johannes Weiner <hannes@cmpxchg.org> |
| 3240 | M: Michal Hocko <mhocko@kernel.org> | 3251 | M: Michal Hocko <mhocko@kernel.org> |
| 3241 | M: Vladimir Davydov <vdavydov@virtuozzo.com> | 3252 | M: Vladimir Davydov <vdavydov.dev@gmail.com> |
| 3242 | L: cgroups@vger.kernel.org | 3253 | L: cgroups@vger.kernel.org |
| 3243 | L: linux-mm@kvack.org | 3254 | L: linux-mm@kvack.org |
| 3244 | S: Maintained | 3255 | S: Maintained |
| @@ -3259,7 +3270,7 @@ S: Maintained · 14 unmodified lines | |||
| 3259 | F: drivers/net/wan/cosa* | 3270 | F: drivers/net/wan/cosa* |
| 3260 | 3271 | ||
| 3261 | CPMAC ETHERNET DRIVER | 3272 | CPMAC ETHERNET DRIVER |
| 3262 | M: Florian Fainelli <florian@openwrt.org> | 3273 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 3263 | L: netdev@vger.kernel.org | 3274 | L: netdev@vger.kernel.org |
| 3264 | S: Maintained | 3275 | S: Maintained |
| 3265 | F: drivers/net/ethernet/ti/cpmac.c | 3276 | F: drivers/net/ethernet/ti/cpmac.c |
| @@ -6092,7 +6103,7 @@ S: Supported · 2826 unmodified lines | |||
| 6092 | F: drivers/cpufreq/intel_pstate.c | 6103 | F: drivers/cpufreq/intel_pstate.c |
| 6093 | 6104 | ||
| 6094 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) | 6105 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) |
| 6095 | M: Maik Broemme <mbroemme@plusserver.de> | 6106 | M: Maik Broemme <mbroemme@libmpq.org> |
| 6096 | L: linux-fbdev@vger.kernel.org | 6107 | L: linux-fbdev@vger.kernel.org |
| 6097 | S: Maintained | 6108 | S: Maintained |
| 6098 | F: Documentation/fb/intelfb.txt | 6109 | F: Documentation/fb/intelfb.txt |
| @@ -7455,7 +7466,8 @@ F: Documentation/devicetree/bindings/sound/max9860.txt · 1356 unmodified lines | |||
| 7455 | F: sound/soc/codecs/max9860.* | 7466 | F: sound/soc/codecs/max9860.* |
| 7456 | 7467 | ||
| 7457 | MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS | 7468 | MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS |
| 7458 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 7469 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 7470 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
| 7459 | L: linux-pm@vger.kernel.org | 7471 | L: linux-pm@vger.kernel.org |
| 7460 | S: Supported | 7472 | S: Supported |
| 7461 | F: drivers/power/max14577_charger.c | 7473 | F: drivers/power/max14577_charger.c |
| @@ -7471,7 +7483,8 @@ F: include/dt-bindings/*/*max77802.h · 9 unmodified lines | |||
| 7471 | 7483 | ||
| 7472 | MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS | 7484 | MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS |
| 7473 | M: Chanwoo Choi <cw00.choi@samsung.com> | 7485 | M: Chanwoo Choi <cw00.choi@samsung.com> |
| 7474 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 7486 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 7487 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
| 7475 | L: linux-kernel@vger.kernel.org | 7488 | L: linux-kernel@vger.kernel.org |
| 7476 | S: Supported | 7489 | S: Supported |
| 7477 | F: drivers/*/max14577*.c | 7490 | F: drivers/*/max14577*.c |
| @@ -7661,7 +7674,7 @@ L: linux-rdma@vger.kernel.org · 183 unmodified lines | |||
| 7661 | S: Supported | 7674 | S: Supported |
| 7662 | W: https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home | 7675 | W: https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home |
| 7663 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ | 7676 | Q: http://patchwork.kernel.org/project/linux-rdma/list/ |
| 7664 | F: drivers/infiniband/hw/rxe/ | 7677 | F: drivers/infiniband/sw/rxe/ |
| 7665 | F: include/uapi/rdma/rdma_user_rxe.h | 7678 | F: include/uapi/rdma/rdma_user_rxe.h |
| 7666 | 7679 | ||
| 7667 | MEMBARRIER SUPPORT | 7680 | MEMBARRIER SUPPORT |
| @@ -8148,6 +8161,15 @@ S: Maintained · 480 unmodified lines | |||
| 8148 | W: https://fedorahosted.org/dropwatch/ | 8161 | W: https://fedorahosted.org/dropwatch/ |
| 8149 | F: net/core/drop_monitor.c | 8162 | F: net/core/drop_monitor.c |
| 8150 | 8163 | ||
| 8164 | NETWORKING [DSA] | ||
| 8165 | M: Andrew Lunn <andrew@lunn.ch> | ||
| 8166 | M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> | ||
| 8167 | M: Florian Fainelli <f.fainelli@gmail.com> | ||
| 8168 | S: Maintained | ||
| 8169 | F: net/dsa/ | ||
| 8170 | F: include/net/dsa.h | ||
| 8171 | F: drivers/net/dsa/ | ||
| 8172 | |||
| 8151 | NETWORKING [GENERAL] | 8173 | NETWORKING [GENERAL] |
| 8152 | M: "David S. Miller" <davem@davemloft.net> | 8174 | M: "David S. Miller" <davem@davemloft.net> |
| 8153 | L: netdev@vger.kernel.org | 8175 | L: netdev@vger.kernel.org |
| @@ -9237,7 +9259,7 @@ F: drivers/pinctrl/sh-pfc/ · 1083 unmodified lines | |||
| 9237 | 9259 | ||
| 9238 | PIN CONTROLLER - SAMSUNG | 9260 | PIN CONTROLLER - SAMSUNG |
| 9239 | M: Tomasz Figa <tomasz.figa@gmail.com> | 9261 | M: Tomasz Figa <tomasz.figa@gmail.com> |
| 9240 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 9262 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 9241 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> | 9263 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
| 9242 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 9264 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 9243 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 9265 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
| @@ -10170,7 +10192,7 @@ S: Maintained · 926 unmodified lines | |||
| 10170 | F: drivers/platform/x86/samsung-laptop.c | 10192 | F: drivers/platform/x86/samsung-laptop.c |
| 10171 | 10193 | ||
| 10172 | SAMSUNG AUDIO (ASoC) DRIVERS | 10194 | SAMSUNG AUDIO (ASoC) DRIVERS |
| 10173 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 10195 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 10174 | M: Sangbeom Kim <sbkim73@samsung.com> | 10196 | M: Sangbeom Kim <sbkim73@samsung.com> |
| 10175 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> | 10197 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
| 10176 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 10198 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| @@ -10185,7 +10207,8 @@ F: drivers/video/fbdev/s3c-fb.c · 8 unmodified lines | |||
| 10185 | 10207 | ||
| 10186 | SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS | 10208 | SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS |
| 10187 | M: Sangbeom Kim <sbkim73@samsung.com> | 10209 | M: Sangbeom Kim <sbkim73@samsung.com> |
| 10188 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 10210 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 10211 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
| 10189 | L: linux-kernel@vger.kernel.org | 10212 | L: linux-kernel@vger.kernel.org |
| 10190 | L: linux-samsung-soc@vger.kernel.org | 10213 | L: linux-samsung-soc@vger.kernel.org |
| 10191 | S: Supported | 10214 | S: Supported |
| @@ -10244,6 +10267,17 @@ S: Supported · 52 unmodified lines | |||
| 10244 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 10267 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
| 10245 | F: drivers/clk/samsung/ | 10268 | F: drivers/clk/samsung/ |
| 10246 | 10269 | ||
| 10270 | SAMSUNG SPI DRIVERS | ||
| 10271 | M: Kukjin Kim <kgene@kernel.org> | ||
| 10272 | M: Krzysztof Kozlowski <krzk@kernel.org> | ||
| 10273 | M: Andi Shyti <andi.shyti@samsung.com> | ||
| 10274 | L: linux-spi@vger.kernel.org | ||
| 10275 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | ||
| 10276 | S: Maintained | ||
| 10277 | F: Documentation/devicetree/bindings/spi/spi-samsung.txt | ||
| 10278 | F: drivers/spi/spi-s3c* | ||
| 10279 | F: include/linux/platform_data/spi-s3c64xx.h | ||
| 10280 | |||
| 10247 | SAMSUNG SXGBE DRIVERS | 10281 | SAMSUNG SXGBE DRIVERS |
| 10248 | M: Byungho An <bh74.an@samsung.com> | 10282 | M: Byungho An <bh74.an@samsung.com> |
| 10249 | M: Girish K S <ks.giri@samsung.com> | 10283 | M: Girish K S <ks.giri@samsung.com> |
| @@ -11223,12 +11257,8 @@ S: Odd Fixes · 973 unmodified lines | |||
| 11223 | F: drivers/staging/vt665?/ | 11257 | F: drivers/staging/vt665?/ |
| 11224 | 11258 | ||
| 11225 | STAGING - WILC1000 WIFI DRIVER | 11259 | STAGING - WILC1000 WIFI DRIVER |
| 11226 | M: Johnny Kim <johnny.kim@atmel.com> | 11260 | M: Aditya Shankar <aditya.shankar@microchip.com> |
| 11227 | M: Austin Shin <austin.shin@atmel.com> | 11261 | M: Ganesh Krishna <ganesh.krishna@microchip.com> |
| 11228 | M: Chris Park <chris.park@atmel.com> | ||
| 11229 | M: Tony Cho <tony.cho@atmel.com> | ||
| 11230 | M: Glen Lee <glen.lee@atmel.com> | ||
| 11231 | M: Leo Kim <leo.kim@atmel.com> | ||
| 11232 | L: linux-wireless@vger.kernel.org | 11262 | L: linux-wireless@vger.kernel.org |
| 11233 | S: Supported | 11263 | S: Supported |
| 11234 | F: drivers/staging/wilc1000/ | 11264 | F: drivers/staging/wilc1000/ |
| @@ -12548,7 +12578,7 @@ F: include/linux/if_*vlan.h · 1313 unmodified lines | |||
| 12548 | F: net/8021q/ | 12578 | F: net/8021q/ |
| 12549 | 12579 | ||
| 12550 | VLYNQ BUS | 12580 | VLYNQ BUS |
| 12551 | M: Florian Fainelli <florian@openwrt.org> | 12581 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 12552 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | 12582 | L: openwrt-devel@lists.openwrt.org (subscribers-only) |
| 12553 | S: Maintained | 12583 | S: Maintained |
| 12554 | F: drivers/vlynq/vlynq.c | 12584 | F: drivers/vlynq/vlynq.c |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 8 | 2 | PATCHLEVEL = 8 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc8 |
| 5 | NAME = Psychotic Stoned Sheep | 5 | NAME = Psychotic Stoned Sheep |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -336,17 +336,6 @@ config HAVE_ARCH_SECCOMP_FILTER · 335 unmodified lines | |||
| 336 | results in the system call being skipped immediately. | 336 | results in the system call being skipped immediately. |
| 337 | - seccomp syscall wired up | 337 | - seccomp syscall wired up |
| 338 | 338 | ||
| 339 | For best performance, an arch should use seccomp_phase1 and | ||
| 340 | seccomp_phase2 directly. It should call seccomp_phase1 for all | ||
| 341 | syscalls if TIF_SECCOMP is set, but seccomp_phase1 does not | ||
| 342 | need to be called from a ptrace-safe context. It must then | ||
| 343 | call seccomp_phase2 if seccomp_phase1 returns anything other | ||
| 344 | than SECCOMP_PHASE1_OK or SECCOMP_PHASE1_SKIP. | ||
| 345 | |||
| 346 | As an additional optimization, an arch may provide seccomp_data | ||
| 347 | directly to seccomp_phase1; this avoids multiple calls | ||
| 348 | to the syscall_xyz helpers for every syscall. | ||
| 349 | |||
| 350 | config SECCOMP_FILTER | 339 | config SECCOMP_FILTER |
| 351 | def_bool y | 340 | def_bool y |
| 352 | depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET | 341 | depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET |
| @@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len) · 370 unmodified lines | |||
| 371 | return __cu_len; | 371 | return __cu_len; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | extern inline long | ||
| 375 | __copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) | ||
| 376 | { | ||
| 377 | if (__access_ok((unsigned long)validate, len, get_fs())) | ||
| 378 | len = __copy_tofrom_user_nocheck(to, from, len); | ||
| 379 | return len; | ||
| 380 | } | ||
| 381 | |||
| 382 | #define __copy_to_user(to, from, n) \ | 374 | #define __copy_to_user(to, from, n) \ |
| 383 | ({ \ | 375 | ({ \ |
| 384 | __chk_user_ptr(to); \ | 376 | __chk_user_ptr(to); \ |
| @@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali · 8 unmodified lines | |||
| 393 | #define __copy_to_user_inatomic __copy_to_user | 385 | #define __copy_to_user_inatomic __copy_to_user |
| 394 | #define __copy_from_user_inatomic __copy_from_user | 386 | #define __copy_from_user_inatomic __copy_from_user |
| 395 | 387 | ||
| 396 | |||
| 397 | extern inline long | 388 | extern inline long |
| 398 | copy_to_user(void __user *to, const void *from, long n) | 389 | copy_to_user(void __user *to, const void *from, long n) |
| 399 | { | 390 | { |
| 400 | return __copy_tofrom_user((__force void *)to, from, n, to); | 391 | if (likely(__access_ok((unsigned long)to, n, get_fs()))) |
| 392 | n = __copy_tofrom_user_nocheck((__force void *)to, from, n); | ||
| 393 | return n; | ||
| 401 | } | 394 | } |
| 402 | 395 | ||
| 403 | extern inline long | 396 | extern inline long |
| 404 | copy_from_user(void *to, const void __user *from, long n) | 397 | copy_from_user(void *to, const void __user *from, long n) |
| 405 | { | 398 | { |
| 406 | return __copy_tofrom_user(to, (__force void *)from, n, from); | 399 | if (likely(__access_ok((unsigned long)from, n, get_fs()))) |
| 400 | n = __copy_tofrom_user_nocheck(to, (__force void *)from, n); | ||
| 401 | else | ||
| 402 | memset(to, 0, n); | ||
| 403 | return n; | ||
| 407 | } | 404 | } |
| 408 | 405 | ||
| 409 | extern void __do_clear_user(void); | 406 | extern void __do_clear_user(void); |
| @@ -142,7 +142,7 @@ · 141 unmodified lines | |||
| 142 | 142 | ||
| 143 | #ifdef CONFIG_ARC_CURR_IN_REG | 143 | #ifdef CONFIG_ARC_CURR_IN_REG |
| 144 | ; Retrieve orig r25 and save it with rest of callee_regs | 144 | ; Retrieve orig r25 and save it with rest of callee_regs |
| 145 | ld.as r12, [r12, PT_user_r25] | 145 | ld r12, [r12, PT_user_r25] |
| 146 | PUSH r12 | 146 | PUSH r12 |
| 147 | #else | 147 | #else |
| 148 | PUSH r25 | 148 | PUSH r25 |
| @@ -198,7 +198,7 @@ · 49 unmodified lines | |||
| 198 | 198 | ||
| 199 | ; SP is back to start of pt_regs | 199 | ; SP is back to start of pt_regs |
| 200 | #ifdef CONFIG_ARC_CURR_IN_REG | 200 | #ifdef CONFIG_ARC_CURR_IN_REG |
| 201 | st.as r12, [sp, PT_user_r25] | 201 | st r12, [sp, PT_user_r25] |
| 202 | #endif | 202 | #endif |
| 203 | .endm | 203 | .endm |
| 204 | 204 | ||
| @@ -188,10 +188,10 @@ static inline int arch_irqs_disabled(void) · 187 unmodified lines | |||
| 188 | .endm | 188 | .endm |
| 189 | 189 | ||
| 190 | .macro IRQ_ENABLE scratch | 190 | .macro IRQ_ENABLE scratch |
| 191 | TRACE_ASM_IRQ_ENABLE | ||
| 191 | lr \scratch, [status32] | 192 | lr \scratch, [status32] |
| 192 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) | 193 | or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) |
| 193 | flag \scratch | 194 | flag \scratch |
| 194 | TRACE_ASM_IRQ_ENABLE | ||
| 195 | .endm | 195 | .endm |
| 196 | 196 | ||
| 197 | #endif /* __ASSEMBLY__ */ | 197 | #endif /* __ASSEMBLY__ */ |
| @@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) · 279 unmodified lines | |||
| 280 | 280 | ||
| 281 | #define pte_page(pte) pfn_to_page(pte_pfn(pte)) | 281 | #define pte_page(pte) pfn_to_page(pte_pfn(pte)) |
| 282 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | 282 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) |
| 283 | #define pfn_pte(pfn, prot) (__pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))) | 283 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) |
| 284 | 284 | ||
| 285 | /* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/ | 285 | /* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/ |
| 286 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | 286 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) |
| @@ -83,7 +83,10 @@ · 82 unmodified lines | |||
| 83 | "2: ;nop\n" \ | 83 | "2: ;nop\n" \ |
| 84 | " .section .fixup, \"ax\"\n" \ | 84 | " .section .fixup, \"ax\"\n" \ |
| 85 | " .align 4\n" \ | 85 | " .align 4\n" \ |
| 86 | "3: mov %0, %3\n" \ | 86 | "3: # return -EFAULT\n" \ |
| 87 | " mov %0, %3\n" \ | ||
| 88 | " # zero out dst ptr\n" \ | ||
| 89 | " mov %1, 0\n" \ | ||
| 87 | " j 2b\n" \ | 90 | " j 2b\n" \ |
| 88 | " .previous\n" \ | 91 | " .previous\n" \ |
| 89 | " .section __ex_table, \"a\"\n" \ | 92 | " .section __ex_table, \"a\"\n" \ |
| @@ -101,7 +104,11 @@ · 11 unmodified lines | |||
| 101 | "2: ;nop\n" \ | 104 | "2: ;nop\n" \ |
| 102 | " .section .fixup, \"ax\"\n" \ | 105 | " .section .fixup, \"ax\"\n" \ |
| 103 | " .align 4\n" \ | 106 | " .align 4\n" \ |
| 104 | "3: mov %0, %3\n" \ | 107 | "3: # return -EFAULT\n" \ |
| 108 | " mov %0, %3\n" \ | ||
| 109 | " # zero out dst ptr\n" \ | ||
| 110 | " mov %1, 0\n" \ | ||
| 111 | " mov %R1, 0\n" \ | ||
| 105 | " j 2b\n" \ | 112 | " j 2b\n" \ |
| 106 | " .previous\n" \ | 113 | " .previous\n" \ |
| 107 | " .section __ex_table, \"a\"\n" \ | 114 | " .section __ex_table, \"a\"\n" \ |
| @@ -13,8 +13,15 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | /* Machine specific ELF Hdr flags */ | 14 | /* Machine specific ELF Hdr flags */ |
| 15 | #define EF_ARC_OSABI_MSK 0x00000f00 | 15 | #define EF_ARC_OSABI_MSK 0x00000f00 |
| 16 | #define EF_ARC_OSABI_ORIG 0x00000000 /* MUST be zero for back-compat */ | 16 | |
| 17 | #define EF_ARC_OSABI_CURRENT 0x00000300 /* v3 (no legacy syscalls) */ | 17 | #define EF_ARC_OSABI_V3 0x00000300 /* v3 (no legacy syscalls) */ |
| 18 | #define EF_ARC_OSABI_V4 0x00000400 /* v4 (64bit data any reg align) */ | ||
| 19 | |||
| 20 | #if __GNUC__ < 6 | ||
| 21 | #define EF_ARC_OSABI_CURRENT EF_ARC_OSABI_V3 | ||
| 22 | #else | ||
| 23 | #define EF_ARC_OSABI_CURRENT EF_ARC_OSABI_V4 | ||
| 24 | #endif | ||
| 18 | 25 | ||
| 19 | typedef unsigned long elf_greg_t; | 26 | typedef unsigned long elf_greg_t; |
| 20 | typedef unsigned long elf_fpregset_t; | 27 | typedef unsigned long elf_fpregset_t; |
| @@ -28,6 +28,7 @@ extern void __muldf3(void); · 27 unmodified lines | |||
| 28 | extern void __divdf3(void); | 28 | extern void __divdf3(void); |
| 29 | extern void __floatunsidf(void); | 29 | extern void __floatunsidf(void); |
| 30 | extern void __floatunsisf(void); | 30 | extern void __floatunsisf(void); |
| 31 | extern void __udivdi3(void); | ||
| 31 | 32 | ||
| 32 | EXPORT_SYMBOL(__ashldi3); | 33 | EXPORT_SYMBOL(__ashldi3); |
| 33 | EXPORT_SYMBOL(__ashrdi3); | 34 | EXPORT_SYMBOL(__ashrdi3); |
| @@ -45,6 +46,7 @@ EXPORT_SYMBOL(__muldf3); · 11 unmodified lines | |||
| 45 | EXPORT_SYMBOL(__divdf3); | 46 | EXPORT_SYMBOL(__divdf3); |
| 46 | EXPORT_SYMBOL(__floatunsidf); | 47 | EXPORT_SYMBOL(__floatunsidf); |
| 47 | EXPORT_SYMBOL(__floatunsisf); | 48 | EXPORT_SYMBOL(__floatunsisf); |
| 49 | EXPORT_SYMBOL(__udivdi3); | ||
| 48 | 50 | ||
| 49 | /* ARC optimised assembler routines */ | 51 | /* ARC optimised assembler routines */ |
| 50 | EXPORT_SYMBOL(memset); | 52 | EXPORT_SYMBOL(memset); |
| @@ -199,7 +199,7 @@ int elf_check_arch(const struct elf32_hdr *x) · 198 unmodified lines | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | eflags = x->e_flags; | 201 | eflags = x->e_flags; |
| 202 | if ((eflags & EF_ARC_OSABI_MSK) < EF_ARC_OSABI_CURRENT) { | 202 | if ((eflags & EF_ARC_OSABI_MSK) != EF_ARC_OSABI_CURRENT) { |
| 203 | pr_err("ABI mismatch - you need newer toolchain\n"); | 203 | pr_err("ABI mismatch - you need newer toolchain\n"); |
| 204 | force_sigsegv(SIGSEGV, current); | 204 | force_sigsegv(SIGSEGV, current); |
| 205 | return 0; | 205 | return 0; |
| @@ -291,8 +291,10 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) · 290 unmodified lines | |||
| 291 | cpu->dccm.base_addr, TO_KB(cpu->dccm.sz), | 291 | cpu->dccm.base_addr, TO_KB(cpu->dccm.sz), |
| 292 | cpu->iccm.base_addr, TO_KB(cpu->iccm.sz)); | 292 | cpu->iccm.base_addr, TO_KB(cpu->iccm.sz)); |
| 293 | 293 | ||
| 294 | n += scnprintf(buf + n, len - n, | 294 | n += scnprintf(buf + n, len - n, "OS ABI [v%d]\t: %s\n", |
| 295 | "OS ABI [v3]\t: no-legacy-syscalls\n"); | 295 | EF_ARC_OSABI_CURRENT >> 8, |
| 296 | EF_ARC_OSABI_CURRENT == EF_ARC_OSABI_V3 ? | ||
| 297 | "no-legacy-syscalls" : "64-bit data any register aligned"); | ||
| 296 | 298 | ||
| 297 | return buf; | 299 | return buf; |
| 298 | } | 300 | } |
| @@ -921,6 +921,15 @@ void arc_cache_init(void) · 920 unmodified lines | |||
| 921 | 921 | ||
| 922 | printk(arc_cache_mumbojumbo(0, str, sizeof(str))); | 922 | printk(arc_cache_mumbojumbo(0, str, sizeof(str))); |
| 923 | 923 | ||
| 924 | /* | ||
| 925 | * Only master CPU needs to execute rest of function: | ||
| 926 | * - Assume SMP so all cores will have same cache config so | ||
| 927 | * any geomtry checks will be same for all | ||
| 928 | * - IOC setup / dma callbacks only need to be setup once | ||
| 929 | */ | ||
| 930 | if (cpu) | ||
| 931 | return; | ||
| 932 | |||
| 924 | if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) { | 933 | if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) { |
| 925 | struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; | 934 | struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; |
| 926 | 935 | ||
| @@ -61,6 +61,7 @@ void *kmap(struct page *page) · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | return kmap_high(page); | 62 | return kmap_high(page); |
| 63 | } | 63 | } |
| 64 | EXPORT_SYMBOL(kmap); | ||
| 64 | 65 | ||
| 65 | void *kmap_atomic(struct page *page) | 66 | void *kmap_atomic(struct page *page) |
| 66 | { | 67 | { |
| @@ -226,7 +226,7 @@ · 225 unmodified lines | |||
| 226 | 226 | ||
| 227 | #address-cells = <1>; | 227 | #address-cells = <1>; |
| 228 | #size-cells = <1>; | 228 | #size-cells = <1>; |
| 229 | elm_id = <&elm>; | 229 | ti,elm-id = <&elm>; |
| 230 | }; | 230 | }; |
| 231 | }; | 231 | }; |
| 232 | 232 | ||
| @@ -161,7 +161,7 @@ · 160 unmodified lines | |||
| 161 | 161 | ||
| 162 | #address-cells = <1>; | 162 | #address-cells = <1>; |
| 163 | #size-cells = <1>; | 163 | #size-cells = <1>; |
| 164 | elm_id = <&elm>; | 164 | ti,elm-id = <&elm>; |
| 165 | 165 | ||
| 166 | /* MTD partition table */ | 166 | /* MTD partition table */ |
| 167 | partition@0 { | 167 | partition@0 { |
| @@ -197,7 +197,7 @@ · 196 unmodified lines | |||
| 197 | gpmc,wr-access-ns = <30>; | 197 | gpmc,wr-access-ns = <30>; |
| 198 | gpmc,wr-data-mux-bus-ns = <0>; | 198 | gpmc,wr-data-mux-bus-ns = <0>; |
| 199 | 199 | ||
| 200 | elm_id = <&elm>; | 200 | ti,elm-id = <&elm>; |
| 201 | 201 | ||
| 202 | #address-cells = <1>; | 202 | #address-cells = <1>; |
| 203 | #size-cells = <1>; | 203 | #size-cells = <1>; |
| @@ -390,12 +390,12 @@ · 389 unmodified lines | |||
| 390 | 390 | ||
| 391 | port@0 { | 391 | port@0 { |
| 392 | reg = <0>; | 392 | reg = <0>; |
| 393 | label = "lan1"; | 393 | label = "lan5"; |
| 394 | }; | 394 | }; |
| 395 | 395 | ||
| 396 | port@1 { | 396 | port@1 { |
| 397 | reg = <1>; | 397 | reg = <1>; |
| 398 | label = "lan2"; | 398 | label = "lan4"; |
| 399 | }; | 399 | }; |
| 400 | 400 | ||
| 401 | port@2 { | 401 | port@2 { |
| @@ -405,12 +405,12 @@ · 3 unmodified lines | |||
| 405 | 405 | ||
| 406 | port@3 { | 406 | port@3 { |
| 407 | reg = <3>; | 407 | reg = <3>; |
| 408 | label = "lan4"; | 408 | label = "lan2"; |
| 409 | }; | 409 | }; |
| 410 | 410 | ||
| 411 | port@4 { | 411 | port@4 { |
| 412 | reg = <4>; | 412 | reg = <4>; |
| 413 | label = "lan5"; | 413 | label = "lan1"; |
| 414 | }; | 414 | }; |
| 415 | 415 | ||
| 416 | port@5 { | 416 | port@5 { |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | / { | 3 | / { |
| 4 | memory { | 4 | memory { |
| 5 | device_type = "memory"; | ||
| 5 | reg = <0 0x10000000>; | 6 | reg = <0 0x10000000>; |
| 6 | }; | 7 | }; |
| 7 | 8 | ||
| @@ -2,7 +2,6 @@ · 1 unmodified line | |||
| 2 | #include <dt-bindings/clock/bcm2835.h> | 2 | #include <dt-bindings/clock/bcm2835.h> |
| 3 | #include <dt-bindings/clock/bcm2835-aux.h> | 3 | #include <dt-bindings/clock/bcm2835-aux.h> |
| 4 | #include <dt-bindings/gpio/gpio.h> | 4 | #include <dt-bindings/gpio/gpio.h> |
| 5 | #include "skeleton.dtsi" | ||
| 6 | 5 | ||
| 7 | /* This include file covers the common peripherals and configuration between | 6 | /* This include file covers the common peripherals and configuration between |
| 8 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to | 7 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to |
| @@ -13,6 +12,8 @@ · 4 unmodified lines | |||
| 13 | compatible = "brcm,bcm2835"; | 12 | compatible = "brcm,bcm2835"; |
| 14 | model = "BCM2835"; | 13 | model = "BCM2835"; |
| 15 | interrupt-parent = <&intc>; | 14 | interrupt-parent = <&intc>; |
| 15 | #address-cells = <1>; | ||
| 16 | #size-cells = <1>; | ||
| 16 | 17 | ||
| 17 | chosen { | 18 | chosen { |
| 18 | bootargs = "earlyprintk console=ttyAMA0"; | 19 | bootargs = "earlyprintk console=ttyAMA0"; |
| @@ -447,14 +447,11 @@ · 446 unmodified lines | |||
| 447 | samsung,dw-mshc-ciu-div = <3>; | 447 | samsung,dw-mshc-ciu-div = <3>; |
| 448 | samsung,dw-mshc-sdr-timing = <0 4>; | 448 | samsung,dw-mshc-sdr-timing = <0 4>; |
| 449 | samsung,dw-mshc-ddr-timing = <0 2>; | 449 | samsung,dw-mshc-ddr-timing = <0 2>; |
| 450 | samsung,dw-mshc-hs400-timing = <0 2>; | ||
| 451 | samsung,read-strobe-delay = <90>; | ||
| 452 | pinctrl-names = "default"; | 450 | pinctrl-names = "default"; |
| 453 | pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8 &sd0_cd>; | 451 | pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8 &sd0_cd>; |
| 454 | bus-width = <8>; | 452 | bus-width = <8>; |
| 455 | cap-mmc-highspeed; | 453 | cap-mmc-highspeed; |
| 456 | mmc-hs200-1_8v; | 454 | mmc-hs200-1_8v; |
| 457 | mmc-hs400-1_8v; | ||
| 458 | vmmc-supply = <&ldo20_reg>; | 455 | vmmc-supply = <&ldo20_reg>; |
| 459 | vqmmc-supply = <&ldo11_reg>; | 456 | vqmmc-supply = <&ldo11_reg>; |
| 460 | }; | 457 | }; |
| @@ -243,7 +243,7 @@ · 242 unmodified lines | |||
| 243 | clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>, | 243 | clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>, |
| 244 | <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>, | 244 | <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>, |
| 245 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>, | 245 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>, |
| 246 | <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>, | 246 | <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>, |
| 247 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>; | 247 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>; |
| 248 | clock-names = "core", "rxtx0", | 248 | clock-names = "core", "rxtx0", |
| 249 | "rxtx1", "rxtx2", | 249 | "rxtx1", "rxtx2", |
| @@ -64,7 +64,7 @@ · 63 unmodified lines | |||
| 64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; | 64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; |
| 65 | no-1-8-v; | 65 | no-1-8-v; |
| 66 | keep-power-in-suspend; | 66 | keep-power-in-suspend; |
| 67 | enable-sdio-wakup; | 67 | wakeup-source; |
| 68 | status = "okay"; | 68 | status = "okay"; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| @@ -131,7 +131,7 @@ · 130 unmodified lines | |||
| 131 | ti,y-min = /bits/ 16 <0>; | 131 | ti,y-min = /bits/ 16 <0>; |
| 132 | ti,y-max = /bits/ 16 <0>; | 132 | ti,y-max = /bits/ 16 <0>; |
| 133 | ti,pressure-max = /bits/ 16 <0>; | 133 | ti,pressure-max = /bits/ 16 <0>; |
| 134 | ti,x-plat-ohms = /bits/ 16 <400>; | 134 | ti,x-plate-ohms = /bits/ 16 <400>; |
| 135 | wakeup-source; | 135 | wakeup-source; |
| 136 | }; | 136 | }; |
| 137 | }; | 137 | }; |
| @@ -113,7 +113,7 @@ · 112 unmodified lines | |||
| 113 | 113 | ||
| 114 | partition@e0000 { | 114 | partition@e0000 { |
| 115 | label = "u-boot environment"; | 115 | label = "u-boot environment"; |
| 116 | reg = <0xe0000 0x100000>; | 116 | reg = <0xe0000 0x20000>; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | partition@100000 { | 119 | partition@100000 { |
| @@ -116,6 +116,10 @@ · 115 unmodified lines | |||
| 116 | }; | 116 | }; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | &pciec { | ||
| 120 | status = "okay"; | ||
| 121 | }; | ||
| 122 | |||
| 119 | &pcie0 { | 123 | &pcie0 { |
| 120 | status = "okay"; | 124 | status = "okay"; |
| 121 | }; | 125 | }; |
| @@ -35,10 +35,15 @@ · 34 unmodified lines | |||
| 35 | ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */ | 35 | ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */ |
| 36 | 36 | ||
| 37 | nand@0,0 { | 37 | nand@0,0 { |
| 38 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | 38 | compatible = "ti,omap2-nand"; |
| 39 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ | 39 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ |
| 40 | interrupt-parent = <&gpmc>; | ||
| 41 | interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */ | ||
| 42 | <1 IRQ_TYPE_NONE>; /* termcount */ | ||
| 43 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | ||
| 40 | nand-bus-width = <16>; | 44 | nand-bus-width = <16>; |
| 41 | ti,nand-ecc-opt = "bch8"; | 45 | ti,nand-ecc-opt = "bch8"; |
| 46 | rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */ | ||
| 42 | gpmc,sync-clk-ps = <0>; | 47 | gpmc,sync-clk-ps = <0>; |
| 43 | gpmc,cs-on-ns = <0>; | 48 | gpmc,cs-on-ns = <0>; |
| 44 | gpmc,cs-rd-off-ns = <44>; | 49 | gpmc,cs-rd-off-ns = <44>; |
| @@ -54,10 +59,6 @@ · 9 unmodified lines | |||
| 54 | gpmc,wr-access-ns = <40>; | 59 | gpmc,wr-access-ns = <40>; |
| 55 | gpmc,wr-data-mux-bus-ns = <0>; | 60 | gpmc,wr-data-mux-bus-ns = <0>; |
| 56 | gpmc,device-width = <2>; | 61 | gpmc,device-width = <2>; |
| 57 | |||
| 58 | gpmc,page-burst-access-ns = <5>; | ||
| 59 | gpmc,cycle2cycle-delay-ns = <50>; | ||
| 60 | |||
| 61 | #address-cells = <1>; | 62 | #address-cells = <1>; |
| 62 | #size-cells = <1>; | 63 | #size-cells = <1>; |
| 63 | 64 | ||
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | 46 | linux,mtd-name = "micron,mt29f4g16abbda3w"; |
| 47 | nand-bus-width = <16>; | 47 | nand-bus-width = <16>; |
| 48 | ti,nand-ecc-opt = "bch8"; | 48 | ti,nand-ecc-opt = "bch8"; |
| 49 | rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */ | ||
| 49 | gpmc,sync-clk-ps = <0>; | 50 | gpmc,sync-clk-ps = <0>; |
| 50 | gpmc,cs-on-ns = <0>; | 51 | gpmc,cs-on-ns = <0>; |
| 51 | gpmc,cs-rd-off-ns = <44>; | 52 | gpmc,cs-rd-off-ns = <44>; |
| @@ -223,7 +223,9 @@ · 222 unmodified lines | |||
| 223 | }; | 223 | }; |
| 224 | 224 | ||
| 225 | &gpmc { | 225 | &gpmc { |
| 226 | ranges = <0 0 0x00000000 0x20000000>; | 226 | ranges = <0 0 0x30000000 0x1000000>, /* CS0 */ |
| 227 | <4 0 0x2b000000 0x1000000>, /* CS4 */ | ||
| 228 | <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
| 227 | 229 | ||
| 228 | nand@0,0 { | 230 | nand@0,0 { |
| 229 | compatible = "ti,omap2-nand"; | 231 | compatible = "ti,omap2-nand"; |
| @@ -55,8 +55,6 @@ · 54 unmodified lines | |||
| 55 | #include "omap-gpmc-smsc9221.dtsi" | 55 | #include "omap-gpmc-smsc9221.dtsi" |
| 56 | 56 | ||
| 57 | &gpmc { | 57 | &gpmc { |
| 58 | ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
| 59 | |||
| 60 | ethernet@gpmc { | 58 | ethernet@gpmc { |
| 61 | reg = <5 0 0xff>; | 59 | reg = <5 0 0xff>; |
| 62 | interrupt-parent = <&gpio6>; | 60 | interrupt-parent = <&gpio6>; |
| @@ -27,8 +27,6 @@ · 26 unmodified lines | |||
| 27 | #include "omap-gpmc-smsc9221.dtsi" | 27 | #include "omap-gpmc-smsc9221.dtsi" |
| 28 | 28 | ||
| 29 | &gpmc { | 29 | &gpmc { |
| 30 | ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
| 31 | |||
| 32 | ethernet@gpmc { | 30 | ethernet@gpmc { |
| 33 | reg = <5 0 0xff>; | 31 | reg = <5 0 0xff>; |
| 34 | interrupt-parent = <&gpio6>; | 32 | interrupt-parent = <&gpio6>; |
| @@ -15,9 +15,6 @@ · 14 unmodified lines | |||
| 15 | #include "omap-gpmc-smsc9221.dtsi" | 15 | #include "omap-gpmc-smsc9221.dtsi" |
| 16 | 16 | ||
| 17 | &gpmc { | 17 | &gpmc { |
| 18 | ranges = <4 0 0x2b000000 0x1000000>, /* CS4 */ | ||
| 19 | <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
| 20 | |||
| 21 | smsc1: ethernet@gpmc { | 18 | smsc1: ethernet@gpmc { |
| 22 | reg = <5 0 0xff>; | 19 | reg = <5 0 0xff>; |
| 23 | interrupt-parent = <&gpio6>; | 20 | interrupt-parent = <&gpio6>; |
| @@ -197,6 +197,8 @@ · 196 unmodified lines | |||
| 197 | clock-names = "saradc", "apb_pclk"; | 197 | clock-names = "saradc", "apb_pclk"; |
| 198 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; | 198 | interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; |
| 199 | #io-channel-cells = <1>; | 199 | #io-channel-cells = <1>; |
| 200 | resets = <&cru SRST_SARADC>; | ||
| 201 | reset-names = "saradc-apb"; | ||
| 200 | status = "disabled"; | 202 | status = "disabled"; |
| 201 | }; | 203 | }; |
| 202 | 204 | ||
| @@ -279,6 +279,8 @@ · 278 unmodified lines | |||
| 279 | #io-channel-cells = <1>; | 279 | #io-channel-cells = <1>; |
| 280 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; | 280 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
| 281 | clock-names = "saradc", "apb_pclk"; | 281 | clock-names = "saradc", "apb_pclk"; |
| 282 | resets = <&cru SRST_SARADC>; | ||
| 283 | reset-names = "saradc-apb"; | ||
| 282 | status = "disabled"; | 284 | status = "disabled"; |
| 283 | }; | 285 | }; |
| 284 | 286 | ||
| @@ -399,6 +399,8 @@ · 398 unmodified lines | |||
| 399 | #io-channel-cells = <1>; | 399 | #io-channel-cells = <1>; |
| 400 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; | 400 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
| 401 | clock-names = "saradc", "apb_pclk"; | 401 | clock-names = "saradc", "apb_pclk"; |
| 402 | resets = <&cru SRST_SARADC>; | ||
| 403 | reset-names = "saradc-apb"; | ||
| 402 | status = "disabled"; | 404 | status = "disabled"; |
| 403 | }; | 405 | }; |
| 404 | 406 | ||
| @@ -550,8 +550,9 @@ · 549 unmodified lines | |||
| 550 | interrupt-names = "mmcirq"; | 550 | interrupt-names = "mmcirq"; |
| 551 | pinctrl-names = "default"; | 551 | pinctrl-names = "default"; |
| 552 | pinctrl-0 = <&pinctrl_mmc0>; | 552 | pinctrl-0 = <&pinctrl_mmc0>; |
| 553 | clock-names = "mmc"; | 553 | clock-names = "mmc", "icn"; |
| 554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>; | 554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>, |
| 555 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
| 555 | bus-width = <8>; | 556 | bus-width = <8>; |
| 556 | non-removable; | 557 | non-removable; |
| 557 | }; | 558 | }; |
| @@ -565,8 +566,9 @@ · 7 unmodified lines | |||
| 565 | interrupt-names = "mmcirq"; | 566 | interrupt-names = "mmcirq"; |
| 566 | pinctrl-names = "default"; | 567 | pinctrl-names = "default"; |
| 567 | pinctrl-0 = <&pinctrl_sd1>; | 568 | pinctrl-0 = <&pinctrl_sd1>; |
| 568 | clock-names = "mmc"; | 569 | clock-names = "mmc", "icn"; |
| 569 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>; | 570 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>, |
| 571 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
| 570 | resets = <&softreset STIH407_MMC1_SOFTRESET>; | 572 | resets = <&softreset STIH407_MMC1_SOFTRESET>; |
| 571 | bus-width = <4>; | 573 | bus-width = <4>; |
| 572 | }; | 574 | }; |
| @@ -41,7 +41,8 @@ · 40 unmodified lines | |||
| 41 | compatible = "st,st-ohci-300x"; | 41 | compatible = "st,st-ohci-300x"; |
| 42 | reg = <0x9a03c00 0x100>; | 42 | reg = <0x9a03c00 0x100>; |
| 43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; | 43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; |
| 44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
| 45 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
| 45 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 46 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
| 46 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 47 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
| 47 | reset-names = "power", "softreset"; | 48 | reset-names = "power", "softreset"; |
| @@ -57,7 +58,8 @@ · 9 unmodified lines | |||
| 57 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; | 58 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; |
| 58 | pinctrl-names = "default"; | 59 | pinctrl-names = "default"; |
| 59 | pinctrl-0 = <&pinctrl_usb0>; | 60 | pinctrl-0 = <&pinctrl_usb0>; |
| 60 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 61 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
| 62 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
| 61 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 63 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
| 62 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 64 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
| 63 | reset-names = "power", "softreset"; | 65 | reset-names = "power", "softreset"; |
| @@ -71,7 +73,8 @@ · 7 unmodified lines | |||
| 71 | compatible = "st,st-ohci-300x"; | 73 | compatible = "st,st-ohci-300x"; |
| 72 | reg = <0x9a83c00 0x100>; | 74 | reg = <0x9a83c00 0x100>; |
| 73 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; | 75 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; |
| 74 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 76 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
| 77 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
| 75 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 78 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
| 76 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 79 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
| 77 | reset-names = "power", "softreset"; | 80 | reset-names = "power", "softreset"; |
| @@ -87,7 +90,8 @@ · 9 unmodified lines | |||
| 87 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; | 90 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; |
| 88 | pinctrl-names = "default"; | 91 | pinctrl-names = "default"; |
| 89 | pinctrl-0 = <&pinctrl_usb1>; | 92 | pinctrl-0 = <&pinctrl_usb1>; |
| 90 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 93 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
| 94 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
| 91 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 95 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
| 92 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 96 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
| 93 | reset-names = "power", "softreset"; | 97 | reset-names = "power", "softreset"; |
| @@ -84,7 +84,7 @@ · 83 unmodified lines | |||
| 84 | trips { | 84 | trips { |
| 85 | cpu_alert0: cpu_alert0 { | 85 | cpu_alert0: cpu_alert0 { |
| 86 | /* milliCelsius */ | 86 | /* milliCelsius */ |
| 87 | temperature = <850000>; | 87 | temperature = <85000>; |
| 88 | hysteresis = <2000>; | 88 | hysteresis = <2000>; |
| 89 | type = "passive"; | 89 | type = "passive"; |
| 90 | }; | 90 | }; |
| @@ -897,7 +897,7 @@ · 896 unmodified lines | |||
| 897 | palmas: tps65913@58 { | 897 | palmas: tps65913@58 { |
| 898 | compatible = "ti,palmas"; | 898 | compatible = "ti,palmas"; |
| 899 | reg = <0x58>; | 899 | reg = <0x58>; |
| 900 | interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>; | 900 | interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>; |
| 901 | 901 | ||
| 902 | #interrupt-cells = <2>; | 902 | #interrupt-cells = <2>; |
| 903 | interrupt-controller; | 903 | interrupt-controller; |
| @@ -802,7 +802,7 @@ · 801 unmodified lines | |||
| 802 | palmas: pmic@58 { | 802 | palmas: pmic@58 { |
| 803 | compatible = "ti,palmas"; | 803 | compatible = "ti,palmas"; |
| 804 | reg = <0x58>; | 804 | reg = <0x58>; |
| 805 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_LOW>; | 805 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
| 806 | 806 | ||
| 807 | #interrupt-cells = <2>; | 807 | #interrupt-cells = <2>; |
| 808 | interrupt-controller; | 808 | interrupt-controller; |
| @@ -63,7 +63,7 @@ · 62 unmodified lines | |||
| 63 | palmas: pmic@58 { | 63 | palmas: pmic@58 { |
| 64 | compatible = "ti,palmas"; | 64 | compatible = "ti,palmas"; |
| 65 | reg = <0x58>; | 65 | reg = <0x58>; |
| 66 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_LOW>; | 66 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
| 67 | 67 | ||
| 68 | #interrupt-cells = <2>; | 68 | #interrupt-cells = <2>; |
| 69 | interrupt-controller; | 69 | interrupt-controller; |
| @@ -1382,7 +1382,7 @@ · 1381 unmodified lines | |||
| 1382 | * Pin 41: BR_UART1_TXD | 1382 | * Pin 41: BR_UART1_TXD |
| 1383 | * Pin 44: BR_UART1_RXD | 1383 | * Pin 44: BR_UART1_RXD |
| 1384 | */ | 1384 | */ |
| 1385 | serial@0,70006000 { | 1385 | serial@70006000 { |
| 1386 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; | 1386 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; |
| 1387 | status = "okay"; | 1387 | status = "okay"; |
| 1388 | }; | 1388 | }; |
| @@ -1394,7 +1394,7 @@ · 5 unmodified lines | |||
| 1394 | * Pin 71: UART2_CTS_L | 1394 | * Pin 71: UART2_CTS_L |
| 1395 | * Pin 74: UART2_RTS_L | 1395 | * Pin 74: UART2_RTS_L |
| 1396 | */ | 1396 | */ |
| 1397 | serial@0,70006040 { | 1397 | serial@70006040 { |
| 1398 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; | 1398 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; |
| 1399 | status = "okay"; | 1399 | status = "okay"; |
| 1400 | }; | 1400 | }; |
| @@ -140,7 +140,7 @@ static struct locomo_dev_info locomo_devices[] = { · 139 unmodified lines | |||
| 140 | 140 | ||
| 141 | static void locomo_handler(struct irq_desc *desc) | 141 | static void locomo_handler(struct irq_desc *desc) |
| 142 | { | 142 | { |
| 143 | struct locomo *lchip = irq_desc_get_chip_data(desc); | 143 | struct locomo *lchip = irq_desc_get_handler_data(desc); |
| 144 | int req, i; | 144 | int req, i; |
| 145 | 145 | ||
| 146 | /* Acknowledge the parent IRQ */ | 146 | /* Acknowledge the parent IRQ */ |
| @@ -200,8 +200,7 @@ static void locomo_setup_irq(struct locomo *lchip) · 53 unmodified lines | |||
| 200 | * Install handler for IRQ_LOCOMO_HW. | 200 | * Install handler for IRQ_LOCOMO_HW. |
| 201 | */ | 201 | */ |
| 202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); | 202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); |
| 203 | irq_set_chip_data(lchip->irq, lchip); | 203 | irq_set_chained_handler_and_data(lchip->irq, locomo_handler, lchip); |
| 204 | irq_set_chained_handler(lchip->irq, locomo_handler); | ||
| 205 | 204 | ||
| 206 | /* Install handlers for IRQ_LOCOMO_* */ | 205 | /* Install handlers for IRQ_LOCOMO_* */ |
| 207 | for ( ; irq <= lchip->irq_base + 3; irq++) { | 206 | for ( ; irq <= lchip->irq_base + 3; irq++) { |
| @@ -472,8 +472,8 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) · 471 unmodified lines | |||
| 472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. | 472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. |
| 473 | */ | 473 | */ |
| 474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); | 474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); |
| 475 | sa1111_writel(SA1111_IRQMASK_HI(IRQ_S0_READY_NINT) | | 475 | sa1111_writel(BIT(IRQ_S0_READY_NINT & 31) | |
| 476 | SA1111_IRQMASK_HI(IRQ_S1_READY_NINT), | 476 | BIT(IRQ_S1_READY_NINT & 31), |
| 477 | irqbase + SA1111_INTPOL1); | 477 | irqbase + SA1111_INTPOL1); |
| 478 | 478 | ||
| 479 | /* clear all IRQs */ | 479 | /* clear all IRQs */ |
| @@ -754,7 +754,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) · 274 unmodified lines | |||
| 754 | if (sachip->irq != NO_IRQ) { | 754 | if (sachip->irq != NO_IRQ) { |
| 755 | ret = sa1111_setup_irq(sachip, pd->irq_base); | 755 | ret = sa1111_setup_irq(sachip, pd->irq_base); |
| 756 | if (ret) | 756 | if (ret) |
| 757 | goto err_unmap; | 757 | goto err_clk; |
| 758 | } | 758 | } |
| 759 | 759 | ||
| 760 | #ifdef CONFIG_ARCH_SA1100 | 760 | #ifdef CONFIG_ARCH_SA1100 |
| @@ -799,6 +799,8 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) · 38 unmodified lines | |||
| 799 | 799 | ||
| 800 | return 0; | 800 | return 0; |
| 801 | 801 | ||
| 802 | err_clk: | ||
| 803 | clk_disable(sachip->clk); | ||
| 802 | err_unmap: | 804 | err_unmap: |
| 803 | iounmap(sachip->base); | 805 | iounmap(sachip->base); |
| 804 | err_clk_unprep: | 806 | err_clk_unprep: |
| @@ -869,9 +871,9 @@ struct sa1111_save_data { · 64 unmodified lines | |||
| 869 | 871 | ||
| 870 | #ifdef CONFIG_PM | 872 | #ifdef CONFIG_PM |
| 871 | 873 | ||
| 872 | static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | 874 | static int sa1111_suspend_noirq(struct device *dev) |
| 873 | { | 875 | { |
| 874 | struct sa1111 *sachip = platform_get_drvdata(dev); | 876 | struct sa1111 *sachip = dev_get_drvdata(dev); |
| 875 | struct sa1111_save_data *save; | 877 | struct sa1111_save_data *save; |
| 876 | unsigned long flags; | 878 | unsigned long flags; |
| 877 | unsigned int val; | 879 | unsigned int val; |
| @@ -934,9 +936,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) · 56 unmodified lines | |||
| 934 | * restored by their respective drivers, and must be called | 936 | * restored by their respective drivers, and must be called |
| 935 | * via LDM after this function. | 937 | * via LDM after this function. |
| 936 | */ | 938 | */ |
| 937 | static int sa1111_resume(struct platform_device *dev) | 939 | static int sa1111_resume_noirq(struct device *dev) |
| 938 | { | 940 | { |
| 939 | struct sa1111 *sachip = platform_get_drvdata(dev); | 941 | struct sa1111 *sachip = dev_get_drvdata(dev); |
| 940 | struct sa1111_save_data *save; | 942 | struct sa1111_save_data *save; |
| 941 | unsigned long flags, id; | 943 | unsigned long flags, id; |
| 942 | void __iomem *base; | 944 | void __iomem *base; |
| @@ -952,7 +954,7 @@ static int sa1111_resume(struct platform_device *dev) · 9 unmodified lines | |||
| 952 | id = sa1111_readl(sachip->base + SA1111_SKID); | 954 | id = sa1111_readl(sachip->base + SA1111_SKID); |
| 953 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 955 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
| 954 | __sa1111_remove(sachip); | 956 | __sa1111_remove(sachip); |
| 955 | platform_set_drvdata(dev, NULL); | 957 | dev_set_drvdata(dev, NULL); |
| 956 | kfree(save); | 958 | kfree(save); |
| 957 | return 0; | 959 | return 0; |
| 958 | } | 960 | } |
| @@ -1003,8 +1005,8 @@ static int sa1111_resume(struct platform_device *dev) · 44 unmodified lines | |||
| 1003 | } | 1005 | } |
| 1004 | 1006 | ||
| 1005 | #else | 1007 | #else |
| 1006 | #define sa1111_suspend NULL | 1008 | #define sa1111_suspend_noirq NULL |
| 1007 | #define sa1111_resume NULL | 1009 | #define sa1111_resume_noirq NULL |
| 1008 | #endif | 1010 | #endif |
| 1009 | 1011 | ||
| 1010 | static int sa1111_probe(struct platform_device *pdev) | 1012 | static int sa1111_probe(struct platform_device *pdev) |
| @@ -1017,7 +1019,7 @@ static int sa1111_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 1017 | return -EINVAL; | 1019 | return -EINVAL; |
| 1018 | irq = platform_get_irq(pdev, 0); | 1020 | irq = platform_get_irq(pdev, 0); |
| 1019 | if (irq < 0) | 1021 | if (irq < 0) |
| 1020 | return -ENXIO; | 1022 | return irq; |
| 1021 | 1023 | ||
| 1022 | return __sa1111_probe(&pdev->dev, mem, irq); | 1024 | return __sa1111_probe(&pdev->dev, mem, irq); |
| 1023 | } | 1025 | } |
| @@ -1038,6 +1040,11 @@ static int sa1111_remove(struct platform_device *pdev) · 14 unmodified lines | |||
| 1038 | return 0; | 1040 | return 0; |
| 1039 | } | 1041 | } |
| 1040 | 1042 | ||
| 1043 | static struct dev_pm_ops sa1111_pm_ops = { | ||
| 1044 | .suspend_noirq = sa1111_suspend_noirq, | ||
| 1045 | .resume_noirq = sa1111_resume_noirq, | ||
| 1046 | }; | ||
| 1047 | |||
| 1041 | /* | 1048 | /* |
| 1042 | * Not sure if this should be on the system bus or not yet. | 1049 | * Not sure if this should be on the system bus or not yet. |
| 1043 | * We really want some way to register a system device at | 1050 | * We really want some way to register a system device at |
| @@ -1050,10 +1057,9 @@ static int sa1111_remove(struct platform_device *pdev) · 6 unmodified lines | |||
| 1050 | static struct platform_driver sa1111_device_driver = { | 1057 | static struct platform_driver sa1111_device_driver = { |
| 1051 | .probe = sa1111_probe, | 1058 | .probe = sa1111_probe, |
| 1052 | .remove = sa1111_remove, | 1059 | .remove = sa1111_remove, |
| 1053 | .suspend = sa1111_suspend, | ||
| 1054 | .resume = sa1111_resume, | ||
| 1055 | .driver = { | 1060 | .driver = { |
| 1056 | .name = "sa1111", | 1061 | .name = "sa1111", |
| 1062 | .pm = &sa1111_pm_ops, | ||
| 1057 | }, | 1063 | }, |
| 1058 | }; | 1064 | }; |
| 1059 | 1065 | ||
| @@ -161,6 +161,7 @@ CONFIG_USB_MON=y · 160 unmodified lines | |||
| 161 | CONFIG_USB_XHCI_HCD=y | 161 | CONFIG_USB_XHCI_HCD=y |
| 162 | CONFIG_USB_STORAGE=y | 162 | CONFIG_USB_STORAGE=y |
| 163 | CONFIG_USB_DWC3=y | 163 | CONFIG_USB_DWC3=y |
| 164 | CONFIG_NOP_USB_XCEIV=y | ||
| 164 | CONFIG_KEYSTONE_USB_PHY=y | 165 | CONFIG_KEYSTONE_USB_PHY=y |
| 165 | CONFIG_NEW_LEDS=y | 166 | CONFIG_NEW_LEDS=y |
| 166 | CONFIG_LEDS_CLASS=y | 167 | CONFIG_LEDS_CLASS=y |
| @@ -781,7 +781,7 @@ CONFIG_MXS_DMA=y · 780 unmodified lines | |||
| 781 | CONFIG_DMA_BCM2835=y | 781 | CONFIG_DMA_BCM2835=y |
| 782 | CONFIG_DMA_OMAP=y | 782 | CONFIG_DMA_OMAP=y |
| 783 | CONFIG_QCOM_BAM_DMA=y | 783 | CONFIG_QCOM_BAM_DMA=y |
| 784 | CONFIG_XILINX_VDMA=y | 784 | CONFIG_XILINX_DMA=y |
| 785 | CONFIG_DMA_SUN6I=y | 785 | CONFIG_DMA_SUN6I=y |
| 786 | CONFIG_STAGING=y | 786 | CONFIG_STAGING=y |
| 787 | CONFIG_SENSORS_ISL29018=y | 787 | CONFIG_SENSORS_ISL29018=y |
| @@ -284,7 +284,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, · 283 unmodified lines | |||
| 284 | err = blkcipher_walk_done(desc, &walk, | 284 | err = blkcipher_walk_done(desc, &walk, |
| 285 | walk.nbytes % AES_BLOCK_SIZE); | 285 | walk.nbytes % AES_BLOCK_SIZE); |
| 286 | } | 286 | } |
| 287 | if (nbytes) { | 287 | if (walk.nbytes % AES_BLOCK_SIZE) { |
| 288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
| 289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
| 290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
| 48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) | 48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) |
| 49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
| 50 | #define PMD_SECT_CACHE_MASK (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | ||
| 50 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) | 51 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) |
| 51 | 52 | ||
| 52 | /* | 53 | /* |
| @@ -62,6 +62,7 @@ · 61 unmodified lines | |||
| 62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ | 62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ |
| 63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ | 63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ |
| 64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ | 64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ |
| 65 | #define PMD_SECT_CACHE_MASK (_AT(pmdval_t, 7) << 2) | ||
| 65 | 66 | ||
| 66 | /* | 67 | /* |
| 67 | * + Level 3 descriptor (PTE) | 68 | * + Level 3 descriptor (PTE) |
| @@ -142,6 +142,19 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE · 141 unmodified lines | |||
| 142 | and r7, #0x1f @ Preserve HPMN | 142 | and r7, #0x1f @ Preserve HPMN |
| 143 | mcr p15, 4, r7, c1, c1, 1 @ HDCR | 143 | mcr p15, 4, r7, c1, c1, 1 @ HDCR |
| 144 | 144 | ||
| 145 | @ Make sure NS-SVC is initialised appropriately | ||
| 146 | mrc p15, 0, r7, c1, c0, 0 @ SCTLR | ||
| 147 | orr r7, #(1 << 5) @ CP15 barriers enabled | ||
| 148 | bic r7, #(3 << 7) @ Clear SED/ITD for v8 (RES0 for v7) | ||
| 149 | bic r7, #(3 << 19) @ WXN and UWXN disabled | ||
| 150 | mcr p15, 0, r7, c1, c0, 0 @ SCTLR | ||
| 151 | |||
| 152 | mrc p15, 0, r7, c0, c0, 0 @ MIDR | ||
| 153 | mcr p15, 4, r7, c0, c0, 0 @ VPIDR | ||
| 154 | |||
| 155 | mrc p15, 0, r7, c0, c0, 5 @ MPIDR | ||
| 156 | mcr p15, 4, r7, c0, c0, 5 @ VMPIDR | ||
| 157 | |||
| 145 | #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER) | 158 | #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER) |
| 146 | @ make CNTP_* and CNTPCT accessible from PL1 | 159 | @ make CNTP_* and CNTPCT accessible from PL1 |
| 147 | mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 | 160 | mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 |
| @@ -158,8 +158,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) · 157 unmodified lines | |||
| 158 | { | 158 | { |
| 159 | int i; | 159 | int i; |
| 160 | 160 | ||
| 161 | kvm_free_stage2_pgd(kvm); | ||
| 162 | |||
| 163 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 161 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
| 164 | if (kvm->vcpus[i]) { | 162 | if (kvm->vcpus[i]) { |
| 165 | kvm_arch_vcpu_free(kvm->vcpus[i]); | 163 | kvm_arch_vcpu_free(kvm->vcpus[i]); |
| @@ -1309,7 +1309,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 1308 unmodified lines | |||
| 1309 | smp_rmb(); | 1309 | smp_rmb(); |
| 1310 | 1310 | ||
| 1311 | pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable); | 1311 | pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable); |
| 1312 | if (is_error_pfn(pfn)) | 1312 | if (is_error_noslot_pfn(pfn)) |
| 1313 | return -EFAULT; | 1313 | return -EFAULT; |
| 1314 | 1314 | ||
| 1315 | if (kvm_is_device_pfn(pfn)) { | 1315 | if (kvm_is_device_pfn(pfn)) { |
| @@ -1714,7 +1714,8 @@ int kvm_mmu_init(void) · 398 unmodified lines | |||
| 1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); | 1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); |
| 1715 | 1715 | ||
| 1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && | 1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && |
| 1717 | hyp_idmap_start < kern_hyp_va(~0UL)) { | 1717 | hyp_idmap_start < kern_hyp_va(~0UL) && |
| 1718 | hyp_idmap_start != (unsigned long)__hyp_idmap_text_start) { | ||
| 1718 | /* | 1719 | /* |
| 1719 | * The idmap page is intersecting with the VA space, | 1720 | * The idmap page is intersecting with the VA space, |
| 1720 | * it is not safe to continue further. | 1721 | * it is not safe to continue further. |
| @@ -1893,6 +1894,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm, struct kvm_memslots *slots) · 172 unmodified lines | |||
| 1893 | 1894 | ||
| 1894 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | 1895 | void kvm_arch_flush_shadow_all(struct kvm *kvm) |
| 1895 | { | 1896 | { |
| 1897 | kvm_free_stage2_pgd(kvm); | ||
| 1896 | } | 1898 | } |
| 1897 | 1899 | ||
| 1898 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, | 1900 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, |
| @@ -255,6 +255,12 @@ static int __init exynos_pmu_irq_init(struct device_node *node, · 254 unmodified lines | |||
| 255 | return -ENOMEM; | 255 | return -ENOMEM; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* | ||
| 259 | * Clear the OF_POPULATED flag set in of_irq_init so that | ||
| 260 | * later the Exynos PMU platform device won't be skipped. | ||
| 261 | */ | ||
| 262 | of_node_clear_flag(node, OF_POPULATED); | ||
| 263 | |||
| 258 | return 0; | 264 | return 0; |
| 259 | } | 265 | } |
| 260 | 266 | ||
| @@ -64,6 +64,7 @@ static void __init imx6ul_init_machine(void) · 63 unmodified lines | |||
| 64 | if (parent == NULL) | 64 | if (parent == NULL) |
| 65 | pr_warn("failed to initialize soc device\n"); | 65 | pr_warn("failed to initialize soc device\n"); |
| 66 | 66 | ||
| 67 | of_platform_default_populate(NULL, NULL, parent); | ||
| 67 | imx6ul_enet_init(); | 68 | imx6ul_enet_init(); |
| 68 | imx_anatop_init(); | 69 | imx_anatop_init(); |
| 69 | imx6ul_pm_init(); | 70 | imx6ul_pm_init(); |
| @@ -295,7 +295,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) · 294 unmodified lines | |||
| 295 | val &= ~BM_CLPCR_SBYOS; | 295 | val &= ~BM_CLPCR_SBYOS; |
| 296 | if (cpu_is_imx6sl()) | 296 | if (cpu_is_imx6sl()) |
| 297 | val |= BM_CLPCR_BYPASS_PMIC_READY; | 297 | val |= BM_CLPCR_BYPASS_PMIC_READY; |
| 298 | if (cpu_is_imx6sl() || cpu_is_imx6sx()) | 298 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
| 299 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; | 299 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
| 300 | else | 300 | else |
| 301 | val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; | 301 | val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; |
| @@ -310,7 +310,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) · 8 unmodified lines | |||
| 310 | val |= 0x3 << BP_CLPCR_STBY_COUNT; | 310 | val |= 0x3 << BP_CLPCR_STBY_COUNT; |
| 311 | val |= BM_CLPCR_VSTBY; | 311 | val |= BM_CLPCR_VSTBY; |
| 312 | val |= BM_CLPCR_SBYOS; | 312 | val |= BM_CLPCR_SBYOS; |
| 313 | if (cpu_is_imx6sl()) | 313 | if (cpu_is_imx6sl() || cpu_is_imx6sx()) |
| 314 | val |= BM_CLPCR_BYPASS_PMIC_READY; | 314 | val |= BM_CLPCR_BYPASS_PMIC_READY; |
| 315 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) | 315 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
| 316 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; | 316 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
| @@ -220,9 +220,6 @@ static int am33xx_cm_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs, · 219 unmodified lines | |||
| 220 | { | 220 | { |
| 221 | int i = 0; | 221 | int i = 0; |
| 222 | 222 | ||
| 223 | if (!clkctrl_offs) | ||
| 224 | return 0; | ||
| 225 | |||
| 226 | omap_test_timeout(_is_module_ready(inst, clkctrl_offs), | 223 | omap_test_timeout(_is_module_ready(inst, clkctrl_offs), |
| 227 | MAX_MODULE_READY_TIME, i); | 224 | MAX_MODULE_READY_TIME, i); |
| 228 | 225 | ||
| @@ -246,9 +243,6 @@ static int am33xx_cm_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs, · 17 unmodified lines | |||
| 246 | { | 243 | { |
| 247 | int i = 0; | 244 | int i = 0; |
| 248 | 245 | ||
| 249 | if (!clkctrl_offs) | ||
| 250 | return 0; | ||
| 251 | |||
| 252 | omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) == | 246 | omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) == |
| 253 | CLKCTRL_IDLEST_DISABLED), | 247 | CLKCTRL_IDLEST_DISABLED), |
| 254 | MAX_MODULE_READY_TIME, i); | 248 | MAX_MODULE_READY_TIME, i); |
| @@ -278,9 +278,6 @@ static int omap4_cminst_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs, · 277 unmodified lines | |||
| 278 | { | 278 | { |
| 279 | int i = 0; | 279 | int i = 0; |
| 280 | 280 | ||
| 281 | if (!clkctrl_offs) | ||
| 282 | return 0; | ||
| 283 | |||
| 284 | omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs), | 281 | omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs), |
| 285 | MAX_MODULE_READY_TIME, i); | 282 | MAX_MODULE_READY_TIME, i); |
| 286 | 283 | ||
| @@ -304,9 +301,6 @@ static int omap4_cminst_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs, · 17 unmodified lines | |||
| 304 | { | 301 | { |
| 305 | int i = 0; | 302 | int i = 0; |
| 306 | 303 | ||
| 307 | if (!clkctrl_offs) | ||
| 308 | return 0; | ||
| 309 | |||
| 310 | omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) == | 304 | omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) == |
| 311 | CLKCTRL_IDLEST_DISABLED), | 305 | CLKCTRL_IDLEST_DISABLED), |
| 312 | MAX_MODULE_DISABLE_TIME, i); | 306 | MAX_MODULE_DISABLE_TIME, i); |
| @@ -1053,6 +1053,10 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh) · 1052 unmodified lines | |||
| 1053 | if (oh->flags & HWMOD_NO_IDLEST) | 1053 | if (oh->flags & HWMOD_NO_IDLEST) |
| 1054 | return 0; | 1054 | return 0; |
| 1055 | 1055 | ||
| 1056 | if (!oh->prcm.omap4.clkctrl_offs && | ||
| 1057 | !(oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET)) | ||
| 1058 | return 0; | ||
| 1059 | |||
| 1056 | return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, | 1060 | return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, |
| 1057 | oh->clkdm->cm_inst, | 1061 | oh->clkdm->cm_inst, |
| 1058 | oh->prcm.omap4.clkctrl_offs, 0); | 1062 | oh->prcm.omap4.clkctrl_offs, 0); |
| @@ -2971,6 +2975,10 @@ static int _omap4_wait_target_ready(struct omap_hwmod *oh) · 1912 unmodified lines | |||
| 2971 | if (!_find_mpu_rt_port(oh)) | 2975 | if (!_find_mpu_rt_port(oh)) |
| 2972 | return 0; | 2976 | return 0; |
| 2973 | 2977 | ||
| 2978 | if (!oh->prcm.omap4.clkctrl_offs && | ||
| 2979 | !(oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET)) | ||
| 2980 | return 0; | ||
| 2981 | |||
| 2974 | /* XXX check module SIDLEMODE, hardreset status */ | 2982 | /* XXX check module SIDLEMODE, hardreset status */ |
| 2975 | 2983 | ||
| 2976 | return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, | 2984 | return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, |
| @@ -443,8 +443,12 @@ struct omap_hwmod_omap2_prcm { · 442 unmodified lines | |||
| 443 | * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM | 443 | * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM |
| 444 | * module-level context loss register associated with them; this | 444 | * module-level context loss register associated with them; this |
| 445 | * flag bit should be set in those cases | 445 | * flag bit should be set in those cases |
| 446 | * HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET: Some IP blocks have a valid CLKCTRL | ||
| 447 | * offset of zero; this flag bit should be set in those cases to | ||
| 448 | * distinguish from hwmods that have no clkctrl offset. | ||
| 446 | */ | 449 | */ |
| 447 | #define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0) | 450 | #define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0) |
| 451 | #define HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET (1 << 1) | ||
| 448 | 452 | ||
| 449 | /** | 453 | /** |
| 450 | * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data | 454 | * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) | 29 | #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) |
| 30 | #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) | 30 | #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) |
| 31 | #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst)) | 31 | #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst)) |
| 32 | #define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag)) | ||
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| 34 | * 'l3' class | 35 | * 'l3' class |
| @@ -1296,6 +1297,7 @@ static void omap_hwmod_am33xx_clkctrl(void) · 1261 unmodified lines | |||
| 1296 | CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET); | 1297 | CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET); |
| 1297 | CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET); | 1298 | CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET); |
| 1298 | CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET); | 1299 | CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET); |
| 1300 | PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET); | ||
| 1299 | CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET); | 1301 | CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET); |
| 1300 | CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET); | 1302 | CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET); |
| 1301 | CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET); | 1303 | CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET); |
| @@ -722,8 +722,20 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { · 721 unmodified lines | |||
| 722 | * display serial interface controller | 722 | * display serial interface controller |
| 723 | */ | 723 | */ |
| 724 | 724 | ||
| 725 | static struct omap_hwmod_class_sysconfig omap3xxx_dsi_sysc = { | ||
| 726 | .rev_offs = 0x0000, | ||
| 727 | .sysc_offs = 0x0010, | ||
| 728 | .syss_offs = 0x0014, | ||
| 729 | .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | | ||
| 730 | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | | ||
| 731 | SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), | ||
| 732 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | ||
| 733 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
| 734 | }; | ||
| 735 | |||
| 725 | static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { | 736 | static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { |
| 726 | .name = "dsi", | 737 | .name = "dsi", |
| 738 | .sysc = &omap3xxx_dsi_sysc, | ||
| 727 | }; | 739 | }; |
| 728 | 740 | ||
| 729 | static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = { | 741 | static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = { |
| @@ -83,7 +83,8 @@ static struct resource smc91x_resources[] = { · 82 unmodified lines | |||
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | static struct smc91x_platdata smc91x_platdata = { | 85 | static struct smc91x_platdata smc91x_platdata = { |
| 86 | .flags = SMC91X_USE_32BIT | SMC91X_USE_DMA | SMC91X_NOWAIT, | 86 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
| 87 | SMC91X_USE_DMA | SMC91X_NOWAIT, | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | static struct platform_device smc91x_device = { | 90 | static struct platform_device smc91x_device = { |
| @@ -137,6 +137,18 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = { · 136 unmodified lines | |||
| 137 | // no D+ pullup; lubbock can't connect/disconnect in software | 137 | // no D+ pullup; lubbock can't connect/disconnect in software |
| 138 | }; | 138 | }; |
| 139 | 139 | ||
| 140 | static void lubbock_init_pcmcia(void) | ||
| 141 | { | ||
| 142 | struct clk *clk; | ||
| 143 | |||
| 144 | /* Add an alias for the SA1111 PCMCIA clock */ | ||
| 145 | clk = clk_get_sys("pxa2xx-pcmcia", NULL); | ||
| 146 | if (!IS_ERR(clk)) { | ||
| 147 | clkdev_create(clk, NULL, "1800"); | ||
| 148 | clk_put(clk); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 140 | static struct resource sa1111_resources[] = { | 152 | static struct resource sa1111_resources[] = { |
| 141 | [0] = { | 153 | [0] = { |
| 142 | .start = 0x10000000, | 154 | .start = 0x10000000, |
| @@ -467,6 +479,8 @@ static void __init lubbock_init(void) · 324 unmodified lines | |||
| 467 | pxa_set_btuart_info(NULL); | 479 | pxa_set_btuart_info(NULL); |
| 468 | pxa_set_stuart_info(NULL); | 480 | pxa_set_stuart_info(NULL); |
| 469 | 481 | ||
| 482 | lubbock_init_pcmcia(); | ||
| 483 | |||
| 470 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); | 484 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); |
| 471 | pxa_set_udc_info(&udc_info); | 485 | pxa_set_udc_info(&udc_info); |
| 472 | pxa_set_fb_info(NULL, &sharp_lm8v31); | 486 | pxa_set_fb_info(NULL, &sharp_lm8v31); |
| @@ -120,7 +120,8 @@ static struct resource smc91x_resources[] = { · 119 unmodified lines | |||
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | static struct smc91x_platdata xcep_smc91x_info = { | 122 | static struct smc91x_platdata xcep_smc91x_info = { |
| 123 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA, | 123 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
| 124 | SMC91X_NOWAIT | SMC91X_USE_DMA, | ||
| 124 | }; | 125 | }; |
| 125 | 126 | ||
| 126 | static struct platform_device smc91x_device = { | 127 | static struct platform_device smc91x_device = { |
| @@ -93,7 +93,8 @@ static struct smsc911x_platform_config smsc911x_config = { · 92 unmodified lines | |||
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct smc91x_platdata smc91x_platdata = { | 95 | static struct smc91x_platdata smc91x_platdata = { |
| 96 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, | 96 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
| 97 | SMC91X_NOWAIT, | ||
| 97 | }; | 98 | }; |
| 98 | 99 | ||
| 99 | static struct platform_device realview_eth_device = { | 100 | static struct platform_device realview_eth_device = { |
| @@ -497,9 +497,28 @@ static struct i2c_board_info mini2440_i2c_devs[] __initdata = { · 496 unmodified lines | |||
| 497 | }, | 497 | }, |
| 498 | }; | 498 | }; |
| 499 | 499 | ||
| 500 | static struct uda134x_platform_data s3c24xx_uda134x = { | ||
| 501 | .l3 = { | ||
| 502 | .gpio_clk = S3C2410_GPB(4), | ||
| 503 | .gpio_data = S3C2410_GPB(3), | ||
| 504 | .gpio_mode = S3C2410_GPB(2), | ||
| 505 | .use_gpios = 1, | ||
| 506 | .data_hold = 1, | ||
| 507 | .data_setup = 1, | ||
| 508 | .clock_high = 1, | ||
| 509 | .mode_hold = 1, | ||
| 510 | .mode = 1, | ||
| 511 | .mode_setup = 1, | ||
| 512 | }, | ||
| 513 | .model = UDA134X_UDA1341, | ||
| 514 | }; | ||
| 515 | |||
| 500 | static struct platform_device uda1340_codec = { | 516 | static struct platform_device uda1340_codec = { |
| 501 | .name = "uda134x-codec", | 517 | .name = "uda134x-codec", |
| 502 | .id = -1, | 518 | .id = -1, |
| 519 | .dev = { | ||
| 520 | .platform_data = &s3c24xx_uda134x, | ||
| 521 | }, | ||
| 503 | }; | 522 | }; |
| 504 | 523 | ||
| 505 | static struct platform_device *mini2440_devices[] __initdata = { | 524 | static struct platform_device *mini2440_devices[] __initdata = { |
| @@ -125,6 +125,8 @@ static unsigned long clk_36864_get_rate(struct clk *clk) · 124 unmodified lines | |||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | static struct clkops clk_36864_ops = { | 127 | static struct clkops clk_36864_ops = { |
| 128 | .enable = clk_cpu_enable, | ||
| 129 | .disable = clk_cpu_disable, | ||
| 128 | .get_rate = clk_36864_get_rate, | 130 | .get_rate = clk_36864_get_rate, |
| 129 | }; | 131 | }; |
| 130 | 132 | ||
| @@ -140,9 +142,8 @@ static struct clk_lookup sa11xx_clkregs[] = { · 9 unmodified lines | |||
| 140 | CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864), | 142 | CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864), |
| 141 | }; | 143 | }; |
| 142 | 144 | ||
| 143 | static int __init sa11xx_clk_init(void) | 145 | int __init sa11xx_clk_init(void) |
| 144 | { | 146 | { |
| 145 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); | 147 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); |
| 146 | return 0; | 148 | return 0; |
| 147 | } | 149 | } |
| 148 | core_initcall(sa11xx_clk_init); | ||
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
| 36 | #include <mach/irqs.h> | 36 | #include <mach/irqs.h> |
| 37 | #include <mach/reset.h> | ||
| 37 | 38 | ||
| 38 | #include "generic.h" | 39 | #include "generic.h" |
| 39 | #include <clocksource/pxa.h> | 40 | #include <clocksource/pxa.h> |
| @@ -95,6 +96,8 @@ static void sa1100_power_off(void) · 55 unmodified lines | |||
| 95 | 96 | ||
| 96 | void sa11x0_restart(enum reboot_mode mode, const char *cmd) | 97 | void sa11x0_restart(enum reboot_mode mode, const char *cmd) |
| 97 | { | 98 | { |
| 99 | clear_reset_status(RESET_STATUS_ALL); | ||
| 100 | |||
| 98 | if (mode == REBOOT_SOFT) { | 101 | if (mode == REBOOT_SOFT) { |
| 99 | /* Jump into ROM at address 0 */ | 102 | /* Jump into ROM at address 0 */ |
| 100 | soft_restart(0); | 103 | soft_restart(0); |
| @@ -388,6 +391,7 @@ void __init sa1100_init_irq(void) · 287 unmodified lines | |||
| 388 | sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start); | 391 | sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start); |
| 389 | 392 | ||
| 390 | sa1100_init_gpio(); | 393 | sa1100_init_gpio(); |
| 394 | sa11xx_clk_init(); | ||
| 391 | } | 395 | } |
| 392 | 396 | ||
| 393 | /* | 397 | /* |
| @@ -44,3 +44,5 @@ int sa11x0_pm_init(void); · 43 unmodified lines | |||
| 44 | #else | 44 | #else |
| 45 | static inline int sa11x0_pm_init(void) { return 0; } | 45 | static inline int sa11x0_pm_init(void) { return 0; } |
| 46 | #endif | 46 | #endif |
| 47 | |||
| 48 | int sa11xx_clk_init(void); | ||
| @@ -45,7 +45,7 @@ static struct resource smc91x_resources[] = { · 44 unmodified lines | |||
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | static struct smc91x_platdata smc91x_platdata = { | 47 | static struct smc91x_platdata smc91x_platdata = { |
| 48 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | 48 | .flags = SMC91X_USE_16BIT | SMC91X_USE_8BIT | SMC91X_NOWAIT, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static struct platform_device smc91x_device = { | 51 | static struct platform_device smc91x_device = { |
| @@ -41,39 +41,26 @@ · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ | 42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ |
| 43 | 43 | ||
| 44 | static void __iomem *irqc; | 44 | /* start of DA9210 System Control and Event Registers */ |
| 45 | |||
| 46 | static const u8 da9063_mask_regs[] = { | ||
| 47 | DA9063_REG_IRQ_MASK_A, | ||
| 48 | DA9063_REG_IRQ_MASK_B, | ||
| 49 | DA9063_REG_IRQ_MASK_C, | ||
| 50 | DA9063_REG_IRQ_MASK_D, | ||
| 51 | }; | ||
| 52 | |||
| 53 | /* DA9210 System Control and Event Registers */ | ||
| 54 | #define DA9210_REG_MASK_A 0x54 | 45 | #define DA9210_REG_MASK_A 0x54 |
| 55 | #define DA9210_REG_MASK_B 0x55 | ||
| 56 | |||
| 57 | static const u8 da9210_mask_regs[] = { | ||
| 58 | DA9210_REG_MASK_A, | ||
| 59 | DA9210_REG_MASK_B, | ||
| 60 | }; | ||
| 61 | |||
| 62 | static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[], | ||
| 63 | unsigned int nregs) | ||
| 64 | { | ||
| 65 | unsigned int i; | ||
| 66 | 46 | ||
| 67 | dev_info(&client->dev, "Masking %s interrupt sources\n", client->name); | 47 | static void __iomem *irqc; |
| 68 | 48 | ||
| 69 | for (i = 0; i < nregs; i++) { | 49 | /* first byte sets the memory pointer, following are consecutive reg values */ |
| 70 | int error = i2c_smbus_write_byte_data(client, regs[i], ~0); | 50 | static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff }; |
| 71 | if (error) { | 51 | static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff }; |
| 72 | dev_err(&client->dev, "i2c error %d\n", error); | 52 | |
| 73 | return; | 53 | static struct i2c_msg da9xxx_msgs[2] = { |
| 74 | } | 54 | { |
| 75 | } | 55 | .addr = 0x58, |
| 76 | } | 56 | .len = ARRAY_SIZE(da9063_irq_clr), |
| 57 | .buf = da9063_irq_clr, | ||
| 58 | }, { | ||
| 59 | .addr = 0x68, | ||
| 60 | .len = ARRAY_SIZE(da9210_irq_clr), | ||
| 61 | .buf = da9210_irq_clr, | ||
| 62 | }, | ||
| 63 | }; | ||
| 77 | 64 | ||
| 78 | static int regulator_quirk_notify(struct notifier_block *nb, | 65 | static int regulator_quirk_notify(struct notifier_block *nb, |
| 79 | unsigned long action, void *data) | 66 | unsigned long action, void *data) |
| @@ -93,12 +80,15 @@ static int regulator_quirk_notify(struct notifier_block *nb, · 13 unmodified lines | |||
| 93 | client = to_i2c_client(dev); | 80 | client = to_i2c_client(dev); |
| 94 | dev_dbg(dev, "Detected %s\n", client->name); | 81 | dev_dbg(dev, "Detected %s\n", client->name); |
| 95 | 82 | ||
| 96 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063"))) | 83 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) || |
| 97 | da9xxx_mask_irqs(client, da9063_mask_regs, | 84 | (client->addr == 0x68 && !strcmp(client->name, "da9210"))) { |
| 98 | ARRAY_SIZE(da9063_mask_regs)); | 85 | int ret; |
| 99 | else if (client->addr == 0x68 && !strcmp(client->name, "da9210")) | 86 | |
| 100 | da9xxx_mask_irqs(client, da9210_mask_regs, | 87 | dev_info(&client->dev, "clearing da9063/da9210 interrupts\n"); |
| 101 | ARRAY_SIZE(da9210_mask_regs)); | 88 | ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs)); |
| 89 | if (ret != ARRAY_SIZE(da9xxx_msgs)) | ||
| 90 | dev_err(&client->dev, "i2c error %d\n", ret); | ||
| 91 | } | ||
| 102 | 92 | ||
| 103 | mon = ioread32(irqc + IRQC_MONITOR); | 93 | mon = ioread32(irqc + IRQC_MONITOR); |
| 104 | if (mon & REGULATOR_IRQ_MASK) | 94 | if (mon & REGULATOR_IRQ_MASK) |
| @@ -137,7 +137,7 @@ void __init init_default_cache_policy(unsigned long pmd) · 136 unmodified lines | |||
| 137 | 137 | ||
| 138 | initial_pmd_value = pmd; | 138 | initial_pmd_value = pmd; |
| 139 | 139 | ||
| 140 | pmd &= PMD_SECT_TEX(1) | PMD_SECT_BUFFERABLE | PMD_SECT_CACHEABLE; | 140 | pmd &= PMD_SECT_CACHE_MASK; |
| 141 | 141 | ||
| 142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) | 142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) |
| 143 | if (cache_policies[i].pmd == pmd) { | 143 | if (cache_policies[i].pmd == pmd) { |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <asm/hwcap.h> | 16 | #include <asm/hwcap.h> |
| 17 | #include <asm/pgtable-hwdef.h> | 17 | #include <asm/pgtable-hwdef.h> |
| 18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
| 19 | #include <asm/memory.h> | ||
| 19 | 20 | ||
| 20 | #include "proc-macros.S" | 21 | #include "proc-macros.S" |
| 21 | 22 | ||
| @@ -50,7 +50,7 @@ DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); · 49 unmodified lines | |||
| 50 | static struct vcpu_info __percpu *xen_vcpu_info; | 50 | static struct vcpu_info __percpu *xen_vcpu_info; |
| 51 | 51 | ||
| 52 | /* Linux <-> Xen vCPU id mapping */ | 52 | /* Linux <-> Xen vCPU id mapping */ |
| 53 | DEFINE_PER_CPU(int, xen_vcpu_id) = -1; | 53 | DEFINE_PER_CPU(uint32_t, xen_vcpu_id); |
| 54 | EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); | 54 | EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); |
| 55 | 55 | ||
| 56 | /* These are unused until we support booting "pre-ballooned" */ | 56 | /* These are unused until we support booting "pre-ballooned" */ |
| @@ -170,9 +170,6 @@ static int xen_starting_cpu(unsigned int cpu) · 113 unmodified lines | |||
| 170 | pr_info("Xen: initializing cpu%d\n", cpu); | 170 | pr_info("Xen: initializing cpu%d\n", cpu); |
| 171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); | 171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); |
| 172 | 172 | ||
| 173 | /* Direct vCPU id mapping for ARM guests. */ | ||
| 174 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
| 175 | |||
| 176 | info.mfn = virt_to_gfn(vcpup); | 173 | info.mfn = virt_to_gfn(vcpup); |
| 177 | info.offset = xen_offset_in_page(vcpup); | 174 | info.offset = xen_offset_in_page(vcpup); |
| 178 | 175 | ||
| @@ -330,6 +327,7 @@ static int __init xen_guest_init(void) · 151 unmodified lines | |||
| 330 | { | 327 | { |
| 331 | struct xen_add_to_physmap xatp; | 328 | struct xen_add_to_physmap xatp; |
| 332 | struct shared_info *shared_info_page = NULL; | 329 | struct shared_info *shared_info_page = NULL; |
| 330 | int cpu; | ||
| 333 | 331 | ||
| 334 | if (!xen_domain()) | 332 | if (!xen_domain()) |
| 335 | return 0; | 333 | return 0; |
| @@ -380,7 +378,8 @@ static int __init xen_guest_init(void) · 44 unmodified lines | |||
| 380 | return -ENOMEM; | 378 | return -ENOMEM; |
| 381 | 379 | ||
| 382 | /* Direct vCPU id mapping for ARM guests. */ | 380 | /* Direct vCPU id mapping for ARM guests. */ |
| 383 | per_cpu(xen_vcpu_id, 0) = 0; | 381 | for_each_possible_cpu(cpu) |
| 382 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
| 384 | 383 | ||
| 385 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); | 384 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); |
| 386 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, | 385 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, |
| @@ -255,10 +255,10 @@ · 254 unmodified lines | |||
| 255 | /* Local timer */ | 255 | /* Local timer */ |
| 256 | timer { | 256 | timer { |
| 257 | compatible = "arm,armv8-timer"; | 257 | compatible = "arm,armv8-timer"; |
| 258 | interrupts = <1 13 0xf01>, | 258 | interrupts = <1 13 0xf08>, |
| 259 | <1 14 0xf01>, | 259 | <1 14 0xf08>, |
| 260 | <1 11 0xf01>, | 260 | <1 11 0xf08>, |
| 261 | <1 10 0xf01>; | 261 | <1 10 0xf08>; |
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | timer0: timer0@ffc03000 { | 264 | timer0: timer0@ffc03000 { |
| @@ -102,13 +102,13 @@ · 101 unmodified lines | |||
| 102 | timer { | 102 | timer { |
| 103 | compatible = "arm,armv8-timer"; | 103 | compatible = "arm,armv8-timer"; |
| 104 | interrupts = <GIC_PPI 13 | 104 | interrupts = <GIC_PPI 13 |
| 105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
| 106 | <GIC_PPI 14 | 106 | <GIC_PPI 14 |
| 107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
| 108 | <GIC_PPI 11 | 108 | <GIC_PPI 11 |
| 109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
| 110 | <GIC_PPI 10 | 110 | <GIC_PPI 10 |
| 111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>; | 111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>; |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | xtal: xtal-clk { | 114 | xtal: xtal-clk { |
| @@ -110,10 +110,10 @@ · 109 unmodified lines | |||
| 110 | 110 | ||
| 111 | timer { | 111 | timer { |
| 112 | compatible = "arm,armv8-timer"; | 112 | compatible = "arm,armv8-timer"; |
| 113 | interrupts = <1 0 0xff01>, /* Secure Phys IRQ */ | 113 | interrupts = <1 0 0xff08>, /* Secure Phys IRQ */ |
| 114 | <1 13 0xff01>, /* Non-secure Phys IRQ */ | 114 | <1 13 0xff08>, /* Non-secure Phys IRQ */ |
| 115 | <1 14 0xff01>, /* Virt IRQ */ | 115 | <1 14 0xff08>, /* Virt IRQ */ |
| 116 | <1 15 0xff01>; /* Hyp IRQ */ | 116 | <1 15 0xff08>; /* Hyp IRQ */ |
| 117 | clock-frequency = <50000000>; | 117 | clock-frequency = <50000000>; |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| @@ -0,0 +1 @@ | |||
| 1 | ../../../../arm/boot/dts/bcm2835-rpi.dtsi | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /dts-v1/; | 1 | /dts-v1/; |
| 2 | #include "bcm2837.dtsi" | 2 | #include "bcm2837.dtsi" |
| 3 | #include "../../../../arm/boot/dts/bcm2835-rpi.dtsi" | 3 | #include "bcm2835-rpi.dtsi" |
| 4 | #include "../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi" | 4 | #include "bcm283x-rpi-smsc9514.dtsi" |
| 5 | 5 | ||
| 6 | / { | 6 | / { |
| 7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; | 7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | #include "../../../../arm/boot/dts/bcm283x.dtsi" | 1 | #include "bcm283x.dtsi" |
| 2 | 2 | ||
| 3 | / { | 3 | / { |
| 4 | compatible = "brcm,bcm2836"; | 4 | compatible = "brcm,bcm2836"; |
| @@ -0,0 +1 @@ | |||
| 1 | ../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi | ||
| @@ -0,0 +1 @@ | |||
| 1 | ../../../../arm/boot/dts/bcm283x.dtsi | ||
| @@ -88,13 +88,13 @@ · 87 unmodified lines | |||
| 88 | timer { | 88 | timer { |
| 89 | compatible = "arm,armv8-timer"; | 89 | compatible = "arm,armv8-timer"; |
| 90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | | 90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | |
| 91 | IRQ_TYPE_EDGE_RISING)>, | 91 | IRQ_TYPE_LEVEL_LOW)>, |
| 92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | | 92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | |
| 93 | IRQ_TYPE_EDGE_RISING)>, | 93 | IRQ_TYPE_LEVEL_LOW)>, |
| 94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | | 94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | |
| 95 | IRQ_TYPE_EDGE_RISING)>, | 95 | IRQ_TYPE_LEVEL_LOW)>, |
| 96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | | 96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | |
| 97 | IRQ_TYPE_EDGE_RISING)>; | 97 | IRQ_TYPE_LEVEL_LOW)>; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | pmu { | 100 | pmu { |
| @@ -354,10 +354,10 @@ · 353 unmodified lines | |||
| 354 | 354 | ||
| 355 | timer { | 355 | timer { |
| 356 | compatible = "arm,armv8-timer"; | 356 | compatible = "arm,armv8-timer"; |
| 357 | interrupts = <1 13 0xff01>, | 357 | interrupts = <1 13 4>, |
| 358 | <1 14 0xff01>, | 358 | <1 14 4>, |
| 359 | <1 11 0xff01>, | 359 | <1 11 4>, |
| 360 | <1 10 0xff01>; | 360 | <1 10 4>; |
| 361 | }; | 361 | }; |
| 362 | 362 | ||
| 363 | pmu { | 363 | pmu { |
| @@ -473,10 +473,10 @@ · 472 unmodified lines | |||
| 473 | 473 | ||
| 474 | timer { | 474 | timer { |
| 475 | compatible = "arm,armv8-timer"; | 475 | compatible = "arm,armv8-timer"; |
| 476 | interrupts = <1 13 0xff01>, | 476 | interrupts = <1 13 0xff08>, |
| 477 | <1 14 0xff01>, | 477 | <1 14 0xff08>, |
| 478 | <1 11 0xff01>, | 478 | <1 11 0xff08>, |
| 479 | <1 10 0xff01>; | 479 | <1 10 0xff08>; |
| 480 | }; | 480 | }; |
| 481 | 481 | ||
| 482 | pmu_system_controller: system-controller@105c0000 { | 482 | pmu_system_controller: system-controller@105c0000 { |
| @@ -119,10 +119,10 @@ · 118 unmodified lines | |||
| 119 | 119 | ||
| 120 | timer { | 120 | timer { |
| 121 | compatible = "arm,armv8-timer"; | 121 | compatible = "arm,armv8-timer"; |
| 122 | interrupts = <1 13 0x1>, /* Physical Secure PPI */ | 122 | interrupts = <1 13 0xf08>, /* Physical Secure PPI */ |
| 123 | <1 14 0x1>, /* Physical Non-Secure PPI */ | 123 | <1 14 0xf08>, /* Physical Non-Secure PPI */ |
| 124 | <1 11 0x1>, /* Virtual PPI */ | 124 | <1 11 0xf08>, /* Virtual PPI */ |
| 125 | <1 10 0x1>; /* Hypervisor PPI */ | 125 | <1 10 0xf08>; /* Hypervisor PPI */ |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | pmu { | 128 | pmu { |
| @@ -191,10 +191,10 @@ · 190 unmodified lines | |||
| 191 | 191 | ||
| 192 | timer { | 192 | timer { |
| 193 | compatible = "arm,armv8-timer"; | 193 | compatible = "arm,armv8-timer"; |
| 194 | interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ | 194 | interrupts = <1 13 4>, /* Physical Secure PPI, active-low */ |
| 195 | <1 14 0x8>, /* Physical Non-Secure PPI, active-low */ | 195 | <1 14 4>, /* Physical Non-Secure PPI, active-low */ |
| 196 | <1 11 0x8>, /* Virtual PPI, active-low */ | 196 | <1 11 4>, /* Virtual PPI, active-low */ |
| 197 | <1 10 0x8>; /* Hypervisor PPI, active-low */ | 197 | <1 10 4>; /* Hypervisor PPI, active-low */ |
| 198 | }; | 198 | }; |
| 199 | 199 | ||
| 200 | pmu { | 200 | pmu { |
| @@ -122,10 +122,10 @@ · 121 unmodified lines | |||
| 122 | 122 | ||
| 123 | timer { | 123 | timer { |
| 124 | compatible = "arm,armv8-timer"; | 124 | compatible = "arm,armv8-timer"; |
| 125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
| 126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
| 127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
| 128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; | 128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | odmi: odmi@300000 { | 131 | odmi: odmi@300000 { |
| @@ -270,6 +270,8 @@ · 269 unmodified lines | |||
| 270 | #io-channel-cells = <1>; | 270 | #io-channel-cells = <1>; |
| 271 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; | 271 | clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; |
| 272 | clock-names = "saradc", "apb_pclk"; | 272 | clock-names = "saradc", "apb_pclk"; |
| 273 | resets = <&cru SRST_SARADC>; | ||
| 274 | reset-names = "saradc-apb"; | ||
| 273 | status = "disabled"; | 275 | status = "disabled"; |
| 274 | }; | 276 | }; |
| 275 | 277 | ||
| @@ -129,10 +129,10 @@ · 128 unmodified lines | |||
| 129 | 129 | ||
| 130 | timer { | 130 | timer { |
| 131 | compatible = "arm,armv8-timer"; | 131 | compatible = "arm,armv8-timer"; |
| 132 | interrupts = <1 13 0xf01>, | 132 | interrupts = <1 13 4>, |
| 133 | <1 14 0xf01>, | 133 | <1 14 4>, |
| 134 | <1 11 0xf01>, | 134 | <1 11 4>, |
| 135 | <1 10 0xf01>; | 135 | <1 10 4>; |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | soc { | 138 | soc { |
| @@ -65,10 +65,10 @@ · 64 unmodified lines | |||
| 65 | timer { | 65 | timer { |
| 66 | compatible = "arm,armv8-timer"; | 66 | compatible = "arm,armv8-timer"; |
| 67 | interrupt-parent = <&gic>; | 67 | interrupt-parent = <&gic>; |
| 68 | interrupts = <1 13 0xf01>, | 68 | interrupts = <1 13 0xf08>, |
| 69 | <1 14 0xf01>, | 69 | <1 14 0xf08>, |
| 70 | <1 11 0xf01>, | 70 | <1 11 0xf08>, |
| 71 | <1 10 0xf01>; | 71 | <1 10 0xf08>; |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | amba_apu { | 74 | amba_apu { |
| @@ -216,7 +216,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, · 215 unmodified lines | |||
| 216 | err = blkcipher_walk_done(desc, &walk, | 216 | err = blkcipher_walk_done(desc, &walk, |
| 217 | walk.nbytes % AES_BLOCK_SIZE); | 217 | walk.nbytes % AES_BLOCK_SIZE); |
| 218 | } | 218 | } |
| 219 | if (nbytes) { | 219 | if (walk.nbytes % AES_BLOCK_SIZE) { |
| 220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
| 221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
| 222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
| @@ -61,8 +61,6 @@ · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | #define AARCH64_BREAK_KGDB_DYN_DBG \ | 62 | #define AARCH64_BREAK_KGDB_DYN_DBG \ |
| 63 | (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5)) | 63 | (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5)) |
| 64 | #define KGDB_DYN_BRK_INS_BYTE(x) \ | ||
| 65 | ((AARCH64_BREAK_KGDB_DYN_DBG >> (8 * (x))) & 0xff) | ||
| 66 | 64 | ||
| 67 | #define CACHE_FLUSH_IS_SAFE 1 | 65 | #define CACHE_FLUSH_IS_SAFE 1 |
| 68 | 66 | ||
| @@ -199,19 +199,19 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, · 198 unmodified lines | |||
| 199 | #define _percpu_read(pcp) \ | 199 | #define _percpu_read(pcp) \ |
| 200 | ({ \ | 200 | ({ \ |
| 201 | typeof(pcp) __retval; \ | 201 | typeof(pcp) __retval; \ |
| 202 | preempt_disable(); \ | 202 | preempt_disable_notrace(); \ |
| 203 | __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ | 203 | __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ |
| 204 | sizeof(pcp)); \ | 204 | sizeof(pcp)); \ |
| 205 | preempt_enable(); \ | 205 | preempt_enable_notrace(); \ |
| 206 | __retval; \ | 206 | __retval; \ |
| 207 | }) | 207 | }) |
| 208 | 208 | ||
| 209 | #define _percpu_write(pcp, val) \ | 209 | #define _percpu_write(pcp, val) \ |
| 210 | do { \ | 210 | do { \ |
| 211 | preempt_disable(); \ | 211 | preempt_disable_notrace(); \ |
| 212 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ | 212 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ |
| 213 | sizeof(pcp)); \ | 213 | sizeof(pcp)); \ |
| 214 | preempt_enable(); \ | 214 | preempt_enable_notrace(); \ |
| 215 | } while(0) \ | 215 | } while(0) \ |
| 216 | 216 | ||
| 217 | #define _pcp_protect(operation, pcp, val) \ | 217 | #define _pcp_protect(operation, pcp, val) \ |
| @@ -363,4 +363,14 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) · 362 unmodified lines | |||
| 363 | #define arch_read_relax(lock) cpu_relax() | 363 | #define arch_read_relax(lock) cpu_relax() |
| 364 | #define arch_write_relax(lock) cpu_relax() | 364 | #define arch_write_relax(lock) cpu_relax() |
| 365 | 365 | ||
| 366 | /* | ||
| 367 | * Accesses appearing in program order before a spin_lock() operation | ||
| 368 | * can be reordered with accesses inside the critical section, by virtue | ||
| 369 | * of arch_spin_lock being constructed using acquire semantics. | ||
| 370 | * | ||
| 371 | * In cases where this is problematic (e.g. try_to_wake_up), an | ||
| 372 | * smp_mb__before_spinlock() can restore the required ordering. | ||
| 373 | */ | ||
| 374 | #define smp_mb__before_spinlock() smp_mb() | ||
| 375 | |||
| 366 | #endif /* __ASM_SPINLOCK_H */ | 376 | #endif /* __ASM_SPINLOCK_H */ |
| @@ -757,6 +757,9 @@ ENTRY(__enable_mmu) · 756 unmodified lines | |||
| 757 | isb | 757 | isb |
| 758 | bl __create_page_tables // recreate kernel mapping | 758 | bl __create_page_tables // recreate kernel mapping |
| 759 | 759 | ||
| 760 | tlbi vmalle1 // Remove any stale TLB entries | ||
| 761 | dsb nsh | ||
| 762 | |||
| 760 | msr sctlr_el1, x19 // re-enable the MMU | 763 | msr sctlr_el1, x19 // re-enable the MMU |
| 761 | isb | 764 | isb |
| 762 | ic iallu // flush instructions fetched | 765 | ic iallu // flush instructions fetched |
| @@ -19,10 +19,13 @@ · 18 unmodified lines | |||
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/bug.h> | ||
| 22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
| 23 | #include <linux/kdebug.h> | 24 | #include <linux/kdebug.h> |
| 24 | #include <linux/kgdb.h> | 25 | #include <linux/kgdb.h> |
| 25 | #include <linux/kprobes.h> | 26 | #include <linux/kprobes.h> |
| 27 | #include <asm/debug-monitors.h> | ||
| 28 | #include <asm/insn.h> | ||
| 26 | #include <asm/traps.h> | 29 | #include <asm/traps.h> |
| 27 | 30 | ||
| 28 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { | 31 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { |
| @@ -338,15 +341,24 @@ void kgdb_arch_exit(void) · 309 unmodified lines | |||
| 338 | unregister_die_notifier(&kgdb_notifier); | 341 | unregister_die_notifier(&kgdb_notifier); |
| 339 | } | 342 | } |
| 340 | 343 | ||
| 341 | /* | 344 | struct kgdb_arch arch_kgdb_ops; |
| 342 | * ARM instructions are always in LE. | 345 | |
| 343 | * Break instruction is encoded in LE format | 346 | int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) |
| 344 | */ | 347 | { |
| 345 | struct kgdb_arch arch_kgdb_ops = { | 348 | int err; |
| 346 | .gdb_bpt_instr = { | 349 | |
| 347 | KGDB_DYN_BRK_INS_BYTE(0), | 350 | BUILD_BUG_ON(AARCH64_INSN_SIZE != BREAK_INSTR_SIZE); |
| 348 | KGDB_DYN_BRK_INS_BYTE(1), | 351 | |
| 349 | KGDB_DYN_BRK_INS_BYTE(2), | 352 | err = aarch64_insn_read((void *)bpt->bpt_addr, (u32 *)bpt->saved_instr); |
| 350 | KGDB_DYN_BRK_INS_BYTE(3), | 353 | if (err) |
| 351 | } | 354 | return err; |
| 352 | }; | 355 | |
| 356 | return aarch64_insn_write((void *)bpt->bpt_addr, | ||
| 357 | (u32)AARCH64_BREAK_KGDB_DYN_DBG); | ||
| 358 | } | ||
| 359 | |||
| 360 | int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) | ||
| 361 | { | ||
| 362 | return aarch64_insn_write((void *)bpt->bpt_addr, | ||
| 363 | *(u32 *)bpt->saved_instr); | ||
| 364 | } | ||
| @@ -201,12 +201,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) · 200 unmodified lines | |||
| 201 | return ret; | 201 | return ret; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static void smp_store_cpu_info(unsigned int cpuid) | ||
| 205 | { | ||
| 206 | store_cpu_topology(cpuid); | ||
| 207 | numa_store_cpu_info(cpuid); | ||
| 208 | } | ||
| 209 | |||
| 210 | /* | 204 | /* |
| 211 | * This is the secondary CPU boot entry. We're using this CPUs | 205 | * This is the secondary CPU boot entry. We're using this CPUs |
| 212 | * idle thread stack, but a set of temporary page tables. | 206 | * idle thread stack, but a set of temporary page tables. |
| @@ -254,7 +248,7 @@ asmlinkage void secondary_start_kernel(void) · 41 unmodified lines | |||
| 254 | */ | 248 | */ |
| 255 | notify_cpu_starting(cpu); | 249 | notify_cpu_starting(cpu); |
| 256 | 250 | ||
| 257 | smp_store_cpu_info(cpu); | 251 | store_cpu_topology(cpu); |
| 258 | 252 | ||
| 259 | /* | 253 | /* |
| 260 | * OK, now it's safe to let the boot CPU continue. Wait for | 254 | * OK, now it's safe to let the boot CPU continue. Wait for |
| @@ -689,10 +683,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 428 unmodified lines | |||
| 689 | { | 683 | { |
| 690 | int err; | 684 | int err; |
| 691 | unsigned int cpu; | 685 | unsigned int cpu; |
| 686 | unsigned int this_cpu; | ||
| 692 | 687 | ||
| 693 | init_cpu_topology(); | 688 | init_cpu_topology(); |
| 694 | 689 | ||
| 695 | smp_store_cpu_info(smp_processor_id()); | 690 | this_cpu = smp_processor_id(); |
| 691 | store_cpu_topology(this_cpu); | ||
| 692 | numa_store_cpu_info(this_cpu); | ||
| 696 | 693 | ||
| 697 | /* | 694 | /* |
| 698 | * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set | 695 | * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set |
| @@ -719,6 +716,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 20 unmodified lines | |||
| 719 | continue; | 716 | continue; |
| 720 | 717 | ||
| 721 | set_cpu_present(cpu, true); | 718 | set_cpu_present(cpu, true); |
| 719 | numa_store_cpu_info(cpu); | ||
| 722 | } | 720 | } |
| 723 | } | 721 | } |
| 724 | 722 | ||
| @@ -256,7 +256,7 @@ static int __hyp_text __guest_run(struct kvm_vcpu *vcpu) · 255 unmodified lines | |||
| 256 | 256 | ||
| 257 | /* | 257 | /* |
| 258 | * We must restore the 32-bit state before the sysregs, thanks | 258 | * We must restore the 32-bit state before the sysregs, thanks |
| 259 | * to Cortex-A57 erratum #852523. | 259 | * to erratum #852523 (Cortex-A57) or #853709 (Cortex-A72). |
| 260 | */ | 260 | */ |
| 261 | __sysreg32_restore_state(vcpu); | 261 | __sysreg32_restore_state(vcpu); |
| 262 | __sysreg_restore_guest_state(guest_ctxt); | 262 | __sysreg_restore_guest_state(guest_ctxt); |
| @@ -823,14 +823,6 @@ static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 822 unmodified lines | |||
| 823 | * Architected system registers. | 823 | * Architected system registers. |
| 824 | * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 | 824 | * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2 |
| 825 | * | 825 | * |
| 826 | * We could trap ID_DFR0 and tell the guest we don't support performance | ||
| 827 | * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was | ||
| 828 | * NAKed, so it will read the PMCR anyway. | ||
| 829 | * | ||
| 830 | * Therefore we tell the guest we have 0 counters. Unfortunately, we | ||
| 831 | * must always support PMCCNTR (the cycle counter): we just RAZ/WI for | ||
| 832 | * all PM registers, which doesn't crash the guest kernel at least. | ||
| 833 | * | ||
| 834 | * Debug handling: We do trap most, if not all debug related system | 826 | * Debug handling: We do trap most, if not all debug related system |
| 835 | * registers. The implementation is good enough to ensure that a guest | 827 | * registers. The implementation is good enough to ensure that a guest |
| 836 | * can use these with minimal performance degradation. The drawback is | 828 | * can use these with minimal performance degradation. The drawback is |
| @@ -1360,7 +1352,7 @@ static const struct sys_reg_desc cp15_regs[] = { · 523 unmodified lines | |||
| 1360 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, | 1352 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, |
| 1361 | 1353 | ||
| 1362 | /* ICC_SRE */ | 1354 | /* ICC_SRE */ |
| 1363 | { Op1( 0), CRn(12), CRm(12), Op2( 5), trap_raz_wi }, | 1355 | { Op1( 0), CRn(12), CRm(12), Op2( 5), access_gic_sre }, |
| 1364 | 1356 | ||
| 1365 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, | 1357 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, |
| 1366 | 1358 | ||
| @@ -100,7 +100,16 @@ ENTRY(cpu_do_resume) · 99 unmodified lines | |||
| 100 | 100 | ||
| 101 | msr tcr_el1, x8 | 101 | msr tcr_el1, x8 |
| 102 | msr vbar_el1, x9 | 102 | msr vbar_el1, x9 |
| 103 | |||
| 104 | /* | ||
| 105 | * __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking | ||
| 106 | * debug exceptions. By restoring MDSCR_EL1 here, we may take a debug | ||
| 107 | * exception. Mask them until local_dbg_restore() in cpu_suspend() | ||
| 108 | * resets them. | ||
| 109 | */ | ||
| 110 | disable_dbg | ||
| 103 | msr mdscr_el1, x10 | 111 | msr mdscr_el1, x10 |
| 112 | |||
| 104 | msr sctlr_el1, x12 | 113 | msr sctlr_el1, x12 |
| 105 | /* | 114 | /* |
| 106 | * Restore oslsr_el1 by writing oslar_el1 | 115 | * Restore oslsr_el1 by writing oslar_el1 |
| @@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from, · 73 unmodified lines | |||
| 74 | 74 | ||
| 75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, | 75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, |
| 76 | __kernel_size_t n); | 76 | __kernel_size_t n); |
| 77 | extern __kernel_size_t copy_from_user(void *to, const void __user *from, | 77 | extern __kernel_size_t ___copy_from_user(void *to, const void __user *from, |
| 78 | __kernel_size_t n); | 78 | __kernel_size_t n); |
| 79 | 79 | ||
| 80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, | 80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, |
| @@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, · 7 unmodified lines | |||
| 88 | { | 88 | { |
| 89 | return __copy_user(to, (const void __force *)from, n); | 89 | return __copy_user(to, (const void __force *)from, n); |
| 90 | } | 90 | } |
| 91 | static inline __kernel_size_t copy_from_user(void *to, | ||
| 92 | const void __user *from, | ||
| 93 | __kernel_size_t n) | ||
| 94 | { | ||
| 95 | size_t res = ___copy_from_user(to, from, n); | ||
| 96 | if (unlikely(res)) | ||
| 97 | memset(to + (n - res), 0, res); | ||
| 98 | return res; | ||
| 99 | } | ||
| 91 | 100 | ||
| 92 | #define __copy_to_user_inatomic __copy_to_user | 101 | #define __copy_to_user_inatomic __copy_to_user |
| 93 | #define __copy_from_user_inatomic __copy_from_user | 102 | #define __copy_from_user_inatomic __copy_from_user |
| @@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page); · 35 unmodified lines | |||
| 36 | /* | 36 | /* |
| 37 | * Userspace access stuff. | 37 | * Userspace access stuff. |
| 38 | */ | 38 | */ |
| 39 | EXPORT_SYMBOL(copy_from_user); | 39 | EXPORT_SYMBOL(___copy_from_user); |
| 40 | EXPORT_SYMBOL(copy_to_user); | 40 | EXPORT_SYMBOL(copy_to_user); |
| 41 | EXPORT_SYMBOL(__copy_user); | 41 | EXPORT_SYMBOL(__copy_user); |
| 42 | EXPORT_SYMBOL(strncpy_from_user); | 42 | EXPORT_SYMBOL(strncpy_from_user); |
| @@ -23,13 +23,13 @@ · 22 unmodified lines | |||
| 23 | */ | 23 | */ |
| 24 | .text | 24 | .text |
| 25 | .align 1 | 25 | .align 1 |
| 26 | .global copy_from_user | 26 | .global ___copy_from_user |
| 27 | .type copy_from_user, @function | 27 | .type ___copy_from_user, @function |
| 28 | copy_from_user: | 28 | ___copy_from_user: |
| 29 | branch_if_kernel r8, __copy_user | 29 | branch_if_kernel r8, __copy_user |
| 30 | ret_if_privileged r8, r11, r10, r10 | 30 | ret_if_privileged r8, r11, r10, r10 |
| 31 | rjmp __copy_user | 31 | rjmp __copy_user |
| 32 | .size copy_from_user, . - copy_from_user | 32 | .size ___copy_from_user, . - ___copy_from_user |
| 33 | 33 | ||
| 34 | .global copy_to_user | 34 | .global copy_to_user |
| 35 | .type copy_to_user, @function | 35 | .type copy_to_user, @function |
| @@ -171,11 +171,12 @@ static inline int bad_user_access_length(void) · 170 unmodified lines | |||
| 171 | static inline unsigned long __must_check | 171 | static inline unsigned long __must_check |
| 172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 172 | copy_from_user(void *to, const void __user *from, unsigned long n) |
| 173 | { | 173 | { |
| 174 | if (access_ok(VERIFY_READ, from, n)) | 174 | if (likely(access_ok(VERIFY_READ, from, n))) { |
| 175 | memcpy(to, (const void __force *)from, n); | 175 | memcpy(to, (const void __force *)from, n); |
| 176 | else | 176 | return 0; |
| 177 | return n; | 177 | } |
| 178 | return 0; | 178 | memset(to, 0, n); |
| 179 | return n; | ||
| 179 | } | 180 | } |
| 180 | 181 | ||
| 181 | static inline unsigned long __must_check | 182 | static inline unsigned long __must_check |
| @@ -146,7 +146,8 @@ static struct platform_device hitachi_fb_device = { · 145 unmodified lines | |||
| 146 | #include <linux/smc91x.h> | 146 | #include <linux/smc91x.h> |
| 147 | 147 | ||
| 148 | static struct smc91x_platdata smc91x_info = { | 148 | static struct smc91x_platdata smc91x_info = { |
| 149 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, | 149 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
| 150 | SMC91X_NOWAIT, | ||
| 150 | .leda = RPC_LED_100_10, | 151 | .leda = RPC_LED_100_10, |
| 151 | .ledb = RPC_LED_TX_RX, | 152 | .ledb = RPC_LED_TX_RX, |
| 152 | }; | 153 | }; |
| @@ -134,7 +134,8 @@ static struct platform_device net2272_bfin_device = { · 133 unmodified lines | |||
| 134 | #include <linux/smc91x.h> | 134 | #include <linux/smc91x.h> |
| 135 | 135 | ||
| 136 | static struct smc91x_platdata smc91x_info = { | 136 | static struct smc91x_platdata smc91x_info = { |
| 137 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, | 137 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
| 138 | SMC91X_NOWAIT, | ||
| 138 | .leda = RPC_LED_100_10, | 139 | .leda = RPC_LED_100_10, |
| 139 | .ledb = RPC_LED_TX_RX, | 140 | .ledb = RPC_LED_TX_RX, |
| 140 | }; | 141 | }; |
| @@ -194,30 +194,6 @@ extern unsigned long __copy_user(void __user *to, const void *from, unsigned lon · 193 unmodified lines | |||
| 194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); | 194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); |
| 195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); | 195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); |
| 196 | 196 | ||
| 197 | static inline unsigned long | ||
| 198 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
| 199 | { | ||
| 200 | if (access_ok(VERIFY_WRITE, to, n)) | ||
| 201 | return __copy_user(to, from, n); | ||
| 202 | return n; | ||
| 203 | } | ||
| 204 | |||
| 205 | static inline unsigned long | ||
| 206 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | ||
| 207 | { | ||
| 208 | if (access_ok(VERIFY_READ, from, n)) | ||
| 209 | return __copy_user_zeroing(to, from, n); | ||
| 210 | return n; | ||
| 211 | } | ||
| 212 | |||
| 213 | static inline unsigned long | ||
| 214 | __generic_clear_user(void __user *to, unsigned long n) | ||
| 215 | { | ||
| 216 | if (access_ok(VERIFY_WRITE, to, n)) | ||
| 217 | return __do_clear_user(to, n); | ||
| 218 | return n; | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline long | 197 | static inline long |
| 222 | __strncpy_from_user(char *dst, const char __user *src, long count) | 198 | __strncpy_from_user(char *dst, const char __user *src, long count) |
| 223 | { | 199 | { |
| @@ -282,7 +258,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) · 58 unmodified lines | |||
| 282 | else if (n == 24) | 258 | else if (n == 24) |
| 283 | __asm_copy_from_user_24(to, from, ret); | 259 | __asm_copy_from_user_24(to, from, ret); |
| 284 | else | 260 | else |
| 285 | ret = __generic_copy_from_user(to, from, n); | 261 | ret = __copy_user_zeroing(to, from, n); |
| 286 | 262 | ||
| 287 | return ret; | 263 | return ret; |
| 288 | } | 264 | } |
| @@ -333,7 +309,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) · 44 unmodified lines | |||
| 333 | else if (n == 24) | 309 | else if (n == 24) |
| 334 | __asm_copy_to_user_24(to, from, ret); | 310 | __asm_copy_to_user_24(to, from, ret); |
| 335 | else | 311 | else |
| 336 | ret = __generic_copy_to_user(to, from, n); | 312 | ret = __copy_user(to, from, n); |
| 337 | 313 | ||
| 338 | return ret; | 314 | return ret; |
| 339 | } | 315 | } |
| @@ -366,26 +342,43 @@ __constant_clear_user(void __user *to, unsigned long n) · 26 unmodified lines | |||
| 366 | else if (n == 24) | 342 | else if (n == 24) |
| 367 | __asm_clear_24(to, ret); | 343 | __asm_clear_24(to, ret); |
| 368 | else | 344 | else |
| 369 | ret = __generic_clear_user(to, n); | 345 | ret = __do_clear_user(to, n); |
| 370 | 346 | ||
| 371 | return ret; | 347 | return ret; |
| 372 | } | 348 | } |
| 373 | 349 | ||
| 374 | 350 | ||
| 375 | #define clear_user(to, n) \ | 351 | static inline size_t clear_user(void __user *to, size_t n) |
| 376 | (__builtin_constant_p(n) ? \ | 352 | { |
| 377 | __constant_clear_user(to, n) : \ | 353 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
| 378 | __generic_clear_user(to, n)) | 354 | return n; |
| 355 | if (__builtin_constant_p(n)) | ||
| 356 | return __constant_clear_user(to, n); | ||
| 357 | else | ||
| 358 | return __do_clear_user(to, n); | ||
| 359 | } | ||
| 379 | 360 | ||
| 380 | #define copy_from_user(to, from, n) \ | 361 | static inline size_t copy_from_user(void *to, const void __user *from, size_t n) |
| 381 | (__builtin_constant_p(n) ? \ | 362 | { |
| 382 | __constant_copy_from_user(to, from, n) : \ | 363 | if (unlikely(!access_ok(VERIFY_READ, from, n))) { |
| 383 | __generic_copy_from_user(to, from, n)) | 364 | memset(to, 0, n); |
| 365 | return n; | ||
| 366 | } | ||
| 367 | if (__builtin_constant_p(n)) | ||
| 368 | return __constant_copy_from_user(to, from, n); | ||
| 369 | else | ||
| 370 | return __copy_user_zeroing(to, from, n); | ||
| 371 | } | ||
| 384 | 372 | ||
| 385 | #define copy_to_user(to, from, n) \ | 373 | static inline size_t copy_to_user(void __user *to, const void *from, size_t n) |
| 386 | (__builtin_constant_p(n) ? \ | 374 | { |
| 387 | __constant_copy_to_user(to, from, n) : \ | 375 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
| 388 | __generic_copy_to_user(to, from, n)) | 376 | return n; |
| 377 | if (__builtin_constant_p(n)) | ||
| 378 | return __constant_copy_to_user(to, from, n); | ||
| 379 | else | ||
| 380 | return __copy_user(to, from, n); | ||
| 381 | } | ||
| 389 | 382 | ||
| 390 | /* We let the __ versions of copy_from/to_user inline, because they're often | 383 | /* We let the __ versions of copy_from/to_user inline, because they're often |
| 391 | * used in fast paths and have only a small space overhead. | 384 | * used in fast paths and have only a small space overhead. |
| @@ -263,19 +263,25 @@ do { \ · 262 unmodified lines | |||
| 263 | extern long __memset_user(void *dst, unsigned long count); | 263 | extern long __memset_user(void *dst, unsigned long count); |
| 264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); | 264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
| 265 | 265 | ||
| 266 | #define clear_user(dst,count) __memset_user(____force(dst), (count)) | 266 | #define __clear_user(dst,count) __memset_user(____force(dst), (count)) |
| 267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) | 267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) |
| 268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) | 268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) |
| 269 | 269 | ||
| 270 | #else | 270 | #else |
| 271 | 271 | ||
| 272 | #define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) | 272 | #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
| 273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) | 273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) |
| 274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) | 274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) |
| 275 | 275 | ||
| 276 | #endif | 276 | #endif |
| 277 | 277 | ||
| 278 | #define __clear_user clear_user | 278 | static inline unsigned long __must_check |
| 279 | clear_user(void __user *to, unsigned long n) | ||
| 280 | { | ||
| 281 | if (likely(__access_ok(to, n))) | ||
| 282 | n = __clear_user(to, n); | ||
| 283 | return n; | ||
| 284 | } | ||
| 279 | 285 | ||
| 280 | static inline unsigned long __must_check | 286 | static inline unsigned long __must_check |
| 281 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 287 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
| @@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src, · 102 unmodified lines | |||
| 103 | { | 103 | { |
| 104 | long res = __strnlen_user(src, n); | 104 | long res = __strnlen_user(src, n); |
| 105 | 105 | ||
| 106 | /* return from strnlen can't be zero -- that would be rubbish. */ | 106 | if (unlikely(!res)) |
| 107 | return -EFAULT; | ||
| 107 | 108 | ||
| 108 | if (res > n) { | 109 | if (res > n) { |
| 109 | copy_from_user(dst, src, n); | 110 | copy_from_user(dst, src, n); |
| @@ -241,8 +241,7 @@ extern unsigned long __must_check __copy_user (void __user *to, const void __use · 240 unmodified lines | |||
| 241 | static inline unsigned long | 241 | static inline unsigned long |
| 242 | __copy_to_user (void __user *to, const void *from, unsigned long count) | 242 | __copy_to_user (void __user *to, const void *from, unsigned long count) |
| 243 | { | 243 | { |
| 244 | if (!__builtin_constant_p(count)) | 244 | check_object_size(from, count, true); |
| 245 | check_object_size(from, count, true); | ||
| 246 | 245 | ||
| 247 | return __copy_user(to, (__force void __user *) from, count); | 246 | return __copy_user(to, (__force void __user *) from, count); |
| 248 | } | 247 | } |
| @@ -250,8 +249,7 @@ __copy_to_user (void __user *to, const void *from, unsigned long count) · 1 unmodified line | |||
| 250 | static inline unsigned long | 249 | static inline unsigned long |
| 251 | __copy_from_user (void *to, const void __user *from, unsigned long count) | 250 | __copy_from_user (void *to, const void __user *from, unsigned long count) |
| 252 | { | 251 | { |
| 253 | if (!__builtin_constant_p(count)) | 252 | check_object_size(to, count, false); |
| 254 | check_object_size(to, count, false); | ||
| 255 | 253 | ||
| 256 | return __copy_user((__force void __user *) to, from, count); | 254 | return __copy_user((__force void __user *) to, from, count); |
| 257 | } | 255 | } |
| @@ -265,27 +263,22 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) · 7 unmodified lines | |||
| 265 | long __cu_len = (n); \ | 263 | long __cu_len = (n); \ |
| 266 | \ | 264 | \ |
| 267 | if (__access_ok(__cu_to, __cu_len, get_fs())) { \ | 265 | if (__access_ok(__cu_to, __cu_len, get_fs())) { \ |
| 268 | if (!__builtin_constant_p(n)) \ | 266 | check_object_size(__cu_from, __cu_len, true); \ |
| 269 | check_object_size(__cu_from, __cu_len, true); \ | ||
| 270 | __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \ | 267 | __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \ |
| 271 | } \ | 268 | } \ |
| 272 | __cu_len; \ | 269 | __cu_len; \ |
| 273 | }) | 270 | }) |
| 274 | 271 | ||
| 275 | #define copy_from_user(to, from, n) \ | 272 | static inline unsigned long |
| 276 | ({ \ | 273 | copy_from_user(void *to, const void __user *from, unsigned long n) |
| 277 | void *__cu_to = (to); \ | 274 | { |
| 278 | const void __user *__cu_from = (from); \ | 275 | check_object_size(to, n, false); |
| 279 | long __cu_len = (n); \ | 276 | if (likely(__access_ok(from, n, get_fs()))) |
| 280 | \ | 277 | n = __copy_user((__force void __user *) to, from, n); |
| 281 | __chk_user_ptr(__cu_from); \ | 278 | else |
| 282 | if (__access_ok(__cu_from, __cu_len, get_fs())) { \ | 279 | memset(to, 0, n); |
| 283 | if (!__builtin_constant_p(n)) \ | 280 | return n; |
| 284 | check_object_size(__cu_to, __cu_len, false); \ | 281 | } |
| 285 | __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ | ||
| 286 | } \ | ||
| 287 | __cu_len; \ | ||
| 288 | }) | ||
| 289 | 282 | ||
| 290 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) | 283 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) |
| 291 | 284 | ||
| @@ -219,7 +219,7 @@ extern int fixup_exception(struct pt_regs *regs); · 218 unmodified lines | |||
| 219 | #define __get_user_nocheck(x, ptr, size) \ | 219 | #define __get_user_nocheck(x, ptr, size) \ |
| 220 | ({ \ | 220 | ({ \ |
| 221 | long __gu_err = 0; \ | 221 | long __gu_err = 0; \ |
| 222 | unsigned long __gu_val; \ | 222 | unsigned long __gu_val = 0; \ |
| 223 | might_fault(); \ | 223 | might_fault(); \ |
| 224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | 224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ |
| 225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
| @@ -204,8 +204,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to, · 203 unmodified lines | |||
| 204 | static inline unsigned long | 204 | static inline unsigned long |
| 205 | copy_from_user(void *to, const void __user *from, unsigned long n) | 205 | copy_from_user(void *to, const void __user *from, unsigned long n) |
| 206 | { | 206 | { |
| 207 | if (access_ok(VERIFY_READ, from, n)) | 207 | if (likely(access_ok(VERIFY_READ, from, n))) |
| 208 | return __copy_user_zeroing(to, from, n); | 208 | return __copy_user_zeroing(to, from, n); |
| 209 | memset(to, 0, n); | ||
| 209 | return n; | 210 | return n; |
| 210 | } | 211 | } |
| 211 | 212 | ||
| @@ -227,7 +227,7 @@ extern long __user_bad(void); · 226 unmodified lines | |||
| 227 | 227 | ||
| 228 | #define __get_user(x, ptr) \ | 228 | #define __get_user(x, ptr) \ |
| 229 | ({ \ | 229 | ({ \ |
| 230 | unsigned long __gu_val; \ | 230 | unsigned long __gu_val = 0; \ |
| 231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ | 231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ |
| 232 | long __gu_err; \ | 232 | long __gu_err; \ |
| 233 | switch (sizeof(*(ptr))) { \ | 233 | switch (sizeof(*(ptr))) { \ |
| @@ -373,10 +373,13 @@ extern long __user_bad(void); · 139 unmodified lines | |||
| 373 | static inline long copy_from_user(void *to, | 373 | static inline long copy_from_user(void *to, |
| 374 | const void __user *from, unsigned long n) | 374 | const void __user *from, unsigned long n) |
| 375 | { | 375 | { |
| 376 | unsigned long res = n; | ||
| 376 | might_fault(); | 377 | might_fault(); |
| 377 | if (access_ok(VERIFY_READ, from, n)) | 378 | if (likely(access_ok(VERIFY_READ, from, n))) |
| 378 | return __copy_from_user(to, from, n); | 379 | res = __copy_from_user(to, from, n); |
| 379 | return n; | 380 | if (unlikely(res)) |
| 381 | memset(to + (n - res), 0, res); | ||
| 382 | return res; | ||
| 380 | } | 383 | } |
| 381 | 384 | ||
| 382 | #define __copy_to_user(to, from, n) \ | 385 | #define __copy_to_user(to, from, n) \ |
| @@ -65,6 +65,7 @@ config MIPS · 64 unmodified lines | |||
| 65 | select ARCH_CLOCKSOURCE_DATA | 65 | select ARCH_CLOCKSOURCE_DATA |
| 66 | select HANDLE_DOMAIN_IRQ | 66 | select HANDLE_DOMAIN_IRQ |
| 67 | select HAVE_EXIT_THREAD | 67 | select HAVE_EXIT_THREAD |
| 68 | select HAVE_REGS_AND_STACK_ACCESS_API | ||
| 68 | 69 | ||
| 69 | menu "Machine selection" | 70 | menu "Machine selection" |
| 70 | 71 | ||
| @@ -113,42 +113,6 @@ config SPINLOCK_TEST · 112 unmodified lines | |||
| 113 | help | 113 | help |
| 114 | Add several files to the debugfs to test spinlock speed. | 114 | Add several files to the debugfs to test spinlock speed. |
| 115 | 115 | ||
| 116 | if CPU_MIPSR6 | ||
| 117 | |||
| 118 | choice | ||
| 119 | prompt "Compact branch policy" | ||
| 120 | default MIPS_COMPACT_BRANCHES_OPTIMAL | ||
| 121 | |||
| 122 | config MIPS_COMPACT_BRANCHES_NEVER | ||
| 123 | bool "Never (force delay slot branches)" | ||
| 124 | help | ||
| 125 | Pass the -mcompact-branches=never flag to the compiler in order to | ||
| 126 | force it to always emit branches with delay slots, and make no use | ||
| 127 | of the compact branch instructions introduced by MIPSr6. This is | ||
| 128 | useful if you suspect there may be an issue with compact branches in | ||
| 129 | either the compiler or the CPU. | ||
| 130 | |||
| 131 | config MIPS_COMPACT_BRANCHES_OPTIMAL | ||
| 132 | bool "Optimal (use where beneficial)" | ||
| 133 | help | ||
| 134 | Pass the -mcompact-branches=optimal flag to the compiler in order for | ||
| 135 | it to make use of compact branch instructions where it deems them | ||
| 136 | beneficial, and use branches with delay slots elsewhere. This is the | ||
| 137 | default compiler behaviour, and should be used unless you have a | ||
| 138 | reason to choose otherwise. | ||
| 139 | |||
| 140 | config MIPS_COMPACT_BRANCHES_ALWAYS | ||
| 141 | bool "Always (force compact branches)" | ||
| 142 | help | ||
| 143 | Pass the -mcompact-branches=always flag to the compiler in order to | ||
| 144 | force it to always emit compact branches, making no use of branch | ||
| 145 | instructions with delay slots. This can result in more compact code | ||
| 146 | which may be beneficial in some scenarios. | ||
| 147 | |||
| 148 | endchoice | ||
| 149 | |||
| 150 | endif # CPU_MIPSR6 | ||
| 151 | |||
| 152 | config SCACHE_DEBUGFS | 116 | config SCACHE_DEBUGFS |
| 153 | bool "L2 cache debugfs entries" | 117 | bool "L2 cache debugfs entries" |
| 154 | depends on DEBUG_FS | 118 | depends on DEBUG_FS |
| @@ -203,10 +203,6 @@ endif · 202 unmodified lines | |||
| 203 | toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) | 203 | toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) |
| 204 | cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT | 204 | cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT |
| 205 | 205 | ||
| 206 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never | ||
| 207 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal | ||
| 208 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always | ||
| 209 | |||
| 210 | # | 206 | # |
| 211 | # Firmware support | 207 | # Firmware support |
| 212 | # | 208 | # |
| @@ -96,7 +96,7 @@ static struct clk * __init ath79_reg_ffclk(const char *name, · 95 unmodified lines | |||
| 96 | struct clk *clk; | 96 | struct clk *clk; |
| 97 | 97 | ||
| 98 | clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); | 98 | clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); |
| 99 | if (!clk) | 99 | if (IS_ERR(clk)) |
| 100 | panic("failed to allocate %s clock structure", name); | 100 | panic("failed to allocate %s clock structure", name); |
| 101 | 101 | ||
| 102 | return clk; | 102 | return clk; |
| @@ -1059,7 +1059,7 @@ static int __init octeon_publish_devices(void) · 1058 unmodified lines | |||
| 1059 | { | 1059 | { |
| 1060 | return of_platform_bus_probe(NULL, octeon_ids, NULL); | 1060 | return of_platform_bus_probe(NULL, octeon_ids, NULL); |
| 1061 | } | 1061 | } |
| 1062 | device_initcall(octeon_publish_devices); | 1062 | arch_initcall(octeon_publish_devices); |
| 1063 | 1063 | ||
| 1064 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); | 1064 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); |
| 1065 | MODULE_LICENSE("GPL"); | 1065 | MODULE_LICENSE("GPL"); |
| @@ -157,6 +157,7 @@ · 156 unmodified lines | |||
| 157 | ldc1 $f28, THREAD_FPR28(\thread) | 157 | ldc1 $f28, THREAD_FPR28(\thread) |
| 158 | ldc1 $f30, THREAD_FPR30(\thread) | 158 | ldc1 $f30, THREAD_FPR30(\thread) |
| 159 | ctc1 \tmp, fcr31 | 159 | ctc1 \tmp, fcr31 |
| 160 | .set pop | ||
| 160 | .endm | 161 | .endm |
| 161 | 162 | ||
| 162 | .macro fpu_restore_16odd thread | 163 | .macro fpu_restore_16odd thread |
| @@ -15,8 +15,8 @@ · 14 unmodified lines | |||
| 15 | static inline bool __should_swizzle_bits(volatile void *a) | 15 | static inline bool __should_swizzle_bits(volatile void *a) |
| 16 | { | 16 | { |
| 17 | extern const bool octeon_should_swizzle_table[]; | 17 | extern const bool octeon_should_swizzle_table[]; |
| 18 | u64 did = ((u64)(uintptr_t)a >> 40) & 0xff; | ||
| 18 | 19 | ||
| 19 | unsigned long did = ((unsigned long)a >> 40) & 0xff; | ||
| 20 | return octeon_should_swizzle_table[did]; | 20 | return octeon_should_swizzle_table[did]; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| @@ -29,7 +29,7 @@ static inline bool __should_swizzle_bits(volatile void *a) · 6 unmodified lines | |||
| 29 | 29 | ||
| 30 | #define __should_swizzle_bits(a) false | 30 | #define __should_swizzle_bits(a) false |
| 31 | 31 | ||
| 32 | static inline bool __should_swizzle_addr(unsigned long p) | 32 | static inline bool __should_swizzle_addr(u64 p) |
| 33 | { | 33 | { |
| 34 | /* boot bus? */ | 34 | /* boot bus? */ |
| 35 | return ((p >> 40) & 0xff) == 0; | 35 | return ((p >> 40) & 0xff) == 0; |
| @@ -11,11 +11,13 @@ · 10 unmodified lines | |||
| 11 | #define CP0_EBASE $15, 1 | 11 | #define CP0_EBASE $15, 1 |
| 12 | 12 | ||
| 13 | .macro kernel_entry_setup | 13 | .macro kernel_entry_setup |
| 14 | #ifdef CONFIG_SMP | ||
| 14 | mfc0 t0, CP0_EBASE | 15 | mfc0 t0, CP0_EBASE |
| 15 | andi t0, t0, 0x3ff # CPUNum | 16 | andi t0, t0, 0x3ff # CPUNum |
| 16 | beqz t0, 1f | 17 | beqz t0, 1f |
| 17 | # CPUs other than zero goto smp_bootstrap | 18 | # CPUs other than zero goto smp_bootstrap |
| 18 | j smp_bootstrap | 19 | j smp_bootstrap |
| 20 | #endif /* CONFIG_SMP */ | ||
| 19 | 21 | ||
| 20 | 1: | 22 | 1: |
| 21 | .endm | 23 | .endm |
| @@ -164,7 +164,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; · 163 unmodified lines | |||
| 164 | */ | 164 | */ |
| 165 | static inline unsigned long ___pa(unsigned long x) | 165 | static inline unsigned long ___pa(unsigned long x) |
| 166 | { | 166 | { |
| 167 | if (config_enabled(CONFIG_64BIT)) { | 167 | if (IS_ENABLED(CONFIG_64BIT)) { |
| 168 | /* | 168 | /* |
| 169 | * For MIPS64 the virtual address may either be in one of | 169 | * For MIPS64 the virtual address may either be in one of |
| 170 | * the compatibility segements ckseg0 or ckseg1, or it may | 170 | * the compatibility segements ckseg0 or ckseg1, or it may |
| @@ -173,7 +173,7 @@ static inline unsigned long ___pa(unsigned long x) · 2 unmodified lines | |||
| 173 | return x < CKSEG0 ? XPHYSADDR(x) : CPHYSADDR(x); | 173 | return x < CKSEG0 ? XPHYSADDR(x) : CPHYSADDR(x); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | if (!config_enabled(CONFIG_EVA)) { | 176 | if (!IS_ENABLED(CONFIG_EVA)) { |
| 177 | /* | 177 | /* |
| 178 | * We're using the standard MIPS32 legacy memory map, ie. | 178 | * We're using the standard MIPS32 legacy memory map, ie. |
| 179 | * the address x is going to be in kseg0 or kseg1. We can | 179 | * the address x is going to be in kseg0 or kseg1. We can |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
| 16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
| 17 | #include <linux/string.h> | ||
| 17 | #include <asm/asm-eva.h> | 18 | #include <asm/asm-eva.h> |
| 18 | 19 | ||
| 19 | /* | 20 | /* |
| @@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); · 1150 unmodified lines | |||
| 1170 | __cu_len = __invoke_copy_from_user(__cu_to, \ | 1171 | __cu_len = __invoke_copy_from_user(__cu_to, \ |
| 1171 | __cu_from, \ | 1172 | __cu_from, \ |
| 1172 | __cu_len); \ | 1173 | __cu_len); \ |
| 1174 | } else { \ | ||
| 1175 | memset(__cu_to, 0, __cu_len); \ | ||
| 1173 | } \ | 1176 | } \ |
| 1174 | } \ | 1177 | } \ |
| 1175 | __cu_len; \ | 1178 | __cu_len; \ |
| @@ -1164,7 +1164,9 @@ fpu_emul: · 1163 unmodified lines | |||
| 1164 | regs->regs[31] = r31; | 1164 | regs->regs[31] = r31; |
| 1165 | regs->cp0_epc = epc; | 1165 | regs->cp0_epc = epc; |
| 1166 | if (!used_math()) { /* First time FPU user. */ | 1166 | if (!used_math()) { /* First time FPU user. */ |
| 1167 | preempt_disable(); | ||
| 1167 | err = init_fpu(); | 1168 | err = init_fpu(); |
| 1169 | preempt_enable(); | ||
| 1168 | set_used_math(); | 1170 | set_used_math(); |
| 1169 | } | 1171 | } |
| 1170 | lose_fpu(1); /* Save FPU state for the emulator. */ | 1172 | lose_fpu(1); /* Save FPU state for the emulator. */ |
| @@ -605,14 +605,14 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) · 604 unmodified lines | |||
| 605 | return -EOPNOTSUPP; | 605 | return -EOPNOTSUPP; |
| 606 | 606 | ||
| 607 | /* Avoid inadvertently triggering emulation */ | 607 | /* Avoid inadvertently triggering emulation */ |
| 608 | if ((value & PR_FP_MODE_FR) && cpu_has_fpu && | 608 | if ((value & PR_FP_MODE_FR) && raw_cpu_has_fpu && |
| 609 | !(current_cpu_data.fpu_id & MIPS_FPIR_F64)) | 609 | !(raw_current_cpu_data.fpu_id & MIPS_FPIR_F64)) |
| 610 | return -EOPNOTSUPP; | 610 | return -EOPNOTSUPP; |
| 611 | if ((value & PR_FP_MODE_FRE) && cpu_has_fpu && !cpu_has_fre) | 611 | if ((value & PR_FP_MODE_FRE) && raw_cpu_has_fpu && !cpu_has_fre) |
| 612 | return -EOPNOTSUPP; | 612 | return -EOPNOTSUPP; |
| 613 | 613 | ||
| 614 | /* FR = 0 not supported in MIPS R6 */ | 614 | /* FR = 0 not supported in MIPS R6 */ |
| 615 | if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6) | 615 | if (!(value & PR_FP_MODE_FR) && raw_cpu_has_fpu && cpu_has_mips_r6) |
| 616 | return -EOPNOTSUPP; | 616 | return -EOPNOTSUPP; |
| 617 | 617 | ||
| 618 | /* Proceed with the mode switch */ | 618 | /* Proceed with the mode switch */ |
| @@ -87,6 +87,13 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) · 86 unmodified lines | |||
| 87 | int x = boot_mem_map.nr_map; | 87 | int x = boot_mem_map.nr_map; |
| 88 | int i; | 88 | int i; |
| 89 | 89 | ||
| 90 | /* | ||
| 91 | * If the region reaches the top of the physical address space, adjust | ||
| 92 | * the size slightly so that (start + size) doesn't overflow | ||
| 93 | */ | ||
| 94 | if (start + size - 1 == (phys_addr_t)ULLONG_MAX) | ||
| 95 | --size; | ||
| 96 | |||
| 90 | /* Sanity check */ | 97 | /* Sanity check */ |
| 91 | if (start + size < start) { | 98 | if (start + size < start) { |
| 92 | pr_warn("Trying to add an invalid memory region, skipped\n"); | 99 | pr_warn("Trying to add an invalid memory region, skipped\n"); |
| @@ -322,6 +322,9 @@ asmlinkage void start_secondary(void) · 321 unmodified lines | |||
| 322 | cpumask_set_cpu(cpu, &cpu_coherent_mask); | 322 | cpumask_set_cpu(cpu, &cpu_coherent_mask); |
| 323 | notify_cpu_starting(cpu); | 323 | notify_cpu_starting(cpu); |
| 324 | 324 | ||
| 325 | cpumask_set_cpu(cpu, &cpu_callin_map); | ||
| 326 | synchronise_count_slave(cpu); | ||
| 327 | |||
| 325 | set_cpu_online(cpu, true); | 328 | set_cpu_online(cpu, true); |
| 326 | 329 | ||
| 327 | set_cpu_sibling_map(cpu); | 330 | set_cpu_sibling_map(cpu); |
| @@ -329,10 +332,6 @@ asmlinkage void start_secondary(void) · 1 unmodified line | |||
| 329 | 332 | ||
| 330 | calculate_cpu_foreign_map(); | 333 | calculate_cpu_foreign_map(); |
| 331 | 334 | ||
| 332 | cpumask_set_cpu(cpu, &cpu_callin_map); | ||
| 333 | |||
| 334 | synchronise_count_slave(cpu); | ||
| 335 | |||
| 336 | /* | 335 | /* |
| 337 | * irq will be enabled in ->smp_finish(), enabling it too early | 336 | * irq will be enabled in ->smp_finish(), enabling it too early |
| 338 | * is dangerous. | 337 | * is dangerous. |
| @@ -222,7 +222,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self, · 221 unmodified lines | |||
| 222 | return NOTIFY_DONE; | 222 | return NOTIFY_DONE; |
| 223 | 223 | ||
| 224 | switch (val) { | 224 | switch (val) { |
| 225 | case DIE_BREAK: | 225 | case DIE_UPROBE: |
| 226 | if (uprobe_pre_sstep_notifier(regs)) | 226 | if (uprobe_pre_sstep_notifier(regs)) |
| 227 | return NOTIFY_STOP; | 227 | return NOTIFY_STOP; |
| 228 | break; | 228 | break; |
| @@ -39,16 +39,16 @@ static struct vm_special_mapping vdso_vvar_mapping = { · 38 unmodified lines | |||
| 39 | static void __init init_vdso_image(struct mips_vdso_image *image) | 39 | static void __init init_vdso_image(struct mips_vdso_image *image) |
| 40 | { | 40 | { |
| 41 | unsigned long num_pages, i; | 41 | unsigned long num_pages, i; |
| 42 | unsigned long data_pfn; | ||
| 42 | 43 | ||
| 43 | BUG_ON(!PAGE_ALIGNED(image->data)); | 44 | BUG_ON(!PAGE_ALIGNED(image->data)); |
| 44 | BUG_ON(!PAGE_ALIGNED(image->size)); | 45 | BUG_ON(!PAGE_ALIGNED(image->size)); |
| 45 | 46 | ||
| 46 | num_pages = image->size / PAGE_SIZE; | 47 | num_pages = image->size / PAGE_SIZE; |
| 47 | 48 | ||
| 48 | for (i = 0; i < num_pages; i++) { | 49 | data_pfn = __phys_to_pfn(__pa_symbol(image->data)); |
| 49 | image->mapping.pages[i] = | 50 | for (i = 0; i < num_pages; i++) |
| 50 | virt_to_page(image->data + (i * PAGE_SIZE)); | 51 | image->mapping.pages[i] = pfn_to_page(data_pfn + i); |
| 51 | } | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | static int __init init_vdso(void) | 54 | static int __init init_vdso(void) |
| @@ -40,7 +40,7 @@ static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) · 39 unmodified lines | |||
| 40 | srcu_idx = srcu_read_lock(&kvm->srcu); | 40 | srcu_idx = srcu_read_lock(&kvm->srcu); |
| 41 | pfn = gfn_to_pfn(kvm, gfn); | 41 | pfn = gfn_to_pfn(kvm, gfn); |
| 42 | 42 | ||
| 43 | if (is_error_pfn(pfn)) { | 43 | if (is_error_noslot_pfn(pfn)) { |
| 44 | kvm_err("Couldn't get pfn for gfn %#llx!\n", gfn); | 44 | kvm_err("Couldn't get pfn for gfn %#llx!\n", gfn); |
| 45 | err = -EFAULT; | 45 | err = -EFAULT; |
| 46 | goto out; | 46 | goto out; |
| @@ -298,5 +298,6 @@ bool do_dsemulret(struct pt_regs *xcp) · 297 unmodified lines | |||
| 298 | /* Set EPC to return to post-branch instruction */ | 298 | /* Set EPC to return to post-branch instruction */ |
| 299 | xcp->cp0_epc = current->thread.bd_emu_cont_pc; | 299 | xcp->cp0_epc = current->thread.bd_emu_cont_pc; |
| 300 | pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc); | 300 | pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc); |
| 301 | MIPS_FPU_EMU_INC_STATS(ds_emul); | ||
| 301 | return true; | 302 | return true; |
| 302 | } | 303 | } |
| @@ -800,7 +800,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end) · 799 unmodified lines | |||
| 800 | * If address-based cache ops don't require an SMP call, then | 800 | * If address-based cache ops don't require an SMP call, then |
| 801 | * use them exclusively for small flushes. | 801 | * use them exclusively for small flushes. |
| 802 | */ | 802 | */ |
| 803 | size = start - end; | 803 | size = end - start; |
| 804 | cache_size = icache_size; | 804 | cache_size = icache_size; |
| 805 | if (!cpu_has_ic_fills_f_dc) { | 805 | if (!cpu_has_ic_fills_f_dc) { |
| 806 | size *= 2; | 806 | size *= 2; |
| @@ -261,7 +261,6 @@ unsigned __weak platform_maar_init(unsigned num_pairs) · 260 unmodified lines | |||
| 261 | { | 261 | { |
| 262 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; | 262 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; |
| 263 | unsigned i, num_configured, num_cfg = 0; | 263 | unsigned i, num_configured, num_cfg = 0; |
| 264 | phys_addr_t skip; | ||
| 265 | 264 | ||
| 266 | for (i = 0; i < boot_mem_map.nr_map; i++) { | 265 | for (i = 0; i < boot_mem_map.nr_map; i++) { |
| 267 | switch (boot_mem_map.map[i].type) { | 266 | switch (boot_mem_map.map[i].type) { |
| @@ -272,14 +271,14 @@ unsigned __weak platform_maar_init(unsigned num_pairs) · 4 unmodified lines | |||
| 272 | continue; | 271 | continue; |
| 273 | } | 272 | } |
| 274 | 273 | ||
| 275 | skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | 274 | /* Round lower up */ |
| 276 | |||
| 277 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; | 275 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; |
| 278 | cfg[num_cfg].lower += skip; | 276 | cfg[num_cfg].lower = (cfg[num_cfg].lower + 0xffff) & ~0xffff; |
| 279 | 277 | ||
| 280 | cfg[num_cfg].upper = cfg[num_cfg].lower; | 278 | /* Round upper down */ |
| 281 | cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | 279 | cfg[num_cfg].upper = boot_mem_map.map[i].addr + |
| 282 | cfg[num_cfg].upper -= skip; | 280 | boot_mem_map.map[i].size; |
| 281 | cfg[num_cfg].upper = (cfg[num_cfg].upper & ~0xffff) - 1; | ||
| 283 | 282 | ||
| 284 | cfg[num_cfg].attrs = MIPS_MAAR_S; | 283 | cfg[num_cfg].attrs = MIPS_MAAR_S; |
| 285 | num_cfg++; | 284 | num_cfg++; |
| @@ -166,6 +166,7 @@ struct __large_struct { unsigned long buf[100]; }; · 165 unmodified lines | |||
| 166 | "2:\n" \ | 166 | "2:\n" \ |
| 167 | " .section .fixup,\"ax\"\n" \ | 167 | " .section .fixup,\"ax\"\n" \ |
| 168 | "3:\n\t" \ | 168 | "3:\n\t" \ |
| 169 | " mov 0,%1\n" \ | ||
| 169 | " mov %3,%0\n" \ | 170 | " mov %3,%0\n" \ |
| 170 | " jmp 2b\n" \ | 171 | " jmp 2b\n" \ |
| 171 | " .previous\n" \ | 172 | " .previous\n" \ |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | * as published by the Free Software Foundation; either version | 9 | * as published by the Free Software Foundation; either version |
| 10 | * 2 of the Licence, or (at your option) any later version. | 10 | * 2 of the Licence, or (at your option) any later version. |
| 11 | */ | 11 | */ |
| 12 | #include <asm/uaccess.h> | 12 | #include <linux/uaccess.h> |
| 13 | 13 | ||
| 14 | unsigned long | 14 | unsigned long |
| 15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | 15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) |
| @@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) · 8 unmodified lines | |||
| 24 | { | 24 | { |
| 25 | if (access_ok(VERIFY_READ, from, n)) | 25 | if (access_ok(VERIFY_READ, from, n)) |
| 26 | __copy_user_zeroing(to, from, n); | 26 | __copy_user_zeroing(to, from, n); |
| 27 | else | ||
| 28 | memset(to, 0, n); | ||
| 27 | return n; | 29 | return n; |
| 28 | } | 30 | } |
| 29 | 31 | ||
| @@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *to, const void *from, unsigned long n); · 101 unmodified lines | |||
| 102 | static inline long copy_from_user(void *to, const void __user *from, | 102 | static inline long copy_from_user(void *to, const void __user *from, |
| 103 | unsigned long n) | 103 | unsigned long n) |
| 104 | { | 104 | { |
| 105 | if (!access_ok(VERIFY_READ, from, n)) | 105 | unsigned long res = n; |
| 106 | return n; | 106 | if (access_ok(VERIFY_READ, from, n)) |
| 107 | return __copy_from_user(to, from, n); | 107 | res = __copy_from_user(to, from, n); |
| 108 | if (unlikely(res)) | ||
| 109 | memset(to + (n - res), 0, res); | ||
| 110 | return res; | ||
| 108 | } | 111 | } |
| 109 | 112 | ||
| 110 | static inline long copy_to_user(void __user *to, const void *from, | 113 | static inline long copy_to_user(void __user *to, const void *from, |
| @@ -139,7 +142,7 @@ extern long strnlen_user(const char __user *s, long n); · 28 unmodified lines | |||
| 139 | 142 | ||
| 140 | #define __get_user_unknown(val, size, ptr, err) do { \ | 143 | #define __get_user_unknown(val, size, ptr, err) do { \ |
| 141 | err = 0; \ | 144 | err = 0; \ |
| 142 | if (copy_from_user(&(val), ptr, size)) { \ | 145 | if (__copy_from_user(&(val), ptr, size)) { \ |
| 143 | err = -EFAULT; \ | 146 | err = -EFAULT; \ |
| 144 | } \ | 147 | } \ |
| 145 | } while (0) | 148 | } while (0) |
| @@ -166,7 +169,7 @@ do { \ · 20 unmodified lines | |||
| 166 | ({ \ | 169 | ({ \ |
| 167 | long __gu_err = -EFAULT; \ | 170 | long __gu_err = -EFAULT; \ |
| 168 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | 171 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
| 169 | unsigned long __gu_val; \ | 172 | unsigned long __gu_val = 0; \ |
| 170 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ | 173 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
| 171 | (x) = (__force __typeof__(x))__gu_val; \ | 174 | (x) = (__force __typeof__(x))__gu_val; \ |
| 172 | __gu_err; \ | 175 | __gu_err; \ |
| @@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void *from, unsigned long size); · 272 unmodified lines | |||
| 273 | static inline unsigned long | 273 | static inline unsigned long |
| 274 | copy_from_user(void *to, const void *from, unsigned long n) | 274 | copy_from_user(void *to, const void *from, unsigned long n) |
| 275 | { | 275 | { |
| 276 | unsigned long over; | 276 | unsigned long res = n; |
| 277 | 277 | ||
| 278 | if (access_ok(VERIFY_READ, from, n)) | 278 | if (likely(access_ok(VERIFY_READ, from, n))) |
| 279 | return __copy_tofrom_user(to, from, n); | 279 | res = __copy_tofrom_user(to, from, n); |
| 280 | if ((unsigned long)from < TASK_SIZE) { | 280 | if (unlikely(res)) |
| 281 | over = (unsigned long)from + n - TASK_SIZE; | 281 | memset(to + (n - res), 0, res); |
| 282 | return __copy_tofrom_user(to, from, n - over) + over; | 282 | return res; |
| 283 | } | ||
| 284 | return n; | ||
| 285 | } | 283 | } |
| 286 | 284 | ||
| 287 | static inline unsigned long | 285 | static inline unsigned long |
| 288 | copy_to_user(void *to, const void *from, unsigned long n) | 286 | copy_to_user(void *to, const void *from, unsigned long n) |
| 289 | { | 287 | { |
| 290 | unsigned long over; | 288 | if (likely(access_ok(VERIFY_WRITE, to, n))) |
| 291 | 289 | n = __copy_tofrom_user(to, from, n); | |
| 292 | if (access_ok(VERIFY_WRITE, to, n)) | ||
| 293 | return __copy_tofrom_user(to, from, n); | ||
| 294 | if ((unsigned long)to < TASK_SIZE) { | ||
| 295 | over = (unsigned long)to + n - TASK_SIZE; | ||
| 296 | return __copy_tofrom_user(to, from, n - over) + over; | ||
| 297 | } | ||
| 298 | return n; | 290 | return n; |
| 299 | } | 291 | } |
| 300 | 292 | ||
| @@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *addr, unsigned long size); · 2 unmodified lines | |||
| 303 | static inline __must_check unsigned long | 295 | static inline __must_check unsigned long |
| 304 | clear_user(void *addr, unsigned long size) | 296 | clear_user(void *addr, unsigned long size) |
| 305 | { | 297 | { |
| 306 | 298 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | |
| 307 | if (access_ok(VERIFY_WRITE, addr, size)) | 299 | size = __clear_user(addr, size); |
| 308 | return __clear_user(addr, size); | ||
| 309 | if ((unsigned long)addr < TASK_SIZE) { | ||
| 310 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
| 311 | return __clear_user(addr, size - over) + over; | ||
| 312 | } | ||
| 313 | return size; | 300 | return size; |
| 314 | } | 301 | } |
| 315 | 302 | ||
| @@ -1,6 +1,5 @@ | |||
| 1 | config PARISC | 1 | config PARISC |
| 2 | def_bool y | 2 | def_bool y |
| 3 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 4 | select ARCH_MIGHT_HAVE_PC_PARPORT | 3 | select ARCH_MIGHT_HAVE_PC_PARPORT |
| 5 | select HAVE_IDE | 4 | select HAVE_IDE |
| 6 | select HAVE_OPROFILE | 5 | select HAVE_OPROFILE |
| @@ -245,7 +245,6 @@ CONFIG_DEBUG_RT_MUTEXES=y · 244 unmodified lines | |||
| 245 | CONFIG_PROVE_RCU_DELAY=y | 245 | CONFIG_PROVE_RCU_DELAY=y |
| 246 | CONFIG_DEBUG_BLOCK_EXT_DEVT=y | 246 | CONFIG_DEBUG_BLOCK_EXT_DEVT=y |
| 247 | CONFIG_LATENCYTOP=y | 247 | CONFIG_LATENCYTOP=y |
| 248 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 249 | CONFIG_KEYS=y | 248 | CONFIG_KEYS=y |
| 250 | # CONFIG_CRYPTO_HW is not set | 249 | # CONFIG_CRYPTO_HW is not set |
| 251 | CONFIG_FONTS=y | 250 | CONFIG_FONTS=y |
| @@ -291,7 +291,6 @@ CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y · 290 unmodified lines | |||
| 291 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y | 291 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y |
| 292 | # CONFIG_SCHED_DEBUG is not set | 292 | # CONFIG_SCHED_DEBUG is not set |
| 293 | CONFIG_TIMER_STATS=y | 293 | CONFIG_TIMER_STATS=y |
| 294 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 295 | CONFIG_CRYPTO_MANAGER=y | 294 | CONFIG_CRYPTO_MANAGER=y |
| 296 | CONFIG_CRYPTO_ECB=m | 295 | CONFIG_CRYPTO_ECB=m |
| 297 | CONFIG_CRYPTO_PCBC=m | 296 | CONFIG_CRYPTO_PCBC=m |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
| 11 | 11 | ||
| 12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
| 13 | #include <linux/string.h> | ||
| 13 | 14 | ||
| 14 | #define VERIFY_READ 0 | 15 | #define VERIFY_READ 0 |
| 15 | #define VERIFY_WRITE 1 | 16 | #define VERIFY_WRITE 1 |
| @@ -208,26 +209,30 @@ unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned lo · 192 unmodified lines | |||
| 208 | #define __copy_to_user_inatomic __copy_to_user | 209 | #define __copy_to_user_inatomic __copy_to_user |
| 209 | #define __copy_from_user_inatomic __copy_from_user | 210 | #define __copy_from_user_inatomic __copy_from_user |
| 210 | 211 | ||
| 211 | extern void copy_from_user_overflow(void) | 212 | extern void __compiletime_error("usercopy buffer size is too small") |
| 212 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | 213 | __bad_copy_user(void); |
| 213 | __compiletime_error("copy_from_user() buffer size is not provably correct") | 214 | |
| 214 | #else | 215 | static inline void copy_user_overflow(int size, unsigned long count) |
| 215 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | 216 | { |
| 216 | #endif | 217 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
| 217 | ; | 218 | } |
| 218 | 219 | ||
| 219 | static inline unsigned long __must_check copy_from_user(void *to, | 220 | static inline unsigned long __must_check copy_from_user(void *to, |
| 220 | const void __user *from, | 221 | const void __user *from, |
| 221 | unsigned long n) | 222 | unsigned long n) |
| 222 | { | 223 | { |
| 223 | int sz = __compiletime_object_size(to); | 224 | int sz = __compiletime_object_size(to); |
| 224 | int ret = -EFAULT; | 225 | unsigned long ret = n; |
| 225 | 226 | ||
| 226 | if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n)) | 227 | if (likely(sz == -1 || sz >= n)) |
| 227 | ret = __copy_from_user(to, from, n); | 228 | ret = __copy_from_user(to, from, n); |
| 228 | else | 229 | else if (!__builtin_constant_p(n)) |
| 229 | copy_from_user_overflow(); | 230 | copy_user_overflow(sz, n); |
| 231 | else | ||
| 232 | __bad_copy_user(); | ||
| 230 | 233 | ||
| 234 | if (unlikely(ret)) | ||
| 235 | memset(to + (n - ret), 0, ret); | ||
| 231 | return ret; | 236 | return ret; |
| 232 | } | 237 | } |
| 233 | 238 | ||
| @@ -15,7 +15,7 @@ static inline bool early_cpu_has_feature(unsigned long feature) · 14 unmodified lines | |||
| 15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS | 15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS |
| 16 | #include <linux/jump_label.h> | 16 | #include <linux/jump_label.h> |
| 17 | 17 | ||
| 18 | #define NUM_CPU_FTR_KEYS 64 | 18 | #define NUM_CPU_FTR_KEYS BITS_PER_LONG |
| 19 | 19 | ||
| 20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; | 20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; |
| 21 | 21 | ||
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
| 5 | #include <linux/cpumask.h> | 5 | #include <linux/cpumask.h> |
| 6 | #include <asm/cpu_has_feature.h> | ||
| 6 | 7 | ||
| 7 | /* | 8 | /* |
| 8 | * Mapping of threads to cores | 9 | * Mapping of threads to cores |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #ifndef __ASM_PPC64_HMI_H__ | 21 | #ifndef __ASM_PPC64_HMI_H__ |
| 22 | #define __ASM_PPC64_HMI_H__ | 22 | #define __ASM_PPC64_HMI_H__ |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_PPC_BOOK3S_64 | 24 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
| 25 | 25 | ||
| 26 | #define CORE_TB_RESYNC_REQ_BIT 63 | 26 | #define CORE_TB_RESYNC_REQ_BIT 63 |
| 27 | #define MAX_SUBCORE_PER_CORE 4 | 27 | #define MAX_SUBCORE_PER_CORE 4 |
| @@ -183,11 +183,6 @@ struct paca_struct { · 182 unmodified lines | |||
| 183 | */ | 183 | */ |
| 184 | u16 in_mce; | 184 | u16 in_mce; |
| 185 | u8 hmi_event_available; /* HMI event is available */ | 185 | u8 hmi_event_available; /* HMI event is available */ |
| 186 | /* | ||
| 187 | * Bitmap for sibling subcore status. See kvm/book3s_hv_ras.c for | ||
| 188 | * more details | ||
| 189 | */ | ||
| 190 | struct sibling_subcore_state *sibling_subcore_state; | ||
| 191 | #endif | 186 | #endif |
| 192 | 187 | ||
| 193 | /* Stuff for accurate time accounting */ | 188 | /* Stuff for accurate time accounting */ |
| @@ -202,6 +197,13 @@ struct paca_struct { · 8 unmodified lines | |||
| 202 | struct kvmppc_book3s_shadow_vcpu shadow_vcpu; | 197 | struct kvmppc_book3s_shadow_vcpu shadow_vcpu; |
| 203 | #endif | 198 | #endif |
| 204 | struct kvmppc_host_state kvm_hstate; | 199 | struct kvmppc_host_state kvm_hstate; |
| 200 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE | ||
| 201 | /* | ||
| 202 | * Bitmap for sibling subcore status. See kvm/book3s_hv_ras.c for | ||
| 203 | * more details | ||
| 204 | */ | ||
| 205 | struct sibling_subcore_state *sibling_subcore_state; | ||
| 206 | #endif | ||
| 205 | #endif | 207 | #endif |
| 206 | }; | 208 | }; |
| 207 | 209 | ||
| @@ -301,6 +301,7 @@ extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, · 300 unmodified lines | |||
| 301 | /* Allocate & free a PCI host bridge structure */ | 301 | /* Allocate & free a PCI host bridge structure */ |
| 302 | extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); | 302 | extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev); |
| 303 | extern void pcibios_free_controller(struct pci_controller *phb); | 303 | extern void pcibios_free_controller(struct pci_controller *phb); |
| 304 | extern void pcibios_free_controller_deferred(struct pci_host_bridge *bridge); | ||
| 304 | 305 | ||
| 305 | #ifdef CONFIG_PCI | 306 | #ifdef CONFIG_PCI |
| 306 | extern int pcibios_vaddr_is_ioport(void __iomem *address); | 307 | extern int pcibios_vaddr_is_ioport(void __iomem *address); |
| @@ -308,40 +308,21 @@ extern unsigned long __copy_tofrom_user(void __user *to, · 307 unmodified lines | |||
| 308 | static inline unsigned long copy_from_user(void *to, | 308 | static inline unsigned long copy_from_user(void *to, |
| 309 | const void __user *from, unsigned long n) | 309 | const void __user *from, unsigned long n) |
| 310 | { | 310 | { |
| 311 | unsigned long over; | 311 | if (likely(access_ok(VERIFY_READ, from, n))) { |
| 312 | 312 | check_object_size(to, n, false); | |
| 313 | if (access_ok(VERIFY_READ, from, n)) { | ||
| 314 | if (!__builtin_constant_p(n)) | ||
| 315 | check_object_size(to, n, false); | ||
| 316 | return __copy_tofrom_user((__force void __user *)to, from, n); | 313 | return __copy_tofrom_user((__force void __user *)to, from, n); |
| 317 | } | 314 | } |
| 318 | if ((unsigned long)from < TASK_SIZE) { | 315 | memset(to, 0, n); |
| 319 | over = (unsigned long)from + n - TASK_SIZE; | ||
| 320 | if (!__builtin_constant_p(n - over)) | ||
| 321 | check_object_size(to, n - over, false); | ||
| 322 | return __copy_tofrom_user((__force void __user *)to, from, | ||
| 323 | n - over) + over; | ||
| 324 | } | ||
| 325 | return n; | 316 | return n; |
| 326 | } | 317 | } |
| 327 | 318 | ||
| 328 | static inline unsigned long copy_to_user(void __user *to, | 319 | static inline unsigned long copy_to_user(void __user *to, |
| 329 | const void *from, unsigned long n) | 320 | const void *from, unsigned long n) |
| 330 | { | 321 | { |
| 331 | unsigned long over; | ||
| 332 | |||
| 333 | if (access_ok(VERIFY_WRITE, to, n)) { | 322 | if (access_ok(VERIFY_WRITE, to, n)) { |
| 334 | if (!__builtin_constant_p(n)) | 323 | check_object_size(from, n, true); |
| 335 | check_object_size(from, n, true); | ||
| 336 | return __copy_tofrom_user(to, (__force void __user *)from, n); | 324 | return __copy_tofrom_user(to, (__force void __user *)from, n); |
| 337 | } | 325 | } |
| 338 | if ((unsigned long)to < TASK_SIZE) { | ||
| 339 | over = (unsigned long)to + n - TASK_SIZE; | ||
| 340 | if (!__builtin_constant_p(n)) | ||
| 341 | check_object_size(from, n - over, true); | ||
| 342 | return __copy_tofrom_user(to, (__force void __user *)from, | ||
| 343 | n - over) + over; | ||
| 344 | } | ||
| 345 | return n; | 326 | return n; |
| 346 | } | 327 | } |
| 347 | 328 | ||
| @@ -383,8 +364,7 @@ static inline unsigned long __copy_from_user_inatomic(void *to, · 35 unmodified lines | |||
| 383 | return 0; | 364 | return 0; |
| 384 | } | 365 | } |
| 385 | 366 | ||
| 386 | if (!__builtin_constant_p(n)) | 367 | check_object_size(to, n, false); |
| 387 | check_object_size(to, n, false); | ||
| 388 | 368 | ||
| 389 | return __copy_tofrom_user((__force void __user *)to, from, n); | 369 | return __copy_tofrom_user((__force void __user *)to, from, n); |
| 390 | } | 370 | } |
| @@ -412,8 +392,8 @@ static inline unsigned long __copy_to_user_inatomic(void __user *to, · 21 unmodified lines | |||
| 412 | if (ret == 0) | 392 | if (ret == 0) |
| 413 | return 0; | 393 | return 0; |
| 414 | } | 394 | } |
| 415 | if (!__builtin_constant_p(n)) | 395 | |
| 416 | check_object_size(from, n, true); | 396 | check_object_size(from, n, true); |
| 417 | 397 | ||
| 418 | return __copy_tofrom_user(to, (__force const void __user *)from, n); | 398 | return __copy_tofrom_user(to, (__force const void __user *)from, n); |
| 419 | } | 399 | } |
| @@ -439,10 +419,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) · 19 unmodified lines | |||
| 439 | might_fault(); | 419 | might_fault(); |
| 440 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | 420 | if (likely(access_ok(VERIFY_WRITE, addr, size))) |
| 441 | return __clear_user(addr, size); | 421 | return __clear_user(addr, size); |
| 442 | if ((unsigned long)addr < TASK_SIZE) { | ||
| 443 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
| 444 | return __clear_user(addr, size - over) + over; | ||
| 445 | } | ||
| 446 | return size; | 422 | return size; |
| 447 | } | 423 | } |
| 448 | 424 | ||
| @@ -41,7 +41,7 @@ obj-$(CONFIG_VDSO32) += vdso32/ · 40 unmodified lines | |||
| 41 | obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o | 41 | obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o |
| 42 | obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o | 42 | obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o |
| 43 | obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o | 43 | obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o |
| 44 | obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o hmi.o | 44 | obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o |
| 45 | obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o | 45 | obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o |
| 46 | obj-$(CONFIG_PPC64) += vdso64/ | 46 | obj-$(CONFIG_PPC64) += vdso64/ |
| 47 | obj-$(CONFIG_ALTIVEC) += vecemu.o | 47 | obj-$(CONFIG_ALTIVEC) += vecemu.o |
| @@ -368,13 +368,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) · 367 unmodified lines | |||
| 368 | tabort_syscall: | 368 | tabort_syscall: |
| 369 | /* Firstly we need to enable TM in the kernel */ | 369 | /* Firstly we need to enable TM in the kernel */ |
| 370 | mfmsr r10 | 370 | mfmsr r10 |
| 371 | li r13, 1 | 371 | li r9, 1 |
| 372 | rldimi r10, r13, MSR_TM_LG, 63-MSR_TM_LG | 372 | rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG |
| 373 | mtmsrd r10, 0 | 373 | mtmsrd r10, 0 |
| 374 | 374 | ||
| 375 | /* tabort, this dooms the transaction, nothing else */ | 375 | /* tabort, this dooms the transaction, nothing else */ |
| 376 | li r13, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) | 376 | li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) |
| 377 | TABORT(R13) | 377 | TABORT(R9) |
| 378 | 378 | ||
| 379 | /* | 379 | /* |
| 380 | * Return directly to userspace. We have corrupted user register state, | 380 | * Return directly to userspace. We have corrupted user register state, |
| @@ -382,8 +382,8 @@ tabort_syscall: · 1 unmodified line | |||
| 382 | * resume after the tbegin of the aborted transaction with the | 382 | * resume after the tbegin of the aborted transaction with the |
| 383 | * checkpointed register state. | 383 | * checkpointed register state. |
| 384 | */ | 384 | */ |
| 385 | li r13, MSR_RI | 385 | li r9, MSR_RI |
| 386 | andc r10, r10, r13 | 386 | andc r10, r10, r9 |
| 387 | mtmsrd r10, 1 | 387 | mtmsrd r10, 1 |
| 388 | mtspr SPRN_SRR0, r11 | 388 | mtspr SPRN_SRR0, r11 |
| 389 | mtspr SPRN_SRR1, r12 | 389 | mtspr SPRN_SRR1, r12 |
| @@ -485,7 +485,23 @@ machine_check_fwnmi: · 484 unmodified lines | |||
| 485 | EXCEPTION_PROLOG_0(PACA_EXMC) | 485 | EXCEPTION_PROLOG_0(PACA_EXMC) |
| 486 | machine_check_pSeries_0: | 486 | machine_check_pSeries_0: |
| 487 | EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200) | 487 | EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200) |
| 488 | EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD) | 488 | /* |
| 489 | * The following is essentially EXCEPTION_PROLOG_PSERIES_1 with the | ||
| 490 | * difference that MSR_RI is not enabled, because PACA_EXMC is being | ||
| 491 | * used, so nested machine check corrupts it. machine_check_common | ||
| 492 | * enables MSR_RI. | ||
| 493 | */ | ||
| 494 | ld r12,PACAKBASE(r13) | ||
| 495 | ld r10,PACAKMSR(r13) | ||
| 496 | xori r10,r10,MSR_RI | ||
| 497 | mfspr r11,SPRN_SRR0 | ||
| 498 | LOAD_HANDLER(r12, machine_check_common) | ||
| 499 | mtspr SPRN_SRR0,r12 | ||
| 500 | mfspr r12,SPRN_SRR1 | ||
| 501 | mtspr SPRN_SRR1,r10 | ||
| 502 | rfid | ||
| 503 | b . /* prevent speculative execution */ | ||
| 504 | |||
| 489 | KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200) | 505 | KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200) |
| 490 | KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300) | 506 | KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300) |
| 491 | KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380) | 507 | KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380) |
| @@ -969,14 +985,17 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) · 477 unmodified lines | |||
| 969 | machine_check_common: | 985 | machine_check_common: |
| 970 | 986 | ||
| 971 | mfspr r10,SPRN_DAR | 987 | mfspr r10,SPRN_DAR |
| 972 | std r10,PACA_EXGEN+EX_DAR(r13) | 988 | std r10,PACA_EXMC+EX_DAR(r13) |
| 973 | mfspr r10,SPRN_DSISR | 989 | mfspr r10,SPRN_DSISR |
| 974 | stw r10,PACA_EXGEN+EX_DSISR(r13) | 990 | stw r10,PACA_EXMC+EX_DSISR(r13) |
| 975 | EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) | 991 | EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) |
| 976 | FINISH_NAP | 992 | FINISH_NAP |
| 977 | RECONCILE_IRQ_STATE(r10, r11) | 993 | RECONCILE_IRQ_STATE(r10, r11) |
| 978 | ld r3,PACA_EXGEN+EX_DAR(r13) | 994 | ld r3,PACA_EXMC+EX_DAR(r13) |
| 979 | lwz r4,PACA_EXGEN+EX_DSISR(r13) | 995 | lwz r4,PACA_EXMC+EX_DSISR(r13) |
| 996 | /* Enable MSR_RI when finished with PACA_EXMC */ | ||
| 997 | li r10,MSR_RI | ||
| 998 | mtmsrd r10,1 | ||
| 980 | std r3,_DAR(r1) | 999 | std r3,_DAR(r1) |
| 981 | std r4,_DSISR(r1) | 1000 | std r4,_DSISR(r1) |
| 982 | bl save_nvgprs | 1001 | bl save_nvgprs |
| @@ -411,7 +411,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) · 410 unmodified lines | |||
| 411 | * | 411 | * |
| 412 | * r13 - PACA | 412 | * r13 - PACA |
| 413 | * cr3 - gt if waking up with partial/complete hypervisor state loss | 413 | * cr3 - gt if waking up with partial/complete hypervisor state loss |
| 414 | * cr4 - eq if waking up from complete hypervisor state loss. | 414 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
| 415 | */ | 415 | */ |
| 416 | _GLOBAL(pnv_wakeup_tb_loss) | 416 | _GLOBAL(pnv_wakeup_tb_loss) |
| 417 | ld r1,PACAR1(r13) | 417 | ld r1,PACAR1(r13) |
| @@ -453,7 +453,7 @@ lwarx_loop2: · 35 unmodified lines | |||
| 453 | * At this stage | 453 | * At this stage |
| 454 | * cr2 - eq if first thread to wakeup in core | 454 | * cr2 - eq if first thread to wakeup in core |
| 455 | * cr3- gt if waking up with partial/complete hypervisor state loss | 455 | * cr3- gt if waking up with partial/complete hypervisor state loss |
| 456 | * cr4 - eq if waking up from complete hypervisor state loss. | 456 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
| 457 | */ | 457 | */ |
| 458 | 458 | ||
| 459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT | 459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT |
| @@ -481,7 +481,7 @@ first_thread_in_subcore: · 21 unmodified lines | |||
| 481 | * If waking up from sleep, subcore state is not lost. Hence | 481 | * If waking up from sleep, subcore state is not lost. Hence |
| 482 | * skip subcore state restore | 482 | * skip subcore state restore |
| 483 | */ | 483 | */ |
| 484 | bne cr4,subcore_state_restored | 484 | blt cr4,subcore_state_restored |
| 485 | 485 | ||
| 486 | /* Restore per-subcore state */ | 486 | /* Restore per-subcore state */ |
| 487 | ld r4,_SDR1(r1) | 487 | ld r4,_SDR1(r1) |
| @@ -526,7 +526,7 @@ timebase_resync: · 38 unmodified lines | |||
| 526 | * If waking up from sleep, per core state is not lost, skip to | 526 | * If waking up from sleep, per core state is not lost, skip to |
| 527 | * clear_lock. | 527 | * clear_lock. |
| 528 | */ | 528 | */ |
| 529 | bne cr4,clear_lock | 529 | blt cr4,clear_lock |
| 530 | 530 | ||
| 531 | /* | 531 | /* |
| 532 | * First thread in the core to wake up and its waking up with | 532 | * First thread in the core to wake up and its waking up with |
| @@ -557,7 +557,7 @@ common_exit: · 24 unmodified lines | |||
| 557 | * If waking up from sleep, hypervisor state is not lost. Hence | 557 | * If waking up from sleep, hypervisor state is not lost. Hence |
| 558 | * skip hypervisor state restore. | 558 | * skip hypervisor state restore. |
| 559 | */ | 559 | */ |
| 560 | bne cr4,hypervisor_state_restored | 560 | blt cr4,hypervisor_state_restored |
| 561 | 561 | ||
| 562 | /* Waking up from winkle */ | 562 | /* Waking up from winkle */ |
| 563 | 563 | ||
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <linux/kprobes.h> | 29 | #include <linux/kprobes.h> |
| 30 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
| 31 | #include <linux/preempt.h> | 31 | #include <linux/preempt.h> |
| 32 | #include <linux/module.h> | 32 | #include <linux/extable.h> |
| 33 | #include <linux/kdebug.h> | 33 | #include <linux/kdebug.h> |
| 34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 35 | #include <asm/code-patching.h> | 35 | #include <asm/code-patching.h> |
| @@ -153,6 +153,42 @@ void pcibios_free_controller(struct pci_controller *phb) · 152 unmodified lines | |||
| 153 | } | 153 | } |
| 154 | EXPORT_SYMBOL_GPL(pcibios_free_controller); | 154 | EXPORT_SYMBOL_GPL(pcibios_free_controller); |
| 155 | 155 | ||
| 156 | /* | ||
| 157 | * This function is used to call pcibios_free_controller() | ||
| 158 | * in a deferred manner: a callback from the PCI subsystem. | ||
| 159 | * | ||
| 160 | * _*DO NOT*_ call pcibios_free_controller() explicitly if | ||
| 161 | * this is used (or it may access an invalid *phb pointer). | ||
| 162 | * | ||
| 163 | * The callback occurs when all references to the root bus | ||
| 164 | * are dropped (e.g., child buses/devices and their users). | ||
| 165 | * | ||
| 166 | * It's called as .release_fn() of 'struct pci_host_bridge' | ||
| 167 | * which is associated with the 'struct pci_controller.bus' | ||
| 168 | * (root bus) - it expects .release_data to hold a pointer | ||
| 169 | * to 'struct pci_controller'. | ||
| 170 | * | ||
| 171 | * In order to use it, register .release_fn()/release_data | ||
| 172 | * like this: | ||
| 173 | * | ||
| 174 | * pci_set_host_bridge_release(bridge, | ||
| 175 | * pcibios_free_controller_deferred | ||
| 176 | * (void *) phb); | ||
| 177 | * | ||
| 178 | * e.g. in the pcibios_root_bridge_prepare() callback from | ||
| 179 | * pci_create_root_bus(). | ||
| 180 | */ | ||
| 181 | void pcibios_free_controller_deferred(struct pci_host_bridge *bridge) | ||
| 182 | { | ||
| 183 | struct pci_controller *phb = (struct pci_controller *) | ||
| 184 | bridge->release_data; | ||
| 185 | |||
| 186 | pr_debug("domain %d, dynamic %d\n", phb->global_number, phb->is_dynamic); | ||
| 187 | |||
| 188 | pcibios_free_controller(phb); | ||
| 189 | } | ||
| 190 | EXPORT_SYMBOL_GPL(pcibios_free_controller_deferred); | ||
| 191 | |||
| 156 | /* | 192 | /* |
| 157 | * The function is used to return the minimal alignment | 193 | * The function is used to return the minimal alignment |
| 158 | * for memory or I/O windows of the associated P2P bridge. | 194 | * for memory or I/O windows of the associated P2P bridge. |
| @@ -695,7 +695,7 @@ unsigned char ibm_architecture_vec[] = { · 694 unmodified lines | |||
| 695 | OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ | 695 | OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ |
| 696 | 696 | ||
| 697 | /* option vector 5: PAPR/OF options */ | 697 | /* option vector 5: PAPR/OF options */ |
| 698 | VECTOR_LENGTH(18), /* length */ | 698 | VECTOR_LENGTH(21), /* length */ |
| 699 | 0, /* don't ignore, don't halt */ | 699 | 0, /* don't ignore, don't halt */ |
| 700 | OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | | 700 | OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | |
| 701 | OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | | 701 | OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | |
| @@ -726,8 +726,11 @@ unsigned char ibm_architecture_vec[] = { · 24 unmodified lines | |||
| 726 | 0, | 726 | 0, |
| 727 | 0, | 727 | 0, |
| 728 | OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | | 728 | OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | |
| 729 | OV5_FEAT(OV5_PFO_HW_842), | 729 | OV5_FEAT(OV5_PFO_HW_842), /* Byte 17 */ |
| 730 | OV5_FEAT(OV5_SUB_PROCESSORS), | 730 | 0, /* Byte 18 */ |
| 731 | 0, /* Byte 19 */ | ||
| 732 | 0, /* Byte 20 */ | ||
| 733 | OV5_FEAT(OV5_SUB_PROCESSORS), /* Byte 21 */ | ||
| 731 | 734 | ||
| 732 | /* option vector 6: IBM PAPR hints */ | 735 | /* option vector 6: IBM PAPR hints */ |
| 733 | VECTOR_LENGTH(3), /* length */ | 736 | VECTOR_LENGTH(3), /* length */ |
| @@ -1226,7 +1226,21 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8, · 1225 unmodified lines | |||
| 1226 | (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16); | 1226 | (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16); |
| 1227 | if (!access_ok(VERIFY_READ, rt_sf, sizeof(*rt_sf))) | 1227 | if (!access_ok(VERIFY_READ, rt_sf, sizeof(*rt_sf))) |
| 1228 | goto bad; | 1228 | goto bad; |
| 1229 | |||
| 1229 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 1230 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 1231 | /* | ||
| 1232 | * If there is a transactional state then throw it away. | ||
| 1233 | * The purpose of a sigreturn is to destroy all traces of the | ||
| 1234 | * signal frame, this includes any transactional state created | ||
| 1235 | * within in. We only check for suspended as we can never be | ||
| 1236 | * active in the kernel, we are active, there is nothing better to | ||
| 1237 | * do than go ahead and Bad Thing later. | ||
| 1238 | * The cause is not important as there will never be a | ||
| 1239 | * recheckpoint so it's not user visible. | ||
| 1240 | */ | ||
| 1241 | if (MSR_TM_SUSPENDED(mfmsr())) | ||
| 1242 | tm_reclaim_current(0); | ||
| 1243 | |||
| 1230 | if (__get_user(tmp, &rt_sf->uc.uc_link)) | 1244 | if (__get_user(tmp, &rt_sf->uc.uc_link)) |
| 1231 | goto bad; | 1245 | goto bad; |
| 1232 | uc_transact = (struct ucontext __user *)(uintptr_t)tmp; | 1246 | uc_transact = (struct ucontext __user *)(uintptr_t)tmp; |
| @@ -676,7 +676,21 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5, · 675 unmodified lines | |||
| 676 | if (__copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) | 676 | if (__copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) |
| 677 | goto badframe; | 677 | goto badframe; |
| 678 | set_current_blocked(&set); | 678 | set_current_blocked(&set); |
| 679 | |||
| 679 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 680 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
| 681 | /* | ||
| 682 | * If there is a transactional state then throw it away. | ||
| 683 | * The purpose of a sigreturn is to destroy all traces of the | ||
| 684 | * signal frame, this includes any transactional state created | ||
| 685 | * within in. We only check for suspended as we can never be | ||
| 686 | * active in the kernel, we are active, there is nothing better to | ||
| 687 | * do than go ahead and Bad Thing later. | ||
| 688 | * The cause is not important as there will never be a | ||
| 689 | * recheckpoint so it's not user visible. | ||
| 690 | */ | ||
| 691 | if (MSR_TM_SUSPENDED(mfmsr())) | ||
| 692 | tm_reclaim_current(0); | ||
| 693 | |||
| 680 | if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR])) | 694 | if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR])) |
| 681 | goto badframe; | 695 | goto badframe; |
| 682 | if (MSR_TM_ACTIVE(msr)) { | 696 | if (MSR_TM_ACTIVE(msr)) { |
| @@ -830,7 +830,7 @@ int __cpu_disable(void) · 829 unmodified lines | |||
| 830 | 830 | ||
| 831 | /* Update sibling maps */ | 831 | /* Update sibling maps */ |
| 832 | base = cpu_first_thread_sibling(cpu); | 832 | base = cpu_first_thread_sibling(cpu); |
| 833 | for (i = 0; i < threads_per_core; i++) { | 833 | for (i = 0; i < threads_per_core && base + i < nr_cpu_ids; i++) { |
| 834 | cpumask_clear_cpu(cpu, cpu_sibling_mask(base + i)); | 834 | cpumask_clear_cpu(cpu, cpu_sibling_mask(base + i)); |
| 835 | cpumask_clear_cpu(base + i, cpu_sibling_mask(cpu)); | 835 | cpumask_clear_cpu(base + i, cpu_sibling_mask(cpu)); |
| 836 | cpumask_clear_cpu(cpu, cpu_core_mask(base + i)); | 836 | cpumask_clear_cpu(cpu, cpu_core_mask(base + i)); |
| @@ -25,7 +25,8 @@ · 24 unmodified lines | |||
| 25 | #include <linux/user.h> | 25 | #include <linux/user.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
| 28 | #include <linux/module.h> | 28 | #include <linux/extable.h> |
| 29 | #include <linux/module.h> /* print_modules */ | ||
| 29 | #include <linux/prctl.h> | 30 | #include <linux/prctl.h> |
| 30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
| 31 | #include <linux/kprobes.h> | 32 | #include <linux/kprobes.h> |
| @@ -78,6 +78,7 @@ kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \ · 77 unmodified lines | |||
| 78 | 78 | ||
| 79 | ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE | 79 | ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
| 80 | kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \ | 80 | kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += \ |
| 81 | book3s_hv_hmi.o \ | ||
| 81 | book3s_hv_rmhandlers.o \ | 82 | book3s_hv_rmhandlers.o \ |
| 82 | book3s_hv_rm_mmu.o \ | 83 | book3s_hv_rm_mmu.o \ |
| 83 | book3s_hv_ras.o \ | 84 | book3s_hv_ras.o \ |
File renamed without changes.
| @@ -127,18 +127,19 @@ _GLOBAL(csum_partial_copy_generic) · 126 unmodified lines | |||
| 127 | stw r7,12(r1) | 127 | stw r7,12(r1) |
| 128 | stw r8,8(r1) | 128 | stw r8,8(r1) |
| 129 | 129 | ||
| 130 | rlwinm r0,r4,3,0x8 | ||
| 131 | rlwnm r6,r6,r0,0,31 /* odd destination address: rotate one byte */ | ||
| 132 | cmplwi cr7,r0,0 /* is destination address even ? */ | ||
| 133 | addic r12,r6,0 | 130 | addic r12,r6,0 |
| 134 | addi r6,r4,-4 | 131 | addi r6,r4,-4 |
| 135 | neg r0,r4 | 132 | neg r0,r4 |
| 136 | addi r4,r3,-4 | 133 | addi r4,r3,-4 |
| 137 | andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ | 134 | andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ |
| 135 | crset 4*cr7+eq | ||
| 138 | beq 58f | 136 | beq 58f |
| 139 | 137 | ||
| 140 | cmplw 0,r5,r0 /* is this more than total to do? */ | 138 | cmplw 0,r5,r0 /* is this more than total to do? */ |
| 141 | blt 63f /* if not much to do */ | 139 | blt 63f /* if not much to do */ |
| 140 | rlwinm r7,r6,3,0x8 | ||
| 141 | rlwnm r12,r12,r7,0,31 /* odd destination address: rotate one byte */ | ||
| 142 | cmplwi cr7,r7,0 /* is destination address even ? */ | ||
| 142 | andi. r8,r0,3 /* get it word-aligned first */ | 143 | andi. r8,r0,3 /* get it word-aligned first */ |
| 143 | mtctr r8 | 144 | mtctr r8 |
| 144 | beq+ 61f | 145 | beq+ 61f |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
| 27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
| 28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/extable.h> |
| 30 | #include <linux/kprobes.h> | 30 | #include <linux/kprobes.h> |
| 31 | #include <linux/kdebug.h> | 31 | #include <linux/kdebug.h> |
| 32 | #include <linux/perf_event.h> | 32 | #include <linux/perf_event.h> |
| @@ -113,7 +113,12 @@ BEGIN_FTR_SECTION · 112 unmodified lines | |||
| 113 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) | 113 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) |
| 114 | b slb_finish_load_1T | 114 | b slb_finish_load_1T |
| 115 | 115 | ||
| 116 | 0: | 116 | 0: /* |
| 117 | * For userspace addresses, make sure this is region 0. | ||
| 118 | */ | ||
| 119 | cmpdi r9, 0 | ||
| 120 | bne 8f | ||
| 121 | |||
| 117 | /* when using slices, we extract the psize off the slice bitmaps | 122 | /* when using slices, we extract the psize off the slice bitmaps |
| 118 | * and then we need to get the sllp encoding off the mmu_psize_defs | 123 | * and then we need to get the sllp encoding off the mmu_psize_defs |
| 119 | * array. | 124 | * array. |
| @@ -528,7 +528,6 @@ static struct platform_driver mpc512x_lpbfifo_driver = { · 527 unmodified lines | |||
| 528 | .remove = mpc512x_lpbfifo_remove, | 528 | .remove = mpc512x_lpbfifo_remove, |
| 529 | .driver = { | 529 | .driver = { |
| 530 | .name = DRV_NAME, | 530 | .name = DRV_NAME, |
| 531 | .owner = THIS_MODULE, | ||
| 532 | .of_match_table = mpc512x_lpbfifo_match, | 531 | .of_match_table = mpc512x_lpbfifo_match, |
| 533 | }, | 532 | }, |
| 534 | }; | 533 | }; |
| @@ -222,7 +222,6 @@ static const struct of_device_id mcu_of_match_table[] = { · 221 unmodified lines | |||
| 222 | static struct i2c_driver mcu_driver = { | 222 | static struct i2c_driver mcu_driver = { |
| 223 | .driver = { | 223 | .driver = { |
| 224 | .name = "mcu-mpc8349emitx", | 224 | .name = "mcu-mpc8349emitx", |
| 225 | .owner = THIS_MODULE, | ||
| 226 | .of_match_table = mcu_of_match_table, | 225 | .of_match_table = mcu_of_match_table, |
| 227 | }, | 226 | }, |
| 228 | .probe = mcu_probe, | 227 | .probe = mcu_probe, |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include <linux/tty.h> | 26 | #include <linux/tty.h> |
| 27 | #include <linux/serial_core.h> | 27 | #include <linux/serial_core.h> |
| 28 | #include <linux/of_platform.h> | 28 | #include <linux/of_platform.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/extable.h> |
| 30 | 30 | ||
| 31 | #include <asm/time.h> | 31 | #include <asm/time.h> |
| 32 | #include <asm/machdep.h> | 32 | #include <asm/machdep.h> |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
| 24 | #include <linux/kdev_t.h> | 24 | #include <linux/kdev_t.h> |
| 25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
| 26 | #include <linux/module.h> | 26 | #include <linux/extable.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
| 29 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
| @@ -370,6 +370,7 @@ static irqreturn_t process_dump(int irq, void *data) · 369 unmodified lines | |||
| 370 | uint32_t dump_id, dump_size, dump_type; | 370 | uint32_t dump_id, dump_size, dump_type; |
| 371 | struct dump_obj *dump; | 371 | struct dump_obj *dump; |
| 372 | char name[22]; | 372 | char name[22]; |
| 373 | struct kobject *kobj; | ||
| 373 | 374 | ||
| 374 | rc = dump_read_info(&dump_id, &dump_size, &dump_type); | 375 | rc = dump_read_info(&dump_id, &dump_size, &dump_type); |
| 375 | if (rc != OPAL_SUCCESS) | 376 | if (rc != OPAL_SUCCESS) |
| @@ -381,8 +382,12 @@ static irqreturn_t process_dump(int irq, void *data) · 5 unmodified lines | |||
| 381 | * that gracefully and not create two conflicting | 382 | * that gracefully and not create two conflicting |
| 382 | * entries. | 383 | * entries. |
| 383 | */ | 384 | */ |
| 384 | if (kset_find_obj(dump_kset, name)) | 385 | kobj = kset_find_obj(dump_kset, name); |
| 386 | if (kobj) { | ||
| 387 | /* Drop reference added by kset_find_obj() */ | ||
| 388 | kobject_put(kobj); | ||
| 385 | return 0; | 389 | return 0; |
| 390 | } | ||
| 386 | 391 | ||
| 387 | dump = create_dump_obj(dump_id, dump_size, dump_type); | 392 | dump = create_dump_obj(dump_id, dump_size, dump_type); |
| 388 | if (!dump) | 393 | if (!dump) |
| @@ -247,6 +247,7 @@ static irqreturn_t elog_event(int irq, void *data) · 246 unmodified lines | |||
| 247 | uint64_t elog_type; | 247 | uint64_t elog_type; |
| 248 | int rc; | 248 | int rc; |
| 249 | char name[2+16+1]; | 249 | char name[2+16+1]; |
| 250 | struct kobject *kobj; | ||
| 250 | 251 | ||
| 251 | rc = opal_get_elog_size(&id, &size, &type); | 252 | rc = opal_get_elog_size(&id, &size, &type); |
| 252 | if (rc != OPAL_SUCCESS) { | 253 | if (rc != OPAL_SUCCESS) { |
| @@ -269,8 +270,12 @@ static irqreturn_t elog_event(int irq, void *data) · 16 unmodified lines | |||
| 269 | * that gracefully and not create two conflicting | 270 | * that gracefully and not create two conflicting |
| 270 | * entries. | 271 | * entries. |
| 271 | */ | 272 | */ |
| 272 | if (kset_find_obj(elog_kset, name)) | 273 | kobj = kset_find_obj(elog_kset, name); |
| 274 | if (kobj) { | ||
| 275 | /* Drop reference added by kset_find_obj() */ | ||
| 276 | kobject_put(kobj); | ||
| 273 | return IRQ_HANDLED; | 277 | return IRQ_HANDLED; |
| 278 | } | ||
| 274 | 279 | ||
| 275 | create_elog_obj(log_id, elog_size, elog_type); | 280 | create_elog_obj(log_id, elog_size, elog_type); |
| 276 | 281 | ||
| @@ -124,6 +124,13 @@ static inline bool pnv_pci_is_m64(struct pnv_phb *phb, struct resource *r) · 123 unmodified lines | |||
| 124 | r->start < (phb->ioda.m64_base + phb->ioda.m64_size)); | 124 | r->start < (phb->ioda.m64_base + phb->ioda.m64_size)); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | static inline bool pnv_pci_is_m64_flags(unsigned long resource_flags) | ||
| 128 | { | ||
| 129 | unsigned long flags = (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH); | ||
| 130 | |||
| 131 | return (resource_flags & flags) == flags; | ||
| 132 | } | ||
| 133 | |||
| 127 | static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no) | 134 | static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no) |
| 128 | { | 135 | { |
| 129 | phb->ioda.pe_array[pe_no].phb = phb; | 136 | phb->ioda.pe_array[pe_no].phb = phb; |
| @@ -149,7 +156,7 @@ static void pnv_ioda_reserve_pe(struct pnv_phb *phb, int pe_no) · 19 unmodified lines | |||
| 149 | 156 | ||
| 150 | static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) | 157 | static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) |
| 151 | { | 158 | { |
| 152 | unsigned long pe = phb->ioda.total_pe_num - 1; | 159 | long pe; |
| 153 | 160 | ||
| 154 | for (pe = phb->ioda.total_pe_num - 1; pe >= 0; pe--) { | 161 | for (pe = phb->ioda.total_pe_num - 1; pe >= 0; pe--) { |
| 155 | if (!test_and_set_bit(pe, phb->ioda.pe_alloc)) | 162 | if (!test_and_set_bit(pe, phb->ioda.pe_alloc)) |
| @@ -162,11 +169,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) · 6 unmodified lines | |||
| 162 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) | 169 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) |
| 163 | { | 170 | { |
| 164 | struct pnv_phb *phb = pe->phb; | 171 | struct pnv_phb *phb = pe->phb; |
| 172 | unsigned int pe_num = pe->pe_number; | ||
| 165 | 173 | ||
| 166 | WARN_ON(pe->pdev); | 174 | WARN_ON(pe->pdev); |
| 167 | 175 | ||
| 168 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); | 176 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); |
| 169 | clear_bit(pe->pe_number, phb->ioda.pe_alloc); | 177 | clear_bit(pe_num, phb->ioda.pe_alloc); |
| 170 | } | 178 | } |
| 171 | 179 | ||
| 172 | /* The default M64 BAR is shared by all PEs */ | 180 | /* The default M64 BAR is shared by all PEs */ |
| @@ -2216,7 +2224,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group, · 2043 unmodified lines | |||
| 2216 | 2224 | ||
| 2217 | pnv_pci_link_table_and_group(phb->hose->node, num, | 2225 | pnv_pci_link_table_and_group(phb->hose->node, num, |
| 2218 | tbl, &pe->table_group); | 2226 | tbl, &pe->table_group); |
| 2219 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2227 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
| 2220 | 2228 | ||
| 2221 | return 0; | 2229 | return 0; |
| 2222 | } | 2230 | } |
| @@ -2354,7 +2362,7 @@ static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group, · 131 unmodified lines | |||
| 2354 | if (ret) | 2362 | if (ret) |
| 2355 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); | 2363 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); |
| 2356 | else | 2364 | else |
| 2357 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2365 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
| 2358 | 2366 | ||
| 2359 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); | 2367 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); |
| 2360 | 2368 | ||
| @@ -2870,7 +2878,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) · 509 unmodified lines | |||
| 2870 | res = &pdev->resource[i + PCI_IOV_RESOURCES]; | 2878 | res = &pdev->resource[i + PCI_IOV_RESOURCES]; |
| 2871 | if (!res->flags || res->parent) | 2879 | if (!res->flags || res->parent) |
| 2872 | continue; | 2880 | continue; |
| 2873 | if (!pnv_pci_is_m64(phb, res)) { | 2881 | if (!pnv_pci_is_m64_flags(res->flags)) { |
| 2874 | dev_warn(&pdev->dev, "Don't support SR-IOV with" | 2882 | dev_warn(&pdev->dev, "Don't support SR-IOV with" |
| 2875 | " non M64 VF BAR%d: %pR. \n", | 2883 | " non M64 VF BAR%d: %pR. \n", |
| 2876 | i, res); | 2884 | i, res); |
| @@ -3095,7 +3103,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus, · 218 unmodified lines | |||
| 3095 | * alignment for any 64-bit resource, PCIe doesn't care and | 3103 | * alignment for any 64-bit resource, PCIe doesn't care and |
| 3096 | * bridges only do 64-bit prefetchable anyway. | 3104 | * bridges only do 64-bit prefetchable anyway. |
| 3097 | */ | 3105 | */ |
| 3098 | if (phb->ioda.m64_segsize && (type & IORESOURCE_MEM_64)) | 3106 | if (phb->ioda.m64_segsize && pnv_pci_is_m64_flags(type)) |
| 3099 | return phb->ioda.m64_segsize; | 3107 | return phb->ioda.m64_segsize; |
| 3100 | if (type & IORESOURCE_MEM) | 3108 | if (type & IORESOURCE_MEM) |
| 3101 | return phb->ioda.m32_segsize; | 3109 | return phb->ioda.m32_segsize; |
| @@ -3402,12 +3410,6 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe) · 300 unmodified lines | |||
| 3402 | struct pnv_phb *phb = pe->phb; | 3410 | struct pnv_phb *phb = pe->phb; |
| 3403 | struct pnv_ioda_pe *slave, *tmp; | 3411 | struct pnv_ioda_pe *slave, *tmp; |
| 3404 | 3412 | ||
| 3405 | /* Release slave PEs in compound PE */ | ||
| 3406 | if (pe->flags & PNV_IODA_PE_MASTER) { | ||
| 3407 | list_for_each_entry_safe(slave, tmp, &pe->slaves, list) | ||
| 3408 | pnv_ioda_release_pe(slave); | ||
| 3409 | } | ||
| 3410 | |||
| 3411 | list_del(&pe->list); | 3413 | list_del(&pe->list); |
| 3412 | switch (phb->type) { | 3414 | switch (phb->type) { |
| 3413 | case PNV_PHB_IODA1: | 3415 | case PNV_PHB_IODA1: |
| @@ -3422,7 +3424,26 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe) · 8 unmodified lines | |||
| 3422 | 3424 | ||
| 3423 | pnv_ioda_release_pe_seg(pe); | 3425 | pnv_ioda_release_pe_seg(pe); |
| 3424 | pnv_ioda_deconfigure_pe(pe->phb, pe); | 3426 | pnv_ioda_deconfigure_pe(pe->phb, pe); |
| 3425 | pnv_ioda_free_pe(pe); | 3427 | |
| 3428 | /* Release slave PEs in the compound PE */ | ||
| 3429 | if (pe->flags & PNV_IODA_PE_MASTER) { | ||
| 3430 | list_for_each_entry_safe(slave, tmp, &pe->slaves, list) { | ||
| 3431 | list_del(&slave->list); | ||
| 3432 | pnv_ioda_free_pe(slave); | ||
| 3433 | } | ||
| 3434 | } | ||
| 3435 | |||
| 3436 | /* | ||
| 3437 | * The PE for root bus can be removed because of hotplug in EEH | ||
| 3438 | * recovery for fenced PHB error. We need to mark the PE dead so | ||
| 3439 | * that it can be populated again in PCI hot add path. The PE | ||
| 3440 | * shouldn't be destroyed as it's the global reserved resource. | ||
| 3441 | */ | ||
| 3442 | if (phb->ioda.root_pe_populated && | ||
| 3443 | phb->ioda.root_pe_idx == pe->pe_number) | ||
| 3444 | phb->ioda.root_pe_populated = false; | ||
| 3445 | else | ||
| 3446 | pnv_ioda_free_pe(pe); | ||
| 3426 | } | 3447 | } |
| 3427 | 3448 | ||
| 3428 | static void pnv_pci_release_device(struct pci_dev *pdev) | 3449 | static void pnv_pci_release_device(struct pci_dev *pdev) |
| @@ -3438,7 +3459,17 @@ static void pnv_pci_release_device(struct pci_dev *pdev) · 9 unmodified lines | |||
| 3438 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) | 3459 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) |
| 3439 | return; | 3460 | return; |
| 3440 | 3461 | ||
| 3462 | /* | ||
| 3463 | * PCI hotplug can happen as part of EEH error recovery. The @pdn | ||
| 3464 | * isn't removed and added afterwards in this scenario. We should | ||
| 3465 | * set the PE number in @pdn to an invalid one. Otherwise, the PE's | ||
| 3466 | * device count is decreased on removing devices while failing to | ||
| 3467 | * be increased on adding devices. It leads to unbalanced PE's device | ||
| 3468 | * count and eventually make normal PCI hotplug path broken. | ||
| 3469 | */ | ||
| 3441 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 3470 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
| 3471 | pdn->pe_number = IODA_INVALID_PE; | ||
| 3472 | |||
| 3442 | WARN_ON(--pe->device_count < 0); | 3473 | WARN_ON(--pe->device_count < 0); |
| 3443 | if (pe->device_count == 0) | 3474 | if (pe->device_count == 0) |
| 3444 | pnv_ioda_release_pe(pe); | 3475 | pnv_ioda_release_pe(pe); |
| @@ -119,6 +119,10 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 118 unmodified lines | |||
| 119 | 119 | ||
| 120 | bus = bridge->bus; | 120 | bus = bridge->bus; |
| 121 | 121 | ||
| 122 | /* Rely on the pcibios_free_controller_deferred() callback. */ | ||
| 123 | pci_set_host_bridge_release(bridge, pcibios_free_controller_deferred, | ||
| 124 | (void *) pci_bus_to_host(bus)); | ||
| 125 | |||
| 122 | dn = pcibios_get_phb_of_node(bus); | 126 | dn = pcibios_get_phb_of_node(bus); |
| 123 | if (!dn) | 127 | if (!dn) |
| 124 | return 0; | 128 | return 0; |
| @@ -106,8 +106,11 @@ int remove_phb_dynamic(struct pci_controller *phb) · 105 unmodified lines | |||
| 106 | release_resource(res); | 106 | release_resource(res); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /* Free pci_controller data structure */ | 109 | /* |
| 110 | pcibios_free_controller(phb); | 110 | * The pci_controller data structure is freed by |
| 111 | * the pcibios_free_controller_deferred() callback; | ||
| 112 | * see pseries_root_bridge_prepare(). | ||
| 113 | */ | ||
| 111 | 114 | ||
| 112 | return 0; | 115 | return 0; |
| 113 | } | 116 | } |
| @@ -41,7 +41,6 @@ · 40 unmodified lines | |||
| 41 | #include <linux/root_dev.h> | 41 | #include <linux/root_dev.h> |
| 42 | #include <linux/of.h> | 42 | #include <linux/of.h> |
| 43 | #include <linux/of_pci.h> | 43 | #include <linux/of_pci.h> |
| 44 | #include <linux/kexec.h> | ||
| 45 | 44 | ||
| 46 | #include <asm/mmu.h> | 45 | #include <asm/mmu.h> |
| 47 | #include <asm/processor.h> | 46 | #include <asm/processor.h> |
| @@ -66,6 +65,7 @@ · 18 unmodified lines | |||
| 66 | #include <asm/eeh.h> | 65 | #include <asm/eeh.h> |
| 67 | #include <asm/reg.h> | 66 | #include <asm/reg.h> |
| 68 | #include <asm/plpar_wrappers.h> | 67 | #include <asm/plpar_wrappers.h> |
| 68 | #include <asm/kexec.h> | ||
| 69 | 69 | ||
| 70 | #include "pseries.h" | 70 | #include "pseries.h" |
| 71 | 71 | ||
| @@ -534,7 +534,8 @@ struct cpm1_gpio16_chip { · 533 unmodified lines | |||
| 534 | 534 | ||
| 535 | static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc) | 535 | static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc) |
| 536 | { | 536 | { |
| 537 | struct cpm1_gpio16_chip *cpm1_gc = gpiochip_get_data(&mm_gc->gc); | 537 | struct cpm1_gpio16_chip *cpm1_gc = |
| 538 | container_of(mm_gc, struct cpm1_gpio16_chip, mm_gc); | ||
| 538 | struct cpm_ioport16 __iomem *iop = mm_gc->regs; | 539 | struct cpm_ioport16 __iomem *iop = mm_gc->regs; |
| 539 | 540 | ||
| 540 | cpm1_gc->cpdata = in_be16(&iop->dat); | 541 | cpm1_gc->cpdata = in_be16(&iop->dat); |
| @@ -649,7 +650,8 @@ struct cpm1_gpio32_chip { · 108 unmodified lines | |||
| 649 | 650 | ||
| 650 | static void cpm1_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) | 651 | static void cpm1_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) |
| 651 | { | 652 | { |
| 652 | struct cpm1_gpio32_chip *cpm1_gc = gpiochip_get_data(&mm_gc->gc); | 653 | struct cpm1_gpio32_chip *cpm1_gc = |
| 654 | container_of(mm_gc, struct cpm1_gpio32_chip, mm_gc); | ||
| 653 | struct cpm_ioport32b __iomem *iop = mm_gc->regs; | 655 | struct cpm_ioport32b __iomem *iop = mm_gc->regs; |
| 654 | 656 | ||
| 655 | cpm1_gc->cpdata = in_be32(&iop->dat); | 657 | cpm1_gc->cpdata = in_be32(&iop->dat); |
| @@ -94,7 +94,8 @@ struct cpm2_gpio32_chip { · 93 unmodified lines | |||
| 94 | 94 | ||
| 95 | static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) | 95 | static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc) |
| 96 | { | 96 | { |
| 97 | struct cpm2_gpio32_chip *cpm2_gc = gpiochip_get_data(&mm_gc->gc); | 97 | struct cpm2_gpio32_chip *cpm2_gc = |
| 98 | container_of(mm_gc, struct cpm2_gpio32_chip, mm_gc); | ||
| 98 | struct cpm2_ioports __iomem *iop = mm_gc->regs; | 99 | struct cpm2_ioports __iomem *iop = mm_gc->regs; |
| 99 | 100 | ||
| 100 | cpm2_gc->cpdata = in_be32(&iop->dat); | 101 | cpm2_gc->cpdata = in_be32(&iop->dat); |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
| 26 | #include <linux/module.h> | 26 | #include <linux/extable.h> |
| 27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
| 28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
| 29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
| @@ -23,10 +23,10 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | static void icp_opal_teardown_cpu(void) | 24 | static void icp_opal_teardown_cpu(void) |
| 25 | { | 25 | { |
| 26 | int cpu = smp_processor_id(); | 26 | int hw_cpu = hard_smp_processor_id(); |
| 27 | 27 | ||
| 28 | /* Clear any pending IPI */ | 28 | /* Clear any pending IPI */ |
| 29 | opal_int_set_mfrr(cpu, 0xff); | 29 | opal_int_set_mfrr(hw_cpu, 0xff); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static void icp_opal_flush_ipi(void) | 32 | static void icp_opal_flush_ipi(void) |
| @@ -101,14 +101,16 @@ static void icp_opal_eoi(struct irq_data *d) · 68 unmodified lines | |||
| 101 | 101 | ||
| 102 | static void icp_opal_cause_ipi(int cpu, unsigned long data) | 102 | static void icp_opal_cause_ipi(int cpu, unsigned long data) |
| 103 | { | 103 | { |
| 104 | opal_int_set_mfrr(cpu, IPI_PRIORITY); | 104 | int hw_cpu = get_hard_smp_processor_id(cpu); |
| 105 | |||
| 106 | opal_int_set_mfrr(hw_cpu, IPI_PRIORITY); | ||
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id) | 109 | static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id) |
| 108 | { | 110 | { |
| 109 | int cpu = smp_processor_id(); | 111 | int hw_cpu = hard_smp_processor_id(); |
| 110 | 112 | ||
| 111 | opal_int_set_mfrr(cpu, 0xff); | 113 | opal_int_set_mfrr(hw_cpu, 0xff); |
| 112 | 114 | ||
| 113 | return smp_ipi_demux(); | 115 | return smp_ipi_demux(); |
| 114 | } | 116 | } |
| @@ -68,7 +68,6 @@ config DEBUG_RODATA · 67 unmodified lines | |||
| 68 | config S390 | 68 | config S390 |
| 69 | def_bool y | 69 | def_bool y |
| 70 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 70 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
| 71 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 72 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 71 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
| 73 | select ARCH_HAS_ELF_RANDOMIZE | 72 | select ARCH_HAS_ELF_RANDOMIZE |
| 74 | select ARCH_HAS_GCOV_PROFILE_ALL | 73 | select ARCH_HAS_GCOV_PROFILE_ALL |
| @@ -602,7 +602,6 @@ CONFIG_FAIL_FUTEX=y · 601 unmodified lines | |||
| 602 | CONFIG_FAULT_INJECTION_DEBUG_FS=y | 602 | CONFIG_FAULT_INJECTION_DEBUG_FS=y |
| 603 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y | 603 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
| 604 | CONFIG_LATENCYTOP=y | 604 | CONFIG_LATENCYTOP=y |
| 605 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 606 | CONFIG_IRQSOFF_TRACER=y | 605 | CONFIG_IRQSOFF_TRACER=y |
| 607 | CONFIG_PREEMPT_TRACER=y | 606 | CONFIG_PREEMPT_TRACER=y |
| 608 | CONFIG_SCHED_TRACER=y | 607 | CONFIG_SCHED_TRACER=y |
| @@ -552,7 +552,6 @@ CONFIG_NOTIFIER_ERROR_INJECTION=m · 551 unmodified lines | |||
| 552 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m | 552 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m |
| 553 | CONFIG_PM_NOTIFIER_ERROR_INJECT=m | 553 | CONFIG_PM_NOTIFIER_ERROR_INJECT=m |
| 554 | CONFIG_LATENCYTOP=y | 554 | CONFIG_LATENCYTOP=y |
| 555 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 556 | CONFIG_BLK_DEV_IO_TRACE=y | 555 | CONFIG_BLK_DEV_IO_TRACE=y |
| 557 | # CONFIG_KPROBE_EVENT is not set | 556 | # CONFIG_KPROBE_EVENT is not set |
| 558 | CONFIG_TRACE_ENUM_MAP_FILE=y | 557 | CONFIG_TRACE_ENUM_MAP_FILE=y |
| @@ -549,7 +549,6 @@ CONFIG_TIMER_STATS=y · 548 unmodified lines | |||
| 549 | CONFIG_RCU_TORTURE_TEST=m | 549 | CONFIG_RCU_TORTURE_TEST=m |
| 550 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 550 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 551 | CONFIG_LATENCYTOP=y | 551 | CONFIG_LATENCYTOP=y |
| 552 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 553 | CONFIG_SCHED_TRACER=y | 552 | CONFIG_SCHED_TRACER=y |
| 554 | CONFIG_FTRACE_SYSCALLS=y | 553 | CONFIG_FTRACE_SYSCALLS=y |
| 555 | CONFIG_STACK_TRACER=y | 554 | CONFIG_STACK_TRACER=y |
| @@ -172,7 +172,6 @@ CONFIG_DEBUG_NOTIFIERS=y · 171 unmodified lines | |||
| 172 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 172 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 173 | CONFIG_RCU_TRACE=y | 173 | CONFIG_RCU_TRACE=y |
| 174 | CONFIG_LATENCYTOP=y | 174 | CONFIG_LATENCYTOP=y |
| 175 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | ||
| 176 | CONFIG_SCHED_TRACER=y | 175 | CONFIG_SCHED_TRACER=y |
| 177 | CONFIG_FTRACE_SYSCALLS=y | 176 | CONFIG_FTRACE_SYSCALLS=y |
| 178 | CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y | 177 | CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y |
| @@ -266,28 +266,28 @@ int __put_user_bad(void) __attribute__((noreturn)); · 265 unmodified lines | |||
| 266 | __chk_user_ptr(ptr); \ | 266 | __chk_user_ptr(ptr); \ |
| 267 | switch (sizeof(*(ptr))) { \ | 267 | switch (sizeof(*(ptr))) { \ |
| 268 | case 1: { \ | 268 | case 1: { \ |
| 269 | unsigned char __x; \ | 269 | unsigned char __x = 0; \ |
| 270 | __gu_err = __get_user_fn(&__x, ptr, \ | 270 | __gu_err = __get_user_fn(&__x, ptr, \ |
| 271 | sizeof(*(ptr))); \ | 271 | sizeof(*(ptr))); \ |
| 272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
| 273 | break; \ | 273 | break; \ |
| 274 | }; \ | 274 | }; \ |
| 275 | case 2: { \ | 275 | case 2: { \ |
| 276 | unsigned short __x; \ | 276 | unsigned short __x = 0; \ |
| 277 | __gu_err = __get_user_fn(&__x, ptr, \ | 277 | __gu_err = __get_user_fn(&__x, ptr, \ |
| 278 | sizeof(*(ptr))); \ | 278 | sizeof(*(ptr))); \ |
| 279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
| 280 | break; \ | 280 | break; \ |
| 281 | }; \ | 281 | }; \ |
| 282 | case 4: { \ | 282 | case 4: { \ |
| 283 | unsigned int __x; \ | 283 | unsigned int __x = 0; \ |
| 284 | __gu_err = __get_user_fn(&__x, ptr, \ | 284 | __gu_err = __get_user_fn(&__x, ptr, \ |
| 285 | sizeof(*(ptr))); \ | 285 | sizeof(*(ptr))); \ |
| 286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
| 287 | break; \ | 287 | break; \ |
| 288 | }; \ | 288 | }; \ |
| 289 | case 8: { \ | 289 | case 8: { \ |
| 290 | unsigned long long __x; \ | 290 | unsigned long long __x = 0; \ |
| 291 | __gu_err = __get_user_fn(&__x, ptr, \ | 291 | __gu_err = __get_user_fn(&__x, ptr, \ |
| 292 | sizeof(*(ptr))); \ | 292 | sizeof(*(ptr))); \ |
| 293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
| @@ -311,6 +311,14 @@ int __get_user_bad(void) __attribute__((noreturn)); · 17 unmodified lines | |||
| 311 | #define __put_user_unaligned __put_user | 311 | #define __put_user_unaligned __put_user |
| 312 | #define __get_user_unaligned __get_user | 312 | #define __get_user_unaligned __get_user |
| 313 | 313 | ||
| 314 | extern void __compiletime_error("usercopy buffer size is too small") | ||
| 315 | __bad_copy_user(void); | ||
| 316 | |||
| 317 | static inline void copy_user_overflow(int size, unsigned long count) | ||
| 318 | { | ||
| 319 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); | ||
| 320 | } | ||
| 321 | |||
| 314 | /** | 322 | /** |
| 315 | * copy_to_user: - Copy a block of data into user space. | 323 | * copy_to_user: - Copy a block of data into user space. |
| 316 | * @to: Destination address, in user space. | 324 | * @to: Destination address, in user space. |
| @@ -332,12 +340,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n) · 15 unmodified lines | |||
| 332 | return __copy_to_user(to, from, n); | 340 | return __copy_to_user(to, from, n); |
| 333 | } | 341 | } |
| 334 | 342 | ||
| 335 | void copy_from_user_overflow(void) | ||
| 336 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 337 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | ||
| 338 | #endif | ||
| 339 | ; | ||
| 340 | |||
| 341 | /** | 343 | /** |
| 342 | * copy_from_user: - Copy a block of data from user space. | 344 | * copy_from_user: - Copy a block of data from user space. |
| 343 | * @to: Destination address, in kernel space. | 345 | * @to: Destination address, in kernel space. |
| @@ -362,7 +364,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) · 18 unmodified lines | |||
| 362 | 364 | ||
| 363 | might_fault(); | 365 | might_fault(); |
| 364 | if (unlikely(sz != -1 && sz < n)) { | 366 | if (unlikely(sz != -1 && sz < n)) { |
| 365 | copy_from_user_overflow(); | 367 | if (!__builtin_constant_p(n)) |
| 368 | copy_user_overflow(sz, n); | ||
| 369 | else | ||
| 370 | __bad_copy_user(); | ||
| 366 | return n; | 371 | return n; |
| 367 | } | 372 | } |
| 368 | return __copy_from_user(to, from, n); | 373 | return __copy_from_user(to, from, n); |
| @@ -204,11 +204,9 @@ static void __init conmode_default(void) · 203 unmodified lines | |||
| 204 | #endif | 204 | #endif |
| 205 | } | 205 | } |
| 206 | } else if (MACHINE_IS_KVM) { | 206 | } else if (MACHINE_IS_KVM) { |
| 207 | if (sclp.has_vt220 && | 207 | if (sclp.has_vt220 && IS_ENABLED(CONFIG_SCLP_VT220_CONSOLE)) |
| 208 | config_enabled(CONFIG_SCLP_VT220_CONSOLE)) | ||
| 209 | SET_CONSOLE_VT220; | 208 | SET_CONSOLE_VT220; |
| 210 | else if (sclp.has_linemode && | 209 | else if (sclp.has_linemode && IS_ENABLED(CONFIG_SCLP_CONSOLE)) |
| 211 | config_enabled(CONFIG_SCLP_CONSOLE)) | ||
| 212 | SET_CONSOLE_SCLP; | 210 | SET_CONSOLE_SCLP; |
| 213 | else | 211 | else |
| 214 | SET_CONSOLE_HVC; | 212 | SET_CONSOLE_HVC; |
| @@ -2231,9 +2231,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) · 2230 unmodified lines | |||
| 2231 | return -EINVAL; | 2231 | return -EINVAL; |
| 2232 | current->thread.fpu.fpc = fpu->fpc; | 2232 | current->thread.fpu.fpc = fpu->fpc; |
| 2233 | if (MACHINE_HAS_VX) | 2233 | if (MACHINE_HAS_VX) |
| 2234 | convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs); | 2234 | convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, |
| 2235 | (freg_t *) fpu->fprs); | ||
| 2235 | else | 2236 | else |
| 2236 | memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs)); | 2237 | memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); |
| 2237 | return 0; | 2238 | return 0; |
| 2238 | } | 2239 | } |
| 2239 | 2240 | ||
| @@ -2242,9 +2243,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) · 2 unmodified lines | |||
| 2242 | /* make sure we have the latest values */ | 2243 | /* make sure we have the latest values */ |
| 2243 | save_fpu_regs(); | 2244 | save_fpu_regs(); |
| 2244 | if (MACHINE_HAS_VX) | 2245 | if (MACHINE_HAS_VX) |
| 2245 | convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs); | 2246 | convert_vx_to_fp((freg_t *) fpu->fprs, |
| 2247 | (__vector128 *) vcpu->run->s.regs.vrs); | ||
| 2246 | else | 2248 | else |
| 2247 | memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs)); | 2249 | memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); |
| 2248 | fpu->fpc = current->thread.fpu.fpc; | 2250 | fpu->fpc = current->thread.fpu.fpc; |
| 2249 | return 0; | 2251 | return 0; |
| 2250 | } | 2252 | } |
| @@ -584,7 +584,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · 583 unmodified lines | |||
| 584 | /* Validity 0x0044 will be checked by SIE */ | 584 | /* Validity 0x0044 will be checked by SIE */ |
| 585 | if (rc) | 585 | if (rc) |
| 586 | goto unpin; | 586 | goto unpin; |
| 587 | scb_s->gvrd = hpa; | 587 | scb_s->riccbd = hpa; |
| 588 | } | 588 | } |
| 589 | return 0; | 589 | return 0; |
| 590 | unpin: | 590 | unpin: |
| @@ -163,7 +163,7 @@ do { \ · 162 unmodified lines | |||
| 163 | __get_user_asm(val, "lw", ptr); \ | 163 | __get_user_asm(val, "lw", ptr); \ |
| 164 | break; \ | 164 | break; \ |
| 165 | case 8: \ | 165 | case 8: \ |
| 166 | if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ | 166 | if (__copy_from_user((void *)&val, ptr, 8) == 0) \ |
| 167 | __gu_err = 0; \ | 167 | __gu_err = 0; \ |
| 168 | else \ | 168 | else \ |
| 169 | __gu_err = -EFAULT; \ | 169 | __gu_err = -EFAULT; \ |
| @@ -188,6 +188,8 @@ do { \ · 18 unmodified lines | |||
| 188 | \ | 188 | \ |
| 189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ | 189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ |
| 190 | __get_user_common((x), size, __gu_ptr); \ | 190 | __get_user_common((x), size, __gu_ptr); \ |
| 191 | else \ | ||
| 192 | (x) = 0; \ | ||
| 191 | \ | 193 | \ |
| 192 | __gu_err; \ | 194 | __gu_err; \ |
| 193 | }) | 195 | }) |
| @@ -201,6 +203,7 @@ do { \ · 7 unmodified lines | |||
| 201 | "2:\n" \ | 203 | "2:\n" \ |
| 202 | ".section .fixup,\"ax\"\n" \ | 204 | ".section .fixup,\"ax\"\n" \ |
| 203 | "3:li %0, %4\n" \ | 205 | "3:li %0, %4\n" \ |
| 206 | "li %1, 0\n" \ | ||
| 204 | "j 2b\n" \ | 207 | "j 2b\n" \ |
| 205 | ".previous\n" \ | 208 | ".previous\n" \ |
| 206 | ".section __ex_table,\"a\"\n" \ | 209 | ".section __ex_table,\"a\"\n" \ |
| @@ -298,35 +301,34 @@ extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); · 91 unmodified lines | |||
| 298 | static inline unsigned long | 301 | static inline unsigned long |
| 299 | copy_from_user(void *to, const void *from, unsigned long len) | 302 | copy_from_user(void *to, const void *from, unsigned long len) |
| 300 | { | 303 | { |
| 301 | unsigned long over; | 304 | unsigned long res = len; |
| 302 | 305 | ||
| 303 | if (access_ok(VERIFY_READ, from, len)) | 306 | if (likely(access_ok(VERIFY_READ, from, len))) |
| 304 | return __copy_tofrom_user(to, from, len); | 307 | res = __copy_tofrom_user(to, from, len); |
| 305 | 308 | ||
| 306 | if ((unsigned long)from < TASK_SIZE) { | 309 | if (unlikely(res)) |
| 307 | over = (unsigned long)from + len - TASK_SIZE; | 310 | memset(to + (len - res), 0, res); |
| 308 | return __copy_tofrom_user(to, from, len - over) + over; | 311 | |
| 309 | } | 312 | return res; |
| 310 | return len; | ||
| 311 | } | 313 | } |
| 312 | 314 | ||
| 313 | static inline unsigned long | 315 | static inline unsigned long |
| 314 | copy_to_user(void *to, const void *from, unsigned long len) | 316 | copy_to_user(void *to, const void *from, unsigned long len) |
| 315 | { | 317 | { |
| 316 | unsigned long over; | 318 | if (likely(access_ok(VERIFY_WRITE, to, len))) |
| 317 | 319 | len = __copy_tofrom_user(to, from, len); | |
| 318 | if (access_ok(VERIFY_WRITE, to, len)) | ||
| 319 | return __copy_tofrom_user(to, from, len); | ||
| 320 | 320 | ||
| 321 | if ((unsigned long)to < TASK_SIZE) { | ||
| 322 | over = (unsigned long)to + len - TASK_SIZE; | ||
| 323 | return __copy_tofrom_user(to, from, len - over) + over; | ||
| 324 | } | ||
| 325 | return len; | 321 | return len; |
| 326 | } | 322 | } |
| 327 | 323 | ||
| 328 | #define __copy_from_user(to, from, len) \ | 324 | static inline unsigned long |
| 329 | __copy_tofrom_user((to), (from), (len)) | 325 | __copy_from_user(void *to, const void *from, unsigned long len) |
| 326 | { | ||
| 327 | unsigned long left = __copy_tofrom_user(to, from, len); | ||
| 328 | if (unlikely(left)) | ||
| 329 | memset(to + (len - left), 0, left); | ||
| 330 | return left; | ||
| 331 | } | ||
| 330 | 332 | ||
| 331 | #define __copy_to_user(to, from, len) \ | 333 | #define __copy_to_user(to, from, len) \ |
| 332 | __copy_tofrom_user((to), (from), (len)) | 334 | __copy_tofrom_user((to), (from), (len)) |
| @@ -340,17 +342,17 @@ __copy_to_user_inatomic(void *to, const void *from, unsigned long len) · 7 unmodified lines | |||
| 340 | static inline unsigned long | 342 | static inline unsigned long |
| 341 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) | 343 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) |
| 342 | { | 344 | { |
| 343 | return __copy_from_user(to, from, len); | 345 | return __copy_tofrom_user(to, from, len); |
| 344 | } | 346 | } |
| 345 | 347 | ||
| 346 | #define __copy_in_user(to, from, len) __copy_from_user(to, from, len) | 348 | #define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) |
| 347 | 349 | ||
| 348 | static inline unsigned long | 350 | static inline unsigned long |
| 349 | copy_in_user(void *to, const void *from, unsigned long len) | 351 | copy_in_user(void *to, const void *from, unsigned long len) |
| 350 | { | 352 | { |
| 351 | if (access_ok(VERIFY_READ, from, len) && | 353 | if (access_ok(VERIFY_READ, from, len) && |
| 352 | access_ok(VERFITY_WRITE, to, len)) | 354 | access_ok(VERFITY_WRITE, to, len)) |
| 353 | return copy_from_user(to, from, len); | 355 | return __copy_tofrom_user(to, from, len); |
| 354 | } | 356 | } |
| 355 | 357 | ||
| 356 | /* | 358 | /* |
| @@ -60,7 +60,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ · 59 unmodified lines | |||
| 60 | " movco.l %0, @%3 \n" \ | 60 | " movco.l %0, @%3 \n" \ |
| 61 | " bf 1b \n" \ | 61 | " bf 1b \n" \ |
| 62 | " synco \n" \ | 62 | " synco \n" \ |
| 63 | : "=&z" (temp), "=&z" (res) \ | 63 | : "=&z" (temp), "=&r" (res) \ |
| 64 | : "r" (i), "r" (&v->counter) \ | 64 | : "r" (i), "r" (&v->counter) \ |
| 65 | : "t"); \ | 65 | : "t"); \ |
| 66 | \ | 66 | \ |
| @@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) · 150 unmodified lines | |||
| 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; | 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; |
| 152 | 152 | ||
| 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) | 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) |
| 154 | return __copy_user(to, from, __copy_size); | 154 | __copy_size = __copy_user(to, from, __copy_size); |
| 155 | |||
| 156 | if (unlikely(__copy_size)) | ||
| 157 | memset(to + (n - __copy_size), 0, __copy_size); | ||
| 155 | 158 | ||
| 156 | return __copy_size; | 159 | return __copy_size; |
| 157 | } | 160 | } |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | #define __get_user_size(x,ptr,size,retval) \ | 24 | #define __get_user_size(x,ptr,size,retval) \ |
| 25 | do { \ | 25 | do { \ |
| 26 | retval = 0; \ | 26 | retval = 0; \ |
| 27 | x = 0; \ | ||
| 27 | switch (size) { \ | 28 | switch (size) { \ |
| 28 | case 1: \ | 29 | case 1: \ |
| 29 | retval = __get_user_asm_b((void *)&x, \ | 30 | retval = __get_user_asm_b((void *)&x, \ |
| @@ -249,8 +249,7 @@ unsigned long __copy_user(void __user *to, const void __user *from, unsigned lon · 248 unmodified lines | |||
| 249 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | 249 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) |
| 250 | { | 250 | { |
| 251 | if (n && __access_ok((unsigned long) to, n)) { | 251 | if (n && __access_ok((unsigned long) to, n)) { |
| 252 | if (!__builtin_constant_p(n)) | 252 | check_object_size(from, n, true); |
| 253 | check_object_size(from, n, true); | ||
| 254 | return __copy_user(to, (__force void __user *) from, n); | 253 | return __copy_user(to, (__force void __user *) from, n); |
| 255 | } else | 254 | } else |
| 256 | return n; | 255 | return n; |
| @@ -258,19 +257,19 @@ static inline unsigned long copy_to_user(void __user *to, const void *from, unsi · 1 unmodified line | |||
| 258 | 257 | ||
| 259 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | 258 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) |
| 260 | { | 259 | { |
| 261 | if (!__builtin_constant_p(n)) | 260 | check_object_size(from, n, true); |
| 262 | check_object_size(from, n, true); | ||
| 263 | return __copy_user(to, (__force void __user *) from, n); | 261 | return __copy_user(to, (__force void __user *) from, n); |
| 264 | } | 262 | } |
| 265 | 263 | ||
| 266 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | 264 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) |
| 267 | { | 265 | { |
| 268 | if (n && __access_ok((unsigned long) from, n)) { | 266 | if (n && __access_ok((unsigned long) from, n)) { |
| 269 | if (!__builtin_constant_p(n)) | 267 | check_object_size(to, n, false); |
| 270 | check_object_size(to, n, false); | ||
| 271 | return __copy_user((__force void __user *) to, from, n); | 268 | return __copy_user((__force void __user *) to, from, n); |
| 272 | } else | 269 | } else { |
| 270 | memset(to, 0, n); | ||
| 273 | return n; | 271 | return n; |
| 272 | } | ||
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | 275 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) |
| @@ -212,8 +212,7 @@ copy_from_user(void *to, const void __user *from, unsigned long size) · 211 unmodified lines | |||
| 212 | { | 212 | { |
| 213 | unsigned long ret; | 213 | unsigned long ret; |
| 214 | 214 | ||
| 215 | if (!__builtin_constant_p(size)) | 215 | check_object_size(to, size, false); |
| 216 | check_object_size(to, size, false); | ||
| 217 | 216 | ||
| 218 | ret = ___copy_from_user(to, from, size); | 217 | ret = ___copy_from_user(to, from, size); |
| 219 | if (unlikely(ret)) | 218 | if (unlikely(ret)) |
| @@ -233,8 +232,8 @@ copy_to_user(void __user *to, const void *from, unsigned long size) · 13 unmodified lines | |||
| 233 | { | 232 | { |
| 234 | unsigned long ret; | 233 | unsigned long ret; |
| 235 | 234 | ||
| 236 | if (!__builtin_constant_p(size)) | 235 | check_object_size(from, size, true); |
| 237 | check_object_size(from, size, true); | 236 | |
| 238 | ret = ___copy_to_user(to, from, size); | 237 | ret = ___copy_to_user(to, from, size); |
| 239 | if (unlikely(ret)) | 238 | if (unlikely(ret)) |
| 240 | ret = copy_to_user_fixup(to, from, size); | 239 | ret = copy_to_user_fixup(to, from, size); |
| @@ -4,7 +4,6 @@ · 3 unmodified lines | |||
| 4 | config TILE | 4 | config TILE |
| 5 | def_bool y | 5 | def_bool y |
| 6 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 6 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
| 7 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 8 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 7 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
| 9 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 8 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
| 10 | select ARCH_WANT_FRAME_POINTERS | 9 | select ARCH_WANT_FRAME_POINTERS |
| @@ -416,14 +416,13 @@ _copy_from_user(void *to, const void __user *from, unsigned long n) · 415 unmodified lines | |||
| 416 | return n; | 416 | return n; |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | 419 | extern void __compiletime_error("usercopy buffer size is too small") |
| 420 | /* | 420 | __bad_copy_user(void); |
| 421 | * There are still unprovable places in the generic code as of 2.6.34, so this | 421 | |
| 422 | * option is not really compatible with -Werror, which is more useful in | 422 | static inline void copy_user_overflow(int size, unsigned long count) |
| 423 | * general. | 423 | { |
| 424 | */ | 424 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
| 425 | extern void copy_from_user_overflow(void) | 425 | } |
| 426 | __compiletime_warning("copy_from_user() size is not provably correct"); | ||
| 427 | 426 | ||
| 428 | static inline unsigned long __must_check copy_from_user(void *to, | 427 | static inline unsigned long __must_check copy_from_user(void *to, |
| 429 | const void __user *from, | 428 | const void __user *from, |
| @@ -433,14 +432,13 @@ static inline unsigned long __must_check copy_from_user(void *to, · 3 unmodified lines | |||
| 433 | 432 | ||
| 434 | if (likely(sz == -1 || sz >= n)) | 433 | if (likely(sz == -1 || sz >= n)) |
| 435 | n = _copy_from_user(to, from, n); | 434 | n = _copy_from_user(to, from, n); |
| 435 | else if (!__builtin_constant_p(n)) | ||
| 436 | copy_user_overflow(sz, n); | ||
| 436 | else | 437 | else |
| 437 | copy_from_user_overflow(); | 438 | __bad_copy_user(); |
| 438 | 439 | ||
| 439 | return n; | 440 | return n; |
| 440 | } | 441 | } |
| 441 | #else | ||
| 442 | #define copy_from_user _copy_from_user | ||
| 443 | #endif | ||
| 444 | 442 | ||
| 445 | #ifdef __tilegx__ | 443 | #ifdef __tilegx__ |
| 446 | /** | 444 | /** |
| @@ -81,7 +81,7 @@ · 80 unmodified lines | |||
| 81 | .altinstr_replacement : { *(.altinstr_replacement) } | 81 | .altinstr_replacement : { *(.altinstr_replacement) } |
| 82 | /* .exit.text is discard at runtime, not link time, to deal with references | 82 | /* .exit.text is discard at runtime, not link time, to deal with references |
| 83 | from .altinstructions and .eh_frame */ | 83 | from .altinstructions and .eh_frame */ |
| 84 | .exit.text : { *(.exit.text) } | 84 | .exit.text : { EXIT_TEXT } |
| 85 | .exit.data : { *(.exit.data) } | 85 | .exit.data : { *(.exit.data) } |
| 86 | 86 | ||
| 87 | .preinit_array : { | 87 | .preinit_array : { |
| @@ -21,21 +21,17 @@ void handle_syscall(struct uml_pt_regs *r) · 20 unmodified lines | |||
| 21 | PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); | 21 | PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); |
| 22 | 22 | ||
| 23 | if (syscall_trace_enter(regs)) | 23 | if (syscall_trace_enter(regs)) |
| 24 | return; | 24 | goto out; |
| 25 | 25 | ||
| 26 | /* Do the seccomp check after ptrace; failures should be fast. */ | 26 | /* Do the seccomp check after ptrace; failures should be fast. */ |
| 27 | if (secure_computing(NULL) == -1) | 27 | if (secure_computing(NULL) == -1) |
| 28 | return; | 28 | goto out; |
| 29 | 29 | ||
| 30 | /* Update the syscall number after orig_ax has potentially been updated | ||
| 31 | * with ptrace. | ||
| 32 | */ | ||
| 33 | UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); | ||
| 34 | syscall = UPT_SYSCALL_NR(r); | 30 | syscall = UPT_SYSCALL_NR(r); |
| 35 | |||
| 36 | if (syscall >= 0 && syscall <= __NR_syscall_max) | 31 | if (syscall >= 0 && syscall <= __NR_syscall_max) |
| 37 | PT_REGS_SET_SYSCALL_RETURN(regs, | 32 | PT_REGS_SET_SYSCALL_RETURN(regs, |
| 38 | EXECUTE_SYSCALL(syscall, regs)); | 33 | EXECUTE_SYSCALL(syscall, regs)); |
| 39 | 34 | ||
| 35 | out: | ||
| 40 | syscall_trace_leave(regs); | 36 | syscall_trace_leave(regs); |
| 41 | } | 37 | } |
| @@ -24,7 +24,6 @@ config X86 · 23 unmodified lines | |||
| 24 | select ARCH_DISCARD_MEMBLOCK | 24 | select ARCH_DISCARD_MEMBLOCK |
| 25 | select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI | 25 | select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI |
| 26 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 26 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
| 27 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 28 | select ARCH_HAS_DEVMEM_IS_ALLOWED | 27 | select ARCH_HAS_DEVMEM_IS_ALLOWED |
| 29 | select ARCH_HAS_ELF_RANDOMIZE | 28 | select ARCH_HAS_ELF_RANDOMIZE |
| 30 | select ARCH_HAS_FAST_MULTIPLIER | 29 | select ARCH_HAS_FAST_MULTIPLIER |
| @@ -1004,79 +1004,87 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, · 1003 unmodified lines | |||
| 1004 | return status; | 1004 | return status; |
| 1005 | } | 1005 | } |
| 1006 | 1006 | ||
| 1007 | static efi_status_t exit_boot(struct boot_params *boot_params, | 1007 | struct exit_boot_struct { |
| 1008 | void *handle, bool is64) | 1008 | struct boot_params *boot_params; |
| 1009 | { | 1009 | struct efi_info *efi; |
| 1010 | struct efi_info *efi = &boot_params->efi_info; | ||
| 1011 | unsigned long map_sz, key, desc_size; | ||
| 1012 | efi_memory_desc_t *mem_map; | ||
| 1013 | struct setup_data *e820ext; | 1010 | struct setup_data *e820ext; |
| 1014 | const char *signature; | ||
| 1015 | __u32 e820ext_size; | 1011 | __u32 e820ext_size; |
| 1016 | __u32 nr_desc, prev_nr_desc; | 1012 | bool is64; |
| 1017 | efi_status_t status; | 1013 | }; |
| 1018 | __u32 desc_version; | ||
| 1019 | bool called_exit = false; | ||
| 1020 | u8 nr_entries; | ||
| 1021 | int i; | ||
| 1022 | |||
| 1023 | nr_desc = 0; | ||
| 1024 | e820ext = NULL; | ||
| 1025 | e820ext_size = 0; | ||
| 1026 | |||
| 1027 | get_map: | ||
| 1028 | status = efi_get_memory_map(sys_table, &mem_map, &map_sz, &desc_size, | ||
| 1029 | &desc_version, &key); | ||
| 1030 | |||
| 1031 | if (status != EFI_SUCCESS) | ||
| 1032 | return status; | ||
| 1033 | |||
| 1034 | prev_nr_desc = nr_desc; | ||
| 1035 | nr_desc = map_sz / desc_size; | ||
| 1036 | if (nr_desc > prev_nr_desc && | ||
| 1037 | nr_desc > ARRAY_SIZE(boot_params->e820_map)) { | ||
| 1038 | u32 nr_e820ext = nr_desc - ARRAY_SIZE(boot_params->e820_map); | ||
| 1039 | |||
| 1040 | status = alloc_e820ext(nr_e820ext, &e820ext, &e820ext_size); | ||
| 1041 | if (status != EFI_SUCCESS) | ||
| 1042 | goto free_mem_map; | ||
| 1043 | 1014 | ||
| 1044 | efi_call_early(free_pool, mem_map); | 1015 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, |
| 1045 | goto get_map; /* Allocated memory, get map again */ | 1016 | struct efi_boot_memmap *map, |
| 1017 | void *priv) | ||
| 1018 | { | ||
| 1019 | static bool first = true; | ||
| 1020 | const char *signature; | ||
| 1021 | __u32 nr_desc; | ||
| 1022 | efi_status_t status; | ||
| 1023 | struct exit_boot_struct *p = priv; | ||
| 1024 | |||
| 1025 | if (first) { | ||
| 1026 | nr_desc = *map->buff_size / *map->desc_size; | ||
| 1027 | if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) { | ||
| 1028 | u32 nr_e820ext = nr_desc - | ||
| 1029 | ARRAY_SIZE(p->boot_params->e820_map); | ||
| 1030 | |||
| 1031 | status = alloc_e820ext(nr_e820ext, &p->e820ext, | ||
| 1032 | &p->e820ext_size); | ||
| 1033 | if (status != EFI_SUCCESS) | ||
| 1034 | return status; | ||
| 1035 | } | ||
| 1036 | first = false; | ||
| 1046 | } | 1037 | } |
| 1047 | 1038 | ||
| 1048 | signature = is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; | 1039 | signature = p->is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; |
| 1049 | memcpy(&efi->efi_loader_signature, signature, sizeof(__u32)); | 1040 | memcpy(&p->efi->efi_loader_signature, signature, sizeof(__u32)); |
| 1050 | 1041 | ||
| 1051 | efi->efi_systab = (unsigned long)sys_table; | 1042 | p->efi->efi_systab = (unsigned long)sys_table_arg; |
| 1052 | efi->efi_memdesc_size = desc_size; | 1043 | p->efi->efi_memdesc_size = *map->desc_size; |
| 1053 | efi->efi_memdesc_version = desc_version; | 1044 | p->efi->efi_memdesc_version = *map->desc_ver; |
| 1054 | efi->efi_memmap = (unsigned long)mem_map; | 1045 | p->efi->efi_memmap = (unsigned long)*map->map; |
| 1055 | efi->efi_memmap_size = map_sz; | 1046 | p->efi->efi_memmap_size = *map->map_size; |
| 1056 | 1047 | ||
| 1057 | #ifdef CONFIG_X86_64 | 1048 | #ifdef CONFIG_X86_64 |
| 1058 | efi->efi_systab_hi = (unsigned long)sys_table >> 32; | 1049 | p->efi->efi_systab_hi = (unsigned long)sys_table_arg >> 32; |
| 1059 | efi->efi_memmap_hi = (unsigned long)mem_map >> 32; | 1050 | p->efi->efi_memmap_hi = (unsigned long)*map->map >> 32; |
| 1060 | #endif | 1051 | #endif |
| 1061 | 1052 | ||
| 1053 | return EFI_SUCCESS; | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | static efi_status_t exit_boot(struct boot_params *boot_params, | ||
| 1057 | void *handle, bool is64) | ||
| 1058 | { | ||
| 1059 | unsigned long map_sz, key, desc_size, buff_size; | ||
| 1060 | efi_memory_desc_t *mem_map; | ||
| 1061 | struct setup_data *e820ext; | ||
| 1062 | __u32 e820ext_size; | ||
| 1063 | efi_status_t status; | ||
| 1064 | __u32 desc_version; | ||
| 1065 | struct efi_boot_memmap map; | ||
| 1066 | struct exit_boot_struct priv; | ||
| 1067 | |||
| 1068 | map.map = &mem_map; | ||
| 1069 | map.map_size = &map_sz; | ||
| 1070 | map.desc_size = &desc_size; | ||
| 1071 | map.desc_ver = &desc_version; | ||
| 1072 | map.key_ptr = &key; | ||
| 1073 | map.buff_size = &buff_size; | ||
| 1074 | priv.boot_params = boot_params; | ||
| 1075 | priv.efi = &boot_params->efi_info; | ||
| 1076 | priv.e820ext = NULL; | ||
| 1077 | priv.e820ext_size = 0; | ||
| 1078 | priv.is64 = is64; | ||
| 1079 | |||
| 1062 | /* Might as well exit boot services now */ | 1080 | /* Might as well exit boot services now */ |
| 1063 | status = efi_call_early(exit_boot_services, handle, key); | 1081 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
| 1064 | if (status != EFI_SUCCESS) { | 1082 | exit_boot_func); |
| 1065 | /* | 1083 | if (status != EFI_SUCCESS) |
| 1066 | * ExitBootServices() will fail if any of the event | 1084 | return status; |
| 1067 | * handlers change the memory map. In which case, we | ||
| 1068 | * must be prepared to retry, but only once so that | ||
| 1069 | * we're guaranteed to exit on repeated failures instead | ||
| 1070 | * of spinning forever. | ||
| 1071 | */ | ||
| 1072 | if (called_exit) | ||
| 1073 | goto free_mem_map; | ||
| 1074 | |||
| 1075 | called_exit = true; | ||
| 1076 | efi_call_early(free_pool, mem_map); | ||
| 1077 | goto get_map; | ||
| 1078 | } | ||
| 1079 | 1085 | ||
| 1086 | e820ext = priv.e820ext; | ||
| 1087 | e820ext_size = priv.e820ext_size; | ||
| 1080 | /* Historic? */ | 1088 | /* Historic? */ |
| 1081 | boot_params->alt_mem_k = 32 * 1024; | 1089 | boot_params->alt_mem_k = 32 * 1024; |
| 1082 | 1090 | ||
| @@ -1085,10 +1093,6 @@ get_map: · 2 unmodified lines | |||
| 1085 | return status; | 1093 | return status; |
| 1086 | 1094 | ||
| 1087 | return EFI_SUCCESS; | 1095 | return EFI_SUCCESS; |
| 1088 | |||
| 1089 | free_mem_map: | ||
| 1090 | efi_call_early(free_pool, mem_map); | ||
| 1091 | return status; | ||
| 1092 | } | 1096 | } |
| 1093 | 1097 | ||
| 1094 | /* | 1098 | /* |
| @@ -1 +1,3 @@ | |||
| 1 | CONFIG_NOHIGHMEM=y | 1 | CONFIG_NOHIGHMEM=y |
| 2 | # CONFIG_HIGHMEM4G is not set | ||
| 3 | # CONFIG_HIGHMEM64G is not set | ||
| @@ -485,10 +485,10 @@ static int sha_complete_job(struct mcryptd_hash_request_ctx *rctx, · 484 unmodified lines | |||
| 485 | 485 | ||
| 486 | req = cast_mcryptd_ctx_to_req(req_ctx); | 486 | req = cast_mcryptd_ctx_to_req(req_ctx); |
| 487 | if (irqs_disabled()) | 487 | if (irqs_disabled()) |
| 488 | rctx->complete(&req->base, ret); | 488 | req_ctx->complete(&req->base, ret); |
| 489 | else { | 489 | else { |
| 490 | local_bh_disable(); | 490 | local_bh_disable(); |
| 491 | rctx->complete(&req->base, ret); | 491 | req_ctx->complete(&req->base, ret); |
| 492 | local_bh_enable(); | 492 | local_bh_enable(); |
| 493 | } | 493 | } |
| 494 | } | 494 | } |
| @@ -265,13 +265,14 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2) · 264 unmodified lines | |||
| 265 | vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0 | 265 | vpinsrd $1, _args_digest+1*32(state, idx, 4), %xmm0, %xmm0 |
| 266 | vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0 | 266 | vpinsrd $2, _args_digest+2*32(state, idx, 4), %xmm0, %xmm0 |
| 267 | vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0 | 267 | vpinsrd $3, _args_digest+3*32(state, idx, 4), %xmm0, %xmm0 |
| 268 | movl _args_digest+4*32(state, idx, 4), tmp2_w | 268 | vmovd _args_digest(state , idx, 4) , %xmm0 |
| 269 | vpinsrd $1, _args_digest+5*32(state, idx, 4), %xmm1, %xmm1 | 269 | vpinsrd $1, _args_digest+5*32(state, idx, 4), %xmm1, %xmm1 |
| 270 | vpinsrd $2, _args_digest+6*32(state, idx, 4), %xmm1, %xmm1 | 270 | vpinsrd $2, _args_digest+6*32(state, idx, 4), %xmm1, %xmm1 |
| 271 | vpinsrd $3, _args_digest+7*32(state, idx, 4), %xmm1, %xmm1 | 271 | vpinsrd $3, _args_digest+7*32(state, idx, 4), %xmm1, %xmm1 |
| 272 | 272 | ||
| 273 | vmovdqu %xmm0, _result_digest(job_rax) | 273 | vmovdqu %xmm0, _result_digest(job_rax) |
| 274 | movl tmp2_w, _result_digest+1*16(job_rax) | 274 | offset = (_result_digest + 1*16) |
| 275 | vmovdqu %xmm1, offset(job_rax) | ||
| 275 | 276 | ||
| 276 | pop %rbx | 277 | pop %rbx |
| 277 | 278 | ||
| @@ -497,10 +497,10 @@ static int sha_complete_job(struct mcryptd_hash_request_ctx *rctx, · 496 unmodified lines | |||
| 497 | 497 | ||
| 498 | req = cast_mcryptd_ctx_to_req(req_ctx); | 498 | req = cast_mcryptd_ctx_to_req(req_ctx); |
| 499 | if (irqs_disabled()) | 499 | if (irqs_disabled()) |
| 500 | rctx->complete(&req->base, ret); | 500 | req_ctx->complete(&req->base, ret); |
| 501 | else { | 501 | else { |
| 502 | local_bh_disable(); | 502 | local_bh_disable(); |
| 503 | rctx->complete(&req->base, ret); | 503 | req_ctx->complete(&req->base, ret); |
| 504 | local_bh_enable(); | 504 | local_bh_enable(); |
| 505 | } | 505 | } |
| 506 | } | 506 | } |
| @@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = · 118 unmodified lines | |||
| 119 | { | 119 | { |
| 120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
| 121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
| 122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, | 122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
| 123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, | 123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
| 124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
| 125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
| 126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ | 126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
| @@ -29,6 +29,8 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #define COUNTER_SHIFT 16 | 30 | #define COUNTER_SHIFT 16 |
| 31 | 31 | ||
| 32 | static HLIST_HEAD(uncore_unused_list); | ||
| 33 | |||
| 32 | struct amd_uncore { | 34 | struct amd_uncore { |
| 33 | int id; | 35 | int id; |
| 34 | int refcnt; | 36 | int refcnt; |
| @@ -39,7 +41,7 @@ struct amd_uncore { · 4 unmodified lines | |||
| 39 | cpumask_t *active_mask; | 41 | cpumask_t *active_mask; |
| 40 | struct pmu *pmu; | 42 | struct pmu *pmu; |
| 41 | struct perf_event *events[MAX_COUNTERS]; | 43 | struct perf_event *events[MAX_COUNTERS]; |
| 42 | struct amd_uncore *free_when_cpu_online; | 44 | struct hlist_node node; |
| 43 | }; | 45 | }; |
| 44 | 46 | ||
| 45 | static struct amd_uncore * __percpu *amd_uncore_nb; | 47 | static struct amd_uncore * __percpu *amd_uncore_nb; |
| @@ -306,6 +308,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) · 260 unmodified lines | |||
| 306 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; | 308 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; |
| 307 | uncore_nb->active_mask = &amd_nb_active_mask; | 309 | uncore_nb->active_mask = &amd_nb_active_mask; |
| 308 | uncore_nb->pmu = &amd_nb_pmu; | 310 | uncore_nb->pmu = &amd_nb_pmu; |
| 311 | uncore_nb->id = -1; | ||
| 309 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; | 312 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; |
| 310 | } | 313 | } |
| 311 | 314 | ||
| @@ -319,6 +322,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) · 7 unmodified lines | |||
| 319 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; | 322 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; |
| 320 | uncore_l2->active_mask = &amd_l2_active_mask; | 323 | uncore_l2->active_mask = &amd_l2_active_mask; |
| 321 | uncore_l2->pmu = &amd_l2_pmu; | 324 | uncore_l2->pmu = &amd_l2_pmu; |
| 325 | uncore_l2->id = -1; | ||
| 322 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; | 326 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; |
| 323 | } | 327 | } |
| 324 | 328 | ||
| @@ -348,7 +352,7 @@ amd_uncore_find_online_sibling(struct amd_uncore *this, · 23 unmodified lines | |||
| 348 | continue; | 352 | continue; |
| 349 | 353 | ||
| 350 | if (this->id == that->id) { | 354 | if (this->id == that->id) { |
| 351 | that->free_when_cpu_online = this; | 355 | hlist_add_head(&this->node, &uncore_unused_list); |
| 352 | this = that; | 356 | this = that; |
| 353 | break; | 357 | break; |
| 354 | } | 358 | } |
| @@ -388,13 +392,23 @@ static int amd_uncore_cpu_starting(unsigned int cpu) · 33 unmodified lines | |||
| 388 | return 0; | 392 | return 0; |
| 389 | } | 393 | } |
| 390 | 394 | ||
| 395 | static void uncore_clean_online(void) | ||
| 396 | { | ||
| 397 | struct amd_uncore *uncore; | ||
| 398 | struct hlist_node *n; | ||
| 399 | |||
| 400 | hlist_for_each_entry_safe(uncore, n, &uncore_unused_list, node) { | ||
| 401 | hlist_del(&uncore->node); | ||
| 402 | kfree(uncore); | ||
| 403 | } | ||
| 404 | } | ||
| 405 | |||
| 391 | static void uncore_online(unsigned int cpu, | 406 | static void uncore_online(unsigned int cpu, |
| 392 | struct amd_uncore * __percpu *uncores) | 407 | struct amd_uncore * __percpu *uncores) |
| 393 | { | 408 | { |
| 394 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); | 409 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); |
| 395 | 410 | ||
| 396 | kfree(uncore->free_when_cpu_online); | 411 | uncore_clean_online(); |
| 397 | uncore->free_when_cpu_online = NULL; | ||
| 398 | 412 | ||
| 399 | if (cpu == uncore->cpu) | 413 | if (cpu == uncore->cpu) |
| 400 | cpumask_set_cpu(cpu, uncore->active_mask); | 414 | cpumask_set_cpu(cpu, uncore->active_mask); |
| @@ -31,7 +31,17 @@ · 30 unmodified lines | |||
| 31 | struct bts_ctx { | 31 | struct bts_ctx { |
| 32 | struct perf_output_handle handle; | 32 | struct perf_output_handle handle; |
| 33 | struct debug_store ds_back; | 33 | struct debug_store ds_back; |
| 34 | int started; | 34 | int state; |
| 35 | }; | ||
| 36 | |||
| 37 | /* BTS context states: */ | ||
| 38 | enum { | ||
| 39 | /* no ongoing AUX transactions */ | ||
| 40 | BTS_STATE_STOPPED = 0, | ||
| 41 | /* AUX transaction is on, BTS tracing is disabled */ | ||
| 42 | BTS_STATE_INACTIVE, | ||
| 43 | /* AUX transaction is on, BTS tracing is running */ | ||
| 44 | BTS_STATE_ACTIVE, | ||
| 35 | }; | 45 | }; |
| 36 | 46 | ||
| 37 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); | 47 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); |
| @@ -204,6 +214,15 @@ static void bts_update(struct bts_ctx *bts) · 166 unmodified lines | |||
| 204 | static int | 214 | static int |
| 205 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); | 215 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); |
| 206 | 216 | ||
| 217 | /* | ||
| 218 | * Ordering PMU callbacks wrt themselves and the PMI is done by means | ||
| 219 | * of bts::state, which: | ||
| 220 | * - is set when bts::handle::event is valid, that is, between | ||
| 221 | * perf_aux_output_begin() and perf_aux_output_end(); | ||
| 222 | * - is zero otherwise; | ||
| 223 | * - is ordered against bts::handle::event with a compiler barrier. | ||
| 224 | */ | ||
| 225 | |||
| 207 | static void __bts_event_start(struct perf_event *event) | 226 | static void __bts_event_start(struct perf_event *event) |
| 208 | { | 227 | { |
| 209 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 228 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
| @@ -221,10 +240,13 @@ static void __bts_event_start(struct perf_event *event) · 11 unmodified lines | |||
| 221 | 240 | ||
| 222 | /* | 241 | /* |
| 223 | * local barrier to make sure that ds configuration made it | 242 | * local barrier to make sure that ds configuration made it |
| 224 | * before we enable BTS | 243 | * before we enable BTS and bts::state goes ACTIVE |
| 225 | */ | 244 | */ |
| 226 | wmb(); | 245 | wmb(); |
| 227 | 246 | ||
| 247 | /* INACTIVE/STOPPED -> ACTIVE */ | ||
| 248 | WRITE_ONCE(bts->state, BTS_STATE_ACTIVE); | ||
| 249 | |||
| 228 | intel_pmu_enable_bts(config); | 250 | intel_pmu_enable_bts(config); |
| 229 | 251 | ||
| 230 | } | 252 | } |
| @@ -251,9 +273,6 @@ static void bts_event_start(struct perf_event *event, int flags) · 20 unmodified lines | |||
| 251 | 273 | ||
| 252 | __bts_event_start(event); | 274 | __bts_event_start(event); |
| 253 | 275 | ||
| 254 | /* PMI handler: this counter is running and likely generating PMIs */ | ||
| 255 | ACCESS_ONCE(bts->started) = 1; | ||
| 256 | |||
| 257 | return; | 276 | return; |
| 258 | 277 | ||
| 259 | fail_end_stop: | 278 | fail_end_stop: |
| @@ -263,30 +282,34 @@ fail_stop: · 3 unmodified lines | |||
| 263 | event->hw.state = PERF_HES_STOPPED; | 282 | event->hw.state = PERF_HES_STOPPED; |
| 264 | } | 283 | } |
| 265 | 284 | ||
| 266 | static void __bts_event_stop(struct perf_event *event) | 285 | static void __bts_event_stop(struct perf_event *event, int state) |
| 267 | { | 286 | { |
| 287 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | ||
| 288 | |||
| 289 | /* ACTIVE -> INACTIVE(PMI)/STOPPED(->stop()) */ | ||
| 290 | WRITE_ONCE(bts->state, state); | ||
| 291 | |||
| 268 | /* | 292 | /* |
| 269 | * No extra synchronization is mandated by the documentation to have | 293 | * No extra synchronization is mandated by the documentation to have |
| 270 | * BTS data stores globally visible. | 294 | * BTS data stores globally visible. |
| 271 | */ | 295 | */ |
| 272 | intel_pmu_disable_bts(); | 296 | intel_pmu_disable_bts(); |
| 273 | |||
| 274 | if (event->hw.state & PERF_HES_STOPPED) | ||
| 275 | return; | ||
| 276 | |||
| 277 | ACCESS_ONCE(event->hw.state) |= PERF_HES_STOPPED; | ||
| 278 | } | 297 | } |
| 279 | 298 | ||
| 280 | static void bts_event_stop(struct perf_event *event, int flags) | 299 | static void bts_event_stop(struct perf_event *event, int flags) |
| 281 | { | 300 | { |
| 282 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | 301 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
| 283 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 302 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
| 284 | struct bts_buffer *buf = perf_get_aux(&bts->handle); | 303 | struct bts_buffer *buf = NULL; |
| 304 | int state = READ_ONCE(bts->state); | ||
| 285 | 305 | ||
| 286 | /* PMI handler: don't restart this counter */ | 306 | if (state == BTS_STATE_ACTIVE) |
| 287 | ACCESS_ONCE(bts->started) = 0; | 307 | __bts_event_stop(event, BTS_STATE_STOPPED); |
| 288 | 308 | ||
| 289 | __bts_event_stop(event); | 309 | if (state != BTS_STATE_STOPPED) |
| 310 | buf = perf_get_aux(&bts->handle); | ||
| 311 | |||
| 312 | event->hw.state |= PERF_HES_STOPPED; | ||
| 290 | 313 | ||
| 291 | if (flags & PERF_EF_UPDATE) { | 314 | if (flags & PERF_EF_UPDATE) { |
| 292 | bts_update(bts); | 315 | bts_update(bts); |
| @@ -296,6 +319,7 @@ static void bts_event_stop(struct perf_event *event, int flags) · 3 unmodified lines | |||
| 296 | bts->handle.head = | 319 | bts->handle.head = |
| 297 | local_xchg(&buf->data_size, | 320 | local_xchg(&buf->data_size, |
| 298 | buf->nr_pages << PAGE_SHIFT); | 321 | buf->nr_pages << PAGE_SHIFT); |
| 322 | |||
| 299 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 323 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
| 300 | !!local_xchg(&buf->lost, 0)); | 324 | !!local_xchg(&buf->lost, 0)); |
| 301 | } | 325 | } |
| @@ -310,8 +334,20 @@ static void bts_event_stop(struct perf_event *event, int flags) · 8 unmodified lines | |||
| 310 | void intel_bts_enable_local(void) | 334 | void intel_bts_enable_local(void) |
| 311 | { | 335 | { |
| 312 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 336 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
| 337 | int state = READ_ONCE(bts->state); | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Here we transition from INACTIVE to ACTIVE; | ||
| 341 | * if we instead are STOPPED from the interrupt handler, | ||
| 342 | * stay that way. Can't be ACTIVE here though. | ||
| 343 | */ | ||
| 344 | if (WARN_ON_ONCE(state == BTS_STATE_ACTIVE)) | ||
| 345 | return; | ||
| 346 | |||
| 347 | if (state == BTS_STATE_STOPPED) | ||
| 348 | return; | ||
| 313 | 349 | ||
| 314 | if (bts->handle.event && bts->started) | 350 | if (bts->handle.event) |
| 315 | __bts_event_start(bts->handle.event); | 351 | __bts_event_start(bts->handle.event); |
| 316 | } | 352 | } |
| 317 | 353 | ||
| @@ -319,8 +355,15 @@ void intel_bts_disable_local(void) · 1 unmodified line | |||
| 319 | { | 355 | { |
| 320 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 356 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
| 321 | 357 | ||
| 358 | /* | ||
| 359 | * Here we transition from ACTIVE to INACTIVE; | ||
| 360 | * do nothing for STOPPED or INACTIVE. | ||
| 361 | */ | ||
| 362 | if (READ_ONCE(bts->state) != BTS_STATE_ACTIVE) | ||
| 363 | return; | ||
| 364 | |||
| 322 | if (bts->handle.event) | 365 | if (bts->handle.event) |
| 323 | __bts_event_stop(bts->handle.event); | 366 | __bts_event_stop(bts->handle.event, BTS_STATE_INACTIVE); |
| 324 | } | 367 | } |
| 325 | 368 | ||
| 326 | static int | 369 | static int |
| @@ -335,8 +378,6 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) · 8 unmodified lines | |||
| 335 | return 0; | 378 | return 0; |
| 336 | 379 | ||
| 337 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); | 380 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); |
| 338 | if (WARN_ON_ONCE(head != local_read(&buf->head))) | ||
| 339 | return -EINVAL; | ||
| 340 | 381 | ||
| 341 | phys = &buf->buf[buf->cur_buf]; | 382 | phys = &buf->buf[buf->cur_buf]; |
| 342 | space = phys->offset + phys->displacement + phys->size - head; | 383 | space = phys->offset + phys->displacement + phys->size - head; |
| @@ -403,22 +444,37 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) · 60 unmodified lines | |||
| 403 | 444 | ||
| 404 | int intel_bts_interrupt(void) | 445 | int intel_bts_interrupt(void) |
| 405 | { | 446 | { |
| 447 | struct debug_store *ds = this_cpu_ptr(&cpu_hw_events)->ds; | ||
| 406 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 448 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
| 407 | struct perf_event *event = bts->handle.event; | 449 | struct perf_event *event = bts->handle.event; |
| 408 | struct bts_buffer *buf; | 450 | struct bts_buffer *buf; |
| 409 | s64 old_head; | 451 | s64 old_head; |
| 410 | int err; | 452 | int err = -ENOSPC, handled = 0; |
| 411 | 453 | ||
| 412 | if (!event || !bts->started) | 454 | /* |
| 413 | return 0; | 455 | * The only surefire way of knowing if this NMI is ours is by checking |
| 456 | * the write ptr against the PMI threshold. | ||
| 457 | */ | ||
| 458 | if (ds && (ds->bts_index >= ds->bts_interrupt_threshold)) | ||
| 459 | handled = 1; | ||
| 460 | |||
| 461 | /* | ||
| 462 | * this is wrapped in intel_bts_enable_local/intel_bts_disable_local, | ||
| 463 | * so we can only be INACTIVE or STOPPED | ||
| 464 | */ | ||
| 465 | if (READ_ONCE(bts->state) == BTS_STATE_STOPPED) | ||
| 466 | return handled; | ||
| 414 | 467 | ||
| 415 | buf = perf_get_aux(&bts->handle); | 468 | buf = perf_get_aux(&bts->handle); |
| 469 | if (!buf) | ||
| 470 | return handled; | ||
| 471 | |||
| 416 | /* | 472 | /* |
| 417 | * Skip snapshot counters: they don't use the interrupt, but | 473 | * Skip snapshot counters: they don't use the interrupt, but |
| 418 | * there's no other way of telling, because the pointer will | 474 | * there's no other way of telling, because the pointer will |
| 419 | * keep moving | 475 | * keep moving |
| 420 | */ | 476 | */ |
| 421 | if (!buf || buf->snapshot) | 477 | if (buf->snapshot) |
| 422 | return 0; | 478 | return 0; |
| 423 | 479 | ||
| 424 | old_head = local_read(&buf->head); | 480 | old_head = local_read(&buf->head); |
| @@ -426,18 +482,27 @@ int intel_bts_interrupt(void) · 1 unmodified line | |||
| 426 | 482 | ||
| 427 | /* no new data */ | 483 | /* no new data */ |
| 428 | if (old_head == local_read(&buf->head)) | 484 | if (old_head == local_read(&buf->head)) |
| 429 | return 0; | 485 | return handled; |
| 430 | 486 | ||
| 431 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 487 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
| 432 | !!local_xchg(&buf->lost, 0)); | 488 | !!local_xchg(&buf->lost, 0)); |
| 433 | 489 | ||
| 434 | buf = perf_aux_output_begin(&bts->handle, event); | 490 | buf = perf_aux_output_begin(&bts->handle, event); |
| 435 | if (!buf) | 491 | if (buf) |
| 436 | return 1; | 492 | err = bts_buffer_reset(buf, &bts->handle); |
| 493 | |||
| 494 | if (err) { | ||
| 495 | WRITE_ONCE(bts->state, BTS_STATE_STOPPED); | ||
| 437 | 496 | ||
| 438 | err = bts_buffer_reset(buf, &bts->handle); | 497 | if (buf) { |
| 439 | if (err) | 498 | /* |
| 440 | perf_aux_output_end(&bts->handle, 0, false); | 499 | * BTS_STATE_STOPPED should be visible before |
| 500 | * cleared handle::event | ||
| 501 | */ | ||
| 502 | barrier(); | ||
| 503 | perf_aux_output_end(&bts->handle, 0, false); | ||
| 504 | } | ||
| 505 | } | ||
| 441 | 506 | ||
| 442 | return 1; | 507 | return 1; |
| 443 | } | 508 | } |
| @@ -519,7 +584,8 @@ static __init int bts_init(void) · 75 unmodified lines | |||
| 519 | if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts) | 584 | if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts) |
| 520 | return -ENODEV; | 585 | return -ENODEV; |
| 521 | 586 | ||
| 522 | bts_pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE; | 587 | bts_pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE | |
| 588 | PERF_PMU_CAP_EXCLUSIVE; | ||
| 523 | bts_pmu.task_ctx_nr = perf_sw_context; | 589 | bts_pmu.task_ctx_nr = perf_sw_context; |
| 524 | bts_pmu.event_init = bts_event_init; | 590 | bts_pmu.event_init = bts_event_init; |
| 525 | bts_pmu.add = bts_event_add; | 591 | bts_pmu.add = bts_event_add; |
| @@ -1730,9 +1730,11 @@ static __initconst const u64 knl_hw_cache_extra_regs · 1729 unmodified lines | |||
| 1730 | * disabled state if called consecutively. | 1730 | * disabled state if called consecutively. |
| 1731 | * | 1731 | * |
| 1732 | * During consecutive calls, the same disable value will be written to related | 1732 | * During consecutive calls, the same disable value will be written to related |
| 1733 | * registers, so the PMU state remains unchanged. hw.state in | 1733 | * registers, so the PMU state remains unchanged. |
| 1734 | * intel_bts_disable_local will remain PERF_HES_STOPPED too in consecutive | 1734 | * |
| 1735 | * calls. | 1735 | * intel_bts events don't coexist with intel PMU's BTS events because of |
| 1736 | * x86_add_exclusive(x86_lbr_exclusive_lbr); there's no need to keep them | ||
| 1737 | * disabled around intel PMU's event batching etc, only inside the PMI handler. | ||
| 1736 | */ | 1738 | */ |
| 1737 | static void __intel_pmu_disable_all(void) | 1739 | static void __intel_pmu_disable_all(void) |
| 1738 | { | 1740 | { |
| @@ -1742,8 +1744,6 @@ static void __intel_pmu_disable_all(void) · 3 unmodified lines | |||
| 1742 | 1744 | ||
| 1743 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) | 1745 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) |
| 1744 | intel_pmu_disable_bts(); | 1746 | intel_pmu_disable_bts(); |
| 1745 | else | ||
| 1746 | intel_bts_disable_local(); | ||
| 1747 | 1747 | ||
| 1748 | intel_pmu_pebs_disable_all(); | 1748 | intel_pmu_pebs_disable_all(); |
| 1749 | } | 1749 | } |
| @@ -1771,8 +1771,7 @@ static void __intel_pmu_enable_all(int added, bool pmi) · 21 unmodified lines | |||
| 1771 | return; | 1771 | return; |
| 1772 | 1772 | ||
| 1773 | intel_pmu_enable_bts(event->hw.config); | 1773 | intel_pmu_enable_bts(event->hw.config); |
| 1774 | } else | 1774 | } |
| 1775 | intel_bts_enable_local(); | ||
| 1776 | } | 1775 | } |
| 1777 | 1776 | ||
| 1778 | static void intel_pmu_enable_all(int added) | 1777 | static void intel_pmu_enable_all(int added) |
| @@ -2073,6 +2072,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) · 294 unmodified lines | |||
| 2073 | */ | 2072 | */ |
| 2074 | if (!x86_pmu.late_ack) | 2073 | if (!x86_pmu.late_ack) |
| 2075 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 2074 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
| 2075 | intel_bts_disable_local(); | ||
| 2076 | __intel_pmu_disable_all(); | 2076 | __intel_pmu_disable_all(); |
| 2077 | handled = intel_pmu_drain_bts_buffer(); | 2077 | handled = intel_pmu_drain_bts_buffer(); |
| 2078 | handled += intel_bts_interrupt(); | 2078 | handled += intel_bts_interrupt(); |
| @@ -2172,6 +2172,7 @@ done: · 93 unmodified lines | |||
| 2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ | 2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ |
| 2173 | if (cpuc->enabled) | 2173 | if (cpuc->enabled) |
| 2174 | __intel_pmu_enable_all(0, true); | 2174 | __intel_pmu_enable_all(0, true); |
| 2175 | intel_bts_enable_local(); | ||
| 2175 | 2176 | ||
| 2176 | /* | 2177 | /* |
| 2177 | * Only unmask the NMI after the overflow counters | 2178 | * Only unmask the NMI after the overflow counters |
| @@ -458,6 +458,11 @@ static void __intel_cqm_event_count(void *info); · 457 unmodified lines | |||
| 458 | static void init_mbm_sample(u32 rmid, u32 evt_type); | 458 | static void init_mbm_sample(u32 rmid, u32 evt_type); |
| 459 | static void __intel_mbm_event_count(void *info); | 459 | static void __intel_mbm_event_count(void *info); |
| 460 | 460 | ||
| 461 | static bool is_cqm_event(int e) | ||
| 462 | { | ||
| 463 | return (e == QOS_L3_OCCUP_EVENT_ID); | ||
| 464 | } | ||
| 465 | |||
| 461 | static bool is_mbm_event(int e) | 466 | static bool is_mbm_event(int e) |
| 462 | { | 467 | { |
| 463 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); | 468 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); |
| @@ -1366,6 +1371,10 @@ static int intel_cqm_event_init(struct perf_event *event) · 902 unmodified lines | |||
| 1366 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) | 1371 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) |
| 1367 | return -EINVAL; | 1372 | return -EINVAL; |
| 1368 | 1373 | ||
| 1374 | if ((is_cqm_event(event->attr.config) && !cqm_enabled) || | ||
| 1375 | (is_mbm_event(event->attr.config) && !mbm_enabled)) | ||
| 1376 | return -EINVAL; | ||
| 1377 | |||
| 1369 | /* unsupported modes and filters */ | 1378 | /* unsupported modes and filters */ |
| 1370 | if (event->attr.exclude_user || | 1379 | if (event->attr.exclude_user || |
| 1371 | event->attr.exclude_kernel || | 1380 | event->attr.exclude_kernel || |
| @@ -1274,18 +1274,18 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) · 1273 unmodified lines | |||
| 1274 | struct pebs_record_nhm *p = at; | 1274 | struct pebs_record_nhm *p = at; |
| 1275 | u64 pebs_status; | 1275 | u64 pebs_status; |
| 1276 | 1276 | ||
| 1277 | /* PEBS v3 has accurate status bits */ | 1277 | pebs_status = p->status & cpuc->pebs_enabled; |
| 1278 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
| 1279 | |||
| 1280 | /* PEBS v3 has more accurate status bits */ | ||
| 1278 | if (x86_pmu.intel_cap.pebs_format >= 3) { | 1281 | if (x86_pmu.intel_cap.pebs_format >= 3) { |
| 1279 | for_each_set_bit(bit, (unsigned long *)&p->status, | 1282 | for_each_set_bit(bit, (unsigned long *)&pebs_status, |
| 1280 | MAX_PEBS_EVENTS) | 1283 | x86_pmu.max_pebs_events) |
| 1281 | counts[bit]++; | 1284 | counts[bit]++; |
| 1282 | 1285 | ||
| 1283 | continue; | 1286 | continue; |
| 1284 | } | 1287 | } |
| 1285 | 1288 | ||
| 1286 | pebs_status = p->status & cpuc->pebs_enabled; | ||
| 1287 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
| 1288 | |||
| 1289 | /* | 1289 | /* |
| 1290 | * On some CPUs the PEBS status can be zero when PEBS is | 1290 | * On some CPUs the PEBS status can be zero when PEBS is |
| 1291 | * racing with clearing of GLOBAL_STATUS. | 1291 | * racing with clearing of GLOBAL_STATUS. |
| @@ -1333,8 +1333,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) · 41 unmodified lines | |||
| 1333 | continue; | 1333 | continue; |
| 1334 | 1334 | ||
| 1335 | event = cpuc->events[bit]; | 1335 | event = cpuc->events[bit]; |
| 1336 | WARN_ON_ONCE(!event); | 1336 | if (WARN_ON_ONCE(!event)) |
| 1337 | WARN_ON_ONCE(!event->attr.precise_ip); | 1337 | continue; |
| 1338 | |||
| 1339 | if (WARN_ON_ONCE(!event->attr.precise_ip)) | ||
| 1340 | continue; | ||
| 1338 | 1341 | ||
| 1339 | /* log dropped samples number */ | 1342 | /* log dropped samples number */ |
| 1340 | if (error[bit]) | 1343 | if (error[bit]) |
| @@ -1074,6 +1074,11 @@ static void pt_addr_filters_fini(struct perf_event *event) · 1073 unmodified lines | |||
| 1074 | event->hw.addr_filters = NULL; | 1074 | event->hw.addr_filters = NULL; |
| 1075 | } | 1075 | } |
| 1076 | 1076 | ||
| 1077 | static inline bool valid_kernel_ip(unsigned long ip) | ||
| 1078 | { | ||
| 1079 | return virt_addr_valid(ip) && kernel_ip(ip); | ||
| 1080 | } | ||
| 1081 | |||
| 1077 | static int pt_event_addr_filters_validate(struct list_head *filters) | 1082 | static int pt_event_addr_filters_validate(struct list_head *filters) |
| 1078 | { | 1083 | { |
| 1079 | struct perf_addr_filter *filter; | 1084 | struct perf_addr_filter *filter; |
| @@ -1081,11 +1086,16 @@ static int pt_event_addr_filters_validate(struct list_head *filters) · 1 unmodified line | |||
| 1081 | 1086 | ||
| 1082 | list_for_each_entry(filter, filters, entry) { | 1087 | list_for_each_entry(filter, filters, entry) { |
| 1083 | /* PT doesn't support single address triggers */ | 1088 | /* PT doesn't support single address triggers */ |
| 1084 | if (!filter->range) | 1089 | if (!filter->range || !filter->size) |
| 1085 | return -EOPNOTSUPP; | 1090 | return -EOPNOTSUPP; |
| 1086 | 1091 | ||
| 1087 | if (!filter->inode && !kernel_ip(filter->offset)) | 1092 | if (!filter->inode) { |
| 1088 | return -EINVAL; | 1093 | if (!valid_kernel_ip(filter->offset)) |
| 1094 | return -EINVAL; | ||
| 1095 | |||
| 1096 | if (!valid_kernel_ip(filter->offset + filter->size)) | ||
| 1097 | return -EINVAL; | ||
| 1098 | } | ||
| 1089 | 1099 | ||
| 1090 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) | 1100 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) |
| 1091 | return -EOPNOTSUPP; | 1101 | return -EOPNOTSUPP; |
| @@ -1111,7 +1121,7 @@ static void pt_event_addr_filters_sync(struct perf_event *event) · 19 unmodified lines | |||
| 1111 | } else { | 1121 | } else { |
| 1112 | /* apply the offset */ | 1122 | /* apply the offset */ |
| 1113 | msr_a = filter->offset + offs[range]; | 1123 | msr_a = filter->offset + offs[range]; |
| 1114 | msr_b = filter->size + msr_a; | 1124 | msr_b = filter->size + msr_a - 1; |
| 1115 | } | 1125 | } |
| 1116 | 1126 | ||
| 1117 | filters->filter[range].msr_a = msr_a; | 1127 | filters->filter[range].msr_a = msr_a; |
| @@ -433,7 +433,11 @@ do { \ · 432 unmodified lines | |||
| 433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | 433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
| 434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | 434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ |
| 435 | "2:\n" \ | 435 | "2:\n" \ |
| 436 | _ASM_EXTABLE_EX(1b, 2b) \ | 436 | ".section .fixup,\"ax\"\n" \ |
| 437 | "3:xor"itype" %"rtype"0,%"rtype"0\n" \ | ||
| 438 | " jmp 2b\n" \ | ||
| 439 | ".previous\n" \ | ||
| 440 | _ASM_EXTABLE_EX(1b, 3b) \ | ||
| 437 | : ltype(x) : "m" (__m(addr))) | 441 | : ltype(x) : "m" (__m(addr))) |
| 438 | 442 | ||
| 439 | #define __put_user_nocheck(x, ptr, size) \ | 443 | #define __put_user_nocheck(x, ptr, size) \ |
| @@ -697,44 +701,15 @@ unsigned long __must_check _copy_from_user(void *to, const void __user *from, · 257 unmodified lines | |||
| 697 | unsigned long __must_check _copy_to_user(void __user *to, const void *from, | 701 | unsigned long __must_check _copy_to_user(void __user *to, const void *from, |
| 698 | unsigned n); | 702 | unsigned n); |
| 699 | 703 | ||
| 700 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | 704 | extern void __compiletime_error("usercopy buffer size is too small") |
| 701 | # define copy_user_diag __compiletime_error | 705 | __bad_copy_user(void); |
| 702 | #else | ||
| 703 | # define copy_user_diag __compiletime_warning | ||
| 704 | #endif | ||
| 705 | |||
| 706 | extern void copy_user_diag("copy_from_user() buffer size is too small") | ||
| 707 | copy_from_user_overflow(void); | ||
| 708 | extern void copy_user_diag("copy_to_user() buffer size is too small") | ||
| 709 | copy_to_user_overflow(void) __asm__("copy_from_user_overflow"); | ||
| 710 | |||
| 711 | #undef copy_user_diag | ||
| 712 | |||
| 713 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | ||
| 714 | |||
| 715 | extern void | ||
| 716 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | ||
| 717 | __copy_from_user_overflow(void) __asm__("copy_from_user_overflow"); | ||
| 718 | #define __copy_from_user_overflow(size, count) __copy_from_user_overflow() | ||
| 719 | |||
| 720 | extern void | ||
| 721 | __compiletime_warning("copy_to_user() buffer size is not provably correct") | ||
| 722 | __copy_to_user_overflow(void) __asm__("copy_from_user_overflow"); | ||
| 723 | #define __copy_to_user_overflow(size, count) __copy_to_user_overflow() | ||
| 724 | 706 | ||
| 725 | #else | 707 | static inline void copy_user_overflow(int size, unsigned long count) |
| 726 | |||
| 727 | static inline void | ||
| 728 | __copy_from_user_overflow(int size, unsigned long count) | ||
| 729 | { | 708 | { |
| 730 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); | 709 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
| 731 | } | 710 | } |
| 732 | 711 | ||
| 733 | #define __copy_to_user_overflow __copy_from_user_overflow | 712 | static __always_inline unsigned long __must_check |
| 734 | |||
| 735 | #endif | ||
| 736 | |||
| 737 | static inline unsigned long __must_check | ||
| 738 | copy_from_user(void *to, const void __user *from, unsigned long n) | 713 | copy_from_user(void *to, const void __user *from, unsigned long n) |
| 739 | { | 714 | { |
| 740 | int sz = __compiletime_object_size(to); | 715 | int sz = __compiletime_object_size(to); |
| @@ -743,36 +718,18 @@ copy_from_user(void *to, const void __user *from, unsigned long n) · 2 unmodified lines | |||
| 743 | 718 | ||
| 744 | kasan_check_write(to, n); | 719 | kasan_check_write(to, n); |
| 745 | 720 | ||
| 746 | /* | ||
| 747 | * While we would like to have the compiler do the checking for us | ||
| 748 | * even in the non-constant size case, any false positives there are | ||
| 749 | * a problem (especially when DEBUG_STRICT_USER_COPY_CHECKS, but even | ||
| 750 | * without - the [hopefully] dangerous looking nature of the warning | ||
| 751 | * would make people go look at the respecitive call sites over and | ||
| 752 | * over again just to find that there's no problem). | ||
| 753 | * | ||
| 754 | * And there are cases where it's just not realistic for the compiler | ||
| 755 | * to prove the count to be in range. For example when multiple call | ||
| 756 | * sites of a helper function - perhaps in different source files - | ||
| 757 | * all doing proper range checking, yet the helper function not doing | ||
| 758 | * so again. | ||
| 759 | * | ||
| 760 | * Therefore limit the compile time checking to the constant size | ||
| 761 | * case, and do only runtime checking for non-constant sizes. | ||
| 762 | */ | ||
| 763 | |||
| 764 | if (likely(sz < 0 || sz >= n)) { | 721 | if (likely(sz < 0 || sz >= n)) { |
| 765 | check_object_size(to, n, false); | 722 | check_object_size(to, n, false); |
| 766 | n = _copy_from_user(to, from, n); | 723 | n = _copy_from_user(to, from, n); |
| 767 | } else if (__builtin_constant_p(n)) | 724 | } else if (!__builtin_constant_p(n)) |
| 768 | copy_from_user_overflow(); | 725 | copy_user_overflow(sz, n); |
| 769 | else | 726 | else |
| 770 | __copy_from_user_overflow(sz, n); | 727 | __bad_copy_user(); |
| 771 | 728 | ||
| 772 | return n; | 729 | return n; |
| 773 | } | 730 | } |
| 774 | 731 | ||
| 775 | static inline unsigned long __must_check | 732 | static __always_inline unsigned long __must_check |
| 776 | copy_to_user(void __user *to, const void *from, unsigned long n) | 733 | copy_to_user(void __user *to, const void *from, unsigned long n) |
| 777 | { | 734 | { |
| 778 | int sz = __compiletime_object_size(from); | 735 | int sz = __compiletime_object_size(from); |
| @@ -781,21 +738,17 @@ copy_to_user(void __user *to, const void *from, unsigned long n) · 2 unmodified lines | |||
| 781 | 738 | ||
| 782 | might_fault(); | 739 | might_fault(); |
| 783 | 740 | ||
| 784 | /* See the comment in copy_from_user() above. */ | ||
| 785 | if (likely(sz < 0 || sz >= n)) { | 741 | if (likely(sz < 0 || sz >= n)) { |
| 786 | check_object_size(from, n, true); | 742 | check_object_size(from, n, true); |
| 787 | n = _copy_to_user(to, from, n); | 743 | n = _copy_to_user(to, from, n); |
| 788 | } else if (__builtin_constant_p(n)) | 744 | } else if (!__builtin_constant_p(n)) |
| 789 | copy_to_user_overflow(); | 745 | copy_user_overflow(sz, n); |
| 790 | else | 746 | else |
| 791 | __copy_to_user_overflow(sz, n); | 747 | __bad_copy_user(); |
| 792 | 748 | ||
| 793 | return n; | 749 | return n; |
| 794 | } | 750 | } |
| 795 | 751 | ||
| 796 | #undef __copy_from_user_overflow | ||
| 797 | #undef __copy_to_user_overflow | ||
| 798 | |||
| 799 | /* | 752 | /* |
| 800 | * We rely on the nested NMI work to allow atomic faults from the NMI path; the | 753 | * We rely on the nested NMI work to allow atomic faults from the NMI path; the |
| 801 | * nested NMI paths are careful to preserve CR2. | 754 | * nested NMI paths are careful to preserve CR2. |
| @@ -1623,6 +1623,9 @@ void __init enable_IR_x2apic(void) · 1622 unmodified lines | |||
| 1623 | unsigned long flags; | 1623 | unsigned long flags; |
| 1624 | int ret, ir_stat; | 1624 | int ret, ir_stat; |
| 1625 | 1625 | ||
| 1626 | if (skip_ioapic_setup) | ||
| 1627 | return; | ||
| 1628 | |||
| 1626 | ir_stat = irq_remapping_prepare(); | 1629 | ir_stat = irq_remapping_prepare(); |
| 1627 | if (ir_stat < 0 && !x2apic_supported()) | 1630 | if (ir_stat < 0 && !x2apic_supported()) |
| 1628 | return; | 1631 | return; |
| @@ -2090,7 +2093,6 @@ int generic_processor_info(int apicid, int version) · 461 unmodified lines | |||
| 2090 | return -EINVAL; | 2093 | return -EINVAL; |
| 2091 | } | 2094 | } |
| 2092 | 2095 | ||
| 2093 | num_processors++; | ||
| 2094 | if (apicid == boot_cpu_physical_apicid) { | 2096 | if (apicid == boot_cpu_physical_apicid) { |
| 2095 | /* | 2097 | /* |
| 2096 | * x86_bios_cpu_apicid is required to have processors listed | 2098 | * x86_bios_cpu_apicid is required to have processors listed |
| @@ -2113,10 +2115,13 @@ int generic_processor_info(int apicid, int version) · 16 unmodified lines | |||
| 2113 | 2115 | ||
| 2114 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", | 2116 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", |
| 2115 | thiscpu, apicid); | 2117 | thiscpu, apicid); |
| 2118 | |||
| 2116 | disabled_cpus++; | 2119 | disabled_cpus++; |
| 2117 | return -ENOSPC; | 2120 | return -ENOSPC; |
| 2118 | } | 2121 | } |
| 2119 | 2122 | ||
| 2123 | num_processors++; | ||
| 2124 | |||
| 2120 | /* | 2125 | /* |
| 2121 | * Validate version | 2126 | * Validate version |
| 2122 | */ | 2127 | */ |
| @@ -669,6 +669,17 @@ static void init_amd_gh(struct cpuinfo_x86 *c) · 668 unmodified lines | |||
| 669 | set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); | 669 | set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | #define MSR_AMD64_DE_CFG 0xC0011029 | ||
| 673 | |||
| 674 | static void init_amd_ln(struct cpuinfo_x86 *c) | ||
| 675 | { | ||
| 676 | /* | ||
| 677 | * Apply erratum 665 fix unconditionally so machines without a BIOS | ||
| 678 | * fix work. | ||
| 679 | */ | ||
| 680 | msr_set_bit(MSR_AMD64_DE_CFG, 31); | ||
| 681 | } | ||
| 682 | |||
| 672 | static void init_amd_bd(struct cpuinfo_x86 *c) | 683 | static void init_amd_bd(struct cpuinfo_x86 *c) |
| 673 | { | 684 | { |
| 674 | u64 value; | 685 | u64 value; |
| @@ -726,6 +737,7 @@ static void init_amd(struct cpuinfo_x86 *c) · 51 unmodified lines | |||
| 726 | case 6: init_amd_k7(c); break; | 737 | case 6: init_amd_k7(c); break; |
| 727 | case 0xf: init_amd_k8(c); break; | 738 | case 0xf: init_amd_k8(c); break; |
| 728 | case 0x10: init_amd_gh(c); break; | 739 | case 0x10: init_amd_gh(c); break; |
| 740 | case 0x12: init_amd_ln(c); break; | ||
| 729 | case 0x15: init_amd_bd(c); break; | 741 | case 0x15: init_amd_bd(c); break; |
| 730 | } | 742 | } |
| 731 | 743 | ||
| @@ -54,6 +54,7 @@ static LIST_HEAD(pcache); · 53 unmodified lines | |||
| 54 | */ | 54 | */ |
| 55 | static u8 *container; | 55 | static u8 *container; |
| 56 | static size_t container_size; | 56 | static size_t container_size; |
| 57 | static bool ucode_builtin; | ||
| 57 | 58 | ||
| 58 | static u32 ucode_new_rev; | 59 | static u32 ucode_new_rev; |
| 59 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; | 60 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; |
| @@ -281,18 +282,22 @@ static bool __init load_builtin_amd_microcode(struct cpio_data *cp, · 221 unmodified lines | |||
| 281 | void __init load_ucode_amd_bsp(unsigned int family) | 282 | void __init load_ucode_amd_bsp(unsigned int family) |
| 282 | { | 283 | { |
| 283 | struct cpio_data cp; | 284 | struct cpio_data cp; |
| 285 | bool *builtin; | ||
| 284 | void **data; | 286 | void **data; |
| 285 | size_t *size; | 287 | size_t *size; |
| 286 | 288 | ||
| 287 | #ifdef CONFIG_X86_32 | 289 | #ifdef CONFIG_X86_32 |
| 288 | data = (void **)__pa_nodebug(&ucode_cpio.data); | 290 | data = (void **)__pa_nodebug(&ucode_cpio.data); |
| 289 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); | 291 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); |
| 292 | builtin = (bool *)__pa_nodebug(&ucode_builtin); | ||
| 290 | #else | 293 | #else |
| 291 | data = &ucode_cpio.data; | 294 | data = &ucode_cpio.data; |
| 292 | size = &ucode_cpio.size; | 295 | size = &ucode_cpio.size; |
| 296 | builtin = &ucode_builtin; | ||
| 293 | #endif | 297 | #endif |
| 294 | 298 | ||
| 295 | if (!load_builtin_amd_microcode(&cp, family)) | 299 | *builtin = load_builtin_amd_microcode(&cp, family); |
| 300 | if (!*builtin) | ||
| 296 | cp = find_ucode_in_initrd(); | 301 | cp = find_ucode_in_initrd(); |
| 297 | 302 | ||
| 298 | if (!(cp.data && cp.size)) | 303 | if (!(cp.data && cp.size)) |
| @@ -373,7 +378,8 @@ void load_ucode_amd_ap(void) · 74 unmodified lines | |||
| 373 | return; | 378 | return; |
| 374 | 379 | ||
| 375 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 380 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
| 376 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 381 | if (!ucode_builtin) |
| 382 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
| 377 | 383 | ||
| 378 | eax = cpuid_eax(0x00000001); | 384 | eax = cpuid_eax(0x00000001); |
| 379 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); | 385 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); |
| @@ -439,7 +445,8 @@ int __init save_microcode_in_initrd_amd(void) · 59 unmodified lines | |||
| 439 | container = cont_va; | 445 | container = cont_va; |
| 440 | 446 | ||
| 441 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 447 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
| 442 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 448 | if (!ucode_builtin) |
| 449 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
| 443 | 450 | ||
| 444 | eax = cpuid_eax(0x00000001); | 451 | eax = cpuid_eax(0x00000001); |
| 445 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 452 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
| @@ -289,6 +289,7 @@ void __init kvmclock_init(void) · 288 unmodified lines | |||
| 289 | put_cpu(); | 289 | put_cpu(); |
| 290 | 290 | ||
| 291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; | 291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; |
| 292 | x86_platform.calibrate_cpu = kvm_get_tsc_khz; | ||
| 292 | x86_platform.get_wallclock = kvm_get_wallclock; | 293 | x86_platform.get_wallclock = kvm_get_wallclock; |
| 293 | x86_platform.set_wallclock = kvm_set_wallclock; | 294 | x86_platform.set_wallclock = kvm_set_wallclock; |
| 294 | #ifdef CONFIG_X86_LOCAL_APIC | 295 | #ifdef CONFIG_X86_LOCAL_APIC |
| @@ -56,12 +56,12 @@ asm (".pushsection .entry.text, \"ax\"\n" · 55 unmodified lines | |||
| 56 | ".popsection"); | 56 | ".popsection"); |
| 57 | 57 | ||
| 58 | /* identity function, which can be inlined */ | 58 | /* identity function, which can be inlined */ |
| 59 | u32 _paravirt_ident_32(u32 x) | 59 | u32 notrace _paravirt_ident_32(u32 x) |
| 60 | { | 60 | { |
| 61 | return x; | 61 | return x; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | u64 _paravirt_ident_64(u64 x) | 64 | u64 notrace _paravirt_ident_64(u64 x) |
| 65 | { | 65 | { |
| 66 | return x; | 66 | return x; |
| 67 | } | 67 | } |
| @@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) · 108 unmodified lines | |||
| 109 | { | 109 | { |
| 110 | bool new_val, old_val; | 110 | bool new_val, old_val; |
| 111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; | 111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; |
| 112 | struct dest_map *dest_map = &ioapic->rtc_status.dest_map; | ||
| 112 | union kvm_ioapic_redirect_entry *e; | 113 | union kvm_ioapic_redirect_entry *e; |
| 113 | 114 | ||
| 114 | e = &ioapic->redirtbl[RTC_GSI]; | 115 | e = &ioapic->redirtbl[RTC_GSI]; |
| @@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) · 2 unmodified lines | |||
| 117 | return; | 118 | return; |
| 118 | 119 | ||
| 119 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); | 120 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); |
| 120 | old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 121 | old_val = test_bit(vcpu->vcpu_id, dest_map->map); |
| 121 | 122 | ||
| 122 | if (new_val == old_val) | 123 | if (new_val == old_val) |
| 123 | return; | 124 | return; |
| 124 | 125 | ||
| 125 | if (new_val) { | 126 | if (new_val) { |
| 126 | __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 127 | __set_bit(vcpu->vcpu_id, dest_map->map); |
| 128 | dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; | ||
| 127 | ioapic->rtc_status.pending_eoi++; | 129 | ioapic->rtc_status.pending_eoi++; |
| 128 | } else { | 130 | } else { |
| 129 | __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 131 | __clear_bit(vcpu->vcpu_id, dest_map->map); |
| 130 | ioapic->rtc_status.pending_eoi--; | 132 | ioapic->rtc_status.pending_eoi--; |
| 131 | rtc_status_pending_eoi_check_valid(ioapic); | 133 | rtc_status_pending_eoi_check_valid(ioapic); |
| 132 | } | 134 | } |
| @@ -23,8 +23,8 @@ · 22 unmodified lines | |||
| 23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { | 23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { |
| 24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, | 24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, |
| 25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, | 25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, |
| 26 | [2] = { 0x80, 0x00, PERF_COUNT_HW_CACHE_REFERENCES }, | 26 | [2] = { 0x7d, 0x07, PERF_COUNT_HW_CACHE_REFERENCES }, |
| 27 | [3] = { 0x81, 0x00, PERF_COUNT_HW_CACHE_MISSES }, | 27 | [3] = { 0x7e, 0x07, PERF_COUNT_HW_CACHE_MISSES }, |
| 28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, | 28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, |
| 29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, | 29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, |
| 30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, | 30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, |
| @@ -422,6 +422,7 @@ struct nested_vmx { · 421 unmodified lines | |||
| 422 | struct list_head vmcs02_pool; | 422 | struct list_head vmcs02_pool; |
| 423 | int vmcs02_num; | 423 | int vmcs02_num; |
| 424 | u64 vmcs01_tsc_offset; | 424 | u64 vmcs01_tsc_offset; |
| 425 | bool change_vmcs01_virtual_x2apic_mode; | ||
| 425 | /* L2 must run next, and mustn't decide to exit to L1. */ | 426 | /* L2 must run next, and mustn't decide to exit to L1. */ |
| 426 | bool nested_run_pending; | 427 | bool nested_run_pending; |
| 427 | /* | 428 | /* |
| @@ -435,6 +436,8 @@ struct nested_vmx { · 7 unmodified lines | |||
| 435 | bool pi_pending; | 436 | bool pi_pending; |
| 436 | u16 posted_intr_nv; | 437 | u16 posted_intr_nv; |
| 437 | 438 | ||
| 439 | unsigned long *msr_bitmap; | ||
| 440 | |||
| 438 | struct hrtimer preemption_timer; | 441 | struct hrtimer preemption_timer; |
| 439 | bool preemption_timer_expired; | 442 | bool preemption_timer_expired; |
| 440 | 443 | ||
| @@ -924,7 +927,6 @@ static unsigned long *vmx_msr_bitmap_legacy; · 483 unmodified lines | |||
| 924 | static unsigned long *vmx_msr_bitmap_longmode; | 927 | static unsigned long *vmx_msr_bitmap_longmode; |
| 925 | static unsigned long *vmx_msr_bitmap_legacy_x2apic; | 928 | static unsigned long *vmx_msr_bitmap_legacy_x2apic; |
| 926 | static unsigned long *vmx_msr_bitmap_longmode_x2apic; | 929 | static unsigned long *vmx_msr_bitmap_longmode_x2apic; |
| 927 | static unsigned long *vmx_msr_bitmap_nested; | ||
| 928 | static unsigned long *vmx_vmread_bitmap; | 930 | static unsigned long *vmx_vmread_bitmap; |
| 929 | static unsigned long *vmx_vmwrite_bitmap; | 931 | static unsigned long *vmx_vmwrite_bitmap; |
| 930 | 932 | ||
| @@ -2198,6 +2200,12 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) · 1267 unmodified lines | |||
| 2198 | new.control) != old.control); | 2200 | new.control) != old.control); |
| 2199 | } | 2201 | } |
| 2200 | 2202 | ||
| 2203 | static void decache_tsc_multiplier(struct vcpu_vmx *vmx) | ||
| 2204 | { | ||
| 2205 | vmx->current_tsc_ratio = vmx->vcpu.arch.tsc_scaling_ratio; | ||
| 2206 | vmcs_write64(TSC_MULTIPLIER, vmx->current_tsc_ratio); | ||
| 2207 | } | ||
| 2208 | |||
| 2201 | /* | 2209 | /* |
| 2202 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes | 2210 | * Switches to specified vcpu, until a matching vcpu_put(), but assumes |
| 2203 | * vcpu mutex is already taken. | 2211 | * vcpu mutex is already taken. |
| @@ -2256,10 +2264,8 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 52 unmodified lines | |||
| 2256 | 2264 | ||
| 2257 | /* Setup TSC multiplier */ | 2265 | /* Setup TSC multiplier */ |
| 2258 | if (kvm_has_tsc_control && | 2266 | if (kvm_has_tsc_control && |
| 2259 | vmx->current_tsc_ratio != vcpu->arch.tsc_scaling_ratio) { | 2267 | vmx->current_tsc_ratio != vcpu->arch.tsc_scaling_ratio) |
| 2260 | vmx->current_tsc_ratio = vcpu->arch.tsc_scaling_ratio; | 2268 | decache_tsc_multiplier(vmx); |
| 2261 | vmcs_write64(TSC_MULTIPLIER, vmx->current_tsc_ratio); | ||
| 2262 | } | ||
| 2263 | 2269 | ||
| 2264 | vmx_vcpu_pi_load(vcpu, cpu); | 2270 | vmx_vcpu_pi_load(vcpu, cpu); |
| 2265 | vmx->host_pkru = read_pkru(); | 2271 | vmx->host_pkru = read_pkru(); |
| @@ -2508,7 +2514,7 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) · 242 unmodified lines | |||
| 2508 | unsigned long *msr_bitmap; | 2514 | unsigned long *msr_bitmap; |
| 2509 | 2515 | ||
| 2510 | if (is_guest_mode(vcpu)) | 2516 | if (is_guest_mode(vcpu)) |
| 2511 | msr_bitmap = vmx_msr_bitmap_nested; | 2517 | msr_bitmap = to_vmx(vcpu)->nested.msr_bitmap; |
| 2512 | else if (cpu_has_secondary_exec_ctrls() && | 2518 | else if (cpu_has_secondary_exec_ctrls() && |
| 2513 | (vmcs_read32(SECONDARY_VM_EXEC_CONTROL) & | 2519 | (vmcs_read32(SECONDARY_VM_EXEC_CONTROL) & |
| 2514 | SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) { | 2520 | SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) { |
| @@ -6363,13 +6369,6 @@ static __init int hardware_setup(void) · 3848 unmodified lines | |||
| 6363 | if (!vmx_msr_bitmap_longmode_x2apic) | 6369 | if (!vmx_msr_bitmap_longmode_x2apic) |
| 6364 | goto out4; | 6370 | goto out4; |
| 6365 | 6371 | ||
| 6366 | if (nested) { | ||
| 6367 | vmx_msr_bitmap_nested = | ||
| 6368 | (unsigned long *)__get_free_page(GFP_KERNEL); | ||
| 6369 | if (!vmx_msr_bitmap_nested) | ||
| 6370 | goto out5; | ||
| 6371 | } | ||
| 6372 | |||
| 6373 | vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL); | 6372 | vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL); |
| 6374 | if (!vmx_vmread_bitmap) | 6373 | if (!vmx_vmread_bitmap) |
| 6375 | goto out6; | 6374 | goto out6; |
| @@ -6392,8 +6391,6 @@ static __init int hardware_setup(void) · 16 unmodified lines | |||
| 6392 | 6391 | ||
| 6393 | memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE); | 6392 | memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE); |
| 6394 | memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE); | 6393 | memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE); |
| 6395 | if (nested) | ||
| 6396 | memset(vmx_msr_bitmap_nested, 0xff, PAGE_SIZE); | ||
| 6397 | 6394 | ||
| 6398 | if (setup_vmcs_config(&vmcs_config) < 0) { | 6395 | if (setup_vmcs_config(&vmcs_config) < 0) { |
| 6399 | r = -EIO; | 6396 | r = -EIO; |
| @@ -6529,9 +6526,6 @@ out8: · 129 unmodified lines | |||
| 6529 | out7: | 6526 | out7: |
| 6530 | free_page((unsigned long)vmx_vmread_bitmap); | 6527 | free_page((unsigned long)vmx_vmread_bitmap); |
| 6531 | out6: | 6528 | out6: |
| 6532 | if (nested) | ||
| 6533 | free_page((unsigned long)vmx_msr_bitmap_nested); | ||
| 6534 | out5: | ||
| 6535 | free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic); | 6529 | free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic); |
| 6536 | out4: | 6530 | out4: |
| 6537 | free_page((unsigned long)vmx_msr_bitmap_longmode); | 6531 | free_page((unsigned long)vmx_msr_bitmap_longmode); |
| @@ -6557,8 +6551,6 @@ static __exit void hardware_unsetup(void) · 19 unmodified lines | |||
| 6557 | free_page((unsigned long)vmx_io_bitmap_a); | 6551 | free_page((unsigned long)vmx_io_bitmap_a); |
| 6558 | free_page((unsigned long)vmx_vmwrite_bitmap); | 6552 | free_page((unsigned long)vmx_vmwrite_bitmap); |
| 6559 | free_page((unsigned long)vmx_vmread_bitmap); | 6553 | free_page((unsigned long)vmx_vmread_bitmap); |
| 6560 | if (nested) | ||
| 6561 | free_page((unsigned long)vmx_msr_bitmap_nested); | ||
| 6562 | 6554 | ||
| 6563 | free_kvm_area(); | 6555 | free_kvm_area(); |
| 6564 | } | 6556 | } |
| @@ -6995,16 +6987,21 @@ static int handle_vmon(struct kvm_vcpu *vcpu) · 430 unmodified lines | |||
| 6995 | return 1; | 6987 | return 1; |
| 6996 | } | 6988 | } |
| 6997 | 6989 | ||
| 6990 | if (cpu_has_vmx_msr_bitmap()) { | ||
| 6991 | vmx->nested.msr_bitmap = | ||
| 6992 | (unsigned long *)__get_free_page(GFP_KERNEL); | ||
| 6993 | if (!vmx->nested.msr_bitmap) | ||
| 6994 | goto out_msr_bitmap; | ||
| 6995 | } | ||
| 6996 | |||
| 6998 | vmx->nested.cached_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | 6997 | vmx->nested.cached_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); |
| 6999 | if (!vmx->nested.cached_vmcs12) | 6998 | if (!vmx->nested.cached_vmcs12) |
| 7000 | return -ENOMEM; | 6999 | goto out_cached_vmcs12; |
| 7001 | 7000 | ||
| 7002 | if (enable_shadow_vmcs) { | 7001 | if (enable_shadow_vmcs) { |
| 7003 | shadow_vmcs = alloc_vmcs(); | 7002 | shadow_vmcs = alloc_vmcs(); |
| 7004 | if (!shadow_vmcs) { | 7003 | if (!shadow_vmcs) |
| 7005 | kfree(vmx->nested.cached_vmcs12); | 7004 | goto out_shadow_vmcs; |
| 7006 | return -ENOMEM; | ||
| 7007 | } | ||
| 7008 | /* mark vmcs as shadow */ | 7005 | /* mark vmcs as shadow */ |
| 7009 | shadow_vmcs->revision_id |= (1u << 31); | 7006 | shadow_vmcs->revision_id |= (1u << 31); |
| 7010 | /* init shadow vmcs */ | 7007 | /* init shadow vmcs */ |
| @@ -7024,6 +7021,15 @@ static int handle_vmon(struct kvm_vcpu *vcpu) · 13 unmodified lines | |||
| 7024 | skip_emulated_instruction(vcpu); | 7021 | skip_emulated_instruction(vcpu); |
| 7025 | nested_vmx_succeed(vcpu); | 7022 | nested_vmx_succeed(vcpu); |
| 7026 | return 1; | 7023 | return 1; |
| 7024 | |||
| 7025 | out_shadow_vmcs: | ||
| 7026 | kfree(vmx->nested.cached_vmcs12); | ||
| 7027 | |||
| 7028 | out_cached_vmcs12: | ||
| 7029 | free_page((unsigned long)vmx->nested.msr_bitmap); | ||
| 7030 | |||
| 7031 | out_msr_bitmap: | ||
| 7032 | return -ENOMEM; | ||
| 7027 | } | 7033 | } |
| 7028 | 7034 | ||
| 7029 | /* | 7035 | /* |
| @@ -7098,6 +7104,10 @@ static void free_nested(struct vcpu_vmx *vmx) · 68 unmodified lines | |||
| 7098 | vmx->nested.vmxon = false; | 7104 | vmx->nested.vmxon = false; |
| 7099 | free_vpid(vmx->nested.vpid02); | 7105 | free_vpid(vmx->nested.vpid02); |
| 7100 | nested_release_vmcs12(vmx); | 7106 | nested_release_vmcs12(vmx); |
| 7107 | if (vmx->nested.msr_bitmap) { | ||
| 7108 | free_page((unsigned long)vmx->nested.msr_bitmap); | ||
| 7109 | vmx->nested.msr_bitmap = NULL; | ||
| 7110 | } | ||
| 7101 | if (enable_shadow_vmcs) | 7111 | if (enable_shadow_vmcs) |
| 7102 | free_vmcs(vmx->nested.current_shadow_vmcs); | 7112 | free_vmcs(vmx->nested.current_shadow_vmcs); |
| 7103 | kfree(vmx->nested.cached_vmcs12); | 7113 | kfree(vmx->nested.cached_vmcs12); |
| @@ -8419,6 +8429,12 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set) · 1315 unmodified lines | |||
| 8419 | { | 8429 | { |
| 8420 | u32 sec_exec_control; | 8430 | u32 sec_exec_control; |
| 8421 | 8431 | ||
| 8432 | /* Postpone execution until vmcs01 is the current VMCS. */ | ||
| 8433 | if (is_guest_mode(vcpu)) { | ||
| 8434 | to_vmx(vcpu)->nested.change_vmcs01_virtual_x2apic_mode = true; | ||
| 8435 | return; | ||
| 8436 | } | ||
| 8437 | |||
| 8422 | /* | 8438 | /* |
| 8423 | * There is not point to enable virtualize x2apic without enable | 8439 | * There is not point to enable virtualize x2apic without enable |
| 8424 | * apicv | 8440 | * apicv |
| @@ -9472,8 +9488,10 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, · 1047 unmodified lines | |||
| 9472 | { | 9488 | { |
| 9473 | int msr; | 9489 | int msr; |
| 9474 | struct page *page; | 9490 | struct page *page; |
| 9475 | unsigned long *msr_bitmap; | 9491 | unsigned long *msr_bitmap_l1; |
| 9492 | unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.msr_bitmap; | ||
| 9476 | 9493 | ||
| 9494 | /* This shortcut is ok because we support only x2APIC MSRs so far. */ | ||
| 9477 | if (!nested_cpu_has_virt_x2apic_mode(vmcs12)) | 9495 | if (!nested_cpu_has_virt_x2apic_mode(vmcs12)) |
| 9478 | return false; | 9496 | return false; |
| 9479 | 9497 | ||
| @@ -9482,63 +9500,37 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, · 2 unmodified lines | |||
| 9482 | WARN_ON(1); | 9500 | WARN_ON(1); |
| 9483 | return false; | 9501 | return false; |
| 9484 | } | 9502 | } |
| 9485 | msr_bitmap = (unsigned long *)kmap(page); | 9503 | msr_bitmap_l1 = (unsigned long *)kmap(page); |
| 9486 | if (!msr_bitmap) { | 9504 | if (!msr_bitmap_l1) { |
| 9487 | nested_release_page_clean(page); | 9505 | nested_release_page_clean(page); |
| 9488 | WARN_ON(1); | 9506 | WARN_ON(1); |
| 9489 | return false; | 9507 | return false; |
| 9490 | } | 9508 | } |
| 9491 | 9509 | ||
| 9510 | memset(msr_bitmap_l0, 0xff, PAGE_SIZE); | ||
| 9511 | |||
| 9492 | if (nested_cpu_has_virt_x2apic_mode(vmcs12)) { | 9512 | if (nested_cpu_has_virt_x2apic_mode(vmcs12)) { |
| 9493 | if (nested_cpu_has_apic_reg_virt(vmcs12)) | 9513 | if (nested_cpu_has_apic_reg_virt(vmcs12)) |
| 9494 | for (msr = 0x800; msr <= 0x8ff; msr++) | 9514 | for (msr = 0x800; msr <= 0x8ff; msr++) |
| 9495 | nested_vmx_disable_intercept_for_msr( | 9515 | nested_vmx_disable_intercept_for_msr( |
| 9496 | msr_bitmap, | 9516 | msr_bitmap_l1, msr_bitmap_l0, |
| 9497 | vmx_msr_bitmap_nested, | ||
| 9498 | msr, MSR_TYPE_R); | 9517 | msr, MSR_TYPE_R); |
| 9499 | /* TPR is allowed */ | 9518 | |
| 9500 | nested_vmx_disable_intercept_for_msr(msr_bitmap, | 9519 | nested_vmx_disable_intercept_for_msr( |
| 9501 | vmx_msr_bitmap_nested, | 9520 | msr_bitmap_l1, msr_bitmap_l0, |
| 9502 | APIC_BASE_MSR + (APIC_TASKPRI >> 4), | 9521 | APIC_BASE_MSR + (APIC_TASKPRI >> 4), |
| 9503 | MSR_TYPE_R | MSR_TYPE_W); | 9522 | MSR_TYPE_R | MSR_TYPE_W); |
| 9523 | |||
| 9504 | if (nested_cpu_has_vid(vmcs12)) { | 9524 | if (nested_cpu_has_vid(vmcs12)) { |
| 9505 | /* EOI and self-IPI are allowed */ | ||
| 9506 | nested_vmx_disable_intercept_for_msr( | 9525 | nested_vmx_disable_intercept_for_msr( |
| 9507 | msr_bitmap, | 9526 | msr_bitmap_l1, msr_bitmap_l0, |
| 9508 | vmx_msr_bitmap_nested, | ||
| 9509 | APIC_BASE_MSR + (APIC_EOI >> 4), | 9527 | APIC_BASE_MSR + (APIC_EOI >> 4), |
| 9510 | MSR_TYPE_W); | 9528 | MSR_TYPE_W); |
| 9511 | nested_vmx_disable_intercept_for_msr( | 9529 | nested_vmx_disable_intercept_for_msr( |
| 9512 | msr_bitmap, | 9530 | msr_bitmap_l1, msr_bitmap_l0, |
| 9513 | vmx_msr_bitmap_nested, | ||
| 9514 | APIC_BASE_MSR + (APIC_SELF_IPI >> 4), | 9531 | APIC_BASE_MSR + (APIC_SELF_IPI >> 4), |
| 9515 | MSR_TYPE_W); | 9532 | MSR_TYPE_W); |
| 9516 | } | 9533 | } |
| 9517 | } else { | ||
| 9518 | /* | ||
| 9519 | * Enable reading intercept of all the x2apic | ||
| 9520 | * MSRs. We should not rely on vmcs12 to do any | ||
| 9521 | * optimizations here, it may have been modified | ||
| 9522 | * by L1. | ||
| 9523 | */ | ||
| 9524 | for (msr = 0x800; msr <= 0x8ff; msr++) | ||
| 9525 | __vmx_enable_intercept_for_msr( | ||
| 9526 | vmx_msr_bitmap_nested, | ||
| 9527 | msr, | ||
| 9528 | MSR_TYPE_R); | ||
| 9529 | |||
| 9530 | __vmx_enable_intercept_for_msr( | ||
| 9531 | vmx_msr_bitmap_nested, | ||
| 9532 | APIC_BASE_MSR + (APIC_TASKPRI >> 4), | ||
| 9533 | MSR_TYPE_W); | ||
| 9534 | __vmx_enable_intercept_for_msr( | ||
| 9535 | vmx_msr_bitmap_nested, | ||
| 9536 | APIC_BASE_MSR + (APIC_EOI >> 4), | ||
| 9537 | MSR_TYPE_W); | ||
| 9538 | __vmx_enable_intercept_for_msr( | ||
| 9539 | vmx_msr_bitmap_nested, | ||
| 9540 | APIC_BASE_MSR + (APIC_SELF_IPI >> 4), | ||
| 9541 | MSR_TYPE_W); | ||
| 9542 | } | 9534 | } |
| 9543 | kunmap(page); | 9535 | kunmap(page); |
| 9544 | nested_release_page_clean(page); | 9536 | nested_release_page_clean(page); |
| @@ -9957,10 +9949,10 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) · 412 unmodified lines | |||
| 9957 | } | 9949 | } |
| 9958 | 9950 | ||
| 9959 | if (cpu_has_vmx_msr_bitmap() && | 9951 | if (cpu_has_vmx_msr_bitmap() && |
| 9960 | exec_control & CPU_BASED_USE_MSR_BITMAPS) { | 9952 | exec_control & CPU_BASED_USE_MSR_BITMAPS && |
| 9961 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12); | 9953 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12)) |
| 9962 | /* MSR_BITMAP will be set by following vmx_set_efer. */ | 9954 | ; /* MSR_BITMAP will be set by following vmx_set_efer. */ |
| 9963 | } else | 9955 | else |
| 9964 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; | 9956 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; |
| 9965 | 9957 | ||
| 9966 | /* | 9958 | /* |
| @@ -10011,6 +10003,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) · 44 unmodified lines | |||
| 10011 | vmx->nested.vmcs01_tsc_offset + vmcs12->tsc_offset); | 10003 | vmx->nested.vmcs01_tsc_offset + vmcs12->tsc_offset); |
| 10012 | else | 10004 | else |
| 10013 | vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset); | 10005 | vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset); |
| 10006 | if (kvm_has_tsc_control) | ||
| 10007 | decache_tsc_multiplier(vmx); | ||
| 10014 | 10008 | ||
| 10015 | if (enable_vpid) { | 10009 | if (enable_vpid) { |
| 10016 | /* | 10010 | /* |
| @@ -10767,6 +10761,14 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, · 750 unmodified lines | |||
| 10767 | else | 10761 | else |
| 10768 | vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL, | 10762 | vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL, |
| 10769 | PIN_BASED_VMX_PREEMPTION_TIMER); | 10763 | PIN_BASED_VMX_PREEMPTION_TIMER); |
| 10764 | if (kvm_has_tsc_control) | ||
| 10765 | decache_tsc_multiplier(vmx); | ||
| 10766 | |||
| 10767 | if (vmx->nested.change_vmcs01_virtual_x2apic_mode) { | ||
| 10768 | vmx->nested.change_vmcs01_virtual_x2apic_mode = false; | ||
| 10769 | vmx_set_virtual_x2apic_mode(vcpu, | ||
| 10770 | vcpu->arch.apic_base & X2APIC_ENABLE); | ||
| 10771 | } | ||
| 10770 | 10772 | ||
| 10771 | /* This is needed for same reason as it was needed in prepare_vmcs02 */ | 10773 | /* This is needed for same reason as it was needed in prepare_vmcs02 */ |
| 10772 | vmx->host_rsp = 0; | 10774 | vmx->host_rsp = 0; |
| @@ -2743,16 +2743,16 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 2742 unmodified lines | |||
| 2743 | if (tsc_delta < 0) | 2743 | if (tsc_delta < 0) |
| 2744 | mark_tsc_unstable("KVM discovered backwards TSC"); | 2744 | mark_tsc_unstable("KVM discovered backwards TSC"); |
| 2745 | 2745 | ||
| 2746 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
| 2747 | kvm_x86_ops->set_hv_timer(vcpu, | ||
| 2748 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
| 2749 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
| 2750 | if (check_tsc_unstable()) { | 2746 | if (check_tsc_unstable()) { |
| 2751 | u64 offset = kvm_compute_tsc_offset(vcpu, | 2747 | u64 offset = kvm_compute_tsc_offset(vcpu, |
| 2752 | vcpu->arch.last_guest_tsc); | 2748 | vcpu->arch.last_guest_tsc); |
| 2753 | kvm_x86_ops->write_tsc_offset(vcpu, offset); | 2749 | kvm_x86_ops->write_tsc_offset(vcpu, offset); |
| 2754 | vcpu->arch.tsc_catchup = 1; | 2750 | vcpu->arch.tsc_catchup = 1; |
| 2755 | } | 2751 | } |
| 2752 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
| 2753 | kvm_x86_ops->set_hv_timer(vcpu, | ||
| 2754 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
| 2755 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
| 2756 | /* | 2756 | /* |
| 2757 | * On a host with synchronized TSC, there is no need to update | 2757 | * On a host with synchronized TSC, there is no need to update |
| 2758 | * kvmclock on vcpu->cpu migration | 2758 | * kvmclock on vcpu->cpu migration |
| @@ -77,7 +77,7 @@ static inline unsigned long get_padding(struct kaslr_memory_region *region) · 76 unmodified lines | |||
| 77 | */ | 77 | */ |
| 78 | static inline bool kaslr_memory_enabled(void) | 78 | static inline bool kaslr_memory_enabled(void) |
| 79 | { | 79 | { |
| 80 | return kaslr_enabled() && !config_enabled(CONFIG_KASAN); | 80 | return kaslr_enabled() && !IS_ENABLED(CONFIG_KASAN); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | /* Initialize base and padding for each memory region randomized with KASLR */ | 83 | /* Initialize base and padding for each memory region randomized with KASLR */ |
| @@ -917,11 +917,11 @@ static void populate_pte(struct cpa_data *cpa, · 916 unmodified lines | |||
| 917 | } | 917 | } |
| 918 | } | 918 | } |
| 919 | 919 | ||
| 920 | static int populate_pmd(struct cpa_data *cpa, | 920 | static long populate_pmd(struct cpa_data *cpa, |
| 921 | unsigned long start, unsigned long end, | 921 | unsigned long start, unsigned long end, |
| 922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) | 922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) |
| 923 | { | 923 | { |
| 924 | unsigned int cur_pages = 0; | 924 | long cur_pages = 0; |
| 925 | pmd_t *pmd; | 925 | pmd_t *pmd; |
| 926 | pgprot_t pmd_pgprot; | 926 | pgprot_t pmd_pgprot; |
| 927 | 927 | ||
| @@ -991,12 +991,12 @@ static int populate_pmd(struct cpa_data *cpa, · 63 unmodified lines | |||
| 991 | return num_pages; | 991 | return num_pages; |
| 992 | } | 992 | } |
| 993 | 993 | ||
| 994 | static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, | 994 | static long populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, |
| 995 | pgprot_t pgprot) | 995 | pgprot_t pgprot) |
| 996 | { | 996 | { |
| 997 | pud_t *pud; | 997 | pud_t *pud; |
| 998 | unsigned long end; | 998 | unsigned long end; |
| 999 | int cur_pages = 0; | 999 | long cur_pages = 0; |
| 1000 | pgprot_t pud_pgprot; | 1000 | pgprot_t pud_pgprot; |
| 1001 | 1001 | ||
| 1002 | end = start + (cpa->numpages << PAGE_SHIFT); | 1002 | end = start + (cpa->numpages << PAGE_SHIFT); |
| @@ -1052,7 +1052,7 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, · 49 unmodified lines | |||
| 1052 | 1052 | ||
| 1053 | /* Map trailing leftover */ | 1053 | /* Map trailing leftover */ |
| 1054 | if (start < end) { | 1054 | if (start < end) { |
| 1055 | int tmp; | 1055 | long tmp; |
| 1056 | 1056 | ||
| 1057 | pud = pud_offset(pgd, start); | 1057 | pud = pud_offset(pgd, start); |
| 1058 | if (pud_none(*pud)) | 1058 | if (pud_none(*pud)) |
| @@ -1078,7 +1078,7 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr) · 19 unmodified lines | |||
| 1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); | 1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); |
| 1079 | pud_t *pud = NULL; /* shut up gcc */ | 1079 | pud_t *pud = NULL; /* shut up gcc */ |
| 1080 | pgd_t *pgd_entry; | 1080 | pgd_t *pgd_entry; |
| 1081 | int ret; | 1081 | long ret; |
| 1082 | 1082 | ||
| 1083 | pgd_entry = cpa->pgd + pgd_index(addr); | 1083 | pgd_entry = cpa->pgd + pgd_index(addr); |
| 1084 | 1084 | ||
| @@ -1327,7 +1327,8 @@ static int cpa_process_alias(struct cpa_data *cpa) · 242 unmodified lines | |||
| 1327 | 1327 | ||
| 1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) | 1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) |
| 1329 | { | 1329 | { |
| 1330 | int ret, numpages = cpa->numpages; | 1330 | unsigned long numpages = cpa->numpages; |
| 1331 | int ret; | ||
| 1331 | 1332 | ||
| 1332 | while (numpages) { | 1333 | while (numpages) { |
| 1333 | /* | 1334 | /* |
| @@ -927,9 +927,10 @@ int track_pfn_copy(struct vm_area_struct *vma) · 926 unmodified lines | |||
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | /* | 929 | /* |
| 930 | * prot is passed in as a parameter for the new mapping. If the vma has a | 930 | * prot is passed in as a parameter for the new mapping. If the vma has |
| 931 | * linear pfn mapping for the entire range reserve the entire vma range with | 931 | * a linear pfn mapping for the entire range, or no vma is provided, |
| 932 | * single reserve_pfn_range call. | 932 | * reserve the entire pfn + size range with single reserve_pfn_range |
| 933 | * call. | ||
| 933 | */ | 934 | */ |
| 934 | int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, | 935 | int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, |
| 935 | unsigned long pfn, unsigned long addr, unsigned long size) | 936 | unsigned long pfn, unsigned long addr, unsigned long size) |
| @@ -938,11 +939,12 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, · 2 unmodified lines | |||
| 938 | enum page_cache_mode pcm; | 939 | enum page_cache_mode pcm; |
| 939 | 940 | ||
| 940 | /* reserve the whole chunk starting from paddr */ | 941 | /* reserve the whole chunk starting from paddr */ |
| 941 | if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) { | 942 | if (!vma || (addr == vma->vm_start |
| 943 | && size == (vma->vm_end - vma->vm_start))) { | ||
| 942 | int ret; | 944 | int ret; |
| 943 | 945 | ||
| 944 | ret = reserve_pfn_range(paddr, size, prot, 0); | 946 | ret = reserve_pfn_range(paddr, size, prot, 0); |
| 945 | if (!ret) | 947 | if (ret == 0 && vma) |
| 946 | vma->vm_flags |= VM_PAT; | 948 | vma->vm_flags |= VM_PAT; |
| 947 | return ret; | 949 | return ret; |
| 948 | } | 950 | } |
| @@ -997,7 +999,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, · 48 unmodified lines | |||
| 997 | resource_size_t paddr; | 999 | resource_size_t paddr; |
| 998 | unsigned long prot; | 1000 | unsigned long prot; |
| 999 | 1001 | ||
| 1000 | if (!(vma->vm_flags & VM_PAT)) | 1002 | if (vma && !(vma->vm_flags & VM_PAT)) |
| 1001 | return; | 1003 | return; |
| 1002 | 1004 | ||
| 1003 | /* free the chunk starting from pfn or the whole chunk */ | 1005 | /* free the chunk starting from pfn or the whole chunk */ |
| @@ -1011,7 +1013,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, · 7 unmodified lines | |||
| 1011 | size = vma->vm_end - vma->vm_start; | 1013 | size = vma->vm_end - vma->vm_start; |
| 1012 | } | 1014 | } |
| 1013 | free_pfn_range(paddr, size); | 1015 | free_pfn_range(paddr, size); |
| 1014 | vma->vm_flags &= ~VM_PAT; | 1016 | if (vma) |
| 1017 | vma->vm_flags &= ~VM_PAT; | ||
| 1015 | } | 1018 | } |
| 1016 | 1019 | ||
| 1017 | /* | 1020 | /* |
| @@ -553,15 +553,21 @@ static void twinhead_reserve_killing_zone(struct pci_dev *dev) · 552 unmodified lines | |||
| 553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); | 553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); |
| 554 | 554 | ||
| 555 | /* | 555 | /* |
| 556 | * Broadwell EP Home Agent BARs erroneously return non-zero values when read. | 556 | * Device [8086:2fc0] |
| 557 | * Erratum HSE43 | ||
| 558 | * CONFIG_TDP_NOMINAL CSR Implemented at Incorrect Offset | ||
| 559 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v3-spec-update.html | ||
| 557 | * | 560 | * |
| 558 | * See http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | 561 | * Devices [8086:6f60,6fa0,6fc0] |
| 559 | * entry BDF2. | 562 | * Erratum BDF2 |
| 563 | * PCI BARs in the Home Agent Will Return Non-Zero Values During Enumeration | ||
| 564 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | ||
| 560 | */ | 565 | */ |
| 561 | static void pci_bdwep_bar(struct pci_dev *dev) | 566 | static void pci_invalid_bar(struct pci_dev *dev) |
| 562 | { | 567 | { |
| 563 | dev->non_compliant_bars = 1; | 568 | dev->non_compliant_bars = 1; |
| 564 | } | 569 | } |
| 565 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_bdwep_bar); | 570 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, pci_invalid_bar); |
| 566 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar); | 571 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); |
| 567 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar); | 572 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); |
| 573 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar); | ||
| @@ -41,6 +41,7 @@ static DEFINE_RAW_SPINLOCK(list_lock); · 40 unmodified lines | |||
| 41 | * @node: list item for parent traversal. | 41 | * @node: list item for parent traversal. |
| 42 | * @rcu: RCU callback item for freeing. | 42 | * @rcu: RCU callback item for freeing. |
| 43 | * @irq: back pointer to parent. | 43 | * @irq: back pointer to parent. |
| 44 | * @enabled: true if driver enabled IRQ | ||
| 44 | * @virq: the virtual IRQ value provided to the requesting driver. | 45 | * @virq: the virtual IRQ value provided to the requesting driver. |
| 45 | * | 46 | * |
| 46 | * Every MSI/MSI-X IRQ requested for a device in a VMD domain will be mapped to | 47 | * Every MSI/MSI-X IRQ requested for a device in a VMD domain will be mapped to |
| @@ -50,6 +51,7 @@ struct vmd_irq { · 3 unmodified lines | |||
| 50 | struct list_head node; | 51 | struct list_head node; |
| 51 | struct rcu_head rcu; | 52 | struct rcu_head rcu; |
| 52 | struct vmd_irq_list *irq; | 53 | struct vmd_irq_list *irq; |
| 54 | bool enabled; | ||
| 53 | unsigned int virq; | 55 | unsigned int virq; |
| 54 | }; | 56 | }; |
| 55 | 57 | ||
| @@ -122,7 +124,9 @@ static void vmd_irq_enable(struct irq_data *data) · 66 unmodified lines | |||
| 122 | unsigned long flags; | 124 | unsigned long flags; |
| 123 | 125 | ||
| 124 | raw_spin_lock_irqsave(&list_lock, flags); | 126 | raw_spin_lock_irqsave(&list_lock, flags); |
| 127 | WARN_ON(vmdirq->enabled); | ||
| 125 | list_add_tail_rcu(&vmdirq->node, &vmdirq->irq->irq_list); | 128 | list_add_tail_rcu(&vmdirq->node, &vmdirq->irq->irq_list); |
| 129 | vmdirq->enabled = true; | ||
| 126 | raw_spin_unlock_irqrestore(&list_lock, flags); | 130 | raw_spin_unlock_irqrestore(&list_lock, flags); |
| 127 | 131 | ||
| 128 | data->chip->irq_unmask(data); | 132 | data->chip->irq_unmask(data); |
| @@ -136,8 +140,10 @@ static void vmd_irq_disable(struct irq_data *data) · 7 unmodified lines | |||
| 136 | data->chip->irq_mask(data); | 140 | data->chip->irq_mask(data); |
| 137 | 141 | ||
| 138 | raw_spin_lock_irqsave(&list_lock, flags); | 142 | raw_spin_lock_irqsave(&list_lock, flags); |
| 139 | list_del_rcu(&vmdirq->node); | 143 | if (vmdirq->enabled) { |
| 140 | INIT_LIST_HEAD_RCU(&vmdirq->node); | 144 | list_del_rcu(&vmdirq->node); |
| 145 | vmdirq->enabled = false; | ||
| 146 | } | ||
| 141 | raw_spin_unlock_irqrestore(&list_lock, flags); | 147 | raw_spin_unlock_irqrestore(&list_lock, flags); |
| 142 | } | 148 | } |
| 143 | 149 | ||
| @@ -245,7 +245,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) · 244 unmodified lines | |||
| 245 | * text and allocate a new stack because we can't rely on the | 245 | * text and allocate a new stack because we can't rely on the |
| 246 | * stack pointer being < 4GB. | 246 | * stack pointer being < 4GB. |
| 247 | */ | 247 | */ |
| 248 | if (!IS_ENABLED(CONFIG_EFI_MIXED)) | 248 | if (!IS_ENABLED(CONFIG_EFI_MIXED) || efi_is_native()) |
| 249 | return 0; | 249 | return 0; |
| 250 | 250 | ||
| 251 | /* | 251 | /* |
| @@ -84,7 +84,10 @@ int putreg(struct task_struct *child, int regno, unsigned long value) · 83 unmodified lines | |||
| 84 | case EAX: | 84 | case EAX: |
| 85 | case EIP: | 85 | case EIP: |
| 86 | case UESP: | 86 | case UESP: |
| 87 | break; | ||
| 87 | case ORIG_EAX: | 88 | case ORIG_EAX: |
| 89 | /* Update the syscall number. */ | ||
| 90 | UPT_SYSCALL_NR(&child->thread.regs.regs) = value; | ||
| 88 | break; | 91 | break; |
| 89 | case FS: | 92 | case FS: |
| 90 | if (value && (value & 3) != 3) | 93 | if (value && (value & 3) != 3) |
| @@ -78,7 +78,11 @@ int putreg(struct task_struct *child, int regno, unsigned long value) · 77 unmodified lines | |||
| 78 | case RSI: | 78 | case RSI: |
| 79 | case RDI: | 79 | case RDI: |
| 80 | case RBP: | 80 | case RBP: |
| 81 | break; | ||
| 82 | |||
| 81 | case ORIG_RAX: | 83 | case ORIG_RAX: |
| 84 | /* Update the syscall number. */ | ||
| 85 | UPT_SYSCALL_NR(&child->thread.regs.regs) = value; | ||
| 82 | break; | 86 | break; |
| 83 | 87 | ||
| 84 | case FS: | 88 | case FS: |
| @@ -118,7 +118,7 @@ DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); · 117 unmodified lines | |||
| 118 | DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); | 118 | DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); |
| 119 | 119 | ||
| 120 | /* Linux <-> Xen vCPU id mapping */ | 120 | /* Linux <-> Xen vCPU id mapping */ |
| 121 | DEFINE_PER_CPU(int, xen_vcpu_id) = -1; | 121 | DEFINE_PER_CPU(uint32_t, xen_vcpu_id); |
| 122 | EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); | 122 | EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); |
| 123 | 123 | ||
| 124 | enum xen_domain_type xen_domain_type = XEN_NATIVE; | 124 | enum xen_domain_type xen_domain_type = XEN_NATIVE; |
| @@ -667,18 +667,19 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask, · 666 unmodified lines | |||
| 667 | bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; | 667 | bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; |
| 668 | bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; | 668 | bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; |
| 669 | 669 | ||
| 670 | if (bio_op(bio) == REQ_OP_DISCARD) | 670 | switch (bio_op(bio)) { |
| 671 | goto integrity_clone; | 671 | case REQ_OP_DISCARD: |
| 672 | 672 | case REQ_OP_SECURE_ERASE: | |
| 673 | if (bio_op(bio) == REQ_OP_WRITE_SAME) { | 673 | break; |
| 674 | case REQ_OP_WRITE_SAME: | ||
| 674 | bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0]; | 675 | bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0]; |
| 675 | goto integrity_clone; | 676 | break; |
| 677 | default: | ||
| 678 | bio_for_each_segment(bv, bio_src, iter) | ||
| 679 | bio->bi_io_vec[bio->bi_vcnt++] = bv; | ||
| 680 | break; | ||
| 676 | } | 681 | } |
| 677 | 682 | ||
| 678 | bio_for_each_segment(bv, bio_src, iter) | ||
| 679 | bio->bi_io_vec[bio->bi_vcnt++] = bv; | ||
| 680 | |||
| 681 | integrity_clone: | ||
| 682 | if (bio_integrity(bio_src)) { | 683 | if (bio_integrity(bio_src)) { |
| 683 | int ret; | 684 | int ret; |
| 684 | 685 | ||
| @@ -1788,7 +1789,7 @@ struct bio *bio_split(struct bio *bio, int sectors, · 1103 unmodified lines | |||
| 1788 | * Discards need a mutable bio_vec to accommodate the payload | 1789 | * Discards need a mutable bio_vec to accommodate the payload |
| 1789 | * required by the DSM TRIM and UNMAP commands. | 1790 | * required by the DSM TRIM and UNMAP commands. |
| 1790 | */ | 1791 | */ |
| 1791 | if (bio_op(bio) == REQ_OP_DISCARD) | 1792 | if (bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_SECURE_ERASE) |
| 1792 | split = bio_clone_bioset(bio, gfp, bs); | 1793 | split = bio_clone_bioset(bio, gfp, bs); |
| 1793 | else | 1794 | else |
| 1794 | split = bio_clone_fast(bio, gfp, bs); | 1795 | split = bio_clone_fast(bio, gfp, bs); |
| @@ -515,7 +515,9 @@ EXPORT_SYMBOL_GPL(blk_queue_bypass_end); · 514 unmodified lines | |||
| 515 | 515 | ||
| 516 | void blk_set_queue_dying(struct request_queue *q) | 516 | void blk_set_queue_dying(struct request_queue *q) |
| 517 | { | 517 | { |
| 518 | queue_flag_set_unlocked(QUEUE_FLAG_DYING, q); | 518 | spin_lock_irq(q->queue_lock); |
| 519 | queue_flag_set(QUEUE_FLAG_DYING, q); | ||
| 520 | spin_unlock_irq(q->queue_lock); | ||
| 519 | 521 | ||
| 520 | if (q->mq_ops) | 522 | if (q->mq_ops) |
| 521 | blk_mq_wake_waiters(q); | 523 | blk_mq_wake_waiters(q); |
| @@ -94,8 +94,30 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, · 93 unmodified lines | |||
| 94 | bool do_split = true; | 94 | bool do_split = true; |
| 95 | struct bio *new = NULL; | 95 | struct bio *new = NULL; |
| 96 | const unsigned max_sectors = get_max_io_size(q, bio); | 96 | const unsigned max_sectors = get_max_io_size(q, bio); |
| 97 | unsigned bvecs = 0; | ||
| 97 | 98 | ||
| 98 | bio_for_each_segment(bv, bio, iter) { | 99 | bio_for_each_segment(bv, bio, iter) { |
| 100 | /* | ||
| 101 | * With arbitrary bio size, the incoming bio may be very | ||
| 102 | * big. We have to split the bio into small bios so that | ||
| 103 | * each holds at most BIO_MAX_PAGES bvecs because | ||
| 104 | * bio_clone() can fail to allocate big bvecs. | ||
| 105 | * | ||
| 106 | * It should have been better to apply the limit per | ||
| 107 | * request queue in which bio_clone() is involved, | ||
| 108 | * instead of globally. The biggest blocker is the | ||
| 109 | * bio_clone() in bio bounce. | ||
| 110 | * | ||
| 111 | * If bio is splitted by this reason, we should have | ||
| 112 | * allowed to continue bios merging, but don't do | ||
| 113 | * that now for making the change simple. | ||
| 114 | * | ||
| 115 | * TODO: deal with bio bounce's bio_clone() gracefully | ||
| 116 | * and convert the global limit into per-queue limit. | ||
| 117 | */ | ||
| 118 | if (bvecs++ >= BIO_MAX_PAGES) | ||
| 119 | goto split; | ||
| 120 | |||
| 99 | /* | 121 | /* |
| 100 | * If the queue doesn't support SG gaps and adding this | 122 | * If the queue doesn't support SG gaps and adding this |
| 101 | * offset would create a gap, disallow it. | 123 | * offset would create a gap, disallow it. |
| @@ -172,12 +194,18 @@ void blk_queue_split(struct request_queue *q, struct bio **bio, · 70 unmodified lines | |||
| 172 | struct bio *split, *res; | 194 | struct bio *split, *res; |
| 173 | unsigned nsegs; | 195 | unsigned nsegs; |
| 174 | 196 | ||
| 175 | if (bio_op(*bio) == REQ_OP_DISCARD) | 197 | switch (bio_op(*bio)) { |
| 198 | case REQ_OP_DISCARD: | ||
| 199 | case REQ_OP_SECURE_ERASE: | ||
| 176 | split = blk_bio_discard_split(q, *bio, bs, &nsegs); | 200 | split = blk_bio_discard_split(q, *bio, bs, &nsegs); |
| 177 | else if (bio_op(*bio) == REQ_OP_WRITE_SAME) | 201 | break; |
| 202 | case REQ_OP_WRITE_SAME: | ||
| 178 | split = blk_bio_write_same_split(q, *bio, bs, &nsegs); | 203 | split = blk_bio_write_same_split(q, *bio, bs, &nsegs); |
| 179 | else | 204 | break; |
| 205 | default: | ||
| 180 | split = blk_bio_segment_split(q, *bio, q->bio_split, &nsegs); | 206 | split = blk_bio_segment_split(q, *bio, q->bio_split, &nsegs); |
| 207 | break; | ||
| 208 | } | ||
| 181 | 209 | ||
| 182 | /* physical segments can be figured out during splitting */ | 210 | /* physical segments can be figured out during splitting */ |
| 183 | res = split ? split : *bio; | 211 | res = split ? split : *bio; |
| @@ -213,7 +241,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q, · 29 unmodified lines | |||
| 213 | * This should probably be returning 0, but blk_add_request_payload() | 241 | * This should probably be returning 0, but blk_add_request_payload() |
| 214 | * (Christoph!!!!) | 242 | * (Christoph!!!!) |
| 215 | */ | 243 | */ |
| 216 | if (bio_op(bio) == REQ_OP_DISCARD) | 244 | if (bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_SECURE_ERASE) |
| 217 | return 1; | 245 | return 1; |
| 218 | 246 | ||
| 219 | if (bio_op(bio) == REQ_OP_WRITE_SAME) | 247 | if (bio_op(bio) == REQ_OP_WRITE_SAME) |
| @@ -385,7 +413,9 @@ static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, · 165 unmodified lines | |||
| 385 | nsegs = 0; | 413 | nsegs = 0; |
| 386 | cluster = blk_queue_cluster(q); | 414 | cluster = blk_queue_cluster(q); |
| 387 | 415 | ||
| 388 | if (bio_op(bio) == REQ_OP_DISCARD) { | 416 | switch (bio_op(bio)) { |
| 417 | case REQ_OP_DISCARD: | ||
| 418 | case REQ_OP_SECURE_ERASE: | ||
| 389 | /* | 419 | /* |
| 390 | * This is a hack - drivers should be neither modifying the | 420 | * This is a hack - drivers should be neither modifying the |
| 391 | * biovec, nor relying on bi_vcnt - but because of | 421 | * biovec, nor relying on bi_vcnt - but because of |
| @@ -393,19 +423,16 @@ static int __blk_bios_map_sg(struct request_queue *q, struct bio *bio, · 1 unmodified line | |||
| 393 | * a payload we need to set up here (thank you Christoph) and | 423 | * a payload we need to set up here (thank you Christoph) and |
| 394 | * bi_vcnt is really the only way of telling if we need to. | 424 | * bi_vcnt is really the only way of telling if we need to. |
| 395 | */ | 425 | */ |
| 396 | 426 | if (!bio->bi_vcnt) | |
| 397 | if (bio->bi_vcnt) | 427 | return 0; |
| 398 | goto single_segment; | 428 | /* Fall through */ |
| 399 | 429 | case REQ_OP_WRITE_SAME: | |
| 400 | return 0; | ||
| 401 | } | ||
| 402 | |||
| 403 | if (bio_op(bio) == REQ_OP_WRITE_SAME) { | ||
| 404 | single_segment: | ||
| 405 | *sg = sglist; | 430 | *sg = sglist; |
| 406 | bvec = bio_iovec(bio); | 431 | bvec = bio_iovec(bio); |
| 407 | sg_set_page(*sg, bvec.bv_page, bvec.bv_len, bvec.bv_offset); | 432 | sg_set_page(*sg, bvec.bv_page, bvec.bv_len, bvec.bv_offset); |
| 408 | return 1; | 433 | return 1; |
| 434 | default: | ||
| 435 | break; | ||
| 409 | } | 436 | } |
| 410 | 437 | ||
| 411 | for_each_bio(bio) | 438 | for_each_bio(bio) |
| @@ -296,17 +296,29 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, int rw, · 295 unmodified lines | |||
| 296 | if (ret) | 296 | if (ret) |
| 297 | return ERR_PTR(ret); | 297 | return ERR_PTR(ret); |
| 298 | 298 | ||
| 299 | /* | ||
| 300 | * Check if the hardware context is actually mapped to anything. | ||
| 301 | * If not tell the caller that it should skip this queue. | ||
| 302 | */ | ||
| 299 | hctx = q->queue_hw_ctx[hctx_idx]; | 303 | hctx = q->queue_hw_ctx[hctx_idx]; |
| 304 | if (!blk_mq_hw_queue_mapped(hctx)) { | ||
| 305 | ret = -EXDEV; | ||
| 306 | goto out_queue_exit; | ||
| 307 | } | ||
| 300 | ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask)); | 308 | ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask)); |
| 301 | 309 | ||
| 302 | blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx); | 310 | blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx); |
| 303 | rq = __blk_mq_alloc_request(&alloc_data, rw, 0); | 311 | rq = __blk_mq_alloc_request(&alloc_data, rw, 0); |
| 304 | if (!rq) { | 312 | if (!rq) { |
| 305 | blk_queue_exit(q); | 313 | ret = -EWOULDBLOCK; |
| 306 | return ERR_PTR(-EWOULDBLOCK); | 314 | goto out_queue_exit; |
| 307 | } | 315 | } |
| 308 | 316 | ||
| 309 | return rq; | 317 | return rq; |
| 318 | |||
| 319 | out_queue_exit: | ||
| 320 | blk_queue_exit(q); | ||
| 321 | return ERR_PTR(ret); | ||
| 310 | } | 322 | } |
| 311 | EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); | 323 | EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); |
| 312 | 324 | ||
| @@ -793,11 +805,12 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx) · 480 unmodified lines | |||
| 793 | struct list_head *dptr; | 805 | struct list_head *dptr; |
| 794 | int queued; | 806 | int queued; |
| 795 | 807 | ||
| 796 | WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask)); | ||
| 797 | |||
| 798 | if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) | 808 | if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state))) |
| 799 | return; | 809 | return; |
| 800 | 810 | ||
| 811 | WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) && | ||
| 812 | cpu_online(hctx->next_cpu)); | ||
| 813 | |||
| 801 | hctx->run++; | 814 | hctx->run++; |
| 802 | 815 | ||
| 803 | /* | 816 | /* |
| @@ -1036,10 +1049,11 @@ void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs) · 232 unmodified lines | |||
| 1036 | EXPORT_SYMBOL(blk_mq_delay_queue); | 1049 | EXPORT_SYMBOL(blk_mq_delay_queue); |
| 1037 | 1050 | ||
| 1038 | static inline void __blk_mq_insert_req_list(struct blk_mq_hw_ctx *hctx, | 1051 | static inline void __blk_mq_insert_req_list(struct blk_mq_hw_ctx *hctx, |
| 1039 | struct blk_mq_ctx *ctx, | ||
| 1040 | struct request *rq, | 1052 | struct request *rq, |
| 1041 | bool at_head) | 1053 | bool at_head) |
| 1042 | { | 1054 | { |
| 1055 | struct blk_mq_ctx *ctx = rq->mq_ctx; | ||
| 1056 | |||
| 1043 | trace_block_rq_insert(hctx->queue, rq); | 1057 | trace_block_rq_insert(hctx->queue, rq); |
| 1044 | 1058 | ||
| 1045 | if (at_head) | 1059 | if (at_head) |
| @@ -1053,20 +1067,16 @@ static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, · 7 unmodified lines | |||
| 1053 | { | 1067 | { |
| 1054 | struct blk_mq_ctx *ctx = rq->mq_ctx; | 1068 | struct blk_mq_ctx *ctx = rq->mq_ctx; |
| 1055 | 1069 | ||
| 1056 | __blk_mq_insert_req_list(hctx, ctx, rq, at_head); | 1070 | __blk_mq_insert_req_list(hctx, rq, at_head); |
| 1057 | blk_mq_hctx_mark_pending(hctx, ctx); | 1071 | blk_mq_hctx_mark_pending(hctx, ctx); |
| 1058 | } | 1072 | } |
| 1059 | 1073 | ||
| 1060 | void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue, | 1074 | void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue, |
| 1061 | bool async) | 1075 | bool async) |
| 1062 | { | 1076 | { |
| 1077 | struct blk_mq_ctx *ctx = rq->mq_ctx; | ||
| 1063 | struct request_queue *q = rq->q; | 1078 | struct request_queue *q = rq->q; |
| 1064 | struct blk_mq_hw_ctx *hctx; | 1079 | struct blk_mq_hw_ctx *hctx; |
| 1065 | struct blk_mq_ctx *ctx = rq->mq_ctx, *current_ctx; | ||
| 1066 | |||
| 1067 | current_ctx = blk_mq_get_ctx(q); | ||
| 1068 | if (!cpu_online(ctx->cpu)) | ||
| 1069 | rq->mq_ctx = ctx = current_ctx; | ||
| 1070 | 1080 | ||
| 1071 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | 1081 | hctx = q->mq_ops->map_queue(q, ctx->cpu); |
| 1072 | 1082 | ||
| @@ -1076,8 +1086,6 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue, · 3 unmodified lines | |||
| 1076 | 1086 | ||
| 1077 | if (run_queue) | 1087 | if (run_queue) |
| 1078 | blk_mq_run_hw_queue(hctx, async); | 1088 | blk_mq_run_hw_queue(hctx, async); |
| 1079 | |||
| 1080 | blk_mq_put_ctx(current_ctx); | ||
| 1081 | } | 1089 | } |
| 1082 | 1090 | ||
| 1083 | static void blk_mq_insert_requests(struct request_queue *q, | 1091 | static void blk_mq_insert_requests(struct request_queue *q, |
| @@ -1088,14 +1096,9 @@ static void blk_mq_insert_requests(struct request_queue *q, · 4 unmodified lines | |||
| 1088 | 1096 | ||
| 1089 | { | 1097 | { |
| 1090 | struct blk_mq_hw_ctx *hctx; | 1098 | struct blk_mq_hw_ctx *hctx; |
| 1091 | struct blk_mq_ctx *current_ctx; | ||
| 1092 | 1099 | ||
| 1093 | trace_block_unplug(q, depth, !from_schedule); | 1100 | trace_block_unplug(q, depth, !from_schedule); |
| 1094 | 1101 | ||
| 1095 | current_ctx = blk_mq_get_ctx(q); | ||
| 1096 | |||
| 1097 | if (!cpu_online(ctx->cpu)) | ||
| 1098 | ctx = current_ctx; | ||
| 1099 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | 1102 | hctx = q->mq_ops->map_queue(q, ctx->cpu); |
| 1100 | 1103 | ||
| 1101 | /* | 1104 | /* |
| @@ -1107,15 +1110,14 @@ static void blk_mq_insert_requests(struct request_queue *q, · 5 unmodified lines | |||
| 1107 | struct request *rq; | 1110 | struct request *rq; |
| 1108 | 1111 | ||
| 1109 | rq = list_first_entry(list, struct request, queuelist); | 1112 | rq = list_first_entry(list, struct request, queuelist); |
| 1113 | BUG_ON(rq->mq_ctx != ctx); | ||
| 1110 | list_del_init(&rq->queuelist); | 1114 | list_del_init(&rq->queuelist); |
| 1111 | rq->mq_ctx = ctx; | 1115 | __blk_mq_insert_req_list(hctx, rq, false); |
| 1112 | __blk_mq_insert_req_list(hctx, ctx, rq, false); | ||
| 1113 | } | 1116 | } |
| 1114 | blk_mq_hctx_mark_pending(hctx, ctx); | 1117 | blk_mq_hctx_mark_pending(hctx, ctx); |
| 1115 | spin_unlock(&ctx->lock); | 1118 | spin_unlock(&ctx->lock); |
| 1116 | 1119 | ||
| 1117 | blk_mq_run_hw_queue(hctx, from_schedule); | 1120 | blk_mq_run_hw_queue(hctx, from_schedule); |
| 1118 | blk_mq_put_ctx(current_ctx); | ||
| 1119 | } | 1121 | } |
| 1120 | 1122 | ||
| 1121 | static int plug_ctx_cmp(void *priv, struct list_head *a, struct list_head *b) | 1123 | static int plug_ctx_cmp(void *priv, struct list_head *a, struct list_head *b) |
| @@ -1630,16 +1632,17 @@ static int blk_mq_alloc_bitmap(struct blk_mq_ctxmap *bitmap, int node) · 508 unmodified lines | |||
| 1630 | return 0; | 1632 | return 0; |
| 1631 | } | 1633 | } |
| 1632 | 1634 | ||
| 1635 | /* | ||
| 1636 | * 'cpu' is going away. splice any existing rq_list entries from this | ||
| 1637 | * software queue to the hw queue dispatch list, and ensure that it | ||
| 1638 | * gets run. | ||
| 1639 | */ | ||
| 1633 | static int blk_mq_hctx_cpu_offline(struct blk_mq_hw_ctx *hctx, int cpu) | 1640 | static int blk_mq_hctx_cpu_offline(struct blk_mq_hw_ctx *hctx, int cpu) |
| 1634 | { | 1641 | { |
| 1635 | struct request_queue *q = hctx->queue; | ||
| 1636 | struct blk_mq_ctx *ctx; | 1642 | struct blk_mq_ctx *ctx; |
| 1637 | LIST_HEAD(tmp); | 1643 | LIST_HEAD(tmp); |
| 1638 | 1644 | ||
| 1639 | /* | 1645 | ctx = __blk_mq_get_ctx(hctx->queue, cpu); |
| 1640 | * Move ctx entries to new CPU, if this one is going away. | ||
| 1641 | */ | ||
| 1642 | ctx = __blk_mq_get_ctx(q, cpu); | ||
| 1643 | 1646 | ||
| 1644 | spin_lock(&ctx->lock); | 1647 | spin_lock(&ctx->lock); |
| 1645 | if (!list_empty(&ctx->rq_list)) { | 1648 | if (!list_empty(&ctx->rq_list)) { |
| @@ -1651,24 +1654,11 @@ static int blk_mq_hctx_cpu_offline(struct blk_mq_hw_ctx *hctx, int cpu) · 5 unmodified lines | |||
| 1651 | if (list_empty(&tmp)) | 1654 | if (list_empty(&tmp)) |
| 1652 | return NOTIFY_OK; | 1655 | return NOTIFY_OK; |
| 1653 | 1656 | ||
| 1654 | ctx = blk_mq_get_ctx(q); | 1657 | spin_lock(&hctx->lock); |
| 1655 | spin_lock(&ctx->lock); | 1658 | list_splice_tail_init(&tmp, &hctx->dispatch); |
| 1656 | 1659 | spin_unlock(&hctx->lock); | |
| 1657 | while (!list_empty(&tmp)) { | ||
| 1658 | struct request *rq; | ||
| 1659 | |||
| 1660 | rq = list_first_entry(&tmp, struct request, queuelist); | ||
| 1661 | rq->mq_ctx = ctx; | ||
| 1662 | list_move_tail(&rq->queuelist, &ctx->rq_list); | ||
| 1663 | } | ||
| 1664 | |||
| 1665 | hctx = q->mq_ops->map_queue(q, ctx->cpu); | ||
| 1666 | blk_mq_hctx_mark_pending(hctx, ctx); | ||
| 1667 | |||
| 1668 | spin_unlock(&ctx->lock); | ||
| 1669 | 1660 | ||
| 1670 | blk_mq_run_hw_queue(hctx, true); | 1661 | blk_mq_run_hw_queue(hctx, true); |
| 1671 | blk_mq_put_ctx(ctx); | ||
| 1672 | return NOTIFY_OK; | 1662 | return NOTIFY_OK; |
| 1673 | } | 1663 | } |
| 1674 | 1664 | ||
| @@ -780,9 +780,11 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio, · 779 unmodified lines | |||
| 780 | /* | 780 | /* |
| 781 | * If previous slice expired, start a new one otherwise renew/extend | 781 | * If previous slice expired, start a new one otherwise renew/extend |
| 782 | * existing slice to make sure it is at least throtl_slice interval | 782 | * existing slice to make sure it is at least throtl_slice interval |
| 783 | * long since now. | 783 | * long since now. New slice is started only for empty throttle group. |
| 784 | * If there is queued bio, that means there should be an active | ||
| 785 | * slice and it should be extended instead. | ||
| 784 | */ | 786 | */ |
| 785 | if (throtl_slice_used(tg, rw)) | 787 | if (throtl_slice_used(tg, rw) && !(tg->service_queue.nr_queued[rw])) |
| 786 | throtl_start_new_slice(tg, rw); | 788 | throtl_start_new_slice(tg, rw); |
| 787 | else { | 789 | else { |
| 788 | if (time_before(tg->slice_end[rw], jiffies + throtl_slice)) | 790 | if (time_before(tg->slice_end[rw], jiffies + throtl_slice)) |
| @@ -366,7 +366,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq) · 365 unmodified lines | |||
| 366 | list_for_each_prev(entry, &q->queue_head) { | 366 | list_for_each_prev(entry, &q->queue_head) { |
| 367 | struct request *pos = list_entry_rq(entry); | 367 | struct request *pos = list_entry_rq(entry); |
| 368 | 368 | ||
| 369 | if ((req_op(rq) == REQ_OP_DISCARD) != (req_op(pos) == REQ_OP_DISCARD)) | 369 | if (req_op(rq) != req_op(pos)) |
| 370 | break; | 370 | break; |
| 371 | if (rq_data_dir(rq) != rq_data_dir(pos)) | 371 | if (rq_data_dir(rq) != rq_data_dir(pos)) |
| 372 | break; | 372 | break; |
| @@ -233,6 +233,8 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, · 232 unmodified lines | |||
| 233 | return blkcipher_walk_done(desc, walk, -EINVAL); | 233 | return blkcipher_walk_done(desc, walk, -EINVAL); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | bsize = min(walk->walk_blocksize, n); | ||
| 237 | |||
| 236 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | | 238 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | |
| 237 | BLKCIPHER_WALK_DIFF); | 239 | BLKCIPHER_WALK_DIFF); |
| 238 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || | 240 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || |
| @@ -245,7 +247,6 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, · 6 unmodified lines | |||
| 245 | } | 247 | } |
| 246 | } | 248 | } |
| 247 | 249 | ||
| 248 | bsize = min(walk->walk_blocksize, n); | ||
| 249 | n = scatterwalk_clamp(&walk->in, n); | 250 | n = scatterwalk_clamp(&walk->in, n); |
| 250 | n = scatterwalk_clamp(&walk->out, n); | 251 | n = scatterwalk_clamp(&walk->out, n); |
| 251 | 252 | ||
| @@ -631,9 +631,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out) · 630 unmodified lines | |||
| 631 | 631 | ||
| 632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) | 632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) |
| 633 | { | 633 | { |
| 634 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | 634 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
| 635 | struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); | ||
| 636 | struct shash_desc *desc = cryptd_shash_desc(req); | ||
| 637 | |||
| 638 | desc->tfm = ctx->child; | ||
| 639 | desc->flags = req->base.flags; | ||
| 635 | 640 | ||
| 636 | return crypto_shash_import(&rctx->desc, in); | 641 | return crypto_shash_import(desc, in); |
| 637 | } | 642 | } |
| 638 | 643 | ||
| 639 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, | 644 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, |
| @@ -733,13 +738,14 @@ static void cryptd_aead_crypt(struct aead_request *req, · 93 unmodified lines | |||
| 733 | rctx = aead_request_ctx(req); | 738 | rctx = aead_request_ctx(req); |
| 734 | compl = rctx->complete; | 739 | compl = rctx->complete; |
| 735 | 740 | ||
| 741 | tfm = crypto_aead_reqtfm(req); | ||
| 742 | |||
| 736 | if (unlikely(err == -EINPROGRESS)) | 743 | if (unlikely(err == -EINPROGRESS)) |
| 737 | goto out; | 744 | goto out; |
| 738 | aead_request_set_tfm(req, child); | 745 | aead_request_set_tfm(req, child); |
| 739 | err = crypt( req ); | 746 | err = crypt( req ); |
| 740 | 747 | ||
| 741 | out: | 748 | out: |
| 742 | tfm = crypto_aead_reqtfm(req); | ||
| 743 | ctx = crypto_aead_ctx(tfm); | 749 | ctx = crypto_aead_ctx(tfm); |
| 744 | refcnt = atomic_read(&ctx->refcnt); | 750 | refcnt = atomic_read(&ctx->refcnt); |
| 745 | 751 | ||
| @@ -1,8 +1,8 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * echainiv: Encrypted Chain IV Generator | 2 | * echainiv: Encrypted Chain IV Generator |
| 3 | * | 3 | * |
| 4 | * This generator generates an IV based on a sequence number by xoring it | 4 | * This generator generates an IV based on a sequence number by multiplying |
| 5 | * with a salt and then encrypting it with the same key as used to encrypt | 5 | * it with a salt and then encrypting it with the same key as used to encrypt |
| 6 | * the plain text. This algorithm requires that the block size be equal | 6 | * the plain text. This algorithm requires that the block size be equal |
| 7 | * to the IV size. It is mainly useful for CBC. | 7 | * to the IV size. It is mainly useful for CBC. |
| 8 | * | 8 | * |
| @@ -24,81 +24,17 @@ · 15 unmodified lines | |||
| 24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
| 25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
| 26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/mm.h> | ||
| 28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 29 | #include <linux/percpu.h> | 28 | #include <linux/slab.h> |
| 30 | #include <linux/spinlock.h> | ||
| 31 | #include <linux/string.h> | 29 | #include <linux/string.h> |
| 32 | 30 | ||
| 33 | #define MAX_IV_SIZE 16 | ||
| 34 | |||
| 35 | static DEFINE_PER_CPU(u32 [MAX_IV_SIZE / sizeof(u32)], echainiv_iv); | ||
| 36 | |||
| 37 | /* We don't care if we get preempted and read/write IVs from the next CPU. */ | ||
| 38 | static void echainiv_read_iv(u8 *dst, unsigned size) | ||
| 39 | { | ||
| 40 | u32 *a = (u32 *)dst; | ||
| 41 | u32 __percpu *b = echainiv_iv; | ||
| 42 | |||
| 43 | for (; size >= 4; size -= 4) { | ||
| 44 | *a++ = this_cpu_read(*b); | ||
| 45 | b++; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | static void echainiv_write_iv(const u8 *src, unsigned size) | ||
| 50 | { | ||
| 51 | const u32 *a = (const u32 *)src; | ||
| 52 | u32 __percpu *b = echainiv_iv; | ||
| 53 | |||
| 54 | for (; size >= 4; size -= 4) { | ||
| 55 | this_cpu_write(*b, *a); | ||
| 56 | a++; | ||
| 57 | b++; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | static void echainiv_encrypt_complete2(struct aead_request *req, int err) | ||
| 62 | { | ||
| 63 | struct aead_request *subreq = aead_request_ctx(req); | ||
| 64 | struct crypto_aead *geniv; | ||
| 65 | unsigned int ivsize; | ||
| 66 | |||
| 67 | if (err == -EINPROGRESS) | ||
| 68 | return; | ||
| 69 | |||
| 70 | if (err) | ||
| 71 | goto out; | ||
| 72 | |||
| 73 | geniv = crypto_aead_reqtfm(req); | ||
| 74 | ivsize = crypto_aead_ivsize(geniv); | ||
| 75 | |||
| 76 | echainiv_write_iv(subreq->iv, ivsize); | ||
| 77 | |||
| 78 | if (req->iv != subreq->iv) | ||
| 79 | memcpy(req->iv, subreq->iv, ivsize); | ||
| 80 | |||
| 81 | out: | ||
| 82 | if (req->iv != subreq->iv) | ||
| 83 | kzfree(subreq->iv); | ||
| 84 | } | ||
| 85 | |||
| 86 | static void echainiv_encrypt_complete(struct crypto_async_request *base, | ||
| 87 | int err) | ||
| 88 | { | ||
| 89 | struct aead_request *req = base->data; | ||
| 90 | |||
| 91 | echainiv_encrypt_complete2(req, err); | ||
| 92 | aead_request_complete(req, err); | ||
| 93 | } | ||
| 94 | |||
| 95 | static int echainiv_encrypt(struct aead_request *req) | 31 | static int echainiv_encrypt(struct aead_request *req) |
| 96 | { | 32 | { |
| 97 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); | 33 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); |
| 98 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); | 34 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); |
| 99 | struct aead_request *subreq = aead_request_ctx(req); | 35 | struct aead_request *subreq = aead_request_ctx(req); |
| 100 | crypto_completion_t compl; | 36 | __be64 nseqno; |
| 101 | void *data; | 37 | u64 seqno; |
| 102 | u8 *info; | 38 | u8 *info; |
| 103 | unsigned int ivsize = crypto_aead_ivsize(geniv); | 39 | unsigned int ivsize = crypto_aead_ivsize(geniv); |
| 104 | int err; | 40 | int err; |
| @@ -108,8 +44,6 @@ static int echainiv_encrypt(struct aead_request *req) · 3 unmodified lines | |||
| 108 | 44 | ||
| 109 | aead_request_set_tfm(subreq, ctx->child); | 45 | aead_request_set_tfm(subreq, ctx->child); |
| 110 | 46 | ||
| 111 | compl = echainiv_encrypt_complete; | ||
| 112 | data = req; | ||
| 113 | info = req->iv; | 47 | info = req->iv; |
| 114 | 48 | ||
| 115 | if (req->src != req->dst) { | 49 | if (req->src != req->dst) { |
| @@ -127,29 +61,30 @@ static int echainiv_encrypt(struct aead_request *req) · 11 unmodified lines | |||
| 127 | return err; | 61 | return err; |
| 128 | } | 62 | } |
| 129 | 63 | ||
| 130 | if (unlikely(!IS_ALIGNED((unsigned long)info, | 64 | aead_request_set_callback(subreq, req->base.flags, |
| 131 | crypto_aead_alignmask(geniv) + 1))) { | 65 | req->base.complete, req->base.data); |
| 132 | info = kmalloc(ivsize, req->base.flags & | ||
| 133 | CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL: | ||
| 134 | GFP_ATOMIC); | ||
| 135 | if (!info) | ||
| 136 | return -ENOMEM; | ||
| 137 | |||
| 138 | memcpy(info, req->iv, ivsize); | ||
| 139 | } | ||
| 140 | |||
| 141 | aead_request_set_callback(subreq, req->base.flags, compl, data); | ||
| 142 | aead_request_set_crypt(subreq, req->dst, req->dst, | 66 | aead_request_set_crypt(subreq, req->dst, req->dst, |
| 143 | req->cryptlen, info); | 67 | req->cryptlen, info); |
| 144 | aead_request_set_ad(subreq, req->assoclen); | 68 | aead_request_set_ad(subreq, req->assoclen); |
| 145 | 69 | ||
| 146 | crypto_xor(info, ctx->salt, ivsize); | 70 | memcpy(&nseqno, info + ivsize - 8, 8); |
| 71 | seqno = be64_to_cpu(nseqno); | ||
| 72 | memset(info, 0, ivsize); | ||
| 73 | |||
| 147 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); | 74 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); |
| 148 | echainiv_read_iv(info, ivsize); | ||
| 149 | 75 | ||
| 150 | err = crypto_aead_encrypt(subreq); | 76 | do { |
| 151 | echainiv_encrypt_complete2(req, err); | 77 | u64 a; |
| 152 | return err; | 78 | |
| 79 | memcpy(&a, ctx->salt + ivsize - 8, 8); | ||
| 80 | |||
| 81 | a |= 1; | ||
| 82 | a *= seqno; | ||
| 83 | |||
| 84 | memcpy(info + ivsize - 8, &a, 8); | ||
| 85 | } while ((ivsize -= 8)); | ||
| 86 | |||
| 87 | return crypto_aead_encrypt(subreq); | ||
| 153 | } | 88 | } |
| 154 | 89 | ||
| 155 | static int echainiv_decrypt(struct aead_request *req) | 90 | static int echainiv_decrypt(struct aead_request *req) |
| @@ -196,8 +131,7 @@ static int echainiv_aead_create(struct crypto_template *tmpl, · 40 unmodified lines | |||
| 196 | alg = crypto_spawn_aead_alg(spawn); | 131 | alg = crypto_spawn_aead_alg(spawn); |
| 197 | 132 | ||
| 198 | err = -EINVAL; | 133 | err = -EINVAL; |
| 199 | if (inst->alg.ivsize & (sizeof(u32) - 1) || | 134 | if (inst->alg.ivsize & (sizeof(u64) - 1) || !inst->alg.ivsize) |
| 200 | inst->alg.ivsize > MAX_IV_SIZE) | ||
| 201 | goto free_inst; | 135 | goto free_inst; |
| 202 | 136 | ||
| 203 | inst->alg.encrypt = echainiv_encrypt; | 137 | inst->alg.encrypt = echainiv_encrypt; |
| @@ -206,7 +140,6 @@ static int echainiv_aead_create(struct crypto_template *tmpl, · 2 unmodified lines | |||
| 206 | inst->alg.init = aead_init_geniv; | 140 | inst->alg.init = aead_init_geniv; |
| 207 | inst->alg.exit = aead_exit_geniv; | 141 | inst->alg.exit = aead_exit_geniv; |
| 208 | 142 | ||
| 209 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
| 210 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); | 143 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); |
| 211 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; | 144 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; |
| 212 | 145 | ||
| @@ -298,41 +298,48 @@ static int pkcs1pad_decrypt_complete(struct akcipher_request *req, int err) · 297 unmodified lines | |||
| 298 | struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); | 298 | struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); |
| 299 | struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); | 299 | struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); |
| 300 | struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req); | 300 | struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req); |
| 301 | unsigned int dst_len; | ||
| 301 | unsigned int pos; | 302 | unsigned int pos; |
| 302 | 303 | u8 *out_buf; | |
| 303 | if (err == -EOVERFLOW) | ||
| 304 | /* Decrypted value had no leading 0 byte */ | ||
| 305 | err = -EINVAL; | ||
| 306 | 304 | ||
| 307 | if (err) | 305 | if (err) |
| 308 | goto done; | 306 | goto done; |
| 309 | 307 | ||
| 310 | if (req_ctx->child_req.dst_len != ctx->key_size - 1) { | 308 | err = -EINVAL; |
| 311 | err = -EINVAL; | 309 | dst_len = req_ctx->child_req.dst_len; |
| 310 | if (dst_len < ctx->key_size - 1) | ||
| 312 | goto done; | 311 | goto done; |
| 312 | |||
| 313 | out_buf = req_ctx->out_buf; | ||
| 314 | if (dst_len == ctx->key_size) { | ||
| 315 | if (out_buf[0] != 0x00) | ||
| 316 | /* Decrypted value had no leading 0 byte */ | ||
| 317 | goto done; | ||
| 318 | |||
| 319 | dst_len--; | ||
| 320 | out_buf++; | ||
| 313 | } | 321 | } |
| 314 | 322 | ||
| 315 | if (req_ctx->out_buf[0] != 0x02) { | 323 | if (out_buf[0] != 0x02) |
| 316 | err = -EINVAL; | ||
| 317 | goto done; | 324 | goto done; |
| 318 | } | 325 | |
| 319 | for (pos = 1; pos < req_ctx->child_req.dst_len; pos++) | 326 | for (pos = 1; pos < dst_len; pos++) |
| 320 | if (req_ctx->out_buf[pos] == 0x00) | 327 | if (out_buf[pos] == 0x00) |
| 321 | break; | 328 | break; |
| 322 | if (pos < 9 || pos == req_ctx->child_req.dst_len) { | 329 | if (pos < 9 || pos == dst_len) |
| 323 | err = -EINVAL; | ||
| 324 | goto done; | 330 | goto done; |
| 325 | } | ||
| 326 | pos++; | 331 | pos++; |
| 327 | 332 | ||
| 328 | if (req->dst_len < req_ctx->child_req.dst_len - pos) | 333 | err = 0; |
| 334 | |||
| 335 | if (req->dst_len < dst_len - pos) | ||
| 329 | err = -EOVERFLOW; | 336 | err = -EOVERFLOW; |
| 330 | req->dst_len = req_ctx->child_req.dst_len - pos; | 337 | req->dst_len = dst_len - pos; |
| 331 | 338 | ||
| 332 | if (!err) | 339 | if (!err) |
| 333 | sg_copy_from_buffer(req->dst, | 340 | sg_copy_from_buffer(req->dst, |
| 334 | sg_nents_for_len(req->dst, req->dst_len), | 341 | sg_nents_for_len(req->dst, req->dst_len), |
| 335 | req_ctx->out_buf + pos, req->dst_len); | 342 | out_buf + pos, req->dst_len); |
| 336 | 343 | ||
| 337 | done: | 344 | done: |
| 338 | kzfree(req_ctx->out_buf); | 345 | kzfree(req_ctx->out_buf); |
| @@ -42,7 +42,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, · 41 unmodified lines | |||
| 42 | list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { | 42 | list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { |
| 43 | struct acpi_nfit_system_address *spa = nfit_spa->spa; | 43 | struct acpi_nfit_system_address *spa = nfit_spa->spa; |
| 44 | 44 | ||
| 45 | if (nfit_spa_type(spa) == NFIT_SPA_PM) | 45 | if (nfit_spa_type(spa) != NFIT_SPA_PM) |
| 46 | continue; | 46 | continue; |
| 47 | /* find the spa that covers the mce addr */ | 47 | /* find the spa that covers the mce addr */ |
| 48 | if (spa->address > mce->addr) | 48 | if (spa->address > mce->addr) |
| @@ -2054,7 +2054,7 @@ int __init acpi_scan_init(void) · 2053 unmodified lines | |||
| 2054 | 2054 | ||
| 2055 | static struct acpi_probe_entry *ape; | 2055 | static struct acpi_probe_entry *ape; |
| 2056 | static int acpi_probe_count; | 2056 | static int acpi_probe_count; |
| 2057 | static DEFINE_SPINLOCK(acpi_probe_lock); | 2057 | static DEFINE_MUTEX(acpi_probe_mutex); |
| 2058 | 2058 | ||
| 2059 | static int __init acpi_match_madt(struct acpi_subtable_header *header, | 2059 | static int __init acpi_match_madt(struct acpi_subtable_header *header, |
| 2060 | const unsigned long end) | 2060 | const unsigned long end) |
| @@ -2073,7 +2073,7 @@ int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr) · 12 unmodified lines | |||
| 2073 | if (acpi_disabled) | 2073 | if (acpi_disabled) |
| 2074 | return 0; | 2074 | return 0; |
| 2075 | 2075 | ||
| 2076 | spin_lock(&acpi_probe_lock); | 2076 | mutex_lock(&acpi_probe_mutex); |
| 2077 | for (ape = ap_head; nr; ape++, nr--) { | 2077 | for (ape = ap_head; nr; ape++, nr--) { |
| 2078 | if (ACPI_COMPARE_NAME(ACPI_SIG_MADT, ape->id)) { | 2078 | if (ACPI_COMPARE_NAME(ACPI_SIG_MADT, ape->id)) { |
| 2079 | acpi_probe_count = 0; | 2079 | acpi_probe_count = 0; |
| @@ -2086,7 +2086,7 @@ int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr) · 6 unmodified lines | |||
| 2086 | count++; | 2086 | count++; |
| 2087 | } | 2087 | } |
| 2088 | } | 2088 | } |
| 2089 | spin_unlock(&acpi_probe_lock); | 2089 | mutex_unlock(&acpi_probe_mutex); |
| 2090 | 2090 | ||
| 2091 | return count; | 2091 | return count; |
| 2092 | } | 2092 | } |
| @@ -2524,7 +2524,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host, · 2523 unmodified lines | |||
| 2524 | 2524 | ||
| 2525 | /* Do not receive interrupts sent by dummy ports */ | 2525 | /* Do not receive interrupts sent by dummy ports */ |
| 2526 | if (!pp) { | 2526 | if (!pp) { |
| 2527 | disable_irq(irq + i); | 2527 | disable_irq(irq); |
| 2528 | continue; | 2528 | continue; |
| 2529 | } | 2529 | } |
| 2530 | 2530 | ||
| @@ -144,7 +144,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 143 unmodified lines | |||
| 144 | ap->ioaddr.altstatus_addr = base + 0x1E; | 144 | ap->ioaddr.altstatus_addr = base + 0x1E; |
| 145 | ap->ioaddr.bmdma_addr = base; | 145 | ap->ioaddr.bmdma_addr = base; |
| 146 | ata_sff_std_ports(&ap->ioaddr); | 146 | ata_sff_std_ports(&ap->ioaddr); |
| 147 | ap->pflags = ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE; | 147 | ap->pflags |= ATA_PFLAG_PIO32 | ATA_PFLAG_PIO32CHANGE; |
| 148 | 148 | ||
| 149 | ninja32_program(base); | 149 | ninja32_program(base); |
| 150 | /* FIXME: Should we disable them at remove ? */ | 150 | /* FIXME: Should we disable them at remove ? */ |
| @@ -301,7 +301,7 @@ static int rpm_idle(struct device *dev, int rpmflags) · 300 unmodified lines | |||
| 301 | int (*callback)(struct device *); | 301 | int (*callback)(struct device *); |
| 302 | int retval; | 302 | int retval; |
| 303 | 303 | ||
| 304 | trace_rpm_idle(dev, rpmflags); | 304 | trace_rpm_idle_rcuidle(dev, rpmflags); |
| 305 | retval = rpm_check_suspend_allowed(dev); | 305 | retval = rpm_check_suspend_allowed(dev); |
| 306 | if (retval < 0) | 306 | if (retval < 0) |
| 307 | ; /* Conditions are wrong. */ | 307 | ; /* Conditions are wrong. */ |
| @@ -337,7 +337,7 @@ static int rpm_idle(struct device *dev, int rpmflags) · 29 unmodified lines | |||
| 337 | dev->power.request_pending = true; | 337 | dev->power.request_pending = true; |
| 338 | queue_work(pm_wq, &dev->power.work); | 338 | queue_work(pm_wq, &dev->power.work); |
| 339 | } | 339 | } |
| 340 | trace_rpm_return_int(dev, _THIS_IP_, 0); | 340 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, 0); |
| 341 | return 0; | 341 | return 0; |
| 342 | } | 342 | } |
| 343 | 343 | ||
| @@ -352,7 +352,7 @@ static int rpm_idle(struct device *dev, int rpmflags) · 8 unmodified lines | |||
| 352 | wake_up_all(&dev->power.wait_queue); | 352 | wake_up_all(&dev->power.wait_queue); |
| 353 | 353 | ||
| 354 | out: | 354 | out: |
| 355 | trace_rpm_return_int(dev, _THIS_IP_, retval); | 355 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
| 356 | return retval ? retval : rpm_suspend(dev, rpmflags | RPM_AUTO); | 356 | return retval ? retval : rpm_suspend(dev, rpmflags | RPM_AUTO); |
| 357 | } | 357 | } |
| 358 | 358 | ||
| @@ -419,7 +419,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) · 60 unmodified lines | |||
| 419 | struct device *parent = NULL; | 419 | struct device *parent = NULL; |
| 420 | int retval; | 420 | int retval; |
| 421 | 421 | ||
| 422 | trace_rpm_suspend(dev, rpmflags); | 422 | trace_rpm_suspend_rcuidle(dev, rpmflags); |
| 423 | 423 | ||
| 424 | repeat: | 424 | repeat: |
| 425 | retval = rpm_check_suspend_allowed(dev); | 425 | retval = rpm_check_suspend_allowed(dev); |
| @@ -549,7 +549,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) · 123 unmodified lines | |||
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | out: | 551 | out: |
| 552 | trace_rpm_return_int(dev, _THIS_IP_, retval); | 552 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
| 553 | 553 | ||
| 554 | return retval; | 554 | return retval; |
| 555 | 555 | ||
| @@ -601,7 +601,7 @@ static int rpm_resume(struct device *dev, int rpmflags) · 45 unmodified lines | |||
| 601 | struct device *parent = NULL; | 601 | struct device *parent = NULL; |
| 602 | int retval = 0; | 602 | int retval = 0; |
| 603 | 603 | ||
| 604 | trace_rpm_resume(dev, rpmflags); | 604 | trace_rpm_resume_rcuidle(dev, rpmflags); |
| 605 | 605 | ||
| 606 | repeat: | 606 | repeat: |
| 607 | if (dev->power.runtime_error) | 607 | if (dev->power.runtime_error) |
| @@ -764,7 +764,7 @@ static int rpm_resume(struct device *dev, int rpmflags) · 156 unmodified lines | |||
| 764 | spin_lock_irq(&dev->power.lock); | 764 | spin_lock_irq(&dev->power.lock); |
| 765 | } | 765 | } |
| 766 | 766 | ||
| 767 | trace_rpm_return_int(dev, _THIS_IP_, retval); | 767 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
| 768 | 768 | ||
| 769 | return retval; | 769 | return retval; |
| 770 | } | 770 | } |
| @@ -404,6 +404,7 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, · 403 unmodified lines | |||
| 404 | unsigned int new_base_reg, new_top_reg; | 404 | unsigned int new_base_reg, new_top_reg; |
| 405 | unsigned int min, max; | 405 | unsigned int min, max; |
| 406 | unsigned int max_dist; | 406 | unsigned int max_dist; |
| 407 | unsigned int dist, best_dist = UINT_MAX; | ||
| 407 | 408 | ||
| 408 | max_dist = map->reg_stride * sizeof(*rbnode_tmp) / | 409 | max_dist = map->reg_stride * sizeof(*rbnode_tmp) / |
| 409 | map->cache_word_size; | 410 | map->cache_word_size; |
| @@ -423,24 +424,41 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, · 13 unmodified lines | |||
| 423 | &base_reg, &top_reg); | 424 | &base_reg, &top_reg); |
| 424 | 425 | ||
| 425 | if (base_reg <= max && top_reg >= min) { | 426 | if (base_reg <= max && top_reg >= min) { |
| 426 | new_base_reg = min(reg, base_reg); | 427 | if (reg < base_reg) |
| 427 | new_top_reg = max(reg, top_reg); | 428 | dist = base_reg - reg; |
| 428 | } else { | 429 | else if (reg > top_reg) |
| 429 | if (max < base_reg) | 430 | dist = reg - top_reg; |
| 430 | node = node->rb_left; | ||
| 431 | else | 431 | else |
| 432 | node = node->rb_right; | 432 | dist = 0; |
| 433 | 433 | if (dist < best_dist) { | |
| 434 | continue; | 434 | rbnode = rbnode_tmp; |
| 435 | best_dist = dist; | ||
| 436 | new_base_reg = min(reg, base_reg); | ||
| 437 | new_top_reg = max(reg, top_reg); | ||
| 438 | } | ||
| 435 | } | 439 | } |
| 436 | 440 | ||
| 437 | ret = regcache_rbtree_insert_to_block(map, rbnode_tmp, | 441 | /* |
| 442 | * Keep looking, we want to choose the closest block, | ||
| 443 | * otherwise we might end up creating overlapping | ||
| 444 | * blocks, which breaks the rbtree. | ||
| 445 | */ | ||
| 446 | if (reg < base_reg) | ||
| 447 | node = node->rb_left; | ||
| 448 | else if (reg > top_reg) | ||
| 449 | node = node->rb_right; | ||
| 450 | else | ||
| 451 | break; | ||
| 452 | } | ||
| 453 | |||
| 454 | if (rbnode) { | ||
| 455 | ret = regcache_rbtree_insert_to_block(map, rbnode, | ||
| 438 | new_base_reg, | 456 | new_base_reg, |
| 439 | new_top_reg, reg, | 457 | new_top_reg, reg, |
| 440 | value); | 458 | value); |
| 441 | if (ret) | 459 | if (ret) |
| 442 | return ret; | 460 | return ret; |
| 443 | rbtree_ctx->cached_rbnode = rbnode_tmp; | 461 | rbtree_ctx->cached_rbnode = rbnode; |
| 444 | return 0; | 462 | return 0; |
| 445 | } | 463 | } |
| 446 | 464 | ||
| @@ -38,10 +38,11 @@ static int regcache_hw_init(struct regmap *map) · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | /* calculate the size of reg_defaults */ | 39 | /* calculate the size of reg_defaults */ |
| 40 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) | 40 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) |
| 41 | if (!regmap_volatile(map, i * map->reg_stride)) | 41 | if (regmap_readable(map, i * map->reg_stride) && |
| 42 | !regmap_volatile(map, i * map->reg_stride)) | ||
| 42 | count++; | 43 | count++; |
| 43 | 44 | ||
| 44 | /* all registers are volatile, so just bypass */ | 45 | /* all registers are unreadable or volatile, so just bypass */ |
| 45 | if (!count) { | 46 | if (!count) { |
| 46 | map->cache_bypass = true; | 47 | map->cache_bypass = true; |
| 47 | return 0; | 48 | return 0; |
| @@ -1474,6 +1474,12 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, · 1473 unmodified lines | |||
| 1474 | ret = map->bus->write(map->bus_context, buf, len); | 1474 | ret = map->bus->write(map->bus_context, buf, len); |
| 1475 | 1475 | ||
| 1476 | kfree(buf); | 1476 | kfree(buf); |
| 1477 | } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { | ||
| 1478 | /* regcache_drop_region() takes lock that we already have, | ||
| 1479 | * thus call map->cache_ops->drop() directly | ||
| 1480 | */ | ||
| 1481 | if (map->cache_ops && map->cache_ops->drop) | ||
| 1482 | map->cache_ops->drop(map, reg, reg + 1); | ||
| 1477 | } | 1483 | } |
| 1478 | 1484 | ||
| 1479 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); | 1485 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); |
| @@ -3706,22 +3706,21 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) · 3705 unmodified lines | |||
| 3706 | if (UFDCS->rawcmd == 1) | 3706 | if (UFDCS->rawcmd == 1) |
| 3707 | UFDCS->rawcmd = 2; | 3707 | UFDCS->rawcmd = 2; |
| 3708 | 3708 | ||
| 3709 | if (mode & (FMODE_READ|FMODE_WRITE)) { | 3709 | if (!(mode & FMODE_NDELAY)) { |
| 3710 | UDRS->last_checked = 0; | 3710 | if (mode & (FMODE_READ|FMODE_WRITE)) { |
| 3711 | clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); | 3711 | UDRS->last_checked = 0; |
| 3712 | check_disk_change(bdev); | 3712 | clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); |
| 3713 | if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags)) | 3713 | check_disk_change(bdev); |
| 3714 | goto out; | 3714 | if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags)) |
| 3715 | if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) | 3715 | goto out; |
| 3716 | if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) | ||
| 3717 | goto out; | ||
| 3718 | } | ||
| 3719 | res = -EROFS; | ||
| 3720 | if ((mode & FMODE_WRITE) && | ||
| 3721 | !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) | ||
| 3716 | goto out; | 3722 | goto out; |
| 3717 | } | 3723 | } |
| 3718 | |||
| 3719 | res = -EROFS; | ||
| 3720 | |||
| 3721 | if ((mode & FMODE_WRITE) && | ||
| 3722 | !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) | ||
| 3723 | goto out; | ||
| 3724 | |||
| 3725 | mutex_unlock(&open_lock); | 3724 | mutex_unlock(&open_lock); |
| 3726 | mutex_unlock(&floppy_mutex); | 3725 | mutex_unlock(&floppy_mutex); |
| 3727 | return 0; | 3726 | return 0; |
| @@ -189,6 +189,8 @@ struct blkfront_info · 188 unmodified lines | |||
| 189 | struct mutex mutex; | 189 | struct mutex mutex; |
| 190 | struct xenbus_device *xbdev; | 190 | struct xenbus_device *xbdev; |
| 191 | struct gendisk *gd; | 191 | struct gendisk *gd; |
| 192 | u16 sector_size; | ||
| 193 | unsigned int physical_sector_size; | ||
| 192 | int vdevice; | 194 | int vdevice; |
| 193 | blkif_vdev_t handle; | 195 | blkif_vdev_t handle; |
| 194 | enum blkif_state connected; | 196 | enum blkif_state connected; |
| @@ -910,9 +912,45 @@ static struct blk_mq_ops blkfront_mq_ops = { · 715 unmodified lines | |||
| 910 | .map_queue = blk_mq_map_queue, | 912 | .map_queue = blk_mq_map_queue, |
| 911 | }; | 913 | }; |
| 912 | 914 | ||
| 915 | static void blkif_set_queue_limits(struct blkfront_info *info) | ||
| 916 | { | ||
| 917 | struct request_queue *rq = info->rq; | ||
| 918 | struct gendisk *gd = info->gd; | ||
| 919 | unsigned int segments = info->max_indirect_segments ? : | ||
| 920 | BLKIF_MAX_SEGMENTS_PER_REQUEST; | ||
| 921 | |||
| 922 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq); | ||
| 923 | |||
| 924 | if (info->feature_discard) { | ||
| 925 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, rq); | ||
| 926 | blk_queue_max_discard_sectors(rq, get_capacity(gd)); | ||
| 927 | rq->limits.discard_granularity = info->discard_granularity; | ||
| 928 | rq->limits.discard_alignment = info->discard_alignment; | ||
| 929 | if (info->feature_secdiscard) | ||
| 930 | queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, rq); | ||
| 931 | } | ||
| 932 | |||
| 933 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | ||
| 934 | blk_queue_logical_block_size(rq, info->sector_size); | ||
| 935 | blk_queue_physical_block_size(rq, info->physical_sector_size); | ||
| 936 | blk_queue_max_hw_sectors(rq, (segments * XEN_PAGE_SIZE) / 512); | ||
| 937 | |||
| 938 | /* Each segment in a request is up to an aligned page in size. */ | ||
| 939 | blk_queue_segment_boundary(rq, PAGE_SIZE - 1); | ||
| 940 | blk_queue_max_segment_size(rq, PAGE_SIZE); | ||
| 941 | |||
| 942 | /* Ensure a merged request will fit in a single I/O ring slot. */ | ||
| 943 | blk_queue_max_segments(rq, segments / GRANTS_PER_PSEG); | ||
| 944 | |||
| 945 | /* Make sure buffer addresses are sector-aligned. */ | ||
| 946 | blk_queue_dma_alignment(rq, 511); | ||
| 947 | |||
| 948 | /* Make sure we don't use bounce buffers. */ | ||
| 949 | blk_queue_bounce_limit(rq, BLK_BOUNCE_ANY); | ||
| 950 | } | ||
| 951 | |||
| 913 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, | 952 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, |
| 914 | unsigned int physical_sector_size, | 953 | unsigned int physical_sector_size) |
| 915 | unsigned int segments) | ||
| 916 | { | 954 | { |
| 917 | struct request_queue *rq; | 955 | struct request_queue *rq; |
| 918 | struct blkfront_info *info = gd->private_data; | 956 | struct blkfront_info *info = gd->private_data; |
| @@ -944,36 +982,11 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, · 25 unmodified lines | |||
| 944 | } | 982 | } |
| 945 | 983 | ||
| 946 | rq->queuedata = info; | 984 | rq->queuedata = info; |
| 947 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq); | 985 | info->rq = gd->queue = rq; |
| 948 | 986 | info->gd = gd; | |
| 949 | if (info->feature_discard) { | 987 | info->sector_size = sector_size; |
| 950 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, rq); | 988 | info->physical_sector_size = physical_sector_size; |
| 951 | blk_queue_max_discard_sectors(rq, get_capacity(gd)); | 989 | blkif_set_queue_limits(info); |
| 952 | rq->limits.discard_granularity = info->discard_granularity; | ||
| 953 | rq->limits.discard_alignment = info->discard_alignment; | ||
| 954 | if (info->feature_secdiscard) | ||
| 955 | queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, rq); | ||
| 956 | } | ||
| 957 | |||
| 958 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | ||
| 959 | blk_queue_logical_block_size(rq, sector_size); | ||
| 960 | blk_queue_physical_block_size(rq, physical_sector_size); | ||
| 961 | blk_queue_max_hw_sectors(rq, (segments * XEN_PAGE_SIZE) / 512); | ||
| 962 | |||
| 963 | /* Each segment in a request is up to an aligned page in size. */ | ||
| 964 | blk_queue_segment_boundary(rq, PAGE_SIZE - 1); | ||
| 965 | blk_queue_max_segment_size(rq, PAGE_SIZE); | ||
| 966 | |||
| 967 | /* Ensure a merged request will fit in a single I/O ring slot. */ | ||
| 968 | blk_queue_max_segments(rq, segments / GRANTS_PER_PSEG); | ||
| 969 | |||
| 970 | /* Make sure buffer addresses are sector-aligned. */ | ||
| 971 | blk_queue_dma_alignment(rq, 511); | ||
| 972 | |||
| 973 | /* Make sure we don't use bounce buffers. */ | ||
| 974 | blk_queue_bounce_limit(rq, BLK_BOUNCE_ANY); | ||
| 975 | |||
| 976 | gd->queue = rq; | ||
| 977 | 990 | ||
| 978 | return 0; | 991 | return 0; |
| 979 | } | 992 | } |
| @@ -1136,16 +1149,11 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, · 156 unmodified lines | |||
| 1136 | gd->private_data = info; | 1149 | gd->private_data = info; |
| 1137 | set_capacity(gd, capacity); | 1150 | set_capacity(gd, capacity); |
| 1138 | 1151 | ||
| 1139 | if (xlvbd_init_blk_queue(gd, sector_size, physical_sector_size, | 1152 | if (xlvbd_init_blk_queue(gd, sector_size, physical_sector_size)) { |
| 1140 | info->max_indirect_segments ? : | ||
| 1141 | BLKIF_MAX_SEGMENTS_PER_REQUEST)) { | ||
| 1142 | del_gendisk(gd); | 1153 | del_gendisk(gd); |
| 1143 | goto release; | 1154 | goto release; |
| 1144 | } | 1155 | } |
| 1145 | 1156 | ||
| 1146 | info->rq = gd->queue; | ||
| 1147 | info->gd = gd; | ||
| 1148 | |||
| 1149 | xlvbd_flush(info); | 1157 | xlvbd_flush(info); |
| 1150 | 1158 | ||
| 1151 | if (vdisk_info & VDISK_READONLY) | 1159 | if (vdisk_info & VDISK_READONLY) |
| @@ -1315,7 +1323,7 @@ free_shadow: · 163 unmodified lines | |||
| 1315 | rinfo->ring_ref[i] = GRANT_INVALID_REF; | 1323 | rinfo->ring_ref[i] = GRANT_INVALID_REF; |
| 1316 | } | 1324 | } |
| 1317 | } | 1325 | } |
| 1318 | free_pages((unsigned long)rinfo->ring.sring, get_order(info->nr_ring_pages * PAGE_SIZE)); | 1326 | free_pages((unsigned long)rinfo->ring.sring, get_order(info->nr_ring_pages * XEN_PAGE_SIZE)); |
| 1319 | rinfo->ring.sring = NULL; | 1327 | rinfo->ring.sring = NULL; |
| 1320 | 1328 | ||
| 1321 | if (rinfo->irq) | 1329 | if (rinfo->irq) |
| @@ -2007,8 +2015,10 @@ static int blkif_recover(struct blkfront_info *info) · 685 unmodified lines | |||
| 2007 | struct split_bio *split_bio; | 2015 | struct split_bio *split_bio; |
| 2008 | 2016 | ||
| 2009 | blkfront_gather_backend_features(info); | 2017 | blkfront_gather_backend_features(info); |
| 2018 | /* Reset limits changed by blk_mq_update_nr_hw_queues(). */ | ||
| 2019 | blkif_set_queue_limits(info); | ||
| 2010 | segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; | 2020 | segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; |
| 2011 | blk_queue_max_segments(info->rq, segs); | 2021 | blk_queue_max_segments(info->rq, segs / GRANTS_PER_PSEG); |
| 2012 | 2022 | ||
| 2013 | for (r_index = 0; r_index < info->nr_rings; r_index++) { | 2023 | for (r_index = 0; r_index < info->nr_rings; r_index++) { |
| 2014 | struct blkfront_ring_info *rinfo = &info->rinfo[r_index]; | 2024 | struct blkfront_ring_info *rinfo = &info->rinfo[r_index]; |
| @@ -2432,7 +2442,7 @@ static void blkfront_connect(struct blkfront_info *info) · 417 unmodified lines | |||
| 2432 | if (err) { | 2442 | if (err) { |
| 2433 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", | 2443 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", |
| 2434 | info->xbdev->otherend); | 2444 | info->xbdev->otherend); |
| 2435 | return; | 2445 | goto fail; |
| 2436 | } | 2446 | } |
| 2437 | 2447 | ||
| 2438 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 2448 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
| @@ -2445,6 +2455,11 @@ static void blkfront_connect(struct blkfront_info *info) · 6 unmodified lines | |||
| 2445 | device_add_disk(&info->xbdev->dev, info->gd); | 2455 | device_add_disk(&info->xbdev->dev, info->gd); |
| 2446 | 2456 | ||
| 2447 | info->is_ready = 1; | 2457 | info->is_ready = 1; |
| 2458 | return; | ||
| 2459 | |||
| 2460 | fail: | ||
| 2461 | blkif_free(info, 0); | ||
| 2462 | return; | ||
| 2448 | } | 2463 | } |
| 2449 | 2464 | ||
| 2450 | /** | 2465 | /** |
| @@ -551,7 +551,7 @@ static struct attribute *cci5xx_pmu_event_attrs[] = { · 550 unmodified lines | |||
| 551 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_wrq, 0xB), | 551 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_wrq, 0xB), |
| 552 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_cd_hs, 0xC), | 552 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_cd_hs, 0xC), |
| 553 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_rq_stall_addr_hazard, 0xD), | 553 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_rq_stall_addr_hazard, 0xD), |
| 554 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snopp_rq_stall_tt_full, 0xE), | 554 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_stall_tt_full, 0xE), |
| 555 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_tzmp1_prot, 0xF), | 555 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_tzmp1_prot, 0xF), |
| 556 | NULL | 556 | NULL |
| 557 | }; | 557 | }; |
| @@ -187,6 +187,7 @@ struct arm_ccn { · 186 unmodified lines | |||
| 187 | struct arm_ccn_component *xp; | 187 | struct arm_ccn_component *xp; |
| 188 | 188 | ||
| 189 | struct arm_ccn_dt dt; | 189 | struct arm_ccn_dt dt; |
| 190 | int mn_id; | ||
| 190 | }; | 191 | }; |
| 191 | 192 | ||
| 192 | static DEFINE_MUTEX(arm_ccn_mutex); | 193 | static DEFINE_MUTEX(arm_ccn_mutex); |
| @@ -212,6 +213,7 @@ static int arm_ccn_node_to_xp_port(int node) · 19 unmodified lines | |||
| 212 | #define CCN_CONFIG_TYPE(_config) (((_config) >> 8) & 0xff) | 213 | #define CCN_CONFIG_TYPE(_config) (((_config) >> 8) & 0xff) |
| 213 | #define CCN_CONFIG_EVENT(_config) (((_config) >> 16) & 0xff) | 214 | #define CCN_CONFIG_EVENT(_config) (((_config) >> 16) & 0xff) |
| 214 | #define CCN_CONFIG_PORT(_config) (((_config) >> 24) & 0x3) | 215 | #define CCN_CONFIG_PORT(_config) (((_config) >> 24) & 0x3) |
| 216 | #define CCN_CONFIG_BUS(_config) (((_config) >> 24) & 0x3) | ||
| 215 | #define CCN_CONFIG_VC(_config) (((_config) >> 26) & 0x7) | 217 | #define CCN_CONFIG_VC(_config) (((_config) >> 26) & 0x7) |
| 216 | #define CCN_CONFIG_DIR(_config) (((_config) >> 29) & 0x1) | 218 | #define CCN_CONFIG_DIR(_config) (((_config) >> 29) & 0x1) |
| 217 | #define CCN_CONFIG_MASK(_config) (((_config) >> 30) & 0xf) | 219 | #define CCN_CONFIG_MASK(_config) (((_config) >> 30) & 0xf) |
| @@ -241,6 +243,7 @@ static CCN_FORMAT_ATTR(xp, "config:0-7"); · 23 unmodified lines | |||
| 241 | static CCN_FORMAT_ATTR(type, "config:8-15"); | 243 | static CCN_FORMAT_ATTR(type, "config:8-15"); |
| 242 | static CCN_FORMAT_ATTR(event, "config:16-23"); | 244 | static CCN_FORMAT_ATTR(event, "config:16-23"); |
| 243 | static CCN_FORMAT_ATTR(port, "config:24-25"); | 245 | static CCN_FORMAT_ATTR(port, "config:24-25"); |
| 246 | static CCN_FORMAT_ATTR(bus, "config:24-25"); | ||
| 244 | static CCN_FORMAT_ATTR(vc, "config:26-28"); | 247 | static CCN_FORMAT_ATTR(vc, "config:26-28"); |
| 245 | static CCN_FORMAT_ATTR(dir, "config:29-29"); | 248 | static CCN_FORMAT_ATTR(dir, "config:29-29"); |
| 246 | static CCN_FORMAT_ATTR(mask, "config:30-33"); | 249 | static CCN_FORMAT_ATTR(mask, "config:30-33"); |
| @@ -253,6 +256,7 @@ static struct attribute *arm_ccn_pmu_format_attrs[] = { · 6 unmodified lines | |||
| 253 | &arm_ccn_pmu_format_attr_type.attr.attr, | 256 | &arm_ccn_pmu_format_attr_type.attr.attr, |
| 254 | &arm_ccn_pmu_format_attr_event.attr.attr, | 257 | &arm_ccn_pmu_format_attr_event.attr.attr, |
| 255 | &arm_ccn_pmu_format_attr_port.attr.attr, | 258 | &arm_ccn_pmu_format_attr_port.attr.attr, |
| 259 | &arm_ccn_pmu_format_attr_bus.attr.attr, | ||
| 256 | &arm_ccn_pmu_format_attr_vc.attr.attr, | 260 | &arm_ccn_pmu_format_attr_vc.attr.attr, |
| 257 | &arm_ccn_pmu_format_attr_dir.attr.attr, | 261 | &arm_ccn_pmu_format_attr_dir.attr.attr, |
| 258 | &arm_ccn_pmu_format_attr_mask.attr.attr, | 262 | &arm_ccn_pmu_format_attr_mask.attr.attr, |
| @@ -328,6 +332,7 @@ struct arm_ccn_pmu_event { · 69 unmodified lines | |||
| 328 | static ssize_t arm_ccn_pmu_event_show(struct device *dev, | 332 | static ssize_t arm_ccn_pmu_event_show(struct device *dev, |
| 329 | struct device_attribute *attr, char *buf) | 333 | struct device_attribute *attr, char *buf) |
| 330 | { | 334 | { |
| 335 | struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev)); | ||
| 331 | struct arm_ccn_pmu_event *event = container_of(attr, | 336 | struct arm_ccn_pmu_event *event = container_of(attr, |
| 332 | struct arm_ccn_pmu_event, attr); | 337 | struct arm_ccn_pmu_event, attr); |
| 333 | ssize_t res; | 338 | ssize_t res; |
| @@ -349,10 +354,17 @@ static ssize_t arm_ccn_pmu_event_show(struct device *dev, · 15 unmodified lines | |||
| 349 | break; | 354 | break; |
| 350 | case CCN_TYPE_XP: | 355 | case CCN_TYPE_XP: |
| 351 | res += snprintf(buf + res, PAGE_SIZE - res, | 356 | res += snprintf(buf + res, PAGE_SIZE - res, |
| 352 | ",xp=?,port=?,vc=?,dir=?"); | 357 | ",xp=?,vc=?"); |
| 353 | if (event->event == CCN_EVENT_WATCHPOINT) | 358 | if (event->event == CCN_EVENT_WATCHPOINT) |
| 354 | res += snprintf(buf + res, PAGE_SIZE - res, | 359 | res += snprintf(buf + res, PAGE_SIZE - res, |
| 355 | ",cmp_l=?,cmp_h=?,mask=?"); | 360 | ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?"); |
| 361 | else | ||
| 362 | res += snprintf(buf + res, PAGE_SIZE - res, | ||
| 363 | ",bus=?"); | ||
| 364 | |||
| 365 | break; | ||
| 366 | case CCN_TYPE_MN: | ||
| 367 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id); | ||
| 356 | break; | 368 | break; |
| 357 | default: | 369 | default: |
| 358 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=?"); | 370 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=?"); |
| @@ -383,9 +395,9 @@ static umode_t arm_ccn_pmu_events_is_visible(struct kobject *kobj, · 24 unmodified lines | |||
| 383 | } | 395 | } |
| 384 | 396 | ||
| 385 | static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = { | 397 | static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = { |
| 386 | CCN_EVENT_MN(eobarrier, "dir=0,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), | 398 | CCN_EVENT_MN(eobarrier, "dir=1,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), |
| 387 | CCN_EVENT_MN(ecbarrier, "dir=0,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), | 399 | CCN_EVENT_MN(ecbarrier, "dir=1,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), |
| 388 | CCN_EVENT_MN(dvmop, "dir=0,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), | 400 | CCN_EVENT_MN(dvmop, "dir=1,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), |
| 389 | CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY), | 401 | CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY), |
| 390 | CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY), | 402 | CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY), |
| 391 | CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY), | 403 | CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY), |
| @@ -733,9 +745,10 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) · 341 unmodified lines | |||
| 733 | 745 | ||
| 734 | if (has_branch_stack(event) || event->attr.exclude_user || | 746 | if (has_branch_stack(event) || event->attr.exclude_user || |
| 735 | event->attr.exclude_kernel || event->attr.exclude_hv || | 747 | event->attr.exclude_kernel || event->attr.exclude_hv || |
| 736 | event->attr.exclude_idle) { | 748 | event->attr.exclude_idle || event->attr.exclude_host || |
| 749 | event->attr.exclude_guest) { | ||
| 737 | dev_warn(ccn->dev, "Can't exclude execution levels!\n"); | 750 | dev_warn(ccn->dev, "Can't exclude execution levels!\n"); |
| 738 | return -EOPNOTSUPP; | 751 | return -EINVAL; |
| 739 | } | 752 | } |
| 740 | 753 | ||
| 741 | if (event->cpu < 0) { | 754 | if (event->cpu < 0) { |
| @@ -759,6 +772,12 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) · 17 unmodified lines | |||
| 759 | 772 | ||
| 760 | /* Validate node/xp vs topology */ | 773 | /* Validate node/xp vs topology */ |
| 761 | switch (type) { | 774 | switch (type) { |
| 775 | case CCN_TYPE_MN: | ||
| 776 | if (node_xp != ccn->mn_id) { | ||
| 777 | dev_warn(ccn->dev, "Invalid MN ID %d!\n", node_xp); | ||
| 778 | return -EINVAL; | ||
| 779 | } | ||
| 780 | break; | ||
| 762 | case CCN_TYPE_XP: | 781 | case CCN_TYPE_XP: |
| 763 | if (node_xp >= ccn->num_xps) { | 782 | if (node_xp >= ccn->num_xps) { |
| 764 | dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); | 783 | dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); |
| @@ -886,6 +905,10 @@ static void arm_ccn_pmu_xp_dt_config(struct perf_event *event, int enable) · 121 unmodified lines | |||
| 886 | struct arm_ccn_component *xp; | 905 | struct arm_ccn_component *xp; |
| 887 | u32 val, dt_cfg; | 906 | u32 val, dt_cfg; |
| 888 | 907 | ||
| 908 | /* Nothing to do for cycle counter */ | ||
| 909 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) | ||
| 910 | return; | ||
| 911 | |||
| 889 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP) | 912 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP) |
| 890 | xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)]; | 913 | xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)]; |
| 891 | else | 914 | else |
| @@ -917,38 +940,17 @@ static void arm_ccn_pmu_event_start(struct perf_event *event, int flags) · 25 unmodified lines | |||
| 917 | arm_ccn_pmu_read_counter(ccn, hw->idx)); | 940 | arm_ccn_pmu_read_counter(ccn, hw->idx)); |
| 918 | hw->state = 0; | 941 | hw->state = 0; |
| 919 | 942 | ||
| 920 | /* | ||
| 921 | * Pin the timer, so that the overflows are handled by the chosen | ||
| 922 | * event->cpu (this is the same one as presented in "cpumask" | ||
| 923 | * attribute). | ||
| 924 | */ | ||
| 925 | if (!ccn->irq) | ||
| 926 | hrtimer_start(&ccn->dt.hrtimer, arm_ccn_pmu_timer_period(), | ||
| 927 | HRTIMER_MODE_REL_PINNED); | ||
| 928 | |||
| 929 | /* Set the DT bus input, engaging the counter */ | 943 | /* Set the DT bus input, engaging the counter */ |
| 930 | arm_ccn_pmu_xp_dt_config(event, 1); | 944 | arm_ccn_pmu_xp_dt_config(event, 1); |
| 931 | } | 945 | } |
| 932 | 946 | ||
| 933 | static void arm_ccn_pmu_event_stop(struct perf_event *event, int flags) | 947 | static void arm_ccn_pmu_event_stop(struct perf_event *event, int flags) |
| 934 | { | 948 | { |
| 935 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
| 936 | struct hw_perf_event *hw = &event->hw; | 949 | struct hw_perf_event *hw = &event->hw; |
| 937 | u64 timeout; | ||
| 938 | 950 | ||
| 939 | /* Disable counting, setting the DT bus to pass-through mode */ | 951 | /* Disable counting, setting the DT bus to pass-through mode */ |
| 940 | arm_ccn_pmu_xp_dt_config(event, 0); | 952 | arm_ccn_pmu_xp_dt_config(event, 0); |
| 941 | 953 | ||
| 942 | if (!ccn->irq) | ||
| 943 | hrtimer_cancel(&ccn->dt.hrtimer); | ||
| 944 | |||
| 945 | /* Let the DT bus drain */ | ||
| 946 | timeout = arm_ccn_pmu_read_counter(ccn, CCN_IDX_PMU_CYCLE_COUNTER) + | ||
| 947 | ccn->num_xps; | ||
| 948 | while (arm_ccn_pmu_read_counter(ccn, CCN_IDX_PMU_CYCLE_COUNTER) < | ||
| 949 | timeout) | ||
| 950 | cpu_relax(); | ||
| 951 | |||
| 952 | if (flags & PERF_EF_UPDATE) | 954 | if (flags & PERF_EF_UPDATE) |
| 953 | arm_ccn_pmu_event_update(event); | 955 | arm_ccn_pmu_event_update(event); |
| 954 | 956 | ||
| @@ -988,7 +990,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) · 33 unmodified lines | |||
| 988 | 990 | ||
| 989 | /* Comparison values */ | 991 | /* Comparison values */ |
| 990 | writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp)); | 992 | writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp)); |
| 991 | writel((cmp_l >> 32) & 0xefffffff, | 993 | writel((cmp_l >> 32) & 0x7fffffff, |
| 992 | source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4); | 994 | source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4); |
| 993 | writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp)); | 995 | writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp)); |
| 994 | writel((cmp_h >> 32) & 0x0fffffff, | 996 | writel((cmp_h >> 32) & 0x0fffffff, |
| @@ -996,7 +998,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) · 1 unmodified line | |||
| 996 | 998 | ||
| 997 | /* Mask */ | 999 | /* Mask */ |
| 998 | writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp)); | 1000 | writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp)); |
| 999 | writel((mask_l >> 32) & 0xefffffff, | 1001 | writel((mask_l >> 32) & 0x7fffffff, |
| 1000 | source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4); | 1002 | source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4); |
| 1001 | writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp)); | 1003 | writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp)); |
| 1002 | writel((mask_h >> 32) & 0x0fffffff, | 1004 | writel((mask_h >> 32) & 0x0fffffff, |
| @@ -1014,7 +1016,7 @@ static void arm_ccn_pmu_xp_event_config(struct perf_event *event) · 11 unmodified lines | |||
| 1014 | hw->event_base = CCN_XP_DT_CONFIG__DT_CFG__XP_PMU_EVENT(hw->config_base); | 1016 | hw->event_base = CCN_XP_DT_CONFIG__DT_CFG__XP_PMU_EVENT(hw->config_base); |
| 1015 | 1017 | ||
| 1016 | id = (CCN_CONFIG_VC(event->attr.config) << 4) | | 1018 | id = (CCN_CONFIG_VC(event->attr.config) << 4) | |
| 1017 | (CCN_CONFIG_PORT(event->attr.config) << 3) | | 1019 | (CCN_CONFIG_BUS(event->attr.config) << 3) | |
| 1018 | (CCN_CONFIG_EVENT(event->attr.config) << 0); | 1020 | (CCN_CONFIG_EVENT(event->attr.config) << 0); |
| 1019 | 1021 | ||
| 1020 | val = readl(source->base + CCN_XP_PMU_EVENT_SEL); | 1022 | val = readl(source->base + CCN_XP_PMU_EVENT_SEL); |
| @@ -1099,15 +1101,31 @@ static void arm_ccn_pmu_event_config(struct perf_event *event) · 78 unmodified lines | |||
| 1099 | spin_unlock(&ccn->dt.config_lock); | 1101 | spin_unlock(&ccn->dt.config_lock); |
| 1100 | } | 1102 | } |
| 1101 | 1103 | ||
| 1104 | static int arm_ccn_pmu_active_counters(struct arm_ccn *ccn) | ||
| 1105 | { | ||
| 1106 | return bitmap_weight(ccn->dt.pmu_counters_mask, | ||
| 1107 | CCN_NUM_PMU_EVENT_COUNTERS + 1); | ||
| 1108 | } | ||
| 1109 | |||
| 1102 | static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) | 1110 | static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) |
| 1103 | { | 1111 | { |
| 1104 | int err; | 1112 | int err; |
| 1105 | struct hw_perf_event *hw = &event->hw; | 1113 | struct hw_perf_event *hw = &event->hw; |
| 1114 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
| 1106 | 1115 | ||
| 1107 | err = arm_ccn_pmu_event_alloc(event); | 1116 | err = arm_ccn_pmu_event_alloc(event); |
| 1108 | if (err) | 1117 | if (err) |
| 1109 | return err; | 1118 | return err; |
| 1110 | 1119 | ||
| 1120 | /* | ||
| 1121 | * Pin the timer, so that the overflows are handled by the chosen | ||
| 1122 | * event->cpu (this is the same one as presented in "cpumask" | ||
| 1123 | * attribute). | ||
| 1124 | */ | ||
| 1125 | if (!ccn->irq && arm_ccn_pmu_active_counters(ccn) == 1) | ||
| 1126 | hrtimer_start(&ccn->dt.hrtimer, arm_ccn_pmu_timer_period(), | ||
| 1127 | HRTIMER_MODE_REL_PINNED); | ||
| 1128 | |||
| 1111 | arm_ccn_pmu_event_config(event); | 1129 | arm_ccn_pmu_event_config(event); |
| 1112 | 1130 | ||
| 1113 | hw->state = PERF_HES_STOPPED; | 1131 | hw->state = PERF_HES_STOPPED; |
| @@ -1120,9 +1138,14 @@ static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) · 6 unmodified lines | |||
| 1120 | 1138 | ||
| 1121 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) | 1139 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) |
| 1122 | { | 1140 | { |
| 1141 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
| 1142 | |||
| 1123 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); | 1143 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); |
| 1124 | 1144 | ||
| 1125 | arm_ccn_pmu_event_release(event); | 1145 | arm_ccn_pmu_event_release(event); |
| 1146 | |||
| 1147 | if (!ccn->irq && arm_ccn_pmu_active_counters(ccn) == 0) | ||
| 1148 | hrtimer_cancel(&ccn->dt.hrtimer); | ||
| 1126 | } | 1149 | } |
| 1127 | 1150 | ||
| 1128 | static void arm_ccn_pmu_event_read(struct perf_event *event) | 1151 | static void arm_ccn_pmu_event_read(struct perf_event *event) |
| @@ -1130,6 +1153,24 @@ static void arm_ccn_pmu_event_read(struct perf_event *event) · 1 unmodified line | |||
| 1130 | arm_ccn_pmu_event_update(event); | 1153 | arm_ccn_pmu_event_update(event); |
| 1131 | } | 1154 | } |
| 1132 | 1155 | ||
| 1156 | static void arm_ccn_pmu_enable(struct pmu *pmu) | ||
| 1157 | { | ||
| 1158 | struct arm_ccn *ccn = pmu_to_arm_ccn(pmu); | ||
| 1159 | |||
| 1160 | u32 val = readl(ccn->dt.base + CCN_DT_PMCR); | ||
| 1161 | val |= CCN_DT_PMCR__PMU_EN; | ||
| 1162 | writel(val, ccn->dt.base + CCN_DT_PMCR); | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | static void arm_ccn_pmu_disable(struct pmu *pmu) | ||
| 1166 | { | ||
| 1167 | struct arm_ccn *ccn = pmu_to_arm_ccn(pmu); | ||
| 1168 | |||
| 1169 | u32 val = readl(ccn->dt.base + CCN_DT_PMCR); | ||
| 1170 | val &= ~CCN_DT_PMCR__PMU_EN; | ||
| 1171 | writel(val, ccn->dt.base + CCN_DT_PMCR); | ||
| 1172 | } | ||
| 1173 | |||
| 1133 | static irqreturn_t arm_ccn_pmu_overflow_handler(struct arm_ccn_dt *dt) | 1174 | static irqreturn_t arm_ccn_pmu_overflow_handler(struct arm_ccn_dt *dt) |
| 1134 | { | 1175 | { |
| 1135 | u32 pmovsr = readl(dt->base + CCN_DT_PMOVSR); | 1176 | u32 pmovsr = readl(dt->base + CCN_DT_PMOVSR); |
| @@ -1252,6 +1293,8 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) · 116 unmodified lines | |||
| 1252 | .start = arm_ccn_pmu_event_start, | 1293 | .start = arm_ccn_pmu_event_start, |
| 1253 | .stop = arm_ccn_pmu_event_stop, | 1294 | .stop = arm_ccn_pmu_event_stop, |
| 1254 | .read = arm_ccn_pmu_event_read, | 1295 | .read = arm_ccn_pmu_event_read, |
| 1296 | .pmu_enable = arm_ccn_pmu_enable, | ||
| 1297 | .pmu_disable = arm_ccn_pmu_disable, | ||
| 1255 | }; | 1298 | }; |
| 1256 | 1299 | ||
| 1257 | /* No overflow interrupt? Have to use a timer instead. */ | 1300 | /* No overflow interrupt? Have to use a timer instead. */ |
| @@ -1361,6 +1404,8 @@ static int arm_ccn_init_nodes(struct arm_ccn *ccn, int region, · 103 unmodified lines | |||
| 1361 | 1404 | ||
| 1362 | switch (type) { | 1405 | switch (type) { |
| 1363 | case CCN_TYPE_MN: | 1406 | case CCN_TYPE_MN: |
| 1407 | ccn->mn_id = id; | ||
| 1408 | return 0; | ||
| 1364 | case CCN_TYPE_DT: | 1409 | case CCN_TYPE_DT: |
| 1365 | return 0; | 1410 | return 0; |
| 1366 | case CCN_TYPE_XP: | 1411 | case CCN_TYPE_XP: |
| @@ -1471,8 +1516,9 @@ static int arm_ccn_probe(struct platform_device *pdev) · 104 unmodified lines | |||
| 1471 | /* Can set 'disable' bits, so can acknowledge interrupts */ | 1516 | /* Can set 'disable' bits, so can acknowledge interrupts */ |
| 1472 | writel(CCN_MN_ERRINT_STATUS__PMU_EVENTS__ENABLE, | 1517 | writel(CCN_MN_ERRINT_STATUS__PMU_EVENTS__ENABLE, |
| 1473 | ccn->base + CCN_MN_ERRINT_STATUS); | 1518 | ccn->base + CCN_MN_ERRINT_STATUS); |
| 1474 | err = devm_request_irq(ccn->dev, irq, arm_ccn_irq_handler, 0, | 1519 | err = devm_request_irq(ccn->dev, irq, arm_ccn_irq_handler, |
| 1475 | dev_name(ccn->dev), ccn); | 1520 | IRQF_NOBALANCING | IRQF_NO_THREAD, |
| 1521 | dev_name(ccn->dev), ccn); | ||
| 1476 | if (err) | 1522 | if (err) |
| 1477 | return err; | 1523 | return err; |
| 1478 | 1524 | ||
| @@ -178,6 +178,7 @@ static int vexpress_config_populate(struct device_node *node) · 177 unmodified lines | |||
| 178 | 178 | ||
| 179 | parent = class_find_device(vexpress_config_class, NULL, bridge, | 179 | parent = class_find_device(vexpress_config_class, NULL, bridge, |
| 180 | vexpress_config_node_match); | 180 | vexpress_config_node_match); |
| 181 | of_node_put(bridge); | ||
| 181 | if (WARN_ON(!parent)) | 182 | if (WARN_ON(!parent)) |
| 182 | return -ENODEV; | 183 | return -ENODEV; |
| 183 | 184 | ||
| @@ -244,7 +244,7 @@ config HW_RANDOM_TX4939 · 243 unmodified lines | |||
| 244 | 244 | ||
| 245 | config HW_RANDOM_MXC_RNGA | 245 | config HW_RANDOM_MXC_RNGA |
| 246 | tristate "Freescale i.MX RNGA Random Number Generator" | 246 | tristate "Freescale i.MX RNGA Random Number Generator" |
| 247 | depends on ARCH_HAS_RNGA | 247 | depends on SOC_IMX31 |
| 248 | default HW_RANDOM | 248 | default HW_RANDOM |
| 249 | ---help--- | 249 | ---help--- |
| 250 | This driver provides kernel-side support for the Random Number | 250 | This driver provides kernel-side support for the Random Number |
| @@ -957,7 +957,7 @@ int tpm2_auto_startup(struct tpm_chip *chip) · 956 unmodified lines | |||
| 957 | goto out; | 957 | goto out; |
| 958 | 958 | ||
| 959 | rc = tpm2_do_selftest(chip); | 959 | rc = tpm2_do_selftest(chip); |
| 960 | if (rc != TPM2_RC_INITIALIZE) { | 960 | if (rc != 0 && rc != TPM2_RC_INITIALIZE) { |
| 961 | dev_err(&chip->dev, "TPM self test failed\n"); | 961 | dev_err(&chip->dev, "TPM self test failed\n"); |
| 962 | goto out; | 962 | goto out; |
| 963 | } | 963 | } |
| @@ -974,7 +974,6 @@ int tpm2_auto_startup(struct tpm_chip *chip) · 10 unmodified lines | |||
| 974 | } | 974 | } |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | return rc; | ||
| 978 | out: | 977 | out: |
| 979 | if (rc > 0) | 978 | if (rc > 0) |
| 980 | rc = -ENODEV; | 979 | rc = -ENODEV; |
| @@ -165,6 +165,12 @@ struct ports_device { · 164 unmodified lines | |||
| 165 | */ | 165 | */ |
| 166 | struct virtqueue *c_ivq, *c_ovq; | 166 | struct virtqueue *c_ivq, *c_ovq; |
| 167 | 167 | ||
| 168 | /* | ||
| 169 | * A control packet buffer for guest->host requests, protected | ||
| 170 | * by c_ovq_lock. | ||
| 171 | */ | ||
| 172 | struct virtio_console_control cpkt; | ||
| 173 | |||
| 168 | /* Array of per-port IO virtqueues */ | 174 | /* Array of per-port IO virtqueues */ |
| 169 | struct virtqueue **in_vqs, **out_vqs; | 175 | struct virtqueue **in_vqs, **out_vqs; |
| 170 | 176 | ||
| @@ -560,28 +566,29 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, · 389 unmodified lines | |||
| 560 | unsigned int event, unsigned int value) | 566 | unsigned int event, unsigned int value) |
| 561 | { | 567 | { |
| 562 | struct scatterlist sg[1]; | 568 | struct scatterlist sg[1]; |
| 563 | struct virtio_console_control cpkt; | ||
| 564 | struct virtqueue *vq; | 569 | struct virtqueue *vq; |
| 565 | unsigned int len; | 570 | unsigned int len; |
| 566 | 571 | ||
| 567 | if (!use_multiport(portdev)) | 572 | if (!use_multiport(portdev)) |
| 568 | return 0; | 573 | return 0; |
| 569 | 574 | ||
| 570 | cpkt.id = cpu_to_virtio32(portdev->vdev, port_id); | ||
| 571 | cpkt.event = cpu_to_virtio16(portdev->vdev, event); | ||
| 572 | cpkt.value = cpu_to_virtio16(portdev->vdev, value); | ||
| 573 | |||
| 574 | vq = portdev->c_ovq; | 575 | vq = portdev->c_ovq; |
| 575 | 576 | ||
| 576 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | ||
| 577 | |||
| 578 | spin_lock(&portdev->c_ovq_lock); | 577 | spin_lock(&portdev->c_ovq_lock); |
| 579 | if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) { | 578 | |
| 579 | portdev->cpkt.id = cpu_to_virtio32(portdev->vdev, port_id); | ||
| 580 | portdev->cpkt.event = cpu_to_virtio16(portdev->vdev, event); | ||
| 581 | portdev->cpkt.value = cpu_to_virtio16(portdev->vdev, value); | ||
| 582 | |||
| 583 | sg_init_one(sg, &portdev->cpkt, sizeof(struct virtio_console_control)); | ||
| 584 | |||
| 585 | if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) { | ||
| 580 | virtqueue_kick(vq); | 586 | virtqueue_kick(vq); |
| 581 | while (!virtqueue_get_buf(vq, &len) | 587 | while (!virtqueue_get_buf(vq, &len) |
| 582 | && !virtqueue_is_broken(vq)) | 588 | && !virtqueue_is_broken(vq)) |
| 583 | cpu_relax(); | 589 | cpu_relax(); |
| 584 | } | 590 | } |
| 591 | |||
| 585 | spin_unlock(&portdev->c_ovq_lock); | 592 | spin_unlock(&portdev->c_ovq_lock); |
| 586 | return 0; | 593 | return 0; |
| 587 | } | 594 | } |
| @@ -69,6 +69,7 @@ static const struct cpg_core_clk r8a7795_core_clks[] __initconst = { · 68 unmodified lines | |||
| 69 | DEF_FIXED(".s1", CLK_S1, CLK_PLL1_DIV2, 3, 1), | 69 | DEF_FIXED(".s1", CLK_S1, CLK_PLL1_DIV2, 3, 1), |
| 70 | DEF_FIXED(".s2", CLK_S2, CLK_PLL1_DIV2, 4, 1), | 70 | DEF_FIXED(".s2", CLK_S2, CLK_PLL1_DIV2, 4, 1), |
| 71 | DEF_FIXED(".s3", CLK_S3, CLK_PLL1_DIV2, 6, 1), | 71 | DEF_FIXED(".s3", CLK_S3, CLK_PLL1_DIV2, 6, 1), |
| 72 | DEF_FIXED(".sdsrc", CLK_SDSRC, CLK_PLL1_DIV2, 2, 1), | ||
| 72 | 73 | ||
| 73 | /* Core Clock Outputs */ | 74 | /* Core Clock Outputs */ |
| 74 | DEF_FIXED("ztr", R8A7795_CLK_ZTR, CLK_PLL1_DIV2, 6, 1), | 75 | DEF_FIXED("ztr", R8A7795_CLK_ZTR, CLK_PLL1_DIV2, 6, 1), |
| @@ -87,10 +88,10 @@ static const struct cpg_core_clk r8a7795_core_clks[] __initconst = { · 12 unmodified lines | |||
| 87 | DEF_FIXED("s3d2", R8A7795_CLK_S3D2, CLK_S3, 2, 1), | 88 | DEF_FIXED("s3d2", R8A7795_CLK_S3D2, CLK_S3, 2, 1), |
| 88 | DEF_FIXED("s3d4", R8A7795_CLK_S3D4, CLK_S3, 4, 1), | 89 | DEF_FIXED("s3d4", R8A7795_CLK_S3D4, CLK_S3, 4, 1), |
| 89 | 90 | ||
| 90 | DEF_GEN3_SD("sd0", R8A7795_CLK_SD0, CLK_PLL1_DIV2, 0x0074), | 91 | DEF_GEN3_SD("sd0", R8A7795_CLK_SD0, CLK_SDSRC, 0x0074), |
| 91 | DEF_GEN3_SD("sd1", R8A7795_CLK_SD1, CLK_PLL1_DIV2, 0x0078), | 92 | DEF_GEN3_SD("sd1", R8A7795_CLK_SD1, CLK_SDSRC, 0x0078), |
| 92 | DEF_GEN3_SD("sd2", R8A7795_CLK_SD2, CLK_PLL1_DIV2, 0x0268), | 93 | DEF_GEN3_SD("sd2", R8A7795_CLK_SD2, CLK_SDSRC, 0x0268), |
| 93 | DEF_GEN3_SD("sd3", R8A7795_CLK_SD3, CLK_PLL1_DIV2, 0x026c), | 94 | DEF_GEN3_SD("sd3", R8A7795_CLK_SD3, CLK_SDSRC, 0x026c), |
| 94 | 95 | ||
| 95 | DEF_FIXED("cl", R8A7795_CLK_CL, CLK_PLL1_DIV2, 48, 1), | 96 | DEF_FIXED("cl", R8A7795_CLK_CL, CLK_PLL1_DIV2, 48, 1), |
| 96 | DEF_FIXED("cp", R8A7795_CLK_CP, CLK_EXTAL, 2, 1), | 97 | DEF_FIXED("cp", R8A7795_CLK_CP, CLK_EXTAL, 2, 1), |
| @@ -833,9 +833,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { · 832 unmodified lines | |||
| 833 | 833 | ||
| 834 | /* perihp */ | 834 | /* perihp */ |
| 835 | GATE(0, "cpll_aclk_perihp_src", "cpll", CLK_IGNORE_UNUSED, | 835 | GATE(0, "cpll_aclk_perihp_src", "cpll", CLK_IGNORE_UNUSED, |
| 836 | RK3399_CLKGATE_CON(5), 0, GFLAGS), | ||
| 837 | GATE(0, "gpll_aclk_perihp_src", "gpll", CLK_IGNORE_UNUSED, | ||
| 838 | RK3399_CLKGATE_CON(5), 1, GFLAGS), | 836 | RK3399_CLKGATE_CON(5), 1, GFLAGS), |
| 837 | GATE(0, "gpll_aclk_perihp_src", "gpll", CLK_IGNORE_UNUSED, | ||
| 838 | RK3399_CLKGATE_CON(5), 0, GFLAGS), | ||
| 839 | COMPOSITE(ACLK_PERIHP, "aclk_perihp", mux_aclk_perihp_p, CLK_IGNORE_UNUSED, | 839 | COMPOSITE(ACLK_PERIHP, "aclk_perihp", mux_aclk_perihp_p, CLK_IGNORE_UNUSED, |
| 840 | RK3399_CLKSEL_CON(14), 7, 1, MFLAGS, 0, 5, DFLAGS, | 840 | RK3399_CLKSEL_CON(14), 7, 1, MFLAGS, 0, 5, DFLAGS, |
| 841 | RK3399_CLKGATE_CON(5), 2, GFLAGS), | 841 | RK3399_CLKGATE_CON(5), 2, GFLAGS), |
| @@ -923,9 +923,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { · 81 unmodified lines | |||
| 923 | RK3399_CLKGATE_CON(6), 14, GFLAGS), | 923 | RK3399_CLKGATE_CON(6), 14, GFLAGS), |
| 924 | 924 | ||
| 925 | GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED, | 925 | GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED, |
| 926 | RK3399_CLKGATE_CON(6), 12, GFLAGS), | ||
| 927 | GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED, | ||
| 928 | RK3399_CLKGATE_CON(6), 13, GFLAGS), | 926 | RK3399_CLKGATE_CON(6), 13, GFLAGS), |
| 927 | GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED, | ||
| 928 | RK3399_CLKGATE_CON(6), 12, GFLAGS), | ||
| 929 | COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, CLK_IGNORE_UNUSED, | 929 | COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, CLK_IGNORE_UNUSED, |
| 930 | RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS), | 930 | RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS), |
| 931 | GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED, | 931 | GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED, |
| @@ -1071,7 +1071,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { · 139 unmodified lines | |||
| 1071 | /* vio */ | 1071 | /* vio */ |
| 1072 | COMPOSITE(ACLK_VIO, "aclk_vio", mux_pll_src_cpll_gpll_ppll_p, CLK_IGNORE_UNUSED, | 1072 | COMPOSITE(ACLK_VIO, "aclk_vio", mux_pll_src_cpll_gpll_ppll_p, CLK_IGNORE_UNUSED, |
| 1073 | RK3399_CLKSEL_CON(42), 6, 2, MFLAGS, 0, 5, DFLAGS, | 1073 | RK3399_CLKSEL_CON(42), 6, 2, MFLAGS, 0, 5, DFLAGS, |
| 1074 | RK3399_CLKGATE_CON(11), 10, GFLAGS), | 1074 | RK3399_CLKGATE_CON(11), 0, GFLAGS), |
| 1075 | COMPOSITE_NOMUX(PCLK_VIO, "pclk_vio", "aclk_vio", 0, | 1075 | COMPOSITE_NOMUX(PCLK_VIO, "pclk_vio", "aclk_vio", 0, |
| 1076 | RK3399_CLKSEL_CON(43), 0, 5, DFLAGS, | 1076 | RK3399_CLKSEL_CON(43), 0, 5, DFLAGS, |
| 1077 | RK3399_CLKGATE_CON(11), 1, GFLAGS), | 1077 | RK3399_CLKGATE_CON(11), 1, GFLAGS), |
| @@ -1484,6 +1484,7 @@ static const char *const rk3399_cru_critical_clocks[] __initconst = { · 406 unmodified lines | |||
| 1484 | "hclk_perilp1", | 1484 | "hclk_perilp1", |
| 1485 | "hclk_perilp1_noc", | 1485 | "hclk_perilp1_noc", |
| 1486 | "aclk_dmac0_perilp", | 1486 | "aclk_dmac0_perilp", |
| 1487 | "aclk_emmc_noc", | ||
| 1487 | "gpll_hclk_perilp1_src", | 1488 | "gpll_hclk_perilp1_src", |
| 1488 | "gpll_aclk_perilp0_src", | 1489 | "gpll_aclk_perilp0_src", |
| 1489 | "gpll_aclk_perihp_src", | 1490 | "gpll_aclk_perihp_src", |
| @@ -783,14 +783,14 @@ static struct ccu_reset_map sun8i_h3_ccu_resets[] = { · 782 unmodified lines | |||
| 783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, | 783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, |
| 784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, | 784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, |
| 785 | 785 | ||
| 786 | [RST_BUS_I2C0] = { 0x2d4, BIT(0) }, | 786 | [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, |
| 787 | [RST_BUS_I2C1] = { 0x2d4, BIT(1) }, | 787 | [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, |
| 788 | [RST_BUS_I2C2] = { 0x2d4, BIT(2) }, | 788 | [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, |
| 789 | [RST_BUS_UART0] = { 0x2d4, BIT(16) }, | 789 | [RST_BUS_UART0] = { 0x2d8, BIT(16) }, |
| 790 | [RST_BUS_UART1] = { 0x2d4, BIT(17) }, | 790 | [RST_BUS_UART1] = { 0x2d8, BIT(17) }, |
| 791 | [RST_BUS_UART2] = { 0x2d4, BIT(18) }, | 791 | [RST_BUS_UART2] = { 0x2d8, BIT(18) }, |
| 792 | [RST_BUS_UART3] = { 0x2d4, BIT(19) }, | 792 | [RST_BUS_UART3] = { 0x2d8, BIT(19) }, |
| 793 | [RST_BUS_SCR] = { 0x2d4, BIT(20) }, | 793 | [RST_BUS_SCR] = { 0x2d8, BIT(20) }, |
| 794 | }; | 794 | }; |
| 795 | 795 | ||
| 796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { | 796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { |
| @@ -31,7 +31,7 @@ void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock) · 30 unmodified lines | |||
| 31 | return; | 31 | return; |
| 32 | 32 | ||
| 33 | WARN_ON(readl_relaxed_poll_timeout(common->base + common->reg, reg, | 33 | WARN_ON(readl_relaxed_poll_timeout(common->base + common->reg, reg, |
| 34 | !(reg & lock), 100, 70000)); | 34 | reg & lock, 100, 70000)); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, | 37 | int sunxi_ccu_probe(struct device_node *node, void __iomem *reg, |
| @@ -14,9 +14,9 @@ · 13 unmodified lines | |||
| 14 | #include "ccu_gate.h" | 14 | #include "ccu_gate.h" |
| 15 | #include "ccu_nk.h" | 15 | #include "ccu_nk.h" |
| 16 | 16 | ||
| 17 | void ccu_nk_find_best(unsigned long parent, unsigned long rate, | 17 | static void ccu_nk_find_best(unsigned long parent, unsigned long rate, |
| 18 | unsigned int max_n, unsigned int max_k, | 18 | unsigned int max_n, unsigned int max_k, |
| 19 | unsigned int *n, unsigned int *k) | 19 | unsigned int *n, unsigned int *k) |
| 20 | { | 20 | { |
| 21 | unsigned long best_rate = 0; | 21 | unsigned long best_rate = 0; |
| 22 | unsigned int best_k = 0, best_n = 0; | 22 | unsigned int best_k = 0, best_n = 0; |
| @@ -73,7 +73,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, · 72 unmodified lines | |||
| 73 | SUN4I_PLL2_PRE_DIV_WIDTH, | 73 | SUN4I_PLL2_PRE_DIV_WIDTH, |
| 74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | 74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
| 75 | &sun4i_a10_pll2_lock); | 75 | &sun4i_a10_pll2_lock); |
| 76 | if (!prediv_clk) { | 76 | if (IS_ERR(prediv_clk)) { |
| 77 | pr_err("Couldn't register the prediv clock\n"); | 77 | pr_err("Couldn't register the prediv clock\n"); |
| 78 | goto err_free_array; | 78 | goto err_free_array; |
| 79 | } | 79 | } |
| @@ -106,7 +106,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, · 26 unmodified lines | |||
| 106 | &mult->hw, &clk_multiplier_ops, | 106 | &mult->hw, &clk_multiplier_ops, |
| 107 | &gate->hw, &clk_gate_ops, | 107 | &gate->hw, &clk_gate_ops, |
| 108 | CLK_SET_RATE_PARENT); | 108 | CLK_SET_RATE_PARENT); |
| 109 | if (!base_clk) { | 109 | if (IS_ERR(base_clk)) { |
| 110 | pr_err("Couldn't register the base multiplier clock\n"); | 110 | pr_err("Couldn't register the base multiplier clock\n"); |
| 111 | goto err_free_multiplier; | 111 | goto err_free_multiplier; |
| 112 | } | 112 | } |
| @@ -48,7 +48,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) · 47 unmodified lines | |||
| 48 | return; | 48 | return; |
| 49 | 49 | ||
| 50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); | 50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); |
| 51 | if (!reg) { | 51 | if (IS_ERR(reg)) { |
| 52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); | 52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); |
| 53 | goto err_free_parents; | 53 | goto err_free_parents; |
| 54 | } | 54 | } |
| @@ -428,7 +428,7 @@ static struct tegra_clk_pll_params pll_d_params = { · 427 unmodified lines | |||
| 428 | .div_nmp = &pllp_nmp, | 428 | .div_nmp = &pllp_nmp, |
| 429 | .freq_table = pll_d_freq_table, | 429 | .freq_table = pll_d_freq_table, |
| 430 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 430 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
| 431 | TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE, | 431 | TEGRA_PLL_HAS_LOCK_ENABLE, |
| 432 | }; | 432 | }; |
| 433 | 433 | ||
| 434 | static struct tegra_clk_pll_params pll_d2_params = { | 434 | static struct tegra_clk_pll_params pll_d2_params = { |
| @@ -446,7 +446,7 @@ static struct tegra_clk_pll_params pll_d2_params = { · 11 unmodified lines | |||
| 446 | .div_nmp = &pllp_nmp, | 446 | .div_nmp = &pllp_nmp, |
| 447 | .freq_table = pll_d_freq_table, | 447 | .freq_table = pll_d_freq_table, |
| 448 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 448 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
| 449 | TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE, | 449 | TEGRA_PLL_HAS_LOCK_ENABLE, |
| 450 | }; | 450 | }; |
| 451 | 451 | ||
| 452 | static const struct pdiv_map pllu_p[] = { | 452 | static const struct pdiv_map pllu_p[] = { |
| @@ -21,6 +21,8 @@ · 20 unmodified lines | |||
| 21 | #include <linux/of_irq.h> | 21 | #include <linux/of_irq.h> |
| 22 | #include <linux/sched_clock.h> | 22 | #include <linux/sched_clock.h> |
| 23 | 23 | ||
| 24 | #include <clocksource/pxa.h> | ||
| 25 | |||
| 24 | #include <asm/div64.h> | 26 | #include <asm/div64.h> |
| 25 | 27 | ||
| 26 | #define OSMR0 0x00 /* OS Timer 0 Match Register */ | 28 | #define OSMR0 0x00 /* OS Timer 0 Match Register */ |
| @@ -123,12 +123,16 @@ static struct clock_event_device sun4i_clockevent = { · 122 unmodified lines | |||
| 123 | .set_next_event = sun4i_clkevt_next_event, | 123 | .set_next_event = sun4i_clkevt_next_event, |
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | static void sun4i_timer_clear_interrupt(void) | ||
| 127 | { | ||
| 128 | writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG); | ||
| 129 | } | ||
| 126 | 130 | ||
| 127 | static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id) | 131 | static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id) |
| 128 | { | 132 | { |
| 129 | struct clock_event_device *evt = (struct clock_event_device *)dev_id; | 133 | struct clock_event_device *evt = (struct clock_event_device *)dev_id; |
| 130 | 134 | ||
| 131 | writel(0x1, timer_base + TIMER_IRQ_ST_REG); | 135 | sun4i_timer_clear_interrupt(); |
| 132 | evt->event_handler(evt); | 136 | evt->event_handler(evt); |
| 133 | 137 | ||
| 134 | return IRQ_HANDLED; | 138 | return IRQ_HANDLED; |
| @@ -208,6 +212,9 @@ static int __init sun4i_timer_init(struct device_node *node) · 73 unmodified lines | |||
| 208 | /* Make sure timer is stopped before playing with interrupts */ | 212 | /* Make sure timer is stopped before playing with interrupts */ |
| 209 | sun4i_clkevt_time_stop(0); | 213 | sun4i_clkevt_time_stop(0); |
| 210 | 214 | ||
| 215 | /* clear timer0 interrupt */ | ||
| 216 | sun4i_timer_clear_interrupt(); | ||
| 217 | |||
| 211 | sun4i_clockevent.cpumask = cpu_possible_mask; | 218 | sun4i_clockevent.cpumask = cpu_possible_mask; |
| 212 | sun4i_clockevent.irq = irq; | 219 | sun4i_clockevent.irq = irq; |
| 213 | 220 | ||
| @@ -202,10 +202,10 @@ static int __init pistachio_clksrc_of_init(struct device_node *node) · 201 unmodified lines | |||
| 202 | rate = clk_get_rate(fast_clk); | 202 | rate = clk_get_rate(fast_clk); |
| 203 | 203 | ||
| 204 | /* Disable irq's for clocksource usage */ | 204 | /* Disable irq's for clocksource usage */ |
| 205 | gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 0); | 205 | gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 0); |
| 206 | gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 1); | 206 | gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 1); |
| 207 | gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 2); | 207 | gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 2); |
| 208 | gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 3); | 208 | gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 3); |
| 209 | 209 | ||
| 210 | /* Enable timer block */ | 210 | /* Enable timer block */ |
| 211 | writel(TIMER_ME_GLOBAL, pcs_gpt.base); | 211 | writel(TIMER_ME_GLOBAL, pcs_gpt.base); |
| @@ -240,6 +240,7 @@ static int __init at91sam926x_pit_common_init(struct pit_data *data) · 239 unmodified lines | |||
| 240 | static int __init at91sam926x_pit_dt_init(struct device_node *node) | 240 | static int __init at91sam926x_pit_dt_init(struct device_node *node) |
| 241 | { | 241 | { |
| 242 | struct pit_data *data; | 242 | struct pit_data *data; |
| 243 | int ret; | ||
| 243 | 244 | ||
| 244 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 245 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 245 | if (!data) | 246 | if (!data) |
| @@ -261,6 +262,12 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) · 15 unmodified lines | |||
| 261 | return PTR_ERR(data->mck); | 262 | return PTR_ERR(data->mck); |
| 262 | } | 263 | } |
| 263 | 264 | ||
| 265 | ret = clk_prepare_enable(data->mck); | ||
| 266 | if (ret) { | ||
| 267 | pr_err("Unable to enable mck\n"); | ||
| 268 | return ret; | ||
| 269 | } | ||
| 270 | |||
| 264 | /* Get the interrupts property */ | 271 | /* Get the interrupts property */ |
| 265 | data->irq = irq_of_parse_and_map(node, 0); | 272 | data->irq = irq_of_parse_and_map(node, 0); |
| 266 | if (!data->irq) { | 273 | if (!data->irq) { |
| @@ -74,6 +74,8 @@ static const struct of_device_id machines[] __initconst = { · 73 unmodified lines | |||
| 74 | { .compatible = "ti,omap5", }, | 74 | { .compatible = "ti,omap5", }, |
| 75 | 75 | ||
| 76 | { .compatible = "xlnx,zynq-7000", }, | 76 | { .compatible = "xlnx,zynq-7000", }, |
| 77 | |||
| 78 | { } | ||
| 77 | }; | 79 | }; |
| 78 | 80 | ||
| 79 | static int __init cpufreq_dt_platdev_init(void) | 81 | static int __init cpufreq_dt_platdev_init(void) |
| @@ -556,7 +556,10 @@ skip_enc: · 555 unmodified lines | |||
| 556 | 556 | ||
| 557 | /* Read and write assoclen bytes */ | 557 | /* Read and write assoclen bytes */ |
| 558 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); | 558 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); |
| 559 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); | 559 | if (alg->caam.geniv) |
| 560 | append_math_add_imm_u32(desc, VARSEQOUTLEN, REG3, IMM, ivsize); | ||
| 561 | else | ||
| 562 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); | ||
| 560 | 563 | ||
| 561 | /* Skip assoc data */ | 564 | /* Skip assoc data */ |
| 562 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); | 565 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); |
| @@ -565,6 +568,14 @@ skip_enc: · 2 unmodified lines | |||
| 565 | append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_MSG | | 568 | append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_MSG | |
| 566 | KEY_VLF); | 569 | KEY_VLF); |
| 567 | 570 | ||
| 571 | if (alg->caam.geniv) { | ||
| 572 | append_seq_load(desc, ivsize, LDST_CLASS_1_CCB | | ||
| 573 | LDST_SRCDST_BYTE_CONTEXT | | ||
| 574 | (ctx1_iv_off << LDST_OFFSET_SHIFT)); | ||
| 575 | append_move(desc, MOVE_SRC_CLASS1CTX | MOVE_DEST_CLASS2INFIFO | | ||
| 576 | (ctx1_iv_off << MOVE_OFFSET_SHIFT) | ivsize); | ||
| 577 | } | ||
| 578 | |||
| 568 | /* Load Counter into CONTEXT1 reg */ | 579 | /* Load Counter into CONTEXT1 reg */ |
| 569 | if (is_rfc3686) | 580 | if (is_rfc3686) |
| 570 | append_load_imm_u32(desc, be32_to_cpu(1), LDST_IMM | | 581 | append_load_imm_u32(desc, be32_to_cpu(1), LDST_IMM | |
| @@ -2150,7 +2161,7 @@ static void init_authenc_job(struct aead_request *req, · 1579 unmodified lines | |||
| 2150 | 2161 | ||
| 2151 | init_aead_job(req, edesc, all_contig, encrypt); | 2162 | init_aead_job(req, edesc, all_contig, encrypt); |
| 2152 | 2163 | ||
| 2153 | if (ivsize && (is_rfc3686 || !(alg->caam.geniv && encrypt))) | 2164 | if (ivsize && ((is_rfc3686 && encrypt) || !alg->caam.geniv)) |
| 2154 | append_load_as_imm(desc, req->iv, ivsize, | 2165 | append_load_as_imm(desc, req->iv, ivsize, |
| 2155 | LDST_CLASS_1_CCB | | 2166 | LDST_CLASS_1_CCB | |
| 2156 | LDST_SRCDST_BYTE_CONTEXT | | 2167 | LDST_SRCDST_BYTE_CONTEXT | |
| @@ -2537,20 +2548,6 @@ static int aead_decrypt(struct aead_request *req) · 380 unmodified lines | |||
| 2537 | return ret; | 2548 | return ret; |
| 2538 | } | 2549 | } |
| 2539 | 2550 | ||
| 2540 | static int aead_givdecrypt(struct aead_request *req) | ||
| 2541 | { | ||
| 2542 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | ||
| 2543 | unsigned int ivsize = crypto_aead_ivsize(aead); | ||
| 2544 | |||
| 2545 | if (req->cryptlen < ivsize) | ||
| 2546 | return -EINVAL; | ||
| 2547 | |||
| 2548 | req->cryptlen -= ivsize; | ||
| 2549 | req->assoclen += ivsize; | ||
| 2550 | |||
| 2551 | return aead_decrypt(req); | ||
| 2552 | } | ||
| 2553 | |||
| 2554 | /* | 2551 | /* |
| 2555 | * allocate and map the ablkcipher extended descriptor for ablkcipher | 2552 | * allocate and map the ablkcipher extended descriptor for ablkcipher |
| 2556 | */ | 2553 | */ |
| @@ -3210,7 +3207,7 @@ static struct caam_aead_alg driver_aeads[] = { · 653 unmodified lines | |||
| 3210 | .setkey = aead_setkey, | 3207 | .setkey = aead_setkey, |
| 3211 | .setauthsize = aead_setauthsize, | 3208 | .setauthsize = aead_setauthsize, |
| 3212 | .encrypt = aead_encrypt, | 3209 | .encrypt = aead_encrypt, |
| 3213 | .decrypt = aead_givdecrypt, | 3210 | .decrypt = aead_decrypt, |
| 3214 | .ivsize = AES_BLOCK_SIZE, | 3211 | .ivsize = AES_BLOCK_SIZE, |
| 3215 | .maxauthsize = MD5_DIGEST_SIZE, | 3212 | .maxauthsize = MD5_DIGEST_SIZE, |
| 3216 | }, | 3213 | }, |
| @@ -3256,7 +3253,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3256 | .setkey = aead_setkey, | 3253 | .setkey = aead_setkey, |
| 3257 | .setauthsize = aead_setauthsize, | 3254 | .setauthsize = aead_setauthsize, |
| 3258 | .encrypt = aead_encrypt, | 3255 | .encrypt = aead_encrypt, |
| 3259 | .decrypt = aead_givdecrypt, | 3256 | .decrypt = aead_decrypt, |
| 3260 | .ivsize = AES_BLOCK_SIZE, | 3257 | .ivsize = AES_BLOCK_SIZE, |
| 3261 | .maxauthsize = SHA1_DIGEST_SIZE, | 3258 | .maxauthsize = SHA1_DIGEST_SIZE, |
| 3262 | }, | 3259 | }, |
| @@ -3302,7 +3299,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3302 | .setkey = aead_setkey, | 3299 | .setkey = aead_setkey, |
| 3303 | .setauthsize = aead_setauthsize, | 3300 | .setauthsize = aead_setauthsize, |
| 3304 | .encrypt = aead_encrypt, | 3301 | .encrypt = aead_encrypt, |
| 3305 | .decrypt = aead_givdecrypt, | 3302 | .decrypt = aead_decrypt, |
| 3306 | .ivsize = AES_BLOCK_SIZE, | 3303 | .ivsize = AES_BLOCK_SIZE, |
| 3307 | .maxauthsize = SHA224_DIGEST_SIZE, | 3304 | .maxauthsize = SHA224_DIGEST_SIZE, |
| 3308 | }, | 3305 | }, |
| @@ -3348,7 +3345,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3348 | .setkey = aead_setkey, | 3345 | .setkey = aead_setkey, |
| 3349 | .setauthsize = aead_setauthsize, | 3346 | .setauthsize = aead_setauthsize, |
| 3350 | .encrypt = aead_encrypt, | 3347 | .encrypt = aead_encrypt, |
| 3351 | .decrypt = aead_givdecrypt, | 3348 | .decrypt = aead_decrypt, |
| 3352 | .ivsize = AES_BLOCK_SIZE, | 3349 | .ivsize = AES_BLOCK_SIZE, |
| 3353 | .maxauthsize = SHA256_DIGEST_SIZE, | 3350 | .maxauthsize = SHA256_DIGEST_SIZE, |
| 3354 | }, | 3351 | }, |
| @@ -3394,7 +3391,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3394 | .setkey = aead_setkey, | 3391 | .setkey = aead_setkey, |
| 3395 | .setauthsize = aead_setauthsize, | 3392 | .setauthsize = aead_setauthsize, |
| 3396 | .encrypt = aead_encrypt, | 3393 | .encrypt = aead_encrypt, |
| 3397 | .decrypt = aead_givdecrypt, | 3394 | .decrypt = aead_decrypt, |
| 3398 | .ivsize = AES_BLOCK_SIZE, | 3395 | .ivsize = AES_BLOCK_SIZE, |
| 3399 | .maxauthsize = SHA384_DIGEST_SIZE, | 3396 | .maxauthsize = SHA384_DIGEST_SIZE, |
| 3400 | }, | 3397 | }, |
| @@ -3440,7 +3437,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3440 | .setkey = aead_setkey, | 3437 | .setkey = aead_setkey, |
| 3441 | .setauthsize = aead_setauthsize, | 3438 | .setauthsize = aead_setauthsize, |
| 3442 | .encrypt = aead_encrypt, | 3439 | .encrypt = aead_encrypt, |
| 3443 | .decrypt = aead_givdecrypt, | 3440 | .decrypt = aead_decrypt, |
| 3444 | .ivsize = AES_BLOCK_SIZE, | 3441 | .ivsize = AES_BLOCK_SIZE, |
| 3445 | .maxauthsize = SHA512_DIGEST_SIZE, | 3442 | .maxauthsize = SHA512_DIGEST_SIZE, |
| 3446 | }, | 3443 | }, |
| @@ -3486,7 +3483,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3486 | .setkey = aead_setkey, | 3483 | .setkey = aead_setkey, |
| 3487 | .setauthsize = aead_setauthsize, | 3484 | .setauthsize = aead_setauthsize, |
| 3488 | .encrypt = aead_encrypt, | 3485 | .encrypt = aead_encrypt, |
| 3489 | .decrypt = aead_givdecrypt, | 3486 | .decrypt = aead_decrypt, |
| 3490 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3487 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3491 | .maxauthsize = MD5_DIGEST_SIZE, | 3488 | .maxauthsize = MD5_DIGEST_SIZE, |
| 3492 | }, | 3489 | }, |
| @@ -3534,7 +3531,7 @@ static struct caam_aead_alg driver_aeads[] = { · 41 unmodified lines | |||
| 3534 | .setkey = aead_setkey, | 3531 | .setkey = aead_setkey, |
| 3535 | .setauthsize = aead_setauthsize, | 3532 | .setauthsize = aead_setauthsize, |
| 3536 | .encrypt = aead_encrypt, | 3533 | .encrypt = aead_encrypt, |
| 3537 | .decrypt = aead_givdecrypt, | 3534 | .decrypt = aead_decrypt, |
| 3538 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3535 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3539 | .maxauthsize = SHA1_DIGEST_SIZE, | 3536 | .maxauthsize = SHA1_DIGEST_SIZE, |
| 3540 | }, | 3537 | }, |
| @@ -3582,7 +3579,7 @@ static struct caam_aead_alg driver_aeads[] = { · 41 unmodified lines | |||
| 3582 | .setkey = aead_setkey, | 3579 | .setkey = aead_setkey, |
| 3583 | .setauthsize = aead_setauthsize, | 3580 | .setauthsize = aead_setauthsize, |
| 3584 | .encrypt = aead_encrypt, | 3581 | .encrypt = aead_encrypt, |
| 3585 | .decrypt = aead_givdecrypt, | 3582 | .decrypt = aead_decrypt, |
| 3586 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3583 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3587 | .maxauthsize = SHA224_DIGEST_SIZE, | 3584 | .maxauthsize = SHA224_DIGEST_SIZE, |
| 3588 | }, | 3585 | }, |
| @@ -3630,7 +3627,7 @@ static struct caam_aead_alg driver_aeads[] = { · 41 unmodified lines | |||
| 3630 | .setkey = aead_setkey, | 3627 | .setkey = aead_setkey, |
| 3631 | .setauthsize = aead_setauthsize, | 3628 | .setauthsize = aead_setauthsize, |
| 3632 | .encrypt = aead_encrypt, | 3629 | .encrypt = aead_encrypt, |
| 3633 | .decrypt = aead_givdecrypt, | 3630 | .decrypt = aead_decrypt, |
| 3634 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3631 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3635 | .maxauthsize = SHA256_DIGEST_SIZE, | 3632 | .maxauthsize = SHA256_DIGEST_SIZE, |
| 3636 | }, | 3633 | }, |
| @@ -3678,7 +3675,7 @@ static struct caam_aead_alg driver_aeads[] = { · 41 unmodified lines | |||
| 3678 | .setkey = aead_setkey, | 3675 | .setkey = aead_setkey, |
| 3679 | .setauthsize = aead_setauthsize, | 3676 | .setauthsize = aead_setauthsize, |
| 3680 | .encrypt = aead_encrypt, | 3677 | .encrypt = aead_encrypt, |
| 3681 | .decrypt = aead_givdecrypt, | 3678 | .decrypt = aead_decrypt, |
| 3682 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3679 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3683 | .maxauthsize = SHA384_DIGEST_SIZE, | 3680 | .maxauthsize = SHA384_DIGEST_SIZE, |
| 3684 | }, | 3681 | }, |
| @@ -3726,7 +3723,7 @@ static struct caam_aead_alg driver_aeads[] = { · 41 unmodified lines | |||
| 3726 | .setkey = aead_setkey, | 3723 | .setkey = aead_setkey, |
| 3727 | .setauthsize = aead_setauthsize, | 3724 | .setauthsize = aead_setauthsize, |
| 3728 | .encrypt = aead_encrypt, | 3725 | .encrypt = aead_encrypt, |
| 3729 | .decrypt = aead_givdecrypt, | 3726 | .decrypt = aead_decrypt, |
| 3730 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3727 | .ivsize = DES3_EDE_BLOCK_SIZE, |
| 3731 | .maxauthsize = SHA512_DIGEST_SIZE, | 3728 | .maxauthsize = SHA512_DIGEST_SIZE, |
| 3732 | }, | 3729 | }, |
| @@ -3772,7 +3769,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3772 | .setkey = aead_setkey, | 3769 | .setkey = aead_setkey, |
| 3773 | .setauthsize = aead_setauthsize, | 3770 | .setauthsize = aead_setauthsize, |
| 3774 | .encrypt = aead_encrypt, | 3771 | .encrypt = aead_encrypt, |
| 3775 | .decrypt = aead_givdecrypt, | 3772 | .decrypt = aead_decrypt, |
| 3776 | .ivsize = DES_BLOCK_SIZE, | 3773 | .ivsize = DES_BLOCK_SIZE, |
| 3777 | .maxauthsize = MD5_DIGEST_SIZE, | 3774 | .maxauthsize = MD5_DIGEST_SIZE, |
| 3778 | }, | 3775 | }, |
| @@ -3818,7 +3815,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3818 | .setkey = aead_setkey, | 3815 | .setkey = aead_setkey, |
| 3819 | .setauthsize = aead_setauthsize, | 3816 | .setauthsize = aead_setauthsize, |
| 3820 | .encrypt = aead_encrypt, | 3817 | .encrypt = aead_encrypt, |
| 3821 | .decrypt = aead_givdecrypt, | 3818 | .decrypt = aead_decrypt, |
| 3822 | .ivsize = DES_BLOCK_SIZE, | 3819 | .ivsize = DES_BLOCK_SIZE, |
| 3823 | .maxauthsize = SHA1_DIGEST_SIZE, | 3820 | .maxauthsize = SHA1_DIGEST_SIZE, |
| 3824 | }, | 3821 | }, |
| @@ -3864,7 +3861,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3864 | .setkey = aead_setkey, | 3861 | .setkey = aead_setkey, |
| 3865 | .setauthsize = aead_setauthsize, | 3862 | .setauthsize = aead_setauthsize, |
| 3866 | .encrypt = aead_encrypt, | 3863 | .encrypt = aead_encrypt, |
| 3867 | .decrypt = aead_givdecrypt, | 3864 | .decrypt = aead_decrypt, |
| 3868 | .ivsize = DES_BLOCK_SIZE, | 3865 | .ivsize = DES_BLOCK_SIZE, |
| 3869 | .maxauthsize = SHA224_DIGEST_SIZE, | 3866 | .maxauthsize = SHA224_DIGEST_SIZE, |
| 3870 | }, | 3867 | }, |
| @@ -3910,7 +3907,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3910 | .setkey = aead_setkey, | 3907 | .setkey = aead_setkey, |
| 3911 | .setauthsize = aead_setauthsize, | 3908 | .setauthsize = aead_setauthsize, |
| 3912 | .encrypt = aead_encrypt, | 3909 | .encrypt = aead_encrypt, |
| 3913 | .decrypt = aead_givdecrypt, | 3910 | .decrypt = aead_decrypt, |
| 3914 | .ivsize = DES_BLOCK_SIZE, | 3911 | .ivsize = DES_BLOCK_SIZE, |
| 3915 | .maxauthsize = SHA256_DIGEST_SIZE, | 3912 | .maxauthsize = SHA256_DIGEST_SIZE, |
| 3916 | }, | 3913 | }, |
| @@ -3956,7 +3953,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 3956 | .setkey = aead_setkey, | 3953 | .setkey = aead_setkey, |
| 3957 | .setauthsize = aead_setauthsize, | 3954 | .setauthsize = aead_setauthsize, |
| 3958 | .encrypt = aead_encrypt, | 3955 | .encrypt = aead_encrypt, |
| 3959 | .decrypt = aead_givdecrypt, | 3956 | .decrypt = aead_decrypt, |
| 3960 | .ivsize = DES_BLOCK_SIZE, | 3957 | .ivsize = DES_BLOCK_SIZE, |
| 3961 | .maxauthsize = SHA384_DIGEST_SIZE, | 3958 | .maxauthsize = SHA384_DIGEST_SIZE, |
| 3962 | }, | 3959 | }, |
| @@ -4002,7 +3999,7 @@ static struct caam_aead_alg driver_aeads[] = { · 39 unmodified lines | |||
| 4002 | .setkey = aead_setkey, | 3999 | .setkey = aead_setkey, |
| 4003 | .setauthsize = aead_setauthsize, | 4000 | .setauthsize = aead_setauthsize, |
| 4004 | .encrypt = aead_encrypt, | 4001 | .encrypt = aead_encrypt, |
| 4005 | .decrypt = aead_givdecrypt, | 4002 | .decrypt = aead_decrypt, |
| 4006 | .ivsize = DES_BLOCK_SIZE, | 4003 | .ivsize = DES_BLOCK_SIZE, |
| 4007 | .maxauthsize = SHA512_DIGEST_SIZE, | 4004 | .maxauthsize = SHA512_DIGEST_SIZE, |
| 4008 | }, | 4005 | }, |
| @@ -4051,7 +4048,7 @@ static struct caam_aead_alg driver_aeads[] = { · 42 unmodified lines | |||
| 4051 | .setkey = aead_setkey, | 4048 | .setkey = aead_setkey, |
| 4052 | .setauthsize = aead_setauthsize, | 4049 | .setauthsize = aead_setauthsize, |
| 4053 | .encrypt = aead_encrypt, | 4050 | .encrypt = aead_encrypt, |
| 4054 | .decrypt = aead_givdecrypt, | 4051 | .decrypt = aead_decrypt, |
| 4055 | .ivsize = CTR_RFC3686_IV_SIZE, | 4052 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4056 | .maxauthsize = MD5_DIGEST_SIZE, | 4053 | .maxauthsize = MD5_DIGEST_SIZE, |
| 4057 | }, | 4054 | }, |
| @@ -4102,7 +4099,7 @@ static struct caam_aead_alg driver_aeads[] = { · 44 unmodified lines | |||
| 4102 | .setkey = aead_setkey, | 4099 | .setkey = aead_setkey, |
| 4103 | .setauthsize = aead_setauthsize, | 4100 | .setauthsize = aead_setauthsize, |
| 4104 | .encrypt = aead_encrypt, | 4101 | .encrypt = aead_encrypt, |
| 4105 | .decrypt = aead_givdecrypt, | 4102 | .decrypt = aead_decrypt, |
| 4106 | .ivsize = CTR_RFC3686_IV_SIZE, | 4103 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4107 | .maxauthsize = SHA1_DIGEST_SIZE, | 4104 | .maxauthsize = SHA1_DIGEST_SIZE, |
| 4108 | }, | 4105 | }, |
| @@ -4153,7 +4150,7 @@ static struct caam_aead_alg driver_aeads[] = { · 44 unmodified lines | |||
| 4153 | .setkey = aead_setkey, | 4150 | .setkey = aead_setkey, |
| 4154 | .setauthsize = aead_setauthsize, | 4151 | .setauthsize = aead_setauthsize, |
| 4155 | .encrypt = aead_encrypt, | 4152 | .encrypt = aead_encrypt, |
| 4156 | .decrypt = aead_givdecrypt, | 4153 | .decrypt = aead_decrypt, |
| 4157 | .ivsize = CTR_RFC3686_IV_SIZE, | 4154 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4158 | .maxauthsize = SHA224_DIGEST_SIZE, | 4155 | .maxauthsize = SHA224_DIGEST_SIZE, |
| 4159 | }, | 4156 | }, |
| @@ -4204,7 +4201,7 @@ static struct caam_aead_alg driver_aeads[] = { · 44 unmodified lines | |||
| 4204 | .setkey = aead_setkey, | 4201 | .setkey = aead_setkey, |
| 4205 | .setauthsize = aead_setauthsize, | 4202 | .setauthsize = aead_setauthsize, |
| 4206 | .encrypt = aead_encrypt, | 4203 | .encrypt = aead_encrypt, |
| 4207 | .decrypt = aead_givdecrypt, | 4204 | .decrypt = aead_decrypt, |
| 4208 | .ivsize = CTR_RFC3686_IV_SIZE, | 4205 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4209 | .maxauthsize = SHA256_DIGEST_SIZE, | 4206 | .maxauthsize = SHA256_DIGEST_SIZE, |
| 4210 | }, | 4207 | }, |
| @@ -4255,7 +4252,7 @@ static struct caam_aead_alg driver_aeads[] = { · 44 unmodified lines | |||
| 4255 | .setkey = aead_setkey, | 4252 | .setkey = aead_setkey, |
| 4256 | .setauthsize = aead_setauthsize, | 4253 | .setauthsize = aead_setauthsize, |
| 4257 | .encrypt = aead_encrypt, | 4254 | .encrypt = aead_encrypt, |
| 4258 | .decrypt = aead_givdecrypt, | 4255 | .decrypt = aead_decrypt, |
| 4259 | .ivsize = CTR_RFC3686_IV_SIZE, | 4256 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4260 | .maxauthsize = SHA384_DIGEST_SIZE, | 4257 | .maxauthsize = SHA384_DIGEST_SIZE, |
| 4261 | }, | 4258 | }, |
| @@ -4306,7 +4303,7 @@ static struct caam_aead_alg driver_aeads[] = { · 44 unmodified lines | |||
| 4306 | .setkey = aead_setkey, | 4303 | .setkey = aead_setkey, |
| 4307 | .setauthsize = aead_setauthsize, | 4304 | .setauthsize = aead_setauthsize, |
| 4308 | .encrypt = aead_encrypt, | 4305 | .encrypt = aead_encrypt, |
| 4309 | .decrypt = aead_givdecrypt, | 4306 | .decrypt = aead_decrypt, |
| 4310 | .ivsize = CTR_RFC3686_IV_SIZE, | 4307 | .ivsize = CTR_RFC3686_IV_SIZE, |
| 4311 | .maxauthsize = SHA512_DIGEST_SIZE, | 4308 | .maxauthsize = SHA512_DIGEST_SIZE, |
| 4312 | }, | 4309 | }, |
| @@ -1260,8 +1260,8 @@ static struct crypto_alg qat_algs[] = { { · 1259 unmodified lines | |||
| 1260 | .setkey = qat_alg_ablkcipher_xts_setkey, | 1260 | .setkey = qat_alg_ablkcipher_xts_setkey, |
| 1261 | .decrypt = qat_alg_ablkcipher_decrypt, | 1261 | .decrypt = qat_alg_ablkcipher_decrypt, |
| 1262 | .encrypt = qat_alg_ablkcipher_encrypt, | 1262 | .encrypt = qat_alg_ablkcipher_encrypt, |
| 1263 | .min_keysize = AES_MIN_KEY_SIZE, | 1263 | .min_keysize = 2 * AES_MIN_KEY_SIZE, |
| 1264 | .max_keysize = AES_MAX_KEY_SIZE, | 1264 | .max_keysize = 2 * AES_MAX_KEY_SIZE, |
| 1265 | .ivsize = AES_BLOCK_SIZE, | 1265 | .ivsize = AES_BLOCK_SIZE, |
| 1266 | }, | 1266 | }, |
| 1267 | }, | 1267 | }, |
| @@ -129,8 +129,8 @@ static int p8_aes_xts_crypt(struct blkcipher_desc *desc, · 128 unmodified lines | |||
| 129 | 129 | ||
| 130 | blkcipher_walk_init(&walk, dst, src, nbytes); | 130 | blkcipher_walk_init(&walk, dst, src, nbytes); |
| 131 | 131 | ||
| 132 | iv = (u8 *)walk.iv; | ||
| 133 | ret = blkcipher_walk_virt(desc, &walk); | 132 | ret = blkcipher_walk_virt(desc, &walk); |
| 133 | iv = walk.iv; | ||
| 134 | memset(tweak, 0, AES_BLOCK_SIZE); | 134 | memset(tweak, 0, AES_BLOCK_SIZE); |
| 135 | aes_p8_encrypt(iv, tweak, &ctx->tweak_key); | 135 | aes_p8_encrypt(iv, tweak, &ctx->tweak_key); |
| 136 | 136 | ||
| @@ -459,7 +459,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev, · 458 unmodified lines | |||
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | pgoff = linear_page_index(vma, pmd_addr); | 461 | pgoff = linear_page_index(vma, pmd_addr); |
| 462 | phys = pgoff_to_phys(dax_dev, pgoff, PAGE_SIZE); | 462 | phys = pgoff_to_phys(dax_dev, pgoff, PMD_SIZE); |
| 463 | if (phys == -1) { | 463 | if (phys == -1) { |
| 464 | dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__, | 464 | dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__, |
| 465 | pgoff); | 465 | pgoff); |
| @@ -116,6 +116,9 @@ static int dax_pmem_probe(struct device *dev) · 115 unmodified lines | |||
| 116 | if (rc) | 116 | if (rc) |
| 117 | return rc; | 117 | return rc; |
| 118 | 118 | ||
| 119 | /* adjust the dax_region resource to the start of data */ | ||
| 120 | res.start += le64_to_cpu(pfn_sb->dataoff); | ||
| 121 | |||
| 119 | nd_region = to_nd_region(dev->parent); | 122 | nd_region = to_nd_region(dev->parent); |
| 120 | dax_region = alloc_dax_region(dev, nd_region->id, &res, | 123 | dax_region = alloc_dax_region(dev, nd_region->id, &res, |
| 121 | le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP); | 124 | le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP); |
| @@ -2067,7 +2067,7 @@ err_dma_unregister: · 2066 unmodified lines | |||
| 2067 | err_clk_disable: | 2067 | err_clk_disable: |
| 2068 | clk_disable_unprepare(atxdmac->clk); | 2068 | clk_disable_unprepare(atxdmac->clk); |
| 2069 | err_free_irq: | 2069 | err_free_irq: |
| 2070 | free_irq(atxdmac->irq, atxdmac->dma.dev); | 2070 | free_irq(atxdmac->irq, atxdmac); |
| 2071 | return ret; | 2071 | return ret; |
| 2072 | } | 2072 | } |
| 2073 | 2073 | ||
| @@ -2081,7 +2081,7 @@ static int at_xdmac_remove(struct platform_device *pdev) · 7 unmodified lines | |||
| 2081 | dma_async_device_unregister(&atxdmac->dma); | 2081 | dma_async_device_unregister(&atxdmac->dma); |
| 2082 | clk_disable_unprepare(atxdmac->clk); | 2082 | clk_disable_unprepare(atxdmac->clk); |
| 2083 | 2083 | ||
| 2084 | free_irq(atxdmac->irq, atxdmac->dma.dev); | 2084 | free_irq(atxdmac->irq, atxdmac); |
| 2085 | 2085 | ||
| 2086 | for (i = 0; i < atxdmac->dma.chancnt; i++) { | 2086 | for (i = 0; i < atxdmac->dma.chancnt; i++) { |
| 2087 | struct at_xdmac_chan *atchan = &atxdmac->chan[i]; | 2087 | struct at_xdmac_chan *atchan = &atxdmac->chan[i]; |
| @@ -836,6 +836,7 @@ static int fsl_re_probe(struct platform_device *ofdev) · 835 unmodified lines | |||
| 836 | rc = of_property_read_u32(np, "reg", &off); | 836 | rc = of_property_read_u32(np, "reg", &off); |
| 837 | if (rc) { | 837 | if (rc) { |
| 838 | dev_err(dev, "Reg property not found in JQ node\n"); | 838 | dev_err(dev, "Reg property not found in JQ node\n"); |
| 839 | of_node_put(np); | ||
| 839 | return -ENODEV; | 840 | return -ENODEV; |
| 840 | } | 841 | } |
| 841 | /* Find out the Job Rings present under each JQ */ | 842 | /* Find out the Job Rings present under each JQ */ |
| @@ -861,7 +861,6 @@ static int mdc_dma_probe(struct platform_device *pdev) · 860 unmodified lines | |||
| 861 | { | 861 | { |
| 862 | struct mdc_dma *mdma; | 862 | struct mdc_dma *mdma; |
| 863 | struct resource *res; | 863 | struct resource *res; |
| 864 | const struct of_device_id *match; | ||
| 865 | unsigned int i; | 864 | unsigned int i; |
| 866 | u32 val; | 865 | u32 val; |
| 867 | int ret; | 866 | int ret; |
| @@ -871,8 +870,7 @@ static int mdc_dma_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 871 | return -ENOMEM; | 870 | return -ENOMEM; |
| 872 | platform_set_drvdata(pdev, mdma); | 871 | platform_set_drvdata(pdev, mdma); |
| 873 | 872 | ||
| 874 | match = of_match_device(mdc_dma_of_match, &pdev->dev); | 873 | mdma->soc = of_device_get_match_data(&pdev->dev); |
| 875 | mdma->soc = match->data; | ||
| 876 | 874 | ||
| 877 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 875 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 878 | mdma->regs = devm_ioremap_resource(&pdev->dev, res); | 876 | mdma->regs = devm_ioremap_resource(&pdev->dev, res); |
| @@ -638,7 +638,7 @@ static bool pxad_try_hotchain(struct virt_dma_chan *vc, · 637 unmodified lines | |||
| 638 | vd_last_issued = list_entry(vc->desc_issued.prev, | 638 | vd_last_issued = list_entry(vc->desc_issued.prev, |
| 639 | struct virt_dma_desc, node); | 639 | struct virt_dma_desc, node); |
| 640 | pxad_desc_chain(vd_last_issued, vd); | 640 | pxad_desc_chain(vd_last_issued, vd); |
| 641 | if (is_chan_running(chan) || is_desc_completed(vd_last_issued)) | 641 | if (is_chan_running(chan) || is_desc_completed(vd)) |
| 642 | return true; | 642 | return true; |
| 643 | } | 643 | } |
| 644 | 644 | ||
| @@ -671,6 +671,7 @@ static irqreturn_t pxad_chan_handler(int irq, void *dev_id) · 26 unmodified lines | |||
| 671 | struct virt_dma_desc *vd, *tmp; | 671 | struct virt_dma_desc *vd, *tmp; |
| 672 | unsigned int dcsr; | 672 | unsigned int dcsr; |
| 673 | unsigned long flags; | 673 | unsigned long flags; |
| 674 | bool vd_completed; | ||
| 674 | dma_cookie_t last_started = 0; | 675 | dma_cookie_t last_started = 0; |
| 675 | 676 | ||
| 676 | BUG_ON(!chan); | 677 | BUG_ON(!chan); |
| @@ -681,15 +682,17 @@ static irqreturn_t pxad_chan_handler(int irq, void *dev_id) · 4 unmodified lines | |||
| 681 | 682 | ||
| 682 | spin_lock_irqsave(&chan->vc.lock, flags); | 683 | spin_lock_irqsave(&chan->vc.lock, flags); |
| 683 | list_for_each_entry_safe(vd, tmp, &chan->vc.desc_issued, node) { | 684 | list_for_each_entry_safe(vd, tmp, &chan->vc.desc_issued, node) { |
| 685 | vd_completed = is_desc_completed(vd); | ||
| 684 | dev_dbg(&chan->vc.chan.dev->device, | 686 | dev_dbg(&chan->vc.chan.dev->device, |
| 685 | "%s(): checking txd %p[%x]: completed=%d\n", | 687 | "%s(): checking txd %p[%x]: completed=%d dcsr=0x%x\n", |
| 686 | __func__, vd, vd->tx.cookie, is_desc_completed(vd)); | 688 | __func__, vd, vd->tx.cookie, vd_completed, |
| 689 | dcsr); | ||
| 687 | last_started = vd->tx.cookie; | 690 | last_started = vd->tx.cookie; |
| 688 | if (to_pxad_sw_desc(vd)->cyclic) { | 691 | if (to_pxad_sw_desc(vd)->cyclic) { |
| 689 | vchan_cyclic_callback(vd); | 692 | vchan_cyclic_callback(vd); |
| 690 | break; | 693 | break; |
| 691 | } | 694 | } |
| 692 | if (is_desc_completed(vd)) { | 695 | if (vd_completed) { |
| 693 | list_del(&vd->node); | 696 | list_del(&vd->node); |
| 694 | vchan_cookie_complete(vd); | 697 | vchan_cookie_complete(vd); |
| 695 | } else { | 698 | } else { |
| @@ -600,27 +600,30 @@ static irqreturn_t usb_dmac_isr_channel(int irq, void *dev) · 599 unmodified lines | |||
| 600 | { | 600 | { |
| 601 | struct usb_dmac_chan *chan = dev; | 601 | struct usb_dmac_chan *chan = dev; |
| 602 | irqreturn_t ret = IRQ_NONE; | 602 | irqreturn_t ret = IRQ_NONE; |
| 603 | u32 mask = USB_DMACHCR_TE; | 603 | u32 mask = 0; |
| 604 | u32 check_bits = USB_DMACHCR_TE | USB_DMACHCR_SP; | ||
| 605 | u32 chcr; | 604 | u32 chcr; |
| 605 | bool xfer_end = false; | ||
| 606 | 606 | ||
| 607 | spin_lock(&chan->vc.lock); | 607 | spin_lock(&chan->vc.lock); |
| 608 | 608 | ||
| 609 | chcr = usb_dmac_chan_read(chan, USB_DMACHCR); | 609 | chcr = usb_dmac_chan_read(chan, USB_DMACHCR); |
| 610 | if (chcr & check_bits) | 610 | if (chcr & (USB_DMACHCR_TE | USB_DMACHCR_SP)) { |
| 611 | mask |= USB_DMACHCR_DE | check_bits; | 611 | mask |= USB_DMACHCR_DE | USB_DMACHCR_TE | USB_DMACHCR_SP; |
| 612 | if (chcr & USB_DMACHCR_DE) | ||
| 613 | xfer_end = true; | ||
| 614 | ret |= IRQ_HANDLED; | ||
| 615 | } | ||
| 612 | if (chcr & USB_DMACHCR_NULL) { | 616 | if (chcr & USB_DMACHCR_NULL) { |
| 613 | /* An interruption of TE will happen after we set FTE */ | 617 | /* An interruption of TE will happen after we set FTE */ |
| 614 | mask |= USB_DMACHCR_NULL; | 618 | mask |= USB_DMACHCR_NULL; |
| 615 | chcr |= USB_DMACHCR_FTE; | 619 | chcr |= USB_DMACHCR_FTE; |
| 616 | ret |= IRQ_HANDLED; | 620 | ret |= IRQ_HANDLED; |
| 617 | } | 621 | } |
| 618 | usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask); | 622 | if (mask) |
| 623 | usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask); | ||
| 619 | 624 | ||
| 620 | if (chcr & check_bits) { | 625 | if (xfer_end) |
| 621 | usb_dmac_isr_transfer_end(chan); | 626 | usb_dmac_isr_transfer_end(chan); |
| 622 | ret |= IRQ_HANDLED; | ||
| 623 | } | ||
| 624 | 627 | ||
| 625 | spin_unlock(&chan->vc.lock); | 628 | spin_unlock(&chan->vc.lock); |
| 626 | 629 | ||
| @@ -709,9 +709,10 @@ static int scpi_probe(struct platform_device *pdev) · 708 unmodified lines | |||
| 709 | struct mbox_client *cl = &pchan->cl; | 709 | struct mbox_client *cl = &pchan->cl; |
| 710 | struct device_node *shmem = of_parse_phandle(np, "shmem", idx); | 710 | struct device_node *shmem = of_parse_phandle(np, "shmem", idx); |
| 711 | 711 | ||
| 712 | if (of_address_to_resource(shmem, 0, &res)) { | 712 | ret = of_address_to_resource(shmem, 0, &res); |
| 713 | of_node_put(shmem); | ||
| 714 | if (ret) { | ||
| 713 | dev_err(dev, "failed to get SCPI payload mem resource\n"); | 715 | dev_err(dev, "failed to get SCPI payload mem resource\n"); |
| 714 | ret = -EINVAL; | ||
| 715 | goto err; | 716 | goto err; |
| 716 | } | 717 | } |
| 717 | 718 | ||
| @@ -229,14 +229,14 @@ static int __init dmi_id_init(void) · 228 unmodified lines | |||
| 229 | 229 | ||
| 230 | ret = device_register(dmi_dev); | 230 | ret = device_register(dmi_dev); |
| 231 | if (ret) | 231 | if (ret) |
| 232 | goto fail_free_dmi_dev; | 232 | goto fail_put_dmi_dev; |
| 233 | 233 | ||
| 234 | return 0; | 234 | return 0; |
| 235 | 235 | ||
| 236 | fail_free_dmi_dev: | 236 | fail_put_dmi_dev: |
| 237 | kfree(dmi_dev); | 237 | put_device(dmi_dev); |
| 238 | fail_class_unregister: | ||
| 239 | 238 | ||
| 239 | fail_class_unregister: | ||
| 240 | class_unregister(&dmi_class); | 240 | class_unregister(&dmi_class); |
| 241 | 241 | ||
| 242 | return ret; | 242 | return ret; |
| @@ -657,9 +657,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, · 656 unmodified lines | |||
| 657 | } | 657 | } |
| 658 | 658 | ||
| 659 | if (subnode) { | 659 | if (subnode) { |
| 660 | node = of_get_flat_dt_subnode_by_name(node, subnode); | 660 | int err = of_get_flat_dt_subnode_by_name(node, subnode); |
| 661 | if (node < 0) | 661 | |
| 662 | if (err < 0) | ||
| 662 | return 0; | 663 | return 0; |
| 664 | |||
| 665 | node = err; | ||
| 663 | } | 666 | } |
| 664 | 667 | ||
| 665 | return __find_uefi_params(node, info, dt_params[i].params); | 668 | return __find_uefi_params(node, info, dt_params[i].params); |
| @@ -41,6 +41,8 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; · 40 unmodified lines | |||
| 41 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE | 41 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | #define EFI_MMAP_NR_SLACK_SLOTS 8 | ||
| 45 | |||
| 44 | struct file_info { | 46 | struct file_info { |
| 45 | efi_file_handle_t *handle; | 47 | efi_file_handle_t *handle; |
| 46 | u64 size; | 48 | u64 size; |
| @@ -63,49 +65,62 @@ void efi_printk(efi_system_table_t *sys_table_arg, char *str) · 16 unmodified lines | |||
| 63 | } | 65 | } |
| 64 | } | 66 | } |
| 65 | 67 | ||
| 68 | static inline bool mmap_has_headroom(unsigned long buff_size, | ||
| 69 | unsigned long map_size, | ||
| 70 | unsigned long desc_size) | ||
| 71 | { | ||
| 72 | unsigned long slack = buff_size - map_size; | ||
| 73 | |||
| 74 | return slack / desc_size >= EFI_MMAP_NR_SLACK_SLOTS; | ||
| 75 | } | ||
| 76 | |||
| 66 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, | 77 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
| 67 | efi_memory_desc_t **map, | 78 | struct efi_boot_memmap *map) |
| 68 | unsigned long *map_size, | ||
| 69 | unsigned long *desc_size, | ||
| 70 | u32 *desc_ver, | ||
| 71 | unsigned long *key_ptr) | ||
| 72 | { | 79 | { |
| 73 | efi_memory_desc_t *m = NULL; | 80 | efi_memory_desc_t *m = NULL; |
| 74 | efi_status_t status; | 81 | efi_status_t status; |
| 75 | unsigned long key; | 82 | unsigned long key; |
| 76 | u32 desc_version; | 83 | u32 desc_version; |
| 77 | 84 | ||
| 78 | *map_size = sizeof(*m) * 32; | 85 | *map->desc_size = sizeof(*m); |
| 86 | *map->map_size = *map->desc_size * 32; | ||
| 87 | *map->buff_size = *map->map_size; | ||
| 79 | again: | 88 | again: |
| 80 | /* | ||
| 81 | * Add an additional efi_memory_desc_t because we're doing an | ||
| 82 | * allocation which may be in a new descriptor region. | ||
| 83 | */ | ||
| 84 | *map_size += sizeof(*m); | ||
| 85 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, | 89 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, |
| 86 | *map_size, (void **)&m); | 90 | *map->map_size, (void **)&m); |
| 87 | if (status != EFI_SUCCESS) | 91 | if (status != EFI_SUCCESS) |
| 88 | goto fail; | 92 | goto fail; |
| 89 | 93 | ||
| 90 | *desc_size = 0; | 94 | *map->desc_size = 0; |
| 91 | key = 0; | 95 | key = 0; |
| 92 | status = efi_call_early(get_memory_map, map_size, m, | 96 | status = efi_call_early(get_memory_map, map->map_size, m, |
| 93 | &key, desc_size, &desc_version); | 97 | &key, map->desc_size, &desc_version); |
| 94 | if (status == EFI_BUFFER_TOO_SMALL) { | 98 | if (status == EFI_BUFFER_TOO_SMALL || |
| 99 | !mmap_has_headroom(*map->buff_size, *map->map_size, | ||
| 100 | *map->desc_size)) { | ||
| 95 | efi_call_early(free_pool, m); | 101 | efi_call_early(free_pool, m); |
| 102 | /* | ||
| 103 | * Make sure there is some entries of headroom so that the | ||
| 104 | * buffer can be reused for a new map after allocations are | ||
| 105 | * no longer permitted. Its unlikely that the map will grow to | ||
| 106 | * exceed this headroom once we are ready to trigger | ||
| 107 | * ExitBootServices() | ||
| 108 | */ | ||
| 109 | *map->map_size += *map->desc_size * EFI_MMAP_NR_SLACK_SLOTS; | ||
| 110 | *map->buff_size = *map->map_size; | ||
| 96 | goto again; | 111 | goto again; |
| 97 | } | 112 | } |
| 98 | 113 | ||
| 99 | if (status != EFI_SUCCESS) | 114 | if (status != EFI_SUCCESS) |
| 100 | efi_call_early(free_pool, m); | 115 | efi_call_early(free_pool, m); |
| 101 | 116 | ||
| 102 | if (key_ptr && status == EFI_SUCCESS) | 117 | if (map->key_ptr && status == EFI_SUCCESS) |
| 103 | *key_ptr = key; | 118 | *map->key_ptr = key; |
| 104 | if (desc_ver && status == EFI_SUCCESS) | 119 | if (map->desc_ver && status == EFI_SUCCESS) |
| 105 | *desc_ver = desc_version; | 120 | *map->desc_ver = desc_version; |
| 106 | 121 | ||
| 107 | fail: | 122 | fail: |
| 108 | *map = m; | 123 | *map->map = m; |
| 109 | return status; | 124 | return status; |
| 110 | } | 125 | } |
| 111 | 126 | ||
| @@ -113,13 +128,20 @@ fail: · 1 unmodified line | |||
| 113 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg) | 128 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg) |
| 114 | { | 129 | { |
| 115 | efi_status_t status; | 130 | efi_status_t status; |
| 116 | unsigned long map_size; | 131 | unsigned long map_size, buff_size; |
| 117 | unsigned long membase = EFI_ERROR; | 132 | unsigned long membase = EFI_ERROR; |
| 118 | struct efi_memory_map map; | 133 | struct efi_memory_map map; |
| 119 | efi_memory_desc_t *md; | 134 | efi_memory_desc_t *md; |
| 135 | struct efi_boot_memmap boot_map; | ||
| 120 | 136 | ||
| 121 | status = efi_get_memory_map(sys_table_arg, (efi_memory_desc_t **)&map.map, | 137 | boot_map.map = (efi_memory_desc_t **)&map.map; |
| 122 | &map_size, &map.desc_size, NULL, NULL); | 138 | boot_map.map_size = &map_size; |
| 139 | boot_map.desc_size = &map.desc_size; | ||
| 140 | boot_map.desc_ver = NULL; | ||
| 141 | boot_map.key_ptr = NULL; | ||
| 142 | boot_map.buff_size = &buff_size; | ||
| 143 | |||
| 144 | status = efi_get_memory_map(sys_table_arg, &boot_map); | ||
| 123 | if (status != EFI_SUCCESS) | 145 | if (status != EFI_SUCCESS) |
| 124 | return membase; | 146 | return membase; |
| 125 | 147 | ||
| @@ -144,15 +166,22 @@ efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, · 18 unmodified lines | |||
| 144 | unsigned long size, unsigned long align, | 166 | unsigned long size, unsigned long align, |
| 145 | unsigned long *addr, unsigned long max) | 167 | unsigned long *addr, unsigned long max) |
| 146 | { | 168 | { |
| 147 | unsigned long map_size, desc_size; | 169 | unsigned long map_size, desc_size, buff_size; |
| 148 | efi_memory_desc_t *map; | 170 | efi_memory_desc_t *map; |
| 149 | efi_status_t status; | 171 | efi_status_t status; |
| 150 | unsigned long nr_pages; | 172 | unsigned long nr_pages; |
| 151 | u64 max_addr = 0; | 173 | u64 max_addr = 0; |
| 152 | int i; | 174 | int i; |
| 175 | struct efi_boot_memmap boot_map; | ||
| 176 | |||
| 177 | boot_map.map = ↦ | ||
| 178 | boot_map.map_size = &map_size; | ||
| 179 | boot_map.desc_size = &desc_size; | ||
| 180 | boot_map.desc_ver = NULL; | ||
| 181 | boot_map.key_ptr = NULL; | ||
| 182 | boot_map.buff_size = &buff_size; | ||
| 153 | 183 | ||
| 154 | status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, | 184 | status = efi_get_memory_map(sys_table_arg, &boot_map); |
| 155 | NULL, NULL); | ||
| 156 | if (status != EFI_SUCCESS) | 185 | if (status != EFI_SUCCESS) |
| 157 | goto fail; | 186 | goto fail; |
| 158 | 187 | ||
| @@ -230,14 +259,21 @@ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, · 71 unmodified lines | |||
| 230 | unsigned long size, unsigned long align, | 259 | unsigned long size, unsigned long align, |
| 231 | unsigned long *addr) | 260 | unsigned long *addr) |
| 232 | { | 261 | { |
| 233 | unsigned long map_size, desc_size; | 262 | unsigned long map_size, desc_size, buff_size; |
| 234 | efi_memory_desc_t *map; | 263 | efi_memory_desc_t *map; |
| 235 | efi_status_t status; | 264 | efi_status_t status; |
| 236 | unsigned long nr_pages; | 265 | unsigned long nr_pages; |
| 237 | int i; | 266 | int i; |
| 267 | struct efi_boot_memmap boot_map; | ||
| 238 | 268 | ||
| 239 | status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, | 269 | boot_map.map = ↦ |
| 240 | NULL, NULL); | 270 | boot_map.map_size = &map_size; |
| 271 | boot_map.desc_size = &desc_size; | ||
| 272 | boot_map.desc_ver = NULL; | ||
| 273 | boot_map.key_ptr = NULL; | ||
| 274 | boot_map.buff_size = &buff_size; | ||
| 275 | |||
| 276 | status = efi_get_memory_map(sys_table_arg, &boot_map); | ||
| 241 | if (status != EFI_SUCCESS) | 277 | if (status != EFI_SUCCESS) |
| 242 | goto fail; | 278 | goto fail; |
| 243 | 279 | ||
| @@ -704,3 +740,76 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, · 460 unmodified lines | |||
| 704 | *cmd_line_len = options_bytes; | 740 | *cmd_line_len = options_bytes; |
| 705 | return (char *)cmdline_addr; | 741 | return (char *)cmdline_addr; |
| 706 | } | 742 | } |
| 743 | |||
| 744 | /* | ||
| 745 | * Handle calling ExitBootServices according to the requirements set out by the | ||
| 746 | * spec. Obtains the current memory map, and returns that info after calling | ||
| 747 | * ExitBootServices. The client must specify a function to perform any | ||
| 748 | * processing of the memory map data prior to ExitBootServices. A client | ||
| 749 | * specific structure may be passed to the function via priv. The client | ||
| 750 | * function may be called multiple times. | ||
| 751 | */ | ||
| 752 | efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg, | ||
| 753 | void *handle, | ||
| 754 | struct efi_boot_memmap *map, | ||
| 755 | void *priv, | ||
| 756 | efi_exit_boot_map_processing priv_func) | ||
| 757 | { | ||
| 758 | efi_status_t status; | ||
| 759 | |||
| 760 | status = efi_get_memory_map(sys_table_arg, map); | ||
| 761 | |||
| 762 | if (status != EFI_SUCCESS) | ||
| 763 | goto fail; | ||
| 764 | |||
| 765 | status = priv_func(sys_table_arg, map, priv); | ||
| 766 | if (status != EFI_SUCCESS) | ||
| 767 | goto free_map; | ||
| 768 | |||
| 769 | status = efi_call_early(exit_boot_services, handle, *map->key_ptr); | ||
| 770 | |||
| 771 | if (status == EFI_INVALID_PARAMETER) { | ||
| 772 | /* | ||
| 773 | * The memory map changed between efi_get_memory_map() and | ||
| 774 | * exit_boot_services(). Per the UEFI Spec v2.6, Section 6.4: | ||
| 775 | * EFI_BOOT_SERVICES.ExitBootServices we need to get the | ||
| 776 | * updated map, and try again. The spec implies one retry | ||
| 777 | * should be sufficent, which is confirmed against the EDK2 | ||
| 778 | * implementation. Per the spec, we can only invoke | ||
| 779 | * get_memory_map() and exit_boot_services() - we cannot alloc | ||
| 780 | * so efi_get_memory_map() cannot be used, and we must reuse | ||
| 781 | * the buffer. For all practical purposes, the headroom in the | ||
| 782 | * buffer should account for any changes in the map so the call | ||
| 783 | * to get_memory_map() is expected to succeed here. | ||
| 784 | */ | ||
| 785 | *map->map_size = *map->buff_size; | ||
| 786 | status = efi_call_early(get_memory_map, | ||
| 787 | map->map_size, | ||
| 788 | *map->map, | ||
| 789 | map->key_ptr, | ||
| 790 | map->desc_size, | ||
| 791 | map->desc_ver); | ||
| 792 | |||
| 793 | /* exit_boot_services() was called, thus cannot free */ | ||
| 794 | if (status != EFI_SUCCESS) | ||
| 795 | goto fail; | ||
| 796 | |||
| 797 | status = priv_func(sys_table_arg, map, priv); | ||
| 798 | /* exit_boot_services() was called, thus cannot free */ | ||
| 799 | if (status != EFI_SUCCESS) | ||
| 800 | goto fail; | ||
| 801 | |||
| 802 | status = efi_call_early(exit_boot_services, handle, *map->key_ptr); | ||
| 803 | } | ||
| 804 | |||
| 805 | /* exit_boot_services() was called, thus cannot free */ | ||
| 806 | if (status != EFI_SUCCESS) | ||
| 807 | goto fail; | ||
| 808 | |||
| 809 | return EFI_SUCCESS; | ||
| 810 | |||
| 811 | free_map: | ||
| 812 | efi_call_early(free_pool, *map->map); | ||
| 813 | fail: | ||
| 814 | return status; | ||
| 815 | } | ||
| @@ -152,6 +152,27 @@ fdt_set_fail: · 151 unmodified lines | |||
| 152 | #define EFI_FDT_ALIGN EFI_PAGE_SIZE | 152 | #define EFI_FDT_ALIGN EFI_PAGE_SIZE |
| 153 | #endif | 153 | #endif |
| 154 | 154 | ||
| 155 | struct exit_boot_struct { | ||
| 156 | efi_memory_desc_t *runtime_map; | ||
| 157 | int *runtime_entry_count; | ||
| 158 | }; | ||
| 159 | |||
| 160 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, | ||
| 161 | struct efi_boot_memmap *map, | ||
| 162 | void *priv) | ||
| 163 | { | ||
| 164 | struct exit_boot_struct *p = priv; | ||
| 165 | /* | ||
| 166 | * Update the memory map with virtual addresses. The function will also | ||
| 167 | * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME | ||
| 168 | * entries so that we can pass it straight to SetVirtualAddressMap() | ||
| 169 | */ | ||
| 170 | efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, | ||
| 171 | p->runtime_map, p->runtime_entry_count); | ||
| 172 | |||
| 173 | return EFI_SUCCESS; | ||
| 174 | } | ||
| 175 | |||
| 155 | /* | 176 | /* |
| 156 | * Allocate memory for a new FDT, then add EFI, commandline, and | 177 | * Allocate memory for a new FDT, then add EFI, commandline, and |
| 157 | * initrd related fields to the FDT. This routine increases the | 178 | * initrd related fields to the FDT. This routine increases the |
| @@ -175,13 +196,22 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 17 unmodified lines | |||
| 175 | unsigned long fdt_addr, | 196 | unsigned long fdt_addr, |
| 176 | unsigned long fdt_size) | 197 | unsigned long fdt_size) |
| 177 | { | 198 | { |
| 178 | unsigned long map_size, desc_size; | 199 | unsigned long map_size, desc_size, buff_size; |
| 179 | u32 desc_ver; | 200 | u32 desc_ver; |
| 180 | unsigned long mmap_key; | 201 | unsigned long mmap_key; |
| 181 | efi_memory_desc_t *memory_map, *runtime_map; | 202 | efi_memory_desc_t *memory_map, *runtime_map; |
| 182 | unsigned long new_fdt_size; | 203 | unsigned long new_fdt_size; |
| 183 | efi_status_t status; | 204 | efi_status_t status; |
| 184 | int runtime_entry_count = 0; | 205 | int runtime_entry_count = 0; |
| 206 | struct efi_boot_memmap map; | ||
| 207 | struct exit_boot_struct priv; | ||
| 208 | |||
| 209 | map.map = &runtime_map; | ||
| 210 | map.map_size = &map_size; | ||
| 211 | map.desc_size = &desc_size; | ||
| 212 | map.desc_ver = &desc_ver; | ||
| 213 | map.key_ptr = &mmap_key; | ||
| 214 | map.buff_size = &buff_size; | ||
| 185 | 215 | ||
| 186 | /* | 216 | /* |
| 187 | * Get a copy of the current memory map that we will use to prepare | 217 | * Get a copy of the current memory map that we will use to prepare |
| @@ -189,8 +219,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 1 unmodified line | |||
| 189 | * subsequent allocations adding entries, since they could not affect | 219 | * subsequent allocations adding entries, since they could not affect |
| 190 | * the number of EFI_MEMORY_RUNTIME regions. | 220 | * the number of EFI_MEMORY_RUNTIME regions. |
| 191 | */ | 221 | */ |
| 192 | status = efi_get_memory_map(sys_table, &runtime_map, &map_size, | 222 | status = efi_get_memory_map(sys_table, &map); |
| 193 | &desc_size, &desc_ver, &mmap_key); | ||
| 194 | if (status != EFI_SUCCESS) { | 223 | if (status != EFI_SUCCESS) { |
| 195 | pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); | 224 | pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); |
| 196 | return status; | 225 | return status; |
| @@ -199,6 +228,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 2 unmodified lines | |||
| 199 | pr_efi(sys_table, | 228 | pr_efi(sys_table, |
| 200 | "Exiting boot services and installing virtual address map...\n"); | 229 | "Exiting boot services and installing virtual address map...\n"); |
| 201 | 230 | ||
| 231 | map.map = &memory_map; | ||
| 202 | /* | 232 | /* |
| 203 | * Estimate size of new FDT, and allocate memory for it. We | 233 | * Estimate size of new FDT, and allocate memory for it. We |
| 204 | * will allocate a bigger buffer if this ends up being too | 234 | * will allocate a bigger buffer if this ends up being too |
| @@ -218,8 +248,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 13 unmodified lines | |||
| 218 | * we can get the memory map key needed for | 248 | * we can get the memory map key needed for |
| 219 | * exit_boot_services(). | 249 | * exit_boot_services(). |
| 220 | */ | 250 | */ |
| 221 | status = efi_get_memory_map(sys_table, &memory_map, &map_size, | 251 | status = efi_get_memory_map(sys_table, &map); |
| 222 | &desc_size, &desc_ver, &mmap_key); | ||
| 223 | if (status != EFI_SUCCESS) | 252 | if (status != EFI_SUCCESS) |
| 224 | goto fail_free_new_fdt; | 253 | goto fail_free_new_fdt; |
| 225 | 254 | ||
| @@ -250,16 +279,11 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, · 24 unmodified lines | |||
| 250 | } | 279 | } |
| 251 | } | 280 | } |
| 252 | 281 | ||
| 253 | /* | 282 | sys_table->boottime->free_pool(memory_map); |
| 254 | * Update the memory map with virtual addresses. The function will also | 283 | priv.runtime_map = runtime_map; |
| 255 | * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME | 284 | priv.runtime_entry_count = &runtime_entry_count; |
| 256 | * entries so that we can pass it straight into SetVirtualAddressMap() | 285 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
| 257 | */ | 286 | exit_boot_func); |
| 258 | efi_get_virtmap(memory_map, map_size, desc_size, runtime_map, | ||
| 259 | &runtime_entry_count); | ||
| 260 | |||
| 261 | /* Now we are ready to exit_boot_services.*/ | ||
| 262 | status = sys_table->boottime->exit_boot_services(handle, mmap_key); | ||
| 263 | 287 | ||
| 264 | if (status == EFI_SUCCESS) { | 288 | if (status == EFI_SUCCESS) { |
| 265 | efi_set_virtual_address_map_t *svam; | 289 | efi_set_virtual_address_map_t *svam; |
| @@ -73,12 +73,20 @@ efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, · 72 unmodified lines | |||
| 73 | unsigned long random_seed) | 73 | unsigned long random_seed) |
| 74 | { | 74 | { |
| 75 | unsigned long map_size, desc_size, total_slots = 0, target_slot; | 75 | unsigned long map_size, desc_size, total_slots = 0, target_slot; |
| 76 | unsigned long buff_size; | ||
| 76 | efi_status_t status; | 77 | efi_status_t status; |
| 77 | efi_memory_desc_t *memory_map; | 78 | efi_memory_desc_t *memory_map; |
| 78 | int map_offset; | 79 | int map_offset; |
| 80 | struct efi_boot_memmap map; | ||
| 79 | 81 | ||
| 80 | status = efi_get_memory_map(sys_table_arg, &memory_map, &map_size, | 82 | map.map = &memory_map; |
| 81 | &desc_size, NULL, NULL); | 83 | map.map_size = &map_size; |
| 84 | map.desc_size = &desc_size; | ||
| 85 | map.desc_ver = NULL; | ||
| 86 | map.key_ptr = NULL; | ||
| 87 | map.buff_size = &buff_size; | ||
| 88 | |||
| 89 | status = efi_get_memory_map(sys_table_arg, &map); | ||
| 82 | if (status != EFI_SUCCESS) | 90 | if (status != EFI_SUCCESS) |
| 83 | return status; | 91 | return status; |
| 84 | 92 | ||
| @@ -50,6 +50,7 @@ config GPIO_DEVRES · 49 unmodified lines | |||
| 50 | config OF_GPIO | 50 | config OF_GPIO |
| 51 | def_bool y | 51 | def_bool y |
| 52 | depends on OF | 52 | depends on OF |
| 53 | depends on HAS_IOMEM | ||
| 53 | 54 | ||
| 54 | config GPIO_ACPI | 55 | config GPIO_ACPI |
| 55 | def_bool y | 56 | def_bool y |
| @@ -188,7 +189,7 @@ config GPIO_EP93XX · 132 unmodified lines | |||
| 188 | config GPIO_ETRAXFS | 189 | config GPIO_ETRAXFS |
| 189 | bool "Axis ETRAX FS General I/O" | 190 | bool "Axis ETRAX FS General I/O" |
| 190 | depends on CRIS || COMPILE_TEST | 191 | depends on CRIS || COMPILE_TEST |
| 191 | depends on OF | 192 | depends on OF_GPIO |
| 192 | select GPIO_GENERIC | 193 | select GPIO_GENERIC |
| 193 | select GPIOLIB_IRQCHIP | 194 | select GPIOLIB_IRQCHIP |
| 194 | help | 195 | help |
| @@ -214,7 +215,7 @@ config GPIO_GENERIC_PLATFORM · 19 unmodified lines | |||
| 214 | 215 | ||
| 215 | config GPIO_GRGPIO | 216 | config GPIO_GRGPIO |
| 216 | tristate "Aeroflex Gaisler GRGPIO support" | 217 | tristate "Aeroflex Gaisler GRGPIO support" |
| 217 | depends on OF | 218 | depends on OF_GPIO |
| 218 | select GPIO_GENERIC | 219 | select GPIO_GENERIC |
| 219 | select IRQ_DOMAIN | 220 | select IRQ_DOMAIN |
| 220 | help | 221 | help |
| @@ -312,7 +313,7 @@ config GPIO_MPC8XXX · 91 unmodified lines | |||
| 312 | config GPIO_MVEBU | 313 | config GPIO_MVEBU |
| 313 | def_bool y | 314 | def_bool y |
| 314 | depends on PLAT_ORION | 315 | depends on PLAT_ORION |
| 315 | depends on OF | 316 | depends on OF_GPIO |
| 316 | select GENERIC_IRQ_CHIP | 317 | select GENERIC_IRQ_CHIP |
| 317 | 318 | ||
| 318 | config GPIO_MXC | 319 | config GPIO_MXC |
| @@ -405,7 +406,7 @@ config GPIO_TEGRA · 86 unmodified lines | |||
| 405 | bool "NVIDIA Tegra GPIO support" | 406 | bool "NVIDIA Tegra GPIO support" |
| 406 | default ARCH_TEGRA | 407 | default ARCH_TEGRA |
| 407 | depends on ARCH_TEGRA || COMPILE_TEST | 408 | depends on ARCH_TEGRA || COMPILE_TEST |
| 408 | depends on OF | 409 | depends on OF_GPIO |
| 409 | help | 410 | help |
| 410 | Say yes here to support GPIO pins on NVIDIA Tegra SoCs. | 411 | Say yes here to support GPIO pins on NVIDIA Tegra SoCs. |
| 411 | 412 | ||
| @@ -1099,7 +1100,7 @@ menu "SPI GPIO expanders" · 687 unmodified lines | |||
| 1099 | 1100 | ||
| 1100 | config GPIO_74X164 | 1101 | config GPIO_74X164 |
| 1101 | tristate "74x164 serial-in/parallel-out 8-bits shift register" | 1102 | tristate "74x164 serial-in/parallel-out 8-bits shift register" |
| 1102 | depends on OF | 1103 | depends on OF_GPIO |
| 1103 | help | 1104 | help |
| 1104 | Driver for 74x164 compatible serial-in/parallel-out 8-outputs | 1105 | Driver for 74x164 compatible serial-in/parallel-out 8-outputs |
| 1105 | shift registers. This driver can be used to provide access | 1106 | shift registers. This driver can be used to provide access |
| @@ -1130,6 +1131,7 @@ menu "SPI or I2C GPIO expanders" · 24 unmodified lines | |||
| 1130 | 1131 | ||
| 1131 | config GPIO_MCP23S08 | 1132 | config GPIO_MCP23S08 |
| 1132 | tristate "Microchip MCP23xxx I/O expander" | 1133 | tristate "Microchip MCP23xxx I/O expander" |
| 1134 | depends on OF_GPIO | ||
| 1133 | select GPIOLIB_IRQCHIP | 1135 | select GPIOLIB_IRQCHIP |
| 1134 | help | 1136 | help |
| 1135 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 | 1137 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 |
| @@ -192,6 +192,10 @@ int __max730x_probe(struct max7301 *ts) · 191 unmodified lines | |||
| 192 | ts->chip.parent = dev; | 192 | ts->chip.parent = dev; |
| 193 | ts->chip.owner = THIS_MODULE; | 193 | ts->chip.owner = THIS_MODULE; |
| 194 | 194 | ||
| 195 | ret = gpiochip_add_data(&ts->chip, ts); | ||
| 196 | if (ret) | ||
| 197 | goto exit_destroy; | ||
| 198 | |||
| 195 | /* | 199 | /* |
| 196 | * initialize pullups according to platform data and cache the | 200 | * initialize pullups according to platform data and cache the |
| 197 | * register values for later use. | 201 | * register values for later use. |
| @@ -213,10 +217,6 @@ int __max730x_probe(struct max7301 *ts) · 15 unmodified lines | |||
| 213 | } | 217 | } |
| 214 | } | 218 | } |
| 215 | 219 | ||
| 216 | ret = gpiochip_add_data(&ts->chip, ts); | ||
| 217 | if (ret) | ||
| 218 | goto exit_destroy; | ||
| 219 | |||
| 220 | return ret; | 220 | return ret; |
| 221 | 221 | ||
| 222 | exit_destroy: | 222 | exit_destroy: |
| @@ -564,7 +564,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, · 563 unmodified lines | |||
| 564 | mcp->chip.direction_output = mcp23s08_direction_output; | 564 | mcp->chip.direction_output = mcp23s08_direction_output; |
| 565 | mcp->chip.set = mcp23s08_set; | 565 | mcp->chip.set = mcp23s08_set; |
| 566 | mcp->chip.dbg_show = mcp23s08_dbg_show; | 566 | mcp->chip.dbg_show = mcp23s08_dbg_show; |
| 567 | #ifdef CONFIG_OF | 567 | #ifdef CONFIG_OF_GPIO |
| 568 | mcp->chip.of_gpio_n_cells = 2; | 568 | mcp->chip.of_gpio_n_cells = 2; |
| 569 | mcp->chip.of_node = dev->of_node; | 569 | mcp->chip.of_node = dev->of_node; |
| 570 | #endif | 570 | #endif |
| @@ -155,7 +155,7 @@ static int sa1100_gpio_irqdomain_map(struct irq_domain *d, · 154 unmodified lines | |||
| 155 | { | 155 | { |
| 156 | irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip, | 156 | irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip, |
| 157 | handle_edge_irq); | 157 | handle_edge_irq); |
| 158 | irq_set_noprobe(irq); | 158 | irq_set_probe(irq); |
| 159 | 159 | ||
| 160 | return 0; | 160 | return 0; |
| 161 | } | 161 | } |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
| 19 | #include <linux/io-mapping.h> | ||
| 20 | #include <linux/gpio/consumer.h> | 19 | #include <linux/gpio/consumer.h> |
| 21 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 22 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
| @@ -426,6 +426,8 @@ struct amdgpu_mman { · 425 unmodified lines | |||
| 426 | 426 | ||
| 427 | /* custom LRU management */ | 427 | /* custom LRU management */ |
| 428 | struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE]; | 428 | struct amdgpu_mman_lru log2_size[AMDGPU_TTM_LRU_SIZE]; |
| 429 | /* guard for log2_size array, don't add anything in between */ | ||
| 430 | struct amdgpu_mman_lru guard; | ||
| 429 | }; | 431 | }; |
| 430 | 432 | ||
| 431 | int amdgpu_copy_buffer(struct amdgpu_ring *ring, | 433 | int amdgpu_copy_buffer(struct amdgpu_ring *ring, |
| @@ -321,6 +321,19 @@ bool amdgpu_atombios_get_connector_info_from_object_table(struct amdgpu_device * · 320 unmodified lines | |||
| 321 | (le16_to_cpu(path->usConnObjectId) & | 321 | (le16_to_cpu(path->usConnObjectId) & |
| 322 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; | 322 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; |
| 323 | 323 | ||
| 324 | /* Skip TV/CV support */ | ||
| 325 | if ((le16_to_cpu(path->usDeviceTag) == | ||
| 326 | ATOM_DEVICE_TV1_SUPPORT) || | ||
| 327 | (le16_to_cpu(path->usDeviceTag) == | ||
| 328 | ATOM_DEVICE_CV_SUPPORT)) | ||
| 329 | continue; | ||
| 330 | |||
| 331 | if (con_obj_id >= ARRAY_SIZE(object_connector_convert)) { | ||
| 332 | DRM_ERROR("invalid con_obj_id %d for device tag 0x%04x\n", | ||
| 333 | con_obj_id, le16_to_cpu(path->usDeviceTag)); | ||
| 334 | continue; | ||
| 335 | } | ||
| 336 | |||
| 324 | connector_type = | 337 | connector_type = |
| 325 | object_connector_convert[con_obj_id]; | 338 | object_connector_convert[con_obj_id]; |
| 326 | connector_object_id = con_obj_id; | 339 | connector_object_id = con_obj_id; |
| @@ -280,7 +280,7 @@ void amdgpu_ib_pool_fini(struct amdgpu_device *adev) · 279 unmodified lines | |||
| 280 | int amdgpu_ib_ring_tests(struct amdgpu_device *adev) | 280 | int amdgpu_ib_ring_tests(struct amdgpu_device *adev) |
| 281 | { | 281 | { |
| 282 | unsigned i; | 282 | unsigned i; |
| 283 | int r; | 283 | int r, ret = 0; |
| 284 | 284 | ||
| 285 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 285 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
| 286 | struct amdgpu_ring *ring = adev->rings[i]; | 286 | struct amdgpu_ring *ring = adev->rings[i]; |
| @@ -301,10 +301,11 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev) · 14 unmodified lines | |||
| 301 | } else { | 301 | } else { |
| 302 | /* still not good, but we can live with it */ | 302 | /* still not good, but we can live with it */ |
| 303 | DRM_ERROR("amdgpu: failed testing IB on ring %d (%d).\n", i, r); | 303 | DRM_ERROR("amdgpu: failed testing IB on ring %d (%d).\n", i, r); |
| 304 | ret = r; | ||
| 304 | } | 305 | } |
| 305 | } | 306 | } |
| 306 | } | 307 | } |
| 307 | return 0; | 308 | return ret; |
| 308 | } | 309 | } |
| 309 | 310 | ||
| 310 | /* | 311 | /* |
| @@ -251,8 +251,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo, · 250 unmodified lines | |||
| 251 | 251 | ||
| 252 | adev = amdgpu_get_adev(bo->bdev); | 252 | adev = amdgpu_get_adev(bo->bdev); |
| 253 | ring = adev->mman.buffer_funcs_ring; | 253 | ring = adev->mman.buffer_funcs_ring; |
| 254 | old_start = old_mem->start << PAGE_SHIFT; | 254 | old_start = (u64)old_mem->start << PAGE_SHIFT; |
| 255 | new_start = new_mem->start << PAGE_SHIFT; | 255 | new_start = (u64)new_mem->start << PAGE_SHIFT; |
| 256 | 256 | ||
| 257 | switch (old_mem->mem_type) { | 257 | switch (old_mem->mem_type) { |
| 258 | case TTM_PL_VRAM: | 258 | case TTM_PL_VRAM: |
| @@ -950,6 +950,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo) · 691 unmodified lines | |||
| 950 | struct list_head *res = lru->lru[tbo->mem.mem_type]; | 950 | struct list_head *res = lru->lru[tbo->mem.mem_type]; |
| 951 | 951 | ||
| 952 | lru->lru[tbo->mem.mem_type] = &tbo->lru; | 952 | lru->lru[tbo->mem.mem_type] = &tbo->lru; |
| 953 | while ((++lru)->lru[tbo->mem.mem_type] == res) | ||
| 954 | lru->lru[tbo->mem.mem_type] = &tbo->lru; | ||
| 953 | 955 | ||
| 954 | return res; | 956 | return res; |
| 955 | } | 957 | } |
| @@ -960,6 +962,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo) · 4 unmodified lines | |||
| 960 | struct list_head *res = lru->swap_lru; | 962 | struct list_head *res = lru->swap_lru; |
| 961 | 963 | ||
| 962 | lru->swap_lru = &tbo->swap; | 964 | lru->swap_lru = &tbo->swap; |
| 965 | while ((++lru)->swap_lru == res) | ||
| 966 | lru->swap_lru = &tbo->swap; | ||
| 963 | 967 | ||
| 964 | return res; | 968 | return res; |
| 965 | } | 969 | } |
| @@ -1011,6 +1015,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) · 45 unmodified lines | |||
| 1011 | lru->swap_lru = &adev->mman.bdev.glob->swap_lru; | 1015 | lru->swap_lru = &adev->mman.bdev.glob->swap_lru; |
| 1012 | } | 1016 | } |
| 1013 | 1017 | ||
| 1018 | for (j = 0; j < TTM_NUM_MEM_TYPES; ++j) | ||
| 1019 | adev->mman.guard.lru[j] = NULL; | ||
| 1020 | adev->mman.guard.swap_lru = NULL; | ||
| 1021 | |||
| 1014 | adev->mman.initialized = true; | 1022 | adev->mman.initialized = true; |
| 1015 | r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_VRAM, | 1023 | r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_VRAM, |
| 1016 | adev->mc.real_vram_size >> PAGE_SHIFT); | 1024 | adev->mc.real_vram_size >> PAGE_SHIFT); |
| @@ -52,6 +52,7 @@ static void cik_sdma_set_ring_funcs(struct amdgpu_device *adev); · 51 unmodified lines | |||
| 52 | static void cik_sdma_set_irq_funcs(struct amdgpu_device *adev); | 52 | static void cik_sdma_set_irq_funcs(struct amdgpu_device *adev); |
| 53 | static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev); | 53 | static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev); |
| 54 | static void cik_sdma_set_vm_pte_funcs(struct amdgpu_device *adev); | 54 | static void cik_sdma_set_vm_pte_funcs(struct amdgpu_device *adev); |
| 55 | static int cik_sdma_soft_reset(void *handle); | ||
| 55 | 56 | ||
| 56 | MODULE_FIRMWARE("radeon/bonaire_sdma.bin"); | 57 | MODULE_FIRMWARE("radeon/bonaire_sdma.bin"); |
| 57 | MODULE_FIRMWARE("radeon/bonaire_sdma1.bin"); | 58 | MODULE_FIRMWARE("radeon/bonaire_sdma1.bin"); |
| @@ -1037,6 +1038,8 @@ static int cik_sdma_resume(void *handle) · 979 unmodified lines | |||
| 1037 | { | 1038 | { |
| 1038 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 1039 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 1039 | 1040 | ||
| 1041 | cik_sdma_soft_reset(handle); | ||
| 1042 | |||
| 1040 | return cik_sdma_hw_init(adev); | 1043 | return cik_sdma_hw_init(adev); |
| 1041 | } | 1044 | } |
| 1042 | 1045 | ||
| @@ -2755,8 +2755,7 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev) · 2754 unmodified lines | |||
| 2755 | u64 wb_gpu_addr; | 2755 | u64 wb_gpu_addr; |
| 2756 | u32 *buf; | 2756 | u32 *buf; |
| 2757 | struct bonaire_mqd *mqd; | 2757 | struct bonaire_mqd *mqd; |
| 2758 | 2758 | struct amdgpu_ring *ring; | |
| 2759 | gfx_v7_0_cp_compute_enable(adev, true); | ||
| 2760 | 2759 | ||
| 2761 | /* fix up chicken bits */ | 2760 | /* fix up chicken bits */ |
| 2762 | tmp = RREG32(mmCP_CPF_DEBUG); | 2761 | tmp = RREG32(mmCP_CPF_DEBUG); |
| @@ -2791,7 +2790,7 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev) · 28 unmodified lines | |||
| 2791 | 2790 | ||
| 2792 | /* init the queues. Just two for now. */ | 2791 | /* init the queues. Just two for now. */ |
| 2793 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | 2792 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { |
| 2794 | struct amdgpu_ring *ring = &adev->gfx.compute_ring[i]; | 2793 | ring = &adev->gfx.compute_ring[i]; |
| 2795 | 2794 | ||
| 2796 | if (ring->mqd_obj == NULL) { | 2795 | if (ring->mqd_obj == NULL) { |
| 2797 | r = amdgpu_bo_create(adev, | 2796 | r = amdgpu_bo_create(adev, |
| @@ -2970,6 +2969,13 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev) · 172 unmodified lines | |||
| 2970 | amdgpu_bo_unreserve(ring->mqd_obj); | 2969 | amdgpu_bo_unreserve(ring->mqd_obj); |
| 2971 | 2970 | ||
| 2972 | ring->ready = true; | 2971 | ring->ready = true; |
| 2972 | } | ||
| 2973 | |||
| 2974 | gfx_v7_0_cp_compute_enable(adev, true); | ||
| 2975 | |||
| 2976 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | ||
| 2977 | ring = &adev->gfx.compute_ring[i]; | ||
| 2978 | |||
| 2973 | r = amdgpu_ring_test_ring(ring); | 2979 | r = amdgpu_ring_test_ring(ring); |
| 2974 | if (r) | 2980 | if (r) |
| 2975 | ring->ready = false; | 2981 | ring->ready = false; |
| @@ -714,7 +714,7 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 713 unmodified lines | |||
| 714 | DRM_ERROR("amdgpu: IB test timed out\n"); | 714 | DRM_ERROR("amdgpu: IB test timed out\n"); |
| 715 | r = -ETIMEDOUT; | 715 | r = -ETIMEDOUT; |
| 716 | goto err1; | 716 | goto err1; |
| 717 | } else if (r) { | 717 | } else if (r < 0) { |
| 718 | DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); | 718 | DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); |
| 719 | goto err1; | 719 | goto err1; |
| 720 | } | 720 | } |
| @@ -405,7 +405,7 @@ void amd_sched_job_recovery(struct amd_gpu_scheduler *sched) · 404 unmodified lines | |||
| 405 | spin_lock(&sched->job_list_lock); | 405 | spin_lock(&sched->job_list_lock); |
| 406 | s_job = list_first_entry_or_null(&sched->ring_mirror_list, | 406 | s_job = list_first_entry_or_null(&sched->ring_mirror_list, |
| 407 | struct amd_sched_job, node); | 407 | struct amd_sched_job, node); |
| 408 | if (s_job) | 408 | if (s_job && sched->timeout != MAX_SCHEDULE_TIMEOUT) |
| 409 | schedule_delayed_work(&s_job->work_tdr, sched->timeout); | 409 | schedule_delayed_work(&s_job->work_tdr, sched->timeout); |
| 410 | 410 | ||
| 411 | list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) { | 411 | list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) { |
| @@ -387,7 +387,7 @@ void atmel_hlcdc_crtc_irq(struct drm_crtc *c) · 386 unmodified lines | |||
| 387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); | 387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) | 390 | static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) |
| 391 | { | 391 | { |
| 392 | struct atmel_hlcdc_crtc_state *state; | 392 | struct atmel_hlcdc_crtc_state *state; |
| 393 | 393 | ||
| @@ -320,19 +320,19 @@ atmel_hlcdc_plane_update_pos_and_size(struct atmel_hlcdc_plane *plane, · 319 unmodified lines | |||
| 320 | u32 *coeff_tab = heo_upscaling_ycoef; | 320 | u32 *coeff_tab = heo_upscaling_ycoef; |
| 321 | u32 max_memsize; | 321 | u32 max_memsize; |
| 322 | 322 | ||
| 323 | if (state->crtc_w < state->src_w) | 323 | if (state->crtc_h < state->src_h) |
| 324 | coeff_tab = heo_downscaling_ycoef; | 324 | coeff_tab = heo_downscaling_ycoef; |
| 325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) | 325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) |
| 326 | atmel_hlcdc_layer_update_cfg(&plane->layer, | 326 | atmel_hlcdc_layer_update_cfg(&plane->layer, |
| 327 | 33 + i, | 327 | 33 + i, |
| 328 | 0xffffffff, | 328 | 0xffffffff, |
| 329 | coeff_tab[i]); | 329 | coeff_tab[i]); |
| 330 | factor = ((8 * 256 * state->src_w) - (256 * 4)) / | 330 | factor = ((8 * 256 * state->src_h) - (256 * 4)) / |
| 331 | state->crtc_w; | 331 | state->crtc_h; |
| 332 | factor++; | 332 | factor++; |
| 333 | max_memsize = ((factor * state->crtc_w) + (256 * 4)) / | 333 | max_memsize = ((factor * state->crtc_h) + (256 * 4)) / |
| 334 | 2048; | 334 | 2048; |
| 335 | if (max_memsize > state->src_w) | 335 | if (max_memsize > state->src_h) |
| 336 | factor--; | 336 | factor--; |
| 337 | factor_reg |= (factor << 16) | 0x80000000; | 337 | factor_reg |= (factor << 16) | 0x80000000; |
| 338 | } | 338 | } |
| @@ -475,7 +475,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, · 474 unmodified lines | |||
| 475 | val, | 475 | val, |
| 476 | -1, | 476 | -1, |
| 477 | &replaced); | 477 | &replaced); |
| 478 | state->color_mgmt_changed = replaced; | 478 | state->color_mgmt_changed |= replaced; |
| 479 | return ret; | 479 | return ret; |
| 480 | } else if (property == config->ctm_property) { | 480 | } else if (property == config->ctm_property) { |
| 481 | ret = drm_atomic_replace_property_blob_from_id(crtc, | 481 | ret = drm_atomic_replace_property_blob_from_id(crtc, |
| @@ -483,7 +483,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, · 1 unmodified line | |||
| 483 | val, | 483 | val, |
| 484 | sizeof(struct drm_color_ctm), | 484 | sizeof(struct drm_color_ctm), |
| 485 | &replaced); | 485 | &replaced); |
| 486 | state->color_mgmt_changed = replaced; | 486 | state->color_mgmt_changed |= replaced; |
| 487 | return ret; | 487 | return ret; |
| 488 | } else if (property == config->gamma_lut_property) { | 488 | } else if (property == config->gamma_lut_property) { |
| 489 | ret = drm_atomic_replace_property_blob_from_id(crtc, | 489 | ret = drm_atomic_replace_property_blob_from_id(crtc, |
| @@ -491,7 +491,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, · 1 unmodified line | |||
| 491 | val, | 491 | val, |
| 492 | -1, | 492 | -1, |
| 493 | &replaced); | 493 | &replaced); |
| 494 | state->color_mgmt_changed = replaced; | 494 | state->color_mgmt_changed |= replaced; |
| 495 | return ret; | 495 | return ret; |
| 496 | } else if (crtc->funcs->atomic_set_property) | 496 | } else if (crtc->funcs->atomic_set_property) |
| 497 | return crtc->funcs->atomic_set_property(crtc, state, property, val); | 497 | return crtc->funcs->atomic_set_property(crtc, state, property, val); |
| @@ -5404,6 +5404,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, · 5403 unmodified lines | |||
| 5404 | struct drm_pending_vblank_event *e = NULL; | 5404 | struct drm_pending_vblank_event *e = NULL; |
| 5405 | int ret = -EINVAL; | 5405 | int ret = -EINVAL; |
| 5406 | 5406 | ||
| 5407 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 5408 | return -EINVAL; | ||
| 5409 | |||
| 5407 | if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS || | 5410 | if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS || |
| 5408 | page_flip->reserved != 0) | 5411 | page_flip->reserved != 0) |
| 5409 | return -EINVAL; | 5412 | return -EINVAL; |
| @@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, · 1014 unmodified lines | |||
| 1015 | return 0; | 1015 | return 0; |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
| 1018 | typedef struct drm_mode_fb_cmd232 { | 1019 | typedef struct drm_mode_fb_cmd232 { |
| 1019 | u32 fb_id; | 1020 | u32 fb_id; |
| 1020 | u32 width; | 1021 | u32 width; |
| @@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, · 50 unmodified lines | |||
| 1071 | 1072 | ||
| 1072 | return 0; | 1073 | return 0; |
| 1073 | } | 1074 | } |
| 1075 | #endif | ||
| 1074 | 1076 | ||
| 1075 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { | 1077 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
| 1076 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, | 1078 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
| @@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { · 27 unmodified lines | |||
| 1104 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, | 1106 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
| 1105 | #endif | 1107 | #endif |
| 1106 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, | 1108 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
| 1109 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
| 1107 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, | 1110 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, |
| 1111 | #endif | ||
| 1108 | }; | 1112 | }; |
| 1109 | 1113 | ||
| 1110 | /** | 1114 | /** |
| @@ -55,11 +55,11 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, · 54 unmodified lines | |||
| 55 | flags = exynos_gem->flags; | 55 | flags = exynos_gem->flags; |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * without iommu support, not support physically non-continuous memory | 58 | * Physically non-contiguous memory type for framebuffer is not |
| 59 | * for framebuffer. | 59 | * supported without IOMMU. |
| 60 | */ | 60 | */ |
| 61 | if (IS_NONCONTIG_BUFFER(flags)) { | 61 | if (IS_NONCONTIG_BUFFER(flags)) { |
| 62 | DRM_ERROR("cannot use this gem memory type for fb.\n"); | 62 | DRM_ERROR("Non-contiguous GEM memory is not supported.\n"); |
| 63 | return -EINVAL; | 63 | return -EINVAL; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| @@ -1753,32 +1753,6 @@ static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable) · 1752 unmodified lines | |||
| 1753 | return 0; | 1753 | return 0; |
| 1754 | } | 1754 | } |
| 1755 | 1755 | ||
| 1756 | #ifdef CONFIG_PM_SLEEP | ||
| 1757 | static int fimc_suspend(struct device *dev) | ||
| 1758 | { | ||
| 1759 | struct fimc_context *ctx = get_fimc_context(dev); | ||
| 1760 | |||
| 1761 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
| 1762 | |||
| 1763 | if (pm_runtime_suspended(dev)) | ||
| 1764 | return 0; | ||
| 1765 | |||
| 1766 | return fimc_clk_ctrl(ctx, false); | ||
| 1767 | } | ||
| 1768 | |||
| 1769 | static int fimc_resume(struct device *dev) | ||
| 1770 | { | ||
| 1771 | struct fimc_context *ctx = get_fimc_context(dev); | ||
| 1772 | |||
| 1773 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
| 1774 | |||
| 1775 | if (!pm_runtime_suspended(dev)) | ||
| 1776 | return fimc_clk_ctrl(ctx, true); | ||
| 1777 | |||
| 1778 | return 0; | ||
| 1779 | } | ||
| 1780 | #endif | ||
| 1781 | |||
| 1782 | static int fimc_runtime_suspend(struct device *dev) | 1756 | static int fimc_runtime_suspend(struct device *dev) |
| 1783 | { | 1757 | { |
| 1784 | struct fimc_context *ctx = get_fimc_context(dev); | 1758 | struct fimc_context *ctx = get_fimc_context(dev); |
| @@ -1799,7 +1773,8 @@ static int fimc_runtime_resume(struct device *dev) · 14 unmodified lines | |||
| 1799 | #endif | 1773 | #endif |
| 1800 | 1774 | ||
| 1801 | static const struct dev_pm_ops fimc_pm_ops = { | 1775 | static const struct dev_pm_ops fimc_pm_ops = { |
| 1802 | SET_SYSTEM_SLEEP_PM_OPS(fimc_suspend, fimc_resume) | 1776 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 1777 | pm_runtime_force_resume) | ||
| 1803 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) | 1778 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) |
| 1804 | }; | 1779 | }; |
| 1805 | 1780 | ||
| @@ -1475,8 +1475,8 @@ static int g2d_remove(struct platform_device *pdev) · 1474 unmodified lines | |||
| 1475 | return 0; | 1475 | return 0; |
| 1476 | } | 1476 | } |
| 1477 | 1477 | ||
| 1478 | #ifdef CONFIG_PM_SLEEP | 1478 | #ifdef CONFIG_PM |
| 1479 | static int g2d_suspend(struct device *dev) | 1479 | static int g2d_runtime_suspend(struct device *dev) |
| 1480 | { | 1480 | { |
| 1481 | struct g2d_data *g2d = dev_get_drvdata(dev); | 1481 | struct g2d_data *g2d = dev_get_drvdata(dev); |
| 1482 | 1482 | ||
| @@ -1490,25 +1490,6 @@ static int g2d_suspend(struct device *dev) · 7 unmodified lines | |||
| 1490 | 1490 | ||
| 1491 | flush_work(&g2d->runqueue_work); | 1491 | flush_work(&g2d->runqueue_work); |
| 1492 | 1492 | ||
| 1493 | return 0; | ||
| 1494 | } | ||
| 1495 | |||
| 1496 | static int g2d_resume(struct device *dev) | ||
| 1497 | { | ||
| 1498 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
| 1499 | |||
| 1500 | g2d->suspended = false; | ||
| 1501 | g2d_exec_runqueue(g2d); | ||
| 1502 | |||
| 1503 | return 0; | ||
| 1504 | } | ||
| 1505 | #endif | ||
| 1506 | |||
| 1507 | #ifdef CONFIG_PM | ||
| 1508 | static int g2d_runtime_suspend(struct device *dev) | ||
| 1509 | { | ||
| 1510 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
| 1511 | |||
| 1512 | clk_disable_unprepare(g2d->gate_clk); | 1493 | clk_disable_unprepare(g2d->gate_clk); |
| 1513 | 1494 | ||
| 1514 | return 0; | 1495 | return 0; |
| @@ -1523,12 +1504,16 @@ static int g2d_runtime_resume(struct device *dev) · 8 unmodified lines | |||
| 1523 | if (ret < 0) | 1504 | if (ret < 0) |
| 1524 | dev_warn(dev, "failed to enable clock.\n"); | 1505 | dev_warn(dev, "failed to enable clock.\n"); |
| 1525 | 1506 | ||
| 1507 | g2d->suspended = false; | ||
| 1508 | g2d_exec_runqueue(g2d); | ||
| 1509 | |||
| 1526 | return ret; | 1510 | return ret; |
| 1527 | } | 1511 | } |
| 1528 | #endif | 1512 | #endif |
| 1529 | 1513 | ||
| 1530 | static const struct dev_pm_ops g2d_pm_ops = { | 1514 | static const struct dev_pm_ops g2d_pm_ops = { |
| 1531 | SET_SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume) | 1515 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 1516 | pm_runtime_force_resume) | ||
| 1532 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) | 1517 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) |
| 1533 | }; | 1518 | }; |
| 1534 | 1519 | ||
| @@ -1760,34 +1760,7 @@ static int gsc_remove(struct platform_device *pdev) · 1759 unmodified lines | |||
| 1760 | return 0; | 1760 | return 0; |
| 1761 | } | 1761 | } |
| 1762 | 1762 | ||
| 1763 | #ifdef CONFIG_PM_SLEEP | 1763 | static int __maybe_unused gsc_runtime_suspend(struct device *dev) |
| 1764 | static int gsc_suspend(struct device *dev) | ||
| 1765 | { | ||
| 1766 | struct gsc_context *ctx = get_gsc_context(dev); | ||
| 1767 | |||
| 1768 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
| 1769 | |||
| 1770 | if (pm_runtime_suspended(dev)) | ||
| 1771 | return 0; | ||
| 1772 | |||
| 1773 | return gsc_clk_ctrl(ctx, false); | ||
| 1774 | } | ||
| 1775 | |||
| 1776 | static int gsc_resume(struct device *dev) | ||
| 1777 | { | ||
| 1778 | struct gsc_context *ctx = get_gsc_context(dev); | ||
| 1779 | |||
| 1780 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
| 1781 | |||
| 1782 | if (!pm_runtime_suspended(dev)) | ||
| 1783 | return gsc_clk_ctrl(ctx, true); | ||
| 1784 | |||
| 1785 | return 0; | ||
| 1786 | } | ||
| 1787 | #endif | ||
| 1788 | |||
| 1789 | #ifdef CONFIG_PM | ||
| 1790 | static int gsc_runtime_suspend(struct device *dev) | ||
| 1791 | { | 1764 | { |
| 1792 | struct gsc_context *ctx = get_gsc_context(dev); | 1765 | struct gsc_context *ctx = get_gsc_context(dev); |
| 1793 | 1766 | ||
| @@ -1796,7 +1769,7 @@ static int gsc_runtime_suspend(struct device *dev) · 2 unmodified lines | |||
| 1796 | return gsc_clk_ctrl(ctx, false); | 1769 | return gsc_clk_ctrl(ctx, false); |
| 1797 | } | 1770 | } |
| 1798 | 1771 | ||
| 1799 | static int gsc_runtime_resume(struct device *dev) | 1772 | static int __maybe_unused gsc_runtime_resume(struct device *dev) |
| 1800 | { | 1773 | { |
| 1801 | struct gsc_context *ctx = get_gsc_context(dev); | 1774 | struct gsc_context *ctx = get_gsc_context(dev); |
| 1802 | 1775 | ||
| @@ -1804,10 +1777,10 @@ static int gsc_runtime_resume(struct device *dev) · 1 unmodified line | |||
| 1804 | 1777 | ||
| 1805 | return gsc_clk_ctrl(ctx, true); | 1778 | return gsc_clk_ctrl(ctx, true); |
| 1806 | } | 1779 | } |
| 1807 | #endif | ||
| 1808 | 1780 | ||
| 1809 | static const struct dev_pm_ops gsc_pm_ops = { | 1781 | static const struct dev_pm_ops gsc_pm_ops = { |
| 1810 | SET_SYSTEM_SLEEP_PM_OPS(gsc_suspend, gsc_resume) | 1782 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 1783 | pm_runtime_force_resume) | ||
| 1811 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) | 1784 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) |
| 1812 | }; | 1785 | }; |
| 1813 | 1786 | ||
| @@ -794,29 +794,6 @@ static int rotator_clk_crtl(struct rot_context *rot, bool enable) · 793 unmodified lines | |||
| 794 | return 0; | 794 | return 0; |
| 795 | } | 795 | } |
| 796 | 796 | ||
| 797 | |||
| 798 | #ifdef CONFIG_PM_SLEEP | ||
| 799 | static int rotator_suspend(struct device *dev) | ||
| 800 | { | ||
| 801 | struct rot_context *rot = dev_get_drvdata(dev); | ||
| 802 | |||
| 803 | if (pm_runtime_suspended(dev)) | ||
| 804 | return 0; | ||
| 805 | |||
| 806 | return rotator_clk_crtl(rot, false); | ||
| 807 | } | ||
| 808 | |||
| 809 | static int rotator_resume(struct device *dev) | ||
| 810 | { | ||
| 811 | struct rot_context *rot = dev_get_drvdata(dev); | ||
| 812 | |||
| 813 | if (!pm_runtime_suspended(dev)) | ||
| 814 | return rotator_clk_crtl(rot, true); | ||
| 815 | |||
| 816 | return 0; | ||
| 817 | } | ||
| 818 | #endif | ||
| 819 | |||
| 820 | static int rotator_runtime_suspend(struct device *dev) | 797 | static int rotator_runtime_suspend(struct device *dev) |
| 821 | { | 798 | { |
| 822 | struct rot_context *rot = dev_get_drvdata(dev); | 799 | struct rot_context *rot = dev_get_drvdata(dev); |
| @@ -833,7 +810,8 @@ static int rotator_runtime_resume(struct device *dev) · 10 unmodified lines | |||
| 833 | #endif | 810 | #endif |
| 834 | 811 | ||
| 835 | static const struct dev_pm_ops rotator_pm_ops = { | 812 | static const struct dev_pm_ops rotator_pm_ops = { |
| 836 | SET_SYSTEM_SLEEP_PM_OPS(rotator_suspend, rotator_resume) | 813 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
| 814 | pm_runtime_force_resume) | ||
| 837 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, | 815 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, |
| 838 | NULL) | 816 | NULL) |
| 839 | }; | 817 | }; |
| @@ -1281,6 +1281,11 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) · 1280 unmodified lines | |||
| 1281 | 1281 | ||
| 1282 | intel_runtime_pm_enable(dev_priv); | 1282 | intel_runtime_pm_enable(dev_priv); |
| 1283 | 1283 | ||
| 1284 | /* Everything is in place, we can now relax! */ | ||
| 1285 | DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", | ||
| 1286 | driver.name, driver.major, driver.minor, driver.patchlevel, | ||
| 1287 | driver.date, pci_name(pdev), dev_priv->drm.primary->index); | ||
| 1288 | |||
| 1284 | intel_runtime_pm_put(dev_priv); | 1289 | intel_runtime_pm_put(dev_priv); |
| 1285 | 1290 | ||
| 1286 | return 0; | 1291 | return 0; |
| @@ -882,11 +882,12 @@ struct i915_gem_context { · 881 unmodified lines | |||
| 882 | 882 | ||
| 883 | struct i915_ctx_hang_stats hang_stats; | 883 | struct i915_ctx_hang_stats hang_stats; |
| 884 | 884 | ||
| 885 | /* Unique identifier for this context, used by the hw for tracking */ | ||
| 886 | unsigned long flags; | 885 | unsigned long flags; |
| 887 | #define CONTEXT_NO_ZEROMAP BIT(0) | 886 | #define CONTEXT_NO_ZEROMAP BIT(0) |
| 888 | #define CONTEXT_NO_ERROR_CAPTURE BIT(1) | 887 | #define CONTEXT_NO_ERROR_CAPTURE BIT(1) |
| 889 | unsigned hw_id; | 888 | |
| 889 | /* Unique identifier for this context, used by the hw for tracking */ | ||
| 890 | unsigned int hw_id; | ||
| 890 | u32 user_handle; | 891 | u32 user_handle; |
| 891 | 892 | ||
| 892 | u32 ggtt_alignment; | 893 | u32 ggtt_alignment; |
| @@ -1963,6 +1964,13 @@ struct drm_i915_private { · 1070 unmodified lines | |||
| 1963 | struct i915_suspend_saved_registers regfile; | 1964 | struct i915_suspend_saved_registers regfile; |
| 1964 | struct vlv_s0ix_state vlv_s0ix_state; | 1965 | struct vlv_s0ix_state vlv_s0ix_state; |
| 1965 | 1966 | ||
| 1967 | enum { | ||
| 1968 | I915_SKL_SAGV_UNKNOWN = 0, | ||
| 1969 | I915_SKL_SAGV_DISABLED, | ||
| 1970 | I915_SKL_SAGV_ENABLED, | ||
| 1971 | I915_SKL_SAGV_NOT_CONTROLLED | ||
| 1972 | } skl_sagv_status; | ||
| 1973 | |||
| 1966 | struct { | 1974 | struct { |
| 1967 | /* | 1975 | /* |
| 1968 | * Raw watermark latency values: | 1976 | * Raw watermark latency values: |
| @@ -3591,6 +3599,7 @@ int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle); · 1622 unmodified lines | |||
| 3591 | /* belongs in i915_gem_gtt.h */ | 3599 | /* belongs in i915_gem_gtt.h */ |
| 3592 | static inline void i915_gem_chipset_flush(struct drm_i915_private *dev_priv) | 3600 | static inline void i915_gem_chipset_flush(struct drm_i915_private *dev_priv) |
| 3593 | { | 3601 | { |
| 3602 | wmb(); | ||
| 3594 | if (INTEL_GEN(dev_priv) < 6) | 3603 | if (INTEL_GEN(dev_priv) < 6) |
| 3595 | intel_gtt_chipset_flush(); | 3604 | intel_gtt_chipset_flush(); |
| 3596 | } | 3605 | } |
| @@ -943,8 +943,6 @@ i915_gem_execbuffer_move_to_gpu(struct drm_i915_gem_request *req, · 942 unmodified lines | |||
| 943 | { | 943 | { |
| 944 | const unsigned other_rings = ~intel_engine_flag(req->engine); | 944 | const unsigned other_rings = ~intel_engine_flag(req->engine); |
| 945 | struct i915_vma *vma; | 945 | struct i915_vma *vma; |
| 946 | uint32_t flush_domains = 0; | ||
| 947 | bool flush_chipset = false; | ||
| 948 | int ret; | 946 | int ret; |
| 949 | 947 | ||
| 950 | list_for_each_entry(vma, vmas, exec_list) { | 948 | list_for_each_entry(vma, vmas, exec_list) { |
| @@ -957,16 +955,11 @@ i915_gem_execbuffer_move_to_gpu(struct drm_i915_gem_request *req, · 6 unmodified lines | |||
| 957 | } | 955 | } |
| 958 | 956 | ||
| 959 | if (obj->base.write_domain & I915_GEM_DOMAIN_CPU) | 957 | if (obj->base.write_domain & I915_GEM_DOMAIN_CPU) |
| 960 | flush_chipset |= i915_gem_clflush_object(obj, false); | 958 | i915_gem_clflush_object(obj, false); |
| 961 | |||
| 962 | flush_domains |= obj->base.write_domain; | ||
| 963 | } | 959 | } |
| 964 | 960 | ||
| 965 | if (flush_chipset) | 961 | /* Unconditionally flush any chipset caches (for streaming writes). */ |
| 966 | i915_gem_chipset_flush(req->engine->i915); | 962 | i915_gem_chipset_flush(req->engine->i915); |
| 967 | |||
| 968 | if (flush_domains & I915_GEM_DOMAIN_GTT) | ||
| 969 | wmb(); | ||
| 970 | 963 | ||
| 971 | /* Unconditionally invalidate gpu caches and ensure that we do flush | 964 | /* Unconditionally invalidate gpu caches and ensure that we do flush |
| 972 | * any residual writes from the previous batch. | 965 | * any residual writes from the previous batch. |
| @@ -122,8 +122,11 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, · 121 unmodified lines | |||
| 122 | has_full_48bit_ppgtt = | 122 | has_full_48bit_ppgtt = |
| 123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; | 123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; |
| 124 | 124 | ||
| 125 | if (intel_vgpu_active(dev_priv)) | 125 | if (intel_vgpu_active(dev_priv)) { |
| 126 | has_full_ppgtt = false; /* emulation is too hard */ | 126 | /* emulation is too hard */ |
| 127 | has_full_ppgtt = false; | ||
| 128 | has_full_48bit_ppgtt = false; | ||
| 129 | } | ||
| 127 | 130 | ||
| 128 | if (!has_aliasing_ppgtt) | 131 | if (!has_aliasing_ppgtt) |
| 129 | return 0; | 132 | return 0; |
| @@ -158,7 +161,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, · 28 unmodified lines | |||
| 158 | return 0; | 161 | return 0; |
| 159 | } | 162 | } |
| 160 | 163 | ||
| 161 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists) | 164 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) |
| 162 | return has_full_48bit_ppgtt ? 3 : 2; | 165 | return has_full_48bit_ppgtt ? 3 : 2; |
| 163 | else | 166 | else |
| 164 | return has_aliasing_ppgtt ? 1 : 0; | 167 | return has_aliasing_ppgtt ? 1 : 0; |
| @@ -7145,6 +7145,15 @@ enum { · 7144 unmodified lines | |||
| 7145 | 7145 | ||
| 7146 | #define GEN6_PCODE_MAILBOX _MMIO(0x138124) | 7146 | #define GEN6_PCODE_MAILBOX _MMIO(0x138124) |
| 7147 | #define GEN6_PCODE_READY (1<<31) | 7147 | #define GEN6_PCODE_READY (1<<31) |
| 7148 | #define GEN6_PCODE_ERROR_MASK 0xFF | ||
| 7149 | #define GEN6_PCODE_SUCCESS 0x0 | ||
| 7150 | #define GEN6_PCODE_ILLEGAL_CMD 0x1 | ||
| 7151 | #define GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x2 | ||
| 7152 | #define GEN6_PCODE_TIMEOUT 0x3 | ||
| 7153 | #define GEN6_PCODE_UNIMPLEMENTED_CMD 0xFF | ||
| 7154 | #define GEN7_PCODE_TIMEOUT 0x2 | ||
| 7155 | #define GEN7_PCODE_ILLEGAL_DATA 0x3 | ||
| 7156 | #define GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE 0x10 | ||
| 7148 | #define GEN6_PCODE_WRITE_RC6VIDS 0x4 | 7157 | #define GEN6_PCODE_WRITE_RC6VIDS 0x4 |
| 7149 | #define GEN6_PCODE_READ_RC6VIDS 0x5 | 7158 | #define GEN6_PCODE_READ_RC6VIDS 0x5 |
| 7150 | #define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5) | 7159 | #define GEN6_ENCODE_RC6_VID(mv) (((mv) - 245) / 5) |
| @@ -7166,6 +7175,10 @@ enum { · 15 unmodified lines | |||
| 7166 | #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17 | 7175 | #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17 |
| 7167 | #define DISPLAY_IPS_CONTROL 0x19 | 7176 | #define DISPLAY_IPS_CONTROL 0x19 |
| 7168 | #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A | 7177 | #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A |
| 7178 | #define GEN9_PCODE_SAGV_CONTROL 0x21 | ||
| 7179 | #define GEN9_SAGV_DISABLE 0x0 | ||
| 7180 | #define GEN9_SAGV_IS_DISABLED 0x1 | ||
| 7181 | #define GEN9_SAGV_ENABLE 0x3 | ||
| 7169 | #define GEN6_PCODE_DATA _MMIO(0x138128) | 7182 | #define GEN6_PCODE_DATA _MMIO(0x138128) |
| 7170 | #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 | 7183 | #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8 |
| 7171 | #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 | 7184 | #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 |
| @@ -65,9 +65,6 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv) · 64 unmodified lines | |||
| 65 | 65 | ||
| 66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); | 66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); |
| 67 | 67 | ||
| 68 | if (!IS_HASWELL(dev_priv)) | ||
| 69 | return; | ||
| 70 | |||
| 71 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); | 68 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); |
| 72 | if (magic != VGT_MAGIC) | 69 | if (magic != VGT_MAGIC) |
| 73 | return; | 70 | return; |
| @@ -41,15 +41,15 @@ · 40 unmodified lines | |||
| 41 | * be moved to FW_FAILED. | 41 | * be moved to FW_FAILED. |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | #define I915_CSR_KBL "i915/kbl_dmc_ver1.bin" | 44 | #define I915_CSR_KBL "i915/kbl_dmc_ver1_01.bin" |
| 45 | MODULE_FIRMWARE(I915_CSR_KBL); | 45 | MODULE_FIRMWARE(I915_CSR_KBL); |
| 46 | #define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1) | 46 | #define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1) |
| 47 | 47 | ||
| 48 | #define I915_CSR_SKL "i915/skl_dmc_ver1.bin" | 48 | #define I915_CSR_SKL "i915/skl_dmc_ver1_26.bin" |
| 49 | MODULE_FIRMWARE(I915_CSR_SKL); | 49 | MODULE_FIRMWARE(I915_CSR_SKL); |
| 50 | #define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 23) | 50 | #define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 26) |
| 51 | 51 | ||
| 52 | #define I915_CSR_BXT "i915/bxt_dmc_ver1.bin" | 52 | #define I915_CSR_BXT "i915/bxt_dmc_ver1_07.bin" |
| 53 | MODULE_FIRMWARE(I915_CSR_BXT); | 53 | MODULE_FIRMWARE(I915_CSR_BXT); |
| 54 | #define BXT_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) | 54 | #define BXT_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) |
| 55 | 55 | ||
| @@ -13759,6 +13759,13 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 13758 unmodified lines | |||
| 13759 | intel_state->cdclk_pll_vco != dev_priv->cdclk_pll.vco)) | 13759 | intel_state->cdclk_pll_vco != dev_priv->cdclk_pll.vco)) |
| 13760 | dev_priv->display.modeset_commit_cdclk(state); | 13760 | dev_priv->display.modeset_commit_cdclk(state); |
| 13761 | 13761 | ||
| 13762 | /* | ||
| 13763 | * SKL workaround: bspec recommends we disable the SAGV when we | ||
| 13764 | * have more then one pipe enabled | ||
| 13765 | */ | ||
| 13766 | if (IS_SKYLAKE(dev_priv) && !skl_can_enable_sagv(state)) | ||
| 13767 | skl_disable_sagv(dev_priv); | ||
| 13768 | |||
| 13762 | intel_modeset_verify_disabled(dev); | 13769 | intel_modeset_verify_disabled(dev); |
| 13763 | } | 13770 | } |
| 13764 | 13771 | ||
| @@ -13832,6 +13839,10 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 67 unmodified lines | |||
| 13832 | intel_modeset_verify_crtc(crtc, old_crtc_state, crtc->state); | 13839 | intel_modeset_verify_crtc(crtc, old_crtc_state, crtc->state); |
| 13833 | } | 13840 | } |
| 13834 | 13841 | ||
| 13842 | if (IS_SKYLAKE(dev_priv) && intel_state->modeset && | ||
| 13843 | skl_can_enable_sagv(state)) | ||
| 13844 | skl_enable_sagv(dev_priv); | ||
| 13845 | |||
| 13835 | drm_atomic_helper_commit_hw_done(state); | 13846 | drm_atomic_helper_commit_hw_done(state); |
| 13836 | 13847 | ||
| 13837 | if (intel_state->modeset) | 13848 | if (intel_state->modeset) |
| @@ -1716,6 +1716,9 @@ void ilk_wm_get_hw_state(struct drm_device *dev); · 1715 unmodified lines | |||
| 1716 | void skl_wm_get_hw_state(struct drm_device *dev); | 1716 | void skl_wm_get_hw_state(struct drm_device *dev); |
| 1717 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, | 1717 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, |
| 1718 | struct skl_ddb_allocation *ddb /* out */); | 1718 | struct skl_ddb_allocation *ddb /* out */); |
| 1719 | bool skl_can_enable_sagv(struct drm_atomic_state *state); | ||
| 1720 | int skl_enable_sagv(struct drm_i915_private *dev_priv); | ||
| 1721 | int skl_disable_sagv(struct drm_i915_private *dev_priv); | ||
| 1719 | uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config); | 1722 | uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config); |
| 1720 | bool ilk_disable_lp_wm(struct drm_device *dev); | 1723 | bool ilk_disable_lp_wm(struct drm_device *dev); |
| 1721 | int sanitize_rc6_option(struct drm_i915_private *dev_priv, int enable_rc6); | 1724 | int sanitize_rc6_option(struct drm_i915_private *dev_priv, int enable_rc6); |
| @@ -554,7 +554,6 @@ void intel_dvo_init(struct drm_device *dev) · 553 unmodified lines | |||
| 554 | return; | 554 | return; |
| 555 | } | 555 | } |
| 556 | 556 | ||
| 557 | drm_encoder_cleanup(&intel_encoder->base); | ||
| 558 | kfree(intel_dvo); | 557 | kfree(intel_dvo); |
| 559 | kfree(intel_connector); | 558 | kfree(intel_connector); |
| 560 | } | 559 | } |
| @@ -1047,6 +1047,23 @@ err_out: · 1046 unmodified lines | |||
| 1047 | return err; | 1047 | return err; |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | static int intel_use_opregion_panel_type_callback(const struct dmi_system_id *id) | ||
| 1051 | { | ||
| 1052 | DRM_INFO("Using panel type from OpRegion on %s\n", id->ident); | ||
| 1053 | return 1; | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | static const struct dmi_system_id intel_use_opregion_panel_type[] = { | ||
| 1057 | { | ||
| 1058 | .callback = intel_use_opregion_panel_type_callback, | ||
| 1059 | .ident = "Conrac GmbH IX45GM2", | ||
| 1060 | .matches = {DMI_MATCH(DMI_SYS_VENDOR, "Conrac GmbH"), | ||
| 1061 | DMI_MATCH(DMI_PRODUCT_NAME, "IX45GM2"), | ||
| 1062 | }, | ||
| 1063 | }, | ||
| 1064 | { } | ||
| 1065 | }; | ||
| 1066 | |||
| 1050 | int | 1067 | int |
| 1051 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | 1068 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) |
| 1052 | { | 1069 | { |
| @@ -1072,6 +1089,16 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) · 19 unmodified lines | |||
| 1072 | return -ENODEV; | 1089 | return -ENODEV; |
| 1073 | } | 1090 | } |
| 1074 | 1091 | ||
| 1092 | /* | ||
| 1093 | * So far we know that some machined must use it, others must not use it. | ||
| 1094 | * There doesn't seem to be any way to determine which way to go, except | ||
| 1095 | * via a quirk list :( | ||
| 1096 | */ | ||
| 1097 | if (!dmi_check_system(intel_use_opregion_panel_type)) { | ||
| 1098 | DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); | ||
| 1099 | return -ENODEV; | ||
| 1100 | } | ||
| 1101 | |||
| 1075 | /* | 1102 | /* |
| 1076 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us | 1103 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us |
| 1077 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal | 1104 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal |
| @@ -2852,6 +2852,7 @@ bool ilk_disable_lp_wm(struct drm_device *dev) · 2851 unmodified lines | |||
| 2852 | 2852 | ||
| 2853 | #define SKL_DDB_SIZE 896 /* in blocks */ | 2853 | #define SKL_DDB_SIZE 896 /* in blocks */ |
| 2854 | #define BXT_DDB_SIZE 512 | 2854 | #define BXT_DDB_SIZE 512 |
| 2855 | #define SKL_SAGV_BLOCK_TIME 30 /* µs */ | ||
| 2855 | 2856 | ||
| 2856 | /* | 2857 | /* |
| 2857 | * Return the index of a plane in the SKL DDB and wm result arrays. Primary | 2858 | * Return the index of a plane in the SKL DDB and wm result arrays. Primary |
| @@ -2875,6 +2876,153 @@ skl_wm_plane_id(const struct intel_plane *plane) · 17 unmodified lines | |||
| 2875 | } | 2876 | } |
| 2876 | } | 2877 | } |
| 2877 | 2878 | ||
| 2879 | /* | ||
| 2880 | * SAGV dynamically adjusts the system agent voltage and clock frequencies | ||
| 2881 | * depending on power and performance requirements. The display engine access | ||
| 2882 | * to system memory is blocked during the adjustment time. Because of the | ||
| 2883 | * blocking time, having this enabled can cause full system hangs and/or pipe | ||
| 2884 | * underruns if we don't meet all of the following requirements: | ||
| 2885 | * | ||
| 2886 | * - <= 1 pipe enabled | ||
| 2887 | * - All planes can enable watermarks for latencies >= SAGV engine block time | ||
| 2888 | * - We're not using an interlaced display configuration | ||
| 2889 | */ | ||
| 2890 | int | ||
| 2891 | skl_enable_sagv(struct drm_i915_private *dev_priv) | ||
| 2892 | { | ||
| 2893 | int ret; | ||
| 2894 | |||
| 2895 | if (dev_priv->skl_sagv_status == I915_SKL_SAGV_NOT_CONTROLLED || | ||
| 2896 | dev_priv->skl_sagv_status == I915_SKL_SAGV_ENABLED) | ||
| 2897 | return 0; | ||
| 2898 | |||
| 2899 | DRM_DEBUG_KMS("Enabling the SAGV\n"); | ||
| 2900 | mutex_lock(&dev_priv->rps.hw_lock); | ||
| 2901 | |||
| 2902 | ret = sandybridge_pcode_write(dev_priv, GEN9_PCODE_SAGV_CONTROL, | ||
| 2903 | GEN9_SAGV_ENABLE); | ||
| 2904 | |||
| 2905 | /* We don't need to wait for the SAGV when enabling */ | ||
| 2906 | mutex_unlock(&dev_priv->rps.hw_lock); | ||
| 2907 | |||
| 2908 | /* | ||
| 2909 | * Some skl systems, pre-release machines in particular, | ||
| 2910 | * don't actually have an SAGV. | ||
| 2911 | */ | ||
| 2912 | if (ret == -ENXIO) { | ||
| 2913 | DRM_DEBUG_DRIVER("No SAGV found on system, ignoring\n"); | ||
| 2914 | dev_priv->skl_sagv_status = I915_SKL_SAGV_NOT_CONTROLLED; | ||
| 2915 | return 0; | ||
| 2916 | } else if (ret < 0) { | ||
| 2917 | DRM_ERROR("Failed to enable the SAGV\n"); | ||
| 2918 | return ret; | ||
| 2919 | } | ||
| 2920 | |||
| 2921 | dev_priv->skl_sagv_status = I915_SKL_SAGV_ENABLED; | ||
| 2922 | return 0; | ||
| 2923 | } | ||
| 2924 | |||
| 2925 | static int | ||
| 2926 | skl_do_sagv_disable(struct drm_i915_private *dev_priv) | ||
| 2927 | { | ||
| 2928 | int ret; | ||
| 2929 | uint32_t temp = GEN9_SAGV_DISABLE; | ||
| 2930 | |||
| 2931 | ret = sandybridge_pcode_read(dev_priv, GEN9_PCODE_SAGV_CONTROL, | ||
| 2932 | &temp); | ||
| 2933 | if (ret) | ||
| 2934 | return ret; | ||
| 2935 | else | ||
| 2936 | return temp & GEN9_SAGV_IS_DISABLED; | ||
| 2937 | } | ||
| 2938 | |||
| 2939 | int | ||
| 2940 | skl_disable_sagv(struct drm_i915_private *dev_priv) | ||
| 2941 | { | ||
| 2942 | int ret, result; | ||
| 2943 | |||
| 2944 | if (dev_priv->skl_sagv_status == I915_SKL_SAGV_NOT_CONTROLLED || | ||
| 2945 | dev_priv->skl_sagv_status == I915_SKL_SAGV_DISABLED) | ||
| 2946 | return 0; | ||
| 2947 | |||
| 2948 | DRM_DEBUG_KMS("Disabling the SAGV\n"); | ||
| 2949 | mutex_lock(&dev_priv->rps.hw_lock); | ||
| 2950 | |||
| 2951 | /* bspec says to keep retrying for at least 1 ms */ | ||
| 2952 | ret = wait_for(result = skl_do_sagv_disable(dev_priv), 1); | ||
| 2953 | mutex_unlock(&dev_priv->rps.hw_lock); | ||
| 2954 | |||
| 2955 | if (ret == -ETIMEDOUT) { | ||
| 2956 | DRM_ERROR("Request to disable SAGV timed out\n"); | ||
| 2957 | return -ETIMEDOUT; | ||
| 2958 | } | ||
| 2959 | |||
| 2960 | /* | ||
| 2961 | * Some skl systems, pre-release machines in particular, | ||
| 2962 | * don't actually have an SAGV. | ||
| 2963 | */ | ||
| 2964 | if (result == -ENXIO) { | ||
| 2965 | DRM_DEBUG_DRIVER("No SAGV found on system, ignoring\n"); | ||
| 2966 | dev_priv->skl_sagv_status = I915_SKL_SAGV_NOT_CONTROLLED; | ||
| 2967 | return 0; | ||
| 2968 | } else if (result < 0) { | ||
| 2969 | DRM_ERROR("Failed to disable the SAGV\n"); | ||
| 2970 | return result; | ||
| 2971 | } | ||
| 2972 | |||
| 2973 | dev_priv->skl_sagv_status = I915_SKL_SAGV_DISABLED; | ||
| 2974 | return 0; | ||
| 2975 | } | ||
| 2976 | |||
| 2977 | bool skl_can_enable_sagv(struct drm_atomic_state *state) | ||
| 2978 | { | ||
| 2979 | struct drm_device *dev = state->dev; | ||
| 2980 | struct drm_i915_private *dev_priv = to_i915(dev); | ||
| 2981 | struct intel_atomic_state *intel_state = to_intel_atomic_state(state); | ||
| 2982 | struct drm_crtc *crtc; | ||
| 2983 | enum pipe pipe; | ||
| 2984 | int level, plane; | ||
| 2985 | |||
| 2986 | /* | ||
| 2987 | * SKL workaround: bspec recommends we disable the SAGV when we have | ||
| 2988 | * more then one pipe enabled | ||
| 2989 | * | ||
| 2990 | * If there are no active CRTCs, no additional checks need be performed | ||
| 2991 | */ | ||
| 2992 | if (hweight32(intel_state->active_crtcs) == 0) | ||
| 2993 | return true; | ||
| 2994 | else if (hweight32(intel_state->active_crtcs) > 1) | ||
| 2995 | return false; | ||
| 2996 | |||
| 2997 | /* Since we're now guaranteed to only have one active CRTC... */ | ||
| 2998 | pipe = ffs(intel_state->active_crtcs) - 1; | ||
| 2999 | crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | ||
| 3000 | |||
| 3001 | if (crtc->state->mode.flags & DRM_MODE_FLAG_INTERLACE) | ||
| 3002 | return false; | ||
| 3003 | |||
| 3004 | for_each_plane(dev_priv, pipe, plane) { | ||
| 3005 | /* Skip this plane if it's not enabled */ | ||
| 3006 | if (intel_state->wm_results.plane[pipe][plane][0] == 0) | ||
| 3007 | continue; | ||
| 3008 | |||
| 3009 | /* Find the highest enabled wm level for this plane */ | ||
| 3010 | for (level = ilk_wm_max_level(dev); | ||
| 3011 | intel_state->wm_results.plane[pipe][plane][level] == 0; --level) | ||
| 3012 | { } | ||
| 3013 | |||
| 3014 | /* | ||
| 3015 | * If any of the planes on this pipe don't enable wm levels | ||
| 3016 | * that incur memory latencies higher then 30µs we can't enable | ||
| 3017 | * the SAGV | ||
| 3018 | */ | ||
| 3019 | if (dev_priv->wm.skl_latency[level] < SKL_SAGV_BLOCK_TIME) | ||
| 3020 | return false; | ||
| 3021 | } | ||
| 3022 | |||
| 3023 | return true; | ||
| 3024 | } | ||
| 3025 | |||
| 2878 | static void | 3026 | static void |
| 2879 | skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, | 3027 | skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, |
| 2880 | const struct intel_crtc_state *cstate, | 3028 | const struct intel_crtc_state *cstate, |
| @@ -3107,8 +3255,6 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate) · 226 unmodified lines | |||
| 3107 | total_data_rate += intel_cstate->wm.skl.plane_y_data_rate[id]; | 3255 | total_data_rate += intel_cstate->wm.skl.plane_y_data_rate[id]; |
| 3108 | } | 3256 | } |
| 3109 | 3257 | ||
| 3110 | WARN_ON(cstate->plane_mask && total_data_rate == 0); | ||
| 3111 | |||
| 3112 | return total_data_rate; | 3258 | return total_data_rate; |
| 3113 | } | 3259 | } |
| 3114 | 3260 | ||
| @@ -3912,9 +4058,24 @@ skl_compute_ddb(struct drm_atomic_state *state) · 797 unmodified lines | |||
| 3912 | * pretend that all pipes switched active status so that we'll | 4058 | * pretend that all pipes switched active status so that we'll |
| 3913 | * ensure a full DDB recompute. | 4059 | * ensure a full DDB recompute. |
| 3914 | */ | 4060 | */ |
| 3915 | if (dev_priv->wm.distrust_bios_wm) | 4061 | if (dev_priv->wm.distrust_bios_wm) { |
| 4062 | ret = drm_modeset_lock(&dev->mode_config.connection_mutex, | ||
| 4063 | state->acquire_ctx); | ||
| 4064 | if (ret) | ||
| 4065 | return ret; | ||
| 4066 | |||
| 3916 | intel_state->active_pipe_changes = ~0; | 4067 | intel_state->active_pipe_changes = ~0; |
| 3917 | 4068 | ||
| 4069 | /* | ||
| 4070 | * We usually only initialize intel_state->active_crtcs if we | ||
| 4071 | * we're doing a modeset; make sure this field is always | ||
| 4072 | * initialized during the sanitization process that happens | ||
| 4073 | * on the first commit too. | ||
| 4074 | */ | ||
| 4075 | if (!intel_state->modeset) | ||
| 4076 | intel_state->active_crtcs = dev_priv->active_crtcs; | ||
| 4077 | } | ||
| 4078 | |||
| 3918 | /* | 4079 | /* |
| 3919 | * If the modeset changes which CRTC's are active, we need to | 4080 | * If the modeset changes which CRTC's are active, we need to |
| 3920 | * recompute the DDB allocation for *all* active pipes, even | 4081 | * recompute the DDB allocation for *all* active pipes, even |
| @@ -3943,11 +4104,33 @@ skl_compute_ddb(struct drm_atomic_state *state) · 22 unmodified lines | |||
| 3943 | ret = skl_allocate_pipe_ddb(cstate, ddb); | 4104 | ret = skl_allocate_pipe_ddb(cstate, ddb); |
| 3944 | if (ret) | 4105 | if (ret) |
| 3945 | return ret; | 4106 | return ret; |
| 4107 | |||
| 4108 | ret = drm_atomic_add_affected_planes(state, &intel_crtc->base); | ||
| 4109 | if (ret) | ||
| 4110 | return ret; | ||
| 3946 | } | 4111 | } |
| 3947 | 4112 | ||
| 3948 | return 0; | 4113 | return 0; |
| 3949 | } | 4114 | } |
| 3950 | 4115 | ||
| 4116 | static void | ||
| 4117 | skl_copy_wm_for_pipe(struct skl_wm_values *dst, | ||
| 4118 | struct skl_wm_values *src, | ||
| 4119 | enum pipe pipe) | ||
| 4120 | { | ||
| 4121 | dst->wm_linetime[pipe] = src->wm_linetime[pipe]; | ||
| 4122 | memcpy(dst->plane[pipe], src->plane[pipe], | ||
| 4123 | sizeof(dst->plane[pipe])); | ||
| 4124 | memcpy(dst->plane_trans[pipe], src->plane_trans[pipe], | ||
| 4125 | sizeof(dst->plane_trans[pipe])); | ||
| 4126 | |||
| 4127 | dst->ddb.pipe[pipe] = src->ddb.pipe[pipe]; | ||
| 4128 | memcpy(dst->ddb.y_plane[pipe], src->ddb.y_plane[pipe], | ||
| 4129 | sizeof(dst->ddb.y_plane[pipe])); | ||
| 4130 | memcpy(dst->ddb.plane[pipe], src->ddb.plane[pipe], | ||
| 4131 | sizeof(dst->ddb.plane[pipe])); | ||
| 4132 | } | ||
| 4133 | |||
| 3951 | static int | 4134 | static int |
| 3952 | skl_compute_wm(struct drm_atomic_state *state) | 4135 | skl_compute_wm(struct drm_atomic_state *state) |
| 3953 | { | 4136 | { |
| @@ -4020,8 +4203,10 @@ static void skl_update_wm(struct drm_crtc *crtc) · 66 unmodified lines | |||
| 4020 | struct drm_device *dev = crtc->dev; | 4203 | struct drm_device *dev = crtc->dev; |
| 4021 | struct drm_i915_private *dev_priv = to_i915(dev); | 4204 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 4022 | struct skl_wm_values *results = &dev_priv->wm.skl_results; | 4205 | struct skl_wm_values *results = &dev_priv->wm.skl_results; |
| 4206 | struct skl_wm_values *hw_vals = &dev_priv->wm.skl_hw; | ||
| 4023 | struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state); | 4207 | struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state); |
| 4024 | struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal; | 4208 | struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal; |
| 4209 | int pipe; | ||
| 4025 | 4210 | ||
| 4026 | if ((results->dirty_pipes & drm_crtc_mask(crtc)) == 0) | 4211 | if ((results->dirty_pipes & drm_crtc_mask(crtc)) == 0) |
| 4027 | return; | 4212 | return; |
| @@ -4033,8 +4218,12 @@ static void skl_update_wm(struct drm_crtc *crtc) · 5 unmodified lines | |||
| 4033 | skl_write_wm_values(dev_priv, results); | 4218 | skl_write_wm_values(dev_priv, results); |
| 4034 | skl_flush_wm_values(dev_priv, results); | 4219 | skl_flush_wm_values(dev_priv, results); |
| 4035 | 4220 | ||
| 4036 | /* store the new configuration */ | 4221 | /* |
| 4037 | dev_priv->wm.skl_hw = *results; | 4222 | * Store the new configuration (but only for the pipes that have |
| 4223 | * changed; the other values weren't recomputed). | ||
| 4224 | */ | ||
| 4225 | for_each_pipe_masked(dev_priv, pipe, results->dirty_pipes) | ||
| 4226 | skl_copy_wm_for_pipe(hw_vals, results, pipe); | ||
| 4038 | 4227 | ||
| 4039 | mutex_unlock(&dev_priv->wm.wm_mutex); | 4228 | mutex_unlock(&dev_priv->wm.wm_mutex); |
| 4040 | } | 4229 | } |
| @@ -7658,8 +7847,54 @@ void intel_init_pm(struct drm_device *dev) · 3617 unmodified lines | |||
| 7658 | } | 7847 | } |
| 7659 | } | 7848 | } |
| 7660 | 7849 | ||
| 7850 | static inline int gen6_check_mailbox_status(struct drm_i915_private *dev_priv) | ||
| 7851 | { | ||
| 7852 | uint32_t flags = | ||
| 7853 | I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_ERROR_MASK; | ||
| 7854 | |||
| 7855 | switch (flags) { | ||
| 7856 | case GEN6_PCODE_SUCCESS: | ||
| 7857 | return 0; | ||
| 7858 | case GEN6_PCODE_UNIMPLEMENTED_CMD: | ||
| 7859 | case GEN6_PCODE_ILLEGAL_CMD: | ||
| 7860 | return -ENXIO; | ||
| 7861 | case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | ||
| 7862 | case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | ||
| 7863 | return -EOVERFLOW; | ||
| 7864 | case GEN6_PCODE_TIMEOUT: | ||
| 7865 | return -ETIMEDOUT; | ||
| 7866 | default: | ||
| 7867 | MISSING_CASE(flags) | ||
| 7868 | return 0; | ||
| 7869 | } | ||
| 7870 | } | ||
| 7871 | |||
| 7872 | static inline int gen7_check_mailbox_status(struct drm_i915_private *dev_priv) | ||
| 7873 | { | ||
| 7874 | uint32_t flags = | ||
| 7875 | I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_ERROR_MASK; | ||
| 7876 | |||
| 7877 | switch (flags) { | ||
| 7878 | case GEN6_PCODE_SUCCESS: | ||
| 7879 | return 0; | ||
| 7880 | case GEN6_PCODE_ILLEGAL_CMD: | ||
| 7881 | return -ENXIO; | ||
| 7882 | case GEN7_PCODE_TIMEOUT: | ||
| 7883 | return -ETIMEDOUT; | ||
| 7884 | case GEN7_PCODE_ILLEGAL_DATA: | ||
| 7885 | return -EINVAL; | ||
| 7886 | case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | ||
| 7887 | return -EOVERFLOW; | ||
| 7888 | default: | ||
| 7889 | MISSING_CASE(flags); | ||
| 7890 | return 0; | ||
| 7891 | } | ||
| 7892 | } | ||
| 7893 | |||
| 7661 | int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val) | 7894 | int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val) |
| 7662 | { | 7895 | { |
| 7896 | int status; | ||
| 7897 | |||
| 7663 | WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); | 7898 | WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); |
| 7664 | 7899 | ||
| 7665 | /* GEN6_PCODE_* are outside of the forcewake domain, we can | 7900 | /* GEN6_PCODE_* are outside of the forcewake domain, we can |
| @@ -7686,12 +7921,25 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val · 20 unmodified lines | |||
| 7686 | *val = I915_READ_FW(GEN6_PCODE_DATA); | 7921 | *val = I915_READ_FW(GEN6_PCODE_DATA); |
| 7687 | I915_WRITE_FW(GEN6_PCODE_DATA, 0); | 7922 | I915_WRITE_FW(GEN6_PCODE_DATA, 0); |
| 7688 | 7923 | ||
| 7924 | if (INTEL_GEN(dev_priv) > 6) | ||
| 7925 | status = gen7_check_mailbox_status(dev_priv); | ||
| 7926 | else | ||
| 7927 | status = gen6_check_mailbox_status(dev_priv); | ||
| 7928 | |||
| 7929 | if (status) { | ||
| 7930 | DRM_DEBUG_DRIVER("warning: pcode (read) mailbox access failed: %d\n", | ||
| 7931 | status); | ||
| 7932 | return status; | ||
| 7933 | } | ||
| 7934 | |||
| 7689 | return 0; | 7935 | return 0; |
| 7690 | } | 7936 | } |
| 7691 | 7937 | ||
| 7692 | int sandybridge_pcode_write(struct drm_i915_private *dev_priv, | 7938 | int sandybridge_pcode_write(struct drm_i915_private *dev_priv, |
| 7693 | u32 mbox, u32 val) | 7939 | u32 mbox, u32 val) |
| 7694 | { | 7940 | { |
| 7941 | int status; | ||
| 7942 | |||
| 7695 | WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); | 7943 | WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); |
| 7696 | 7944 | ||
| 7697 | /* GEN6_PCODE_* are outside of the forcewake domain, we can | 7945 | /* GEN6_PCODE_* are outside of the forcewake domain, we can |
| @@ -7716,6 +7964,17 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv, · 18 unmodified lines | |||
| 7716 | 7964 | ||
| 7717 | I915_WRITE_FW(GEN6_PCODE_DATA, 0); | 7965 | I915_WRITE_FW(GEN6_PCODE_DATA, 0); |
| 7718 | 7966 | ||
| 7967 | if (INTEL_GEN(dev_priv) > 6) | ||
| 7968 | status = gen7_check_mailbox_status(dev_priv); | ||
| 7969 | else | ||
| 7970 | status = gen6_check_mailbox_status(dev_priv); | ||
| 7971 | |||
| 7972 | if (status) { | ||
| 7973 | DRM_DEBUG_DRIVER("warning: pcode (write) mailbox access failed: %d\n", | ||
| 7974 | status); | ||
| 7975 | return status; | ||
| 7976 | } | ||
| 7977 | |||
| 7719 | return 0; | 7978 | return 0; |
| 7720 | } | 7979 | } |
| 7721 | 7980 | ||
| @@ -255,14 +255,14 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) · 254 unmodified lines | |||
| 255 | struct drm_i915_private *dev_priv = to_i915(dev); | 255 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 256 | 256 | ||
| 257 | uint32_t max_sleep_time = 0x1f; | 257 | uint32_t max_sleep_time = 0x1f; |
| 258 | /* Lately it was identified that depending on panel idle frame count | 258 | /* |
| 259 | * calculated at HW can be off by 1. So let's use what came | 259 | * Let's respect VBT in case VBT asks a higher idle_frame value. |
| 260 | * from VBT + 1. | 260 | * Let's use 6 as the minimum to cover all known cases including |
| 261 | * There are also other cases where panel demands at least 4 | 261 | * the off-by-one issue that HW has in some cases. Also there are |
| 262 | * but VBT is not being set. To cover these 2 cases lets use | 262 | * cases where sink should be able to train |
| 263 | * at least 5 when VBT isn't set to be on the safest side. | 263 | * with the 5 or 6 idle patterns. |
| 264 | */ | 264 | */ |
| 265 | uint32_t idle_frames = dev_priv->vbt.psr.idle_frames + 1; | 265 | uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); |
| 266 | uint32_t val = EDP_PSR_ENABLE; | 266 | uint32_t val = EDP_PSR_ENABLE; |
| 267 | 267 | ||
| 268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; | 268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; |
| @@ -171,10 +171,34 @@ static void imx_drm_output_poll_changed(struct drm_device *drm) · 170 unmodified lines | |||
| 171 | drm_fbdev_cma_hotplug_event(imxdrm->fbhelper); | 171 | drm_fbdev_cma_hotplug_event(imxdrm->fbhelper); |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | static int imx_drm_atomic_check(struct drm_device *dev, | ||
| 175 | struct drm_atomic_state *state) | ||
| 176 | { | ||
| 177 | int ret; | ||
| 178 | |||
| 179 | ret = drm_atomic_helper_check_modeset(dev, state); | ||
| 180 | if (ret) | ||
| 181 | return ret; | ||
| 182 | |||
| 183 | ret = drm_atomic_helper_check_planes(dev, state); | ||
| 184 | if (ret) | ||
| 185 | return ret; | ||
| 186 | |||
| 187 | /* | ||
| 188 | * Check modeset again in case crtc_state->mode_changed is | ||
| 189 | * updated in plane's ->atomic_check callback. | ||
| 190 | */ | ||
| 191 | ret = drm_atomic_helper_check_modeset(dev, state); | ||
| 192 | if (ret) | ||
| 193 | return ret; | ||
| 194 | |||
| 195 | return ret; | ||
| 196 | } | ||
| 197 | |||
| 174 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { | 198 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { |
| 175 | .fb_create = drm_fb_cma_create, | 199 | .fb_create = drm_fb_cma_create, |
| 176 | .output_poll_changed = imx_drm_output_poll_changed, | 200 | .output_poll_changed = imx_drm_output_poll_changed, |
| 177 | .atomic_check = drm_atomic_helper_check, | 201 | .atomic_check = imx_drm_atomic_check, |
| 178 | .atomic_commit = drm_atomic_helper_commit, | 202 | .atomic_commit = drm_atomic_helper_commit, |
| 179 | }; | 203 | }; |
| 180 | 204 | ||
| @@ -76,6 +76,8 @@ static void ipu_crtc_disable(struct drm_crtc *crtc) · 75 unmodified lines | |||
| 76 | crtc->state->event = NULL; | 76 | crtc->state->event = NULL; |
| 77 | } | 77 | } |
| 78 | spin_unlock_irq(&crtc->dev->event_lock); | 78 | spin_unlock_irq(&crtc->dev->event_lock); |
| 79 | |||
| 80 | drm_crtc_vblank_off(crtc); | ||
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | static void imx_drm_crtc_reset(struct drm_crtc *crtc) | 83 | static void imx_drm_crtc_reset(struct drm_crtc *crtc) |
| @@ -175,6 +177,8 @@ static int ipu_crtc_atomic_check(struct drm_crtc *crtc, · 93 unmodified lines | |||
| 175 | static void ipu_crtc_atomic_begin(struct drm_crtc *crtc, | 177 | static void ipu_crtc_atomic_begin(struct drm_crtc *crtc, |
| 176 | struct drm_crtc_state *old_crtc_state) | 178 | struct drm_crtc_state *old_crtc_state) |
| 177 | { | 179 | { |
| 180 | drm_crtc_vblank_on(crtc); | ||
| 181 | |||
| 178 | spin_lock_irq(&crtc->dev->event_lock); | 182 | spin_lock_irq(&crtc->dev->event_lock); |
| 179 | if (crtc->state->event) { | 183 | if (crtc->state->event) { |
| 180 | WARN_ON(drm_crtc_vblank_get(crtc)); | 184 | WARN_ON(drm_crtc_vblank_get(crtc)); |
| @@ -319,13 +319,14 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, · 318 unmodified lines | |||
| 319 | return -EINVAL; | 319 | return -EINVAL; |
| 320 | 320 | ||
| 321 | /* | 321 | /* |
| 322 | * since we cannot touch active IDMAC channels, we do not support | 322 | * We support resizing active plane or changing its format by |
| 323 | * resizing the enabled plane or changing its format | 323 | * forcing CRTC mode change and disabling-enabling plane in plane's |
| 324 | * ->atomic_update callback. | ||
| 324 | */ | 325 | */ |
| 325 | if (old_fb && (state->src_w != old_state->src_w || | 326 | if (old_fb && (state->src_w != old_state->src_w || |
| 326 | state->src_h != old_state->src_h || | 327 | state->src_h != old_state->src_h || |
| 327 | fb->pixel_format != old_fb->pixel_format)) | 328 | fb->pixel_format != old_fb->pixel_format)) |
| 328 | return -EINVAL; | 329 | crtc_state->mode_changed = true; |
| 329 | 330 | ||
| 330 | eba = drm_plane_state_to_eba(state); | 331 | eba = drm_plane_state_to_eba(state); |
| 331 | 332 | ||
| @@ -336,7 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, · 4 unmodified lines | |||
| 336 | return -EINVAL; | 337 | return -EINVAL; |
| 337 | 338 | ||
| 338 | if (old_fb && fb->pitches[0] != old_fb->pitches[0]) | 339 | if (old_fb && fb->pitches[0] != old_fb->pitches[0]) |
| 339 | return -EINVAL; | 340 | crtc_state->mode_changed = true; |
| 340 | 341 | ||
| 341 | switch (fb->pixel_format) { | 342 | switch (fb->pixel_format) { |
| 342 | case DRM_FORMAT_YUV420: | 343 | case DRM_FORMAT_YUV420: |
| @@ -372,7 +373,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, · 29 unmodified lines | |||
| 372 | return -EINVAL; | 373 | return -EINVAL; |
| 373 | 374 | ||
| 374 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) | 375 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) |
| 375 | return -EINVAL; | 376 | crtc_state->mode_changed = true; |
| 376 | } | 377 | } |
| 377 | 378 | ||
| 378 | return 0; | 379 | return 0; |
| @@ -392,8 +393,14 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, · 13 unmodified lines | |||
| 392 | enum ipu_color_space ics; | 393 | enum ipu_color_space ics; |
| 393 | 394 | ||
| 394 | if (old_state->fb) { | 395 | if (old_state->fb) { |
| 395 | ipu_plane_atomic_set_base(ipu_plane, old_state); | 396 | struct drm_crtc_state *crtc_state = state->crtc->state; |
| 396 | return; | 397 | |
| 398 | if (!crtc_state->mode_changed) { | ||
| 399 | ipu_plane_atomic_set_base(ipu_plane, old_state); | ||
| 400 | return; | ||
| 401 | } | ||
| 402 | |||
| 403 | ipu_disable_plane(plane); | ||
| 397 | } | 404 | } |
| 398 | 405 | ||
| 399 | switch (ipu_plane->dp_flow) { | 406 | switch (ipu_plane->dp_flow) { |
| @@ -157,6 +157,12 @@ struct msm_drm_private { · 156 unmodified lines | |||
| 157 | struct shrinker shrinker; | 157 | struct shrinker shrinker; |
| 158 | 158 | ||
| 159 | struct msm_vblank_ctrl vblank_ctrl; | 159 | struct msm_vblank_ctrl vblank_ctrl; |
| 160 | |||
| 161 | /* task holding struct_mutex.. currently only used in submit path | ||
| 162 | * to detect and reject faults from copy_from_user() for submit | ||
| 163 | * ioctl. | ||
| 164 | */ | ||
| 165 | struct task_struct *struct_mutex_task; | ||
| 160 | }; | 166 | }; |
| 161 | 167 | ||
| 162 | struct msm_format { | 168 | struct msm_format { |
| @@ -196,11 +196,20 @@ int msm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) · 195 unmodified lines | |||
| 196 | { | 196 | { |
| 197 | struct drm_gem_object *obj = vma->vm_private_data; | 197 | struct drm_gem_object *obj = vma->vm_private_data; |
| 198 | struct drm_device *dev = obj->dev; | 198 | struct drm_device *dev = obj->dev; |
| 199 | struct msm_drm_private *priv = dev->dev_private; | ||
| 199 | struct page **pages; | 200 | struct page **pages; |
| 200 | unsigned long pfn; | 201 | unsigned long pfn; |
| 201 | pgoff_t pgoff; | 202 | pgoff_t pgoff; |
| 202 | int ret; | 203 | int ret; |
| 203 | 204 | ||
| 205 | /* This should only happen if userspace tries to pass a mmap'd | ||
| 206 | * but unfaulted gem bo vaddr into submit ioctl, triggering | ||
| 207 | * a page fault while struct_mutex is already held. This is | ||
| 208 | * not a valid use-case so just bail. | ||
| 209 | */ | ||
| 210 | if (priv->struct_mutex_task == current) | ||
| 211 | return VM_FAULT_SIGBUS; | ||
| 212 | |||
| 204 | /* Make sure we don't parallel update on a fault, nor move or remove | 213 | /* Make sure we don't parallel update on a fault, nor move or remove |
| 205 | * something from beneath our feet | 214 | * something from beneath our feet |
| 206 | */ | 215 | */ |
| @@ -64,6 +64,14 @@ void msm_gem_submit_free(struct msm_gem_submit *submit) · 63 unmodified lines | |||
| 64 | kfree(submit); | 64 | kfree(submit); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static inline unsigned long __must_check | ||
| 68 | copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) | ||
| 69 | { | ||
| 70 | if (access_ok(VERIFY_READ, from, n)) | ||
| 71 | return __copy_from_user_inatomic(to, from, n); | ||
| 72 | return -EFAULT; | ||
| 73 | } | ||
| 74 | |||
| 67 | static int submit_lookup_objects(struct msm_gem_submit *submit, | 75 | static int submit_lookup_objects(struct msm_gem_submit *submit, |
| 68 | struct drm_msm_gem_submit *args, struct drm_file *file) | 76 | struct drm_msm_gem_submit *args, struct drm_file *file) |
| 69 | { | 77 | { |
| @@ -71,6 +79,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, · 1 unmodified line | |||
| 71 | int ret = 0; | 79 | int ret = 0; |
| 72 | 80 | ||
| 73 | spin_lock(&file->table_lock); | 81 | spin_lock(&file->table_lock); |
| 82 | pagefault_disable(); | ||
| 74 | 83 | ||
| 75 | for (i = 0; i < args->nr_bos; i++) { | 84 | for (i = 0; i < args->nr_bos; i++) { |
| 76 | struct drm_msm_gem_submit_bo submit_bo; | 85 | struct drm_msm_gem_submit_bo submit_bo; |
| @@ -84,10 +93,15 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, · 7 unmodified lines | |||
| 84 | */ | 93 | */ |
| 85 | submit->bos[i].flags = 0; | 94 | submit->bos[i].flags = 0; |
| 86 | 95 | ||
| 87 | ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo)); | 96 | ret = copy_from_user_inatomic(&submit_bo, userptr, sizeof(submit_bo)); |
| 88 | if (ret) { | 97 | if (unlikely(ret)) { |
| 89 | ret = -EFAULT; | 98 | pagefault_enable(); |
| 90 | goto out_unlock; | 99 | spin_unlock(&file->table_lock); |
| 100 | ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo)); | ||
| 101 | if (ret) | ||
| 102 | goto out; | ||
| 103 | spin_lock(&file->table_lock); | ||
| 104 | pagefault_disable(); | ||
| 91 | } | 105 | } |
| 92 | 106 | ||
| 93 | if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) { | 107 | if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) { |
| @@ -127,9 +141,12 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, · 33 unmodified lines | |||
| 127 | } | 141 | } |
| 128 | 142 | ||
| 129 | out_unlock: | 143 | out_unlock: |
| 130 | submit->nr_bos = i; | 144 | pagefault_enable(); |
| 131 | spin_unlock(&file->table_lock); | 145 | spin_unlock(&file->table_lock); |
| 132 | 146 | ||
| 147 | out: | ||
| 148 | submit->nr_bos = i; | ||
| 149 | |||
| 133 | return ret; | 150 | return ret; |
| 134 | } | 151 | } |
| 135 | 152 | ||
| @@ -377,6 +394,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, · 241 unmodified lines | |||
| 377 | if (ret) | 394 | if (ret) |
| 378 | return ret; | 395 | return ret; |
| 379 | 396 | ||
| 397 | priv->struct_mutex_task = current; | ||
| 398 | |||
| 380 | submit = submit_create(dev, gpu, args->nr_bos, args->nr_cmds); | 399 | submit = submit_create(dev, gpu, args->nr_bos, args->nr_cmds); |
| 381 | if (!submit) { | 400 | if (!submit) { |
| 382 | ret = -ENOMEM; | 401 | ret = -ENOMEM; |
| @@ -468,6 +487,7 @@ out: · 85 unmodified lines | |||
| 468 | if (ret) | 487 | if (ret) |
| 469 | msm_gem_submit_free(submit); | 488 | msm_gem_submit_free(submit); |
| 470 | out_unlock: | 489 | out_unlock: |
| 490 | priv->struct_mutex_task = NULL; | ||
| 471 | mutex_unlock(&dev->struct_mutex); | 491 | mutex_unlock(&dev->struct_mutex); |
| 472 | return ret; | 492 | return ret; |
| 473 | } | 493 | } |
| @@ -225,6 +225,17 @@ static bool nouveau_pr3_present(struct pci_dev *pdev) · 224 unmodified lines | |||
| 225 | if (!parent_pdev) | 225 | if (!parent_pdev) |
| 226 | return false; | 226 | return false; |
| 227 | 227 | ||
| 228 | if (!parent_pdev->bridge_d3) { | ||
| 229 | /* | ||
| 230 | * Parent PCI bridge is currently not power managed. | ||
| 231 | * Since userspace can change these afterwards to be on | ||
| 232 | * the safe side we stick with _DSM and prevent usage of | ||
| 233 | * _PR3 from the bridge. | ||
| 234 | */ | ||
| 235 | pci_d3cold_disable(pdev); | ||
| 236 | return false; | ||
| 237 | } | ||
| 238 | |||
| 228 | parent_adev = ACPI_COMPANION(&parent_pdev->dev); | 239 | parent_adev = ACPI_COMPANION(&parent_pdev->dev); |
| 229 | if (!parent_adev) | 240 | if (!parent_adev) |
| 230 | return false; | 241 | return false; |
| @@ -73,10 +73,12 @@ static void qxl_fb_image_init(struct qxl_fb_image *qxl_fb_image, · 72 unmodified lines | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
| 76 | static struct fb_deferred_io qxl_defio = { | 77 | static struct fb_deferred_io qxl_defio = { |
| 77 | .delay = QXL_DIRTY_DELAY, | 78 | .delay = QXL_DIRTY_DELAY, |
| 78 | .deferred_io = drm_fb_helper_deferred_io, | 79 | .deferred_io = drm_fb_helper_deferred_io, |
| 79 | }; | 80 | }; |
| 81 | #endif | ||
| 80 | 82 | ||
| 81 | static struct fb_ops qxlfb_ops = { | 83 | static struct fb_ops qxlfb_ops = { |
| 82 | .owner = THIS_MODULE, | 84 | .owner = THIS_MODULE, |
| @@ -313,8 +315,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev, · 230 unmodified lines | |||
| 313 | goto out_destroy_fbi; | 315 | goto out_destroy_fbi; |
| 314 | } | 316 | } |
| 315 | 317 | ||
| 318 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
| 316 | info->fbdefio = &qxl_defio; | 319 | info->fbdefio = &qxl_defio; |
| 317 | fb_deferred_io_init(info); | 320 | fb_deferred_io_init(info); |
| 321 | #endif | ||
| 318 | 322 | ||
| 319 | qdev->fbdev_info = info; | 323 | qdev->fbdev_info = info; |
| 320 | qdev->fbdev_qfb = &qfbdev->qfb; | 324 | qdev->fbdev_qfb = &qfbdev->qfb; |
| @@ -627,7 +627,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, · 626 unmodified lines | |||
| 627 | if (radeon_crtc->ss.refdiv) { | 627 | if (radeon_crtc->ss.refdiv) { |
| 628 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; | 628 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; |
| 629 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; | 629 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; |
| 630 | if (rdev->family >= CHIP_RV770) | 630 | if (ASIC_IS_AVIVO(rdev) && |
| 631 | rdev->family != CHIP_RS780 && | ||
| 632 | rdev->family != CHIP_RS880) | ||
| 631 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 633 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
| 632 | } | 634 | } |
| 633 | } | 635 | } |
| @@ -263,8 +263,8 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, · 262 unmodified lines | |||
| 263 | 263 | ||
| 264 | rdev = radeon_get_rdev(bo->bdev); | 264 | rdev = radeon_get_rdev(bo->bdev); |
| 265 | ridx = radeon_copy_ring_index(rdev); | 265 | ridx = radeon_copy_ring_index(rdev); |
| 266 | old_start = old_mem->start << PAGE_SHIFT; | 266 | old_start = (u64)old_mem->start << PAGE_SHIFT; |
| 267 | new_start = new_mem->start << PAGE_SHIFT; | 267 | new_start = (u64)new_mem->start << PAGE_SHIFT; |
| 268 | 268 | ||
| 269 | switch (old_mem->mem_type) { | 269 | switch (old_mem->mem_type) { |
| 270 | case TTM_PL_VRAM: | 270 | case TTM_PL_VRAM: |
| @@ -840,6 +840,21 @@ static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = { · 839 unmodified lines | |||
| 840 | .destroy = tegra_output_encoder_destroy, | 840 | .destroy = tegra_output_encoder_destroy, |
| 841 | }; | 841 | }; |
| 842 | 842 | ||
| 843 | static void tegra_dsi_unprepare(struct tegra_dsi *dsi) | ||
| 844 | { | ||
| 845 | int err; | ||
| 846 | |||
| 847 | if (dsi->slave) | ||
| 848 | tegra_dsi_unprepare(dsi->slave); | ||
| 849 | |||
| 850 | err = tegra_mipi_disable(dsi->mipi); | ||
| 851 | if (err < 0) | ||
| 852 | dev_err(dsi->dev, "failed to disable MIPI calibration: %d\n", | ||
| 853 | err); | ||
| 854 | |||
| 855 | pm_runtime_put(dsi->dev); | ||
| 856 | } | ||
| 857 | |||
| 843 | static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) | 858 | static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) |
| 844 | { | 859 | { |
| 845 | struct tegra_output *output = encoder_to_output(encoder); | 860 | struct tegra_output *output = encoder_to_output(encoder); |
| @@ -876,7 +891,26 @@ static void tegra_dsi_encoder_disable(struct drm_encoder *encoder) · 30 unmodified lines | |||
| 876 | 891 | ||
| 877 | tegra_dsi_disable(dsi); | 892 | tegra_dsi_disable(dsi); |
| 878 | 893 | ||
| 879 | pm_runtime_put(dsi->dev); | 894 | tegra_dsi_unprepare(dsi); |
| 895 | } | ||
| 896 | |||
| 897 | static void tegra_dsi_prepare(struct tegra_dsi *dsi) | ||
| 898 | { | ||
| 899 | int err; | ||
| 900 | |||
| 901 | pm_runtime_get_sync(dsi->dev); | ||
| 902 | |||
| 903 | err = tegra_mipi_enable(dsi->mipi); | ||
| 904 | if (err < 0) | ||
| 905 | dev_err(dsi->dev, "failed to enable MIPI calibration: %d\n", | ||
| 906 | err); | ||
| 907 | |||
| 908 | err = tegra_dsi_pad_calibrate(dsi); | ||
| 909 | if (err < 0) | ||
| 910 | dev_err(dsi->dev, "MIPI calibration failed: %d\n", err); | ||
| 911 | |||
| 912 | if (dsi->slave) | ||
| 913 | tegra_dsi_prepare(dsi->slave); | ||
| 880 | } | 914 | } |
| 881 | 915 | ||
| 882 | static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) | 916 | static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) |
| @@ -887,13 +921,8 @@ static void tegra_dsi_encoder_enable(struct drm_encoder *encoder) · 4 unmodified lines | |||
| 887 | struct tegra_dsi *dsi = to_dsi(output); | 921 | struct tegra_dsi *dsi = to_dsi(output); |
| 888 | struct tegra_dsi_state *state; | 922 | struct tegra_dsi_state *state; |
| 889 | u32 value; | 923 | u32 value; |
| 890 | int err; | ||
| 891 | |||
| 892 | pm_runtime_get_sync(dsi->dev); | ||
| 893 | 924 | ||
| 894 | err = tegra_dsi_pad_calibrate(dsi); | 925 | tegra_dsi_prepare(dsi); |
| 895 | if (err < 0) | ||
| 896 | dev_err(dsi->dev, "MIPI calibration failed: %d\n", err); | ||
| 897 | 926 | ||
| 898 | state = tegra_dsi_get_state(dsi); | 927 | state = tegra_dsi_get_state(dsi); |
| 899 | 928 | ||
| @@ -203,6 +203,7 @@ static int udl_fb_open(struct fb_info *info, int user) · 202 unmodified lines | |||
| 203 | 203 | ||
| 204 | ufbdev->fb_count++; | 204 | ufbdev->fb_count++; |
| 205 | 205 | ||
| 206 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
| 206 | if (fb_defio && (info->fbdefio == NULL)) { | 207 | if (fb_defio && (info->fbdefio == NULL)) { |
| 207 | /* enable defio at last moment if not disabled by client */ | 208 | /* enable defio at last moment if not disabled by client */ |
| 208 | 209 | ||
| @@ -218,6 +219,7 @@ static int udl_fb_open(struct fb_info *info, int user) · 9 unmodified lines | |||
| 218 | info->fbdefio = fbdefio; | 219 | info->fbdefio = fbdefio; |
| 219 | fb_deferred_io_init(info); | 220 | fb_deferred_io_init(info); |
| 220 | } | 221 | } |
| 222 | #endif | ||
| 221 | 223 | ||
| 222 | pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", | 224 | pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", |
| 223 | info->node, user, info, ufbdev->fb_count); | 225 | info->node, user, info, ufbdev->fb_count); |
| @@ -235,12 +237,14 @@ static int udl_fb_release(struct fb_info *info, int user) · 11 unmodified lines | |||
| 235 | 237 | ||
| 236 | ufbdev->fb_count--; | 238 | ufbdev->fb_count--; |
| 237 | 239 | ||
| 240 | #ifdef CONFIG_DRM_FBDEV_EMULATION | ||
| 238 | if ((ufbdev->fb_count == 0) && (info->fbdefio)) { | 241 | if ((ufbdev->fb_count == 0) && (info->fbdefio)) { |
| 239 | fb_deferred_io_cleanup(info); | 242 | fb_deferred_io_cleanup(info); |
| 240 | kfree(info->fbdefio); | 243 | kfree(info->fbdefio); |
| 241 | info->fbdefio = NULL; | 244 | info->fbdefio = NULL; |
| 242 | info->fbops->fb_mmap = udl_fb_mmap; | 245 | info->fbops->fb_mmap = udl_fb_mmap; |
| 243 | } | 246 | } |
| 247 | #endif | ||
| 244 | 248 | ||
| 245 | pr_warn("released /dev/fb%d user=%d count=%d\n", | 249 | pr_warn("released /dev/fb%d user=%d count=%d\n", |
| 246 | info->node, user, ufbdev->fb_count); | 250 | info->node, user, ufbdev->fb_count); |
| @@ -144,7 +144,7 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, · 143 unmodified lines | |||
| 144 | return &vc4->bo_cache.size_list[page_index]; | 144 | return &vc4->bo_cache.size_list[page_index]; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | void vc4_bo_cache_purge(struct drm_device *dev) | 147 | static void vc4_bo_cache_purge(struct drm_device *dev) |
| 148 | { | 148 | { |
| 149 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 149 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
| 150 | 150 | ||
| @@ -57,21 +57,21 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data, · 56 unmodified lines | |||
| 57 | switch (args->param) { | 57 | switch (args->param) { |
| 58 | case DRM_VC4_PARAM_V3D_IDENT0: | 58 | case DRM_VC4_PARAM_V3D_IDENT0: |
| 59 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); | 59 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); |
| 60 | if (ret) | 60 | if (ret < 0) |
| 61 | return ret; | 61 | return ret; |
| 62 | args->value = V3D_READ(V3D_IDENT0); | 62 | args->value = V3D_READ(V3D_IDENT0); |
| 63 | pm_runtime_put(&vc4->v3d->pdev->dev); | 63 | pm_runtime_put(&vc4->v3d->pdev->dev); |
| 64 | break; | 64 | break; |
| 65 | case DRM_VC4_PARAM_V3D_IDENT1: | 65 | case DRM_VC4_PARAM_V3D_IDENT1: |
| 66 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); | 66 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); |
| 67 | if (ret) | 67 | if (ret < 0) |
| 68 | return ret; | 68 | return ret; |
| 69 | args->value = V3D_READ(V3D_IDENT1); | 69 | args->value = V3D_READ(V3D_IDENT1); |
| 70 | pm_runtime_put(&vc4->v3d->pdev->dev); | 70 | pm_runtime_put(&vc4->v3d->pdev->dev); |
| 71 | break; | 71 | break; |
| 72 | case DRM_VC4_PARAM_V3D_IDENT2: | 72 | case DRM_VC4_PARAM_V3D_IDENT2: |
| 73 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); | 73 | ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); |
| 74 | if (ret) | 74 | if (ret < 0) |
| 75 | return ret; | 75 | return ret; |
| 76 | args->value = V3D_READ(V3D_IDENT2); | 76 | args->value = V3D_READ(V3D_IDENT2); |
| 77 | pm_runtime_put(&vc4->v3d->pdev->dev); | 77 | pm_runtime_put(&vc4->v3d->pdev->dev); |
| @@ -321,6 +321,15 @@ vc4_first_render_job(struct vc4_dev *vc4) · 320 unmodified lines | |||
| 321 | struct vc4_exec_info, head); | 321 | struct vc4_exec_info, head); |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static inline struct vc4_exec_info * | ||
| 325 | vc4_last_render_job(struct vc4_dev *vc4) | ||
| 326 | { | ||
| 327 | if (list_empty(&vc4->render_job_list)) | ||
| 328 | return NULL; | ||
| 329 | return list_last_entry(&vc4->render_job_list, | ||
| 330 | struct vc4_exec_info, head); | ||
| 331 | } | ||
| 332 | |||
| 324 | /** | 333 | /** |
| 325 | * struct vc4_texture_sample_info - saves the offsets into the UBO for texture | 334 | * struct vc4_texture_sample_info - saves the offsets into the UBO for texture |
| 326 | * setup parameters. | 335 | * setup parameters. |
| @@ -534,8 +534,8 @@ vc4_cl_lookup_bos(struct drm_device *dev, · 533 unmodified lines | |||
| 534 | return -EINVAL; | 534 | return -EINVAL; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | exec->bo = kcalloc(exec->bo_count, sizeof(struct drm_gem_cma_object *), | 537 | exec->bo = drm_calloc_large(exec->bo_count, |
| 538 | GFP_KERNEL); | 538 | sizeof(struct drm_gem_cma_object *)); |
| 539 | if (!exec->bo) { | 539 | if (!exec->bo) { |
| 540 | DRM_ERROR("Failed to allocate validated BO pointers\n"); | 540 | DRM_ERROR("Failed to allocate validated BO pointers\n"); |
| 541 | return -ENOMEM; | 541 | return -ENOMEM; |
| @@ -572,8 +572,8 @@ vc4_cl_lookup_bos(struct drm_device *dev, · 30 unmodified lines | |||
| 572 | spin_unlock(&file_priv->table_lock); | 572 | spin_unlock(&file_priv->table_lock); |
| 573 | 573 | ||
| 574 | fail: | 574 | fail: |
| 575 | kfree(handles); | 575 | drm_free_large(handles); |
| 576 | return 0; | 576 | return ret; |
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | static int | 579 | static int |
| @@ -608,7 +608,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) · 28 unmodified lines | |||
| 608 | * read the contents back for validation, and I think the | 608 | * read the contents back for validation, and I think the |
| 609 | * bo->vaddr is uncached access. | 609 | * bo->vaddr is uncached access. |
| 610 | */ | 610 | */ |
| 611 | temp = kmalloc(temp_size, GFP_KERNEL); | 611 | temp = drm_malloc_ab(temp_size, 1); |
| 612 | if (!temp) { | 612 | if (!temp) { |
| 613 | DRM_ERROR("Failed to allocate storage for copying " | 613 | DRM_ERROR("Failed to allocate storage for copying " |
| 614 | "in bin/render CLs.\n"); | 614 | "in bin/render CLs.\n"); |
| @@ -675,7 +675,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) · 60 unmodified lines | |||
| 675 | ret = vc4_validate_shader_recs(dev, exec); | 675 | ret = vc4_validate_shader_recs(dev, exec); |
| 676 | 676 | ||
| 677 | fail: | 677 | fail: |
| 678 | kfree(temp); | 678 | drm_free_large(temp); |
| 679 | return ret; | 679 | return ret; |
| 680 | } | 680 | } |
| 681 | 681 | ||
| @@ -688,7 +688,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) · 6 unmodified lines | |||
| 688 | if (exec->bo) { | 688 | if (exec->bo) { |
| 689 | for (i = 0; i < exec->bo_count; i++) | 689 | for (i = 0; i < exec->bo_count; i++) |
| 690 | drm_gem_object_unreference_unlocked(&exec->bo[i]->base); | 690 | drm_gem_object_unreference_unlocked(&exec->bo[i]->base); |
| 691 | kfree(exec->bo); | 691 | drm_free_large(exec->bo); |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | while (!list_empty(&exec->unref_list)) { | 694 | while (!list_empty(&exec->unref_list)) { |
| @@ -942,8 +942,8 @@ vc4_gem_destroy(struct drm_device *dev) · 247 unmodified lines | |||
| 942 | vc4->overflow_mem = NULL; | 942 | vc4->overflow_mem = NULL; |
| 943 | } | 943 | } |
| 944 | 944 | ||
| 945 | vc4_bo_cache_destroy(dev); | ||
| 946 | |||
| 947 | if (vc4->hang_state) | 945 | if (vc4->hang_state) |
| 948 | vc4_free_hang_state(dev, vc4->hang_state); | 946 | vc4_free_hang_state(dev, vc4->hang_state); |
| 947 | |||
| 948 | vc4_bo_cache_destroy(dev); | ||
| 949 | } | 949 | } |
| @@ -83,8 +83,10 @@ vc4_overflow_mem_work(struct work_struct *work) · 82 unmodified lines | |||
| 83 | 83 | ||
| 84 | spin_lock_irqsave(&vc4->job_lock, irqflags); | 84 | spin_lock_irqsave(&vc4->job_lock, irqflags); |
| 85 | current_exec = vc4_first_bin_job(vc4); | 85 | current_exec = vc4_first_bin_job(vc4); |
| 86 | if (!current_exec) | ||
| 87 | current_exec = vc4_last_render_job(vc4); | ||
| 86 | if (current_exec) { | 88 | if (current_exec) { |
| 87 | vc4->overflow_mem->seqno = vc4->finished_seqno + 1; | 89 | vc4->overflow_mem->seqno = current_exec->seqno; |
| 88 | list_add_tail(&vc4->overflow_mem->unref_head, | 90 | list_add_tail(&vc4->overflow_mem->unref_head, |
| 89 | ¤t_exec->unref_list); | 91 | ¤t_exec->unref_list); |
| 90 | vc4->overflow_mem = NULL; | 92 | vc4->overflow_mem = NULL; |
| @@ -309,8 +309,14 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade · 308 unmodified lines | |||
| 309 | * of uniforms on each side. However, this scheme is easy to | 309 | * of uniforms on each side. However, this scheme is easy to |
| 310 | * validate so it's all we allow for now. | 310 | * validate so it's all we allow for now. |
| 311 | */ | 311 | */ |
| 312 | 312 | switch (QPU_GET_FIELD(inst, QPU_SIG)) { | |
| 313 | if (QPU_GET_FIELD(inst, QPU_SIG) != QPU_SIG_NONE) { | 313 | case QPU_SIG_NONE: |
| 314 | case QPU_SIG_SCOREBOARD_UNLOCK: | ||
| 315 | case QPU_SIG_COLOR_LOAD: | ||
| 316 | case QPU_SIG_LOAD_TMU0: | ||
| 317 | case QPU_SIG_LOAD_TMU1: | ||
| 318 | break; | ||
| 319 | default: | ||
| 314 | DRM_ERROR("uniforms address change must be " | 320 | DRM_ERROR("uniforms address change must be " |
| 315 | "normal math\n"); | 321 | "normal math\n"); |
| 316 | return false; | 322 | return false; |
| @@ -242,20 +242,6 @@ struct tegra_mipi_device *tegra_mipi_request(struct device *device) · 241 unmodified lines | |||
| 242 | dev->pads = args.args[0]; | 242 | dev->pads = args.args[0]; |
| 243 | dev->device = device; | 243 | dev->device = device; |
| 244 | 244 | ||
| 245 | mutex_lock(&dev->mipi->lock); | ||
| 246 | |||
| 247 | if (dev->mipi->usage_count++ == 0) { | ||
| 248 | err = tegra_mipi_power_up(dev->mipi); | ||
| 249 | if (err < 0) { | ||
| 250 | dev_err(dev->mipi->dev, | ||
| 251 | "failed to power up MIPI bricks: %d\n", | ||
| 252 | err); | ||
| 253 | return ERR_PTR(err); | ||
| 254 | } | ||
| 255 | } | ||
| 256 | |||
| 257 | mutex_unlock(&dev->mipi->lock); | ||
| 258 | |||
| 259 | return dev; | 245 | return dev; |
| 260 | 246 | ||
| 261 | put: | 247 | put: |
| @@ -270,29 +256,42 @@ EXPORT_SYMBOL(tegra_mipi_request); · 8 unmodified lines | |||
| 270 | 256 | ||
| 271 | void tegra_mipi_free(struct tegra_mipi_device *device) | 257 | void tegra_mipi_free(struct tegra_mipi_device *device) |
| 272 | { | 258 | { |
| 273 | int err; | 259 | platform_device_put(device->pdev); |
| 260 | kfree(device); | ||
| 261 | } | ||
| 262 | EXPORT_SYMBOL(tegra_mipi_free); | ||
| 274 | 263 | ||
| 275 | mutex_lock(&device->mipi->lock); | 264 | int tegra_mipi_enable(struct tegra_mipi_device *dev) |
| 265 | { | ||
| 266 | int err = 0; | ||
| 276 | 267 | ||
| 277 | if (--device->mipi->usage_count == 0) { | 268 | mutex_lock(&dev->mipi->lock); |
| 278 | err = tegra_mipi_power_down(device->mipi); | ||
| 279 | if (err < 0) { | ||
| 280 | /* | ||
| 281 | * Not much that can be done here, so an error message | ||
| 282 | * will have to do. | ||
| 283 | */ | ||
| 284 | dev_err(device->mipi->dev, | ||
| 285 | "failed to power down MIPI bricks: %d\n", | ||
| 286 | err); | ||
| 287 | } | ||
| 288 | } | ||
| 289 | 269 | ||
| 290 | mutex_unlock(&device->mipi->lock); | 270 | if (dev->mipi->usage_count++ == 0) |
| 271 | err = tegra_mipi_power_up(dev->mipi); | ||
| 272 | |||
| 273 | mutex_unlock(&dev->mipi->lock); | ||
| 274 | |||
| 275 | return err; | ||
| 291 | 276 | ||
| 292 | platform_device_put(device->pdev); | ||
| 293 | kfree(device); | ||
| 294 | } | 277 | } |
| 295 | EXPORT_SYMBOL(tegra_mipi_free); | 278 | EXPORT_SYMBOL(tegra_mipi_enable); |
| 279 | |||
| 280 | int tegra_mipi_disable(struct tegra_mipi_device *dev) | ||
| 281 | { | ||
| 282 | int err = 0; | ||
| 283 | |||
| 284 | mutex_lock(&dev->mipi->lock); | ||
| 285 | |||
| 286 | if (--dev->mipi->usage_count == 0) | ||
| 287 | err = tegra_mipi_power_down(dev->mipi); | ||
| 288 | |||
| 289 | mutex_unlock(&dev->mipi->lock); | ||
| 290 | |||
| 291 | return err; | ||
| 292 | |||
| 293 | } | ||
| 294 | EXPORT_SYMBOL(tegra_mipi_disable); | ||
| 296 | 295 | ||
| 297 | static int tegra_mipi_wait(struct tegra_mipi *mipi) | 296 | static int tegra_mipi_wait(struct tegra_mipi *mipi) |
| 298 | { | 297 | { |
| @@ -2015,6 +2015,7 @@ static struct attribute *it87_attributes_in[] = { · 2014 unmodified lines | |||
| 2015 | &sensor_dev_attr_in10_input.dev_attr.attr, /* 41 */ | 2015 | &sensor_dev_attr_in10_input.dev_attr.attr, /* 41 */ |
| 2016 | &sensor_dev_attr_in11_input.dev_attr.attr, /* 41 */ | 2016 | &sensor_dev_attr_in11_input.dev_attr.attr, /* 41 */ |
| 2017 | &sensor_dev_attr_in12_input.dev_attr.attr, /* 41 */ | 2017 | &sensor_dev_attr_in12_input.dev_attr.attr, /* 41 */ |
| 2018 | NULL | ||
| 2018 | }; | 2019 | }; |
| 2019 | 2020 | ||
| 2020 | static const struct attribute_group it87_group_in = { | 2021 | static const struct attribute_group it87_group_in = { |
| @@ -643,7 +643,7 @@ static int bcm_kona_i2c_xfer(struct i2c_adapter *adapter, · 642 unmodified lines | |||
| 643 | if (rc < 0) { | 643 | if (rc < 0) { |
| 644 | dev_err(dev->device, | 644 | dev_err(dev->device, |
| 645 | "restart cmd failed rc = %d\n", rc); | 645 | "restart cmd failed rc = %d\n", rc); |
| 646 | goto xfer_send_stop; | 646 | goto xfer_send_stop; |
| 647 | } | 647 | } |
| 648 | } | 648 | } |
| 649 | 649 | ||
| @@ -767,7 +767,7 @@ static int cdns_i2c_setclk(unsigned long clk_in, struct cdns_i2c *id) · 766 unmodified lines | |||
| 767 | * depending on the scaling direction. | 767 | * depending on the scaling direction. |
| 768 | * | 768 | * |
| 769 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK | 769 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK |
| 770 | * to acknowedge the change, NOTIFY_DONE if the notification is | 770 | * to acknowledge the change, NOTIFY_DONE if the notification is |
| 771 | * considered irrelevant. | 771 | * considered irrelevant. |
| 772 | */ | 772 | */ |
| 773 | static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long | 773 | static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long |
| @@ -367,13 +367,17 @@ int i2c_dw_init(struct dw_i2c_dev *dev) · 366 unmodified lines | |||
| 367 | dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt); | 367 | dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt); |
| 368 | 368 | ||
| 369 | /* Configure SDA Hold Time if required */ | 369 | /* Configure SDA Hold Time if required */ |
| 370 | if (dev->sda_hold_time) { | 370 | reg = dw_readl(dev, DW_IC_COMP_VERSION); |
| 371 | reg = dw_readl(dev, DW_IC_COMP_VERSION); | 371 | if (reg >= DW_IC_SDA_HOLD_MIN_VERS) { |
| 372 | if (reg >= DW_IC_SDA_HOLD_MIN_VERS) | 372 | if (dev->sda_hold_time) { |
| 373 | dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD); | 373 | dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD); |
| 374 | else | 374 | } else { |
| 375 | dev_warn(dev->dev, | 375 | /* Keep previous hold time setting if no one set it */ |
| 376 | "Hardware too old to adjust SDA hold time."); | 376 | dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD); |
| 377 | } | ||
| 378 | } else { | ||
| 379 | dev_warn(dev->dev, | ||
| 380 | "Hardware too old to adjust SDA hold time.\n"); | ||
| 377 | } | 381 | } |
| 378 | 382 | ||
| 379 | /* Configure Tx/Rx FIFO threshold levels */ | 383 | /* Configure Tx/Rx FIFO threshold levels */ |
| @@ -773,13 +773,6 @@ static int pch_i2c_probe(struct pci_dev *pdev, · 772 unmodified lines | |||
| 773 | /* Set the number of I2C channel instance */ | 773 | /* Set the number of I2C channel instance */ |
| 774 | adap_info->ch_num = id->driver_data; | 774 | adap_info->ch_num = id->driver_data; |
| 775 | 775 | ||
| 776 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
| 777 | KBUILD_MODNAME, adap_info); | ||
| 778 | if (ret) { | ||
| 779 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
| 780 | goto err_request_irq; | ||
| 781 | } | ||
| 782 | |||
| 783 | for (i = 0; i < adap_info->ch_num; i++) { | 776 | for (i = 0; i < adap_info->ch_num; i++) { |
| 784 | pch_adap = &adap_info->pch_data[i].pch_adapter; | 777 | pch_adap = &adap_info->pch_data[i].pch_adapter; |
| 785 | adap_info->pch_i2c_suspended = false; | 778 | adap_info->pch_i2c_suspended = false; |
| @@ -797,6 +790,17 @@ static int pch_i2c_probe(struct pci_dev *pdev, · 11 unmodified lines | |||
| 797 | 790 | ||
| 798 | pch_adap->dev.of_node = pdev->dev.of_node; | 791 | pch_adap->dev.of_node = pdev->dev.of_node; |
| 799 | pch_adap->dev.parent = &pdev->dev; | 792 | pch_adap->dev.parent = &pdev->dev; |
| 793 | } | ||
| 794 | |||
| 795 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
| 796 | KBUILD_MODNAME, adap_info); | ||
| 797 | if (ret) { | ||
| 798 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
| 799 | goto err_request_irq; | ||
| 800 | } | ||
| 801 | |||
| 802 | for (i = 0; i < adap_info->ch_num; i++) { | ||
| 803 | pch_adap = &adap_info->pch_data[i].pch_adapter; | ||
| 800 | 804 | ||
| 801 | pch_i2c_init(&adap_info->pch_data[i]); | 805 | pch_i2c_init(&adap_info->pch_data[i]); |
| 802 | 806 | ||
| @@ -1599,7 +1599,8 @@ static int qup_i2c_pm_resume_runtime(struct device *device) · 1598 unmodified lines | |||
| 1599 | #ifdef CONFIG_PM_SLEEP | 1599 | #ifdef CONFIG_PM_SLEEP |
| 1600 | static int qup_i2c_suspend(struct device *device) | 1600 | static int qup_i2c_suspend(struct device *device) |
| 1601 | { | 1601 | { |
| 1602 | qup_i2c_pm_suspend_runtime(device); | 1602 | if (!pm_runtime_suspended(device)) |
| 1603 | return qup_i2c_pm_suspend_runtime(device); | ||
| 1603 | return 0; | 1604 | return 0; |
| 1604 | } | 1605 | } |
| 1605 | 1606 | ||
| @@ -378,7 +378,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) · 377 unmodified lines | |||
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); | 380 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); |
| 381 | if (dma_mapping_error(dev, dma_addr)) { | 381 | if (dma_mapping_error(chan->device->dev, dma_addr)) { |
| 382 | dev_dbg(dev, "dma map failed, using PIO\n"); | 382 | dev_dbg(dev, "dma map failed, using PIO\n"); |
| 383 | return; | 383 | return; |
| 384 | } | 384 | } |
| @@ -918,7 +918,7 @@ static void rk3x_i2c_adapt_div(struct rk3x_i2c *i2c, unsigned long clk_rate) · 917 unmodified lines | |||
| 918 | * Code adapted from i2c-cadence.c. | 918 | * Code adapted from i2c-cadence.c. |
| 919 | * | 919 | * |
| 920 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK | 920 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK |
| 921 | * to acknowedge the change, NOTIFY_DONE if the notification is | 921 | * to acknowledge the change, NOTIFY_DONE if the notification is |
| 922 | * considered irrelevant. | 922 | * considered irrelevant. |
| 923 | */ | 923 | */ |
| 924 | static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long | 924 | static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long |
| @@ -1111,6 +1111,15 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap, · 186 unmodified lines | |||
| 1111 | return ret < 0 ? ret : num; | 1111 | return ret < 0 ? ret : num; |
| 1112 | } | 1112 | } |
| 1113 | 1113 | ||
| 1114 | static __maybe_unused int rk3x_i2c_resume(struct device *dev) | ||
| 1115 | { | ||
| 1116 | struct rk3x_i2c *i2c = dev_get_drvdata(dev); | ||
| 1117 | |||
| 1118 | rk3x_i2c_adapt_div(i2c, clk_get_rate(i2c->clk)); | ||
| 1119 | |||
| 1120 | return 0; | ||
| 1121 | } | ||
| 1122 | |||
| 1114 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) | 1123 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) |
| 1115 | { | 1124 | { |
| 1116 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; | 1125 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; |
| @@ -1334,12 +1343,15 @@ static int rk3x_i2c_remove(struct platform_device *pdev) · 217 unmodified lines | |||
| 1334 | return 0; | 1343 | return 0; |
| 1335 | } | 1344 | } |
| 1336 | 1345 | ||
| 1346 | static SIMPLE_DEV_PM_OPS(rk3x_i2c_pm_ops, NULL, rk3x_i2c_resume); | ||
| 1347 | |||
| 1337 | static struct platform_driver rk3x_i2c_driver = { | 1348 | static struct platform_driver rk3x_i2c_driver = { |
| 1338 | .probe = rk3x_i2c_probe, | 1349 | .probe = rk3x_i2c_probe, |
| 1339 | .remove = rk3x_i2c_remove, | 1350 | .remove = rk3x_i2c_remove, |
| 1340 | .driver = { | 1351 | .driver = { |
| 1341 | .name = "rk3x-i2c", | 1352 | .name = "rk3x-i2c", |
| 1342 | .of_match_table = rk3x_i2c_match, | 1353 | .of_match_table = rk3x_i2c_match, |
| 1354 | .pm = &rk3x_i2c_pm_ops, | ||
| 1343 | }, | 1355 | }, |
| 1344 | }; | 1356 | }; |
| 1345 | 1357 | ||
| @@ -610,7 +610,7 @@ static void sh_mobile_i2c_xfer_dma(struct sh_mobile_i2c_data *pd) · 609 unmodified lines | |||
| 610 | return; | 610 | return; |
| 611 | 611 | ||
| 612 | dma_addr = dma_map_single(chan->device->dev, pd->msg->buf, pd->msg->len, dir); | 612 | dma_addr = dma_map_single(chan->device->dev, pd->msg->buf, pd->msg->len, dir); |
| 613 | if (dma_mapping_error(pd->dev, dma_addr)) { | 613 | if (dma_mapping_error(chan->device->dev, dma_addr)) { |
| 614 | dev_dbg(pd->dev, "dma map failed, using PIO\n"); | 614 | dev_dbg(pd->dev, "dma map failed, using PIO\n"); |
| 615 | return; | 615 | return; |
| 616 | } | 616 | } |
| @@ -37,8 +37,6 @@ struct i2c_demux_pinctrl_priv { · 36 unmodified lines | |||
| 37 | struct i2c_demux_pinctrl_chan chan[]; | 37 | struct i2c_demux_pinctrl_chan chan[]; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static struct property status_okay = { .name = "status", .length = 3, .value = "ok" }; | ||
| 41 | |||
| 42 | static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | 40 | static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
| 43 | { | 41 | { |
| 44 | struct i2c_demux_pinctrl_priv *priv = adap->algo_data; | 42 | struct i2c_demux_pinctrl_priv *priv = adap->algo_data; |
| @@ -107,6 +105,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne · 62 unmodified lines | |||
| 107 | of_changeset_revert(&priv->chan[new_chan].chgset); | 105 | of_changeset_revert(&priv->chan[new_chan].chgset); |
| 108 | err: | 106 | err: |
| 109 | dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret); | 107 | dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret); |
| 108 | priv->cur_chan = -EINVAL; | ||
| 110 | return ret; | 109 | return ret; |
| 111 | } | 110 | } |
| 112 | 111 | ||
| @@ -192,6 +191,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 79 unmodified lines | |||
| 192 | { | 191 | { |
| 193 | struct device_node *np = pdev->dev.of_node; | 192 | struct device_node *np = pdev->dev.of_node; |
| 194 | struct i2c_demux_pinctrl_priv *priv; | 193 | struct i2c_demux_pinctrl_priv *priv; |
| 194 | struct property *props; | ||
| 195 | int num_chan, i, j, err; | 195 | int num_chan, i, j, err; |
| 196 | 196 | ||
| 197 | num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL); | 197 | num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL); |
| @@ -202,7 +202,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 4 unmodified lines | |||
| 202 | 202 | ||
| 203 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv) | 203 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv) |
| 204 | + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL); | 204 | + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL); |
| 205 | if (!priv) | 205 | |
| 206 | props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL); | ||
| 207 | |||
| 208 | if (!priv || !props) | ||
| 206 | return -ENOMEM; | 209 | return -ENOMEM; |
| 207 | 210 | ||
| 208 | err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name); | 211 | err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name); |
| @@ -220,8 +223,12 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 220 | } | 223 | } |
| 221 | priv->chan[i].parent_np = adap_np; | 224 | priv->chan[i].parent_np = adap_np; |
| 222 | 225 | ||
| 226 | props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL); | ||
| 227 | props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL); | ||
| 228 | props[i].length = 3; | ||
| 229 | |||
| 223 | of_changeset_init(&priv->chan[i].chgset); | 230 | of_changeset_init(&priv->chan[i].chgset); |
| 224 | of_changeset_update_property(&priv->chan[i].chgset, adap_np, &status_okay); | 231 | of_changeset_update_property(&priv->chan[i].chgset, adap_np, &props[i]); |
| 225 | } | 232 | } |
| 226 | 233 | ||
| 227 | priv->num_chan = num_chan; | 234 | priv->num_chan = num_chan; |
| @@ -164,7 +164,7 @@ static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) · 163 unmodified lines | |||
| 164 | /* Only select the channel if its different from the last channel */ | 164 | /* Only select the channel if its different from the last channel */ |
| 165 | if (data->last_chan != regval) { | 165 | if (data->last_chan != regval) { |
| 166 | ret = pca954x_reg_write(muxc->parent, client, regval); | 166 | ret = pca954x_reg_write(muxc->parent, client, regval); |
| 167 | data->last_chan = regval; | 167 | data->last_chan = ret ? 0 : regval; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | return ret; | 170 | return ret; |
| @@ -20,6 +20,8 @@ config BMA180 · 19 unmodified lines | |||
| 20 | config BMA220 | 20 | config BMA220 |
| 21 | tristate "Bosch BMA220 3-Axis Accelerometer Driver" | 21 | tristate "Bosch BMA220 3-Axis Accelerometer Driver" |
| 22 | depends on SPI | 22 | depends on SPI |
| 23 | select IIO_BUFFER | ||
| 24 | select IIO_TRIGGERED_BUFFER | ||
| 23 | help | 25 | help |
| 24 | Say yes here to add support for the Bosch BMA220 triaxial | 26 | Say yes here to add support for the Bosch BMA220 triaxial |
| 25 | acceleration sensor. | 27 | acceleration sensor. |
| @@ -234,7 +236,8 @@ config STK8312 · 208 unmodified lines | |||
| 234 | config STK8BA50 | 236 | config STK8BA50 |
| 235 | tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver" | 237 | tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver" |
| 236 | depends on I2C | 238 | depends on I2C |
| 237 | depends on IIO_TRIGGER | 239 | select IIO_BUFFER |
| 240 | select IIO_TRIGGERED_BUFFER | ||
| 238 | help | 241 | help |
| 239 | Say yes here to get support for the Sensortek STK8BA50 3-axis | 242 | Say yes here to get support for the Sensortek STK8BA50 3-axis |
| 240 | accelerometer. | 243 | accelerometer. |
| @@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi) · 252 unmodified lines | |||
| 253 | if (ret < 0) | 253 | if (ret < 0) |
| 254 | return ret; | 254 | return ret; |
| 255 | 255 | ||
| 256 | ret = iio_triggered_buffer_setup(indio_dev, NULL, | 256 | ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, |
| 257 | bma220_trigger_handler, NULL); | 257 | bma220_trigger_handler, NULL); |
| 258 | if (ret < 0) { | 258 | if (ret < 0) { |
| 259 | dev_err(&spi->dev, "iio triggered buffer setup failed\n"); | 259 | dev_err(&spi->dev, "iio triggered buffer setup failed\n"); |
| @@ -67,6 +67,9 @@ · 66 unmodified lines | |||
| 67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 | 67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 |
| 68 | #define BMC150_ACCEL_DEF_BW 125 | 68 | #define BMC150_ACCEL_DEF_BW 125 |
| 69 | 69 | ||
| 70 | #define BMC150_ACCEL_REG_RESET 0x14 | ||
| 71 | #define BMC150_ACCEL_RESET_VAL 0xB6 | ||
| 72 | |||
| 70 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 | 73 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 |
| 71 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) | 74 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) |
| 72 | 75 | ||
| @@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) · 1424 unmodified lines | |||
| 1497 | int ret, i; | 1500 | int ret, i; |
| 1498 | unsigned int val; | 1501 | unsigned int val; |
| 1499 | 1502 | ||
| 1503 | /* | ||
| 1504 | * Reset chip to get it in a known good state. A delay of 1.8ms after | ||
| 1505 | * reset is required according to the data sheets of supported chips. | ||
| 1506 | */ | ||
| 1507 | regmap_write(data->regmap, BMC150_ACCEL_REG_RESET, | ||
| 1508 | BMC150_ACCEL_RESET_VAL); | ||
| 1509 | usleep_range(1800, 2500); | ||
| 1510 | |||
| 1500 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); | 1511 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); |
| 1501 | if (ret < 0) { | 1512 | if (ret < 0) { |
| 1502 | dev_err(dev, "Error: Reading chip id\n"); | 1513 | dev_err(dev, "Error: Reading chip id\n"); |
| @@ -160,11 +160,13 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, · 159 unmodified lines | |||
| 160 | if (ret < 0) | 160 | if (ret < 0) |
| 161 | goto error_ret; | 161 | goto error_ret; |
| 162 | *val = ret; | 162 | *val = ret; |
| 163 | ret = IIO_VAL_INT; | ||
| 163 | break; | 164 | break; |
| 164 | case IIO_CHAN_INFO_SCALE: | 165 | case IIO_CHAN_INFO_SCALE: |
| 165 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); | 166 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
| 166 | if (ret < 0) | 167 | if (ret < 0) |
| 167 | goto error_ret; | 168 | goto error_ret; |
| 169 | *val = 0; | ||
| 168 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; | 170 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
| 169 | ret = IIO_VAL_INT_PLUS_MICRO; | 171 | ret = IIO_VAL_INT_PLUS_MICRO; |
| 170 | break; | 172 | break; |
| @@ -389,6 +389,7 @@ config QCOM_SPMI_VADC · 388 unmodified lines | |||
| 389 | config ROCKCHIP_SARADC | 389 | config ROCKCHIP_SARADC |
| 390 | tristate "Rockchip SARADC driver" | 390 | tristate "Rockchip SARADC driver" |
| 391 | depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) | 391 | depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) |
| 392 | depends on RESET_CONTROLLER | ||
| 392 | help | 393 | help |
| 393 | Say yes here to build support for the SARADC found in SoCs from | 394 | Say yes here to build support for the SARADC found in SoCs from |
| 394 | Rockchip. | 395 | Rockchip. |
| @@ -527,6 +527,7 @@ static struct attribute_group ad799x_event_attrs_group = { · 526 unmodified lines | |||
| 527 | static const struct iio_info ad7991_info = { | 527 | static const struct iio_info ad7991_info = { |
| 528 | .read_raw = &ad799x_read_raw, | 528 | .read_raw = &ad799x_read_raw, |
| 529 | .driver_module = THIS_MODULE, | 529 | .driver_module = THIS_MODULE, |
| 530 | .update_scan_mode = ad799x_update_scan_mode, | ||
| 530 | }; | 531 | }; |
| 531 | 532 | ||
| 532 | static const struct iio_info ad7993_4_7_8_noirq_info = { | 533 | static const struct iio_info ad7993_4_7_8_noirq_info = { |
| @@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) · 380 unmodified lines | |||
| 381 | st->ts_bufferedmeasure = false; | 381 | st->ts_bufferedmeasure = false; |
| 382 | input_report_key(st->ts_input, BTN_TOUCH, 0); | 382 | input_report_key(st->ts_input, BTN_TOUCH, 0); |
| 383 | input_sync(st->ts_input); | 383 | input_sync(st->ts_input); |
| 384 | } else if (status & AT91_ADC_EOC(3)) { | 384 | } else if (status & AT91_ADC_EOC(3) && st->ts_input) { |
| 385 | /* Conversion finished */ | 385 | /* Conversion finished and we've a touchscreen */ |
| 386 | if (st->ts_bufferedmeasure) { | 386 | if (st->ts_bufferedmeasure) { |
| 387 | /* | 387 | /* |
| 388 | * Last measurement is always discarded, since it can | 388 | * Last measurement is always discarded, since it can |
| @@ -21,6 +21,8 @@ · 20 unmodified lines | |||
| 21 | #include <linux/of_device.h> | 21 | #include <linux/of_device.h> |
| 22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
| 23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
| 24 | #include <linux/delay.h> | ||
| 25 | #include <linux/reset.h> | ||
| 24 | #include <linux/regulator/consumer.h> | 26 | #include <linux/regulator/consumer.h> |
| 25 | #include <linux/iio/iio.h> | 27 | #include <linux/iio/iio.h> |
| 26 | 28 | ||
| @@ -53,6 +55,7 @@ struct rockchip_saradc { · 26 unmodified lines | |||
| 53 | struct clk *clk; | 55 | struct clk *clk; |
| 54 | struct completion completion; | 56 | struct completion completion; |
| 55 | struct regulator *vref; | 57 | struct regulator *vref; |
| 58 | struct reset_control *reset; | ||
| 56 | const struct rockchip_saradc_data *data; | 59 | const struct rockchip_saradc_data *data; |
| 57 | u16 last_val; | 60 | u16 last_val; |
| 58 | }; | 61 | }; |
| @@ -190,6 +193,16 @@ static const struct of_device_id rockchip_saradc_match[] = { · 131 unmodified lines | |||
| 190 | }; | 193 | }; |
| 191 | MODULE_DEVICE_TABLE(of, rockchip_saradc_match); | 194 | MODULE_DEVICE_TABLE(of, rockchip_saradc_match); |
| 192 | 195 | ||
| 196 | /** | ||
| 197 | * Reset SARADC Controller. | ||
| 198 | */ | ||
| 199 | static void rockchip_saradc_reset_controller(struct reset_control *reset) | ||
| 200 | { | ||
| 201 | reset_control_assert(reset); | ||
| 202 | usleep_range(10, 20); | ||
| 203 | reset_control_deassert(reset); | ||
| 204 | } | ||
| 205 | |||
| 193 | static int rockchip_saradc_probe(struct platform_device *pdev) | 206 | static int rockchip_saradc_probe(struct platform_device *pdev) |
| 194 | { | 207 | { |
| 195 | struct rockchip_saradc *info = NULL; | 208 | struct rockchip_saradc *info = NULL; |
| @@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev) · 22 unmodified lines | |||
| 218 | if (IS_ERR(info->regs)) | 231 | if (IS_ERR(info->regs)) |
| 219 | return PTR_ERR(info->regs); | 232 | return PTR_ERR(info->regs); |
| 220 | 233 | ||
| 234 | /* | ||
| 235 | * The reset should be an optional property, as it should work | ||
| 236 | * with old devicetrees as well | ||
| 237 | */ | ||
| 238 | info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb"); | ||
| 239 | if (IS_ERR(info->reset)) { | ||
| 240 | ret = PTR_ERR(info->reset); | ||
| 241 | if (ret != -ENOENT) | ||
| 242 | return ret; | ||
| 243 | |||
| 244 | dev_dbg(&pdev->dev, "no reset control found\n"); | ||
| 245 | info->reset = NULL; | ||
| 246 | } | ||
| 247 | |||
| 221 | init_completion(&info->completion); | 248 | init_completion(&info->completion); |
| 222 | 249 | ||
| 223 | irq = platform_get_irq(pdev, 0); | 250 | irq = platform_get_irq(pdev, 0); |
| @@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev) · 28 unmodified lines | |||
| 252 | return PTR_ERR(info->vref); | 279 | return PTR_ERR(info->vref); |
| 253 | } | 280 | } |
| 254 | 281 | ||
| 282 | if (info->reset) | ||
| 283 | rockchip_saradc_reset_controller(info->reset); | ||
| 284 | |||
| 255 | /* | 285 | /* |
| 256 | * Use a default value for the converter clock. | 286 | * Use a default value for the converter clock. |
| 257 | * This may become user-configurable in the future. | 287 | * This may become user-configurable in the future. |
| @@ -489,7 +489,8 @@ static struct iio_info ads1115_info = { · 488 unmodified lines | |||
| 489 | #ifdef CONFIG_OF | 489 | #ifdef CONFIG_OF |
| 490 | static int ads1015_get_channels_config_of(struct i2c_client *client) | 490 | static int ads1015_get_channels_config_of(struct i2c_client *client) |
| 491 | { | 491 | { |
| 492 | struct ads1015_data *data = i2c_get_clientdata(client); | 492 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
| 493 | struct ads1015_data *data = iio_priv(indio_dev); | ||
| 493 | struct device_node *node; | 494 | struct device_node *node; |
| 494 | 495 | ||
| 495 | if (!client->dev.of_node || | 496 | if (!client->dev.of_node || |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | struct tiadc_device { | 33 | struct tiadc_device { |
| 34 | struct ti_tscadc_dev *mfd_tscadc; | 34 | struct ti_tscadc_dev *mfd_tscadc; |
| 35 | struct mutex fifo1_lock; /* to protect fifo access */ | ||
| 35 | int channels; | 36 | int channels; |
| 36 | u8 channel_line[8]; | 37 | u8 channel_line[8]; |
| 37 | u8 channel_step[8]; | 38 | u8 channel_step[8]; |
| @@ -359,6 +360,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 321 unmodified lines | |||
| 359 | int *val, int *val2, long mask) | 360 | int *val, int *val2, long mask) |
| 360 | { | 361 | { |
| 361 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 362 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
| 363 | int ret = IIO_VAL_INT; | ||
| 362 | int i, map_val; | 364 | int i, map_val; |
| 363 | unsigned int fifo1count, read, stepid; | 365 | unsigned int fifo1count, read, stepid; |
| 364 | bool found = false; | 366 | bool found = false; |
| @@ -372,13 +374,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 7 unmodified lines | |||
| 372 | if (!step_en) | 374 | if (!step_en) |
| 373 | return -EINVAL; | 375 | return -EINVAL; |
| 374 | 376 | ||
| 377 | mutex_lock(&adc_dev->fifo1_lock); | ||
| 375 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 378 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
| 376 | while (fifo1count--) | 379 | while (fifo1count--) |
| 377 | tiadc_readl(adc_dev, REG_FIFO1); | 380 | tiadc_readl(adc_dev, REG_FIFO1); |
| 378 | 381 | ||
| 379 | am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en); | 382 | am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en); |
| 380 | 383 | ||
| 381 | timeout = jiffies + usecs_to_jiffies | 384 | timeout = jiffies + msecs_to_jiffies |
| 382 | (IDLE_TIMEOUT * adc_dev->channels); | 385 | (IDLE_TIMEOUT * adc_dev->channels); |
| 383 | /* Wait for Fifo threshold interrupt */ | 386 | /* Wait for Fifo threshold interrupt */ |
| 384 | while (1) { | 387 | while (1) { |
| @@ -388,7 +391,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 3 unmodified lines | |||
| 388 | 391 | ||
| 389 | if (time_after(jiffies, timeout)) { | 392 | if (time_after(jiffies, timeout)) { |
| 390 | am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); | 393 | am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); |
| 391 | return -EAGAIN; | 394 | ret = -EAGAIN; |
| 395 | goto err_unlock; | ||
| 392 | } | 396 | } |
| 393 | } | 397 | } |
| 394 | map_val = adc_dev->channel_step[chan->scan_index]; | 398 | map_val = adc_dev->channel_step[chan->scan_index]; |
| @@ -414,8 +418,11 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 19 unmodified lines | |||
| 414 | am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); | 418 | am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); |
| 415 | 419 | ||
| 416 | if (found == false) | 420 | if (found == false) |
| 417 | return -EBUSY; | 421 | ret = -EBUSY; |
| 418 | return IIO_VAL_INT; | 422 | |
| 423 | err_unlock: | ||
| 424 | mutex_unlock(&adc_dev->fifo1_lock); | ||
| 425 | return ret; | ||
| 419 | } | 426 | } |
| 420 | 427 | ||
| 421 | static const struct iio_info tiadc_info = { | 428 | static const struct iio_info tiadc_info = { |
| @@ -483,6 +490,7 @@ static int tiadc_probe(struct platform_device *pdev) · 61 unmodified lines | |||
| 483 | 490 | ||
| 484 | tiadc_step_config(indio_dev); | 491 | tiadc_step_config(indio_dev); |
| 485 | tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD); | 492 | tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD); |
| 493 | mutex_init(&adc_dev->fifo1_lock); | ||
| 486 | 494 | ||
| 487 | err = tiadc_channel_init(indio_dev, adc_dev->channels); | 495 | err = tiadc_channel_init(indio_dev, adc_dev->channels); |
| 488 | if (err < 0) | 496 | if (err < 0) |
| @@ -434,7 +434,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev, · 433 unmodified lines | |||
| 434 | break; | 434 | break; |
| 435 | case IIO_ELECTRICALCONDUCTIVITY: | 435 | case IIO_ELECTRICALCONDUCTIVITY: |
| 436 | *val = 1; /* 0.00001 */ | 436 | *val = 1; /* 0.00001 */ |
| 437 | *val = 100000; | 437 | *val2 = 100000; |
| 438 | break; | 438 | break; |
| 439 | case IIO_CONCENTRATION: | 439 | case IIO_CONCENTRATION: |
| 440 | *val = 0; /* 0.000000001 */ | 440 | *val = 0; /* 0.000000001 */ |
| @@ -56,8 +56,8 @@ static struct { · 55 unmodified lines | |||
| 56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, | 56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, |
| 57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, | 57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, |
| 58 | 58 | ||
| 59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0}, | 59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, |
| 60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0}, | 60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000}, |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | static int pow_10(unsigned power) | 63 | static int pow_10(unsigned power) |
| @@ -65,6 +65,16 @@ struct stx104_gpio { · 64 unmodified lines | |||
| 65 | unsigned int out_state; | 65 | unsigned int out_state; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | /** | ||
| 69 | * struct stx104_dev - STX104 device private data structure | ||
| 70 | * @indio_dev: IIO device | ||
| 71 | * @chip: instance of the gpio_chip | ||
| 72 | */ | ||
| 73 | struct stx104_dev { | ||
| 74 | struct iio_dev *indio_dev; | ||
| 75 | struct gpio_chip *chip; | ||
| 76 | }; | ||
| 77 | |||
| 68 | static int stx104_read_raw(struct iio_dev *indio_dev, | 78 | static int stx104_read_raw(struct iio_dev *indio_dev, |
| 69 | struct iio_chan_spec const *chan, int *val, int *val2, long mask) | 79 | struct iio_chan_spec const *chan, int *val, int *val2, long mask) |
| 70 | { | 80 | { |
| @@ -107,6 +117,7 @@ static const struct iio_chan_spec stx104_channels[STX104_NUM_CHAN] = { · 36 unmodified lines | |||
| 107 | static int stx104_gpio_get_direction(struct gpio_chip *chip, | 117 | static int stx104_gpio_get_direction(struct gpio_chip *chip, |
| 108 | unsigned int offset) | 118 | unsigned int offset) |
| 109 | { | 119 | { |
| 120 | /* GPIO 0-3 are input only, while the rest are output only */ | ||
| 110 | if (offset < 4) | 121 | if (offset < 4) |
| 111 | return 1; | 122 | return 1; |
| 112 | 123 | ||
| @@ -169,6 +180,7 @@ static int stx104_probe(struct device *dev, unsigned int id) · 56 unmodified lines | |||
| 169 | struct iio_dev *indio_dev; | 180 | struct iio_dev *indio_dev; |
| 170 | struct stx104_iio *priv; | 181 | struct stx104_iio *priv; |
| 171 | struct stx104_gpio *stx104gpio; | 182 | struct stx104_gpio *stx104gpio; |
| 183 | struct stx104_dev *stx104dev; | ||
| 172 | int err; | 184 | int err; |
| 173 | 185 | ||
| 174 | indio_dev = devm_iio_device_alloc(dev, sizeof(*priv)); | 186 | indio_dev = devm_iio_device_alloc(dev, sizeof(*priv)); |
| @@ -179,6 +191,10 @@ static int stx104_probe(struct device *dev, unsigned int id) · 4 unmodified lines | |||
| 179 | if (!stx104gpio) | 191 | if (!stx104gpio) |
| 180 | return -ENOMEM; | 192 | return -ENOMEM; |
| 181 | 193 | ||
| 194 | stx104dev = devm_kzalloc(dev, sizeof(*stx104dev), GFP_KERNEL); | ||
| 195 | if (!stx104dev) | ||
| 196 | return -ENOMEM; | ||
| 197 | |||
| 182 | if (!devm_request_region(dev, base[id], STX104_EXTENT, | 198 | if (!devm_request_region(dev, base[id], STX104_EXTENT, |
| 183 | dev_name(dev))) { | 199 | dev_name(dev))) { |
| 184 | dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n", | 200 | dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n", |
| @@ -199,12 +215,6 @@ static int stx104_probe(struct device *dev, unsigned int id) · 14 unmodified lines | |||
| 199 | outw(0, base[id] + 4); | 215 | outw(0, base[id] + 4); |
| 200 | outw(0, base[id] + 6); | 216 | outw(0, base[id] + 6); |
| 201 | 217 | ||
| 202 | err = devm_iio_device_register(dev, indio_dev); | ||
| 203 | if (err) { | ||
| 204 | dev_err(dev, "IIO device registering failed (%d)\n", err); | ||
| 205 | return err; | ||
| 206 | } | ||
| 207 | |||
| 208 | stx104gpio->chip.label = dev_name(dev); | 218 | stx104gpio->chip.label = dev_name(dev); |
| 209 | stx104gpio->chip.parent = dev; | 219 | stx104gpio->chip.parent = dev; |
| 210 | stx104gpio->chip.owner = THIS_MODULE; | 220 | stx104gpio->chip.owner = THIS_MODULE; |
| @@ -220,7 +230,9 @@ static int stx104_probe(struct device *dev, unsigned int id) · 9 unmodified lines | |||
| 220 | 230 | ||
| 221 | spin_lock_init(&stx104gpio->lock); | 231 | spin_lock_init(&stx104gpio->lock); |
| 222 | 232 | ||
| 223 | dev_set_drvdata(dev, stx104gpio); | 233 | stx104dev->indio_dev = indio_dev; |
| 234 | stx104dev->chip = &stx104gpio->chip; | ||
| 235 | dev_set_drvdata(dev, stx104dev); | ||
| 224 | 236 | ||
| 225 | err = gpiochip_add_data(&stx104gpio->chip, stx104gpio); | 237 | err = gpiochip_add_data(&stx104gpio->chip, stx104gpio); |
| 226 | if (err) { | 238 | if (err) { |
| @@ -228,14 +240,22 @@ static int stx104_probe(struct device *dev, unsigned int id) · 1 unmodified line | |||
| 228 | return err; | 240 | return err; |
| 229 | } | 241 | } |
| 230 | 242 | ||
| 243 | err = iio_device_register(indio_dev); | ||
| 244 | if (err) { | ||
| 245 | dev_err(dev, "IIO device registering failed (%d)\n", err); | ||
| 246 | gpiochip_remove(&stx104gpio->chip); | ||
| 247 | return err; | ||
| 248 | } | ||
| 249 | |||
| 231 | return 0; | 250 | return 0; |
| 232 | } | 251 | } |
| 233 | 252 | ||
| 234 | static int stx104_remove(struct device *dev, unsigned int id) | 253 | static int stx104_remove(struct device *dev, unsigned int id) |
| 235 | { | 254 | { |
| 236 | struct stx104_gpio *const stx104gpio = dev_get_drvdata(dev); | 255 | struct stx104_dev *const stx104dev = dev_get_drvdata(dev); |
| 237 | 256 | ||
| 238 | gpiochip_remove(&stx104gpio->chip); | 257 | iio_device_unregister(stx104dev->indio_dev); |
| 258 | gpiochip_remove(stx104dev->chip); | ||
| 239 | 259 | ||
| 240 | return 0; | 260 | return 0; |
| 241 | } | 261 | } |
| @@ -6,6 +6,8 @@ menu "Humidity sensors" · 5 unmodified lines | |||
| 6 | config AM2315 | 6 | config AM2315 |
| 7 | tristate "Aosong AM2315 relative humidity and temperature sensor" | 7 | tristate "Aosong AM2315 relative humidity and temperature sensor" |
| 8 | depends on I2C | 8 | depends on I2C |
| 9 | select IIO_BUFFER | ||
| 10 | select IIO_TRIGGERED_BUFFER | ||
| 9 | help | 11 | help |
| 10 | If you say yes here you get support for the Aosong AM2315 | 12 | If you say yes here you get support for the Aosong AM2315 |
| 11 | relative humidity and ambient temperature sensor. | 13 | relative humidity and ambient temperature sensor. |
| @@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client, · 243 unmodified lines | |||
| 244 | indio_dev->channels = am2315_channels; | 244 | indio_dev->channels = am2315_channels; |
| 245 | indio_dev->num_channels = ARRAY_SIZE(am2315_channels); | 245 | indio_dev->num_channels = ARRAY_SIZE(am2315_channels); |
| 246 | 246 | ||
| 247 | ret = iio_triggered_buffer_setup(indio_dev, NULL, | 247 | ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, |
| 248 | am2315_trigger_handler, NULL); | 248 | am2315_trigger_handler, NULL); |
| 249 | if (ret < 0) { | 249 | if (ret < 0) { |
| 250 | dev_err(&client->dev, "iio triggered buffer setup failed\n"); | 250 | dev_err(&client->dev, "iio triggered buffer setup failed\n"); |
| @@ -142,7 +142,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, · 141 unmodified lines | |||
| 142 | struct i2c_client *client = data->client; | 142 | struct i2c_client *client = data->client; |
| 143 | int delay = data->adc_int_us[chan->address]; | 143 | int delay = data->adc_int_us[chan->address]; |
| 144 | int ret; | 144 | int ret; |
| 145 | int val; | 145 | __be16 val; |
| 146 | 146 | ||
| 147 | /* start measurement */ | 147 | /* start measurement */ |
| 148 | ret = i2c_smbus_write_byte(client, chan->address); | 148 | ret = i2c_smbus_write_byte(client, chan->address); |
| @@ -154,26 +154,13 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, · 5 unmodified lines | |||
| 154 | /* wait for integration time to pass */ | 154 | /* wait for integration time to pass */ |
| 155 | usleep_range(delay, delay + 1000); | 155 | usleep_range(delay, delay + 1000); |
| 156 | 156 | ||
| 157 | /* | 157 | /* read measurement */ |
| 158 | * i2c_smbus_read_word_data cannot() be used here due to the command | 158 | ret = i2c_master_recv(data->client, (char *)&val, sizeof(val)); |
| 159 | * value not being understood and causes NAKs preventing any reading | ||
| 160 | * from being accessed. | ||
| 161 | */ | ||
| 162 | ret = i2c_smbus_read_byte(client); | ||
| 163 | if (ret < 0) { | 159 | if (ret < 0) { |
| 164 | dev_err(&client->dev, "cannot read high byte measurement"); | 160 | dev_err(&client->dev, "cannot read sensor data\n"); |
| 165 | return ret; | 161 | return ret; |
| 166 | } | 162 | } |
| 167 | val = ret << 8; | 163 | return be16_to_cpu(val); |
| 168 | |||
| 169 | ret = i2c_smbus_read_byte(client); | ||
| 170 | if (ret < 0) { | ||
| 171 | dev_err(&client->dev, "cannot read low byte measurement"); | ||
| 172 | return ret; | ||
| 173 | } | ||
| 174 | val |= ret; | ||
| 175 | |||
| 176 | return val; | ||
| 177 | } | 164 | } |
| 178 | 165 | ||
| 179 | static int hdc100x_get_heater_status(struct hdc100x_data *data) | 166 | static int hdc100x_get_heater_status(struct hdc100x_data *data) |
| @@ -272,8 +259,8 @@ static int hdc100x_probe(struct i2c_client *client, · 92 unmodified lines | |||
| 272 | struct iio_dev *indio_dev; | 259 | struct iio_dev *indio_dev; |
| 273 | struct hdc100x_data *data; | 260 | struct hdc100x_data *data; |
| 274 | 261 | ||
| 275 | if (!i2c_check_functionality(client->adapter, | 262 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA | |
| 276 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) | 263 | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C)) |
| 277 | return -EOPNOTSUPP; | 264 | return -EOPNOTSUPP; |
| 278 | 265 | ||
| 279 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); | 266 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
| @@ -107,9 +107,10 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 106 unmodified lines | |||
| 107 | { | 107 | { |
| 108 | struct iio_dev *indio_dev = filp->private_data; | 108 | struct iio_dev *indio_dev = filp->private_data; |
| 109 | struct iio_buffer *rb = indio_dev->buffer; | 109 | struct iio_buffer *rb = indio_dev->buffer; |
| 110 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | ||
| 110 | size_t datum_size; | 111 | size_t datum_size; |
| 111 | size_t to_wait; | 112 | size_t to_wait; |
| 112 | int ret; | 113 | int ret = 0; |
| 113 | 114 | ||
| 114 | if (!indio_dev->info) | 115 | if (!indio_dev->info) |
| 115 | return -ENODEV; | 116 | return -ENODEV; |
| @@ -131,19 +132,29 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 15 unmodified lines | |||
| 131 | else | 132 | else |
| 132 | to_wait = min_t(size_t, n / datum_size, rb->watermark); | 133 | to_wait = min_t(size_t, n / datum_size, rb->watermark); |
| 133 | 134 | ||
| 135 | add_wait_queue(&rb->pollq, &wait); | ||
| 134 | do { | 136 | do { |
| 135 | ret = wait_event_interruptible(rb->pollq, | 137 | if (!indio_dev->info) { |
| 136 | iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)); | 138 | ret = -ENODEV; |
| 137 | if (ret) | 139 | break; |
| 138 | return ret; | 140 | } |
| 139 | 141 | ||
| 140 | if (!indio_dev->info) | 142 | if (!iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)) { |
| 141 | return -ENODEV; | 143 | if (signal_pending(current)) { |
| 144 | ret = -ERESTARTSYS; | ||
| 145 | break; | ||
| 146 | } | ||
| 147 | |||
| 148 | wait_woken(&wait, TASK_INTERRUPTIBLE, | ||
| 149 | MAX_SCHEDULE_TIMEOUT); | ||
| 150 | continue; | ||
| 151 | } | ||
| 142 | 152 | ||
| 143 | ret = rb->access->read_first_n(rb, n, buf); | 153 | ret = rb->access->read_first_n(rb, n, buf); |
| 144 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) | 154 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) |
| 145 | ret = -EAGAIN; | 155 | ret = -EAGAIN; |
| 146 | } while (ret == 0); | 156 | } while (ret == 0); |
| 157 | remove_wait_queue(&rb->pollq, &wait); | ||
| 147 | 158 | ||
| 148 | return ret; | 159 | return ret; |
| 149 | } | 160 | } |
| @@ -613,9 +613,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) · 612 unmodified lines | |||
| 613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | 613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); |
| 614 | case IIO_VAL_FRACTIONAL: | 614 | case IIO_VAL_FRACTIONAL: |
| 615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); | 615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); |
| 616 | vals[1] = do_div(tmp, 1000000000LL); | 616 | vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]); |
| 617 | vals[0] = tmp; | 617 | return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1])); |
| 618 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | ||
| 619 | case IIO_VAL_FRACTIONAL_LOG2: | 618 | case IIO_VAL_FRACTIONAL_LOG2: |
| 620 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; | 619 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; |
| 621 | vals[1] = do_div(tmp, 1000000000LL); | 620 | vals[1] = do_div(tmp, 1000000000LL); |
| @@ -76,7 +76,6 @@ config BH1750 · 75 unmodified lines | |||
| 76 | config BH1780 | 76 | config BH1780 |
| 77 | tristate "ROHM BH1780 ambient light sensor" | 77 | tristate "ROHM BH1780 ambient light sensor" |
| 78 | depends on I2C | 78 | depends on I2C |
| 79 | depends on !SENSORS_BH1780 | ||
| 80 | help | 79 | help |
| 81 | Say Y here to build support for the ROHM BH1780GLI ambient | 80 | Say Y here to build support for the ROHM BH1780GLI ambient |
| 82 | light sensor. | 81 | light sensor. |
| @@ -238,6 +237,8 @@ config MAX44000 · 155 unmodified lines | |||
| 238 | tristate "MAX44000 Ambient and Infrared Proximity Sensor" | 237 | tristate "MAX44000 Ambient and Infrared Proximity Sensor" |
| 239 | depends on I2C | 238 | depends on I2C |
| 240 | select REGMAP_I2C | 239 | select REGMAP_I2C |
| 240 | select IIO_BUFFER | ||
| 241 | select IIO_TRIGGERED_BUFFER | ||
| 241 | help | 242 | help |
| 242 | Say Y here if you want to build support for Maxim Integrated's | 243 | Say Y here if you want to build support for Maxim Integrated's |
| 243 | MAX44000 ambient and infrared proximity sensor device. | 244 | MAX44000 ambient and infrared proximity sensor device. |
| @@ -970,7 +970,7 @@ int bmp280_common_probe(struct device *dev, · 969 unmodified lines | |||
| 970 | data->vdda = devm_regulator_get(dev, "vdda"); | 970 | data->vdda = devm_regulator_get(dev, "vdda"); |
| 971 | if (IS_ERR(data->vdda)) { | 971 | if (IS_ERR(data->vdda)) { |
| 972 | dev_err(dev, "failed to get VDDA regulator\n"); | 972 | dev_err(dev, "failed to get VDDA regulator\n"); |
| 973 | ret = PTR_ERR(data->vddd); | 973 | ret = PTR_ERR(data->vdda); |
| 974 | goto out_disable_vddd; | 974 | goto out_disable_vddd; |
| 975 | } | 975 | } |
| 976 | ret = regulator_enable(data->vdda); | 976 | ret = regulator_enable(data->vdda); |
| @@ -1079,7 +1079,8 @@ EXPORT_SYMBOL(bmp280_common_remove); · 102 unmodified lines | |||
| 1079 | #ifdef CONFIG_PM | 1079 | #ifdef CONFIG_PM |
| 1080 | static int bmp280_runtime_suspend(struct device *dev) | 1080 | static int bmp280_runtime_suspend(struct device *dev) |
| 1081 | { | 1081 | { |
| 1082 | struct bmp280_data *data = dev_get_drvdata(dev); | 1082 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
| 1083 | struct bmp280_data *data = iio_priv(indio_dev); | ||
| 1083 | int ret; | 1084 | int ret; |
| 1084 | 1085 | ||
| 1085 | ret = regulator_disable(data->vdda); | 1086 | ret = regulator_disable(data->vdda); |
| @@ -1090,7 +1091,8 @@ static int bmp280_runtime_suspend(struct device *dev) · 4 unmodified lines | |||
| 1090 | 1091 | ||
| 1091 | static int bmp280_runtime_resume(struct device *dev) | 1092 | static int bmp280_runtime_resume(struct device *dev) |
| 1092 | { | 1093 | { |
| 1093 | struct bmp280_data *data = dev_get_drvdata(dev); | 1094 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
| 1095 | struct bmp280_data *data = iio_priv(indio_dev); | ||
| 1094 | int ret; | 1096 | int ret; |
| 1095 | 1097 | ||
| 1096 | ret = regulator_enable(data->vddd); | 1098 | ret = regulator_enable(data->vddd); |
| @@ -397,7 +397,7 @@ static int as3935_probe(struct spi_device *spi) · 396 unmodified lines | |||
| 397 | return ret; | 397 | return ret; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | ret = iio_triggered_buffer_setup(indio_dev, NULL, | 400 | ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, |
| 401 | &as3935_trigger_handler, NULL); | 401 | &as3935_trigger_handler, NULL); |
| 402 | 402 | ||
| 403 | if (ret) { | 403 | if (ret) { |
| @@ -2462,18 +2462,24 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv) · 2461 unmodified lines | |||
| 2462 | 2462 | ||
| 2463 | if (addr->dev_addr.bound_dev_if) { | 2463 | if (addr->dev_addr.bound_dev_if) { |
| 2464 | ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if); | 2464 | ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if); |
| 2465 | if (!ndev) | 2465 | if (!ndev) { |
| 2466 | return -ENODEV; | 2466 | ret = -ENODEV; |
| 2467 | goto err2; | ||
| 2468 | } | ||
| 2467 | 2469 | ||
| 2468 | if (ndev->flags & IFF_LOOPBACK) { | 2470 | if (ndev->flags & IFF_LOOPBACK) { |
| 2469 | dev_put(ndev); | 2471 | dev_put(ndev); |
| 2470 | if (!id_priv->id.device->get_netdev) | 2472 | if (!id_priv->id.device->get_netdev) { |
| 2471 | return -EOPNOTSUPP; | 2473 | ret = -EOPNOTSUPP; |
| 2474 | goto err2; | ||
| 2475 | } | ||
| 2472 | 2476 | ||
| 2473 | ndev = id_priv->id.device->get_netdev(id_priv->id.device, | 2477 | ndev = id_priv->id.device->get_netdev(id_priv->id.device, |
| 2474 | id_priv->id.port_num); | 2478 | id_priv->id.port_num); |
| 2475 | if (!ndev) | 2479 | if (!ndev) { |
| 2476 | return -ENODEV; | 2480 | ret = -ENODEV; |
| 2481 | goto err2; | ||
| 2482 | } | ||
| 2477 | } | 2483 | } |
| 2478 | 2484 | ||
| 2479 | route->path_rec->net = &init_net; | 2485 | route->path_rec->net = &init_net; |
| @@ -106,7 +106,6 @@ struct mcast_group { · 105 unmodified lines | |||
| 106 | atomic_t refcount; | 106 | atomic_t refcount; |
| 107 | enum mcast_group_state state; | 107 | enum mcast_group_state state; |
| 108 | struct ib_sa_query *query; | 108 | struct ib_sa_query *query; |
| 109 | int query_id; | ||
| 110 | u16 pkey_index; | 109 | u16 pkey_index; |
| 111 | u8 leave_state; | 110 | u8 leave_state; |
| 112 | int retries; | 111 | int retries; |
| @@ -340,11 +339,7 @@ static int send_join(struct mcast_group *group, struct mcast_member *member) · 227 unmodified lines | |||
| 340 | member->multicast.comp_mask, | 339 | member->multicast.comp_mask, |
| 341 | 3000, GFP_KERNEL, join_handler, group, | 340 | 3000, GFP_KERNEL, join_handler, group, |
| 342 | &group->query); | 341 | &group->query); |
| 343 | if (ret >= 0) { | 342 | return (ret > 0) ? 0 : ret; |
| 344 | group->query_id = ret; | ||
| 345 | ret = 0; | ||
| 346 | } | ||
| 347 | return ret; | ||
| 348 | } | 343 | } |
| 349 | 344 | ||
| 350 | static int send_leave(struct mcast_group *group, u8 leave_state) | 345 | static int send_leave(struct mcast_group *group, u8 leave_state) |
| @@ -364,11 +359,7 @@ static int send_leave(struct mcast_group *group, u8 leave_state) · 13 unmodified lines | |||
| 364 | IB_SA_MCMEMBER_REC_JOIN_STATE, | 359 | IB_SA_MCMEMBER_REC_JOIN_STATE, |
| 365 | 3000, GFP_KERNEL, leave_handler, | 360 | 3000, GFP_KERNEL, leave_handler, |
| 366 | group, &group->query); | 361 | group, &group->query); |
| 367 | if (ret >= 0) { | 362 | return (ret > 0) ? 0 : ret; |
| 368 | group->query_id = ret; | ||
| 369 | ret = 0; | ||
| 370 | } | ||
| 371 | return ret; | ||
| 372 | } | 363 | } |
| 373 | 364 | ||
| 374 | static void join_group(struct mcast_group *group, struct mcast_member *member, | 365 | static void join_group(struct mcast_group *group, struct mcast_member *member, |
| @@ -333,6 +333,8 @@ static void remove_ep_tid(struct c4iw_ep *ep) · 332 unmodified lines | |||
| 333 | 333 | ||
| 334 | spin_lock_irqsave(&ep->com.dev->lock, flags); | 334 | spin_lock_irqsave(&ep->com.dev->lock, flags); |
| 335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); | 335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); |
| 336 | if (idr_is_empty(&ep->com.dev->hwtid_idr)) | ||
| 337 | wake_up(&ep->com.dev->wait); | ||
| 336 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); | 338 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); |
| 337 | } | 339 | } |
| 338 | 340 | ||
| @@ -1827,8 +1829,12 @@ static int process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) · 1488 unmodified lines | |||
| 1827 | (ep->mpa_pkt + sizeof(*mpa)); | 1829 | (ep->mpa_pkt + sizeof(*mpa)); |
| 1828 | ep->ird = ntohs(mpa_v2_params->ird) & | 1830 | ep->ird = ntohs(mpa_v2_params->ird) & |
| 1829 | MPA_V2_IRD_ORD_MASK; | 1831 | MPA_V2_IRD_ORD_MASK; |
| 1832 | ep->ird = min_t(u32, ep->ird, | ||
| 1833 | cur_max_read_depth(ep->com.dev)); | ||
| 1830 | ep->ord = ntohs(mpa_v2_params->ord) & | 1834 | ep->ord = ntohs(mpa_v2_params->ord) & |
| 1831 | MPA_V2_IRD_ORD_MASK; | 1835 | MPA_V2_IRD_ORD_MASK; |
| 1836 | ep->ord = min_t(u32, ep->ord, | ||
| 1837 | cur_max_read_depth(ep->com.dev)); | ||
| 1832 | PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird, | 1838 | PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird, |
| 1833 | ep->ord); | 1839 | ep->ord); |
| 1834 | if (ntohs(mpa_v2_params->ird) & MPA_V2_PEER2PEER_MODEL) | 1840 | if (ntohs(mpa_v2_params->ird) & MPA_V2_PEER2PEER_MODEL) |
| @@ -2113,8 +2119,10 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, · 278 unmodified lines | |||
| 2113 | } | 2119 | } |
| 2114 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, | 2120 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
| 2115 | n, pdev, rt_tos2priority(tos)); | 2121 | n, pdev, rt_tos2priority(tos)); |
| 2116 | if (!ep->l2t) | 2122 | if (!ep->l2t) { |
| 2123 | dev_put(pdev); | ||
| 2117 | goto out; | 2124 | goto out; |
| 2125 | } | ||
| 2118 | ep->mtu = pdev->mtu; | 2126 | ep->mtu = pdev->mtu; |
| 2119 | ep->tx_chan = cxgb4_port_chan(pdev); | 2127 | ep->tx_chan = cxgb4_port_chan(pdev); |
| 2120 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, | 2128 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, |
| @@ -3136,7 +3144,7 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) · 1015 unmodified lines | |||
| 3136 | if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { | 3144 | if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { |
| 3137 | if (conn_param->ord > ep->ird) { | 3145 | if (conn_param->ord > ep->ird) { |
| 3138 | if (RELAXED_IRD_NEGOTIATION) { | 3146 | if (RELAXED_IRD_NEGOTIATION) { |
| 3139 | ep->ord = ep->ird; | 3147 | conn_param->ord = ep->ird; |
| 3140 | } else { | 3148 | } else { |
| 3141 | ep->ird = conn_param->ird; | 3149 | ep->ird = conn_param->ird; |
| 3142 | ep->ord = conn_param->ord; | 3150 | ep->ord = conn_param->ord; |
| @@ -1016,15 +1016,15 @@ int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata) · 1015 unmodified lines | |||
| 1016 | int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 1016 | int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
| 1017 | { | 1017 | { |
| 1018 | struct c4iw_cq *chp; | 1018 | struct c4iw_cq *chp; |
| 1019 | int ret; | 1019 | int ret = 0; |
| 1020 | unsigned long flag; | 1020 | unsigned long flag; |
| 1021 | 1021 | ||
| 1022 | chp = to_c4iw_cq(ibcq); | 1022 | chp = to_c4iw_cq(ibcq); |
| 1023 | spin_lock_irqsave(&chp->lock, flag); | 1023 | spin_lock_irqsave(&chp->lock, flag); |
| 1024 | ret = t4_arm_cq(&chp->cq, | 1024 | t4_arm_cq(&chp->cq, |
| 1025 | (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED); | 1025 | (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED); |
| 1026 | if (flags & IB_CQ_REPORT_MISSED_EVENTS) | ||
| 1027 | ret = t4_cq_notempty(&chp->cq); | ||
| 1026 | spin_unlock_irqrestore(&chp->lock, flag); | 1028 | spin_unlock_irqrestore(&chp->lock, flag); |
| 1027 | if (ret && !(flags & IB_CQ_REPORT_MISSED_EVENTS)) | ||
| 1028 | ret = 0; | ||
| 1029 | return ret; | 1029 | return ret; |
| 1030 | } | 1030 | } |
| @@ -872,9 +872,13 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) · 871 unmodified lines | |||
| 872 | static void c4iw_dealloc(struct uld_ctx *ctx) | 872 | static void c4iw_dealloc(struct uld_ctx *ctx) |
| 873 | { | 873 | { |
| 874 | c4iw_rdev_close(&ctx->dev->rdev); | 874 | c4iw_rdev_close(&ctx->dev->rdev); |
| 875 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->cqidr)); | ||
| 875 | idr_destroy(&ctx->dev->cqidr); | 876 | idr_destroy(&ctx->dev->cqidr); |
| 877 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->qpidr)); | ||
| 876 | idr_destroy(&ctx->dev->qpidr); | 878 | idr_destroy(&ctx->dev->qpidr); |
| 879 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->mmidr)); | ||
| 877 | idr_destroy(&ctx->dev->mmidr); | 880 | idr_destroy(&ctx->dev->mmidr); |
| 881 | wait_event(ctx->dev->wait, idr_is_empty(&ctx->dev->hwtid_idr)); | ||
| 878 | idr_destroy(&ctx->dev->hwtid_idr); | 882 | idr_destroy(&ctx->dev->hwtid_idr); |
| 879 | idr_destroy(&ctx->dev->stid_idr); | 883 | idr_destroy(&ctx->dev->stid_idr); |
| 880 | idr_destroy(&ctx->dev->atid_idr); | 884 | idr_destroy(&ctx->dev->atid_idr); |
| @@ -992,6 +996,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) · 111 unmodified lines | |||
| 992 | mutex_init(&devp->rdev.stats.lock); | 996 | mutex_init(&devp->rdev.stats.lock); |
| 993 | mutex_init(&devp->db_mutex); | 997 | mutex_init(&devp->db_mutex); |
| 994 | INIT_LIST_HEAD(&devp->db_fc_list); | 998 | INIT_LIST_HEAD(&devp->db_fc_list); |
| 999 | init_waitqueue_head(&devp->wait); | ||
| 995 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; | 1000 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; |
| 996 | 1001 | ||
| 997 | if (c4iw_debugfs_root) { | 1002 | if (c4iw_debugfs_root) { |
| @@ -263,6 +263,7 @@ struct c4iw_dev { · 262 unmodified lines | |||
| 263 | struct idr stid_idr; | 263 | struct idr stid_idr; |
| 264 | struct list_head db_fc_list; | 264 | struct list_head db_fc_list; |
| 265 | u32 avail_ird; | 265 | u32 avail_ird; |
| 266 | wait_queue_head_t wait; | ||
| 266 | }; | 267 | }; |
| 267 | 268 | ||
| 268 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) | 269 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) |
| @@ -683,7 +683,7 @@ static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, · 682 unmodified lines | |||
| 683 | return 0; | 683 | return 0; |
| 684 | } | 684 | } |
| 685 | 685 | ||
| 686 | void _free_qp(struct kref *kref) | 686 | static void _free_qp(struct kref *kref) |
| 687 | { | 687 | { |
| 688 | struct c4iw_qp *qhp; | 688 | struct c4iw_qp *qhp; |
| 689 | 689 | ||
| @@ -634,6 +634,11 @@ static inline int t4_valid_cqe(struct t4_cq *cq, struct t4_cqe *cqe) · 633 unmodified lines | |||
| 634 | return (CQE_GENBIT(cqe) == cq->gen); | 634 | return (CQE_GENBIT(cqe) == cq->gen); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | static inline int t4_cq_notempty(struct t4_cq *cq) | ||
| 638 | { | ||
| 639 | return cq->sw_in_use || t4_valid_cqe(cq, &cq->queue[cq->cidx]); | ||
| 640 | } | ||
| 641 | |||
| 637 | static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe) | 642 | static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe) |
| 638 | { | 643 | { |
| 639 | int ret; | 644 | int ret; |
| @@ -47,7 +47,6 @@ · 46 unmodified lines | |||
| 47 | #include <linux/topology.h> | 47 | #include <linux/topology.h> |
| 48 | #include <linux/cpumask.h> | 48 | #include <linux/cpumask.h> |
| 49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
| 50 | #include <linux/cpumask.h> | ||
| 51 | 50 | ||
| 52 | #include "hfi.h" | 51 | #include "hfi.h" |
| 53 | #include "affinity.h" | 52 | #include "affinity.h" |
| @@ -682,7 +681,7 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, · 628 unmodified lines | |||
| 682 | size_t count) | 681 | size_t count) |
| 683 | { | 682 | { |
| 684 | struct hfi1_affinity_node *entry; | 683 | struct hfi1_affinity_node *entry; |
| 685 | struct cpumask mask; | 684 | cpumask_var_t mask; |
| 686 | int ret, i; | 685 | int ret, i; |
| 687 | 686 | ||
| 688 | spin_lock(&node_affinity.lock); | 687 | spin_lock(&node_affinity.lock); |
| @@ -692,19 +691,24 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, · 3 unmodified lines | |||
| 692 | if (!entry) | 691 | if (!entry) |
| 693 | return -EINVAL; | 692 | return -EINVAL; |
| 694 | 693 | ||
| 695 | ret = cpulist_parse(buf, &mask); | 694 | ret = zalloc_cpumask_var(&mask, GFP_KERNEL); |
| 695 | if (!ret) | ||
| 696 | return -ENOMEM; | ||
| 697 | |||
| 698 | ret = cpulist_parse(buf, mask); | ||
| 696 | if (ret) | 699 | if (ret) |
| 697 | return ret; | 700 | goto out; |
| 698 | 701 | ||
| 699 | if (!cpumask_subset(&mask, cpu_online_mask) || cpumask_empty(&mask)) { | 702 | if (!cpumask_subset(mask, cpu_online_mask) || cpumask_empty(mask)) { |
| 700 | dd_dev_warn(dd, "Invalid CPU mask\n"); | 703 | dd_dev_warn(dd, "Invalid CPU mask\n"); |
| 701 | return -EINVAL; | 704 | ret = -EINVAL; |
| 705 | goto out; | ||
| 702 | } | 706 | } |
| 703 | 707 | ||
| 704 | mutex_lock(&sdma_affinity_mutex); | 708 | mutex_lock(&sdma_affinity_mutex); |
| 705 | /* reset the SDMA interrupt affinity details */ | 709 | /* reset the SDMA interrupt affinity details */ |
| 706 | init_cpu_mask_set(&entry->def_intr); | 710 | init_cpu_mask_set(&entry->def_intr); |
| 707 | cpumask_copy(&entry->def_intr.mask, &mask); | 711 | cpumask_copy(&entry->def_intr.mask, mask); |
| 708 | /* | 712 | /* |
| 709 | * Reassign the affinity for each SDMA interrupt. | 713 | * Reassign the affinity for each SDMA interrupt. |
| 710 | */ | 714 | */ |
| @@ -720,8 +724,9 @@ int hfi1_set_sdma_affinity(struct hfi1_devdata *dd, const char *buf, · 9 unmodified lines | |||
| 720 | if (ret) | 724 | if (ret) |
| 721 | break; | 725 | break; |
| 722 | } | 726 | } |
| 723 | |||
| 724 | mutex_unlock(&sdma_affinity_mutex); | 727 | mutex_unlock(&sdma_affinity_mutex); |
| 728 | out: | ||
| 729 | free_cpumask_var(mask); | ||
| 725 | return ret ? ret : strnlen(buf, PAGE_SIZE); | 730 | return ret ? ret : strnlen(buf, PAGE_SIZE); |
| 726 | } | 731 | } |
| 727 | 732 | ||
| @@ -9490,6 +9490,78 @@ static void init_lcb(struct hfi1_devdata *dd) · 9489 unmodified lines | |||
| 9490 | write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); | 9490 | write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); |
| 9491 | } | 9491 | } |
| 9492 | 9492 | ||
| 9493 | /* | ||
| 9494 | * Perform a test read on the QSFP. Return 0 on success, -ERRNO | ||
| 9495 | * on error. | ||
| 9496 | */ | ||
| 9497 | static int test_qsfp_read(struct hfi1_pportdata *ppd) | ||
| 9498 | { | ||
| 9499 | int ret; | ||
| 9500 | u8 status; | ||
| 9501 | |||
| 9502 | /* report success if not a QSFP */ | ||
| 9503 | if (ppd->port_type != PORT_TYPE_QSFP) | ||
| 9504 | return 0; | ||
| 9505 | |||
| 9506 | /* read byte 2, the status byte */ | ||
| 9507 | ret = one_qsfp_read(ppd, ppd->dd->hfi1_id, 2, &status, 1); | ||
| 9508 | if (ret < 0) | ||
| 9509 | return ret; | ||
| 9510 | if (ret != 1) | ||
| 9511 | return -EIO; | ||
| 9512 | |||
| 9513 | return 0; /* success */ | ||
| 9514 | } | ||
| 9515 | |||
| 9516 | /* | ||
| 9517 | * Values for QSFP retry. | ||
| 9518 | * | ||
| 9519 | * Give up after 10s (20 x 500ms). The overall timeout was empirically | ||
| 9520 | * arrived at from experience on a large cluster. | ||
| 9521 | */ | ||
| 9522 | #define MAX_QSFP_RETRIES 20 | ||
| 9523 | #define QSFP_RETRY_WAIT 500 /* msec */ | ||
| 9524 | |||
| 9525 | /* | ||
| 9526 | * Try a QSFP read. If it fails, schedule a retry for later. | ||
| 9527 | * Called on first link activation after driver load. | ||
| 9528 | */ | ||
| 9529 | static void try_start_link(struct hfi1_pportdata *ppd) | ||
| 9530 | { | ||
| 9531 | if (test_qsfp_read(ppd)) { | ||
| 9532 | /* read failed */ | ||
| 9533 | if (ppd->qsfp_retry_count >= MAX_QSFP_RETRIES) { | ||
| 9534 | dd_dev_err(ppd->dd, "QSFP not responding, giving up\n"); | ||
| 9535 | return; | ||
| 9536 | } | ||
| 9537 | dd_dev_info(ppd->dd, | ||
| 9538 | "QSFP not responding, waiting and retrying %d\n", | ||
| 9539 | (int)ppd->qsfp_retry_count); | ||
| 9540 | ppd->qsfp_retry_count++; | ||
| 9541 | queue_delayed_work(ppd->hfi1_wq, &ppd->start_link_work, | ||
| 9542 | msecs_to_jiffies(QSFP_RETRY_WAIT)); | ||
| 9543 | return; | ||
| 9544 | } | ||
| 9545 | ppd->qsfp_retry_count = 0; | ||
| 9546 | |||
| 9547 | /* | ||
| 9548 | * Tune the SerDes to a ballpark setting for optimal signal and bit | ||
| 9549 | * error rate. Needs to be done before starting the link. | ||
| 9550 | */ | ||
| 9551 | tune_serdes(ppd); | ||
| 9552 | start_link(ppd); | ||
| 9553 | } | ||
| 9554 | |||
| 9555 | /* | ||
| 9556 | * Workqueue function to start the link after a delay. | ||
| 9557 | */ | ||
| 9558 | void handle_start_link(struct work_struct *work) | ||
| 9559 | { | ||
| 9560 | struct hfi1_pportdata *ppd = container_of(work, struct hfi1_pportdata, | ||
| 9561 | start_link_work.work); | ||
| 9562 | try_start_link(ppd); | ||
| 9563 | } | ||
| 9564 | |||
| 9493 | int bringup_serdes(struct hfi1_pportdata *ppd) | 9565 | int bringup_serdes(struct hfi1_pportdata *ppd) |
| 9494 | { | 9566 | { |
| 9495 | struct hfi1_devdata *dd = ppd->dd; | 9567 | struct hfi1_devdata *dd = ppd->dd; |
| @@ -9525,14 +9597,8 @@ int bringup_serdes(struct hfi1_pportdata *ppd) · 29 unmodified lines | |||
| 9525 | set_qsfp_int_n(ppd, 1); | 9597 | set_qsfp_int_n(ppd, 1); |
| 9526 | } | 9598 | } |
| 9527 | 9599 | ||
| 9528 | /* | 9600 | try_start_link(ppd); |
| 9529 | * Tune the SerDes to a ballpark setting for | 9601 | return 0; |
| 9530 | * optimal signal and bit error rate | ||
| 9531 | * Needs to be done before starting the link | ||
| 9532 | */ | ||
| 9533 | tune_serdes(ppd); | ||
| 9534 | |||
| 9535 | return start_link(ppd); | ||
| 9536 | } | 9602 | } |
| 9537 | 9603 | ||
| 9538 | void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) | 9604 | void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) |
| @@ -9549,6 +9615,10 @@ void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) · 10 unmodified lines | |||
| 9549 | ppd->driver_link_ready = 0; | 9615 | ppd->driver_link_ready = 0; |
| 9550 | ppd->link_enabled = 0; | 9616 | ppd->link_enabled = 0; |
| 9551 | 9617 | ||
| 9618 | ppd->qsfp_retry_count = MAX_QSFP_RETRIES; /* prevent more retries */ | ||
| 9619 | flush_delayed_work(&ppd->start_link_work); | ||
| 9620 | cancel_delayed_work_sync(&ppd->start_link_work); | ||
| 9621 | |||
| 9552 | ppd->offline_disabled_reason = | 9622 | ppd->offline_disabled_reason = |
| 9553 | HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED); | 9623 | HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED); |
| 9554 | set_link_down_reason(ppd, OPA_LINKDOWN_REASON_SMA_DISABLED, 0, | 9624 | set_link_down_reason(ppd, OPA_LINKDOWN_REASON_SMA_DISABLED, 0, |
| @@ -12865,7 +12935,7 @@ fail: · 3310 unmodified lines | |||
| 12865 | */ | 12935 | */ |
| 12866 | static int set_up_context_variables(struct hfi1_devdata *dd) | 12936 | static int set_up_context_variables(struct hfi1_devdata *dd) |
| 12867 | { | 12937 | { |
| 12868 | int num_kernel_contexts; | 12938 | unsigned long num_kernel_contexts; |
| 12869 | int total_contexts; | 12939 | int total_contexts; |
| 12870 | int ret; | 12940 | int ret; |
| 12871 | unsigned ngroups; | 12941 | unsigned ngroups; |
| @@ -12894,9 +12964,9 @@ static int set_up_context_variables(struct hfi1_devdata *dd) · 22 unmodified lines | |||
| 12894 | */ | 12964 | */ |
| 12895 | if (num_kernel_contexts > (dd->chip_send_contexts - num_vls - 1)) { | 12965 | if (num_kernel_contexts > (dd->chip_send_contexts - num_vls - 1)) { |
| 12896 | dd_dev_err(dd, | 12966 | dd_dev_err(dd, |
| 12897 | "Reducing # kernel rcv contexts to: %d, from %d\n", | 12967 | "Reducing # kernel rcv contexts to: %d, from %lu\n", |
| 12898 | (int)(dd->chip_send_contexts - num_vls - 1), | 12968 | (int)(dd->chip_send_contexts - num_vls - 1), |
| 12899 | (int)num_kernel_contexts); | 12969 | num_kernel_contexts); |
| 12900 | num_kernel_contexts = dd->chip_send_contexts - num_vls - 1; | 12970 | num_kernel_contexts = dd->chip_send_contexts - num_vls - 1; |
| 12901 | } | 12971 | } |
| 12902 | /* | 12972 | /* |
| @@ -706,6 +706,7 @@ void handle_link_up(struct work_struct *work); · 705 unmodified lines | |||
| 706 | void handle_link_down(struct work_struct *work); | 706 | void handle_link_down(struct work_struct *work); |
| 707 | void handle_link_downgrade(struct work_struct *work); | 707 | void handle_link_downgrade(struct work_struct *work); |
| 708 | void handle_link_bounce(struct work_struct *work); | 708 | void handle_link_bounce(struct work_struct *work); |
| 709 | void handle_start_link(struct work_struct *work); | ||
| 709 | void handle_sma_message(struct work_struct *work); | 710 | void handle_sma_message(struct work_struct *work); |
| 710 | void reset_qsfp(struct hfi1_pportdata *ppd); | 711 | void reset_qsfp(struct hfi1_pportdata *ppd); |
| 711 | void qsfp_event(struct work_struct *work); | 712 | void qsfp_event(struct work_struct *work); |
| @@ -59,6 +59,40 @@ · 58 unmodified lines | |||
| 59 | 59 | ||
| 60 | static struct dentry *hfi1_dbg_root; | 60 | static struct dentry *hfi1_dbg_root; |
| 61 | 61 | ||
| 62 | /* wrappers to enforce srcu in seq file */ | ||
| 63 | static ssize_t hfi1_seq_read( | ||
| 64 | struct file *file, | ||
| 65 | char __user *buf, | ||
| 66 | size_t size, | ||
| 67 | loff_t *ppos) | ||
| 68 | { | ||
| 69 | struct dentry *d = file->f_path.dentry; | ||
| 70 | int srcu_idx; | ||
| 71 | ssize_t r; | ||
| 72 | |||
| 73 | r = debugfs_use_file_start(d, &srcu_idx); | ||
| 74 | if (likely(!r)) | ||
| 75 | r = seq_read(file, buf, size, ppos); | ||
| 76 | debugfs_use_file_finish(srcu_idx); | ||
| 77 | return r; | ||
| 78 | } | ||
| 79 | |||
| 80 | static loff_t hfi1_seq_lseek( | ||
| 81 | struct file *file, | ||
| 82 | loff_t offset, | ||
| 83 | int whence) | ||
| 84 | { | ||
| 85 | struct dentry *d = file->f_path.dentry; | ||
| 86 | int srcu_idx; | ||
| 87 | loff_t r; | ||
| 88 | |||
| 89 | r = debugfs_use_file_start(d, &srcu_idx); | ||
| 90 | if (likely(!r)) | ||
| 91 | r = seq_lseek(file, offset, whence); | ||
| 92 | debugfs_use_file_finish(srcu_idx); | ||
| 93 | return r; | ||
| 94 | } | ||
| 95 | |||
| 62 | #define private2dd(file) (file_inode(file)->i_private) | 96 | #define private2dd(file) (file_inode(file)->i_private) |
| 63 | #define private2ppd(file) (file_inode(file)->i_private) | 97 | #define private2ppd(file) (file_inode(file)->i_private) |
| 64 | 98 | ||
| @@ -87,8 +121,8 @@ static int _##name##_open(struct inode *inode, struct file *s) \ · 22 unmodified lines | |||
| 87 | static const struct file_operations _##name##_file_ops = { \ | 121 | static const struct file_operations _##name##_file_ops = { \ |
| 88 | .owner = THIS_MODULE, \ | 122 | .owner = THIS_MODULE, \ |
| 89 | .open = _##name##_open, \ | 123 | .open = _##name##_open, \ |
| 90 | .read = seq_read, \ | 124 | .read = hfi1_seq_read, \ |
| 91 | .llseek = seq_lseek, \ | 125 | .llseek = hfi1_seq_lseek, \ |
| 92 | .release = seq_release \ | 126 | .release = seq_release \ |
| 93 | } | 127 | } |
| 94 | 128 | ||
| @@ -105,11 +139,9 @@ do { \ · 10 unmodified lines | |||
| 105 | DEBUGFS_FILE_CREATE(#name, parent, data, &_##name##_file_ops, S_IRUGO) | 139 | DEBUGFS_FILE_CREATE(#name, parent, data, &_##name##_file_ops, S_IRUGO) |
| 106 | 140 | ||
| 107 | static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos) | 141 | static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos) |
| 108 | __acquires(RCU) | ||
| 109 | { | 142 | { |
| 110 | struct hfi1_opcode_stats_perctx *opstats; | 143 | struct hfi1_opcode_stats_perctx *opstats; |
| 111 | 144 | ||
| 112 | rcu_read_lock(); | ||
| 113 | if (*pos >= ARRAY_SIZE(opstats->stats)) | 145 | if (*pos >= ARRAY_SIZE(opstats->stats)) |
| 114 | return NULL; | 146 | return NULL; |
| 115 | return pos; | 147 | return pos; |
| @@ -126,9 +158,7 @@ static void *_opcode_stats_seq_next(struct seq_file *s, void *v, loff_t *pos) · 10 unmodified lines | |||
| 126 | } | 158 | } |
| 127 | 159 | ||
| 128 | static void _opcode_stats_seq_stop(struct seq_file *s, void *v) | 160 | static void _opcode_stats_seq_stop(struct seq_file *s, void *v) |
| 129 | __releases(RCU) | ||
| 130 | { | 161 | { |
| 131 | rcu_read_unlock(); | ||
| 132 | } | 162 | } |
| 133 | 163 | ||
| 134 | static int _opcode_stats_seq_show(struct seq_file *s, void *v) | 164 | static int _opcode_stats_seq_show(struct seq_file *s, void *v) |
| @@ -223,28 +253,32 @@ DEBUGFS_SEQ_FILE_OPEN(ctx_stats) · 88 unmodified lines | |||
| 223 | DEBUGFS_FILE_OPS(ctx_stats); | 253 | DEBUGFS_FILE_OPS(ctx_stats); |
| 224 | 254 | ||
| 225 | static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) | 255 | static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) |
| 226 | __acquires(RCU) | 256 | __acquires(RCU) |
| 227 | { | 257 | { |
| 228 | struct qp_iter *iter; | 258 | struct qp_iter *iter; |
| 229 | loff_t n = *pos; | 259 | loff_t n = *pos; |
| 230 | 260 | ||
| 231 | rcu_read_lock(); | ||
| 232 | iter = qp_iter_init(s->private); | 261 | iter = qp_iter_init(s->private); |
| 262 | |||
| 263 | /* stop calls rcu_read_unlock */ | ||
| 264 | rcu_read_lock(); | ||
| 265 | |||
| 233 | if (!iter) | 266 | if (!iter) |
| 234 | return NULL; | 267 | return NULL; |
| 235 | 268 | ||
| 236 | while (n--) { | 269 | do { |
| 237 | if (qp_iter_next(iter)) { | 270 | if (qp_iter_next(iter)) { |
| 238 | kfree(iter); | 271 | kfree(iter); |
| 239 | return NULL; | 272 | return NULL; |
| 240 | } | 273 | } |
| 241 | } | 274 | } while (n--); |
| 242 | 275 | ||
| 243 | return iter; | 276 | return iter; |
| 244 | } | 277 | } |
| 245 | 278 | ||
| 246 | static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, | 279 | static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
| 247 | loff_t *pos) | 280 | loff_t *pos) |
| 281 | __must_hold(RCU) | ||
| 248 | { | 282 | { |
| 249 | struct qp_iter *iter = iter_ptr; | 283 | struct qp_iter *iter = iter_ptr; |
| 250 | 284 | ||
| @@ -259,7 +293,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, · 8 unmodified lines | |||
| 259 | } | 293 | } |
| 260 | 294 | ||
| 261 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) | 295 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
| 262 | __releases(RCU) | 296 | __releases(RCU) |
| 263 | { | 297 | { |
| 264 | rcu_read_unlock(); | 298 | rcu_read_unlock(); |
| 265 | } | 299 | } |
| @@ -281,12 +315,10 @@ DEBUGFS_SEQ_FILE_OPEN(qp_stats) · 15 unmodified lines | |||
| 281 | DEBUGFS_FILE_OPS(qp_stats); | 315 | DEBUGFS_FILE_OPS(qp_stats); |
| 282 | 316 | ||
| 283 | static void *_sdes_seq_start(struct seq_file *s, loff_t *pos) | 317 | static void *_sdes_seq_start(struct seq_file *s, loff_t *pos) |
| 284 | __acquires(RCU) | ||
| 285 | { | 318 | { |
| 286 | struct hfi1_ibdev *ibd; | 319 | struct hfi1_ibdev *ibd; |
| 287 | struct hfi1_devdata *dd; | 320 | struct hfi1_devdata *dd; |
| 288 | 321 | ||
| 289 | rcu_read_lock(); | ||
| 290 | ibd = (struct hfi1_ibdev *)s->private; | 322 | ibd = (struct hfi1_ibdev *)s->private; |
| 291 | dd = dd_from_dev(ibd); | 323 | dd = dd_from_dev(ibd); |
| 292 | if (!dd->per_sdma || *pos >= dd->num_sdma) | 324 | if (!dd->per_sdma || *pos >= dd->num_sdma) |
| @@ -306,9 +338,7 @@ static void *_sdes_seq_next(struct seq_file *s, void *v, loff_t *pos) · 13 unmodified lines | |||
| 306 | } | 338 | } |
| 307 | 339 | ||
| 308 | static void _sdes_seq_stop(struct seq_file *s, void *v) | 340 | static void _sdes_seq_stop(struct seq_file *s, void *v) |
| 309 | __releases(RCU) | ||
| 310 | { | 341 | { |
| 311 | rcu_read_unlock(); | ||
| 312 | } | 342 | } |
| 313 | 343 | ||
| 314 | static int _sdes_seq_show(struct seq_file *s, void *v) | 344 | static int _sdes_seq_show(struct seq_file *s, void *v) |
| @@ -335,11 +365,9 @@ static ssize_t dev_counters_read(struct file *file, char __user *buf, · 20 unmodified lines | |||
| 335 | struct hfi1_devdata *dd; | 365 | struct hfi1_devdata *dd; |
| 336 | ssize_t rval; | 366 | ssize_t rval; |
| 337 | 367 | ||
| 338 | rcu_read_lock(); | ||
| 339 | dd = private2dd(file); | 368 | dd = private2dd(file); |
| 340 | avail = hfi1_read_cntrs(dd, NULL, &counters); | 369 | avail = hfi1_read_cntrs(dd, NULL, &counters); |
| 341 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); | 370 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); |
| 342 | rcu_read_unlock(); | ||
| 343 | return rval; | 371 | return rval; |
| 344 | } | 372 | } |
| 345 | 373 | ||
| @@ -352,11 +380,9 @@ static ssize_t dev_names_read(struct file *file, char __user *buf, · 6 unmodified lines | |||
| 352 | struct hfi1_devdata *dd; | 380 | struct hfi1_devdata *dd; |
| 353 | ssize_t rval; | 381 | ssize_t rval; |
| 354 | 382 | ||
| 355 | rcu_read_lock(); | ||
| 356 | dd = private2dd(file); | 383 | dd = private2dd(file); |
| 357 | avail = hfi1_read_cntrs(dd, &names, NULL); | 384 | avail = hfi1_read_cntrs(dd, &names, NULL); |
| 358 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); | 385 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); |
| 359 | rcu_read_unlock(); | ||
| 360 | return rval; | 386 | return rval; |
| 361 | } | 387 | } |
| 362 | 388 | ||
| @@ -379,11 +405,9 @@ static ssize_t portnames_read(struct file *file, char __user *buf, · 16 unmodified lines | |||
| 379 | struct hfi1_devdata *dd; | 405 | struct hfi1_devdata *dd; |
| 380 | ssize_t rval; | 406 | ssize_t rval; |
| 381 | 407 | ||
| 382 | rcu_read_lock(); | ||
| 383 | dd = private2dd(file); | 408 | dd = private2dd(file); |
| 384 | avail = hfi1_read_portcntrs(dd->pport, &names, NULL); | 409 | avail = hfi1_read_portcntrs(dd->pport, &names, NULL); |
| 385 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); | 410 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); |
| 386 | rcu_read_unlock(); | ||
| 387 | return rval; | 411 | return rval; |
| 388 | } | 412 | } |
| 389 | 413 | ||
| @@ -396,11 +420,9 @@ static ssize_t portcntrs_debugfs_read(struct file *file, char __user *buf, · 6 unmodified lines | |||
| 396 | struct hfi1_pportdata *ppd; | 420 | struct hfi1_pportdata *ppd; |
| 397 | ssize_t rval; | 421 | ssize_t rval; |
| 398 | 422 | ||
| 399 | rcu_read_lock(); | ||
| 400 | ppd = private2ppd(file); | 423 | ppd = private2ppd(file); |
| 401 | avail = hfi1_read_portcntrs(ppd, NULL, &counters); | 424 | avail = hfi1_read_portcntrs(ppd, NULL, &counters); |
| 402 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); | 425 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); |
| 403 | rcu_read_unlock(); | ||
| 404 | return rval; | 426 | return rval; |
| 405 | } | 427 | } |
| 406 | 428 | ||
| @@ -430,16 +452,13 @@ static ssize_t asic_flags_read(struct file *file, char __user *buf, · 23 unmodified lines | |||
| 430 | int used; | 452 | int used; |
| 431 | int i; | 453 | int i; |
| 432 | 454 | ||
| 433 | rcu_read_lock(); | ||
| 434 | ppd = private2ppd(file); | 455 | ppd = private2ppd(file); |
| 435 | dd = ppd->dd; | 456 | dd = ppd->dd; |
| 436 | size = PAGE_SIZE; | 457 | size = PAGE_SIZE; |
| 437 | used = 0; | 458 | used = 0; |
| 438 | tmp = kmalloc(size, GFP_KERNEL); | 459 | tmp = kmalloc(size, GFP_KERNEL); |
| 439 | if (!tmp) { | 460 | if (!tmp) |
| 440 | rcu_read_unlock(); | ||
| 441 | return -ENOMEM; | 461 | return -ENOMEM; |
| 442 | } | ||
| 443 | 462 | ||
| 444 | scratch0 = read_csr(dd, ASIC_CFG_SCRATCH); | 463 | scratch0 = read_csr(dd, ASIC_CFG_SCRATCH); |
| 445 | used += scnprintf(tmp + used, size - used, | 464 | used += scnprintf(tmp + used, size - used, |
| @@ -466,7 +485,6 @@ static ssize_t asic_flags_read(struct file *file, char __user *buf, · 20 unmodified lines | |||
| 466 | used += scnprintf(tmp + used, size - used, "Write bits to clear\n"); | 485 | used += scnprintf(tmp + used, size - used, "Write bits to clear\n"); |
| 467 | 486 | ||
| 468 | ret = simple_read_from_buffer(buf, count, ppos, tmp, used); | 487 | ret = simple_read_from_buffer(buf, count, ppos, tmp, used); |
| 469 | rcu_read_unlock(); | ||
| 470 | kfree(tmp); | 488 | kfree(tmp); |
| 471 | return ret; | 489 | return ret; |
| 472 | } | 490 | } |
| @@ -482,15 +500,12 @@ static ssize_t asic_flags_write(struct file *file, const char __user *buf, · 9 unmodified lines | |||
| 482 | u64 scratch0; | 500 | u64 scratch0; |
| 483 | u64 clear; | 501 | u64 clear; |
| 484 | 502 | ||
| 485 | rcu_read_lock(); | ||
| 486 | ppd = private2ppd(file); | 503 | ppd = private2ppd(file); |
| 487 | dd = ppd->dd; | 504 | dd = ppd->dd; |
| 488 | 505 | ||
| 489 | buff = kmalloc(count + 1, GFP_KERNEL); | 506 | buff = kmalloc(count + 1, GFP_KERNEL); |
| 490 | if (!buff) { | 507 | if (!buff) |
| 491 | ret = -ENOMEM; | 508 | return -ENOMEM; |
| 492 | goto do_return; | ||
| 493 | } | ||
| 494 | 509 | ||
| 495 | ret = copy_from_user(buff, buf, count); | 510 | ret = copy_from_user(buff, buf, count); |
| 496 | if (ret > 0) { | 511 | if (ret > 0) { |
| @@ -523,8 +538,6 @@ static ssize_t asic_flags_write(struct file *file, const char __user *buf, · 26 unmodified lines | |||
| 523 | 538 | ||
| 524 | do_free: | 539 | do_free: |
| 525 | kfree(buff); | 540 | kfree(buff); |
| 526 | do_return: | ||
| 527 | rcu_read_unlock(); | ||
| 528 | return ret; | 541 | return ret; |
| 529 | } | 542 | } |
| 530 | 543 | ||
| @@ -538,18 +551,14 @@ static ssize_t qsfp_debugfs_dump(struct file *file, char __user *buf, · 7 unmodified lines | |||
| 538 | char *tmp; | 551 | char *tmp; |
| 539 | int ret; | 552 | int ret; |
| 540 | 553 | ||
| 541 | rcu_read_lock(); | ||
| 542 | ppd = private2ppd(file); | 554 | ppd = private2ppd(file); |
| 543 | tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); | 555 | tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); |
| 544 | if (!tmp) { | 556 | if (!tmp) |
| 545 | rcu_read_unlock(); | ||
| 546 | return -ENOMEM; | 557 | return -ENOMEM; |
| 547 | } | ||
| 548 | 558 | ||
| 549 | ret = qsfp_dump(ppd, tmp, PAGE_SIZE); | 559 | ret = qsfp_dump(ppd, tmp, PAGE_SIZE); |
| 550 | if (ret > 0) | 560 | if (ret > 0) |
| 551 | ret = simple_read_from_buffer(buf, count, ppos, tmp, ret); | 561 | ret = simple_read_from_buffer(buf, count, ppos, tmp, ret); |
| 552 | rcu_read_unlock(); | ||
| 553 | kfree(tmp); | 562 | kfree(tmp); |
| 554 | return ret; | 563 | return ret; |
| 555 | } | 564 | } |
| @@ -565,7 +574,6 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, · 9 unmodified lines | |||
| 565 | int offset; | 574 | int offset; |
| 566 | int total_written; | 575 | int total_written; |
| 567 | 576 | ||
| 568 | rcu_read_lock(); | ||
| 569 | ppd = private2ppd(file); | 577 | ppd = private2ppd(file); |
| 570 | 578 | ||
| 571 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ | 579 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ |
| @@ -573,16 +581,12 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, · 1 unmodified line | |||
| 573 | offset = *ppos & 0xffff; | 581 | offset = *ppos & 0xffff; |
| 574 | 582 | ||
| 575 | /* explicitly reject invalid address 0 to catch cp and cat */ | 583 | /* explicitly reject invalid address 0 to catch cp and cat */ |
| 576 | if (i2c_addr == 0) { | 584 | if (i2c_addr == 0) |
| 577 | ret = -EINVAL; | 585 | return -EINVAL; |
| 578 | goto _return; | ||
| 579 | } | ||
| 580 | 586 | ||
| 581 | buff = kmalloc(count, GFP_KERNEL); | 587 | buff = kmalloc(count, GFP_KERNEL); |
| 582 | if (!buff) { | 588 | if (!buff) |
| 583 | ret = -ENOMEM; | 589 | return -ENOMEM; |
| 584 | goto _return; | ||
| 585 | } | ||
| 586 | 590 | ||
| 587 | ret = copy_from_user(buff, buf, count); | 591 | ret = copy_from_user(buff, buf, count); |
| 588 | if (ret > 0) { | 592 | if (ret > 0) { |
| @@ -602,8 +606,6 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, · 13 unmodified lines | |||
| 602 | 606 | ||
| 603 | _free: | 607 | _free: |
| 604 | kfree(buff); | 608 | kfree(buff); |
| 605 | _return: | ||
| 606 | rcu_read_unlock(); | ||
| 607 | return ret; | 609 | return ret; |
| 608 | } | 610 | } |
| 609 | 611 | ||
| @@ -632,7 +634,6 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, · 22 unmodified lines | |||
| 632 | int offset; | 634 | int offset; |
| 633 | int total_read; | 635 | int total_read; |
| 634 | 636 | ||
| 635 | rcu_read_lock(); | ||
| 636 | ppd = private2ppd(file); | 637 | ppd = private2ppd(file); |
| 637 | 638 | ||
| 638 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ | 639 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ |
| @@ -640,16 +641,12 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, · 1 unmodified line | |||
| 640 | offset = *ppos & 0xffff; | 641 | offset = *ppos & 0xffff; |
| 641 | 642 | ||
| 642 | /* explicitly reject invalid address 0 to catch cp and cat */ | 643 | /* explicitly reject invalid address 0 to catch cp and cat */ |
| 643 | if (i2c_addr == 0) { | 644 | if (i2c_addr == 0) |
| 644 | ret = -EINVAL; | 645 | return -EINVAL; |
| 645 | goto _return; | ||
| 646 | } | ||
| 647 | 646 | ||
| 648 | buff = kmalloc(count, GFP_KERNEL); | 647 | buff = kmalloc(count, GFP_KERNEL); |
| 649 | if (!buff) { | 648 | if (!buff) |
| 650 | ret = -ENOMEM; | 649 | return -ENOMEM; |
| 651 | goto _return; | ||
| 652 | } | ||
| 653 | 650 | ||
| 654 | total_read = i2c_read(ppd, target, i2c_addr, offset, buff, count); | 651 | total_read = i2c_read(ppd, target, i2c_addr, offset, buff, count); |
| 655 | if (total_read < 0) { | 652 | if (total_read < 0) { |
| @@ -669,8 +666,6 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, · 13 unmodified lines | |||
| 669 | 666 | ||
| 670 | _free: | 667 | _free: |
| 671 | kfree(buff); | 668 | kfree(buff); |
| 672 | _return: | ||
| 673 | rcu_read_unlock(); | ||
| 674 | return ret; | 669 | return ret; |
| 675 | } | 670 | } |
| 676 | 671 | ||
| @@ -697,26 +692,20 @@ static ssize_t __qsfp_debugfs_write(struct file *file, const char __user *buf, · 20 unmodified lines | |||
| 697 | int ret; | 692 | int ret; |
| 698 | int total_written; | 693 | int total_written; |
| 699 | 694 | ||
| 700 | rcu_read_lock(); | 695 | if (*ppos + count > QSFP_PAGESIZE * 4) /* base page + page00-page03 */ |
| 701 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ | 696 | return -EINVAL; |
| 702 | ret = -EINVAL; | ||
| 703 | goto _return; | ||
| 704 | } | ||
| 705 | 697 | ||
| 706 | ppd = private2ppd(file); | 698 | ppd = private2ppd(file); |
| 707 | 699 | ||
| 708 | buff = kmalloc(count, GFP_KERNEL); | 700 | buff = kmalloc(count, GFP_KERNEL); |
| 709 | if (!buff) { | 701 | if (!buff) |
| 710 | ret = -ENOMEM; | 702 | return -ENOMEM; |
| 711 | goto _return; | ||
| 712 | } | ||
| 713 | 703 | ||
| 714 | ret = copy_from_user(buff, buf, count); | 704 | ret = copy_from_user(buff, buf, count); |
| 715 | if (ret > 0) { | 705 | if (ret > 0) { |
| 716 | ret = -EFAULT; | 706 | ret = -EFAULT; |
| 717 | goto _free; | 707 | goto _free; |
| 718 | } | 708 | } |
| 719 | |||
| 720 | total_written = qsfp_write(ppd, target, *ppos, buff, count); | 709 | total_written = qsfp_write(ppd, target, *ppos, buff, count); |
| 721 | if (total_written < 0) { | 710 | if (total_written < 0) { |
| 722 | ret = total_written; | 711 | ret = total_written; |
| @@ -729,8 +718,6 @@ static ssize_t __qsfp_debugfs_write(struct file *file, const char __user *buf, · 6 unmodified lines | |||
| 729 | 718 | ||
| 730 | _free: | 719 | _free: |
| 731 | kfree(buff); | 720 | kfree(buff); |
| 732 | _return: | ||
| 733 | rcu_read_unlock(); | ||
| 734 | return ret; | 721 | return ret; |
| 735 | } | 722 | } |
| 736 | 723 | ||
| @@ -757,7 +744,6 @@ static ssize_t __qsfp_debugfs_read(struct file *file, char __user *buf, · 20 unmodified lines | |||
| 757 | int ret; | 744 | int ret; |
| 758 | int total_read; | 745 | int total_read; |
| 759 | 746 | ||
| 760 | rcu_read_lock(); | ||
| 761 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ | 747 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ |
| 762 | ret = -EINVAL; | 748 | ret = -EINVAL; |
| 763 | goto _return; | 749 | goto _return; |
| @@ -790,7 +776,6 @@ static ssize_t __qsfp_debugfs_read(struct file *file, char __user *buf, · 26 unmodified lines | |||
| 790 | _free: | 776 | _free: |
| 791 | kfree(buff); | 777 | kfree(buff); |
| 792 | _return: | 778 | _return: |
| 793 | rcu_read_unlock(); | ||
| 794 | return ret; | 779 | return ret; |
| 795 | } | 780 | } |
| 796 | 781 | ||
| @@ -1006,7 +991,6 @@ void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd) · 209 unmodified lines | |||
| 1006 | debugfs_remove_recursive(ibd->hfi1_ibdev_dbg); | 991 | debugfs_remove_recursive(ibd->hfi1_ibdev_dbg); |
| 1007 | out: | 992 | out: |
| 1008 | ibd->hfi1_ibdev_dbg = NULL; | 993 | ibd->hfi1_ibdev_dbg = NULL; |
| 1009 | synchronize_rcu(); | ||
| 1010 | } | 994 | } |
| 1011 | 995 | ||
| 1012 | /* | 996 | /* |
| @@ -1031,9 +1015,7 @@ static const char * const hfi1_statnames[] = { · 18 unmodified lines | |||
| 1031 | }; | 1015 | }; |
| 1032 | 1016 | ||
| 1033 | static void *_driver_stats_names_seq_start(struct seq_file *s, loff_t *pos) | 1017 | static void *_driver_stats_names_seq_start(struct seq_file *s, loff_t *pos) |
| 1034 | __acquires(RCU) | ||
| 1035 | { | 1018 | { |
| 1036 | rcu_read_lock(); | ||
| 1037 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) | 1019 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) |
| 1038 | return NULL; | 1020 | return NULL; |
| 1039 | return pos; | 1021 | return pos; |
| @@ -1051,9 +1033,7 @@ static void *_driver_stats_names_seq_next( · 11 unmodified lines | |||
| 1051 | } | 1033 | } |
| 1052 | 1034 | ||
| 1053 | static void _driver_stats_names_seq_stop(struct seq_file *s, void *v) | 1035 | static void _driver_stats_names_seq_stop(struct seq_file *s, void *v) |
| 1054 | __releases(RCU) | ||
| 1055 | { | 1036 | { |
| 1056 | rcu_read_unlock(); | ||
| 1057 | } | 1037 | } |
| 1058 | 1038 | ||
| 1059 | static int _driver_stats_names_seq_show(struct seq_file *s, void *v) | 1039 | static int _driver_stats_names_seq_show(struct seq_file *s, void *v) |
| @@ -1069,9 +1049,7 @@ DEBUGFS_SEQ_FILE_OPEN(driver_stats_names) · 9 unmodified lines | |||
| 1069 | DEBUGFS_FILE_OPS(driver_stats_names); | 1049 | DEBUGFS_FILE_OPS(driver_stats_names); |
| 1070 | 1050 | ||
| 1071 | static void *_driver_stats_seq_start(struct seq_file *s, loff_t *pos) | 1051 | static void *_driver_stats_seq_start(struct seq_file *s, loff_t *pos) |
| 1072 | __acquires(RCU) | ||
| 1073 | { | 1052 | { |
| 1074 | rcu_read_lock(); | ||
| 1075 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) | 1053 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) |
| 1076 | return NULL; | 1054 | return NULL; |
| 1077 | return pos; | 1055 | return pos; |
| @@ -1086,9 +1064,7 @@ static void *_driver_stats_seq_next(struct seq_file *s, void *v, loff_t *pos) · 8 unmodified lines | |||
| 1086 | } | 1064 | } |
| 1087 | 1065 | ||
| 1088 | static void _driver_stats_seq_stop(struct seq_file *s, void *v) | 1066 | static void _driver_stats_seq_stop(struct seq_file *s, void *v) |
| 1089 | __releases(RCU) | ||
| 1090 | { | 1067 | { |
| 1091 | rcu_read_unlock(); | ||
| 1092 | } | 1068 | } |
| 1093 | 1069 | ||
| 1094 | static u64 hfi1_sps_ints(void) | 1070 | static u64 hfi1_sps_ints(void) |
| @@ -888,14 +888,15 @@ void set_all_slowpath(struct hfi1_devdata *dd) · 887 unmodified lines | |||
| 888 | } | 888 | } |
| 889 | 889 | ||
| 890 | static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd, | 890 | static inline int set_armed_to_active(struct hfi1_ctxtdata *rcd, |
| 891 | struct hfi1_packet packet, | 891 | struct hfi1_packet *packet, |
| 892 | struct hfi1_devdata *dd) | 892 | struct hfi1_devdata *dd) |
| 893 | { | 893 | { |
| 894 | struct work_struct *lsaw = &rcd->ppd->linkstate_active_work; | 894 | struct work_struct *lsaw = &rcd->ppd->linkstate_active_work; |
| 895 | struct hfi1_message_header *hdr = hfi1_get_msgheader(packet.rcd->dd, | 895 | struct hfi1_message_header *hdr = hfi1_get_msgheader(packet->rcd->dd, |
| 896 | packet.rhf_addr); | 896 | packet->rhf_addr); |
| 897 | u8 etype = rhf_rcv_type(packet->rhf); | ||
| 897 | 898 | ||
| 898 | if (hdr2sc(hdr, packet.rhf) != 0xf) { | 899 | if (etype == RHF_RCV_TYPE_IB && hdr2sc(hdr, packet->rhf) != 0xf) { |
| 899 | int hwstate = read_logical_state(dd); | 900 | int hwstate = read_logical_state(dd); |
| 900 | 901 | ||
| 901 | if (hwstate != LSTATE_ACTIVE) { | 902 | if (hwstate != LSTATE_ACTIVE) { |
| @@ -979,7 +980,7 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) · 77 unmodified lines | |||
| 979 | /* Auto activate link on non-SC15 packet receive */ | 980 | /* Auto activate link on non-SC15 packet receive */ |
| 980 | if (unlikely(rcd->ppd->host_link_state == | 981 | if (unlikely(rcd->ppd->host_link_state == |
| 981 | HLS_UP_ARMED) && | 982 | HLS_UP_ARMED) && |
| 982 | set_armed_to_active(rcd, packet, dd)) | 983 | set_armed_to_active(rcd, &packet, dd)) |
| 983 | goto bail; | 984 | goto bail; |
| 984 | last = process_rcv_packet(&packet, thread); | 985 | last = process_rcv_packet(&packet, thread); |
| 985 | } | 986 | } |
| @@ -183,6 +183,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp) · 182 unmodified lines | |||
| 183 | if (fd) { | 183 | if (fd) { |
| 184 | fd->rec_cpu_num = -1; /* no cpu affinity by default */ | 184 | fd->rec_cpu_num = -1; /* no cpu affinity by default */ |
| 185 | fd->mm = current->mm; | 185 | fd->mm = current->mm; |
| 186 | atomic_inc(&fd->mm->mm_count); | ||
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | fp->private_data = fd; | 189 | fp->private_data = fd; |
| @@ -222,7 +223,7 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd, · 33 unmodified lines | |||
| 222 | ret = assign_ctxt(fp, &uinfo); | 223 | ret = assign_ctxt(fp, &uinfo); |
| 223 | if (ret < 0) | 224 | if (ret < 0) |
| 224 | return ret; | 225 | return ret; |
| 225 | setup_ctxt(fp); | 226 | ret = setup_ctxt(fp); |
| 226 | if (ret) | 227 | if (ret) |
| 227 | return ret; | 228 | return ret; |
| 228 | ret = user_init(fp); | 229 | ret = user_init(fp); |
| @@ -779,6 +780,7 @@ static int hfi1_file_close(struct inode *inode, struct file *fp) · 550 unmodified lines | |||
| 779 | mutex_unlock(&hfi1_mutex); | 780 | mutex_unlock(&hfi1_mutex); |
| 780 | hfi1_free_ctxtdata(dd, uctxt); | 781 | hfi1_free_ctxtdata(dd, uctxt); |
| 781 | done: | 782 | done: |
| 783 | mmdrop(fdata->mm); | ||
| 782 | kobject_put(&dd->kobj); | 784 | kobject_put(&dd->kobj); |
| 783 | kfree(fdata); | 785 | kfree(fdata); |
| 784 | return 0; | 786 | return 0; |
| @@ -605,6 +605,7 @@ struct hfi1_pportdata { · 604 unmodified lines | |||
| 605 | struct work_struct freeze_work; | 605 | struct work_struct freeze_work; |
| 606 | struct work_struct link_downgrade_work; | 606 | struct work_struct link_downgrade_work; |
| 607 | struct work_struct link_bounce_work; | 607 | struct work_struct link_bounce_work; |
| 608 | struct delayed_work start_link_work; | ||
| 608 | /* host link state variables */ | 609 | /* host link state variables */ |
| 609 | struct mutex hls_lock; | 610 | struct mutex hls_lock; |
| 610 | u32 host_link_state; | 611 | u32 host_link_state; |
| @@ -659,6 +660,7 @@ struct hfi1_pportdata { · 48 unmodified lines | |||
| 659 | u8 linkinit_reason; | 660 | u8 linkinit_reason; |
| 660 | u8 local_tx_rate; /* rate given to 8051 firmware */ | 661 | u8 local_tx_rate; /* rate given to 8051 firmware */ |
| 661 | u8 last_pstate; /* info only */ | 662 | u8 last_pstate; /* info only */ |
| 663 | u8 qsfp_retry_count; | ||
| 662 | 664 | ||
| 663 | /* placeholders for IB MAD packet settings */ | 665 | /* placeholders for IB MAD packet settings */ |
| 664 | u8 overrun_threshold; | 666 | u8 overrun_threshold; |
| @@ -1272,9 +1274,26 @@ static inline int hdr2sc(struct hfi1_message_header *hdr, u64 rhf) · 607 unmodified lines | |||
| 1272 | ((!!(rhf_dc_info(rhf))) << 4); | 1274 | ((!!(rhf_dc_info(rhf))) << 4); |
| 1273 | } | 1275 | } |
| 1274 | 1276 | ||
| 1277 | #define HFI1_JKEY_WIDTH 16 | ||
| 1278 | #define HFI1_JKEY_MASK (BIT(16) - 1) | ||
| 1279 | #define HFI1_ADMIN_JKEY_RANGE 32 | ||
| 1280 | |||
| 1281 | /* | ||
| 1282 | * J_KEYs are split and allocated in the following groups: | ||
| 1283 | * 0 - 31 - users with administrator privileges | ||
| 1284 | * 32 - 63 - kernel protocols using KDETH packets | ||
| 1285 | * 64 - 65535 - all other users using KDETH packets | ||
| 1286 | */ | ||
| 1275 | static inline u16 generate_jkey(kuid_t uid) | 1287 | static inline u16 generate_jkey(kuid_t uid) |
| 1276 | { | 1288 | { |
| 1277 | return from_kuid(current_user_ns(), uid) & 0xffff; | 1289 | u16 jkey = from_kuid(current_user_ns(), uid) & HFI1_JKEY_MASK; |
| 1290 | |||
| 1291 | if (capable(CAP_SYS_ADMIN)) | ||
| 1292 | jkey &= HFI1_ADMIN_JKEY_RANGE - 1; | ||
| 1293 | else if (jkey < 64) | ||
| 1294 | jkey |= BIT(HFI1_JKEY_WIDTH - 1); | ||
| 1295 | |||
| 1296 | return jkey; | ||
| 1278 | } | 1297 | } |
| 1279 | 1298 | ||
| 1280 | /* | 1299 | /* |
| @@ -1656,7 +1675,6 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd) · 375 unmodified lines | |||
| 1656 | struct hfi1_devdata *hfi1_init_dd(struct pci_dev *, | 1675 | struct hfi1_devdata *hfi1_init_dd(struct pci_dev *, |
| 1657 | const struct pci_device_id *); | 1676 | const struct pci_device_id *); |
| 1658 | void hfi1_free_devdata(struct hfi1_devdata *); | 1677 | void hfi1_free_devdata(struct hfi1_devdata *); |
| 1659 | void cc_state_reclaim(struct rcu_head *rcu); | ||
| 1660 | struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra); | 1678 | struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra); |
| 1661 | 1679 | ||
| 1662 | /* LED beaconing functions */ | 1680 | /* LED beaconing functions */ |
| @@ -1788,7 +1806,7 @@ extern unsigned int hfi1_max_mtu; · 125 unmodified lines | |||
| 1788 | extern unsigned int hfi1_cu; | 1806 | extern unsigned int hfi1_cu; |
| 1789 | extern unsigned int user_credit_return_threshold; | 1807 | extern unsigned int user_credit_return_threshold; |
| 1790 | extern int num_user_contexts; | 1808 | extern int num_user_contexts; |
| 1791 | extern unsigned n_krcvqs; | 1809 | extern unsigned long n_krcvqs; |
| 1792 | extern uint krcvqs[]; | 1810 | extern uint krcvqs[]; |
| 1793 | extern int krcvqsset; | 1811 | extern int krcvqsset; |
| 1794 | extern uint kdeth_qp; | 1812 | extern uint kdeth_qp; |
| @@ -94,7 +94,7 @@ module_param_array(krcvqs, uint, &krcvqsset, S_IRUGO); · 93 unmodified lines | |||
| 94 | MODULE_PARM_DESC(krcvqs, "Array of the number of non-control kernel receive queues by VL"); | 94 | MODULE_PARM_DESC(krcvqs, "Array of the number of non-control kernel receive queues by VL"); |
| 95 | 95 | ||
| 96 | /* computed based on above array */ | 96 | /* computed based on above array */ |
| 97 | unsigned n_krcvqs; | 97 | unsigned long n_krcvqs; |
| 98 | 98 | ||
| 99 | static unsigned hfi1_rcvarr_split = 25; | 99 | static unsigned hfi1_rcvarr_split = 25; |
| 100 | module_param_named(rcvarr_split, hfi1_rcvarr_split, uint, S_IRUGO); | 100 | module_param_named(rcvarr_split, hfi1_rcvarr_split, uint, S_IRUGO); |
| @@ -500,6 +500,7 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, · 399 unmodified lines | |||
| 500 | INIT_WORK(&ppd->link_downgrade_work, handle_link_downgrade); | 500 | INIT_WORK(&ppd->link_downgrade_work, handle_link_downgrade); |
| 501 | INIT_WORK(&ppd->sma_message_work, handle_sma_message); | 501 | INIT_WORK(&ppd->sma_message_work, handle_sma_message); |
| 502 | INIT_WORK(&ppd->link_bounce_work, handle_link_bounce); | 502 | INIT_WORK(&ppd->link_bounce_work, handle_link_bounce); |
| 503 | INIT_DELAYED_WORK(&ppd->start_link_work, handle_start_link); | ||
| 503 | INIT_WORK(&ppd->linkstate_active_work, receive_interrupt_work); | 504 | INIT_WORK(&ppd->linkstate_active_work, receive_interrupt_work); |
| 504 | INIT_WORK(&ppd->qsfp_info.qsfp_work, qsfp_event); | 505 | INIT_WORK(&ppd->qsfp_info.qsfp_work, qsfp_event); |
| 505 | 506 | ||
| @@ -1333,7 +1334,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd) · 827 unmodified lines | |||
| 1333 | spin_unlock(&ppd->cc_state_lock); | 1334 | spin_unlock(&ppd->cc_state_lock); |
| 1334 | 1335 | ||
| 1335 | if (cc_state) | 1336 | if (cc_state) |
| 1336 | call_rcu(&cc_state->rcu, cc_state_reclaim); | 1337 | kfree_rcu(cc_state, rcu); |
| 1337 | } | 1338 | } |
| 1338 | 1339 | ||
| 1339 | free_credit_return(dd); | 1340 | free_credit_return(dd); |
| @@ -1819,6 +1819,11 @@ static int __subn_get_opa_cable_info(struct opa_smp *smp, u32 am, u8 *data, · 1818 unmodified lines | |||
| 1819 | u32 len = OPA_AM_CI_LEN(am) + 1; | 1819 | u32 len = OPA_AM_CI_LEN(am) + 1; |
| 1820 | int ret; | 1820 | int ret; |
| 1821 | 1821 | ||
| 1822 | if (dd->pport->port_type != PORT_TYPE_QSFP) { | ||
| 1823 | smp->status |= IB_SMP_INVALID_FIELD; | ||
| 1824 | return reply((struct ib_mad_hdr *)smp); | ||
| 1825 | } | ||
| 1826 | |||
| 1822 | #define __CI_PAGE_SIZE BIT(7) /* 128 bytes */ | 1827 | #define __CI_PAGE_SIZE BIT(7) /* 128 bytes */ |
| 1823 | #define __CI_PAGE_MASK ~(__CI_PAGE_SIZE - 1) | 1828 | #define __CI_PAGE_MASK ~(__CI_PAGE_SIZE - 1) |
| 1824 | #define __CI_PAGE_NUM(a) ((a) & __CI_PAGE_MASK) | 1829 | #define __CI_PAGE_NUM(a) ((a) & __CI_PAGE_MASK) |
| @@ -2599,7 +2604,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, · 774 unmodified lines | |||
| 2599 | u8 lq, num_vls; | 2604 | u8 lq, num_vls; |
| 2600 | u8 res_lli, res_ler; | 2605 | u8 res_lli, res_ler; |
| 2601 | u64 port_mask; | 2606 | u64 port_mask; |
| 2602 | unsigned long port_num; | 2607 | u8 port_num; |
| 2603 | unsigned long vl; | 2608 | unsigned long vl; |
| 2604 | u32 vl_select_mask; | 2609 | u32 vl_select_mask; |
| 2605 | int vfi; | 2610 | int vfi; |
| @@ -2633,9 +2638,9 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, · 27 unmodified lines | |||
| 2633 | */ | 2638 | */ |
| 2634 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 2639 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
| 2635 | port_num = find_first_bit((unsigned long *)&port_mask, | 2640 | port_num = find_first_bit((unsigned long *)&port_mask, |
| 2636 | sizeof(port_mask)); | 2641 | sizeof(port_mask) * 8); |
| 2637 | 2642 | ||
| 2638 | if ((u8)port_num != port) { | 2643 | if (port_num != port) { |
| 2639 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 2644 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
| 2640 | return reply((struct ib_mad_hdr *)pmp); | 2645 | return reply((struct ib_mad_hdr *)pmp); |
| 2641 | } | 2646 | } |
| @@ -2837,7 +2842,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, · 195 unmodified lines | |||
| 2837 | */ | 2842 | */ |
| 2838 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 2843 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
| 2839 | port_num = find_first_bit((unsigned long *)&port_mask, | 2844 | port_num = find_first_bit((unsigned long *)&port_mask, |
| 2840 | sizeof(port_mask)); | 2845 | sizeof(port_mask) * 8); |
| 2841 | 2846 | ||
| 2842 | if (port_num != port) { | 2847 | if (port_num != port) { |
| 2843 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 2848 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
| @@ -3010,7 +3015,7 @@ static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp, · 166 unmodified lines | |||
| 3010 | */ | 3015 | */ |
| 3011 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 3016 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
| 3012 | port_num = find_first_bit((unsigned long *)&port_mask, | 3017 | port_num = find_first_bit((unsigned long *)&port_mask, |
| 3013 | sizeof(port_mask)); | 3018 | sizeof(port_mask) * 8); |
| 3014 | 3019 | ||
| 3015 | if (port_num != port) { | 3020 | if (port_num != port) { |
| 3016 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 3021 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
| @@ -3247,7 +3252,7 @@ static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp, · 230 unmodified lines | |||
| 3247 | */ | 3252 | */ |
| 3248 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 3253 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
| 3249 | port_num = find_first_bit((unsigned long *)&port_mask, | 3254 | port_num = find_first_bit((unsigned long *)&port_mask, |
| 3250 | sizeof(port_mask)); | 3255 | sizeof(port_mask) * 8); |
| 3251 | 3256 | ||
| 3252 | if (port_num != port) { | 3257 | if (port_num != port) { |
| 3253 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 3258 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
| @@ -3398,7 +3403,7 @@ static void apply_cc_state(struct hfi1_pportdata *ppd) · 144 unmodified lines | |||
| 3398 | 3403 | ||
| 3399 | spin_unlock(&ppd->cc_state_lock); | 3404 | spin_unlock(&ppd->cc_state_lock); |
| 3400 | 3405 | ||
| 3401 | call_rcu(&old_cc_state->rcu, cc_state_reclaim); | 3406 | kfree_rcu(old_cc_state, rcu); |
| 3402 | } | 3407 | } |
| 3403 | 3408 | ||
| 3404 | static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data, | 3409 | static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data, |
| @@ -3553,13 +3558,6 @@ static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, · 148 unmodified lines | |||
| 3553 | return reply((struct ib_mad_hdr *)smp); | 3558 | return reply((struct ib_mad_hdr *)smp); |
| 3554 | } | 3559 | } |
| 3555 | 3560 | ||
| 3556 | void cc_state_reclaim(struct rcu_head *rcu) | ||
| 3557 | { | ||
| 3558 | struct cc_state *cc_state = container_of(rcu, struct cc_state, rcu); | ||
| 3559 | |||
| 3560 | kfree(cc_state); | ||
| 3561 | } | ||
| 3562 | |||
| 3563 | static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, | 3561 | static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, |
| 3564 | struct ib_device *ibdev, u8 port, | 3562 | struct ib_device *ibdev, u8 port, |
| 3565 | u32 *resp_len) | 3563 | u32 *resp_len) |
| @@ -771,6 +771,9 @@ void seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes) · 770 unmodified lines | |||
| 771 | read_extra_bytes(pbuf, from, to_fill); | 771 | read_extra_bytes(pbuf, from, to_fill); |
| 772 | from += to_fill; | 772 | from += to_fill; |
| 773 | nbytes -= to_fill; | 773 | nbytes -= to_fill; |
| 774 | /* may not be enough valid bytes left to align */ | ||
| 775 | if (extra > nbytes) | ||
| 776 | extra = nbytes; | ||
| 774 | 777 | ||
| 775 | /* ...now write carry */ | 778 | /* ...now write carry */ |
| 776 | dest = pbuf->start + (pbuf->qw_written * sizeof(u64)); | 779 | dest = pbuf->start + (pbuf->qw_written * sizeof(u64)); |
| @@ -798,6 +801,15 @@ void seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes) · 21 unmodified lines | |||
| 798 | read_low_bytes(pbuf, from, extra); | 801 | read_low_bytes(pbuf, from, extra); |
| 799 | from += extra; | 802 | from += extra; |
| 800 | nbytes -= extra; | 803 | nbytes -= extra; |
| 804 | /* | ||
| 805 | * If no bytes are left, return early - we are done. | ||
| 806 | * NOTE: This short-circuit is *required* because | ||
| 807 | * "extra" may have been reduced in size and "from" | ||
| 808 | * is not aligned, as required when leaving this | ||
| 809 | * if block. | ||
| 810 | */ | ||
| 811 | if (nbytes == 0) | ||
| 812 | return; | ||
| 801 | } | 813 | } |
| 802 | 814 | ||
| 803 | /* at this point, from is QW aligned */ | 815 | /* at this point, from is QW aligned */ |
| @@ -656,10 +656,6 @@ struct qp_iter *qp_iter_init(struct hfi1_ibdev *dev) · 655 unmodified lines | |||
| 656 | 656 | ||
| 657 | iter->dev = dev; | 657 | iter->dev = dev; |
| 658 | iter->specials = dev->rdi.ibdev.phys_port_cnt * 2; | 658 | iter->specials = dev->rdi.ibdev.phys_port_cnt * 2; |
| 659 | if (qp_iter_next(iter)) { | ||
| 660 | kfree(iter); | ||
| 661 | return NULL; | ||
| 662 | } | ||
| 663 | 659 | ||
| 664 | return iter; | 660 | return iter; |
| 665 | } | 661 | } |
| @@ -706,8 +706,8 @@ int get_cable_info(struct hfi1_devdata *dd, u32 port_num, u32 addr, u32 len, · 705 unmodified lines | |||
| 706 | u8 *data) | 706 | u8 *data) |
| 707 | { | 707 | { |
| 708 | struct hfi1_pportdata *ppd; | 708 | struct hfi1_pportdata *ppd; |
| 709 | u32 excess_len = 0; | 709 | u32 excess_len = len; |
| 710 | int ret = 0; | 710 | int ret = 0, offset = 0; |
| 711 | 711 | ||
| 712 | if (port_num > dd->num_pports || port_num < 1) { | 712 | if (port_num > dd->num_pports || port_num < 1) { |
| 713 | dd_dev_info(dd, "%s: Invalid port number %d\n", | 713 | dd_dev_info(dd, "%s: Invalid port number %d\n", |
| @@ -740,6 +740,34 @@ int get_cable_info(struct hfi1_devdata *dd, u32 port_num, u32 addr, u32 len, · 26 unmodified lines | |||
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | memcpy(data, &ppd->qsfp_info.cache[addr], len); | 742 | memcpy(data, &ppd->qsfp_info.cache[addr], len); |
| 743 | |||
| 744 | if (addr <= QSFP_MONITOR_VAL_END && | ||
| 745 | (addr + len) >= QSFP_MONITOR_VAL_START) { | ||
| 746 | /* Overlap with the dynamic channel monitor range */ | ||
| 747 | if (addr < QSFP_MONITOR_VAL_START) { | ||
| 748 | if (addr + len <= QSFP_MONITOR_VAL_END) | ||
| 749 | len = addr + len - QSFP_MONITOR_VAL_START; | ||
| 750 | else | ||
| 751 | len = QSFP_MONITOR_RANGE; | ||
| 752 | offset = QSFP_MONITOR_VAL_START - addr; | ||
| 753 | addr = QSFP_MONITOR_VAL_START; | ||
| 754 | } else if (addr == QSFP_MONITOR_VAL_START) { | ||
| 755 | offset = 0; | ||
| 756 | if (addr + len > QSFP_MONITOR_VAL_END) | ||
| 757 | len = QSFP_MONITOR_RANGE; | ||
| 758 | } else { | ||
| 759 | offset = 0; | ||
| 760 | if (addr + len > QSFP_MONITOR_VAL_END) | ||
| 761 | len = QSFP_MONITOR_VAL_END - addr + 1; | ||
| 762 | } | ||
| 763 | /* Refresh the values of the dynamic monitors from the cable */ | ||
| 764 | ret = one_qsfp_read(ppd, dd->hfi1_id, addr, data + offset, len); | ||
| 765 | if (ret != len) { | ||
| 766 | ret = -EAGAIN; | ||
| 767 | goto set_zeroes; | ||
| 768 | } | ||
| 769 | } | ||
| 770 | |||
| 743 | return 0; | 771 | return 0; |
| 744 | 772 | ||
| 745 | set_zeroes: | 773 | set_zeroes: |
| @@ -74,6 +74,9 @@ · 73 unmodified lines | |||
| 74 | /* Defined fields that Intel requires of qualified cables */ | 74 | /* Defined fields that Intel requires of qualified cables */ |
| 75 | /* Byte 0 is Identifier, not checked */ | 75 | /* Byte 0 is Identifier, not checked */ |
| 76 | /* Byte 1 is reserved "status MSB" */ | 76 | /* Byte 1 is reserved "status MSB" */ |
| 77 | #define QSFP_MONITOR_VAL_START 22 | ||
| 78 | #define QSFP_MONITOR_VAL_END 81 | ||
| 79 | #define QSFP_MONITOR_RANGE (QSFP_MONITOR_VAL_END - QSFP_MONITOR_VAL_START + 1) | ||
| 77 | #define QSFP_TX_CTRL_BYTE_OFFS 86 | 80 | #define QSFP_TX_CTRL_BYTE_OFFS 86 |
| 78 | #define QSFP_PWR_CTRL_BYTE_OFFS 93 | 81 | #define QSFP_PWR_CTRL_BYTE_OFFS 93 |
| 79 | #define QSFP_CDR_CTRL_BYTE_OFFS 98 | 82 | #define QSFP_CDR_CTRL_BYTE_OFFS 98 |
| @@ -114,6 +114,8 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12 · 113 unmodified lines | |||
| 114 | #define KDETH_HCRC_LOWER_SHIFT 24 | 114 | #define KDETH_HCRC_LOWER_SHIFT 24 |
| 115 | #define KDETH_HCRC_LOWER_MASK 0xff | 115 | #define KDETH_HCRC_LOWER_MASK 0xff |
| 116 | 116 | ||
| 117 | #define AHG_KDETH_INTR_SHIFT 12 | ||
| 118 | |||
| 117 | #define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4) | 119 | #define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4) |
| 118 | #define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff) | 120 | #define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff) |
| 119 | 121 | ||
| @@ -1480,7 +1482,8 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, · 1360 unmodified lines | |||
| 1480 | /* Clear KDETH.SH on last packet */ | 1482 | /* Clear KDETH.SH on last packet */ |
| 1481 | if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT)) { | 1483 | if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT)) { |
| 1482 | val |= cpu_to_le16(KDETH_GET(hdr->kdeth.ver_tid_offset, | 1484 | val |= cpu_to_le16(KDETH_GET(hdr->kdeth.ver_tid_offset, |
| 1483 | INTR) >> 16); | 1485 | INTR) << |
| 1486 | AHG_KDETH_INTR_SHIFT); | ||
| 1484 | val &= cpu_to_le16(~(1U << 13)); | 1487 | val &= cpu_to_le16(~(1U << 13)); |
| 1485 | AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val); | 1488 | AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val); |
| 1486 | } else { | 1489 | } else { |
| @@ -232,7 +232,7 @@ struct i40iw_device { · 231 unmodified lines | |||
| 232 | struct i40e_client *client; | 232 | struct i40e_client *client; |
| 233 | struct i40iw_hw hw; | 233 | struct i40iw_hw hw; |
| 234 | struct i40iw_cm_core cm_core; | 234 | struct i40iw_cm_core cm_core; |
| 235 | unsigned long *mem_resources; | 235 | u8 *mem_resources; |
| 236 | unsigned long *allocated_qps; | 236 | unsigned long *allocated_qps; |
| 237 | unsigned long *allocated_cqs; | 237 | unsigned long *allocated_cqs; |
| 238 | unsigned long *allocated_mrs; | 238 | unsigned long *allocated_mrs; |
| @@ -435,8 +435,8 @@ static inline int i40iw_alloc_resource(struct i40iw_device *iwdev, · 196 unmodified lines | |||
| 435 | *next = resource_num + 1; | 435 | *next = resource_num + 1; |
| 436 | if (*next == max_resources) | 436 | if (*next == max_resources) |
| 437 | *next = 0; | 437 | *next = 0; |
| 438 | spin_unlock_irqrestore(&iwdev->resource_lock, flags); | ||
| 439 | *req_resource_num = resource_num; | 438 | *req_resource_num = resource_num; |
| 439 | spin_unlock_irqrestore(&iwdev->resource_lock, flags); | ||
| 440 | 440 | ||
| 441 | return 0; | 441 | return 0; |
| 442 | } | 442 | } |
| @@ -535,8 +535,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node, · 534 unmodified lines | |||
| 535 | buf += hdr_len; | 535 | buf += hdr_len; |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | if (pd_len) | 538 | if (pdata && pdata->addr) |
| 539 | memcpy(buf, pdata->addr, pd_len); | 539 | memcpy(buf, pdata->addr, pdata->size); |
| 540 | 540 | ||
| 541 | atomic_set(&sqbuf->refcount, 1); | 541 | atomic_set(&sqbuf->refcount, 1); |
| 542 | 542 | ||
| @@ -3346,26 +3346,6 @@ int i40iw_cm_disconn(struct i40iw_qp *iwqp) · 2803 unmodified lines | |||
| 3346 | return 0; | 3346 | return 0; |
| 3347 | } | 3347 | } |
| 3348 | 3348 | ||
| 3349 | /** | ||
| 3350 | * i40iw_loopback_nop - Send a nop | ||
| 3351 | * @qp: associated hw qp | ||
| 3352 | */ | ||
| 3353 | static void i40iw_loopback_nop(struct i40iw_sc_qp *qp) | ||
| 3354 | { | ||
| 3355 | u64 *wqe; | ||
| 3356 | u64 header; | ||
| 3357 | |||
| 3358 | wqe = qp->qp_uk.sq_base->elem; | ||
| 3359 | set_64bit_val(wqe, 0, 0); | ||
| 3360 | set_64bit_val(wqe, 8, 0); | ||
| 3361 | set_64bit_val(wqe, 16, 0); | ||
| 3362 | |||
| 3363 | header = LS_64(I40IWQP_OP_NOP, I40IWQPSQ_OPCODE) | | ||
| 3364 | LS_64(0, I40IWQPSQ_SIGCOMPL) | | ||
| 3365 | LS_64(qp->qp_uk.swqe_polarity, I40IWQPSQ_VALID); | ||
| 3366 | set_64bit_val(wqe, 24, header); | ||
| 3367 | } | ||
| 3368 | |||
| 3369 | /** | 3349 | /** |
| 3370 | * i40iw_qp_disconnect - free qp and close cm | 3350 | * i40iw_qp_disconnect - free qp and close cm |
| 3371 | * @iwqp: associate qp for the connection | 3351 | * @iwqp: associate qp for the connection |
| @@ -3638,7 +3618,7 @@ int i40iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) · 266 unmodified lines | |||
| 3638 | } else { | 3618 | } else { |
| 3639 | if (iwqp->page) | 3619 | if (iwqp->page) |
| 3640 | iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page); | 3620 | iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page); |
| 3641 | i40iw_loopback_nop(&iwqp->sc_qp); | 3621 | dev->iw_priv_qp_ops->qp_send_lsmm(&iwqp->sc_qp, NULL, 0, 0); |
| 3642 | } | 3622 | } |
| 3643 | 3623 | ||
| 3644 | if (iwqp->page) | 3624 | if (iwqp->page) |
| @@ -265,6 +265,7 @@ void i40iw_next_iw_state(struct i40iw_qp *iwqp, · 264 unmodified lines | |||
| 265 | info.dont_send_fin = false; | 265 | info.dont_send_fin = false; |
| 266 | if (iwqp->sc_qp.term_flags && (state == I40IW_QP_STATE_ERROR)) | 266 | if (iwqp->sc_qp.term_flags && (state == I40IW_QP_STATE_ERROR)) |
| 267 | info.reset_tcp_conn = true; | 267 | info.reset_tcp_conn = true; |
| 268 | iwqp->hw_iwarp_state = state; | ||
| 268 | i40iw_hw_modify_qp(iwqp->iwdev, iwqp, &info, 0); | 269 | i40iw_hw_modify_qp(iwqp->iwdev, iwqp, &info, 0); |
| 269 | } | 270 | } |
| 270 | 271 | ||
| @@ -100,7 +100,7 @@ static struct notifier_block i40iw_net_notifier = { · 99 unmodified lines | |||
| 100 | .notifier_call = i40iw_net_event | 100 | .notifier_call = i40iw_net_event |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | static int i40iw_notifiers_registered; | 103 | static atomic_t i40iw_notifiers_registered; |
| 104 | 104 | ||
| 105 | /** | 105 | /** |
| 106 | * i40iw_find_i40e_handler - find a handler given a client info | 106 | * i40iw_find_i40e_handler - find a handler given a client info |
| @@ -1342,12 +1342,11 @@ exit: · 1235 unmodified lines | |||
| 1342 | */ | 1342 | */ |
| 1343 | static void i40iw_register_notifiers(void) | 1343 | static void i40iw_register_notifiers(void) |
| 1344 | { | 1344 | { |
| 1345 | if (!i40iw_notifiers_registered) { | 1345 | if (atomic_inc_return(&i40iw_notifiers_registered) == 1) { |
| 1346 | register_inetaddr_notifier(&i40iw_inetaddr_notifier); | 1346 | register_inetaddr_notifier(&i40iw_inetaddr_notifier); |
| 1347 | register_inet6addr_notifier(&i40iw_inetaddr6_notifier); | 1347 | register_inet6addr_notifier(&i40iw_inetaddr6_notifier); |
| 1348 | register_netevent_notifier(&i40iw_net_notifier); | 1348 | register_netevent_notifier(&i40iw_net_notifier); |
| 1349 | } | 1349 | } |
| 1350 | i40iw_notifiers_registered++; | ||
| 1351 | } | 1350 | } |
| 1352 | 1351 | ||
| 1353 | /** | 1352 | /** |
| @@ -1429,8 +1428,7 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset, bool del · 75 unmodified lines | |||
| 1429 | i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); | 1428 | i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); |
| 1430 | /* fallthrough */ | 1429 | /* fallthrough */ |
| 1431 | case INET_NOTIFIER: | 1430 | case INET_NOTIFIER: |
| 1432 | if (i40iw_notifiers_registered > 0) { | 1431 | if (!atomic_dec_return(&i40iw_notifiers_registered)) { |
| 1433 | i40iw_notifiers_registered--; | ||
| 1434 | unregister_netevent_notifier(&i40iw_net_notifier); | 1432 | unregister_netevent_notifier(&i40iw_net_notifier); |
| 1435 | unregister_inetaddr_notifier(&i40iw_inetaddr_notifier); | 1433 | unregister_inetaddr_notifier(&i40iw_inetaddr_notifier); |
| 1436 | unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); | 1434 | unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); |
| @@ -1558,6 +1556,10 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client) · 121 unmodified lines | |||
| 1558 | enum i40iw_status_code status; | 1556 | enum i40iw_status_code status; |
| 1559 | struct i40iw_handler *hdl; | 1557 | struct i40iw_handler *hdl; |
| 1560 | 1558 | ||
| 1559 | hdl = i40iw_find_netdev(ldev->netdev); | ||
| 1560 | if (hdl) | ||
| 1561 | return 0; | ||
| 1562 | |||
| 1561 | hdl = kzalloc(sizeof(*hdl), GFP_KERNEL); | 1563 | hdl = kzalloc(sizeof(*hdl), GFP_KERNEL); |
| 1562 | if (!hdl) | 1564 | if (!hdl) |
| 1563 | return -ENOMEM; | 1565 | return -ENOMEM; |
| @@ -673,8 +673,11 @@ enum i40iw_status_code i40iw_free_virt_mem(struct i40iw_hw *hw, · 672 unmodified lines | |||
| 673 | { | 673 | { |
| 674 | if (!mem) | 674 | if (!mem) |
| 675 | return I40IW_ERR_PARAM; | 675 | return I40IW_ERR_PARAM; |
| 676 | /* | ||
| 677 | * mem->va points to the parent of mem, so both mem and mem->va | ||
| 678 | * can not be touched once mem->va is freed | ||
| 679 | */ | ||
| 676 | kfree(mem->va); | 680 | kfree(mem->va); |
| 677 | mem->va = NULL; | ||
| 678 | return 0; | 681 | return 0; |
| 679 | } | 682 | } |
| 680 | 683 | ||
| @@ -794,7 +794,6 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd, · 793 unmodified lines | |||
| 794 | return &iwqp->ibqp; | 794 | return &iwqp->ibqp; |
| 795 | error: | 795 | error: |
| 796 | i40iw_free_qp_resources(iwdev, iwqp, qp_num); | 796 | i40iw_free_qp_resources(iwdev, iwqp, qp_num); |
| 797 | kfree(mem); | ||
| 798 | return ERR_PTR(err_code); | 797 | return ERR_PTR(err_code); |
| 799 | } | 798 | } |
| 800 | 799 | ||
| @@ -1926,8 +1925,7 @@ static int i40iw_dereg_mr(struct ib_mr *ib_mr) · 1125 unmodified lines | |||
| 1926 | } | 1925 | } |
| 1927 | if (iwpbl->pbl_allocated) | 1926 | if (iwpbl->pbl_allocated) |
| 1928 | i40iw_free_pble(iwdev->pble_rsrc, palloc); | 1927 | i40iw_free_pble(iwdev->pble_rsrc, palloc); |
| 1929 | kfree(iwpbl->iwmr); | 1928 | kfree(iwmr); |
| 1930 | iwpbl->iwmr = NULL; | ||
| 1931 | return 0; | 1929 | return 0; |
| 1932 | } | 1930 | } |
| 1933 | 1931 | ||
| @@ -576,8 +576,8 @@ static int mlx4_ib_ipoib_csum_ok(__be16 status, __be16 checksum) · 575 unmodified lines | |||
| 576 | checksum == cpu_to_be16(0xffff); | 576 | checksum == cpu_to_be16(0xffff); |
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc, | 579 | static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc, |
| 580 | unsigned tail, struct mlx4_cqe *cqe, int is_eth) | 580 | unsigned tail, struct mlx4_cqe *cqe, int is_eth) |
| 581 | { | 581 | { |
| 582 | struct mlx4_ib_proxy_sqp_hdr *hdr; | 582 | struct mlx4_ib_proxy_sqp_hdr *hdr; |
| 583 | 583 | ||
| @@ -600,8 +600,6 @@ static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct · 16 unmodified lines | |||
| 600 | wc->slid = be16_to_cpu(hdr->tun.slid_mac_47_32); | 600 | wc->slid = be16_to_cpu(hdr->tun.slid_mac_47_32); |
| 601 | wc->sl = (u8) (be16_to_cpu(hdr->tun.sl_vid) >> 12); | 601 | wc->sl = (u8) (be16_to_cpu(hdr->tun.sl_vid) >> 12); |
| 602 | } | 602 | } |
| 603 | |||
| 604 | return 0; | ||
| 605 | } | 603 | } |
| 606 | 604 | ||
| 607 | static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries, | 605 | static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries, |
| @@ -689,12 +687,6 @@ repoll: · 81 unmodified lines | |||
| 689 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == | 687 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == |
| 690 | MLX4_CQE_OPCODE_ERROR; | 688 | MLX4_CQE_OPCODE_ERROR; |
| 691 | 689 | ||
| 692 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_OPCODE_NOP && | ||
| 693 | is_send)) { | ||
| 694 | pr_warn("Completion for NOP opcode detected!\n"); | ||
| 695 | return -EINVAL; | ||
| 696 | } | ||
| 697 | |||
| 698 | /* Resize CQ in progress */ | 690 | /* Resize CQ in progress */ |
| 699 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_CQE_OPCODE_RESIZE)) { | 691 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_CQE_OPCODE_RESIZE)) { |
| 700 | if (cq->resize_buf) { | 692 | if (cq->resize_buf) { |
| @@ -720,12 +712,6 @@ repoll: · 19 unmodified lines | |||
| 720 | */ | 712 | */ |
| 721 | mqp = __mlx4_qp_lookup(to_mdev(cq->ibcq.device)->dev, | 713 | mqp = __mlx4_qp_lookup(to_mdev(cq->ibcq.device)->dev, |
| 722 | be32_to_cpu(cqe->vlan_my_qpn)); | 714 | be32_to_cpu(cqe->vlan_my_qpn)); |
| 723 | if (unlikely(!mqp)) { | ||
| 724 | pr_warn("CQ %06x with entry for unknown QPN %06x\n", | ||
| 725 | cq->mcq.cqn, be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_QPN_MASK); | ||
| 726 | return -EINVAL; | ||
| 727 | } | ||
| 728 | |||
| 729 | *cur_qp = to_mibqp(mqp); | 715 | *cur_qp = to_mibqp(mqp); |
| 730 | } | 716 | } |
| 731 | 717 | ||
| @@ -738,11 +724,6 @@ repoll: · 6 unmodified lines | |||
| 738 | /* SRQ is also in the radix tree */ | 724 | /* SRQ is also in the radix tree */ |
| 739 | msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev, | 725 | msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev, |
| 740 | srq_num); | 726 | srq_num); |
| 741 | if (unlikely(!msrq)) { | ||
| 742 | pr_warn("CQ %06x with entry for unknown SRQN %06x\n", | ||
| 743 | cq->mcq.cqn, srq_num); | ||
| 744 | return -EINVAL; | ||
| 745 | } | ||
| 746 | } | 727 | } |
| 747 | 728 | ||
| 748 | if (is_send) { | 729 | if (is_send) { |
| @@ -852,9 +833,11 @@ repoll: · 103 unmodified lines | |||
| 852 | if (mlx4_is_mfunc(to_mdev(cq->ibcq.device)->dev)) { | 833 | if (mlx4_is_mfunc(to_mdev(cq->ibcq.device)->dev)) { |
| 853 | if ((*cur_qp)->mlx4_ib_qp_type & | 834 | if ((*cur_qp)->mlx4_ib_qp_type & |
| 854 | (MLX4_IB_QPT_PROXY_SMI_OWNER | | 835 | (MLX4_IB_QPT_PROXY_SMI_OWNER | |
| 855 | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) | 836 | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) { |
| 856 | return use_tunnel_data(*cur_qp, cq, wc, tail, | 837 | use_tunnel_data(*cur_qp, cq, wc, tail, cqe, |
| 857 | cqe, is_eth); | 838 | is_eth); |
| 839 | return 0; | ||
| 840 | } | ||
| 858 | } | 841 | } |
| 859 | 842 | ||
| 860 | wc->slid = be16_to_cpu(cqe->rlid); | 843 | wc->slid = be16_to_cpu(cqe->rlid); |
| @@ -891,7 +874,6 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 30 unmodified lines | |||
| 891 | struct mlx4_ib_qp *cur_qp = NULL; | 874 | struct mlx4_ib_qp *cur_qp = NULL; |
| 892 | unsigned long flags; | 875 | unsigned long flags; |
| 893 | int npolled; | 876 | int npolled; |
| 894 | int err = 0; | ||
| 895 | struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); | 877 | struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); |
| 896 | 878 | ||
| 897 | spin_lock_irqsave(&cq->lock, flags); | 879 | spin_lock_irqsave(&cq->lock, flags); |
| @@ -901,8 +883,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 3 unmodified lines | |||
| 901 | } | 883 | } |
| 902 | 884 | ||
| 903 | for (npolled = 0; npolled < num_entries; ++npolled) { | 885 | for (npolled = 0; npolled < num_entries; ++npolled) { |
| 904 | err = mlx4_ib_poll_one(cq, &cur_qp, wc + npolled); | 886 | if (mlx4_ib_poll_one(cq, &cur_qp, wc + npolled)) |
| 905 | if (err) | ||
| 906 | break; | 887 | break; |
| 907 | } | 888 | } |
| 908 | 889 | ||
| @@ -911,10 +892,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 2 unmodified lines | |||
| 911 | out: | 892 | out: |
| 912 | spin_unlock_irqrestore(&cq->lock, flags); | 893 | spin_unlock_irqrestore(&cq->lock, flags); |
| 913 | 894 | ||
| 914 | if (err == 0 || err == -EAGAIN) | 895 | return npolled; |
| 915 | return npolled; | ||
| 916 | else | ||
| 917 | return err; | ||
| 918 | } | 896 | } |
| 919 | 897 | ||
| 920 | int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 898 | int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
| @@ -1128,6 +1128,27 @@ void handle_port_mgmt_change_event(struct work_struct *work) · 1127 unmodified lines | |||
| 1128 | 1128 | ||
| 1129 | /* Generate GUID changed event */ | 1129 | /* Generate GUID changed event */ |
| 1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { | 1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { |
| 1131 | if (mlx4_is_master(dev->dev)) { | ||
| 1132 | union ib_gid gid; | ||
| 1133 | int err = 0; | ||
| 1134 | |||
| 1135 | if (!eqe->event.port_mgmt_change.params.port_info.gid_prefix) | ||
| 1136 | err = __mlx4_ib_query_gid(&dev->ib_dev, port, 0, &gid, 1); | ||
| 1137 | else | ||
| 1138 | gid.global.subnet_prefix = | ||
| 1139 | eqe->event.port_mgmt_change.params.port_info.gid_prefix; | ||
| 1140 | if (err) { | ||
| 1141 | pr_warn("Could not change QP1 subnet prefix for port %d: query_gid error (%d)\n", | ||
| 1142 | port, err); | ||
| 1143 | } else { | ||
| 1144 | pr_debug("Changing QP1 subnet prefix for port %d. old=0x%llx. new=0x%llx\n", | ||
| 1145 | port, | ||
| 1146 | (u64)atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix), | ||
| 1147 | be64_to_cpu(gid.global.subnet_prefix)); | ||
| 1148 | atomic64_set(&dev->sriov.demux[port - 1].subnet_prefix, | ||
| 1149 | be64_to_cpu(gid.global.subnet_prefix)); | ||
| 1150 | } | ||
| 1151 | } | ||
| 1131 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); | 1152 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); |
| 1132 | /*if master, notify all slaves*/ | 1153 | /*if master, notify all slaves*/ |
| 1133 | if (mlx4_is_master(dev->dev)) | 1154 | if (mlx4_is_master(dev->dev)) |
| @@ -2202,6 +2223,8 @@ int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev) · 1068 unmodified lines | |||
| 2202 | if (err) | 2223 | if (err) |
| 2203 | goto demux_err; | 2224 | goto demux_err; |
| 2204 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; | 2225 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; |
| 2226 | atomic64_set(&dev->sriov.demux[i].subnet_prefix, | ||
| 2227 | be64_to_cpu(gid.global.subnet_prefix)); | ||
| 2205 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, | 2228 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, |
| 2206 | &dev->sriov.sqps[i]); | 2229 | &dev->sriov.sqps[i]); |
| 2207 | if (err) | 2230 | if (err) |
| @@ -2202,6 +2202,9 @@ static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev) · 2201 unmodified lines | |||
| 2202 | bool per_port = !!(ibdev->dev->caps.flags2 & | 2202 | bool per_port = !!(ibdev->dev->caps.flags2 & |
| 2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); | 2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); |
| 2204 | 2204 | ||
| 2205 | if (mlx4_is_slave(ibdev->dev)) | ||
| 2206 | return 0; | ||
| 2207 | |||
| 2205 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { | 2208 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { |
| 2206 | /* i == 1 means we are building port counters */ | 2209 | /* i == 1 means we are building port counters */ |
| 2207 | if (i && !per_port) | 2210 | if (i && !per_port) |
| @@ -489,7 +489,7 @@ static u8 get_leave_state(struct mcast_group *group) · 488 unmodified lines | |||
| 489 | if (!group->members[i]) | 489 | if (!group->members[i]) |
| 490 | leave_state |= (1 << i); | 490 | leave_state |= (1 << i); |
| 491 | 491 | ||
| 492 | return leave_state & (group->rec.scope_join_state & 7); | 492 | return leave_state & (group->rec.scope_join_state & 0xf); |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) | 495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) |
| @@ -564,8 +564,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work) · 68 unmodified lines | |||
| 564 | } else | 564 | } else |
| 565 | mcg_warn_group(group, "DRIVER BUG\n"); | 565 | mcg_warn_group(group, "DRIVER BUG\n"); |
| 566 | } else if (group->state == MCAST_LEAVE_SENT) { | 566 | } else if (group->state == MCAST_LEAVE_SENT) { |
| 567 | if (group->rec.scope_join_state & 7) | 567 | if (group->rec.scope_join_state & 0xf) |
| 568 | group->rec.scope_join_state &= 0xf8; | 568 | group->rec.scope_join_state &= 0xf0; |
| 569 | group->state = MCAST_IDLE; | 569 | group->state = MCAST_IDLE; |
| 570 | mutex_unlock(&group->lock); | 570 | mutex_unlock(&group->lock); |
| 571 | if (release_group(group, 1)) | 571 | if (release_group(group, 1)) |
| @@ -605,7 +605,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask, · 33 unmodified lines | |||
| 605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, | 605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, |
| 606 | struct mcast_req *req) | 606 | struct mcast_req *req) |
| 607 | { | 607 | { |
| 608 | u8 group_join_state = group->rec.scope_join_state & 7; | 608 | u8 group_join_state = group->rec.scope_join_state & 0xf; |
| 609 | int ref = 0; | 609 | int ref = 0; |
| 610 | u16 status; | 610 | u16 status; |
| 611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
| @@ -690,8 +690,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work) · 78 unmodified lines | |||
| 690 | u8 cur_join_state; | 690 | u8 cur_join_state; |
| 691 | 691 | ||
| 692 | resp_join_state = ((struct ib_sa_mcmember_data *) | 692 | resp_join_state = ((struct ib_sa_mcmember_data *) |
| 693 | group->response_sa_mad.data)->scope_join_state & 7; | 693 | group->response_sa_mad.data)->scope_join_state & 0xf; |
| 694 | cur_join_state = group->rec.scope_join_state & 7; | 694 | cur_join_state = group->rec.scope_join_state & 0xf; |
| 695 | 695 | ||
| 696 | if (method == IB_MGMT_METHOD_GET_RESP) { | 696 | if (method == IB_MGMT_METHOD_GET_RESP) { |
| 697 | /* successfull join */ | 697 | /* successfull join */ |
| @@ -710,7 +710,7 @@ process_requests: · 12 unmodified lines | |||
| 710 | req = list_first_entry(&group->pending_list, struct mcast_req, | 710 | req = list_first_entry(&group->pending_list, struct mcast_req, |
| 711 | group_list); | 711 | group_list); |
| 712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
| 713 | req_join_state = sa_data->scope_join_state & 0x7; | 713 | req_join_state = sa_data->scope_join_state & 0xf; |
| 714 | 714 | ||
| 715 | /* For a leave request, we will immediately answer the VF, and | 715 | /* For a leave request, we will immediately answer the VF, and |
| 716 | * update our internal counters. The actual leave will be sent | 716 | * update our internal counters. The actual leave will be sent |
| @@ -448,7 +448,7 @@ struct mlx4_ib_demux_ctx { · 447 unmodified lines | |||
| 448 | struct workqueue_struct *wq; | 448 | struct workqueue_struct *wq; |
| 449 | struct workqueue_struct *ud_wq; | 449 | struct workqueue_struct *ud_wq; |
| 450 | spinlock_t ud_lock; | 450 | spinlock_t ud_lock; |
| 451 | __be64 subnet_prefix; | 451 | atomic64_t subnet_prefix; |
| 452 | __be64 guid_cache[128]; | 452 | __be64 guid_cache[128]; |
| 453 | struct mlx4_ib_dev *dev; | 453 | struct mlx4_ib_dev *dev; |
| 454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ | 454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ |
| @@ -2493,24 +2493,27 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, · 2492 unmodified lines | |||
| 2493 | sqp->ud_header.grh.flow_label = | 2493 | sqp->ud_header.grh.flow_label = |
| 2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
| 2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; | 2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; |
| 2496 | if (is_eth) | 2496 | if (is_eth) { |
| 2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); | 2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); |
| 2498 | else { | 2498 | } else { |
| 2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { | 2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { |
| 2500 | /* When multi-function is enabled, the ib_core gid | 2500 | /* When multi-function is enabled, the ib_core gid |
| 2501 | * indexes don't necessarily match the hw ones, so | 2501 | * indexes don't necessarily match the hw ones, so |
| 2502 | * we must use our own cache */ | 2502 | * we must use our own cache |
| 2503 | sqp->ud_header.grh.source_gid.global.subnet_prefix = | 2503 | */ |
| 2504 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2504 | sqp->ud_header.grh.source_gid.global.subnet_prefix = |
| 2505 | subnet_prefix; | 2505 | cpu_to_be64(atomic64_read(&(to_mdev(ib_dev)->sriov. |
| 2506 | sqp->ud_header.grh.source_gid.global.interface_id = | 2506 | demux[sqp->qp.port - 1]. |
| 2507 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2507 | subnet_prefix))); |
| 2508 | guid_cache[ah->av.ib.gid_index]; | 2508 | sqp->ud_header.grh.source_gid.global.interface_id = |
| 2509 | } else | 2509 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. |
| 2510 | ib_get_cached_gid(ib_dev, | 2510 | guid_cache[ah->av.ib.gid_index]; |
| 2511 | be32_to_cpu(ah->av.ib.port_pd) >> 24, | 2511 | } else { |
| 2512 | ah->av.ib.gid_index, | 2512 | ib_get_cached_gid(ib_dev, |
| 2513 | &sqp->ud_header.grh.source_gid, NULL); | 2513 | be32_to_cpu(ah->av.ib.port_pd) >> 24, |
| 2514 | ah->av.ib.gid_index, | ||
| 2515 | &sqp->ud_header.grh.source_gid, NULL); | ||
| 2516 | } | ||
| 2514 | } | 2517 | } |
| 2515 | memcpy(sqp->ud_header.grh.destination_gid.raw, | 2518 | memcpy(sqp->ud_header.grh.destination_gid.raw, |
| 2516 | ah->av.ib.dgid, 16); | 2519 | ah->av.ib.dgid, 16); |
| @@ -553,12 +553,6 @@ repoll: · 552 unmodified lines | |||
| 553 | * from the table. | 553 | * from the table. |
| 554 | */ | 554 | */ |
| 555 | mqp = __mlx5_qp_lookup(dev->mdev, qpn); | 555 | mqp = __mlx5_qp_lookup(dev->mdev, qpn); |
| 556 | if (unlikely(!mqp)) { | ||
| 557 | mlx5_ib_warn(dev, "CQE@CQ %06x for unknown QPN %6x\n", | ||
| 558 | cq->mcq.cqn, qpn); | ||
| 559 | return -EINVAL; | ||
| 560 | } | ||
| 561 | |||
| 562 | *cur_qp = to_mibqp(mqp); | 556 | *cur_qp = to_mibqp(mqp); |
| 563 | } | 557 | } |
| 564 | 558 | ||
| @@ -619,13 +613,6 @@ repoll: · 54 unmodified lines | |||
| 619 | read_lock(&dev->mdev->priv.mkey_table.lock); | 613 | read_lock(&dev->mdev->priv.mkey_table.lock); |
| 620 | mmkey = __mlx5_mr_lookup(dev->mdev, | 614 | mmkey = __mlx5_mr_lookup(dev->mdev, |
| 621 | mlx5_base_mkey(be32_to_cpu(sig_err_cqe->mkey))); | 615 | mlx5_base_mkey(be32_to_cpu(sig_err_cqe->mkey))); |
| 622 | if (unlikely(!mmkey)) { | ||
| 623 | read_unlock(&dev->mdev->priv.mkey_table.lock); | ||
| 624 | mlx5_ib_warn(dev, "CQE@CQ %06x for unknown MR %6x\n", | ||
| 625 | cq->mcq.cqn, be32_to_cpu(sig_err_cqe->mkey)); | ||
| 626 | return -EINVAL; | ||
| 627 | } | ||
| 628 | |||
| 629 | mr = to_mibmr(mmkey); | 616 | mr = to_mibmr(mmkey); |
| 630 | get_sig_err_item(sig_err_cqe, &mr->sig->err_item); | 617 | get_sig_err_item(sig_err_cqe, &mr->sig->err_item); |
| 631 | mr->sig->sig_err_exists = true; | 618 | mr->sig->sig_err_exists = true; |
| @@ -676,7 +663,6 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 44 unmodified lines | |||
| 676 | unsigned long flags; | 663 | unsigned long flags; |
| 677 | int soft_polled = 0; | 664 | int soft_polled = 0; |
| 678 | int npolled; | 665 | int npolled; |
| 679 | int err = 0; | ||
| 680 | 666 | ||
| 681 | spin_lock_irqsave(&cq->lock, flags); | 667 | spin_lock_irqsave(&cq->lock, flags); |
| 682 | if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | 668 | if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
| @@ -688,8 +674,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 5 unmodified lines | |||
| 688 | soft_polled = poll_soft_wc(cq, num_entries, wc); | 674 | soft_polled = poll_soft_wc(cq, num_entries, wc); |
| 689 | 675 | ||
| 690 | for (npolled = 0; npolled < num_entries - soft_polled; npolled++) { | 676 | for (npolled = 0; npolled < num_entries - soft_polled; npolled++) { |
| 691 | err = mlx5_poll_one(cq, &cur_qp, wc + soft_polled + npolled); | 677 | if (mlx5_poll_one(cq, &cur_qp, wc + soft_polled + npolled)) |
| 692 | if (err) | ||
| 693 | break; | 678 | break; |
| 694 | } | 679 | } |
| 695 | 680 | ||
| @@ -698,10 +683,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 2 unmodified lines | |||
| 698 | out: | 683 | out: |
| 699 | spin_unlock_irqrestore(&cq->lock, flags); | 684 | spin_unlock_irqrestore(&cq->lock, flags); |
| 700 | 685 | ||
| 701 | if (err == 0 || err == -EAGAIN) | 686 | return soft_polled + npolled; |
| 702 | return soft_polled + npolled; | ||
| 703 | else | ||
| 704 | return err; | ||
| 705 | } | 687 | } |
| 706 | 688 | ||
| 707 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 689 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
| @@ -37,7 +37,6 @@ · 36 unmodified lines | |||
| 37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
| 38 | #include <linux/dma-mapping.h> | 38 | #include <linux/dma-mapping.h> |
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <linux/io-mapping.h> | ||
| 41 | #if defined(CONFIG_X86) | 40 | #if defined(CONFIG_X86) |
| 42 | #include <asm/pat.h> | 41 | #include <asm/pat.h> |
| 43 | #endif | 42 | #endif |
| @@ -289,7 +288,9 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, · 245 unmodified lines | |||
| 289 | 288 | ||
| 290 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) | 289 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) |
| 291 | { | 290 | { |
| 292 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | 291 | if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) |
| 292 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | ||
| 293 | return 0; | ||
| 293 | } | 294 | } |
| 294 | 295 | ||
| 295 | enum { | 296 | enum { |
| @@ -1429,6 +1430,13 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v, · 1133 unmodified lines | |||
| 1429 | dmac_47_16), | 1430 | dmac_47_16), |
| 1430 | ib_spec->eth.val.dst_mac); | 1431 | ib_spec->eth.val.dst_mac); |
| 1431 | 1432 | ||
| 1433 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_c, | ||
| 1434 | smac_47_16), | ||
| 1435 | ib_spec->eth.mask.src_mac); | ||
| 1436 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v, | ||
| 1437 | smac_47_16), | ||
| 1438 | ib_spec->eth.val.src_mac); | ||
| 1439 | |||
| 1432 | if (ib_spec->eth.mask.vlan_tag) { | 1440 | if (ib_spec->eth.mask.vlan_tag) { |
| 1433 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, | 1441 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, |
| 1434 | vlan_tag, 1); | 1442 | vlan_tag, 1); |
| @@ -1850,6 +1858,7 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, · 415 unmodified lines | |||
| 1850 | int domain) | 1858 | int domain) |
| 1851 | { | 1859 | { |
| 1852 | struct mlx5_ib_dev *dev = to_mdev(qp->device); | 1860 | struct mlx5_ib_dev *dev = to_mdev(qp->device); |
| 1861 | struct mlx5_ib_qp *mqp = to_mqp(qp); | ||
| 1853 | struct mlx5_ib_flow_handler *handler = NULL; | 1862 | struct mlx5_ib_flow_handler *handler = NULL; |
| 1854 | struct mlx5_flow_destination *dst = NULL; | 1863 | struct mlx5_flow_destination *dst = NULL; |
| 1855 | struct mlx5_ib_flow_prio *ft_prio; | 1864 | struct mlx5_ib_flow_prio *ft_prio; |
| @@ -1876,7 +1885,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, · 20 unmodified lines | |||
| 1876 | } | 1885 | } |
| 1877 | 1886 | ||
| 1878 | dst->type = MLX5_FLOW_DESTINATION_TYPE_TIR; | 1887 | dst->type = MLX5_FLOW_DESTINATION_TYPE_TIR; |
| 1879 | dst->tir_num = to_mqp(qp)->raw_packet_qp.rq.tirn; | 1888 | if (mqp->flags & MLX5_IB_QP_RSS) |
| 1889 | dst->tir_num = mqp->rss_qp.tirn; | ||
| 1890 | else | ||
| 1891 | dst->tir_num = mqp->raw_packet_qp.rq.tirn; | ||
| 1880 | 1892 | ||
| 1881 | if (flow_attr->type == IB_FLOW_ATTR_NORMAL) { | 1893 | if (flow_attr->type == IB_FLOW_ATTR_NORMAL) { |
| 1882 | if (flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) { | 1894 | if (flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) { |
| @@ -71,7 +71,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | addr = addr >> page_shift; | 72 | addr = addr >> page_shift; |
| 73 | tmp = (unsigned long)addr; | 73 | tmp = (unsigned long)addr; |
| 74 | m = find_first_bit(&tmp, sizeof(tmp)); | 74 | m = find_first_bit(&tmp, BITS_PER_LONG); |
| 75 | skip = 1 << m; | 75 | skip = 1 << m; |
| 76 | mask = skip - 1; | 76 | mask = skip - 1; |
| 77 | i = 0; | 77 | i = 0; |
| @@ -81,7 +81,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, · 3 unmodified lines | |||
| 81 | for (k = 0; k < len; k++) { | 81 | for (k = 0; k < len; k++) { |
| 82 | if (!(i & mask)) { | 82 | if (!(i & mask)) { |
| 83 | tmp = (unsigned long)pfn; | 83 | tmp = (unsigned long)pfn; |
| 84 | m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp))); | 84 | m = min_t(unsigned long, m, find_first_bit(&tmp, BITS_PER_LONG)); |
| 85 | skip = 1 << m; | 85 | skip = 1 << m; |
| 86 | mask = skip - 1; | 86 | mask = skip - 1; |
| 87 | base = pfn; | 87 | base = pfn; |
| @@ -89,7 +89,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, · 1 unmodified line | |||
| 89 | } else { | 89 | } else { |
| 90 | if (base + p != pfn) { | 90 | if (base + p != pfn) { |
| 91 | tmp = (unsigned long)p; | 91 | tmp = (unsigned long)p; |
| 92 | m = find_first_bit(&tmp, sizeof(tmp)); | 92 | m = find_first_bit(&tmp, BITS_PER_LONG); |
| 93 | skip = 1 << m; | 93 | skip = 1 << m; |
| 94 | mask = skip - 1; | 94 | mask = skip - 1; |
| 95 | base = pfn; | 95 | base = pfn; |
| @@ -402,6 +402,7 @@ enum mlx5_ib_qp_flags { · 401 unmodified lines | |||
| 402 | /* QP uses 1 as its source QP number */ | 402 | /* QP uses 1 as its source QP number */ |
| 403 | MLX5_IB_QP_SQPN_QP1 = 1 << 6, | 403 | MLX5_IB_QP_SQPN_QP1 = 1 << 6, |
| 404 | MLX5_IB_QP_CAP_SCATTER_FCS = 1 << 7, | 404 | MLX5_IB_QP_CAP_SCATTER_FCS = 1 << 7, |
| 405 | MLX5_IB_QP_RSS = 1 << 8, | ||
| 405 | }; | 406 | }; |
| 406 | 407 | ||
| 407 | struct mlx5_umr_wr { | 408 | struct mlx5_umr_wr { |
| @@ -1449,6 +1449,7 @@ create_tir: · 1448 unmodified lines | |||
| 1449 | kvfree(in); | 1449 | kvfree(in); |
| 1450 | /* qpn is reserved for that QP */ | 1450 | /* qpn is reserved for that QP */ |
| 1451 | qp->trans_qp.base.mqp.qpn = 0; | 1451 | qp->trans_qp.base.mqp.qpn = 0; |
| 1452 | qp->flags |= MLX5_IB_QP_RSS; | ||
| 1452 | return 0; | 1453 | return 0; |
| 1453 | 1454 | ||
| 1454 | err: | 1455 | err: |
| @@ -3658,12 +3659,8 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, · 2203 unmodified lines | |||
| 3658 | struct ib_send_wr *wr, unsigned *idx, | 3659 | struct ib_send_wr *wr, unsigned *idx, |
| 3659 | int *size, int nreq) | 3660 | int *size, int nreq) |
| 3660 | { | 3661 | { |
| 3661 | int err = 0; | 3662 | if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) |
| 3662 | 3663 | return -ENOMEM; | |
| 3663 | if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) { | ||
| 3664 | err = -ENOMEM; | ||
| 3665 | return err; | ||
| 3666 | } | ||
| 3667 | 3664 | ||
| 3668 | *idx = qp->sq.cur_post & (qp->sq.wqe_cnt - 1); | 3665 | *idx = qp->sq.cur_post & (qp->sq.wqe_cnt - 1); |
| 3669 | *seg = mlx5_get_send_wqe(qp, *idx); | 3666 | *seg = mlx5_get_send_wqe(qp, *idx); |
| @@ -3679,7 +3676,7 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, · 9 unmodified lines | |||
| 3679 | *seg += sizeof(**ctrl); | 3676 | *seg += sizeof(**ctrl); |
| 3680 | *size = sizeof(**ctrl) / 16; | 3677 | *size = sizeof(**ctrl) / 16; |
| 3681 | 3678 | ||
| 3682 | return err; | 3679 | return 0; |
| 3683 | } | 3680 | } |
| 3684 | 3681 | ||
| 3685 | static void finish_wqe(struct mlx5_ib_qp *qp, | 3682 | static void finish_wqe(struct mlx5_ib_qp *qp, |
| @@ -3758,7 +3755,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 72 unmodified lines | |||
| 3758 | num_sge = wr->num_sge; | 3755 | num_sge = wr->num_sge; |
| 3759 | if (unlikely(num_sge > qp->sq.max_gs)) { | 3756 | if (unlikely(num_sge > qp->sq.max_gs)) { |
| 3760 | mlx5_ib_warn(dev, "\n"); | 3757 | mlx5_ib_warn(dev, "\n"); |
| 3761 | err = -ENOMEM; | 3758 | err = -EINVAL; |
| 3762 | *bad_wr = wr; | 3759 | *bad_wr = wr; |
| 3763 | goto out; | 3760 | goto out; |
| 3764 | } | 3761 | } |
| @@ -1156,18 +1156,18 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev, · 1155 unmodified lines | |||
| 1156 | attr->max_srq = | 1156 | attr->max_srq = |
| 1157 | (rsp->max_srq_rpir_qps & OCRDMA_MBX_QUERY_CFG_MAX_SRQ_MASK) >> | 1157 | (rsp->max_srq_rpir_qps & OCRDMA_MBX_QUERY_CFG_MAX_SRQ_MASK) >> |
| 1158 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_OFFSET; | 1158 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_OFFSET; |
| 1159 | attr->max_send_sge = ((rsp->max_write_send_sge & | 1159 | attr->max_send_sge = ((rsp->max_recv_send_sge & |
| 1160 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> | 1160 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> |
| 1161 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT); | 1161 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT); |
| 1162 | attr->max_recv_sge = (rsp->max_write_send_sge & | 1162 | attr->max_recv_sge = (rsp->max_recv_send_sge & |
| 1163 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> | 1163 | OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_MASK) >> |
| 1164 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT; | 1164 | OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_SHIFT; |
| 1165 | attr->max_srq_sge = (rsp->max_srq_rqe_sge & | 1165 | attr->max_srq_sge = (rsp->max_srq_rqe_sge & |
| 1166 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK) >> | 1166 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK) >> |
| 1167 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET; | 1167 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET; |
| 1168 | attr->max_rdma_sge = (rsp->max_write_send_sge & | 1168 | attr->max_rdma_sge = (rsp->max_wr_rd_sge & |
| 1169 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_MASK) >> | 1169 | OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_MASK) >> |
| 1170 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT; | 1170 | OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_SHIFT; |
| 1171 | attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp & | 1171 | attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp & |
| 1172 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >> | 1172 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >> |
| 1173 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT; | 1173 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT; |
| @@ -554,9 +554,9 @@ enum { · 553 unmodified lines | |||
| 554 | OCRDMA_MBX_QUERY_CFG_L3_TYPE_MASK = 0x18, | 554 | OCRDMA_MBX_QUERY_CFG_L3_TYPE_MASK = 0x18, |
| 555 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0, | 555 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0, |
| 556 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF, | 556 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF, |
| 557 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT = 16, | 557 | OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_SHIFT = 16, |
| 558 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_MASK = 0xFFFF << | 558 | OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_MASK = 0xFFFF << |
| 559 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT, | 559 | OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_SHIFT, |
| 560 | 560 | ||
| 561 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0, | 561 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0, |
| 562 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF, | 562 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF, |
| @@ -612,6 +612,8 @@ enum { · 49 unmodified lines | |||
| 612 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET = 0, | 612 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET = 0, |
| 613 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK = 0xFFFF << | 613 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK = 0xFFFF << |
| 614 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET, | 614 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET, |
| 615 | OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_SHIFT = 0, | ||
| 616 | OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_MASK = 0xFFFF, | ||
| 615 | }; | 617 | }; |
| 616 | 618 | ||
| 617 | struct ocrdma_mbx_query_config { | 619 | struct ocrdma_mbx_query_config { |
| @@ -619,7 +621,7 @@ struct ocrdma_mbx_query_config { · 1 unmodified line | |||
| 619 | struct ocrdma_mbx_rsp rsp; | 621 | struct ocrdma_mbx_rsp rsp; |
| 620 | u32 qp_srq_cq_ird_ord; | 622 | u32 qp_srq_cq_ird_ord; |
| 621 | u32 max_pd_ca_ack_delay; | 623 | u32 max_pd_ca_ack_delay; |
| 622 | u32 max_write_send_sge; | 624 | u32 max_recv_send_sge; |
| 623 | u32 max_ird_ord_per_qp; | 625 | u32 max_ird_ord_per_qp; |
| 624 | u32 max_shared_ird_ord; | 626 | u32 max_shared_ird_ord; |
| 625 | u32 max_mr; | 627 | u32 max_mr; |
| @@ -639,6 +641,8 @@ struct ocrdma_mbx_query_config { · 13 unmodified lines | |||
| 639 | u32 max_wqes_rqes_per_q; | 641 | u32 max_wqes_rqes_per_q; |
| 640 | u32 max_cq_cqes_per_cq; | 642 | u32 max_cq_cqes_per_cq; |
| 641 | u32 max_srq_rqe_sge; | 643 | u32 max_srq_rqe_sge; |
| 644 | u32 max_wr_rd_sge; | ||
| 645 | u32 ird_pgsz_num_pages; | ||
| 642 | }; | 646 | }; |
| 643 | 647 | ||
| 644 | struct ocrdma_fw_ver_rsp { | 648 | struct ocrdma_fw_ver_rsp { |
| @@ -125,8 +125,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr, · 124 unmodified lines | |||
| 125 | IB_DEVICE_SYS_IMAGE_GUID | | 125 | IB_DEVICE_SYS_IMAGE_GUID | |
| 126 | IB_DEVICE_LOCAL_DMA_LKEY | | 126 | IB_DEVICE_LOCAL_DMA_LKEY | |
| 127 | IB_DEVICE_MEM_MGT_EXTENSIONS; | 127 | IB_DEVICE_MEM_MGT_EXTENSIONS; |
| 128 | attr->max_sge = dev->attr.max_send_sge; | 128 | attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_recv_sge); |
| 129 | attr->max_sge_rd = attr->max_sge; | 129 | attr->max_sge_rd = dev->attr.max_rdma_sge; |
| 130 | attr->max_cq = dev->attr.max_cq; | 130 | attr->max_cq = dev->attr.max_cq; |
| 131 | attr->max_cqe = dev->attr.max_cqe; | 131 | attr->max_cqe = dev->attr.max_cqe; |
| 132 | attr->max_mr = dev->attr.max_mr; | 132 | attr->max_mr = dev->attr.max_mr; |
| @@ -189,27 +189,32 @@ static int _ctx_stats_seq_show(struct seq_file *s, void *v) · 188 unmodified lines | |||
| 189 | DEBUGFS_FILE(ctx_stats) | 189 | DEBUGFS_FILE(ctx_stats) |
| 190 | 190 | ||
| 191 | static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) | 191 | static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) |
| 192 | __acquires(RCU) | ||
| 192 | { | 193 | { |
| 193 | struct qib_qp_iter *iter; | 194 | struct qib_qp_iter *iter; |
| 194 | loff_t n = *pos; | 195 | loff_t n = *pos; |
| 195 | 196 | ||
| 196 | rcu_read_lock(); | ||
| 197 | iter = qib_qp_iter_init(s->private); | 197 | iter = qib_qp_iter_init(s->private); |
| 198 | |||
| 199 | /* stop calls rcu_read_unlock */ | ||
| 200 | rcu_read_lock(); | ||
| 201 | |||
| 198 | if (!iter) | 202 | if (!iter) |
| 199 | return NULL; | 203 | return NULL; |
| 200 | 204 | ||
| 201 | while (n--) { | 205 | do { |
| 202 | if (qib_qp_iter_next(iter)) { | 206 | if (qib_qp_iter_next(iter)) { |
| 203 | kfree(iter); | 207 | kfree(iter); |
| 204 | return NULL; | 208 | return NULL; |
| 205 | } | 209 | } |
| 206 | } | 210 | } while (n--); |
| 207 | 211 | ||
| 208 | return iter; | 212 | return iter; |
| 209 | } | 213 | } |
| 210 | 214 | ||
| 211 | static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, | 215 | static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, |
| 212 | loff_t *pos) | 216 | loff_t *pos) |
| 217 | __must_hold(RCU) | ||
| 213 | { | 218 | { |
| 214 | struct qib_qp_iter *iter = iter_ptr; | 219 | struct qib_qp_iter *iter = iter_ptr; |
| 215 | 220 | ||
| @@ -224,6 +229,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, · 8 unmodified lines | |||
| 224 | } | 229 | } |
| 225 | 230 | ||
| 226 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) | 231 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
| 232 | __releases(RCU) | ||
| 227 | { | 233 | { |
| 228 | rcu_read_unlock(); | 234 | rcu_read_unlock(); |
| 229 | } | 235 | } |
| @@ -328,26 +328,12 @@ static ssize_t flash_write(struct file *file, const char __user *buf, · 327 unmodified lines | |||
| 328 | 328 | ||
| 329 | pos = *ppos; | 329 | pos = *ppos; |
| 330 | 330 | ||
| 331 | if (pos != 0) { | 331 | if (pos != 0 || count != sizeof(struct qib_flash)) |
| 332 | ret = -EINVAL; | 332 | return -EINVAL; |
| 333 | goto bail; | ||
| 334 | } | ||
| 335 | |||
| 336 | if (count != sizeof(struct qib_flash)) { | ||
| 337 | ret = -EINVAL; | ||
| 338 | goto bail; | ||
| 339 | } | ||
| 340 | |||
| 341 | tmp = kmalloc(count, GFP_KERNEL); | ||
| 342 | if (!tmp) { | ||
| 343 | ret = -ENOMEM; | ||
| 344 | goto bail; | ||
| 345 | } | ||
| 346 | 333 | ||
| 347 | if (copy_from_user(tmp, buf, count)) { | 334 | tmp = memdup_user(buf, count); |
| 348 | ret = -EFAULT; | 335 | if (IS_ERR(tmp)) |
| 349 | goto bail_tmp; | 336 | return PTR_ERR(tmp); |
| 350 | } | ||
| 351 | 337 | ||
| 352 | dd = private2dd(file); | 338 | dd = private2dd(file); |
| 353 | if (qib_eeprom_write(dd, pos, tmp, count)) { | 339 | if (qib_eeprom_write(dd, pos, tmp, count)) { |
| @@ -361,8 +347,6 @@ static ssize_t flash_write(struct file *file, const char __user *buf, · 7 unmodified lines | |||
| 361 | 347 | ||
| 362 | bail_tmp: | 348 | bail_tmp: |
| 363 | kfree(tmp); | 349 | kfree(tmp); |
| 364 | |||
| 365 | bail: | ||
| 366 | return ret; | 350 | return ret; |
| 367 | } | 351 | } |
| 368 | 352 | ||
| @@ -573,10 +573,6 @@ struct qib_qp_iter *qib_qp_iter_init(struct qib_ibdev *dev) · 572 unmodified lines | |||
| 573 | return NULL; | 573 | return NULL; |
| 574 | 574 | ||
| 575 | iter->dev = dev; | 575 | iter->dev = dev; |
| 576 | if (qib_qp_iter_next(iter)) { | ||
| 577 | kfree(iter); | ||
| 578 | return NULL; | ||
| 579 | } | ||
| 580 | 576 | ||
| 581 | return iter; | 577 | return iter; |
| 582 | } | 578 | } |
| @@ -664,7 +664,8 @@ static int __init usnic_ib_init(void) · 663 unmodified lines | |||
| 664 | return err; | 664 | return err; |
| 665 | } | 665 | } |
| 666 | 666 | ||
| 667 | if (pci_register_driver(&usnic_ib_pci_driver)) { | 667 | err = pci_register_driver(&usnic_ib_pci_driver); |
| 668 | if (err) { | ||
| 668 | usnic_err("Unable to register with PCI\n"); | 669 | usnic_err("Unable to register with PCI\n"); |
| 669 | goto out_umem_fini; | 670 | goto out_umem_fini; |
| 670 | } | 671 | } |
| @@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr) · 293 unmodified lines | |||
| 294 | { | 294 | { |
| 295 | rvt_deinit_mregion(&mr->mr); | 295 | rvt_deinit_mregion(&mr->mr); |
| 296 | rvt_free_lkey(&mr->mr); | 296 | rvt_free_lkey(&mr->mr); |
| 297 | vfree(mr); | 297 | kfree(mr); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | /** | 300 | /** |
| @@ -873,7 +873,8 @@ bail_qpn: · 872 unmodified lines | |||
| 873 | free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); | 873 | free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); |
| 874 | 874 | ||
| 875 | bail_rq_wq: | 875 | bail_rq_wq: |
| 876 | vfree(qp->r_rq.wq); | 876 | if (!qp->ip) |
| 877 | vfree(qp->r_rq.wq); | ||
| 877 | 878 | ||
| 878 | bail_driver_priv: | 879 | bail_driver_priv: |
| 879 | rdi->driver_f.qp_priv_free(rdi, qp); | 880 | rdi->driver_f.qp_priv_free(rdi, qp); |
| @@ -362,15 +362,34 @@ static int __init rxe_module_init(void) · 361 unmodified lines | |||
| 362 | return err; | 362 | return err; |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | err = rxe_net_init(); | 365 | err = rxe_net_ipv4_init(); |
| 366 | if (err) { | 366 | if (err) { |
| 367 | pr_err("rxe: unable to init\n"); | 367 | pr_err("rxe: unable to init ipv4 tunnel\n"); |
| 368 | rxe_cache_exit(); | 368 | rxe_cache_exit(); |
| 369 | return err; | 369 | goto exit; |
| 370 | } | ||
| 371 | |||
| 372 | err = rxe_net_ipv6_init(); | ||
| 373 | if (err) { | ||
| 374 | pr_err("rxe: unable to init ipv6 tunnel\n"); | ||
| 375 | rxe_cache_exit(); | ||
| 376 | goto exit; | ||
| 370 | } | 377 | } |
| 378 | |||
| 379 | err = register_netdevice_notifier(&rxe_net_notifier); | ||
| 380 | if (err) { | ||
| 381 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
| 382 | goto exit; | ||
| 383 | } | ||
| 384 | |||
| 371 | pr_info("rxe: loaded\n"); | 385 | pr_info("rxe: loaded\n"); |
| 372 | 386 | ||
| 373 | return 0; | 387 | return 0; |
| 388 | |||
| 389 | exit: | ||
| 390 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
| 391 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
| 392 | return err; | ||
| 374 | } | 393 | } |
| 375 | 394 | ||
| 376 | static void __exit rxe_module_exit(void) | 395 | static void __exit rxe_module_exit(void) |
| @@ -689,7 +689,14 @@ int rxe_completer(void *arg) · 688 unmodified lines | |||
| 689 | qp->req.need_retry = 1; | 689 | qp->req.need_retry = 1; |
| 690 | rxe_run_task(&qp->req.task, 1); | 690 | rxe_run_task(&qp->req.task, 1); |
| 691 | } | 691 | } |
| 692 | |||
| 693 | if (pkt) { | ||
| 694 | rxe_drop_ref(pkt->qp); | ||
| 695 | kfree_skb(skb); | ||
| 696 | } | ||
| 697 | |||
| 692 | goto exit; | 698 | goto exit; |
| 699 | |||
| 693 | } else { | 700 | } else { |
| 694 | wqe->status = IB_WC_RETRY_EXC_ERR; | 701 | wqe->status = IB_WC_RETRY_EXC_ERR; |
| 695 | state = COMPST_ERROR; | 702 | state = COMPST_ERROR; |
| @@ -716,6 +723,12 @@ int rxe_completer(void *arg) · 20 unmodified lines | |||
| 716 | case COMPST_ERROR: | 723 | case COMPST_ERROR: |
| 717 | do_complete(qp, wqe); | 724 | do_complete(qp, wqe); |
| 718 | rxe_qp_error(qp); | 725 | rxe_qp_error(qp); |
| 726 | |||
| 727 | if (pkt) { | ||
| 728 | rxe_drop_ref(pkt->qp); | ||
| 729 | kfree_skb(skb); | ||
| 730 | } | ||
| 731 | |||
| 719 | goto exit; | 732 | goto exit; |
| 720 | } | 733 | } |
| 721 | } | 734 | } |
| @@ -275,9 +275,10 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port, · 274 unmodified lines | |||
| 275 | return sock; | 275 | return sock; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | static void rxe_release_udp_tunnel(struct socket *sk) | 278 | void rxe_release_udp_tunnel(struct socket *sk) |
| 279 | { | 279 | { |
| 280 | udp_tunnel_sock_release(sk); | 280 | if (sk) |
| 281 | udp_tunnel_sock_release(sk); | ||
| 281 | } | 282 | } |
| 282 | 283 | ||
| 283 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, | 284 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, |
| @@ -658,51 +659,45 @@ out: · 374 unmodified lines | |||
| 658 | return NOTIFY_OK; | 659 | return NOTIFY_OK; |
| 659 | } | 660 | } |
| 660 | 661 | ||
| 661 | static struct notifier_block rxe_net_notifier = { | 662 | struct notifier_block rxe_net_notifier = { |
| 662 | .notifier_call = rxe_notify, | 663 | .notifier_call = rxe_notify, |
| 663 | }; | 664 | }; |
| 664 | 665 | ||
| 665 | int rxe_net_init(void) | 666 | int rxe_net_ipv4_init(void) |
| 666 | { | 667 | { |
| 667 | int err; | ||
| 668 | |||
| 669 | spin_lock_init(&dev_list_lock); | 668 | spin_lock_init(&dev_list_lock); |
| 670 | 669 | ||
| 671 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
| 672 | htons(ROCE_V2_UDP_DPORT), true); | ||
| 673 | if (IS_ERR(recv_sockets.sk6)) { | ||
| 674 | recv_sockets.sk6 = NULL; | ||
| 675 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
| 676 | return -1; | ||
| 677 | } | ||
| 678 | |||
| 679 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, | 670 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, |
| 680 | htons(ROCE_V2_UDP_DPORT), false); | 671 | htons(ROCE_V2_UDP_DPORT), false); |
| 681 | if (IS_ERR(recv_sockets.sk4)) { | 672 | if (IS_ERR(recv_sockets.sk4)) { |
| 682 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
| 683 | recv_sockets.sk4 = NULL; | 673 | recv_sockets.sk4 = NULL; |
| 684 | recv_sockets.sk6 = NULL; | ||
| 685 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); | 674 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); |
| 686 | return -1; | 675 | return -1; |
| 687 | } | 676 | } |
| 688 | 677 | ||
| 689 | err = register_netdevice_notifier(&rxe_net_notifier); | 678 | return 0; |
| 690 | if (err) { | ||
| 691 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
| 692 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
| 693 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
| 694 | } | ||
| 695 | |||
| 696 | return err; | ||
| 697 | } | 679 | } |
| 698 | 680 | ||
| 699 | void rxe_net_exit(void) | 681 | int rxe_net_ipv6_init(void) |
| 700 | { | 682 | { |
| 701 | if (recv_sockets.sk6) | 683 | #if IS_ENABLED(CONFIG_IPV6) |
| 702 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
| 703 | 684 | ||
| 704 | if (recv_sockets.sk4) | 685 | spin_lock_init(&dev_list_lock); |
| 705 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
| 706 | 686 | ||
| 687 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
| 688 | htons(ROCE_V2_UDP_DPORT), true); | ||
| 689 | if (IS_ERR(recv_sockets.sk6)) { | ||
| 690 | recv_sockets.sk6 = NULL; | ||
| 691 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
| 692 | return -1; | ||
| 693 | } | ||
| 694 | #endif | ||
| 695 | return 0; | ||
| 696 | } | ||
| 697 | |||
| 698 | void rxe_net_exit(void) | ||
| 699 | { | ||
| 700 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
| 701 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
| 707 | unregister_netdevice_notifier(&rxe_net_notifier); | 702 | unregister_netdevice_notifier(&rxe_net_notifier); |
| 708 | } | 703 | } |
| @@ -44,10 +44,13 @@ struct rxe_recv_sockets { · 43 unmodified lines | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | extern struct rxe_recv_sockets recv_sockets; | 46 | extern struct rxe_recv_sockets recv_sockets; |
| 47 | extern struct notifier_block rxe_net_notifier; | ||
| 48 | void rxe_release_udp_tunnel(struct socket *sk); | ||
| 47 | 49 | ||
| 48 | struct rxe_dev *rxe_net_add(struct net_device *ndev); | 50 | struct rxe_dev *rxe_net_add(struct net_device *ndev); |
| 49 | 51 | ||
| 50 | int rxe_net_init(void); | 52 | int rxe_net_ipv4_init(void); |
| 53 | int rxe_net_ipv6_init(void); | ||
| 51 | void rxe_net_exit(void); | 54 | void rxe_net_exit(void); |
| 52 | 55 | ||
| 53 | #endif /* RXE_NET_H */ | 56 | #endif /* RXE_NET_H */ |
| @@ -312,7 +312,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 311 unmodified lines | |||
| 312 | * make a copy of the skb to post to the next qp | 312 | * make a copy of the skb to post to the next qp |
| 313 | */ | 313 | */ |
| 314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? | 314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? |
| 315 | skb_clone(skb, GFP_KERNEL) : NULL; | 315 | skb_clone(skb, GFP_ATOMIC) : NULL; |
| 316 | 316 | ||
| 317 | pkt->qp = qp; | 317 | pkt->qp = qp; |
| 318 | rxe_add_ref(qp); | 318 | rxe_add_ref(qp); |
| @@ -511,24 +511,21 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, · 510 unmodified lines | |||
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | static void update_wqe_state(struct rxe_qp *qp, | 513 | static void update_wqe_state(struct rxe_qp *qp, |
| 514 | struct rxe_send_wqe *wqe, | 514 | struct rxe_send_wqe *wqe, |
| 515 | struct rxe_pkt_info *pkt, | 515 | struct rxe_pkt_info *pkt) |
| 516 | enum wqe_state *prev_state) | ||
| 517 | { | 516 | { |
| 518 | enum wqe_state prev_state_ = wqe->state; | ||
| 519 | |||
| 520 | if (pkt->mask & RXE_END_MASK) { | 517 | if (pkt->mask & RXE_END_MASK) { |
| 521 | if (qp_type(qp) == IB_QPT_RC) | 518 | if (qp_type(qp) == IB_QPT_RC) |
| 522 | wqe->state = wqe_state_pending; | 519 | wqe->state = wqe_state_pending; |
| 523 | } else { | 520 | } else { |
| 524 | wqe->state = wqe_state_processing; | 521 | wqe->state = wqe_state_processing; |
| 525 | } | 522 | } |
| 526 | |||
| 527 | *prev_state = prev_state_; | ||
| 528 | } | 523 | } |
| 529 | 524 | ||
| 530 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | 525 | static void update_wqe_psn(struct rxe_qp *qp, |
| 531 | struct rxe_pkt_info *pkt, int payload) | 526 | struct rxe_send_wqe *wqe, |
| 527 | struct rxe_pkt_info *pkt, | ||
| 528 | int payload) | ||
| 532 | { | 529 | { |
| 533 | /* number of packets left to send including current one */ | 530 | /* number of packets left to send including current one */ |
| 534 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; | 531 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; |
| @@ -546,9 +543,34 @@ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, · 11 unmodified lines | |||
| 546 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; | 543 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; |
| 547 | else | 544 | else |
| 548 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; | 545 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; |
| 546 | } | ||
| 549 | 547 | ||
| 550 | qp->req.opcode = pkt->opcode; | 548 | static void save_state(struct rxe_send_wqe *wqe, |
| 549 | struct rxe_qp *qp, | ||
| 550 | struct rxe_send_wqe *rollback_wqe, | ||
| 551 | struct rxe_qp *rollback_qp) | ||
| 552 | { | ||
| 553 | rollback_wqe->state = wqe->state; | ||
| 554 | rollback_wqe->first_psn = wqe->first_psn; | ||
| 555 | rollback_wqe->last_psn = wqe->last_psn; | ||
| 556 | rollback_qp->req.psn = qp->req.psn; | ||
| 557 | } | ||
| 551 | 558 | ||
| 559 | static void rollback_state(struct rxe_send_wqe *wqe, | ||
| 560 | struct rxe_qp *qp, | ||
| 561 | struct rxe_send_wqe *rollback_wqe, | ||
| 562 | struct rxe_qp *rollback_qp) | ||
| 563 | { | ||
| 564 | wqe->state = rollback_wqe->state; | ||
| 565 | wqe->first_psn = rollback_wqe->first_psn; | ||
| 566 | wqe->last_psn = rollback_wqe->last_psn; | ||
| 567 | qp->req.psn = rollback_qp->req.psn; | ||
| 568 | } | ||
| 569 | |||
| 570 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | ||
| 571 | struct rxe_pkt_info *pkt, int payload) | ||
| 572 | { | ||
| 573 | qp->req.opcode = pkt->opcode; | ||
| 552 | 574 | ||
| 553 | if (pkt->mask & RXE_END_MASK) | 575 | if (pkt->mask & RXE_END_MASK) |
| 554 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); | 576 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); |
| @@ -571,7 +593,8 @@ int rxe_requester(void *arg) · 16 unmodified lines | |||
| 571 | int mtu; | 593 | int mtu; |
| 572 | int opcode; | 594 | int opcode; |
| 573 | int ret; | 595 | int ret; |
| 574 | enum wqe_state prev_state; | 596 | struct rxe_qp rollback_qp; |
| 597 | struct rxe_send_wqe rollback_wqe; | ||
| 575 | 598 | ||
| 576 | next_wqe: | 599 | next_wqe: |
| 577 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) | 600 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) |
| @@ -688,13 +711,21 @@ next_wqe: · 110 unmodified lines | |||
| 688 | goto err; | 711 | goto err; |
| 689 | } | 712 | } |
| 690 | 713 | ||
| 691 | update_wqe_state(qp, wqe, &pkt, &prev_state); | 714 | /* |
| 715 | * To prevent a race on wqe access between requester and completer, | ||
| 716 | * wqe members state and psn need to be set before calling | ||
| 717 | * rxe_xmit_packet(). | ||
| 718 | * Otherwise, completer might initiate an unjustified retry flow. | ||
| 719 | */ | ||
| 720 | save_state(wqe, qp, &rollback_wqe, &rollback_qp); | ||
| 721 | update_wqe_state(qp, wqe, &pkt); | ||
| 722 | update_wqe_psn(qp, wqe, &pkt, payload); | ||
| 692 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); | 723 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); |
| 693 | if (ret) { | 724 | if (ret) { |
| 694 | qp->need_req_skb = 1; | 725 | qp->need_req_skb = 1; |
| 695 | kfree_skb(skb); | 726 | kfree_skb(skb); |
| 696 | 727 | ||
| 697 | wqe->state = prev_state; | 728 | rollback_state(wqe, qp, &rollback_wqe, &rollback_qp); |
| 698 | 729 | ||
| 699 | if (ret == -EAGAIN) { | 730 | if (ret == -EAGAIN) { |
| 700 | rxe_run_task(&qp->req.task, 1); | 731 | rxe_run_task(&qp->req.task, 1); |
| @@ -972,11 +972,13 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, · 971 unmodified lines | |||
| 972 | free_rd_atomic_resource(qp, res); | 972 | free_rd_atomic_resource(qp, res); |
| 973 | rxe_advance_resp_resource(qp); | 973 | rxe_advance_resp_resource(qp); |
| 974 | 974 | ||
| 975 | memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(skb->cb)); | ||
| 976 | |||
| 975 | res->type = RXE_ATOMIC_MASK; | 977 | res->type = RXE_ATOMIC_MASK; |
| 976 | res->atomic.skb = skb; | 978 | res->atomic.skb = skb; |
| 977 | res->first_psn = qp->resp.psn; | 979 | res->first_psn = ack_pkt.psn; |
| 978 | res->last_psn = qp->resp.psn; | 980 | res->last_psn = ack_pkt.psn; |
| 979 | res->cur_psn = qp->resp.psn; | 981 | res->cur_psn = ack_pkt.psn; |
| 980 | 982 | ||
| 981 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); | 983 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); |
| 982 | if (rc) { | 984 | if (rc) { |
| @@ -1116,8 +1118,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, · 133 unmodified lines | |||
| 1116 | rc = RESPST_CLEANUP; | 1118 | rc = RESPST_CLEANUP; |
| 1117 | goto out; | 1119 | goto out; |
| 1118 | } | 1120 | } |
| 1119 | bth_set_psn(SKB_TO_PKT(skb_copy), | 1121 | |
| 1120 | qp->resp.psn - 1); | ||
| 1121 | /* Resend the result. */ | 1122 | /* Resend the result. */ |
| 1122 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, | 1123 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, |
| 1123 | pkt, skb_copy); | 1124 | pkt, skb_copy); |
| @@ -478,6 +478,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, · 477 unmodified lines | |||
| 478 | struct ipoib_ah *address, u32 qpn); | 478 | struct ipoib_ah *address, u32 qpn); |
| 479 | void ipoib_reap_ah(struct work_struct *work); | 479 | void ipoib_reap_ah(struct work_struct *work); |
| 480 | 480 | ||
| 481 | struct ipoib_path *__path_find(struct net_device *dev, void *gid); | ||
| 481 | void ipoib_mark_paths_invalid(struct net_device *dev); | 482 | void ipoib_mark_paths_invalid(struct net_device *dev); |
| 482 | void ipoib_flush_paths(struct net_device *dev); | 483 | void ipoib_flush_paths(struct net_device *dev); |
| 483 | int ipoib_check_sm_sendonly_fullmember_support(struct ipoib_dev_priv *priv); | 484 | int ipoib_check_sm_sendonly_fullmember_support(struct ipoib_dev_priv *priv); |
| @@ -1318,6 +1318,8 @@ void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx) · 1317 unmodified lines | |||
| 1318 | } | 1318 | } |
| 1319 | } | 1319 | } |
| 1320 | 1320 | ||
| 1321 | #define QPN_AND_OPTIONS_OFFSET 4 | ||
| 1322 | |||
| 1321 | static void ipoib_cm_tx_start(struct work_struct *work) | 1323 | static void ipoib_cm_tx_start(struct work_struct *work) |
| 1322 | { | 1324 | { |
| 1323 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | 1325 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, |
| @@ -1326,6 +1328,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) · 2 unmodified lines | |||
| 1326 | struct ipoib_neigh *neigh; | 1328 | struct ipoib_neigh *neigh; |
| 1327 | struct ipoib_cm_tx *p; | 1329 | struct ipoib_cm_tx *p; |
| 1328 | unsigned long flags; | 1330 | unsigned long flags; |
| 1331 | struct ipoib_path *path; | ||
| 1329 | int ret; | 1332 | int ret; |
| 1330 | 1333 | ||
| 1331 | struct ib_sa_path_rec pathrec; | 1334 | struct ib_sa_path_rec pathrec; |
| @@ -1338,7 +1341,19 @@ static void ipoib_cm_tx_start(struct work_struct *work) · 6 unmodified lines | |||
| 1338 | p = list_entry(priv->cm.start_list.next, typeof(*p), list); | 1341 | p = list_entry(priv->cm.start_list.next, typeof(*p), list); |
| 1339 | list_del_init(&p->list); | 1342 | list_del_init(&p->list); |
| 1340 | neigh = p->neigh; | 1343 | neigh = p->neigh; |
| 1344 | |||
| 1341 | qpn = IPOIB_QPN(neigh->daddr); | 1345 | qpn = IPOIB_QPN(neigh->daddr); |
| 1346 | /* | ||
| 1347 | * As long as the search is with these 2 locks, | ||
| 1348 | * path existence indicates its validity. | ||
| 1349 | */ | ||
| 1350 | path = __path_find(dev, neigh->daddr + QPN_AND_OPTIONS_OFFSET); | ||
| 1351 | if (!path) { | ||
| 1352 | pr_info("%s ignore not valid path %pI6\n", | ||
| 1353 | __func__, | ||
| 1354 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | ||
| 1355 | goto free_neigh; | ||
| 1356 | } | ||
| 1342 | memcpy(&pathrec, &p->path->pathrec, sizeof pathrec); | 1357 | memcpy(&pathrec, &p->path->pathrec, sizeof pathrec); |
| 1343 | 1358 | ||
| 1344 | spin_unlock_irqrestore(&priv->lock, flags); | 1359 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -1350,6 +1365,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) · 5 unmodified lines | |||
| 1350 | spin_lock_irqsave(&priv->lock, flags); | 1365 | spin_lock_irqsave(&priv->lock, flags); |
| 1351 | 1366 | ||
| 1352 | if (ret) { | 1367 | if (ret) { |
| 1368 | free_neigh: | ||
| 1353 | neigh = p->neigh; | 1369 | neigh = p->neigh; |
| 1354 | if (neigh) { | 1370 | if (neigh) { |
| 1355 | neigh->cm = NULL; | 1371 | neigh->cm = NULL; |
| @@ -1161,8 +1161,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, · 1160 unmodified lines | |||
| 1161 | } | 1161 | } |
| 1162 | 1162 | ||
| 1163 | if (level == IPOIB_FLUSH_LIGHT) { | 1163 | if (level == IPOIB_FLUSH_LIGHT) { |
| 1164 | int oper_up; | ||
| 1164 | ipoib_mark_paths_invalid(dev); | 1165 | ipoib_mark_paths_invalid(dev); |
| 1166 | /* Set IPoIB operation as down to prevent races between: | ||
| 1167 | * the flush flow which leaves MCG and on the fly joins | ||
| 1168 | * which can happen during that time. mcast restart task | ||
| 1169 | * should deal with join requests we missed. | ||
| 1170 | */ | ||
| 1171 | oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
| 1165 | ipoib_mcast_dev_flush(dev); | 1172 | ipoib_mcast_dev_flush(dev); |
| 1173 | if (oper_up) | ||
| 1174 | set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
| 1166 | ipoib_flush_ah(dev); | 1175 | ipoib_flush_ah(dev); |
| 1167 | } | 1176 | } |
| 1168 | 1177 | ||
| @@ -485,7 +485,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf) · 484 unmodified lines | |||
| 485 | return -EINVAL; | 485 | return -EINVAL; |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | static struct ipoib_path *__path_find(struct net_device *dev, void *gid) | 488 | struct ipoib_path *__path_find(struct net_device *dev, void *gid) |
| 489 | { | 489 | { |
| 490 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 490 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 491 | struct rb_node *n = priv->path_tree.rb_node; | 491 | struct rb_node *n = priv->path_tree.rb_node; |
| @@ -403,6 +403,7 @@ isert_init_conn(struct isert_conn *isert_conn) · 402 unmodified lines | |||
| 403 | INIT_LIST_HEAD(&isert_conn->node); | 403 | INIT_LIST_HEAD(&isert_conn->node); |
| 404 | init_completion(&isert_conn->login_comp); | 404 | init_completion(&isert_conn->login_comp); |
| 405 | init_completion(&isert_conn->login_req_comp); | 405 | init_completion(&isert_conn->login_req_comp); |
| 406 | init_waitqueue_head(&isert_conn->rem_wait); | ||
| 406 | kref_init(&isert_conn->kref); | 407 | kref_init(&isert_conn->kref); |
| 407 | mutex_init(&isert_conn->mutex); | 408 | mutex_init(&isert_conn->mutex); |
| 408 | INIT_WORK(&isert_conn->release_work, isert_release_work); | 409 | INIT_WORK(&isert_conn->release_work, isert_release_work); |
| @@ -448,7 +449,7 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, · 39 unmodified lines | |||
| 448 | 449 | ||
| 449 | isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); | 450 | isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); |
| 450 | if (!isert_conn->login_rsp_buf) { | 451 | if (!isert_conn->login_rsp_buf) { |
| 451 | isert_err("Unable to allocate isert_conn->login_rspbuf\n"); | 452 | ret = -ENOMEM; |
| 452 | goto out_unmap_login_req_buf; | 453 | goto out_unmap_login_req_buf; |
| 453 | } | 454 | } |
| 454 | 455 | ||
| @@ -578,7 +579,8 @@ isert_connect_release(struct isert_conn *isert_conn) · 123 unmodified lines | |||
| 578 | BUG_ON(!device); | 579 | BUG_ON(!device); |
| 579 | 580 | ||
| 580 | isert_free_rx_descriptors(isert_conn); | 581 | isert_free_rx_descriptors(isert_conn); |
| 581 | if (isert_conn->cm_id) | 582 | if (isert_conn->cm_id && |
| 583 | !isert_conn->dev_removed) | ||
| 582 | rdma_destroy_id(isert_conn->cm_id); | 584 | rdma_destroy_id(isert_conn->cm_id); |
| 583 | 585 | ||
| 584 | if (isert_conn->qp) { | 586 | if (isert_conn->qp) { |
| @@ -593,7 +595,10 @@ isert_connect_release(struct isert_conn *isert_conn) · 8 unmodified lines | |||
| 593 | 595 | ||
| 594 | isert_device_put(device); | 596 | isert_device_put(device); |
| 595 | 597 | ||
| 596 | kfree(isert_conn); | 598 | if (isert_conn->dev_removed) |
| 599 | wake_up_interruptible(&isert_conn->rem_wait); | ||
| 600 | else | ||
| 601 | kfree(isert_conn); | ||
| 597 | } | 602 | } |
| 598 | 603 | ||
| 599 | static void | 604 | static void |
| @@ -753,6 +758,7 @@ static int · 153 unmodified lines | |||
| 753 | isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | 758 | isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) |
| 754 | { | 759 | { |
| 755 | struct isert_np *isert_np = cma_id->context; | 760 | struct isert_np *isert_np = cma_id->context; |
| 761 | struct isert_conn *isert_conn; | ||
| 756 | int ret = 0; | 762 | int ret = 0; |
| 757 | 763 | ||
| 758 | isert_info("%s (%d): status %d id %p np %p\n", | 764 | isert_info("%s (%d): status %d id %p np %p\n", |
| @@ -773,10 +779,21 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) · 14 unmodified lines | |||
| 773 | break; | 779 | break; |
| 774 | case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ | 780 | case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ |
| 775 | case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ | 781 | case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ |
| 776 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | ||
| 777 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 782 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
| 778 | ret = isert_disconnected_handler(cma_id, event->event); | 783 | ret = isert_disconnected_handler(cma_id, event->event); |
| 779 | break; | 784 | break; |
| 785 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | ||
| 786 | isert_conn = cma_id->qp->qp_context; | ||
| 787 | isert_conn->dev_removed = true; | ||
| 788 | isert_disconnected_handler(cma_id, event->event); | ||
| 789 | wait_event_interruptible(isert_conn->rem_wait, | ||
| 790 | isert_conn->state == ISER_CONN_DOWN); | ||
| 791 | kfree(isert_conn); | ||
| 792 | /* | ||
| 793 | * return non-zero from the callback to destroy | ||
| 794 | * the rdma cm id | ||
| 795 | */ | ||
| 796 | return 1; | ||
| 780 | case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ | 797 | case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ |
| 781 | case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ | 798 | case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ |
| 782 | case RDMA_CM_EVENT_CONNECT_ERROR: | 799 | case RDMA_CM_EVENT_CONNECT_ERROR: |
| @@ -158,6 +158,8 @@ struct isert_conn { · 157 unmodified lines | |||
| 158 | struct work_struct release_work; | 158 | struct work_struct release_work; |
| 159 | bool logout_posted; | 159 | bool logout_posted; |
| 160 | bool snd_w_inv; | 160 | bool snd_w_inv; |
| 161 | wait_queue_head_t rem_wait; | ||
| 162 | bool dev_removed; | ||
| 161 | }; | 163 | }; |
| 162 | 164 | ||
| 163 | #define ISERT_MAX_CQ 64 | 165 | #define ISERT_MAX_CQ 64 |
| @@ -522,6 +522,11 @@ static int srpt_refresh_port(struct srpt_port *sport) · 521 unmodified lines | |||
| 522 | if (ret) | 522 | if (ret) |
| 523 | goto err_query_port; | 523 | goto err_query_port; |
| 524 | 524 | ||
| 525 | snprintf(sport->port_guid, sizeof(sport->port_guid), | ||
| 526 | "0x%016llx%016llx", | ||
| 527 | be64_to_cpu(sport->gid.global.subnet_prefix), | ||
| 528 | be64_to_cpu(sport->gid.global.interface_id)); | ||
| 529 | |||
| 525 | if (!sport->mad_agent) { | 530 | if (!sport->mad_agent) { |
| 526 | memset(®_req, 0, sizeof(reg_req)); | 531 | memset(®_req, 0, sizeof(reg_req)); |
| 527 | reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT; | 532 | reg_req.mgmt_class = IB_MGMT_CLASS_DEVICE_MGMT; |
| @@ -2548,10 +2553,6 @@ static void srpt_add_one(struct ib_device *device) · 2020 unmodified lines | |||
| 2548 | sdev->device->name, i); | 2553 | sdev->device->name, i); |
| 2549 | goto err_ring; | 2554 | goto err_ring; |
| 2550 | } | 2555 | } |
| 2551 | snprintf(sport->port_guid, sizeof(sport->port_guid), | ||
| 2552 | "0x%016llx%016llx", | ||
| 2553 | be64_to_cpu(sport->gid.global.subnet_prefix), | ||
| 2554 | be64_to_cpu(sport->gid.global.interface_id)); | ||
| 2555 | } | 2556 | } |
| 2556 | 2557 | ||
| 2557 | spin_lock(&srpt_dev_lock); | 2558 | spin_lock(&srpt_dev_lock); |
| @@ -376,7 +376,7 @@ static int tegra_kbc_start(struct tegra_kbc *kbc) · 375 unmodified lines | |||
| 376 | /* Reset the KBC controller to clear all previous status.*/ | 376 | /* Reset the KBC controller to clear all previous status.*/ |
| 377 | reset_control_assert(kbc->rst); | 377 | reset_control_assert(kbc->rst); |
| 378 | udelay(100); | 378 | udelay(100); |
| 379 | reset_control_assert(kbc->rst); | 379 | reset_control_deassert(kbc->rst); |
| 380 | udelay(100); | 380 | udelay(100); |
| 381 | 381 | ||
| 382 | tegra_kbc_config_pins(kbc); | 382 | tegra_kbc_config_pins(kbc); |
| @@ -553,7 +553,6 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr, · 552 unmodified lines | |||
| 553 | goto free_struct_buff; | 553 | goto free_struct_buff; |
| 554 | 554 | ||
| 555 | reg = find_first_bit(rdesc->presense_map, RMI_REG_DESC_PRESENSE_BITS); | 555 | reg = find_first_bit(rdesc->presense_map, RMI_REG_DESC_PRESENSE_BITS); |
| 556 | map_offset = 0; | ||
| 557 | for (i = 0; i < rdesc->num_registers; i++) { | 556 | for (i = 0; i < rdesc->num_registers; i++) { |
| 558 | struct rmi_register_desc_item *item = &rdesc->registers[i]; | 557 | struct rmi_register_desc_item *item = &rdesc->registers[i]; |
| 559 | int reg_size = struct_buf[offset]; | 558 | int reg_size = struct_buf[offset]; |
| @@ -576,6 +575,8 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr, · 16 unmodified lines | |||
| 576 | item->reg = reg; | 575 | item->reg = reg; |
| 577 | item->reg_size = reg_size; | 576 | item->reg_size = reg_size; |
| 578 | 577 | ||
| 578 | map_offset = 0; | ||
| 579 | |||
| 579 | do { | 580 | do { |
| 580 | for (b = 0; b < 7; b++) { | 581 | for (b = 0; b < 7; b++) { |
| 581 | if (struct_buf[offset] & (0x1 << b)) | 582 | if (struct_buf[offset] & (0x1 << b)) |
| @@ -1305,6 +1305,7 @@ static int __init i8042_create_aux_port(int idx) · 1304 unmodified lines | |||
| 1305 | serio->write = i8042_aux_write; | 1305 | serio->write = i8042_aux_write; |
| 1306 | serio->start = i8042_start; | 1306 | serio->start = i8042_start; |
| 1307 | serio->stop = i8042_stop; | 1307 | serio->stop = i8042_stop; |
| 1308 | serio->ps2_cmd_mutex = &i8042_mutex; | ||
| 1308 | serio->port_data = port; | 1309 | serio->port_data = port; |
| 1309 | serio->dev.parent = &i8042_platform_device->dev; | 1310 | serio->dev.parent = &i8042_platform_device->dev; |
| 1310 | if (idx < 0) { | 1311 | if (idx < 0) { |
| @@ -1473,7 +1473,6 @@ static int ads7846_remove(struct spi_device *spi) · 1472 unmodified lines | |||
| 1473 | 1473 | ||
| 1474 | ads784x_hwmon_unregister(spi, ts); | 1474 | ads784x_hwmon_unregister(spi, ts); |
| 1475 | 1475 | ||
| 1476 | regulator_disable(ts->reg); | ||
| 1477 | regulator_put(ts->reg); | 1476 | regulator_put(ts->reg); |
| 1478 | 1477 | ||
| 1479 | if (!ts->get_pendown_state) { | 1478 | if (!ts->get_pendown_state) { |
| @@ -390,9 +390,10 @@ static void silead_ts_read_props(struct i2c_client *client) · 389 unmodified lines | |||
| 390 | data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ | 390 | data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | error = device_property_read_string(dev, "touchscreen-fw-name", &str); | 393 | error = device_property_read_string(dev, "firmware-name", &str); |
| 394 | if (!error) | 394 | if (!error) |
| 395 | snprintf(data->fw_name, sizeof(data->fw_name), "%s", str); | 395 | snprintf(data->fw_name, sizeof(data->fw_name), |
| 396 | "silead/%s", str); | ||
| 396 | else | 397 | else |
| 397 | dev_dbg(dev, "Firmware file name read error. Using default."); | 398 | dev_dbg(dev, "Firmware file name read error. Using default."); |
| 398 | } | 399 | } |
| @@ -410,14 +411,14 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data, · 11 unmodified lines | |||
| 410 | if (!acpi_id) | 411 | if (!acpi_id) |
| 411 | return -ENODEV; | 412 | return -ENODEV; |
| 412 | 413 | ||
| 413 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", | 414 | snprintf(data->fw_name, sizeof(data->fw_name), |
| 414 | acpi_id->id); | 415 | "silead/%s.fw", acpi_id->id); |
| 415 | 416 | ||
| 416 | for (i = 0; i < strlen(data->fw_name); i++) | 417 | for (i = 0; i < strlen(data->fw_name); i++) |
| 417 | data->fw_name[i] = tolower(data->fw_name[i]); | 418 | data->fw_name[i] = tolower(data->fw_name[i]); |
| 418 | } else { | 419 | } else { |
| 419 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", | 420 | snprintf(data->fw_name, sizeof(data->fw_name), |
| 420 | id->name); | 421 | "silead/%s.fw", id->name); |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | return 0; | 424 | return 0; |
| @@ -426,7 +427,8 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data, · 2 unmodified lines | |||
| 426 | static int silead_ts_set_default_fw_name(struct silead_ts_data *data, | 427 | static int silead_ts_set_default_fw_name(struct silead_ts_data *data, |
| 427 | const struct i2c_device_id *id) | 428 | const struct i2c_device_id *id) |
| 428 | { | 429 | { |
| 429 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", id->name); | 430 | snprintf(data->fw_name, sizeof(data->fw_name), |
| 431 | "silead/%s.fw", id->name); | ||
| 430 | return 0; | 432 | return 0; |
| 431 | } | 433 | } |
| 432 | #endif | 434 | #endif |
| @@ -464,7 +466,7 @@ static int silead_ts_probe(struct i2c_client *client, · 31 unmodified lines | |||
| 464 | return -ENODEV; | 466 | return -ENODEV; |
| 465 | 467 | ||
| 466 | /* Power GPIO pin */ | 468 | /* Power GPIO pin */ |
| 467 | data->gpio_power = gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); | 469 | data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); |
| 468 | if (IS_ERR(data->gpio_power)) { | 470 | if (IS_ERR(data->gpio_power)) { |
| 469 | if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) | 471 | if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) |
| 470 | dev_err(dev, "Shutdown GPIO request failed\n"); | 472 | dev_err(dev, "Shutdown GPIO request failed\n"); |
| @@ -879,7 +879,7 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu) · 878 unmodified lines | |||
| 879 | * We may have concurrent producers, so we need to be careful | 879 | * We may have concurrent producers, so we need to be careful |
| 880 | * not to touch any of the shadow cmdq state. | 880 | * not to touch any of the shadow cmdq state. |
| 881 | */ | 881 | */ |
| 882 | queue_read(cmd, Q_ENT(q, idx), q->ent_dwords); | 882 | queue_read(cmd, Q_ENT(q, cons), q->ent_dwords); |
| 883 | dev_err(smmu->dev, "skipping command in error state:\n"); | 883 | dev_err(smmu->dev, "skipping command in error state:\n"); |
| 884 | for (i = 0; i < ARRAY_SIZE(cmd); ++i) | 884 | for (i = 0; i < ARRAY_SIZE(cmd); ++i) |
| 885 | dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]); | 885 | dev_err(smmu->dev, "\t0x%016llx\n", (unsigned long long)cmd[i]); |
| @@ -890,7 +890,7 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu) · 4 unmodified lines | |||
| 890 | return; | 890 | return; |
| 891 | } | 891 | } |
| 892 | 892 | ||
| 893 | queue_write(cmd, Q_ENT(q, idx), q->ent_dwords); | 893 | queue_write(Q_ENT(q, cons), cmd, q->ent_dwords); |
| 894 | } | 894 | } |
| 895 | 895 | ||
| 896 | static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, | 896 | static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, |
| @@ -1034,6 +1034,9 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid, · 137 unmodified lines | |||
| 1034 | case STRTAB_STE_0_CFG_S2_TRANS: | 1034 | case STRTAB_STE_0_CFG_S2_TRANS: |
| 1035 | ste_live = true; | 1035 | ste_live = true; |
| 1036 | break; | 1036 | break; |
| 1037 | case STRTAB_STE_0_CFG_ABORT: | ||
| 1038 | if (disable_bypass) | ||
| 1039 | break; | ||
| 1037 | default: | 1040 | default: |
| 1038 | BUG(); /* STE corruption */ | 1041 | BUG(); /* STE corruption */ |
| 1039 | } | 1042 | } |
| @@ -686,8 +686,7 @@ static struct iommu_gather_ops arm_smmu_gather_ops = { · 685 unmodified lines | |||
| 686 | 686 | ||
| 687 | static irqreturn_t arm_smmu_context_fault(int irq, void *dev) | 687 | static irqreturn_t arm_smmu_context_fault(int irq, void *dev) |
| 688 | { | 688 | { |
| 689 | int flags, ret; | 689 | u32 fsr, fsynr; |
| 690 | u32 fsr, fsynr, resume; | ||
| 691 | unsigned long iova; | 690 | unsigned long iova; |
| 692 | struct iommu_domain *domain = dev; | 691 | struct iommu_domain *domain = dev; |
| 693 | struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); | 692 | struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); |
| @@ -701,34 +700,15 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) · 7 unmodified lines | |||
| 701 | if (!(fsr & FSR_FAULT)) | 700 | if (!(fsr & FSR_FAULT)) |
| 702 | return IRQ_NONE; | 701 | return IRQ_NONE; |
| 703 | 702 | ||
| 704 | if (fsr & FSR_IGN) | ||
| 705 | dev_err_ratelimited(smmu->dev, | ||
| 706 | "Unexpected context fault (fsr 0x%x)\n", | ||
| 707 | fsr); | ||
| 708 | |||
| 709 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); | 703 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); |
| 710 | flags = fsynr & FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ; | ||
| 711 | |||
| 712 | iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); | 704 | iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); |
| 713 | if (!report_iommu_fault(domain, smmu->dev, iova, flags)) { | ||
| 714 | ret = IRQ_HANDLED; | ||
| 715 | resume = RESUME_RETRY; | ||
| 716 | } else { | ||
| 717 | dev_err_ratelimited(smmu->dev, | ||
| 718 | "Unhandled context fault: iova=0x%08lx, fsynr=0x%x, cb=%d\n", | ||
| 719 | iova, fsynr, cfg->cbndx); | ||
| 720 | ret = IRQ_NONE; | ||
| 721 | resume = RESUME_TERMINATE; | ||
| 722 | } | ||
| 723 | |||
| 724 | /* Clear the faulting FSR */ | ||
| 725 | writel(fsr, cb_base + ARM_SMMU_CB_FSR); | ||
| 726 | 705 | ||
| 727 | /* Retry or terminate any stalled transactions */ | 706 | dev_err_ratelimited(smmu->dev, |
| 728 | if (fsr & FSR_SS) | 707 | "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n", |
| 729 | writel_relaxed(resume, cb_base + ARM_SMMU_CB_RESUME); | 708 | fsr, iova, fsynr, cfg->cbndx); |
| 730 | 709 | ||
| 731 | return ret; | 710 | writel(fsr, cb_base + ARM_SMMU_CB_FSR); |
| 711 | return IRQ_HANDLED; | ||
| 732 | } | 712 | } |
| 733 | 713 | ||
| 734 | static irqreturn_t arm_smmu_global_fault(int irq, void *dev) | 714 | static irqreturn_t arm_smmu_global_fault(int irq, void *dev) |
| @@ -837,7 +817,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain, · 102 unmodified lines | |||
| 837 | } | 817 | } |
| 838 | 818 | ||
| 839 | /* SCTLR */ | 819 | /* SCTLR */ |
| 840 | reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP; | 820 | reg = SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP; |
| 841 | if (stage1) | 821 | if (stage1) |
| 842 | reg |= SCTLR_S1_ASIDPNE; | 822 | reg |= SCTLR_S1_ASIDPNE; |
| 843 | #ifdef __BIG_ENDIAN | 823 | #ifdef __BIG_ENDIAN |
| @@ -286,12 +286,14 @@ static int arm_v7s_pte_to_prot(arm_v7s_iopte pte, int lvl) · 285 unmodified lines | |||
| 286 | int prot = IOMMU_READ; | 286 | int prot = IOMMU_READ; |
| 287 | arm_v7s_iopte attr = pte >> ARM_V7S_ATTR_SHIFT(lvl); | 287 | arm_v7s_iopte attr = pte >> ARM_V7S_ATTR_SHIFT(lvl); |
| 288 | 288 | ||
| 289 | if (attr & ARM_V7S_PTE_AP_RDONLY) | 289 | if (!(attr & ARM_V7S_PTE_AP_RDONLY)) |
| 290 | prot |= IOMMU_WRITE; | 290 | prot |= IOMMU_WRITE; |
| 291 | if ((attr & (ARM_V7S_TEX_MASK << ARM_V7S_TEX_SHIFT)) == 0) | 291 | if ((attr & (ARM_V7S_TEX_MASK << ARM_V7S_TEX_SHIFT)) == 0) |
| 292 | prot |= IOMMU_MMIO; | 292 | prot |= IOMMU_MMIO; |
| 293 | else if (pte & ARM_V7S_ATTR_C) | 293 | else if (pte & ARM_V7S_ATTR_C) |
| 294 | prot |= IOMMU_CACHE; | 294 | prot |= IOMMU_CACHE; |
| 295 | if (pte & ARM_V7S_ATTR_XN(lvl)) | ||
| 296 | prot |= IOMMU_NOEXEC; | ||
| 295 | 297 | ||
| 296 | return prot; | 298 | return prot; |
| 297 | } | 299 | } |
| @@ -176,6 +176,7 @@ static int aic_irq_domain_xlate(struct irq_domain *d, · 175 unmodified lines | |||
| 176 | { | 176 | { |
| 177 | struct irq_domain_chip_generic *dgc = d->gc; | 177 | struct irq_domain_chip_generic *dgc = d->gc; |
| 178 | struct irq_chip_generic *gc; | 178 | struct irq_chip_generic *gc; |
| 179 | unsigned long flags; | ||
| 179 | unsigned smr; | 180 | unsigned smr; |
| 180 | int idx; | 181 | int idx; |
| 181 | int ret; | 182 | int ret; |
| @@ -194,11 +195,11 @@ static int aic_irq_domain_xlate(struct irq_domain *d, · 12 unmodified lines | |||
| 194 | 195 | ||
| 195 | gc = dgc->gc[idx]; | 196 | gc = dgc->gc[idx]; |
| 196 | 197 | ||
| 197 | irq_gc_lock(gc); | 198 | irq_gc_lock_irqsave(gc, flags); |
| 198 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); | 199 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); |
| 199 | aic_common_set_priority(intspec[2], &smr); | 200 | aic_common_set_priority(intspec[2], &smr); |
| 200 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); | 201 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); |
| 201 | irq_gc_unlock(gc); | 202 | irq_gc_unlock_irqrestore(gc, flags); |
| 202 | 203 | ||
| 203 | return ret; | 204 | return ret; |
| 204 | } | 205 | } |
| @@ -258,6 +258,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, · 257 unmodified lines | |||
| 258 | unsigned int *out_type) | 258 | unsigned int *out_type) |
| 259 | { | 259 | { |
| 260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); | 260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); |
| 261 | unsigned long flags; | ||
| 261 | unsigned smr; | 262 | unsigned smr; |
| 262 | int ret; | 263 | int ret; |
| 263 | 264 | ||
| @@ -269,12 +270,12 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, · 5 unmodified lines | |||
| 269 | if (ret) | 270 | if (ret) |
| 270 | return ret; | 271 | return ret; |
| 271 | 272 | ||
| 272 | irq_gc_lock(bgc); | 273 | irq_gc_lock_irqsave(bgc, flags); |
| 273 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); | 274 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); |
| 274 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); | 275 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); |
| 275 | aic_common_set_priority(intspec[2], &smr); | 276 | aic_common_set_priority(intspec[2], &smr); |
| 276 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); | 277 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); |
| 277 | irq_gc_unlock(bgc); | 278 | irq_gc_unlock_irqrestore(bgc, flags); |
| 278 | 279 | ||
| 279 | return ret; | 280 | return ret; |
| 280 | } | 281 | } |
| @@ -1545,7 +1545,12 @@ static int its_force_quiescent(void __iomem *base) · 1544 unmodified lines | |||
| 1545 | u32 val; | 1545 | u32 val; |
| 1546 | 1546 | ||
| 1547 | val = readl_relaxed(base + GITS_CTLR); | 1547 | val = readl_relaxed(base + GITS_CTLR); |
| 1548 | if (val & GITS_CTLR_QUIESCENT) | 1548 | /* |
| 1549 | * GIC architecture specification requires the ITS to be both | ||
| 1550 | * disabled and quiescent for writes to GITS_BASER<n> or | ||
| 1551 | * GITS_CBASER to not have UNPREDICTABLE results. | ||
| 1552 | */ | ||
| 1553 | if ((val & GITS_CTLR_QUIESCENT) && !(val & GITS_CTLR_ENABLE)) | ||
| 1549 | return 0; | 1554 | return 0; |
| 1550 | 1555 | ||
| 1551 | /* Disable the generation of all interrupts to this ITS */ | 1556 | /* Disable the generation of all interrupts to this ITS */ |
| @@ -548,7 +548,7 @@ static int gic_starting_cpu(unsigned int cpu) · 547 unmodified lines | |||
| 548 | static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, | 548 | static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, |
| 549 | unsigned long cluster_id) | 549 | unsigned long cluster_id) |
| 550 | { | 550 | { |
| 551 | int cpu = *base_cpu; | 551 | int next_cpu, cpu = *base_cpu; |
| 552 | unsigned long mpidr = cpu_logical_map(cpu); | 552 | unsigned long mpidr = cpu_logical_map(cpu); |
| 553 | u16 tlist = 0; | 553 | u16 tlist = 0; |
| 554 | 554 | ||
| @@ -562,9 +562,10 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, · 7 unmodified lines | |||
| 562 | 562 | ||
| 563 | tlist |= 1 << (mpidr & 0xf); | 563 | tlist |= 1 << (mpidr & 0xf); |
| 564 | 564 | ||
| 565 | cpu = cpumask_next(cpu, mask); | 565 | next_cpu = cpumask_next(cpu, mask); |
| 566 | if (cpu >= nr_cpu_ids) | 566 | if (next_cpu >= nr_cpu_ids) |
| 567 | goto out; | 567 | goto out; |
| 568 | cpu = next_cpu; | ||
| 568 | 569 | ||
| 569 | mpidr = cpu_logical_map(cpu); | 570 | mpidr = cpu_logical_map(cpu); |
| 570 | 571 | ||
| @@ -667,13 +668,20 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, · 96 unmodified lines | |||
| 667 | #endif | 668 | #endif |
| 668 | 669 | ||
| 669 | #ifdef CONFIG_CPU_PM | 670 | #ifdef CONFIG_CPU_PM |
| 671 | /* Check whether it's single security state view */ | ||
| 672 | static bool gic_dist_security_disabled(void) | ||
| 673 | { | ||
| 674 | return readl_relaxed(gic_data.dist_base + GICD_CTLR) & GICD_CTLR_DS; | ||
| 675 | } | ||
| 676 | |||
| 670 | static int gic_cpu_pm_notifier(struct notifier_block *self, | 677 | static int gic_cpu_pm_notifier(struct notifier_block *self, |
| 671 | unsigned long cmd, void *v) | 678 | unsigned long cmd, void *v) |
| 672 | { | 679 | { |
| 673 | if (cmd == CPU_PM_EXIT) { | 680 | if (cmd == CPU_PM_EXIT) { |
| 674 | gic_enable_redist(true); | 681 | if (gic_dist_security_disabled()) |
| 682 | gic_enable_redist(true); | ||
| 675 | gic_cpu_sys_reg_init(); | 683 | gic_cpu_sys_reg_init(); |
| 676 | } else if (cmd == CPU_PM_ENTER) { | 684 | } else if (cmd == CPU_PM_ENTER && gic_dist_security_disabled()) { |
| 677 | gic_write_grpen1(0); | 685 | gic_write_grpen1(0); |
| 678 | gic_enable_redist(false); | 686 | gic_enable_redist(false); |
| 679 | } | 687 | } |
| @@ -769,6 +769,13 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) · 768 unmodified lines | |||
| 769 | int cpu; | 769 | int cpu; |
| 770 | unsigned long flags, map = 0; | 770 | unsigned long flags, map = 0; |
| 771 | 771 | ||
| 772 | if (unlikely(nr_cpu_ids == 1)) { | ||
| 773 | /* Only one CPU? let's do a self-IPI... */ | ||
| 774 | writel_relaxed(2 << 24 | irq, | ||
| 775 | gic_data_dist_base(&gic_data[0]) + GIC_DIST_SOFTINT); | ||
| 776 | return; | ||
| 777 | } | ||
| 778 | |||
| 772 | raw_spin_lock_irqsave(&irq_controller_lock, flags); | 779 | raw_spin_lock_irqsave(&irq_controller_lock, flags); |
| 773 | 780 | ||
| 774 | /* Convert our logical CPU mask into a physical one. */ | 781 | /* Convert our logical CPU mask into a physical one. */ |
| @@ -638,27 +638,6 @@ static int gic_local_irq_domain_map(struct irq_domain *d, unsigned int virq, · 637 unmodified lines | |||
| 638 | if (!gic_local_irq_is_routable(intr)) | 638 | if (!gic_local_irq_is_routable(intr)) |
| 639 | return -EPERM; | 639 | return -EPERM; |
| 640 | 640 | ||
| 641 | /* | ||
| 642 | * HACK: These are all really percpu interrupts, but the rest | ||
| 643 | * of the MIPS kernel code does not use the percpu IRQ API for | ||
| 644 | * the CP0 timer and performance counter interrupts. | ||
| 645 | */ | ||
| 646 | switch (intr) { | ||
| 647 | case GIC_LOCAL_INT_TIMER: | ||
| 648 | case GIC_LOCAL_INT_PERFCTR: | ||
| 649 | case GIC_LOCAL_INT_FDC: | ||
| 650 | irq_set_chip_and_handler(virq, | ||
| 651 | &gic_all_vpes_local_irq_controller, | ||
| 652 | handle_percpu_irq); | ||
| 653 | break; | ||
| 654 | default: | ||
| 655 | irq_set_chip_and_handler(virq, | ||
| 656 | &gic_local_irq_controller, | ||
| 657 | handle_percpu_devid_irq); | ||
| 658 | irq_set_percpu_devid(virq); | ||
| 659 | break; | ||
| 660 | } | ||
| 661 | |||
| 662 | spin_lock_irqsave(&gic_lock, flags); | 641 | spin_lock_irqsave(&gic_lock, flags); |
| 663 | for (i = 0; i < gic_vpes; i++) { | 642 | for (i = 0; i < gic_vpes; i++) { |
| 664 | u32 val = GIC_MAP_TO_PIN_MSK | gic_cpu_pin; | 643 | u32 val = GIC_MAP_TO_PIN_MSK | gic_cpu_pin; |
| @@ -713,9 +692,6 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, · 48 unmodified lines | |||
| 713 | unsigned long flags; | 692 | unsigned long flags; |
| 714 | int i; | 693 | int i; |
| 715 | 694 | ||
| 716 | irq_set_chip_and_handler(virq, &gic_level_irq_controller, | ||
| 717 | handle_level_irq); | ||
| 718 | |||
| 719 | spin_lock_irqsave(&gic_lock, flags); | 695 | spin_lock_irqsave(&gic_lock, flags); |
| 720 | gic_map_to_pin(intr, gic_cpu_pin); | 696 | gic_map_to_pin(intr, gic_cpu_pin); |
| 721 | gic_map_to_vpe(intr, mips_cm_vp_id(vpe)); | 697 | gic_map_to_vpe(intr, mips_cm_vp_id(vpe)); |
| @@ -727,12 +703,42 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, · 5 unmodified lines | |||
| 727 | return 0; | 703 | return 0; |
| 728 | } | 704 | } |
| 729 | 705 | ||
| 730 | static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq, | 706 | static int gic_setup_dev_chip(struct irq_domain *d, unsigned int virq, |
| 731 | irq_hw_number_t hw) | 707 | unsigned int hwirq) |
| 732 | { | 708 | { |
| 733 | if (GIC_HWIRQ_TO_LOCAL(hw) < GIC_NUM_LOCAL_INTRS) | 709 | struct irq_chip *chip; |
| 734 | return gic_local_irq_domain_map(d, virq, hw); | 710 | int err; |
| 735 | return gic_shared_irq_domain_map(d, virq, hw, 0); | 711 | |
| 712 | if (hwirq >= GIC_SHARED_HWIRQ_BASE) { | ||
| 713 | err = irq_domain_set_hwirq_and_chip(d, virq, hwirq, | ||
| 714 | &gic_level_irq_controller, | ||
| 715 | NULL); | ||
| 716 | } else { | ||
| 717 | switch (GIC_HWIRQ_TO_LOCAL(hwirq)) { | ||
| 718 | case GIC_LOCAL_INT_TIMER: | ||
| 719 | case GIC_LOCAL_INT_PERFCTR: | ||
| 720 | case GIC_LOCAL_INT_FDC: | ||
| 721 | /* | ||
| 722 | * HACK: These are all really percpu interrupts, but | ||
| 723 | * the rest of the MIPS kernel code does not use the | ||
| 724 | * percpu IRQ API for them. | ||
| 725 | */ | ||
| 726 | chip = &gic_all_vpes_local_irq_controller; | ||
| 727 | irq_set_handler(virq, handle_percpu_irq); | ||
| 728 | break; | ||
| 729 | |||
| 730 | default: | ||
| 731 | chip = &gic_local_irq_controller; | ||
| 732 | irq_set_handler(virq, handle_percpu_devid_irq); | ||
| 733 | irq_set_percpu_devid(virq); | ||
| 734 | break; | ||
| 735 | } | ||
| 736 | |||
| 737 | err = irq_domain_set_hwirq_and_chip(d, virq, hwirq, | ||
| 738 | chip, NULL); | ||
| 739 | } | ||
| 740 | |||
| 741 | return err; | ||
| 736 | } | 742 | } |
| 737 | 743 | ||
| 738 | static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, | 744 | static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, |
| @@ -743,15 +749,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, · 4 unmodified lines | |||
| 743 | int cpu, ret, i; | 749 | int cpu, ret, i; |
| 744 | 750 | ||
| 745 | if (spec->type == GIC_DEVICE) { | 751 | if (spec->type == GIC_DEVICE) { |
| 746 | /* verify that it doesn't conflict with an IPI irq */ | 752 | /* verify that shared irqs don't conflict with an IPI irq */ |
| 747 | if (test_bit(spec->hwirq, ipi_resrv)) | 753 | if ((spec->hwirq >= GIC_SHARED_HWIRQ_BASE) && |
| 754 | test_bit(GIC_HWIRQ_TO_SHARED(spec->hwirq), ipi_resrv)) | ||
| 748 | return -EBUSY; | 755 | return -EBUSY; |
| 749 | 756 | ||
| 750 | hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq); | 757 | return gic_setup_dev_chip(d, virq, spec->hwirq); |
| 751 | |||
| 752 | return irq_domain_set_hwirq_and_chip(d, virq, hwirq, | ||
| 753 | &gic_level_irq_controller, | ||
| 754 | NULL); | ||
| 755 | } else { | 758 | } else { |
| 756 | base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs); | 759 | base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs); |
| 757 | if (base_hwirq == gic_shared_intrs) { | 760 | if (base_hwirq == gic_shared_intrs) { |
| @@ -771,11 +774,13 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, · 13 unmodified lines | |||
| 771 | hwirq = GIC_SHARED_TO_HWIRQ(base_hwirq + i); | 774 | hwirq = GIC_SHARED_TO_HWIRQ(base_hwirq + i); |
| 772 | 775 | ||
| 773 | ret = irq_domain_set_hwirq_and_chip(d, virq + i, hwirq, | 776 | ret = irq_domain_set_hwirq_and_chip(d, virq + i, hwirq, |
| 774 | &gic_edge_irq_controller, | 777 | &gic_level_irq_controller, |
| 775 | NULL); | 778 | NULL); |
| 776 | if (ret) | 779 | if (ret) |
| 777 | goto error; | 780 | goto error; |
| 778 | 781 | ||
| 782 | irq_set_handler(virq + i, handle_level_irq); | ||
| 783 | |||
| 779 | ret = gic_shared_irq_domain_map(d, virq + i, hwirq, cpu); | 784 | ret = gic_shared_irq_domain_map(d, virq + i, hwirq, cpu); |
| 780 | if (ret) | 785 | if (ret) |
| 781 | goto error; | 786 | goto error; |
| @@ -818,7 +823,6 @@ int gic_irq_domain_match(struct irq_domain *d, struct device_node *node, · 36 unmodified lines | |||
| 818 | } | 823 | } |
| 819 | 824 | ||
| 820 | static const struct irq_domain_ops gic_irq_domain_ops = { | 825 | static const struct irq_domain_ops gic_irq_domain_ops = { |
| 821 | .map = gic_irq_domain_map, | ||
| 822 | .alloc = gic_irq_domain_alloc, | 826 | .alloc = gic_irq_domain_alloc, |
| 823 | .free = gic_irq_domain_free, | 827 | .free = gic_irq_domain_free, |
| 824 | .match = gic_irq_domain_match, | 828 | .match = gic_irq_domain_match, |
| @@ -849,29 +853,20 @@ static int gic_dev_domain_alloc(struct irq_domain *d, unsigned int virq, · 24 unmodified lines | |||
| 849 | struct irq_fwspec *fwspec = arg; | 853 | struct irq_fwspec *fwspec = arg; |
| 850 | struct gic_irq_spec spec = { | 854 | struct gic_irq_spec spec = { |
| 851 | .type = GIC_DEVICE, | 855 | .type = GIC_DEVICE, |
| 852 | .hwirq = fwspec->param[1], | ||
| 853 | }; | 856 | }; |
| 854 | int i, ret; | 857 | int i, ret; |
| 855 | bool is_shared = fwspec->param[0] == GIC_SHARED; | ||
| 856 | 858 | ||
| 857 | if (is_shared) { | 859 | if (fwspec->param[0] == GIC_SHARED) |
| 858 | ret = irq_domain_alloc_irqs_parent(d, virq, nr_irqs, &spec); | 860 | spec.hwirq = GIC_SHARED_TO_HWIRQ(fwspec->param[1]); |
| 859 | if (ret) | 861 | else |
| 860 | return ret; | 862 | spec.hwirq = GIC_LOCAL_TO_HWIRQ(fwspec->param[1]); |
| 861 | } | ||
| 862 | |||
| 863 | for (i = 0; i < nr_irqs; i++) { | ||
| 864 | irq_hw_number_t hwirq; | ||
| 865 | 863 | ||
| 866 | if (is_shared) | 864 | ret = irq_domain_alloc_irqs_parent(d, virq, nr_irqs, &spec); |
| 867 | hwirq = GIC_SHARED_TO_HWIRQ(spec.hwirq + i); | 865 | if (ret) |
| 868 | else | 866 | return ret; |
| 869 | hwirq = GIC_LOCAL_TO_HWIRQ(spec.hwirq + i); | ||
| 870 | 867 | ||
| 871 | ret = irq_domain_set_hwirq_and_chip(d, virq + i, | 868 | for (i = 0; i < nr_irqs; i++) { |
| 872 | hwirq, | 869 | ret = gic_setup_dev_chip(d, virq + i, spec.hwirq + i); |
| 873 | &gic_level_irq_controller, | ||
| 874 | NULL); | ||
| 875 | if (ret) | 870 | if (ret) |
| 876 | goto error; | 871 | goto error; |
| 877 | } | 872 | } |
| @@ -890,10 +885,20 @@ void gic_dev_domain_free(struct irq_domain *d, unsigned int virq, · 12 unmodified lines | |||
| 890 | return; | 885 | return; |
| 891 | } | 886 | } |
| 892 | 887 | ||
| 888 | static void gic_dev_domain_activate(struct irq_domain *domain, | ||
| 889 | struct irq_data *d) | ||
| 890 | { | ||
| 891 | if (GIC_HWIRQ_TO_LOCAL(d->hwirq) < GIC_NUM_LOCAL_INTRS) | ||
| 892 | gic_local_irq_domain_map(domain, d->irq, d->hwirq); | ||
| 893 | else | ||
| 894 | gic_shared_irq_domain_map(domain, d->irq, d->hwirq, 0); | ||
| 895 | } | ||
| 896 | |||
| 893 | static struct irq_domain_ops gic_dev_domain_ops = { | 897 | static struct irq_domain_ops gic_dev_domain_ops = { |
| 894 | .xlate = gic_dev_domain_xlate, | 898 | .xlate = gic_dev_domain_xlate, |
| 895 | .alloc = gic_dev_domain_alloc, | 899 | .alloc = gic_dev_domain_alloc, |
| 896 | .free = gic_dev_domain_free, | 900 | .free = gic_dev_domain_free, |
| 901 | .activate = gic_dev_domain_activate, | ||
| 897 | }; | 902 | }; |
| 898 | 903 | ||
| 899 | static int gic_ipi_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, | 904 | static int gic_ipi_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, |
| @@ -73,7 +73,6 @@ MODULE_DEVICE_TABLE(i2c, ams_id); · 72 unmodified lines | |||
| 73 | static struct i2c_driver ams_i2c_driver = { | 73 | static struct i2c_driver ams_i2c_driver = { |
| 74 | .driver = { | 74 | .driver = { |
| 75 | .name = "ams", | 75 | .name = "ams", |
| 76 | .owner = THIS_MODULE, | ||
| 77 | }, | 76 | }, |
| 78 | .probe = ams_i2c_probe, | 77 | .probe = ams_i2c_probe, |
| 79 | .remove = ams_i2c_remove, | 78 | .remove = ams_i2c_remove, |
| @@ -668,7 +668,6 @@ static struct platform_driver wf_pm112_driver = { · 667 unmodified lines | |||
| 668 | .remove = wf_pm112_remove, | 668 | .remove = wf_pm112_remove, |
| 669 | .driver = { | 669 | .driver = { |
| 670 | .name = "windfarm", | 670 | .name = "windfarm", |
| 671 | .owner = THIS_MODULE, | ||
| 672 | }, | 671 | }, |
| 673 | }; | 672 | }; |
| 674 | 673 | ||
| @@ -789,7 +789,6 @@ static struct platform_driver wf_pm72_driver = { · 788 unmodified lines | |||
| 789 | .remove = wf_pm72_remove, | 789 | .remove = wf_pm72_remove, |
| 790 | .driver = { | 790 | .driver = { |
| 791 | .name = "windfarm", | 791 | .name = "windfarm", |
| 792 | .owner = THIS_MODULE, | ||
| 793 | }, | 792 | }, |
| 794 | }; | 793 | }; |
| 795 | 794 | ||
| @@ -682,7 +682,6 @@ static struct platform_driver wf_rm31_driver = { · 681 unmodified lines | |||
| 682 | .remove = wf_rm31_remove, | 682 | .remove = wf_rm31_remove, |
| 683 | .driver = { | 683 | .driver = { |
| 684 | .name = "windfarm", | 684 | .name = "windfarm", |
| 685 | .owner = THIS_MODULE, | ||
| 686 | }, | 685 | }, |
| 687 | }; | 686 | }; |
| 688 | 687 | ||
| @@ -127,6 +127,7 @@ config XGENE_SLIMPRO_MBOX · 126 unmodified lines | |||
| 127 | config BCM_PDC_MBOX | 127 | config BCM_PDC_MBOX |
| 128 | tristate "Broadcom PDC Mailbox" | 128 | tristate "Broadcom PDC Mailbox" |
| 129 | depends on ARM64 || COMPILE_TEST | 129 | depends on ARM64 || COMPILE_TEST |
| 130 | depends on HAS_DMA | ||
| 130 | default ARCH_BCM_IPROC | 131 | default ARCH_BCM_IPROC |
| 131 | help | 132 | help |
| 132 | Mailbox implementation for the Broadcom PDC ring manager, | 133 | Mailbox implementation for the Broadcom PDC ring manager, |
| @@ -469,7 +469,7 @@ static const struct file_operations pdc_debugfs_stats = { · 468 unmodified lines | |||
| 469 | * this directory for a SPU. | 469 | * this directory for a SPU. |
| 470 | * @pdcs: PDC state structure | 470 | * @pdcs: PDC state structure |
| 471 | */ | 471 | */ |
| 472 | void pdc_setup_debugfs(struct pdc_state *pdcs) | 472 | static void pdc_setup_debugfs(struct pdc_state *pdcs) |
| 473 | { | 473 | { |
| 474 | char spu_stats_name[16]; | 474 | char spu_stats_name[16]; |
| 475 | 475 | ||
| @@ -485,7 +485,7 @@ void pdc_setup_debugfs(struct pdc_state *pdcs) · 9 unmodified lines | |||
| 485 | &pdc_debugfs_stats); | 485 | &pdc_debugfs_stats); |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | void pdc_free_debugfs(void) | 488 | static void pdc_free_debugfs(void) |
| 489 | { | 489 | { |
| 490 | if (debugfs_dir && simple_empty(debugfs_dir)) { | 490 | if (debugfs_dir && simple_empty(debugfs_dir)) { |
| 491 | debugfs_remove_recursive(debugfs_dir); | 491 | debugfs_remove_recursive(debugfs_dir); |
| @@ -1191,10 +1191,11 @@ static void pdc_shutdown(struct mbox_chan *chan) · 699 unmodified lines | |||
| 1191 | { | 1191 | { |
| 1192 | struct pdc_state *pdcs = chan->con_priv; | 1192 | struct pdc_state *pdcs = chan->con_priv; |
| 1193 | 1193 | ||
| 1194 | if (pdcs) | 1194 | if (!pdcs) |
| 1195 | dev_dbg(&pdcs->pdev->dev, | 1195 | return; |
| 1196 | "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx); | ||
| 1197 | 1196 | ||
| 1197 | dev_dbg(&pdcs->pdev->dev, | ||
| 1198 | "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx); | ||
| 1198 | pdc_ring_free(pdcs); | 1199 | pdc_ring_free(pdcs); |
| 1199 | } | 1200 | } |
| 1200 | 1201 | ||
| @@ -760,7 +760,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, · 759 unmodified lines | |||
| 760 | if (!d->nr_stripes || | 760 | if (!d->nr_stripes || |
| 761 | d->nr_stripes > INT_MAX || | 761 | d->nr_stripes > INT_MAX || |
| 762 | d->nr_stripes > SIZE_MAX / sizeof(atomic_t)) { | 762 | d->nr_stripes > SIZE_MAX / sizeof(atomic_t)) { |
| 763 | pr_err("nr_stripes too large"); | 763 | pr_err("nr_stripes too large or invalid: %u (start sector beyond end of disk?)", |
| 764 | (unsigned)d->nr_stripes); | ||
| 764 | return -ENOMEM; | 765 | return -ENOMEM; |
| 765 | } | 766 | } |
| 766 | 767 | ||
| @@ -1820,7 +1821,7 @@ static int cache_alloc(struct cache *ca) · 1053 unmodified lines | |||
| 1820 | free = roundup_pow_of_two(ca->sb.nbuckets) >> 10; | 1821 | free = roundup_pow_of_two(ca->sb.nbuckets) >> 10; |
| 1821 | 1822 | ||
| 1822 | if (!init_fifo(&ca->free[RESERVE_BTREE], 8, GFP_KERNEL) || | 1823 | if (!init_fifo(&ca->free[RESERVE_BTREE], 8, GFP_KERNEL) || |
| 1823 | !init_fifo(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) || | 1824 | !init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) || |
| 1824 | !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) || | 1825 | !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) || |
| 1825 | !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) || | 1826 | !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) || |
| 1826 | !init_fifo(&ca->free_inc, free << 2, GFP_KERNEL) || | 1827 | !init_fifo(&ca->free_inc, free << 2, GFP_KERNEL) || |
| @@ -1844,7 +1845,7 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page, · 17 unmodified lines | |||
| 1844 | struct block_device *bdev, struct cache *ca) | 1845 | struct block_device *bdev, struct cache *ca) |
| 1845 | { | 1846 | { |
| 1846 | char name[BDEVNAME_SIZE]; | 1847 | char name[BDEVNAME_SIZE]; |
| 1847 | const char *err = NULL; | 1848 | const char *err = NULL; /* must be set for any error case */ |
| 1848 | int ret = 0; | 1849 | int ret = 0; |
| 1849 | 1850 | ||
| 1850 | memcpy(&ca->sb, sb, sizeof(struct cache_sb)); | 1851 | memcpy(&ca->sb, sb, sizeof(struct cache_sb)); |
| @@ -1861,8 +1862,13 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page, · 10 unmodified lines | |||
| 1861 | ca->discard = CACHE_DISCARD(&ca->sb); | 1862 | ca->discard = CACHE_DISCARD(&ca->sb); |
| 1862 | 1863 | ||
| 1863 | ret = cache_alloc(ca); | 1864 | ret = cache_alloc(ca); |
| 1864 | if (ret != 0) | 1865 | if (ret != 0) { |
| 1866 | if (ret == -ENOMEM) | ||
| 1867 | err = "cache_alloc(): -ENOMEM"; | ||
| 1868 | else | ||
| 1869 | err = "cache_alloc(): unknown error"; | ||
| 1865 | goto err; | 1870 | goto err; |
| 1871 | } | ||
| 1866 | 1872 | ||
| 1867 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) { | 1873 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) { |
| 1868 | err = "error calling kobject_add"; | 1874 | err = "error calling kobject_add"; |
| @@ -2183,19 +2183,29 @@ location_show(struct mddev *mddev, char *page) · 2182 unmodified lines | |||
| 2183 | static ssize_t | 2183 | static ssize_t |
| 2184 | location_store(struct mddev *mddev, const char *buf, size_t len) | 2184 | location_store(struct mddev *mddev, const char *buf, size_t len) |
| 2185 | { | 2185 | { |
| 2186 | int rv; | ||
| 2186 | 2187 | ||
| 2188 | rv = mddev_lock(mddev); | ||
| 2189 | if (rv) | ||
| 2190 | return rv; | ||
| 2187 | if (mddev->pers) { | 2191 | if (mddev->pers) { |
| 2188 | if (!mddev->pers->quiesce) | 2192 | if (!mddev->pers->quiesce) { |
| 2189 | return -EBUSY; | 2193 | rv = -EBUSY; |
| 2190 | if (mddev->recovery || mddev->sync_thread) | 2194 | goto out; |
| 2191 | return -EBUSY; | 2195 | } |
| 2196 | if (mddev->recovery || mddev->sync_thread) { | ||
| 2197 | rv = -EBUSY; | ||
| 2198 | goto out; | ||
| 2199 | } | ||
| 2192 | } | 2200 | } |
| 2193 | 2201 | ||
| 2194 | if (mddev->bitmap || mddev->bitmap_info.file || | 2202 | if (mddev->bitmap || mddev->bitmap_info.file || |
| 2195 | mddev->bitmap_info.offset) { | 2203 | mddev->bitmap_info.offset) { |
| 2196 | /* bitmap already configured. Only option is to clear it */ | 2204 | /* bitmap already configured. Only option is to clear it */ |
| 2197 | if (strncmp(buf, "none", 4) != 0) | 2205 | if (strncmp(buf, "none", 4) != 0) { |
| 2198 | return -EBUSY; | 2206 | rv = -EBUSY; |
| 2207 | goto out; | ||
| 2208 | } | ||
| 2199 | if (mddev->pers) { | 2209 | if (mddev->pers) { |
| 2200 | mddev->pers->quiesce(mddev, 1); | 2210 | mddev->pers->quiesce(mddev, 1); |
| 2201 | bitmap_destroy(mddev); | 2211 | bitmap_destroy(mddev); |
| @@ -2214,21 +2224,25 @@ location_store(struct mddev *mddev, const char *buf, size_t len) · 12 unmodified lines | |||
| 2214 | /* nothing to be done */; | 2224 | /* nothing to be done */; |
| 2215 | else if (strncmp(buf, "file:", 5) == 0) { | 2225 | else if (strncmp(buf, "file:", 5) == 0) { |
| 2216 | /* Not supported yet */ | 2226 | /* Not supported yet */ |
| 2217 | return -EINVAL; | 2227 | rv = -EINVAL; |
| 2228 | goto out; | ||
| 2218 | } else { | 2229 | } else { |
| 2219 | int rv; | ||
| 2220 | if (buf[0] == '+') | 2230 | if (buf[0] == '+') |
| 2221 | rv = kstrtoll(buf+1, 10, &offset); | 2231 | rv = kstrtoll(buf+1, 10, &offset); |
| 2222 | else | 2232 | else |
| 2223 | rv = kstrtoll(buf, 10, &offset); | 2233 | rv = kstrtoll(buf, 10, &offset); |
| 2224 | if (rv) | 2234 | if (rv) |
| 2225 | return rv; | 2235 | goto out; |
| 2226 | if (offset == 0) | 2236 | if (offset == 0) { |
| 2227 | return -EINVAL; | 2237 | rv = -EINVAL; |
| 2238 | goto out; | ||
| 2239 | } | ||
| 2228 | if (mddev->bitmap_info.external == 0 && | 2240 | if (mddev->bitmap_info.external == 0 && |
| 2229 | mddev->major_version == 0 && | 2241 | mddev->major_version == 0 && |
| 2230 | offset != mddev->bitmap_info.default_offset) | 2242 | offset != mddev->bitmap_info.default_offset) { |
| 2231 | return -EINVAL; | 2243 | rv = -EINVAL; |
| 2244 | goto out; | ||
| 2245 | } | ||
| 2232 | mddev->bitmap_info.offset = offset; | 2246 | mddev->bitmap_info.offset = offset; |
| 2233 | if (mddev->pers) { | 2247 | if (mddev->pers) { |
| 2234 | struct bitmap *bitmap; | 2248 | struct bitmap *bitmap; |
| @@ -2245,7 +2259,7 @@ location_store(struct mddev *mddev, const char *buf, size_t len) · 10 unmodified lines | |||
| 2245 | mddev->pers->quiesce(mddev, 0); | 2259 | mddev->pers->quiesce(mddev, 0); |
| 2246 | if (rv) { | 2260 | if (rv) { |
| 2247 | bitmap_destroy(mddev); | 2261 | bitmap_destroy(mddev); |
| 2248 | return rv; | 2262 | goto out; |
| 2249 | } | 2263 | } |
| 2250 | } | 2264 | } |
| 2251 | } | 2265 | } |
| @@ -2257,6 +2271,11 @@ location_store(struct mddev *mddev, const char *buf, size_t len) · 5 unmodified lines | |||
| 2257 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 2271 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
| 2258 | md_wakeup_thread(mddev->thread); | 2272 | md_wakeup_thread(mddev->thread); |
| 2259 | } | 2273 | } |
| 2274 | rv = 0; | ||
| 2275 | out: | ||
| 2276 | mddev_unlock(mddev); | ||
| 2277 | if (rv) | ||
| 2278 | return rv; | ||
| 2260 | return len; | 2279 | return len; |
| 2261 | } | 2280 | } |
| 2262 | 2281 | ||
| @@ -1879,7 +1879,7 @@ static int __init dm_bufio_init(void) · 1878 unmodified lines | |||
| 1879 | __cache_size_refresh(); | 1879 | __cache_size_refresh(); |
| 1880 | mutex_unlock(&dm_bufio_clients_lock); | 1880 | mutex_unlock(&dm_bufio_clients_lock); |
| 1881 | 1881 | ||
| 1882 | dm_bufio_wq = create_singlethread_workqueue("dm_bufio_cache"); | 1882 | dm_bufio_wq = alloc_workqueue("dm_bufio_cache", WQ_MEM_RECLAIM, 0); |
| 1883 | if (!dm_bufio_wq) | 1883 | if (!dm_bufio_wq) |
| 1884 | return -ENOMEM; | 1884 | return -ENOMEM; |
| 1885 | 1885 | ||
| @@ -1453,7 +1453,7 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode) · 1452 unmodified lines | |||
| 1453 | unsigned i; | 1453 | unsigned i; |
| 1454 | int err; | 1454 | int err; |
| 1455 | 1455 | ||
| 1456 | cc->tfms = kmalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), | 1456 | cc->tfms = kzalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), |
| 1457 | GFP_KERNEL); | 1457 | GFP_KERNEL); |
| 1458 | if (!cc->tfms) | 1458 | if (!cc->tfms) |
| 1459 | return -ENOMEM; | 1459 | return -ENOMEM; |
| @@ -1924,6 +1924,13 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) · 464 unmodified lines | |||
| 1924 | return DM_MAPIO_REMAPPED; | 1924 | return DM_MAPIO_REMAPPED; |
| 1925 | } | 1925 | } |
| 1926 | 1926 | ||
| 1927 | /* | ||
| 1928 | * Check if bio is too large, split as needed. | ||
| 1929 | */ | ||
| 1930 | if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) && | ||
| 1931 | bio_data_dir(bio) == WRITE) | ||
| 1932 | dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT)); | ||
| 1933 | |||
| 1927 | io = dm_per_bio_data(bio, cc->per_bio_data_size); | 1934 | io = dm_per_bio_data(bio, cc->per_bio_data_size); |
| 1928 | crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector)); | 1935 | crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector)); |
| 1929 | io->ctx.req = (struct skcipher_request *)(io + 1); | 1936 | io->ctx.req = (struct skcipher_request *)(io + 1); |
| @@ -289,15 +289,13 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) · 288 unmodified lines | |||
| 289 | pb->bio_submitted = true; | 289 | pb->bio_submitted = true; |
| 290 | 290 | ||
| 291 | /* | 291 | /* |
| 292 | * Map reads as normal only if corrupt_bio_byte set. | 292 | * Error reads if neither corrupt_bio_byte or drop_writes are set. |
| 293 | * Otherwise, flakey_end_io() will decide if the reads should be modified. | ||
| 293 | */ | 294 | */ |
| 294 | if (bio_data_dir(bio) == READ) { | 295 | if (bio_data_dir(bio) == READ) { |
| 295 | /* If flags were specified, only corrupt those that match. */ | 296 | if (!fc->corrupt_bio_byte && !test_bit(DROP_WRITES, &fc->flags)) |
| 296 | if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && | ||
| 297 | all_corrupt_bio_flags_match(bio, fc)) | ||
| 298 | goto map_bio; | ||
| 299 | else | ||
| 300 | return -EIO; | 297 | return -EIO; |
| 298 | goto map_bio; | ||
| 301 | } | 299 | } |
| 302 | 300 | ||
| 303 | /* | 301 | /* |
| @@ -334,14 +332,21 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) · 30 unmodified lines | |||
| 334 | struct flakey_c *fc = ti->private; | 332 | struct flakey_c *fc = ti->private; |
| 335 | struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); | 333 | struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); |
| 336 | 334 | ||
| 337 | /* | ||
| 338 | * Corrupt successful READs while in down state. | ||
| 339 | */ | ||
| 340 | if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { | 335 | if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { |
| 341 | if (fc->corrupt_bio_byte) | 336 | if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && |
| 337 | all_corrupt_bio_flags_match(bio, fc)) { | ||
| 338 | /* | ||
| 339 | * Corrupt successful matching READs while in down state. | ||
| 340 | */ | ||
| 342 | corrupt_bio_data(bio, fc); | 341 | corrupt_bio_data(bio, fc); |
| 343 | else | 342 | |
| 343 | } else if (!test_bit(DROP_WRITES, &fc->flags)) { | ||
| 344 | /* | ||
| 345 | * Error read during the down_interval if drop_writes | ||
| 346 | * wasn't configured. | ||
| 347 | */ | ||
| 344 | return -EIO; | 348 | return -EIO; |
| 349 | } | ||
| 345 | } | 350 | } |
| 346 | 351 | ||
| 347 | return error; | 352 | return error; |
| @@ -259,12 +259,12 @@ static int log_one_block(struct log_writes_c *lc, · 258 unmodified lines | |||
| 259 | goto out; | 259 | goto out; |
| 260 | sector++; | 260 | sector++; |
| 261 | 261 | ||
| 262 | bio = bio_alloc(GFP_KERNEL, block->vec_cnt); | 262 | atomic_inc(&lc->io_blocks); |
| 263 | bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt, BIO_MAX_PAGES)); | ||
| 263 | if (!bio) { | 264 | if (!bio) { |
| 264 | DMERR("Couldn't alloc log bio"); | 265 | DMERR("Couldn't alloc log bio"); |
| 265 | goto error; | 266 | goto error; |
| 266 | } | 267 | } |
| 267 | atomic_inc(&lc->io_blocks); | ||
| 268 | bio->bi_iter.bi_size = 0; | 268 | bio->bi_iter.bi_size = 0; |
| 269 | bio->bi_iter.bi_sector = sector; | 269 | bio->bi_iter.bi_sector = sector; |
| 270 | bio->bi_bdev = lc->logdev->bdev; | 270 | bio->bi_bdev = lc->logdev->bdev; |
| @@ -282,7 +282,7 @@ static int log_one_block(struct log_writes_c *lc, · 11 unmodified lines | |||
| 282 | if (ret != block->vecs[i].bv_len) { | 282 | if (ret != block->vecs[i].bv_len) { |
| 283 | atomic_inc(&lc->io_blocks); | 283 | atomic_inc(&lc->io_blocks); |
| 284 | submit_bio(bio); | 284 | submit_bio(bio); |
| 285 | bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i); | 285 | bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt - i, BIO_MAX_PAGES)); |
| 286 | if (!bio) { | 286 | if (!bio) { |
| 287 | DMERR("Couldn't alloc log bio"); | 287 | DMERR("Couldn't alloc log bio"); |
| 288 | goto error; | 288 | goto error; |
| @@ -459,9 +459,9 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 170 unmodified lines | |||
| 459 | goto bad; | 459 | goto bad; |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | ret = -EINVAL; | ||
| 463 | lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); | 462 | lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); |
| 464 | if (!lc->log_kthread) { | 463 | if (IS_ERR(lc->log_kthread)) { |
| 464 | ret = PTR_ERR(lc->log_kthread); | ||
| 465 | ti->error = "Couldn't alloc kthread"; | 465 | ti->error = "Couldn't alloc kthread"; |
| 466 | dm_put_device(ti, lc->dev); | 466 | dm_put_device(ti, lc->dev); |
| 467 | dm_put_device(ti, lc->logdev); | 467 | dm_put_device(ti, lc->logdev); |
| @@ -291,9 +291,10 @@ static void header_from_disk(struct log_header_core *core, struct log_header_dis · 290 unmodified lines | |||
| 291 | core->nr_regions = le64_to_cpu(disk->nr_regions); | 291 | core->nr_regions = le64_to_cpu(disk->nr_regions); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | static int rw_header(struct log_c *lc, int rw) | 294 | static int rw_header(struct log_c *lc, int op) |
| 295 | { | 295 | { |
| 296 | lc->io_req.bi_op = rw; | 296 | lc->io_req.bi_op = op; |
| 297 | lc->io_req.bi_op_flags = 0; | ||
| 297 | 298 | ||
| 298 | return dm_io(&lc->io_req, 1, &lc->header_location, NULL); | 299 | return dm_io(&lc->io_req, 1, &lc->header_location, NULL); |
| 299 | } | 300 | } |
| @@ -316,7 +317,7 @@ static int read_header(struct log_c *log) · 16 unmodified lines | |||
| 316 | { | 317 | { |
| 317 | int r; | 318 | int r; |
| 318 | 319 | ||
| 319 | r = rw_header(log, READ); | 320 | r = rw_header(log, REQ_OP_READ); |
| 320 | if (r) | 321 | if (r) |
| 321 | return r; | 322 | return r; |
| 322 | 323 | ||
| @@ -630,7 +631,7 @@ static int disk_resume(struct dm_dirty_log *log) · 307 unmodified lines | |||
| 630 | header_to_disk(&lc->header, lc->disk_header); | 631 | header_to_disk(&lc->header, lc->disk_header); |
| 631 | 632 | ||
| 632 | /* write the new header */ | 633 | /* write the new header */ |
| 633 | r = rw_header(lc, WRITE); | 634 | r = rw_header(lc, REQ_OP_WRITE); |
| 634 | if (!r) { | 635 | if (!r) { |
| 635 | r = flush_header(lc); | 636 | r = flush_header(lc); |
| 636 | if (r) | 637 | if (r) |
| @@ -698,7 +699,7 @@ static int disk_flush(struct dm_dirty_log *log) · 61 unmodified lines | |||
| 698 | log_clear_bit(lc, lc->clean_bits, i); | 699 | log_clear_bit(lc, lc->clean_bits, i); |
| 699 | } | 700 | } |
| 700 | 701 | ||
| 701 | r = rw_header(lc, WRITE); | 702 | r = rw_header(lc, REQ_OP_WRITE); |
| 702 | if (r) | 703 | if (r) |
| 703 | fail_log_device(lc); | 704 | fail_log_device(lc); |
| 704 | else { | 705 | else { |
| @@ -834,8 +834,10 @@ static int join(struct mddev *mddev, int nodes) · 833 unmodified lines | |||
| 834 | goto err; | 834 | goto err; |
| 835 | } | 835 | } |
| 836 | cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0); | 836 | cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0); |
| 837 | if (!cinfo->ack_lockres) | 837 | if (!cinfo->ack_lockres) { |
| 838 | ret = -ENOMEM; | ||
| 838 | goto err; | 839 | goto err; |
| 840 | } | ||
| 839 | /* get sync CR lock on ACK. */ | 841 | /* get sync CR lock on ACK. */ |
| 840 | if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR)) | 842 | if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR)) |
| 841 | pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n", | 843 | pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n", |
| @@ -849,8 +851,10 @@ static int join(struct mddev *mddev, int nodes) · 7 unmodified lines | |||
| 849 | pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number); | 851 | pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number); |
| 850 | snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1); | 852 | snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1); |
| 851 | cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1); | 853 | cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1); |
| 852 | if (!cinfo->bitmap_lockres) | 854 | if (!cinfo->bitmap_lockres) { |
| 855 | ret = -ENOMEM; | ||
| 853 | goto err; | 856 | goto err; |
| 857 | } | ||
| 854 | if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) { | 858 | if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) { |
| 855 | pr_err("Failed to get bitmap lock\n"); | 859 | pr_err("Failed to get bitmap lock\n"); |
| 856 | ret = -EINVAL; | 860 | ret = -EINVAL; |
| @@ -858,8 +862,10 @@ static int join(struct mddev *mddev, int nodes) · 1 unmodified line | |||
| 858 | } | 862 | } |
| 859 | 863 | ||
| 860 | cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0); | 864 | cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0); |
| 861 | if (!cinfo->resync_lockres) | 865 | if (!cinfo->resync_lockres) { |
| 866 | ret = -ENOMEM; | ||
| 862 | goto err; | 867 | goto err; |
| 868 | } | ||
| 863 | 869 | ||
| 864 | return 0; | 870 | return 0; |
| 865 | err: | 871 | err: |
| @@ -1604,11 +1604,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) · 1603 unmodified lines | |||
| 1604 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 1604 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| 1607 | if (le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL) { | 1607 | if (le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL) |
| 1608 | set_bit(MD_HAS_JOURNAL, &mddev->flags); | 1608 | set_bit(MD_HAS_JOURNAL, &mddev->flags); |
| 1609 | if (mddev->recovery_cp == MaxSector) | ||
| 1610 | set_bit(MD_JOURNAL_CLEAN, &mddev->flags); | ||
| 1611 | } | ||
| 1612 | } else if (mddev->pers == NULL) { | 1609 | } else if (mddev->pers == NULL) { |
| 1613 | /* Insist of good event counter while assembling, except for | 1610 | /* Insist of good event counter while assembling, except for |
| 1614 | * spares (which don't need an event count) */ | 1611 | * spares (which don't need an event count) */ |
| @@ -5851,6 +5848,9 @@ static int get_array_info(struct mddev *mddev, void __user *arg) · 4236 unmodified lines | |||
| 5851 | working++; | 5848 | working++; |
| 5852 | if (test_bit(In_sync, &rdev->flags)) | 5849 | if (test_bit(In_sync, &rdev->flags)) |
| 5853 | insync++; | 5850 | insync++; |
| 5851 | else if (test_bit(Journal, &rdev->flags)) | ||
| 5852 | /* TODO: add journal count to md_u.h */ | ||
| 5853 | ; | ||
| 5854 | else | 5854 | else |
| 5855 | spare++; | 5855 | spare++; |
| 5856 | } | 5856 | } |
| @@ -7610,16 +7610,12 @@ EXPORT_SYMBOL(unregister_md_cluster_operations); · 1753 unmodified lines | |||
| 7610 | 7610 | ||
| 7611 | int md_setup_cluster(struct mddev *mddev, int nodes) | 7611 | int md_setup_cluster(struct mddev *mddev, int nodes) |
| 7612 | { | 7612 | { |
| 7613 | int err; | 7613 | if (!md_cluster_ops) |
| 7614 | 7614 | request_module("md-cluster"); | |
| 7615 | err = request_module("md-cluster"); | ||
| 7616 | if (err) { | ||
| 7617 | pr_err("md-cluster module not found.\n"); | ||
| 7618 | return -ENOENT; | ||
| 7619 | } | ||
| 7620 | |||
| 7621 | spin_lock(&pers_lock); | 7615 | spin_lock(&pers_lock); |
| 7616 | /* ensure module won't be unloaded */ | ||
| 7622 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { | 7617 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { |
| 7618 | pr_err("can't find md-cluster module or get it's reference.\n"); | ||
| 7623 | spin_unlock(&pers_lock); | 7619 | spin_unlock(&pers_lock); |
| 7624 | return -ENOENT; | 7620 | return -ENOENT; |
| 7625 | } | 7621 | } |
| @@ -7862,6 +7858,7 @@ void md_do_sync(struct md_thread *thread) · 236 unmodified lines | |||
| 7862 | */ | 7858 | */ |
| 7863 | 7859 | ||
| 7864 | do { | 7860 | do { |
| 7861 | int mddev2_minor = -1; | ||
| 7865 | mddev->curr_resync = 2; | 7862 | mddev->curr_resync = 2; |
| 7866 | 7863 | ||
| 7867 | try_again: | 7864 | try_again: |
| @@ -7891,10 +7888,14 @@ void md_do_sync(struct md_thread *thread) · 23 unmodified lines | |||
| 7891 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); | 7888 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); |
| 7892 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) && | 7889 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) && |
| 7893 | mddev2->curr_resync >= mddev->curr_resync) { | 7890 | mddev2->curr_resync >= mddev->curr_resync) { |
| 7894 | printk(KERN_INFO "md: delaying %s of %s" | 7891 | if (mddev2_minor != mddev2->md_minor) { |
| 7895 | " until %s has finished (they" | 7892 | mddev2_minor = mddev2->md_minor; |
| 7896 | " share one or more physical units)\n", | 7893 | printk(KERN_INFO "md: delaying %s of %s" |
| 7897 | desc, mdname(mddev), mdname(mddev2)); | 7894 | " until %s has finished (they" |
| 7895 | " share one or more physical units)\n", | ||
| 7896 | desc, mdname(mddev), | ||
| 7897 | mdname(mddev2)); | ||
| 7898 | } | ||
| 7898 | mddev_put(mddev2); | 7899 | mddev_put(mddev2); |
| 7899 | if (signal_pending(current)) | 7900 | if (signal_pending(current)) |
| 7900 | flush_signals(current); | 7901 | flush_signals(current); |
| @@ -8275,16 +8276,13 @@ no_add: · 374 unmodified lines | |||
| 8275 | static void md_start_sync(struct work_struct *ws) | 8276 | static void md_start_sync(struct work_struct *ws) |
| 8276 | { | 8277 | { |
| 8277 | struct mddev *mddev = container_of(ws, struct mddev, del_work); | 8278 | struct mddev *mddev = container_of(ws, struct mddev, del_work); |
| 8278 | int ret = 0; | ||
| 8279 | 8279 | ||
| 8280 | mddev->sync_thread = md_register_thread(md_do_sync, | 8280 | mddev->sync_thread = md_register_thread(md_do_sync, |
| 8281 | mddev, | 8281 | mddev, |
| 8282 | "resync"); | 8282 | "resync"); |
| 8283 | if (!mddev->sync_thread) { | 8283 | if (!mddev->sync_thread) { |
| 8284 | if (!(mddev_is_clustered(mddev) && ret == -EAGAIN)) | 8284 | printk(KERN_ERR "%s: could not start resync thread...\n", |
| 8285 | printk(KERN_ERR "%s: could not start resync" | 8285 | mdname(mddev)); |
| 8286 | " thread...\n", | ||
| 8287 | mdname(mddev)); | ||
| 8288 | /* leave the spares where they are, it shouldn't hurt */ | 8286 | /* leave the spares where they are, it shouldn't hurt */ |
| 8289 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 8287 | clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
| 8290 | clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); | 8288 | clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); |
| @@ -1064,6 +1064,8 @@ static void __make_request(struct mddev *mddev, struct bio *bio) · 1063 unmodified lines | |||
| 1064 | int max_sectors; | 1064 | int max_sectors; |
| 1065 | int sectors; | 1065 | int sectors; |
| 1066 | 1066 | ||
| 1067 | md_write_start(mddev, bio); | ||
| 1068 | |||
| 1067 | /* | 1069 | /* |
| 1068 | * Register the new request and wait if the reconstruction | 1070 | * Register the new request and wait if the reconstruction |
| 1069 | * thread has put up a bar for new requests. | 1071 | * thread has put up a bar for new requests. |
| @@ -1445,8 +1447,6 @@ static void raid10_make_request(struct mddev *mddev, struct bio *bio) · 375 unmodified lines | |||
| 1445 | return; | 1447 | return; |
| 1446 | } | 1448 | } |
| 1447 | 1449 | ||
| 1448 | md_write_start(mddev, bio); | ||
| 1449 | |||
| 1450 | do { | 1450 | do { |
| 1451 | 1451 | ||
| 1452 | /* | 1452 | /* |
| @@ -2465,20 +2465,21 @@ static int narrow_write_error(struct r10bio *r10_bio, int i) · 1012 unmodified lines | |||
| 2465 | 2465 | ||
| 2466 | while (sect_to_write) { | 2466 | while (sect_to_write) { |
| 2467 | struct bio *wbio; | 2467 | struct bio *wbio; |
| 2468 | sector_t wsector; | ||
| 2468 | if (sectors > sect_to_write) | 2469 | if (sectors > sect_to_write) |
| 2469 | sectors = sect_to_write; | 2470 | sectors = sect_to_write; |
| 2470 | /* Write at 'sector' for 'sectors' */ | 2471 | /* Write at 'sector' for 'sectors' */ |
| 2471 | wbio = bio_clone_mddev(bio, GFP_NOIO, mddev); | 2472 | wbio = bio_clone_mddev(bio, GFP_NOIO, mddev); |
| 2472 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); | 2473 | bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors); |
| 2473 | wbio->bi_iter.bi_sector = (r10_bio->devs[i].addr+ | 2474 | wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector); |
| 2474 | choose_data_offset(r10_bio, rdev) + | 2475 | wbio->bi_iter.bi_sector = wsector + |
| 2475 | (sector - r10_bio->sector)); | 2476 | choose_data_offset(r10_bio, rdev); |
| 2476 | wbio->bi_bdev = rdev->bdev; | 2477 | wbio->bi_bdev = rdev->bdev; |
| 2477 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); | 2478 | bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
| 2478 | 2479 | ||
| 2479 | if (submit_bio_wait(wbio) < 0) | 2480 | if (submit_bio_wait(wbio) < 0) |
| 2480 | /* Failure! */ | 2481 | /* Failure! */ |
| 2481 | ok = rdev_set_badblocks(rdev, sector, | 2482 | ok = rdev_set_badblocks(rdev, wsector, |
| 2482 | sectors, 0) | 2483 | sectors, 0) |
| 2483 | && ok; | 2484 | && ok; |
| 2484 | 2485 | ||
| @@ -96,7 +96,6 @@ struct r5l_log { · 95 unmodified lines | |||
| 96 | spinlock_t no_space_stripes_lock; | 96 | spinlock_t no_space_stripes_lock; |
| 97 | 97 | ||
| 98 | bool need_cache_flush; | 98 | bool need_cache_flush; |
| 99 | bool in_teardown; | ||
| 100 | }; | 99 | }; |
| 101 | 100 | ||
| 102 | /* | 101 | /* |
| @@ -704,31 +703,22 @@ static void r5l_write_super_and_discard_space(struct r5l_log *log, · 601 unmodified lines | |||
| 704 | 703 | ||
| 705 | mddev = log->rdev->mddev; | 704 | mddev = log->rdev->mddev; |
| 706 | /* | 705 | /* |
| 707 | * This is to avoid a deadlock. r5l_quiesce holds reconfig_mutex and | 706 | * Discard could zero data, so before discard we must make sure |
| 708 | * wait for this thread to finish. This thread waits for | 707 | * superblock is updated to new log tail. Updating superblock (either |
| 709 | * MD_CHANGE_PENDING clear, which is supposed to be done in | 708 | * directly call md_update_sb() or depend on md thread) must hold |
| 710 | * md_check_recovery(). md_check_recovery() tries to get | 709 | * reconfig mutex. On the other hand, raid5_quiesce is called with |
| 711 | * reconfig_mutex. Since r5l_quiesce already holds the mutex, | 710 | * reconfig_mutex hold. The first step of raid5_quiesce() is waitting |
| 712 | * md_check_recovery() fails, so the PENDING never get cleared. The | 711 | * for all IO finish, hence waitting for reclaim thread, while reclaim |
| 713 | * in_teardown check workaround this issue. | 712 | * thread is calling this function and waitting for reconfig mutex. So |
| 713 | * there is a deadlock. We workaround this issue with a trylock. | ||
| 714 | * FIXME: we could miss discard if we can't take reconfig mutex | ||
| 714 | */ | 715 | */ |
| 715 | if (!log->in_teardown) { | 716 | set_mask_bits(&mddev->flags, 0, |
| 716 | set_mask_bits(&mddev->flags, 0, | 717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); |
| 717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); | 718 | if (!mddev_trylock(mddev)) |
| 718 | md_wakeup_thread(mddev->thread); | 719 | return; |
| 719 | wait_event(mddev->sb_wait, | 720 | md_update_sb(mddev, 1); |
| 720 | !test_bit(MD_CHANGE_PENDING, &mddev->flags) || | 721 | mddev_unlock(mddev); |
| 721 | log->in_teardown); | ||
| 722 | /* | ||
| 723 | * r5l_quiesce could run after in_teardown check and hold | ||
| 724 | * mutex first. Superblock might get updated twice. | ||
| 725 | */ | ||
| 726 | if (log->in_teardown) | ||
| 727 | md_update_sb(mddev, 1); | ||
| 728 | } else { | ||
| 729 | WARN_ON(!mddev_is_locked(mddev)); | ||
| 730 | md_update_sb(mddev, 1); | ||
| 731 | } | ||
| 732 | 722 | ||
| 733 | /* discard IO error really doesn't matter, ignore it */ | 723 | /* discard IO error really doesn't matter, ignore it */ |
| 734 | if (log->last_checkpoint < end) { | 724 | if (log->last_checkpoint < end) { |
| @@ -827,7 +817,6 @@ void r5l_quiesce(struct r5l_log *log, int state) · 92 unmodified lines | |||
| 827 | if (!log || state == 2) | 817 | if (!log || state == 2) |
| 828 | return; | 818 | return; |
| 829 | if (state == 0) { | 819 | if (state == 0) { |
| 830 | log->in_teardown = 0; | ||
| 831 | /* | 820 | /* |
| 832 | * This is a special case for hotadd. In suspend, the array has | 821 | * This is a special case for hotadd. In suspend, the array has |
| 833 | * no journal. In resume, journal is initialized as well as the | 822 | * no journal. In resume, journal is initialized as well as the |
| @@ -838,11 +827,6 @@ void r5l_quiesce(struct r5l_log *log, int state) · 4 unmodified lines | |||
| 838 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, | 827 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, |
| 839 | log->rdev->mddev, "reclaim"); | 828 | log->rdev->mddev, "reclaim"); |
| 840 | } else if (state == 1) { | 829 | } else if (state == 1) { |
| 841 | /* | ||
| 842 | * at this point all stripes are finished, so io_unit is at | ||
| 843 | * least in STRIPE_END state | ||
| 844 | */ | ||
| 845 | log->in_teardown = 1; | ||
| 846 | /* make sure r5l_write_super_and_discard_space exits */ | 830 | /* make sure r5l_write_super_and_discard_space exits */ |
| 847 | mddev = log->rdev->mddev; | 831 | mddev = log->rdev->mddev; |
| 848 | wake_up(&mddev->sb_wait); | 832 | wake_up(&mddev->sb_wait); |
| @@ -659,6 +659,7 @@ raid5_get_active_stripe(struct r5conf *conf, sector_t sector, · 658 unmodified lines | |||
| 659 | { | 659 | { |
| 660 | struct stripe_head *sh; | 660 | struct stripe_head *sh; |
| 661 | int hash = stripe_hash_locks_hash(sector); | 661 | int hash = stripe_hash_locks_hash(sector); |
| 662 | int inc_empty_inactive_list_flag; | ||
| 662 | 663 | ||
| 663 | pr_debug("get_stripe, sector %llu\n", (unsigned long long)sector); | 664 | pr_debug("get_stripe, sector %llu\n", (unsigned long long)sector); |
| 664 | 665 | ||
| @@ -703,7 +704,12 @@ raid5_get_active_stripe(struct r5conf *conf, sector_t sector, · 38 unmodified lines | |||
| 703 | atomic_inc(&conf->active_stripes); | 704 | atomic_inc(&conf->active_stripes); |
| 704 | BUG_ON(list_empty(&sh->lru) && | 705 | BUG_ON(list_empty(&sh->lru) && |
| 705 | !test_bit(STRIPE_EXPANDING, &sh->state)); | 706 | !test_bit(STRIPE_EXPANDING, &sh->state)); |
| 707 | inc_empty_inactive_list_flag = 0; | ||
| 708 | if (!list_empty(conf->inactive_list + hash)) | ||
| 709 | inc_empty_inactive_list_flag = 1; | ||
| 706 | list_del_init(&sh->lru); | 710 | list_del_init(&sh->lru); |
| 711 | if (list_empty(conf->inactive_list + hash) && inc_empty_inactive_list_flag) | ||
| 712 | atomic_inc(&conf->empty_inactive_list_nr); | ||
| 707 | if (sh->group) { | 713 | if (sh->group) { |
| 708 | sh->group->stripes_cnt--; | 714 | sh->group->stripes_cnt--; |
| 709 | sh->group = NULL; | 715 | sh->group = NULL; |
| @@ -762,6 +768,7 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *sh · 52 unmodified lines | |||
| 762 | sector_t head_sector, tmp_sec; | 768 | sector_t head_sector, tmp_sec; |
| 763 | int hash; | 769 | int hash; |
| 764 | int dd_idx; | 770 | int dd_idx; |
| 771 | int inc_empty_inactive_list_flag; | ||
| 765 | 772 | ||
| 766 | /* Don't cross chunks, so stripe pd_idx/qd_idx is the same */ | 773 | /* Don't cross chunks, so stripe pd_idx/qd_idx is the same */ |
| 767 | tmp_sec = sh->sector; | 774 | tmp_sec = sh->sector; |
| @@ -779,7 +786,12 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *sh · 11 unmodified lines | |||
| 779 | atomic_inc(&conf->active_stripes); | 786 | atomic_inc(&conf->active_stripes); |
| 780 | BUG_ON(list_empty(&head->lru) && | 787 | BUG_ON(list_empty(&head->lru) && |
| 781 | !test_bit(STRIPE_EXPANDING, &head->state)); | 788 | !test_bit(STRIPE_EXPANDING, &head->state)); |
| 789 | inc_empty_inactive_list_flag = 0; | ||
| 790 | if (!list_empty(conf->inactive_list + hash)) | ||
| 791 | inc_empty_inactive_list_flag = 1; | ||
| 782 | list_del_init(&head->lru); | 792 | list_del_init(&head->lru); |
| 793 | if (list_empty(conf->inactive_list + hash) && inc_empty_inactive_list_flag) | ||
| 794 | atomic_inc(&conf->empty_inactive_list_nr); | ||
| 783 | if (head->group) { | 795 | if (head->group) { |
| 784 | head->group->stripes_cnt--; | 796 | head->group->stripes_cnt--; |
| 785 | head->group = NULL; | 797 | head->group = NULL; |
| @@ -993,7 +1005,6 @@ again: · 207 unmodified lines | |||
| 993 | 1005 | ||
| 994 | set_bit(STRIPE_IO_STARTED, &sh->state); | 1006 | set_bit(STRIPE_IO_STARTED, &sh->state); |
| 995 | 1007 | ||
| 996 | bio_reset(bi); | ||
| 997 | bi->bi_bdev = rdev->bdev; | 1008 | bi->bi_bdev = rdev->bdev; |
| 998 | bio_set_op_attrs(bi, op, op_flags); | 1009 | bio_set_op_attrs(bi, op, op_flags); |
| 999 | bi->bi_end_io = op_is_write(op) | 1010 | bi->bi_end_io = op_is_write(op) |
| @@ -1045,7 +1056,6 @@ again: · 45 unmodified lines | |||
| 1045 | 1056 | ||
| 1046 | set_bit(STRIPE_IO_STARTED, &sh->state); | 1057 | set_bit(STRIPE_IO_STARTED, &sh->state); |
| 1047 | 1058 | ||
| 1048 | bio_reset(rbi); | ||
| 1049 | rbi->bi_bdev = rrdev->bdev; | 1059 | rbi->bi_bdev = rrdev->bdev; |
| 1050 | bio_set_op_attrs(rbi, op, op_flags); | 1060 | bio_set_op_attrs(rbi, op, op_flags); |
| 1051 | BUG_ON(!op_is_write(op)); | 1061 | BUG_ON(!op_is_write(op)); |
| @@ -1978,9 +1988,11 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) · 926 unmodified lines | |||
| 1978 | put_cpu(); | 1988 | put_cpu(); |
| 1979 | } | 1989 | } |
| 1980 | 1990 | ||
| 1981 | static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp) | 1991 | static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp, |
| 1992 | int disks) | ||
| 1982 | { | 1993 | { |
| 1983 | struct stripe_head *sh; | 1994 | struct stripe_head *sh; |
| 1995 | int i; | ||
| 1984 | 1996 | ||
| 1985 | sh = kmem_cache_zalloc(sc, gfp); | 1997 | sh = kmem_cache_zalloc(sc, gfp); |
| 1986 | if (sh) { | 1998 | if (sh) { |
| @@ -1989,6 +2001,17 @@ static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp) · 2 unmodified lines | |||
| 1989 | INIT_LIST_HEAD(&sh->batch_list); | 2001 | INIT_LIST_HEAD(&sh->batch_list); |
| 1990 | INIT_LIST_HEAD(&sh->lru); | 2002 | INIT_LIST_HEAD(&sh->lru); |
| 1991 | atomic_set(&sh->count, 1); | 2003 | atomic_set(&sh->count, 1); |
| 2004 | for (i = 0; i < disks; i++) { | ||
| 2005 | struct r5dev *dev = &sh->dev[i]; | ||
| 2006 | |||
| 2007 | bio_init(&dev->req); | ||
| 2008 | dev->req.bi_io_vec = &dev->vec; | ||
| 2009 | dev->req.bi_max_vecs = 1; | ||
| 2010 | |||
| 2011 | bio_init(&dev->rreq); | ||
| 2012 | dev->rreq.bi_io_vec = &dev->rvec; | ||
| 2013 | dev->rreq.bi_max_vecs = 1; | ||
| 2014 | } | ||
| 1992 | } | 2015 | } |
| 1993 | return sh; | 2016 | return sh; |
| 1994 | } | 2017 | } |
| @@ -1996,7 +2019,7 @@ static int grow_one_stripe(struct r5conf *conf, gfp_t gfp) · 1 unmodified line | |||
| 1996 | { | 2019 | { |
| 1997 | struct stripe_head *sh; | 2020 | struct stripe_head *sh; |
| 1998 | 2021 | ||
| 1999 | sh = alloc_stripe(conf->slab_cache, gfp); | 2022 | sh = alloc_stripe(conf->slab_cache, gfp, conf->pool_size); |
| 2000 | if (!sh) | 2023 | if (!sh) |
| 2001 | return 0; | 2024 | return 0; |
| 2002 | 2025 | ||
| @@ -2167,7 +2190,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) · 164 unmodified lines | |||
| 2167 | mutex_lock(&conf->cache_size_mutex); | 2190 | mutex_lock(&conf->cache_size_mutex); |
| 2168 | 2191 | ||
| 2169 | for (i = conf->max_nr_stripes; i; i--) { | 2192 | for (i = conf->max_nr_stripes; i; i--) { |
| 2170 | nsh = alloc_stripe(sc, GFP_KERNEL); | 2193 | nsh = alloc_stripe(sc, GFP_KERNEL, newsize); |
| 2171 | if (!nsh) | 2194 | if (!nsh) |
| 2172 | break; | 2195 | break; |
| 2173 | 2196 | ||
| @@ -2299,6 +2322,7 @@ static void raid5_end_read_request(struct bio * bi) · 125 unmodified lines | |||
| 2299 | (unsigned long long)sh->sector, i, atomic_read(&sh->count), | 2322 | (unsigned long long)sh->sector, i, atomic_read(&sh->count), |
| 2300 | bi->bi_error); | 2323 | bi->bi_error); |
| 2301 | if (i == disks) { | 2324 | if (i == disks) { |
| 2325 | bio_reset(bi); | ||
| 2302 | BUG(); | 2326 | BUG(); |
| 2303 | return; | 2327 | return; |
| 2304 | } | 2328 | } |
| @@ -2399,6 +2423,7 @@ static void raid5_end_read_request(struct bio * bi) · 94 unmodified lines | |||
| 2399 | } | 2423 | } |
| 2400 | } | 2424 | } |
| 2401 | rdev_dec_pending(rdev, conf->mddev); | 2425 | rdev_dec_pending(rdev, conf->mddev); |
| 2426 | bio_reset(bi); | ||
| 2402 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2427 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
| 2403 | set_bit(STRIPE_HANDLE, &sh->state); | 2428 | set_bit(STRIPE_HANDLE, &sh->state); |
| 2404 | raid5_release_stripe(sh); | 2429 | raid5_release_stripe(sh); |
| @@ -2436,6 +2461,7 @@ static void raid5_end_write_request(struct bio *bi) · 31 unmodified lines | |||
| 2436 | (unsigned long long)sh->sector, i, atomic_read(&sh->count), | 2461 | (unsigned long long)sh->sector, i, atomic_read(&sh->count), |
| 2437 | bi->bi_error); | 2462 | bi->bi_error); |
| 2438 | if (i == disks) { | 2463 | if (i == disks) { |
| 2464 | bio_reset(bi); | ||
| 2439 | BUG(); | 2465 | BUG(); |
| 2440 | return; | 2466 | return; |
| 2441 | } | 2467 | } |
| @@ -2472,6 +2498,7 @@ static void raid5_end_write_request(struct bio *bi) · 30 unmodified lines | |||
| 2472 | if (sh->batch_head && bi->bi_error && !replacement) | 2498 | if (sh->batch_head && bi->bi_error && !replacement) |
| 2473 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); | 2499 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); |
| 2474 | 2500 | ||
| 2501 | bio_reset(bi); | ||
| 2475 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) | 2502 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) |
| 2476 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2503 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
| 2477 | set_bit(STRIPE_HANDLE, &sh->state); | 2504 | set_bit(STRIPE_HANDLE, &sh->state); |
| @@ -2485,16 +2512,6 @@ static void raid5_build_block(struct stripe_head *sh, int i, int previous) · 7 unmodified lines | |||
| 2485 | { | 2512 | { |
| 2486 | struct r5dev *dev = &sh->dev[i]; | 2513 | struct r5dev *dev = &sh->dev[i]; |
| 2487 | 2514 | ||
| 2488 | bio_init(&dev->req); | ||
| 2489 | dev->req.bi_io_vec = &dev->vec; | ||
| 2490 | dev->req.bi_max_vecs = 1; | ||
| 2491 | dev->req.bi_private = sh; | ||
| 2492 | |||
| 2493 | bio_init(&dev->rreq); | ||
| 2494 | dev->rreq.bi_io_vec = &dev->rvec; | ||
| 2495 | dev->rreq.bi_max_vecs = 1; | ||
| 2496 | dev->rreq.bi_private = sh; | ||
| 2497 | |||
| 2498 | dev->flags = 0; | 2515 | dev->flags = 0; |
| 2499 | dev->sector = raid5_compute_blocknr(sh, i, previous); | 2516 | dev->sector = raid5_compute_blocknr(sh, i, previous); |
| 2500 | } | 2517 | } |
| @@ -4628,7 +4645,9 @@ finish: · 2127 unmodified lines | |||
| 4628 | } | 4645 | } |
| 4629 | 4646 | ||
| 4630 | if (!bio_list_empty(&s.return_bi)) { | 4647 | if (!bio_list_empty(&s.return_bi)) { |
| 4631 | if (test_bit(MD_CHANGE_PENDING, &conf->mddev->flags)) { | 4648 | if (test_bit(MD_CHANGE_PENDING, &conf->mddev->flags) && |
| 4649 | (s.failed <= conf->max_degraded || | ||
| 4650 | conf->mddev->external == 0)) { | ||
| 4632 | spin_lock_irq(&conf->device_lock); | 4651 | spin_lock_irq(&conf->device_lock); |
| 4633 | bio_list_merge(&conf->return_bi, &s.return_bi); | 4652 | bio_list_merge(&conf->return_bi, &s.return_bi); |
| 4634 | spin_unlock_irq(&conf->device_lock); | 4653 | spin_unlock_irq(&conf->device_lock); |
| @@ -6620,6 +6639,16 @@ static struct r5conf *setup_conf(struct mddev *mddev) · 1985 unmodified lines | |||
| 6620 | } | 6639 | } |
| 6621 | 6640 | ||
| 6622 | conf->min_nr_stripes = NR_STRIPES; | 6641 | conf->min_nr_stripes = NR_STRIPES; |
| 6642 | if (mddev->reshape_position != MaxSector) { | ||
| 6643 | int stripes = max_t(int, | ||
| 6644 | ((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4, | ||
| 6645 | ((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4); | ||
| 6646 | conf->min_nr_stripes = max(NR_STRIPES, stripes); | ||
| 6647 | if (conf->min_nr_stripes != NR_STRIPES) | ||
| 6648 | printk(KERN_INFO | ||
| 6649 | "md/raid:%s: force stripe size %d for reshape\n", | ||
| 6650 | mdname(mddev), conf->min_nr_stripes); | ||
| 6651 | } | ||
| 6623 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + | 6652 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + |
| 6624 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; | 6653 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; |
| 6625 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); | 6654 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); |
| @@ -6826,11 +6855,14 @@ static int raid5_run(struct mddev *mddev) · 200 unmodified lines | |||
| 6826 | if (IS_ERR(conf)) | 6855 | if (IS_ERR(conf)) |
| 6827 | return PTR_ERR(conf); | 6856 | return PTR_ERR(conf); |
| 6828 | 6857 | ||
| 6829 | if (test_bit(MD_HAS_JOURNAL, &mddev->flags) && !journal_dev) { | 6858 | if (test_bit(MD_HAS_JOURNAL, &mddev->flags)) { |
| 6830 | printk(KERN_ERR "md/raid:%s: journal disk is missing, force array readonly\n", | 6859 | if (!journal_dev) { |
| 6831 | mdname(mddev)); | 6860 | pr_err("md/raid:%s: journal disk is missing, force array readonly\n", |
| 6832 | mddev->ro = 1; | 6861 | mdname(mddev)); |
| 6833 | set_disk_ro(mddev->gendisk, 1); | 6862 | mddev->ro = 1; |
| 6863 | set_disk_ro(mddev->gendisk, 1); | ||
| 6864 | } else if (mddev->recovery_cp == MaxSector) | ||
| 6865 | set_bit(MD_JOURNAL_CLEAN, &mddev->flags); | ||
| 6834 | } | 6866 | } |
| 6835 | 6867 | ||
| 6836 | conf->min_offset_diff = min_offset_diff; | 6868 | conf->min_offset_diff = min_offset_diff; |
| @@ -70,7 +70,10 @@ static unsigned int cec_get_edid_spa_location(const u8 *edid, unsigned int size) · 69 unmodified lines | |||
| 70 | u8 tag = edid[i] >> 5; | 70 | u8 tag = edid[i] >> 5; |
| 71 | u8 len = edid[i] & 0x1f; | 71 | u8 len = edid[i] & 0x1f; |
| 72 | 72 | ||
| 73 | if (tag == 3 && len >= 5 && i + len <= end) | 73 | if (tag == 3 && len >= 5 && i + len <= end && |
| 74 | edid[i + 1] == 0x03 && | ||
| 75 | edid[i + 2] == 0x0c && | ||
| 76 | edid[i + 3] == 0x00) | ||
| 74 | return i + 4; | 77 | return i + 4; |
| 75 | i += len + 1; | 78 | i += len + 1; |
| 76 | } while (i < end); | 79 | } while (i < end); |
| @@ -1552,6 +1552,7 @@ int cx23885_417_register(struct cx23885_dev *dev) · 1551 unmodified lines | |||
| 1552 | q->mem_ops = &vb2_dma_sg_memops; | 1552 | q->mem_ops = &vb2_dma_sg_memops; |
| 1553 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1553 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
| 1554 | q->lock = &dev->lock; | 1554 | q->lock = &dev->lock; |
| 1555 | q->dev = &dev->pci->dev; | ||
| 1555 | 1556 | ||
| 1556 | err = vb2_queue_init(q); | 1557 | err = vb2_queue_init(q); |
| 1557 | if (err < 0) | 1558 | if (err < 0) |
| @@ -1238,6 +1238,7 @@ static int dvb_init(struct saa7134_dev *dev) · 1237 unmodified lines | |||
| 1238 | q->buf_struct_size = sizeof(struct saa7134_buf); | 1238 | q->buf_struct_size = sizeof(struct saa7134_buf); |
| 1239 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1239 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
| 1240 | q->lock = &dev->lock; | 1240 | q->lock = &dev->lock; |
| 1241 | q->dev = &dev->pci->dev; | ||
| 1241 | ret = vb2_queue_init(q); | 1242 | ret = vb2_queue_init(q); |
| 1242 | if (ret) { | 1243 | if (ret) { |
| 1243 | vb2_dvb_dealloc_frontends(&dev->frontends); | 1244 | vb2_dvb_dealloc_frontends(&dev->frontends); |
| @@ -295,6 +295,7 @@ static int empress_init(struct saa7134_dev *dev) · 294 unmodified lines | |||
| 295 | q->buf_struct_size = sizeof(struct saa7134_buf); | 295 | q->buf_struct_size = sizeof(struct saa7134_buf); |
| 296 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 296 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
| 297 | q->lock = &dev->lock; | 297 | q->lock = &dev->lock; |
| 298 | q->dev = &dev->pci->dev; | ||
| 298 | err = vb2_queue_init(q); | 299 | err = vb2_queue_init(q); |
| 299 | if (err) | 300 | if (err) |
| 300 | return err; | 301 | return err; |
| @@ -169,7 +169,7 @@ config VIDEO_MEDIATEK_VPU · 168 unmodified lines | |||
| 169 | config VIDEO_MEDIATEK_VCODEC | 169 | config VIDEO_MEDIATEK_VCODEC |
| 170 | tristate "Mediatek Video Codec driver" | 170 | tristate "Mediatek Video Codec driver" |
| 171 | depends on MTK_IOMMU || COMPILE_TEST | 171 | depends on MTK_IOMMU || COMPILE_TEST |
| 172 | depends on VIDEO_DEV && VIDEO_V4L2 | 172 | depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA |
| 173 | depends on ARCH_MEDIATEK || COMPILE_TEST | 173 | depends on ARCH_MEDIATEK || COMPILE_TEST |
| 174 | select VIDEOBUF2_DMA_CONTIG | 174 | select VIDEOBUF2_DMA_CONTIG |
| 175 | select V4L2_MEM2MEM_DEV | 175 | select V4L2_MEM2MEM_DEV |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | #include <media/v4l2-ioctl.h> | 23 | #include <media/v4l2-ioctl.h> |
| 24 | #include <media/videobuf2-core.h> | 24 | #include <media/videobuf2-core.h> |
| 25 | 25 | ||
| 26 | #include "mtk_vcodec_util.h" | ||
| 27 | 26 | ||
| 28 | #define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv" | 27 | #define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv" |
| 29 | #define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" | 28 | #define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" |
| @@ -487,7 +487,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, · 486 unmodified lines | |||
| 487 | struct mtk_q_data *q_data; | 487 | struct mtk_q_data *q_data; |
| 488 | int ret, i; | 488 | int ret, i; |
| 489 | struct mtk_video_fmt *fmt; | 489 | struct mtk_video_fmt *fmt; |
| 490 | unsigned int pitch_w_div16; | ||
| 491 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 490 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
| 492 | 491 | ||
| 493 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); | 492 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); |
| @@ -530,15 +529,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, · 36 unmodified lines | |||
| 530 | q_data->coded_width = f->fmt.pix_mp.width; | 529 | q_data->coded_width = f->fmt.pix_mp.width; |
| 531 | q_data->coded_height = f->fmt.pix_mp.height; | 530 | q_data->coded_height = f->fmt.pix_mp.height; |
| 532 | 531 | ||
| 533 | pitch_w_div16 = DIV_ROUND_UP(q_data->visible_width, 16); | ||
| 534 | if (pitch_w_div16 % 8 != 0) { | ||
| 535 | /* Adjust returned width/height, so application could correctly | ||
| 536 | * allocate hw required memory | ||
| 537 | */ | ||
| 538 | q_data->visible_height += 32; | ||
| 539 | vidioc_try_fmt(f, q_data->fmt); | ||
| 540 | } | ||
| 541 | |||
| 542 | q_data->field = f->fmt.pix_mp.field; | 532 | q_data->field = f->fmt.pix_mp.field; |
| 543 | ctx->colorspace = f->fmt.pix_mp.colorspace; | 533 | ctx->colorspace = f->fmt.pix_mp.colorspace; |
| 544 | ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; | 534 | ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; |
| @@ -878,7 +868,8 @@ static int mtk_venc_encode_header(void *priv) · 333 unmodified lines | |||
| 878 | { | 868 | { |
| 879 | struct mtk_vcodec_ctx *ctx = priv; | 869 | struct mtk_vcodec_ctx *ctx = priv; |
| 880 | int ret; | 870 | int ret; |
| 881 | struct vb2_buffer *dst_buf; | 871 | struct vb2_buffer *src_buf, *dst_buf; |
| 872 | struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2; | ||
| 882 | struct mtk_vcodec_mem bs_buf; | 873 | struct mtk_vcodec_mem bs_buf; |
| 883 | struct venc_done_result enc_result; | 874 | struct venc_done_result enc_result; |
| 884 | 875 | ||
| @@ -911,6 +902,15 @@ static int mtk_venc_encode_header(void *priv) · 26 unmodified lines | |||
| 911 | mtk_v4l2_err("venc_if_encode failed=%d", ret); | 902 | mtk_v4l2_err("venc_if_encode failed=%d", ret); |
| 912 | return -EINVAL; | 903 | return -EINVAL; |
| 913 | } | 904 | } |
| 905 | src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); | ||
| 906 | if (src_buf) { | ||
| 907 | src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf); | ||
| 908 | dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf); | ||
| 909 | dst_buf->timestamp = src_buf->timestamp; | ||
| 910 | dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode; | ||
| 911 | } else { | ||
| 912 | mtk_v4l2_err("No timestamp for the header buffer."); | ||
| 913 | } | ||
| 914 | 914 | ||
| 915 | ctx->state = MTK_STATE_HEADER; | 915 | ctx->state = MTK_STATE_HEADER; |
| 916 | dst_buf->planes[0].bytesused = enc_result.bs_size; | 916 | dst_buf->planes[0].bytesused = enc_result.bs_size; |
| @@ -1003,7 +1003,7 @@ static void mtk_venc_worker(struct work_struct *work) · 86 unmodified lines | |||
| 1003 | struct mtk_vcodec_mem bs_buf; | 1003 | struct mtk_vcodec_mem bs_buf; |
| 1004 | struct venc_done_result enc_result; | 1004 | struct venc_done_result enc_result; |
| 1005 | int ret, i; | 1005 | int ret, i; |
| 1006 | struct vb2_v4l2_buffer *vb2_v4l2; | 1006 | struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2; |
| 1007 | 1007 | ||
| 1008 | /* check dst_buf, dst_buf may be removed in device_run | 1008 | /* check dst_buf, dst_buf may be removed in device_run |
| 1009 | * to stored encdoe header so we need check dst_buf and | 1009 | * to stored encdoe header so we need check dst_buf and |
| @@ -1043,9 +1043,14 @@ static void mtk_venc_worker(struct work_struct *work) · 33 unmodified lines | |||
| 1043 | ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME, | 1043 | ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME, |
| 1044 | &frm_buf, &bs_buf, &enc_result); | 1044 | &frm_buf, &bs_buf, &enc_result); |
| 1045 | 1045 | ||
| 1046 | vb2_v4l2 = container_of(dst_buf, struct vb2_v4l2_buffer, vb2_buf); | 1046 | src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf); |
| 1047 | dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf); | ||
| 1048 | |||
| 1049 | dst_buf->timestamp = src_buf->timestamp; | ||
| 1050 | dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode; | ||
| 1051 | |||
| 1047 | if (enc_result.is_key_frm) | 1052 | if (enc_result.is_key_frm) |
| 1048 | vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME; | 1053 | dst_vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME; |
| 1049 | 1054 | ||
| 1050 | if (ret) { | 1055 | if (ret) { |
| 1051 | v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf), | 1056 | v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf), |
| @@ -1217,7 +1222,7 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) · 165 unmodified lines | |||
| 1217 | 0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE); | 1222 | 0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE); |
| 1218 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE, | 1223 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
| 1219 | V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, | 1224 | V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, |
| 1220 | 0, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN); | 1225 | 0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH); |
| 1221 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL, | 1226 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
| 1222 | V4L2_MPEG_VIDEO_H264_LEVEL_4_2, | 1227 | V4L2_MPEG_VIDEO_H264_LEVEL_4_2, |
| 1223 | 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); | 1228 | 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); |
| @@ -1288,5 +1293,10 @@ int mtk_venc_lock(struct mtk_vcodec_ctx *ctx) · 64 unmodified lines | |||
| 1288 | 1293 | ||
| 1289 | void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx) | 1294 | void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx) |
| 1290 | { | 1295 | { |
| 1291 | venc_if_deinit(ctx); | 1296 | int ret = venc_if_deinit(ctx); |
| 1297 | |||
| 1298 | if (ret) | ||
| 1299 | mtk_v4l2_err("venc_if_deinit failed=%d", ret); | ||
| 1300 | |||
| 1301 | ctx->state = MTK_STATE_FREE; | ||
| 1292 | } | 1302 | } |
| @@ -218,11 +218,15 @@ static int fops_vcodec_release(struct file *file) · 217 unmodified lines | |||
| 218 | mtk_v4l2_debug(1, "[%d] encoder", ctx->id); | 218 | mtk_v4l2_debug(1, "[%d] encoder", ctx->id); |
| 219 | mutex_lock(&dev->dev_mutex); | 219 | mutex_lock(&dev->dev_mutex); |
| 220 | 220 | ||
| 221 | /* | ||
| 222 | * Call v4l2_m2m_ctx_release to make sure the worker thread is not | ||
| 223 | * running after venc_if_deinit. | ||
| 224 | */ | ||
| 225 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
| 221 | mtk_vcodec_enc_release(ctx); | 226 | mtk_vcodec_enc_release(ctx); |
| 222 | v4l2_fh_del(&ctx->fh); | 227 | v4l2_fh_del(&ctx->fh); |
| 223 | v4l2_fh_exit(&ctx->fh); | 228 | v4l2_fh_exit(&ctx->fh); |
| 224 | v4l2_ctrl_handler_free(&ctx->ctrl_hdl); | 229 | v4l2_ctrl_handler_free(&ctx->ctrl_hdl); |
| 225 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
| 226 | 230 | ||
| 227 | list_del_init(&ctx->list); | 231 | list_del_init(&ctx->list); |
| 228 | dev->num_instances--; | 232 | dev->num_instances--; |
| @@ -16,7 +16,6 @@ · 15 unmodified lines | |||
| 16 | #define _MTK_VCODEC_INTR_H_ | 16 | #define _MTK_VCODEC_INTR_H_ |
| 17 | 17 | ||
| 18 | #define MTK_INST_IRQ_RECEIVED 0x1 | 18 | #define MTK_INST_IRQ_RECEIVED 0x1 |
| 19 | #define MTK_INST_WORK_THREAD_ABORT_DONE 0x2 | ||
| 20 | 19 | ||
| 21 | struct mtk_vcodec_ctx; | 20 | struct mtk_vcodec_ctx; |
| 22 | 21 | ||
| @@ -61,6 +61,8 @@ enum venc_h264_bs_mode { · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | /* | 62 | /* |
| 63 | * struct venc_h264_vpu_config - Structure for h264 encoder configuration | 63 | * struct venc_h264_vpu_config - Structure for h264 encoder configuration |
| 64 | * AP-W/R : AP is writer/reader on this item | ||
| 65 | * VPU-W/R: VPU is write/reader on this item | ||
| 64 | * @input_fourcc: input fourcc | 66 | * @input_fourcc: input fourcc |
| 65 | * @bitrate: target bitrate (in bps) | 67 | * @bitrate: target bitrate (in bps) |
| 66 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, | 68 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, |
| @@ -94,13 +96,13 @@ struct venc_h264_vpu_config { · 27 unmodified lines | |||
| 94 | 96 | ||
| 95 | /* | 97 | /* |
| 96 | * struct venc_h264_vpu_buf - Structure for buffer information | 98 | * struct venc_h264_vpu_buf - Structure for buffer information |
| 97 | * @align: buffer alignment (in bytes) | 99 | * AP-W/R : AP is writer/reader on this item |
| 100 | * VPU-W/R: VPU is write/reader on this item | ||
| 98 | * @iova: IO virtual address | 101 | * @iova: IO virtual address |
| 99 | * @vpua: VPU side memory addr which is used by RC_CODE | 102 | * @vpua: VPU side memory addr which is used by RC_CODE |
| 100 | * @size: buffer size (in bytes) | 103 | * @size: buffer size (in bytes) |
| 101 | */ | 104 | */ |
| 102 | struct venc_h264_vpu_buf { | 105 | struct venc_h264_vpu_buf { |
| 103 | u32 align; | ||
| 104 | u32 iova; | 106 | u32 iova; |
| 105 | u32 vpua; | 107 | u32 vpua; |
| 106 | u32 size; | 108 | u32 size; |
| @@ -108,6 +110,8 @@ struct venc_h264_vpu_buf { · 1 unmodified line | |||
| 108 | 110 | ||
| 109 | /* | 111 | /* |
| 110 | * struct venc_h264_vsi - Structure for VPU driver control and info share | 112 | * struct venc_h264_vsi - Structure for VPU driver control and info share |
| 113 | * AP-W/R : AP is writer/reader on this item | ||
| 114 | * VPU-W/R: VPU is write/reader on this item | ||
| 111 | * This structure is allocated in VPU side and shared to AP side. | 115 | * This structure is allocated in VPU side and shared to AP side. |
| 112 | * @config: h264 encoder configuration | 116 | * @config: h264 encoder configuration |
| 113 | * @work_bufs: working buffer information in VPU side | 117 | * @work_bufs: working buffer information in VPU side |
| @@ -150,12 +154,6 @@ struct venc_h264_inst { · 36 unmodified lines | |||
| 150 | struct mtk_vcodec_ctx *ctx; | 154 | struct mtk_vcodec_ctx *ctx; |
| 151 | }; | 155 | }; |
| 152 | 156 | ||
| 153 | static inline void h264_write_reg(struct venc_h264_inst *inst, u32 addr, | ||
| 154 | u32 val) | ||
| 155 | { | ||
| 156 | writel(val, inst->hw_base + addr); | ||
| 157 | } | ||
| 158 | |||
| 159 | static inline u32 h264_read_reg(struct venc_h264_inst *inst, u32 addr) | 157 | static inline u32 h264_read_reg(struct venc_h264_inst *inst, u32 addr) |
| 160 | { | 158 | { |
| 161 | return readl(inst->hw_base + addr); | 159 | return readl(inst->hw_base + addr); |
| @@ -214,6 +212,8 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst, · 52 unmodified lines | |||
| 214 | return 40; | 212 | return 40; |
| 215 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: | 213 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: |
| 216 | return 41; | 214 | return 41; |
| 215 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: | ||
| 216 | return 42; | ||
| 217 | default: | 217 | default: |
| 218 | mtk_vcodec_debug(inst, "unsupported level %d", level); | 218 | mtk_vcodec_debug(inst, "unsupported level %d", level); |
| 219 | return 31; | 219 | return 31; |
| @@ -56,6 +56,8 @@ enum venc_vp8_vpu_work_buf { · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration | 58 | * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration |
| 59 | * AP-W/R : AP is writer/reader on this item | ||
| 60 | * VPU-W/R: VPU is write/reader on this item | ||
| 59 | * @input_fourcc: input fourcc | 61 | * @input_fourcc: input fourcc |
| 60 | * @bitrate: target bitrate (in bps) | 62 | * @bitrate: target bitrate (in bps) |
| 61 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, | 63 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, |
| @@ -83,14 +85,14 @@ struct venc_vp8_vpu_config { · 21 unmodified lines | |||
| 83 | }; | 85 | }; |
| 84 | 86 | ||
| 85 | /* | 87 | /* |
| 86 | * struct venc_vp8_vpu_buf -Structure for buffer information | 88 | * struct venc_vp8_vpu_buf - Structure for buffer information |
| 87 | * @align: buffer alignment (in bytes) | 89 | * AP-W/R : AP is writer/reader on this item |
| 90 | * VPU-W/R: VPU is write/reader on this item | ||
| 88 | * @iova: IO virtual address | 91 | * @iova: IO virtual address |
| 89 | * @vpua: VPU side memory addr which is used by RC_CODE | 92 | * @vpua: VPU side memory addr which is used by RC_CODE |
| 90 | * @size: buffer size (in bytes) | 93 | * @size: buffer size (in bytes) |
| 91 | */ | 94 | */ |
| 92 | struct venc_vp8_vpu_buf { | 95 | struct venc_vp8_vpu_buf { |
| 93 | u32 align; | ||
| 94 | u32 iova; | 96 | u32 iova; |
| 95 | u32 vpua; | 97 | u32 vpua; |
| 96 | u32 size; | 98 | u32 size; |
| @@ -98,6 +100,8 @@ struct venc_vp8_vpu_buf { · 1 unmodified line | |||
| 98 | 100 | ||
| 99 | /* | 101 | /* |
| 100 | * struct venc_vp8_vsi - Structure for VPU driver control and info share | 102 | * struct venc_vp8_vsi - Structure for VPU driver control and info share |
| 103 | * AP-W/R : AP is writer/reader on this item | ||
| 104 | * VPU-W/R: VPU is write/reader on this item | ||
| 101 | * This structure is allocated in VPU side and shared to AP side. | 105 | * This structure is allocated in VPU side and shared to AP side. |
| 102 | * @config: vp8 encoder configuration | 106 | * @config: vp8 encoder configuration |
| 103 | * @work_bufs: working buffer information in VPU side | 107 | * @work_bufs: working buffer information in VPU side |
| @@ -138,12 +142,6 @@ struct venc_vp8_inst { · 34 unmodified lines | |||
| 138 | struct mtk_vcodec_ctx *ctx; | 142 | struct mtk_vcodec_ctx *ctx; |
| 139 | }; | 143 | }; |
| 140 | 144 | ||
| 141 | static inline void vp8_enc_write_reg(struct venc_vp8_inst *inst, u32 addr, | ||
| 142 | u32 val) | ||
| 143 | { | ||
| 144 | writel(val, inst->hw_base + addr); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline u32 vp8_enc_read_reg(struct venc_vp8_inst *inst, u32 addr) | 145 | static inline u32 vp8_enc_read_reg(struct venc_vp8_inst *inst, u32 addr) |
| 148 | { | 146 | { |
| 149 | return readl(inst->hw_base + addr); | 147 | return readl(inst->hw_base + addr); |
| @@ -99,10 +99,16 @@ EXPORT_SYMBOL_GPL(rcar_fcp_put); · 98 unmodified lines | |||
| 99 | */ | 99 | */ |
| 100 | int rcar_fcp_enable(struct rcar_fcp_device *fcp) | 100 | int rcar_fcp_enable(struct rcar_fcp_device *fcp) |
| 101 | { | 101 | { |
| 102 | int error; | ||
| 103 | |||
| 102 | if (!fcp) | 104 | if (!fcp) |
| 103 | return 0; | 105 | return 0; |
| 104 | 106 | ||
| 105 | return pm_runtime_get_sync(fcp->dev); | 107 | error = pm_runtime_get_sync(fcp->dev); |
| 108 | if (error < 0) | ||
| 109 | return error; | ||
| 110 | |||
| 111 | return 0; | ||
| 106 | } | 112 | } |
| 107 | EXPORT_SYMBOL_GPL(rcar_fcp_enable); | 113 | EXPORT_SYMBOL_GPL(rcar_fcp_enable); |
| 108 | 114 | ||
| @@ -2185,7 +2185,7 @@ static int gpmc_probe_dt(struct platform_device *pdev) · 2184 unmodified lines | |||
| 2185 | return 0; | 2185 | return 0; |
| 2186 | } | 2186 | } |
| 2187 | 2187 | ||
| 2188 | static int gpmc_probe_dt_children(struct platform_device *pdev) | 2188 | static void gpmc_probe_dt_children(struct platform_device *pdev) |
| 2189 | { | 2189 | { |
| 2190 | int ret; | 2190 | int ret; |
| 2191 | struct device_node *child; | 2191 | struct device_node *child; |
| @@ -2200,11 +2200,11 @@ static int gpmc_probe_dt_children(struct platform_device *pdev) · 8 unmodified lines | |||
| 2200 | else | 2200 | else |
| 2201 | ret = gpmc_probe_generic_child(pdev, child); | 2201 | ret = gpmc_probe_generic_child(pdev, child); |
| 2202 | 2202 | ||
| 2203 | if (ret) | 2203 | if (ret) { |
| 2204 | return ret; | 2204 | dev_err(&pdev->dev, "failed to probe DT child '%s': %d\n", |
| 2205 | child->name, ret); | ||
| 2206 | } | ||
| 2205 | } | 2207 | } |
| 2206 | |||
| 2207 | return 0; | ||
| 2208 | } | 2208 | } |
| 2209 | #else | 2209 | #else |
| 2210 | static int gpmc_probe_dt(struct platform_device *pdev) | 2210 | static int gpmc_probe_dt(struct platform_device *pdev) |
| @@ -2212,9 +2212,8 @@ static int gpmc_probe_dt(struct platform_device *pdev) · 1 unmodified line | |||
| 2212 | return 0; | 2212 | return 0; |
| 2213 | } | 2213 | } |
| 2214 | 2214 | ||
| 2215 | static int gpmc_probe_dt_children(struct platform_device *pdev) | 2215 | static void gpmc_probe_dt_children(struct platform_device *pdev) |
| 2216 | { | 2216 | { |
| 2217 | return 0; | ||
| 2218 | } | 2217 | } |
| 2219 | #endif /* CONFIG_OF */ | 2218 | #endif /* CONFIG_OF */ |
| 2220 | 2219 | ||
| @@ -2369,16 +2368,10 @@ static int gpmc_probe(struct platform_device *pdev) · 148 unmodified lines | |||
| 2369 | goto setup_irq_failed; | 2368 | goto setup_irq_failed; |
| 2370 | } | 2369 | } |
| 2371 | 2370 | ||
| 2372 | rc = gpmc_probe_dt_children(pdev); | 2371 | gpmc_probe_dt_children(pdev); |
| 2373 | if (rc < 0) { | ||
| 2374 | dev_err(gpmc->dev, "failed to probe DT children\n"); | ||
| 2375 | goto dt_children_failed; | ||
| 2376 | } | ||
| 2377 | 2372 | ||
| 2378 | return 0; | 2373 | return 0; |
| 2379 | 2374 | ||
| 2380 | dt_children_failed: | ||
| 2381 | gpmc_free_irq(gpmc); | ||
| 2382 | setup_irq_failed: | 2375 | setup_irq_failed: |
| 2383 | gpmc_gpio_exit(gpmc); | 2376 | gpmc_gpio_exit(gpmc); |
| 2384 | gpio_init_failed: | 2377 | gpio_init_failed: |
| @@ -345,16 +345,6 @@ config SENSORS_TSL2550 · 344 unmodified lines | |||
| 345 | This driver can also be built as a module. If so, the module | 345 | This driver can also be built as a module. If so, the module |
| 346 | will be called tsl2550. | 346 | will be called tsl2550. |
| 347 | 347 | ||
| 348 | config SENSORS_BH1780 | ||
| 349 | tristate "ROHM BH1780GLI ambient light sensor" | ||
| 350 | depends on I2C && SYSFS | ||
| 351 | help | ||
| 352 | If you say yes here you get support for the ROHM BH1780GLI | ||
| 353 | ambient light sensor. | ||
| 354 | |||
| 355 | This driver can also be built as a module. If so, the module | ||
| 356 | will be called bh1780gli. | ||
| 357 | |||
| 358 | config SENSORS_BH1770 | 348 | config SENSORS_BH1770 |
| 359 | tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor" | 349 | tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor" |
| 360 | depends on I2C | 350 | depends on I2C |
| @@ -19,7 +19,6 @@ obj-$(CONFIG_TIFM_CORE) += tifm_core.o · 18 unmodified lines | |||
| 19 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o | 19 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o |
| 20 | obj-$(CONFIG_PHANTOM) += phantom.o | 20 | obj-$(CONFIG_PHANTOM) += phantom.o |
| 21 | obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o | 21 | obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o |
| 22 | obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o | ||
| 23 | obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o | 22 | obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o |
| 24 | obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o | 23 | obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o |
| 25 | obj-$(CONFIG_SGI_IOC4) += ioc4.o | 24 | obj-$(CONFIG_SGI_IOC4) += ioc4.o |
| @@ -1,259 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * bh1780gli.c | ||
| 3 | * ROHM Ambient Light Sensor Driver | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Texas Instruments | ||
| 6 | * Author: Hemanth V <hemanthv@ti.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License version 2 as published by | ||
| 10 | * the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 15 | * more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along with | ||
| 18 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | #include <linux/i2c.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | #include <linux/mutex.h> | ||
| 23 | #include <linux/platform_device.h> | ||
| 24 | #include <linux/delay.h> | ||
| 25 | #include <linux/module.h> | ||
| 26 | #include <linux/of.h> | ||
| 27 | |||
| 28 | #define BH1780_REG_CONTROL 0x80 | ||
| 29 | #define BH1780_REG_PARTID 0x8A | ||
| 30 | #define BH1780_REG_MANFID 0x8B | ||
| 31 | #define BH1780_REG_DLOW 0x8C | ||
| 32 | #define BH1780_REG_DHIGH 0x8D | ||
| 33 | |||
| 34 | #define BH1780_REVMASK (0xf) | ||
| 35 | #define BH1780_POWMASK (0x3) | ||
| 36 | #define BH1780_POFF (0x0) | ||
| 37 | #define BH1780_PON (0x3) | ||
| 38 | |||
| 39 | /* power on settling time in ms */ | ||
| 40 | #define BH1780_PON_DELAY 2 | ||
| 41 | |||
| 42 | struct bh1780_data { | ||
| 43 | struct i2c_client *client; | ||
| 44 | int power_state; | ||
| 45 | /* lock for sysfs operations */ | ||
| 46 | struct mutex lock; | ||
| 47 | }; | ||
| 48 | |||
| 49 | static int bh1780_write(struct bh1780_data *ddata, u8 reg, u8 val, char *msg) | ||
| 50 | { | ||
| 51 | int ret = i2c_smbus_write_byte_data(ddata->client, reg, val); | ||
| 52 | if (ret < 0) | ||
| 53 | dev_err(&ddata->client->dev, | ||
| 54 | "i2c_smbus_write_byte_data failed error %d Register (%s)\n", | ||
| 55 | ret, msg); | ||
| 56 | return ret; | ||
| 57 | } | ||
| 58 | |||
| 59 | static int bh1780_read(struct bh1780_data *ddata, u8 reg, char *msg) | ||
| 60 | { | ||
| 61 | int ret = i2c_smbus_read_byte_data(ddata->client, reg); | ||
| 62 | if (ret < 0) | ||
| 63 | dev_err(&ddata->client->dev, | ||
| 64 | "i2c_smbus_read_byte_data failed error %d Register (%s)\n", | ||
| 65 | ret, msg); | ||
| 66 | return ret; | ||
| 67 | } | ||
| 68 | |||
| 69 | static ssize_t bh1780_show_lux(struct device *dev, | ||
| 70 | struct device_attribute *attr, char *buf) | ||
| 71 | { | ||
| 72 | struct platform_device *pdev = to_platform_device(dev); | ||
| 73 | struct bh1780_data *ddata = platform_get_drvdata(pdev); | ||
| 74 | int lsb, msb; | ||
| 75 | |||
| 76 | lsb = bh1780_read(ddata, BH1780_REG_DLOW, "DLOW"); | ||
| 77 | if (lsb < 0) | ||
| 78 | return lsb; | ||
| 79 | |||
| 80 | msb = bh1780_read(ddata, BH1780_REG_DHIGH, "DHIGH"); | ||
| 81 | if (msb < 0) | ||
| 82 | return msb; | ||
| 83 | |||
| 84 | return sprintf(buf, "%d\n", (msb << 8) | lsb); | ||
| 85 | } | ||
| 86 | |||
| 87 | static ssize_t bh1780_show_power_state(struct device *dev, | ||
| 88 | struct device_attribute *attr, | ||
| 89 | char *buf) | ||
| 90 | { | ||
| 91 | struct platform_device *pdev = to_platform_device(dev); | ||
| 92 | struct bh1780_data *ddata = platform_get_drvdata(pdev); | ||
| 93 | int state; | ||
| 94 | |||
| 95 | state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); | ||
| 96 | if (state < 0) | ||
| 97 | return state; | ||
| 98 | |||
| 99 | return sprintf(buf, "%d\n", state & BH1780_POWMASK); | ||
| 100 | } | ||
| 101 | |||
| 102 | static ssize_t bh1780_store_power_state(struct device *dev, | ||
| 103 | struct device_attribute *attr, | ||
| 104 | const char *buf, size_t count) | ||
| 105 | { | ||
| 106 | struct platform_device *pdev = to_platform_device(dev); | ||
| 107 | struct bh1780_data *ddata = platform_get_drvdata(pdev); | ||
| 108 | unsigned long val; | ||
| 109 | int error; | ||
| 110 | |||
| 111 | error = kstrtoul(buf, 0, &val); | ||
| 112 | if (error) | ||
| 113 | return error; | ||
| 114 | |||
| 115 | if (val < BH1780_POFF || val > BH1780_PON) | ||
| 116 | return -EINVAL; | ||
| 117 | |||
| 118 | mutex_lock(&ddata->lock); | ||
| 119 | |||
| 120 | error = bh1780_write(ddata, BH1780_REG_CONTROL, val, "CONTROL"); | ||
| 121 | if (error < 0) { | ||
| 122 | mutex_unlock(&ddata->lock); | ||
| 123 | return error; | ||
| 124 | } | ||
| 125 | |||
| 126 | msleep(BH1780_PON_DELAY); | ||
| 127 | ddata->power_state = val; | ||
| 128 | mutex_unlock(&ddata->lock); | ||
| 129 | |||
| 130 | return count; | ||
| 131 | } | ||
| 132 | |||
| 133 | static DEVICE_ATTR(lux, S_IRUGO, bh1780_show_lux, NULL); | ||
| 134 | |||
| 135 | static DEVICE_ATTR(power_state, S_IWUSR | S_IRUGO, | ||
| 136 | bh1780_show_power_state, bh1780_store_power_state); | ||
| 137 | |||
| 138 | static struct attribute *bh1780_attributes[] = { | ||
| 139 | &dev_attr_power_state.attr, | ||
| 140 | &dev_attr_lux.attr, | ||
| 141 | NULL | ||
| 142 | }; | ||
| 143 | |||
| 144 | static const struct attribute_group bh1780_attr_group = { | ||
| 145 | .attrs = bh1780_attributes, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static int bh1780_probe(struct i2c_client *client, | ||
| 149 | const struct i2c_device_id *id) | ||
| 150 | { | ||
| 151 | int ret; | ||
| 152 | struct bh1780_data *ddata; | ||
| 153 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | ||
| 154 | |||
| 155 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) | ||
| 156 | return -EIO; | ||
| 157 | |||
| 158 | ddata = devm_kzalloc(&client->dev, sizeof(struct bh1780_data), | ||
| 159 | GFP_KERNEL); | ||
| 160 | if (ddata == NULL) | ||
| 161 | return -ENOMEM; | ||
| 162 | |||
| 163 | ddata->client = client; | ||
| 164 | i2c_set_clientdata(client, ddata); | ||
| 165 | |||
| 166 | ret = bh1780_read(ddata, BH1780_REG_PARTID, "PART ID"); | ||
| 167 | if (ret < 0) | ||
| 168 | return ret; | ||
| 169 | |||
| 170 | dev_info(&client->dev, "Ambient Light Sensor, Rev : %d\n", | ||
| 171 | (ret & BH1780_REVMASK)); | ||
| 172 | |||
| 173 | mutex_init(&ddata->lock); | ||
| 174 | |||
| 175 | return sysfs_create_group(&client->dev.kobj, &bh1780_attr_group); | ||
| 176 | } | ||
| 177 | |||
| 178 | static int bh1780_remove(struct i2c_client *client) | ||
| 179 | { | ||
| 180 | sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); | ||
| 181 | |||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | |||
| 185 | #ifdef CONFIG_PM_SLEEP | ||
| 186 | static int bh1780_suspend(struct device *dev) | ||
| 187 | { | ||
| 188 | struct bh1780_data *ddata; | ||
| 189 | int state, ret; | ||
| 190 | struct i2c_client *client = to_i2c_client(dev); | ||
| 191 | |||
| 192 | ddata = i2c_get_clientdata(client); | ||
| 193 | state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL"); | ||
| 194 | if (state < 0) | ||
| 195 | return state; | ||
| 196 | |||
| 197 | ddata->power_state = state & BH1780_POWMASK; | ||
| 198 | |||
| 199 | ret = bh1780_write(ddata, BH1780_REG_CONTROL, BH1780_POFF, | ||
| 200 | "CONTROL"); | ||
| 201 | |||
| 202 | if (ret < 0) | ||
| 203 | return ret; | ||
| 204 | |||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | |||
| 208 | static int bh1780_resume(struct device *dev) | ||
| 209 | { | ||
| 210 | struct bh1780_data *ddata; | ||
| 211 | int state, ret; | ||
| 212 | struct i2c_client *client = to_i2c_client(dev); | ||
| 213 | |||
| 214 | ddata = i2c_get_clientdata(client); | ||
| 215 | state = ddata->power_state; | ||
| 216 | ret = bh1780_write(ddata, BH1780_REG_CONTROL, state, | ||
| 217 | "CONTROL"); | ||
| 218 | |||
| 219 | if (ret < 0) | ||
| 220 | return ret; | ||
| 221 | |||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | #endif /* CONFIG_PM_SLEEP */ | ||
| 225 | |||
| 226 | static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume); | ||
| 227 | |||
| 228 | static const struct i2c_device_id bh1780_id[] = { | ||
| 229 | { "bh1780", 0 }, | ||
| 230 | { }, | ||
| 231 | }; | ||
| 232 | |||
| 233 | MODULE_DEVICE_TABLE(i2c, bh1780_id); | ||
| 234 | |||
| 235 | #ifdef CONFIG_OF | ||
| 236 | static const struct of_device_id of_bh1780_match[] = { | ||
| 237 | { .compatible = "rohm,bh1780gli", }, | ||
| 238 | {}, | ||
| 239 | }; | ||
| 240 | |||
| 241 | MODULE_DEVICE_TABLE(of, of_bh1780_match); | ||
| 242 | #endif | ||
| 243 | |||
| 244 | static struct i2c_driver bh1780_driver = { | ||
| 245 | .probe = bh1780_probe, | ||
| 246 | .remove = bh1780_remove, | ||
| 247 | .id_table = bh1780_id, | ||
| 248 | .driver = { | ||
| 249 | .name = "bh1780", | ||
| 250 | .pm = &bh1780_pm, | ||
| 251 | .of_match_table = of_match_ptr(of_bh1780_match), | ||
| 252 | }, | ||
| 253 | }; | ||
| 254 | |||
| 255 | module_i2c_driver(bh1780_driver); | ||
| 256 | |||
| 257 | MODULE_DESCRIPTION("BH1780GLI Ambient Light Sensor Driver"); | ||
| 258 | MODULE_LICENSE("GPL"); | ||
| 259 | MODULE_AUTHOR("Hemanth V <hemanthv@ti.com>"); | ||
| @@ -230,6 +230,11 @@ int cxl_pci_vphb_add(struct cxl_afu *afu) · 229 unmodified lines | |||
| 230 | if (phb->bus == NULL) | 230 | if (phb->bus == NULL) |
| 231 | return -ENXIO; | 231 | return -ENXIO; |
| 232 | 232 | ||
| 233 | /* Set release hook on root bus */ | ||
| 234 | pci_set_host_bridge_release(to_pci_host_bridge(phb->bus->bridge), | ||
| 235 | pcibios_free_controller_deferred, | ||
| 236 | (void *) phb); | ||
| 237 | |||
| 233 | /* Claim resources. This might need some rework as well depending | 238 | /* Claim resources. This might need some rework as well depending |
| 234 | * whether we are doing probe-only or not, like assigning unassigned | 239 | * whether we are doing probe-only or not, like assigning unassigned |
| 235 | * resources etc... | 240 | * resources etc... |
| @@ -256,7 +261,10 @@ void cxl_pci_vphb_remove(struct cxl_afu *afu) · 20 unmodified lines | |||
| 256 | afu->phb = NULL; | 261 | afu->phb = NULL; |
| 257 | 262 | ||
| 258 | pci_remove_root_bus(phb->bus); | 263 | pci_remove_root_bus(phb->bus); |
| 259 | pcibios_free_controller(phb); | 264 | /* |
| 265 | * We don't free phb here - that's handled by | ||
| 266 | * pcibios_free_controller_deferred() | ||
| 267 | */ | ||
| 260 | } | 268 | } |
| 261 | 269 | ||
| 262 | static bool _cxl_pci_is_vphb_device(struct pci_controller *phb) | 270 | static bool _cxl_pci_is_vphb_device(struct pci_controller *phb) |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | */ | 4 | */ |
| 5 | #include "lkdtm.h" | 5 | #include "lkdtm.h" |
| 6 | 6 | ||
| 7 | void lkdtm_rodata_do_nothing(void) | 7 | void notrace lkdtm_rodata_do_nothing(void) |
| 8 | { | 8 | { |
| 9 | /* Does nothing. We just want an architecture agnostic "return". */ | 9 | /* Does nothing. We just want an architecture agnostic "return". */ |
| 10 | } | 10 | } |
| @@ -9,7 +9,15 @@ · 8 unmodified lines | |||
| 9 | #include <linux/uaccess.h> | 9 | #include <linux/uaccess.h> |
| 10 | #include <asm/cacheflush.h> | 10 | #include <asm/cacheflush.h> |
| 11 | 11 | ||
| 12 | static size_t cache_size = 1024; | 12 | /* |
| 13 | * Many of the tests here end up using const sizes, but those would | ||
| 14 | * normally be ignored by hardened usercopy, so force the compiler | ||
| 15 | * into choosing the non-const path to make sure we trigger the | ||
| 16 | * hardened usercopy checks by added "unconst" to all the const copies, | ||
| 17 | * and making sure "cache_size" isn't optimized into a const. | ||
| 18 | */ | ||
| 19 | static volatile size_t unconst = 0; | ||
| 20 | static volatile size_t cache_size = 1024; | ||
| 13 | static struct kmem_cache *bad_cache; | 21 | static struct kmem_cache *bad_cache; |
| 14 | 22 | ||
| 15 | static const unsigned char test_text[] = "This is a test.\n"; | 23 | static const unsigned char test_text[] = "This is a test.\n"; |
| @@ -67,14 +75,14 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame) · 51 unmodified lines | |||
| 67 | if (to_user) { | 75 | if (to_user) { |
| 68 | pr_info("attempting good copy_to_user of local stack\n"); | 76 | pr_info("attempting good copy_to_user of local stack\n"); |
| 69 | if (copy_to_user((void __user *)user_addr, good_stack, | 77 | if (copy_to_user((void __user *)user_addr, good_stack, |
| 70 | sizeof(good_stack))) { | 78 | unconst + sizeof(good_stack))) { |
| 71 | pr_warn("copy_to_user failed unexpectedly?!\n"); | 79 | pr_warn("copy_to_user failed unexpectedly?!\n"); |
| 72 | goto free_user; | 80 | goto free_user; |
| 73 | } | 81 | } |
| 74 | 82 | ||
| 75 | pr_info("attempting bad copy_to_user of distant stack\n"); | 83 | pr_info("attempting bad copy_to_user of distant stack\n"); |
| 76 | if (copy_to_user((void __user *)user_addr, bad_stack, | 84 | if (copy_to_user((void __user *)user_addr, bad_stack, |
| 77 | sizeof(good_stack))) { | 85 | unconst + sizeof(good_stack))) { |
| 78 | pr_warn("copy_to_user failed, but lacked Oops\n"); | 86 | pr_warn("copy_to_user failed, but lacked Oops\n"); |
| 79 | goto free_user; | 87 | goto free_user; |
| 80 | } | 88 | } |
| @@ -88,14 +96,14 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame) · 7 unmodified lines | |||
| 88 | 96 | ||
| 89 | pr_info("attempting good copy_from_user of local stack\n"); | 97 | pr_info("attempting good copy_from_user of local stack\n"); |
| 90 | if (copy_from_user(good_stack, (void __user *)user_addr, | 98 | if (copy_from_user(good_stack, (void __user *)user_addr, |
| 91 | sizeof(good_stack))) { | 99 | unconst + sizeof(good_stack))) { |
| 92 | pr_warn("copy_from_user failed unexpectedly?!\n"); | 100 | pr_warn("copy_from_user failed unexpectedly?!\n"); |
| 93 | goto free_user; | 101 | goto free_user; |
| 94 | } | 102 | } |
| 95 | 103 | ||
| 96 | pr_info("attempting bad copy_from_user of distant stack\n"); | 104 | pr_info("attempting bad copy_from_user of distant stack\n"); |
| 97 | if (copy_from_user(bad_stack, (void __user *)user_addr, | 105 | if (copy_from_user(bad_stack, (void __user *)user_addr, |
| 98 | sizeof(good_stack))) { | 106 | unconst + sizeof(good_stack))) { |
| 99 | pr_warn("copy_from_user failed, but lacked Oops\n"); | 107 | pr_warn("copy_from_user failed, but lacked Oops\n"); |
| 100 | goto free_user; | 108 | goto free_user; |
| 101 | } | 109 | } |
| @@ -109,7 +117,7 @@ static void do_usercopy_heap_size(bool to_user) · 7 unmodified lines | |||
| 109 | { | 117 | { |
| 110 | unsigned long user_addr; | 118 | unsigned long user_addr; |
| 111 | unsigned char *one, *two; | 119 | unsigned char *one, *two; |
| 112 | const size_t size = 1024; | 120 | size_t size = unconst + 1024; |
| 113 | 121 | ||
| 114 | one = kmalloc(size, GFP_KERNEL); | 122 | one = kmalloc(size, GFP_KERNEL); |
| 115 | two = kmalloc(size, GFP_KERNEL); | 123 | two = kmalloc(size, GFP_KERNEL); |
| @@ -285,13 +293,14 @@ void lkdtm_USERCOPY_KERNEL(void) · 169 unmodified lines | |||
| 285 | 293 | ||
| 286 | pr_info("attempting good copy_to_user from kernel rodata\n"); | 294 | pr_info("attempting good copy_to_user from kernel rodata\n"); |
| 287 | if (copy_to_user((void __user *)user_addr, test_text, | 295 | if (copy_to_user((void __user *)user_addr, test_text, |
| 288 | sizeof(test_text))) { | 296 | unconst + sizeof(test_text))) { |
| 289 | pr_warn("copy_to_user failed unexpectedly?!\n"); | 297 | pr_warn("copy_to_user failed unexpectedly?!\n"); |
| 290 | goto free_user; | 298 | goto free_user; |
| 291 | } | 299 | } |
| 292 | 300 | ||
| 293 | pr_info("attempting bad copy_to_user from kernel text\n"); | 301 | pr_info("attempting bad copy_to_user from kernel text\n"); |
| 294 | if (copy_to_user((void __user *)user_addr, vm_mmap, PAGE_SIZE)) { | 302 | if (copy_to_user((void __user *)user_addr, vm_mmap, |
| 303 | unconst + PAGE_SIZE)) { | ||
| 295 | pr_warn("copy_to_user failed, but lacked Oops\n"); | 304 | pr_warn("copy_to_user failed, but lacked Oops\n"); |
| 296 | goto free_user; | 305 | goto free_user; |
| 297 | } | 306 | } |
| @@ -1263,8 +1263,14 @@ static bool mei_me_fw_type_nm(struct pci_dev *pdev) · 1262 unmodified lines | |||
| 1263 | static bool mei_me_fw_type_sps(struct pci_dev *pdev) | 1263 | static bool mei_me_fw_type_sps(struct pci_dev *pdev) |
| 1264 | { | 1264 | { |
| 1265 | u32 reg; | 1265 | u32 reg; |
| 1266 | /* Read ME FW Status check for SPS Firmware */ | 1266 | unsigned int devfn; |
| 1267 | pci_read_config_dword(pdev, PCI_CFG_HFS_1, ®); | 1267 | |
| 1268 | /* | ||
| 1269 | * Read ME FW Status register to check for SPS Firmware | ||
| 1270 | * The SPS FW is only signaled in pci function 0 | ||
| 1271 | */ | ||
| 1272 | devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0); | ||
| 1273 | pci_bus_read_config_dword(pdev->bus, devfn, PCI_CFG_HFS_1, ®); | ||
| 1268 | trace_mei_pci_cfg_read(&pdev->dev, "PCI_CFG_HFS_1", PCI_CFG_HFS_1, reg); | 1274 | trace_mei_pci_cfg_read(&pdev->dev, "PCI_CFG_HFS_1", PCI_CFG_HFS_1, reg); |
| 1269 | /* if bits [19:16] = 15, running SPS Firmware */ | 1275 | /* if bits [19:16] = 15, running SPS Firmware */ |
| 1270 | return (reg & 0xf0000) == 0xf0000; | 1276 | return (reg & 0xf0000) == 0xf0000; |
| @@ -85,8 +85,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 84 unmodified lines | |||
| 85 | 85 | ||
| 86 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT, mei_me_pch8_cfg)}, | 86 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT, mei_me_pch8_cfg)}, |
| 87 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, mei_me_pch8_cfg)}, | 87 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, mei_me_pch8_cfg)}, |
| 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_cfg)}, | 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_sps_cfg)}, |
| 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_cfg)}, | 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_sps_cfg)}, |
| 90 | 90 | ||
| 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, mei_me_pch8_cfg)}, | 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, mei_me_pch8_cfg)}, |
| 92 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, mei_me_pch8_cfg)}, | 92 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, mei_me_pch8_cfg)}, |
| @@ -1726,6 +1726,7 @@ static u8 mmc_blk_prep_packed_list(struct mmc_queue *mq, struct request *req) · 1725 unmodified lines | |||
| 1726 | break; | 1726 | break; |
| 1727 | 1727 | ||
| 1728 | if (req_op(next) == REQ_OP_DISCARD || | 1728 | if (req_op(next) == REQ_OP_DISCARD || |
| 1729 | req_op(next) == REQ_OP_SECURE_ERASE || | ||
| 1729 | req_op(next) == REQ_OP_FLUSH) | 1730 | req_op(next) == REQ_OP_FLUSH) |
| 1730 | break; | 1731 | break; |
| 1731 | 1732 | ||
| @@ -2150,6 +2151,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) · 418 unmodified lines | |||
| 2150 | struct mmc_card *card = md->queue.card; | 2151 | struct mmc_card *card = md->queue.card; |
| 2151 | struct mmc_host *host = card->host; | 2152 | struct mmc_host *host = card->host; |
| 2152 | unsigned long flags; | 2153 | unsigned long flags; |
| 2154 | bool req_is_special = mmc_req_is_special(req); | ||
| 2153 | 2155 | ||
| 2154 | if (req && !mq->mqrq_prev->req) | 2156 | if (req && !mq->mqrq_prev->req) |
| 2155 | /* claim host only for the first request */ | 2157 | /* claim host only for the first request */ |
| @@ -2190,8 +2192,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) · 34 unmodified lines | |||
| 2190 | } | 2192 | } |
| 2191 | 2193 | ||
| 2192 | out: | 2194 | out: |
| 2193 | if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) || | 2195 | if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) || req_is_special) |
| 2194 | mmc_req_is_special(req)) | ||
| 2195 | /* | 2196 | /* |
| 2196 | * Release host when there are no more requests | 2197 | * Release host when there are no more requests |
| 2197 | * and after special request(discard, flush) is done. | 2198 | * and after special request(discard, flush) is done. |
| @@ -33,7 +33,8 @@ static int mmc_prep_request(struct request_queue *q, struct request *req) · 32 unmodified lines | |||
| 33 | /* | 33 | /* |
| 34 | * We only like normal block requests and discards. | 34 | * We only like normal block requests and discards. |
| 35 | */ | 35 | */ |
| 36 | if (req->cmd_type != REQ_TYPE_FS && req_op(req) != REQ_OP_DISCARD) { | 36 | if (req->cmd_type != REQ_TYPE_FS && req_op(req) != REQ_OP_DISCARD && |
| 37 | req_op(req) != REQ_OP_SECURE_ERASE) { | ||
| 37 | blk_dump_rq_flags(req, "MMC bad request"); | 38 | blk_dump_rq_flags(req, "MMC bad request"); |
| 38 | return BLKPREP_KILL; | 39 | return BLKPREP_KILL; |
| 39 | } | 40 | } |
| @@ -64,6 +65,8 @@ static int mmc_queue_thread(void *d) · 24 unmodified lines | |||
| 64 | spin_unlock_irq(q->queue_lock); | 65 | spin_unlock_irq(q->queue_lock); |
| 65 | 66 | ||
| 66 | if (req || mq->mqrq_prev->req) { | 67 | if (req || mq->mqrq_prev->req) { |
| 68 | bool req_is_special = mmc_req_is_special(req); | ||
| 69 | |||
| 67 | set_current_state(TASK_RUNNING); | 70 | set_current_state(TASK_RUNNING); |
| 68 | mq->issue_fn(mq, req); | 71 | mq->issue_fn(mq, req); |
| 69 | cond_resched(); | 72 | cond_resched(); |
| @@ -79,7 +82,7 @@ static int mmc_queue_thread(void *d) · 9 unmodified lines | |||
| 79 | * has been finished. Do not assign it to previous | 82 | * has been finished. Do not assign it to previous |
| 80 | * request. | 83 | * request. |
| 81 | */ | 84 | */ |
| 82 | if (mmc_req_is_special(req)) | 85 | if (req_is_special) |
| 83 | mq->mqrq_cur->req = NULL; | 86 | mq->mqrq_cur->req = NULL; |
| 84 | 87 | ||
| 85 | mq->mqrq_prev->brq.mrq.data = NULL; | 88 | mq->mqrq_prev->brq.mrq.data = NULL; |
| @@ -4,7 +4,9 @@ · 3 unmodified lines | |||
| 4 | static inline bool mmc_req_is_special(struct request *req) | 4 | static inline bool mmc_req_is_special(struct request *req) |
| 5 | { | 5 | { |
| 6 | return req && | 6 | return req && |
| 7 | (req_op(req) == REQ_OP_FLUSH || req_op(req) == REQ_OP_DISCARD); | 7 | (req_op(req) == REQ_OP_FLUSH || |
| 8 | req_op(req) == REQ_OP_DISCARD || | ||
| 9 | req_op(req) == REQ_OP_SECURE_ERASE); | ||
| 8 | } | 10 | } |
| 9 | 11 | ||
| 10 | struct request; | 12 | struct request; |
| @@ -1112,11 +1112,12 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) · 1111 unmodified lines | |||
| 1112 | 1112 | ||
| 1113 | div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0; | 1113 | div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0; |
| 1114 | 1114 | ||
| 1115 | dev_info(&slot->mmc->class_dev, | 1115 | if (clock != slot->__clk_old || force_clkinit) |
| 1116 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", | 1116 | dev_info(&slot->mmc->class_dev, |
| 1117 | slot->id, host->bus_hz, clock, | 1117 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", |
| 1118 | div ? ((host->bus_hz / div) >> 1) : | 1118 | slot->id, host->bus_hz, clock, |
| 1119 | host->bus_hz, div); | 1119 | div ? ((host->bus_hz / div) >> 1) : |
| 1120 | host->bus_hz, div); | ||
| 1120 | 1121 | ||
| 1121 | /* disable clock */ | 1122 | /* disable clock */ |
| 1122 | mci_writel(host, CLKENA, 0); | 1123 | mci_writel(host, CLKENA, 0); |
| @@ -1139,6 +1140,9 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) · 16 unmodified lines | |||
| 1139 | 1140 | ||
| 1140 | /* inform CIU */ | 1141 | /* inform CIU */ |
| 1141 | mci_send_cmd(slot, sdmmc_cmd_bits, 0); | 1142 | mci_send_cmd(slot, sdmmc_cmd_bits, 0); |
| 1143 | |||
| 1144 | /* keep the last clock value that was requested from core */ | ||
| 1145 | slot->__clk_old = clock; | ||
| 1142 | } | 1146 | } |
| 1143 | 1147 | ||
| 1144 | host->current_speed = clock; | 1148 | host->current_speed = clock; |
| @@ -249,6 +249,8 @@ extern int dw_mci_resume(struct dw_mci *host); · 248 unmodified lines | |||
| 249 | * @queue_node: List node for placing this node in the @queue list of | 249 | * @queue_node: List node for placing this node in the @queue list of |
| 250 | * &struct dw_mci. | 250 | * &struct dw_mci. |
| 251 | * @clock: Clock rate configured by set_ios(). Protected by host->lock. | 251 | * @clock: Clock rate configured by set_ios(). Protected by host->lock. |
| 252 | * @__clk_old: The last clock value that was requested from core. | ||
| 253 | * Keeping track of this helps us to avoid spamming the console. | ||
| 252 | * @flags: Random state bits associated with the slot. | 254 | * @flags: Random state bits associated with the slot. |
| 253 | * @id: Number of this slot. | 255 | * @id: Number of this slot. |
| 254 | * @sdio_id: Number of this slot in the SDIO interrupt registers. | 256 | * @sdio_id: Number of this slot in the SDIO interrupt registers. |
| @@ -263,6 +265,7 @@ struct dw_mci_slot { · 8 unmodified lines | |||
| 263 | struct list_head queue_node; | 265 | struct list_head queue_node; |
| 264 | 266 | ||
| 265 | unsigned int clock; | 267 | unsigned int clock; |
| 268 | unsigned int __clk_old; | ||
| 266 | 269 | ||
| 267 | unsigned long flags; | 270 | unsigned long flags; |
| 268 | #define DW_MMC_CARD_PRESENT 0 | 271 | #define DW_MMC_CARD_PRESENT 0 |
| @@ -1016,14 +1016,16 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) · 1015 unmodified lines | |||
| 1016 | 1016 | ||
| 1017 | /* Only reconfigure if we have a different burst size */ | 1017 | /* Only reconfigure if we have a different burst size */ |
| 1018 | if (*bp != burst) { | 1018 | if (*bp != burst) { |
| 1019 | struct dma_slave_config cfg; | 1019 | struct dma_slave_config cfg = { |
| 1020 | 1020 | .src_addr = host->phys_base + | |
| 1021 | cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1021 | OMAP_MMC_REG(host, DATA), |
| 1022 | cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1022 | .dst_addr = host->phys_base + |
| 1023 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1023 | OMAP_MMC_REG(host, DATA), |
| 1024 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1024 | .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
| 1025 | cfg.src_maxburst = burst; | 1025 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
| 1026 | cfg.dst_maxburst = burst; | 1026 | .src_maxburst = burst, |
| 1027 | .dst_maxburst = burst, | ||
| 1028 | }; | ||
| 1027 | 1029 | ||
| 1028 | if (dmaengine_slave_config(c, &cfg)) | 1030 | if (dmaengine_slave_config(c, &cfg)) |
| 1029 | goto use_pio; | 1031 | goto use_pio; |
| @@ -1409,11 +1409,18 @@ static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host, · 1408 unmodified lines | |||
| 1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, | 1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, |
| 1410 | struct mmc_request *req) | 1410 | struct mmc_request *req) |
| 1411 | { | 1411 | { |
| 1412 | struct dma_slave_config cfg; | ||
| 1413 | struct dma_async_tx_descriptor *tx; | 1412 | struct dma_async_tx_descriptor *tx; |
| 1414 | int ret = 0, i; | 1413 | int ret = 0, i; |
| 1415 | struct mmc_data *data = req->data; | 1414 | struct mmc_data *data = req->data; |
| 1416 | struct dma_chan *chan; | 1415 | struct dma_chan *chan; |
| 1416 | struct dma_slave_config cfg = { | ||
| 1417 | .src_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
| 1418 | .dst_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
| 1419 | .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
| 1420 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
| 1421 | .src_maxburst = data->blksz / 4, | ||
| 1422 | .dst_maxburst = data->blksz / 4, | ||
| 1423 | }; | ||
| 1417 | 1424 | ||
| 1418 | /* Sanity check: all the SG entries must be aligned by block size. */ | 1425 | /* Sanity check: all the SG entries must be aligned by block size. */ |
| 1419 | for (i = 0; i < data->sg_len; i++) { | 1426 | for (i = 0; i < data->sg_len; i++) { |
| @@ -1433,13 +1440,6 @@ static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, · 13 unmodified lines | |||
| 1433 | 1440 | ||
| 1434 | chan = omap_hsmmc_get_dma_chan(host, data); | 1441 | chan = omap_hsmmc_get_dma_chan(host, data); |
| 1435 | 1442 | ||
| 1436 | cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
| 1437 | cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
| 1438 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
| 1439 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
| 1440 | cfg.src_maxburst = data->blksz / 4; | ||
| 1441 | cfg.dst_maxburst = data->blksz / 4; | ||
| 1442 | |||
| 1443 | ret = dmaengine_slave_config(chan, &cfg); | 1443 | ret = dmaengine_slave_config(chan, &cfg); |
| 1444 | if (ret) | 1444 | if (ret) |
| 1445 | return ret; | 1445 | return ret; |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | struct st_mmc_platform_data { | 29 | struct st_mmc_platform_data { |
| 30 | struct reset_control *rstc; | 30 | struct reset_control *rstc; |
| 31 | struct clk *icnclk; | ||
| 31 | void __iomem *top_ioaddr; | 32 | void __iomem *top_ioaddr; |
| 32 | }; | 33 | }; |
| 33 | 34 | ||
| @@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev) · 319 unmodified lines | |||
| 353 | struct sdhci_host *host; | 354 | struct sdhci_host *host; |
| 354 | struct st_mmc_platform_data *pdata; | 355 | struct st_mmc_platform_data *pdata; |
| 355 | struct sdhci_pltfm_host *pltfm_host; | 356 | struct sdhci_pltfm_host *pltfm_host; |
| 356 | struct clk *clk; | 357 | struct clk *clk, *icnclk; |
| 357 | int ret = 0; | 358 | int ret = 0; |
| 358 | u16 host_version; | 359 | u16 host_version; |
| 359 | struct resource *res; | 360 | struct resource *res; |
| @@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev) · 5 unmodified lines | |||
| 365 | return PTR_ERR(clk); | 366 | return PTR_ERR(clk); |
| 366 | } | 367 | } |
| 367 | 368 | ||
| 369 | /* ICN clock isn't compulsory, but use it if it's provided. */ | ||
| 370 | icnclk = devm_clk_get(&pdev->dev, "icn"); | ||
| 371 | if (IS_ERR(icnclk)) | ||
| 372 | icnclk = NULL; | ||
| 373 | |||
| 368 | rstc = devm_reset_control_get(&pdev->dev, NULL); | 374 | rstc = devm_reset_control_get(&pdev->dev, NULL); |
| 369 | if (IS_ERR(rstc)) | 375 | if (IS_ERR(rstc)) |
| 370 | rstc = NULL; | 376 | rstc = NULL; |
| @@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev) · 18 unmodified lines | |||
| 389 | } | 395 | } |
| 390 | 396 | ||
| 391 | clk_prepare_enable(clk); | 397 | clk_prepare_enable(clk); |
| 398 | clk_prepare_enable(icnclk); | ||
| 392 | 399 | ||
| 393 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ | 400 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ |
| 394 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 401 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
| @@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev) · 5 unmodified lines | |||
| 400 | } | 407 | } |
| 401 | 408 | ||
| 402 | pltfm_host->clk = clk; | 409 | pltfm_host->clk = clk; |
| 410 | pdata->icnclk = icnclk; | ||
| 403 | 411 | ||
| 404 | /* Configure the Arasan HC inside the flashSS */ | 412 | /* Configure the Arasan HC inside the flashSS */ |
| 405 | st_mmcss_cconfig(np, host); | 413 | st_mmcss_cconfig(np, host); |
| @@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev) · 16 unmodified lines | |||
| 422 | return 0; | 430 | return 0; |
| 423 | 431 | ||
| 424 | err_out: | 432 | err_out: |
| 433 | clk_disable_unprepare(icnclk); | ||
| 425 | clk_disable_unprepare(clk); | 434 | clk_disable_unprepare(clk); |
| 426 | err_of: | 435 | err_of: |
| 427 | sdhci_pltfm_free(pdev); | 436 | sdhci_pltfm_free(pdev); |
| @@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev) · 14 unmodified lines | |||
| 442 | 451 | ||
| 443 | ret = sdhci_pltfm_unregister(pdev); | 452 | ret = sdhci_pltfm_unregister(pdev); |
| 444 | 453 | ||
| 454 | clk_disable_unprepare(pdata->icnclk); | ||
| 455 | |||
| 445 | if (rstc) | 456 | if (rstc) |
| 446 | reset_control_assert(rstc); | 457 | reset_control_assert(rstc); |
| 447 | 458 | ||
| @@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev) · 14 unmodified lines | |||
| 462 | if (pdata->rstc) | 473 | if (pdata->rstc) |
| 463 | reset_control_assert(pdata->rstc); | 474 | reset_control_assert(pdata->rstc); |
| 464 | 475 | ||
| 476 | clk_disable_unprepare(pdata->icnclk); | ||
| 465 | clk_disable_unprepare(pltfm_host->clk); | 477 | clk_disable_unprepare(pltfm_host->clk); |
| 466 | out: | 478 | out: |
| 467 | return ret; | 479 | return ret; |
| @@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev) · 7 unmodified lines | |||
| 475 | struct device_node *np = dev->of_node; | 487 | struct device_node *np = dev->of_node; |
| 476 | 488 | ||
| 477 | clk_prepare_enable(pltfm_host->clk); | 489 | clk_prepare_enable(pltfm_host->clk); |
| 490 | clk_prepare_enable(pdata->icnclk); | ||
| 478 | 491 | ||
| 479 | if (pdata->rstc) | 492 | if (pdata->rstc) |
| 480 | reset_control_deassert(pdata->rstc); | 493 | reset_control_deassert(pdata->rstc); |
| @@ -366,7 +366,8 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, · 365 unmodified lines | |||
| 366 | u8 *data, u32 bytes) | 366 | u8 *data, u32 bytes) |
| 367 | { | 367 | { |
| 368 | dma_addr_t addr; | 368 | dma_addr_t addr; |
| 369 | u32 *p, len, i; | 369 | u8 *p; |
| 370 | u32 len, i, val; | ||
| 370 | int ret = 0; | 371 | int ret = 0; |
| 371 | 372 | ||
| 372 | addr = dma_map_single(ecc->dev, data, bytes, DMA_TO_DEVICE); | 373 | addr = dma_map_single(ecc->dev, data, bytes, DMA_TO_DEVICE); |
| @@ -392,11 +393,14 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, · 19 unmodified lines | |||
| 392 | 393 | ||
| 393 | /* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */ | 394 | /* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */ |
| 394 | len = (config->strength * ECC_PARITY_BITS + 7) >> 3; | 395 | len = (config->strength * ECC_PARITY_BITS + 7) >> 3; |
| 395 | p = (u32 *)(data + bytes); | 396 | p = data + bytes; |
| 396 | 397 | ||
| 397 | /* write the parity bytes generated by the ECC back to the OOB region */ | 398 | /* write the parity bytes generated by the ECC back to the OOB region */ |
| 398 | for (i = 0; i < len; i++) | 399 | for (i = 0; i < len; i++) { |
| 399 | p[i] = readl(ecc->regs + ECC_ENCPAR(i)); | 400 | if ((i % 4) == 0) |
| 401 | val = readl(ecc->regs + ECC_ENCPAR(i / 4)); | ||
| 402 | p[i] = (val >> ((i % 4) * 8)) & 0xff; | ||
| 403 | } | ||
| 400 | timeout: | 404 | timeout: |
| 401 | 405 | ||
| 402 | dma_unmap_single(ecc->dev, addr, bytes, DMA_TO_DEVICE); | 406 | dma_unmap_single(ecc->dev, addr, bytes, DMA_TO_DEVICE); |
| @@ -93,6 +93,9 @@ · 92 unmodified lines | |||
| 93 | #define NFI_FSM_MASK (0xf << 16) | 93 | #define NFI_FSM_MASK (0xf << 16) |
| 94 | #define NFI_ADDRCNTR (0x70) | 94 | #define NFI_ADDRCNTR (0x70) |
| 95 | #define CNTR_MASK GENMASK(16, 12) | 95 | #define CNTR_MASK GENMASK(16, 12) |
| 96 | #define ADDRCNTR_SEC_SHIFT (12) | ||
| 97 | #define ADDRCNTR_SEC(val) \ | ||
| 98 | (((val) & CNTR_MASK) >> ADDRCNTR_SEC_SHIFT) | ||
| 96 | #define NFI_STRADDR (0x80) | 99 | #define NFI_STRADDR (0x80) |
| 97 | #define NFI_BYTELEN (0x84) | 100 | #define NFI_BYTELEN (0x84) |
| 98 | #define NFI_CSEL (0x90) | 101 | #define NFI_CSEL (0x90) |
| @@ -699,7 +702,7 @@ static int mtk_nfc_do_write_page(struct mtd_info *mtd, struct nand_chip *chip, · 600 unmodified lines | |||
| 699 | } | 702 | } |
| 700 | 703 | ||
| 701 | ret = readl_poll_timeout_atomic(nfc->regs + NFI_ADDRCNTR, reg, | 704 | ret = readl_poll_timeout_atomic(nfc->regs + NFI_ADDRCNTR, reg, |
| 702 | (reg & CNTR_MASK) >= chip->ecc.steps, | 705 | ADDRCNTR_SEC(reg) >= chip->ecc.steps, |
| 703 | 10, MTK_TIMEOUT); | 706 | 10, MTK_TIMEOUT); |
| 704 | if (ret) | 707 | if (ret) |
| 705 | dev_err(dev, "hwecc write timeout\n"); | 708 | dev_err(dev, "hwecc write timeout\n"); |
| @@ -902,7 +905,7 @@ static int mtk_nfc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, · 196 unmodified lines | |||
| 902 | dev_warn(nfc->dev, "read ahb/dma done timeout\n"); | 905 | dev_warn(nfc->dev, "read ahb/dma done timeout\n"); |
| 903 | 906 | ||
| 904 | rc = readl_poll_timeout_atomic(nfc->regs + NFI_BYTELEN, reg, | 907 | rc = readl_poll_timeout_atomic(nfc->regs + NFI_BYTELEN, reg, |
| 905 | (reg & CNTR_MASK) >= sectors, 10, | 908 | ADDRCNTR_SEC(reg) >= sectors, 10, |
| 906 | MTK_TIMEOUT); | 909 | MTK_TIMEOUT); |
| 907 | if (rc < 0) { | 910 | if (rc < 0) { |
| 908 | dev_err(nfc->dev, "subpage done timeout\n"); | 911 | dev_err(nfc->dev, "subpage done timeout\n"); |
| @@ -943,7 +943,7 @@ static int mxc_v2_ooblayout_free(struct mtd_info *mtd, int section, · 942 unmodified lines | |||
| 943 | struct nand_chip *nand_chip = mtd_to_nand(mtd); | 943 | struct nand_chip *nand_chip = mtd_to_nand(mtd); |
| 944 | int stepsize = nand_chip->ecc.bytes == 9 ? 16 : 26; | 944 | int stepsize = nand_chip->ecc.bytes == 9 ? 16 : 26; |
| 945 | 945 | ||
| 946 | if (section > nand_chip->ecc.steps) | 946 | if (section >= nand_chip->ecc.steps) |
| 947 | return -ERANGE; | 947 | return -ERANGE; |
| 948 | 948 | ||
| 949 | if (!section) { | 949 | if (!section) { |
| @@ -1341,9 +1341,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) · 1340 unmodified lines | |||
| 1341 | slave_dev->name); | 1341 | slave_dev->name); |
| 1342 | } | 1342 | } |
| 1343 | 1343 | ||
| 1344 | /* already enslaved */ | 1344 | /* already in-use? */ |
| 1345 | if (slave_dev->flags & IFF_SLAVE) { | 1345 | if (netdev_is_rx_handler_busy(slave_dev)) { |
| 1346 | netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); | 1346 | netdev_err(bond_dev, |
| 1347 | "Error: Device is in use and cannot be enslaved\n"); | ||
| 1347 | return -EBUSY; | 1348 | return -EBUSY; |
| 1348 | } | 1349 | } |
| 1349 | 1350 | ||
| @@ -1268,11 +1268,10 @@ static int __maybe_unused flexcan_suspend(struct device *device) · 1267 unmodified lines | |||
| 1268 | struct flexcan_priv *priv = netdev_priv(dev); | 1268 | struct flexcan_priv *priv = netdev_priv(dev); |
| 1269 | int err; | 1269 | int err; |
| 1270 | 1270 | ||
| 1271 | err = flexcan_chip_disable(priv); | ||
| 1272 | if (err) | ||
| 1273 | return err; | ||
| 1274 | |||
| 1275 | if (netif_running(dev)) { | 1271 | if (netif_running(dev)) { |
| 1272 | err = flexcan_chip_disable(priv); | ||
| 1273 | if (err) | ||
| 1274 | return err; | ||
| 1276 | netif_stop_queue(dev); | 1275 | netif_stop_queue(dev); |
| 1277 | netif_device_detach(dev); | 1276 | netif_device_detach(dev); |
| 1278 | } | 1277 | } |
| @@ -1285,13 +1284,17 @@ static int __maybe_unused flexcan_resume(struct device *device) · 6 unmodified lines | |||
| 1285 | { | 1284 | { |
| 1286 | struct net_device *dev = dev_get_drvdata(device); | 1285 | struct net_device *dev = dev_get_drvdata(device); |
| 1287 | struct flexcan_priv *priv = netdev_priv(dev); | 1286 | struct flexcan_priv *priv = netdev_priv(dev); |
| 1287 | int err; | ||
| 1288 | 1288 | ||
| 1289 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 1289 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
| 1290 | if (netif_running(dev)) { | 1290 | if (netif_running(dev)) { |
| 1291 | netif_device_attach(dev); | 1291 | netif_device_attach(dev); |
| 1292 | netif_start_queue(dev); | 1292 | netif_start_queue(dev); |
| 1293 | err = flexcan_chip_enable(priv); | ||
| 1294 | if (err) | ||
| 1295 | return err; | ||
| 1293 | } | 1296 | } |
| 1294 | return flexcan_chip_enable(priv); | 1297 | return 0; |
| 1295 | } | 1298 | } |
| 1296 | 1299 | ||
| 1297 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); | 1300 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); |
| @@ -81,6 +81,10 @@ · 80 unmodified lines | |||
| 81 | #define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6 BIT(15) | 81 | #define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6 BIT(15) |
| 82 | 82 | ||
| 83 | #define IFI_CANFD_TDELAY 0x1c | 83 | #define IFI_CANFD_TDELAY 0x1c |
| 84 | #define IFI_CANFD_TDELAY_DEFAULT 0xb | ||
| 85 | #define IFI_CANFD_TDELAY_MASK 0x3fff | ||
| 86 | #define IFI_CANFD_TDELAY_ABS BIT(14) | ||
| 87 | #define IFI_CANFD_TDELAY_EN BIT(15) | ||
| 84 | 88 | ||
| 85 | #define IFI_CANFD_ERROR 0x20 | 89 | #define IFI_CANFD_ERROR 0x20 |
| 86 | #define IFI_CANFD_ERROR_TX_OFFSET 0 | 90 | #define IFI_CANFD_ERROR_TX_OFFSET 0 |
| @@ -641,7 +645,7 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev) · 554 unmodified lines | |||
| 641 | struct ifi_canfd_priv *priv = netdev_priv(ndev); | 645 | struct ifi_canfd_priv *priv = netdev_priv(ndev); |
| 642 | const struct can_bittiming *bt = &priv->can.bittiming; | 646 | const struct can_bittiming *bt = &priv->can.bittiming; |
| 643 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | 647 | const struct can_bittiming *dbt = &priv->can.data_bittiming; |
| 644 | u16 brp, sjw, tseg1, tseg2; | 648 | u16 brp, sjw, tseg1, tseg2, tdc; |
| 645 | 649 | ||
| 646 | /* Configure bit timing */ | 650 | /* Configure bit timing */ |
| 647 | brp = bt->brp - 2; | 651 | brp = bt->brp - 2; |
| @@ -664,6 +668,11 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev) · 16 unmodified lines | |||
| 664 | (brp << IFI_CANFD_TIME_PRESCALE_OFF) | | 668 | (brp << IFI_CANFD_TIME_PRESCALE_OFF) | |
| 665 | (sjw << IFI_CANFD_TIME_SJW_OFF_7_9_8_8), | 669 | (sjw << IFI_CANFD_TIME_SJW_OFF_7_9_8_8), |
| 666 | priv->base + IFI_CANFD_FTIME); | 670 | priv->base + IFI_CANFD_FTIME); |
| 671 | |||
| 672 | /* Configure transmitter delay */ | ||
| 673 | tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK; | ||
| 674 | writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc, | ||
| 675 | priv->base + IFI_CANFD_TDELAY); | ||
| 667 | } | 676 | } |
| 668 | 677 | ||
| 669 | static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id, | 678 | static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id, |
| @@ -205,8 +205,8 @@ static inline void name##_writeq(struct bcm_sf2_priv *priv, u64 val, \ · 204 unmodified lines | |||
| 205 | static inline void intrl2_##which##_mask_clear(struct bcm_sf2_priv *priv, \ | 205 | static inline void intrl2_##which##_mask_clear(struct bcm_sf2_priv *priv, \ |
| 206 | u32 mask) \ | 206 | u32 mask) \ |
| 207 | { \ | 207 | { \ |
| 208 | intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ | ||
| 209 | priv->irq##which##_mask &= ~(mask); \ | 208 | priv->irq##which##_mask &= ~(mask); \ |
| 209 | intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ | ||
| 210 | } \ | 210 | } \ |
| 211 | static inline void intrl2_##which##_mask_set(struct bcm_sf2_priv *priv, \ | 211 | static inline void intrl2_##which##_mask_set(struct bcm_sf2_priv *priv, \ |
| 212 | u32 mask) \ | 212 | u32 mask) \ |
| @@ -2656,15 +2656,19 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) · 2655 unmodified lines | |||
| 2656 | return ret; | 2656 | return ret; |
| 2657 | } | 2657 | } |
| 2658 | 2658 | ||
| 2659 | /* Rate Control: disable ingress rate limiting. */ | ||
| 2659 | if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) || | 2660 | if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) || |
| 2660 | mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) || | 2661 | mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) || |
| 2661 | mv88e6xxx_6185_family(chip) || mv88e6xxx_6095_family(chip) || | ||
| 2662 | mv88e6xxx_6320_family(chip)) { | 2662 | mv88e6xxx_6320_family(chip)) { |
| 2663 | /* Rate Control: disable ingress rate limiting. */ | ||
| 2664 | ret = _mv88e6xxx_reg_write(chip, REG_PORT(port), | 2663 | ret = _mv88e6xxx_reg_write(chip, REG_PORT(port), |
| 2665 | PORT_RATE_CONTROL, 0x0001); | 2664 | PORT_RATE_CONTROL, 0x0001); |
| 2666 | if (ret) | 2665 | if (ret) |
| 2667 | return ret; | 2666 | return ret; |
| 2667 | } else if (mv88e6xxx_6185_family(chip) || mv88e6xxx_6095_family(chip)) { | ||
| 2668 | ret = _mv88e6xxx_reg_write(chip, REG_PORT(port), | ||
| 2669 | PORT_RATE_CONTROL, 0x0000); | ||
| 2670 | if (ret) | ||
| 2671 | return ret; | ||
| 2668 | } | 2672 | } |
| 2669 | 2673 | ||
| 2670 | /* Port Control 1: disable trunking, disable sending | 2674 | /* Port Control 1: disable trunking, disable sending |
| @@ -1545,6 +1545,8 @@ static const struct pci_device_id alx_pci_tbl[] = { · 1544 unmodified lines | |||
| 1545 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, | 1545 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, |
| 1546 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2400), | 1546 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2400), |
| 1547 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, | 1547 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, |
| 1548 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_E2500), | ||
| 1549 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, | ||
| 1548 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8162), | 1550 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8162), |
| 1549 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, | 1551 | .driver_data = ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG }, |
| 1550 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8171) }, | 1552 | { PCI_VDEVICE(ATTANSIC, ALX_DEV_ID_AR8171) }, |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | |||
| 38 | #define ALX_DEV_ID_AR8161 0x1091 | 38 | #define ALX_DEV_ID_AR8161 0x1091 |
| 39 | #define ALX_DEV_ID_E2200 0xe091 | 39 | #define ALX_DEV_ID_E2200 0xe091 |
| 40 | #define ALX_DEV_ID_E2400 0xe0a1 | 40 | #define ALX_DEV_ID_E2400 0xe0a1 |
| 41 | #define ALX_DEV_ID_E2500 0xe0b1 | ||
| 41 | #define ALX_DEV_ID_AR8162 0x1090 | 42 | #define ALX_DEV_ID_AR8162 0x1090 |
| 42 | #define ALX_DEV_ID_AR8171 0x10A1 | 43 | #define ALX_DEV_ID_AR8171 0x10A1 |
| 43 | #define ALX_DEV_ID_AR8172 0x10A0 | 44 | #define ALX_DEV_ID_AR8172 0x10A0 |
| @@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_device *core) · 158 unmodified lines | |||
| 159 | 159 | ||
| 160 | if (!bgmac_is_bcm4707_family(core)) { | 160 | if (!bgmac_is_bcm4707_family(core)) { |
| 161 | mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); | 161 | mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr); |
| 162 | if (!IS_ERR(mii_bus)) { | 162 | if (IS_ERR(mii_bus)) { |
| 163 | err = PTR_ERR(mii_bus); | 163 | err = PTR_ERR(mii_bus); |
| 164 | goto err; | 164 | goto err; |
| 165 | } | 165 | } |
| @@ -6356,10 +6356,6 @@ bnx2_open(struct net_device *dev) · 6355 unmodified lines | |||
| 6356 | struct bnx2 *bp = netdev_priv(dev); | 6356 | struct bnx2 *bp = netdev_priv(dev); |
| 6357 | int rc; | 6357 | int rc; |
| 6358 | 6358 | ||
| 6359 | rc = bnx2_request_firmware(bp); | ||
| 6360 | if (rc < 0) | ||
| 6361 | goto out; | ||
| 6362 | |||
| 6363 | netif_carrier_off(dev); | 6359 | netif_carrier_off(dev); |
| 6364 | 6360 | ||
| 6365 | bnx2_disable_int(bp); | 6361 | bnx2_disable_int(bp); |
| @@ -6428,7 +6424,6 @@ open_err: · 62 unmodified lines | |||
| 6428 | bnx2_free_irq(bp); | 6424 | bnx2_free_irq(bp); |
| 6429 | bnx2_free_mem(bp); | 6425 | bnx2_free_mem(bp); |
| 6430 | bnx2_del_napi(bp); | 6426 | bnx2_del_napi(bp); |
| 6431 | bnx2_release_firmware(bp); | ||
| 6432 | goto out; | 6427 | goto out; |
| 6433 | } | 6428 | } |
| 6434 | 6429 | ||
| @@ -8575,6 +8570,12 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 2140 unmodified lines | |||
| 8575 | 8570 | ||
| 8576 | pci_set_drvdata(pdev, dev); | 8571 | pci_set_drvdata(pdev, dev); |
| 8577 | 8572 | ||
| 8573 | rc = bnx2_request_firmware(bp); | ||
| 8574 | if (rc < 0) | ||
| 8575 | goto error; | ||
| 8576 | |||
| 8577 | |||
| 8578 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); | ||
| 8578 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); | 8579 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); |
| 8579 | 8580 | ||
| 8580 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | | 8581 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | |
| @@ -8607,6 +8608,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 26 unmodified lines | |||
| 8607 | return 0; | 8608 | return 0; |
| 8608 | 8609 | ||
| 8609 | error: | 8610 | error: |
| 8611 | bnx2_release_firmware(bp); | ||
| 8610 | pci_iounmap(pdev, bp->regview); | 8612 | pci_iounmap(pdev, bp->regview); |
| 8611 | pci_release_regions(pdev); | 8613 | pci_release_regions(pdev); |
| 8612 | pci_disable_device(pdev); | 8614 | pci_disable_device(pdev); |
| @@ -772,6 +772,11 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl) · 771 unmodified lines | |||
| 772 | (bp->common.bc_ver & 0xff00) >> 8, | 772 | (bp->common.bc_ver & 0xff00) >> 8, |
| 773 | (bp->common.bc_ver & 0xff)); | 773 | (bp->common.bc_ver & 0xff)); |
| 774 | 774 | ||
| 775 | if (pci_channel_offline(bp->pdev)) { | ||
| 776 | BNX2X_ERR("Cannot dump MCP info while in PCI error\n"); | ||
| 777 | return; | ||
| 778 | } | ||
| 779 | |||
| 775 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); | 780 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); |
| 776 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) | 781 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) |
| 777 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); | 782 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); |
| @@ -9415,10 +9420,16 @@ unload_error: · 8637 unmodified lines | |||
| 9415 | /* Release IRQs */ | 9420 | /* Release IRQs */ |
| 9416 | bnx2x_free_irq(bp); | 9421 | bnx2x_free_irq(bp); |
| 9417 | 9422 | ||
| 9418 | /* Reset the chip */ | 9423 | /* Reset the chip, unless PCI function is offline. If we reach this |
| 9419 | rc = bnx2x_reset_hw(bp, reset_code); | 9424 | * point following a PCI error handling, it means device is really |
| 9420 | if (rc) | 9425 | * in a bad state and we're about to remove it, so reset the chip |
| 9421 | BNX2X_ERR("HW_RESET failed\n"); | 9426 | * is not a good idea. |
| 9427 | */ | ||
| 9428 | if (!pci_channel_offline(bp->pdev)) { | ||
| 9429 | rc = bnx2x_reset_hw(bp, reset_code); | ||
| 9430 | if (rc) | ||
| 9431 | BNX2X_ERR("HW_RESET failed\n"); | ||
| 9432 | } | ||
| 9422 | 9433 | ||
| 9423 | /* Report UNLOAD_DONE to MCP */ | 9434 | /* Report UNLOAD_DONE to MCP */ |
| 9424 | bnx2x_send_unload_done(bp, keep_link); | 9435 | bnx2x_send_unload_done(bp, keep_link); |
| @@ -353,8 +353,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) · 352 unmodified lines | |||
| 353 | push_len = (length + sizeof(*tx_push) + 7) / 8; | 353 | push_len = (length + sizeof(*tx_push) + 7) / 8; |
| 354 | if (push_len > 16) { | 354 | if (push_len > 16) { |
| 355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); | 355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); |
| 356 | __iowrite64_copy(txr->tx_doorbell + 4, tx_push_buf + 1, | 356 | __iowrite32_copy(txr->tx_doorbell + 4, tx_push_buf + 1, |
| 357 | push_len - 16); | 357 | (push_len - 16) << 1); |
| 358 | } else { | 358 | } else { |
| 359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, | 359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, |
| 360 | push_len); | 360 | push_len); |
| @@ -14012,6 +14012,7 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) · 14011 unmodified lines | |||
| 14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || | 14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || |
| 14013 | (!ec->rx_coalesce_usecs) || | 14013 | (!ec->rx_coalesce_usecs) || |
| 14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || | 14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || |
| 14015 | (!ec->tx_coalesce_usecs) || | ||
| 14015 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || | 14016 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || |
| 14016 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || | 14017 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || |
| 14017 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || | 14018 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || |
| @@ -14022,16 +14023,6 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) · 4 unmodified lines | |||
| 14022 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) | 14023 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) |
| 14023 | return -EINVAL; | 14024 | return -EINVAL; |
| 14024 | 14025 | ||
| 14025 | /* No rx interrupts will be generated if both are zero */ | ||
| 14026 | if ((ec->rx_coalesce_usecs == 0) && | ||
| 14027 | (ec->rx_max_coalesced_frames == 0)) | ||
| 14028 | return -EINVAL; | ||
| 14029 | |||
| 14030 | /* No tx interrupts will be generated if both are zero */ | ||
| 14031 | if ((ec->tx_coalesce_usecs == 0) && | ||
| 14032 | (ec->tx_max_coalesced_frames == 0)) | ||
| 14033 | return -EINVAL; | ||
| 14034 | |||
| 14035 | /* Only copy relevant parameters, ignore all others. */ | 14026 | /* Only copy relevant parameters, ignore all others. */ |
| 14036 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; | 14027 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; |
| 14037 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; | 14028 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; |
| @@ -31,15 +31,10 @@ · 30 unmodified lines | |||
| 31 | #define BNAD_NUM_TXF_COUNTERS 12 | 31 | #define BNAD_NUM_TXF_COUNTERS 12 |
| 32 | #define BNAD_NUM_RXF_COUNTERS 10 | 32 | #define BNAD_NUM_RXF_COUNTERS 10 |
| 33 | #define BNAD_NUM_CQ_COUNTERS (3 + 5) | 33 | #define BNAD_NUM_CQ_COUNTERS (3 + 5) |
| 34 | #define BNAD_NUM_RXQ_COUNTERS 6 | 34 | #define BNAD_NUM_RXQ_COUNTERS 7 |
| 35 | #define BNAD_NUM_TXQ_COUNTERS 5 | 35 | #define BNAD_NUM_TXQ_COUNTERS 5 |
| 36 | 36 | ||
| 37 | #define BNAD_ETHTOOL_STATS_NUM \ | 37 | static const char *bnad_net_stats_strings[] = { |
| 38 | (sizeof(struct rtnl_link_stats64) / sizeof(u64) + \ | ||
| 39 | sizeof(struct bnad_drv_stats) / sizeof(u64) + \ | ||
| 40 | offsetof(struct bfi_enet_stats, rxf_stats[0]) / sizeof(u64)) | ||
| 41 | |||
| 42 | static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { | ||
| 43 | "rx_packets", | 38 | "rx_packets", |
| 44 | "tx_packets", | 39 | "tx_packets", |
| 45 | "rx_bytes", | 40 | "rx_bytes", |
| @@ -50,22 +45,10 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { · 4 unmodified lines | |||
| 50 | "tx_dropped", | 45 | "tx_dropped", |
| 51 | "multicast", | 46 | "multicast", |
| 52 | "collisions", | 47 | "collisions", |
| 53 | |||
| 54 | "rx_length_errors", | 48 | "rx_length_errors", |
| 55 | "rx_over_errors", | ||
| 56 | "rx_crc_errors", | 49 | "rx_crc_errors", |
| 57 | "rx_frame_errors", | 50 | "rx_frame_errors", |
| 58 | "rx_fifo_errors", | ||
| 59 | "rx_missed_errors", | ||
| 60 | |||
| 61 | "tx_aborted_errors", | ||
| 62 | "tx_carrier_errors", | ||
| 63 | "tx_fifo_errors", | 51 | "tx_fifo_errors", |
| 64 | "tx_heartbeat_errors", | ||
| 65 | "tx_window_errors", | ||
| 66 | |||
| 67 | "rx_compressed", | ||
| 68 | "tx_compressed", | ||
| 69 | 52 | ||
| 70 | "netif_queue_stop", | 53 | "netif_queue_stop", |
| 71 | "netif_queue_wakeup", | 54 | "netif_queue_wakeup", |
| @@ -254,6 +237,8 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { · 182 unmodified lines | |||
| 254 | "fc_tx_fid_parity_errors", | 237 | "fc_tx_fid_parity_errors", |
| 255 | }; | 238 | }; |
| 256 | 239 | ||
| 240 | #define BNAD_ETHTOOL_STATS_NUM ARRAY_SIZE(bnad_net_stats_strings) | ||
| 241 | |||
| 257 | static int | 242 | static int |
| 258 | bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | 243 | bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) |
| 259 | { | 244 | { |
| @@ -658,6 +643,8 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) · 398 unmodified lines | |||
| 658 | string += ETH_GSTRING_LEN; | 643 | string += ETH_GSTRING_LEN; |
| 659 | sprintf(string, "rxq%d_allocbuf_failed", q_num); | 644 | sprintf(string, "rxq%d_allocbuf_failed", q_num); |
| 660 | string += ETH_GSTRING_LEN; | 645 | string += ETH_GSTRING_LEN; |
| 646 | sprintf(string, "rxq%d_mapbuf_failed", q_num); | ||
| 647 | string += ETH_GSTRING_LEN; | ||
| 661 | sprintf(string, "rxq%d_producer_index", q_num); | 648 | sprintf(string, "rxq%d_producer_index", q_num); |
| 662 | string += ETH_GSTRING_LEN; | 649 | string += ETH_GSTRING_LEN; |
| 663 | sprintf(string, "rxq%d_consumer_index", q_num); | 650 | sprintf(string, "rxq%d_consumer_index", q_num); |
| @@ -678,6 +665,9 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) · 14 unmodified lines | |||
| 678 | sprintf(string, "rxq%d_allocbuf_failed", | 665 | sprintf(string, "rxq%d_allocbuf_failed", |
| 679 | q_num); | 666 | q_num); |
| 680 | string += ETH_GSTRING_LEN; | 667 | string += ETH_GSTRING_LEN; |
| 668 | sprintf(string, "rxq%d_mapbuf_failed", | ||
| 669 | q_num); | ||
| 670 | string += ETH_GSTRING_LEN; | ||
| 681 | sprintf(string, "rxq%d_producer_index", | 671 | sprintf(string, "rxq%d_producer_index", |
| 682 | q_num); | 672 | q_num); |
| 683 | string += ETH_GSTRING_LEN; | 673 | string += ETH_GSTRING_LEN; |
| @@ -854,9 +844,9 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, · 170 unmodified lines | |||
| 854 | u64 *buf) | 844 | u64 *buf) |
| 855 | { | 845 | { |
| 856 | struct bnad *bnad = netdev_priv(netdev); | 846 | struct bnad *bnad = netdev_priv(netdev); |
| 857 | int i, j, bi; | 847 | int i, j, bi = 0; |
| 858 | unsigned long flags; | 848 | unsigned long flags; |
| 859 | struct rtnl_link_stats64 *net_stats64; | 849 | struct rtnl_link_stats64 net_stats64; |
| 860 | u64 *stats64; | 850 | u64 *stats64; |
| 861 | u32 bmap; | 851 | u32 bmap; |
| 862 | 852 | ||
| @@ -871,14 +861,25 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, · 8 unmodified lines | |||
| 871 | * under the same lock | 861 | * under the same lock |
| 872 | */ | 862 | */ |
| 873 | spin_lock_irqsave(&bnad->bna_lock, flags); | 863 | spin_lock_irqsave(&bnad->bna_lock, flags); |
| 874 | bi = 0; | ||
| 875 | memset(buf, 0, stats->n_stats * sizeof(u64)); | ||
| 876 | |||
| 877 | net_stats64 = (struct rtnl_link_stats64 *)buf; | ||
| 878 | bnad_netdev_qstats_fill(bnad, net_stats64); | ||
| 879 | bnad_netdev_hwstats_fill(bnad, net_stats64); | ||
| 880 | 864 | ||
| 881 | bi = sizeof(*net_stats64) / sizeof(u64); | 865 | memset(&net_stats64, 0, sizeof(net_stats64)); |
| 866 | bnad_netdev_qstats_fill(bnad, &net_stats64); | ||
| 867 | bnad_netdev_hwstats_fill(bnad, &net_stats64); | ||
| 868 | |||
| 869 | buf[bi++] = net_stats64.rx_packets; | ||
| 870 | buf[bi++] = net_stats64.tx_packets; | ||
| 871 | buf[bi++] = net_stats64.rx_bytes; | ||
| 872 | buf[bi++] = net_stats64.tx_bytes; | ||
| 873 | buf[bi++] = net_stats64.rx_errors; | ||
| 874 | buf[bi++] = net_stats64.tx_errors; | ||
| 875 | buf[bi++] = net_stats64.rx_dropped; | ||
| 876 | buf[bi++] = net_stats64.tx_dropped; | ||
| 877 | buf[bi++] = net_stats64.multicast; | ||
| 878 | buf[bi++] = net_stats64.collisions; | ||
| 879 | buf[bi++] = net_stats64.rx_length_errors; | ||
| 880 | buf[bi++] = net_stats64.rx_crc_errors; | ||
| 881 | buf[bi++] = net_stats64.rx_frame_errors; | ||
| 882 | buf[bi++] = net_stats64.tx_fifo_errors; | ||
| 882 | 883 | ||
| 883 | /* Get netif_queue_stopped from stack */ | 884 | /* Get netif_queue_stopped from stack */ |
| 884 | bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev); | 885 | bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev); |
| @@ -1323,6 +1323,24 @@ dma_error: · 1322 unmodified lines | |||
| 1323 | return 0; | 1323 | return 0; |
| 1324 | } | 1324 | } |
| 1325 | 1325 | ||
| 1326 | static inline int macb_clear_csum(struct sk_buff *skb) | ||
| 1327 | { | ||
| 1328 | /* no change for packets without checksum offloading */ | ||
| 1329 | if (skb->ip_summed != CHECKSUM_PARTIAL) | ||
| 1330 | return 0; | ||
| 1331 | |||
| 1332 | /* make sure we can modify the header */ | ||
| 1333 | if (unlikely(skb_cow_head(skb, 0))) | ||
| 1334 | return -1; | ||
| 1335 | |||
| 1336 | /* initialize checksum field | ||
| 1337 | * This is required - at least for Zynq, which otherwise calculates | ||
| 1338 | * wrong UDP header checksums for UDP packets with UDP data len <=2 | ||
| 1339 | */ | ||
| 1340 | *(__sum16 *)(skb_checksum_start(skb) + skb->csum_offset) = 0; | ||
| 1341 | return 0; | ||
| 1342 | } | ||
| 1343 | |||
| 1326 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1344 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 1327 | { | 1345 | { |
| 1328 | u16 queue_index = skb_get_queue_mapping(skb); | 1346 | u16 queue_index = skb_get_queue_mapping(skb); |
| @@ -1362,6 +1380,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) · 33 unmodified lines | |||
| 1362 | return NETDEV_TX_BUSY; | 1380 | return NETDEV_TX_BUSY; |
| 1363 | } | 1381 | } |
| 1364 | 1382 | ||
| 1383 | if (macb_clear_csum(skb)) { | ||
| 1384 | dev_kfree_skb_any(skb); | ||
| 1385 | return NETDEV_TX_OK; | ||
| 1386 | } | ||
| 1387 | |||
| 1365 | /* Map socket buffer for DMA transfer */ | 1388 | /* Map socket buffer for DMA transfer */ |
| 1366 | if (!macb_tx_map(bp, queue, skb)) { | 1389 | if (!macb_tx_map(bp, queue, skb)) { |
| 1367 | dev_kfree_skb_any(skb); | 1390 | dev_kfree_skb_any(skb); |
| @@ -279,6 +279,7 @@ struct nicvf { · 278 unmodified lines | |||
| 279 | u8 sqs_id; | 279 | u8 sqs_id; |
| 280 | bool sqs_mode; | 280 | bool sqs_mode; |
| 281 | bool hw_tso; | 281 | bool hw_tso; |
| 282 | bool t88; | ||
| 282 | 283 | ||
| 283 | /* Receive buffer alloc */ | 284 | /* Receive buffer alloc */ |
| 284 | u32 rb_page_offset; | 285 | u32 rb_page_offset; |
| @@ -251,9 +251,14 @@ static void nic_set_tx_pkt_pad(struct nicpf *nic, int size) · 250 unmodified lines | |||
| 251 | int lmac; | 251 | int lmac; |
| 252 | u64 lmac_cfg; | 252 | u64 lmac_cfg; |
| 253 | 253 | ||
| 254 | /* Max value that can be set is 60 */ | 254 | /* There is a issue in HW where-in while sending GSO sized |
| 255 | if (size > 60) | 255 | * pkts as part of TSO, if pkt len falls below this size |
| 256 | size = 60; | 256 | * NIC will zero PAD packet and also updates IP total length. |
| 257 | * Hence set this value to lessthan min pkt size of MAC+IP+TCP | ||
| 258 | * headers, BGX will do the padding to transmit 64 byte pkt. | ||
| 259 | */ | ||
| 260 | if (size > 52) | ||
| 261 | size = 52; | ||
| 257 | 262 | ||
| 258 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { | 263 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { |
| 259 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); | 264 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); |
| @@ -170,7 +170,6 @@ · 169 unmodified lines | |||
| 170 | #define NIC_QSET_SQ_0_7_DOOR (0x010838) | 170 | #define NIC_QSET_SQ_0_7_DOOR (0x010838) |
| 171 | #define NIC_QSET_SQ_0_7_STATUS (0x010840) | 171 | #define NIC_QSET_SQ_0_7_STATUS (0x010840) |
| 172 | #define NIC_QSET_SQ_0_7_DEBUG (0x010848) | 172 | #define NIC_QSET_SQ_0_7_DEBUG (0x010848) |
| 173 | #define NIC_QSET_SQ_0_7_CNM_CHG (0x010860) | ||
| 174 | #define NIC_QSET_SQ_0_7_STAT_0_1 (0x010900) | 173 | #define NIC_QSET_SQ_0_7_STAT_0_1 (0x010900) |
| 175 | 174 | ||
| 176 | #define NIC_QSET_RBDR_0_1_CFG (0x010C00) | 175 | #define NIC_QSET_RBDR_0_1_CFG (0x010C00) |
| @@ -382,7 +382,10 @@ static void nicvf_get_regs(struct net_device *dev, · 381 unmodified lines | |||
| 382 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); | 382 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q); |
| 383 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); | 383 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q); |
| 384 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); | 384 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q); |
| 385 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CNM_CHG, q); | 385 | /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which |
| 386 | * produces bus errors when read | ||
| 387 | */ | ||
| 388 | p[i++] = 0; | ||
| 386 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); | 389 | p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q); |
| 387 | reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); | 390 | reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3); |
| 388 | p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); | 391 | p[i++] = nicvf_queue_reg_read(nic, reg_offset, q); |
| @@ -513,6 +513,7 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, · 512 unmodified lines | |||
| 513 | struct nicvf *nic = netdev_priv(netdev); | 513 | struct nicvf *nic = netdev_priv(netdev); |
| 514 | struct snd_queue *sq; | 514 | struct snd_queue *sq; |
| 515 | struct sq_hdr_subdesc *hdr; | 515 | struct sq_hdr_subdesc *hdr; |
| 516 | struct sq_hdr_subdesc *tso_sqe; | ||
| 516 | 517 | ||
| 517 | sq = &nic->qs->sq[cqe_tx->sq_idx]; | 518 | sq = &nic->qs->sq[cqe_tx->sq_idx]; |
| 518 | 519 | ||
| @@ -527,17 +528,21 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, · 8 unmodified lines | |||
| 527 | 528 | ||
| 528 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); | 529 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); |
| 529 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; | 530 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; |
| 530 | /* For TSO offloaded packets only one SQE will have a valid SKB */ | ||
| 531 | if (skb) { | 531 | if (skb) { |
| 532 | /* Check for dummy descriptor used for HW TSO offload on 88xx */ | ||
| 533 | if (hdr->dont_send) { | ||
| 534 | /* Get actual TSO descriptors and free them */ | ||
| 535 | tso_sqe = | ||
| 536 | (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2); | ||
| 537 | nicvf_put_sq_desc(sq, tso_sqe->subdesc_cnt + 1); | ||
| 538 | } | ||
| 532 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 539 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
| 533 | prefetch(skb); | 540 | prefetch(skb); |
| 534 | dev_consume_skb_any(skb); | 541 | dev_consume_skb_any(skb); |
| 535 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; | 542 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; |
| 536 | } else { | 543 | } else { |
| 537 | /* In case of HW TSO, HW sends a CQE for each segment of a TSO | 544 | /* In case of SW TSO on 88xx, only last segment will have |
| 538 | * packet instead of a single CQE for the whole TSO packet | 545 | * a SKB attached, so just free SQEs here. |
| 539 | * transmitted. Each of this CQE points to the same SQE, so | ||
| 540 | * avoid freeing same SQE multiple times. | ||
| 541 | */ | 546 | */ |
| 542 | if (!nic->hw_tso) | 547 | if (!nic->hw_tso) |
| 543 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 548 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
| @@ -1502,6 +1507,7 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 958 unmodified lines | |||
| 1502 | struct net_device *netdev; | 1507 | struct net_device *netdev; |
| 1503 | struct nicvf *nic; | 1508 | struct nicvf *nic; |
| 1504 | int err, qcount; | 1509 | int err, qcount; |
| 1510 | u16 sdevid; | ||
| 1505 | 1511 | ||
| 1506 | err = pci_enable_device(pdev); | 1512 | err = pci_enable_device(pdev); |
| 1507 | if (err) { | 1513 | if (err) { |
| @@ -1575,6 +1581,10 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 67 unmodified lines | |||
| 1575 | if (!pass1_silicon(nic->pdev)) | 1581 | if (!pass1_silicon(nic->pdev)) |
| 1576 | nic->hw_tso = true; | 1582 | nic->hw_tso = true; |
| 1577 | 1583 | ||
| 1584 | pci_read_config_word(nic->pdev, PCI_SUBSYSTEM_ID, &sdevid); | ||
| 1585 | if (sdevid == 0xA134) | ||
| 1586 | nic->t88 = true; | ||
| 1587 | |||
| 1578 | /* Check if this VF is in QS only mode */ | 1588 | /* Check if this VF is in QS only mode */ |
| 1579 | if (nic->sqs_mode) | 1589 | if (nic->sqs_mode) |
| 1580 | return 0; | 1590 | return 0; |
| @@ -938,6 +938,8 @@ static int nicvf_tso_count_subdescs(struct sk_buff *skb) · 937 unmodified lines | |||
| 938 | return num_edescs + sh->gso_segs; | 938 | return num_edescs + sh->gso_segs; |
| 939 | } | 939 | } |
| 940 | 940 | ||
| 941 | #define POST_CQE_DESC_COUNT 2 | ||
| 942 | |||
| 941 | /* Get the number of SQ descriptors needed to xmit this skb */ | 943 | /* Get the number of SQ descriptors needed to xmit this skb */ |
| 942 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) | 944 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) |
| 943 | { | 945 | { |
| @@ -948,6 +950,10 @@ static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) · 4 unmodified lines | |||
| 948 | return subdesc_cnt; | 950 | return subdesc_cnt; |
| 949 | } | 951 | } |
| 950 | 952 | ||
| 953 | /* Dummy descriptors to get TSO pkt completion notification */ | ||
| 954 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) | ||
| 955 | subdesc_cnt += POST_CQE_DESC_COUNT; | ||
| 956 | |||
| 951 | if (skb_shinfo(skb)->nr_frags) | 957 | if (skb_shinfo(skb)->nr_frags) |
| 952 | subdesc_cnt += skb_shinfo(skb)->nr_frags; | 958 | subdesc_cnt += skb_shinfo(skb)->nr_frags; |
| 953 | 959 | ||
| @@ -965,14 +971,21 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry, · 11 unmodified lines | |||
| 965 | struct sq_hdr_subdesc *hdr; | 971 | struct sq_hdr_subdesc *hdr; |
| 966 | 972 | ||
| 967 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | 973 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); |
| 968 | sq->skbuff[qentry] = (u64)skb; | ||
| 969 | |||
| 970 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | 974 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); |
| 971 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | 975 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; |
| 972 | /* Enable notification via CQE after processing SQE */ | 976 | |
| 973 | hdr->post_cqe = 1; | 977 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) { |
| 974 | /* No of subdescriptors following this */ | 978 | /* post_cqe = 0, to avoid HW posting a CQE for every TSO |
| 975 | hdr->subdesc_cnt = subdesc_cnt; | 979 | * segment transmitted on 88xx. |
| 980 | */ | ||
| 981 | hdr->subdesc_cnt = subdesc_cnt - POST_CQE_DESC_COUNT; | ||
| 982 | } else { | ||
| 983 | sq->skbuff[qentry] = (u64)skb; | ||
| 984 | /* Enable notification via CQE after processing SQE */ | ||
| 985 | hdr->post_cqe = 1; | ||
| 986 | /* No of subdescriptors following this */ | ||
| 987 | hdr->subdesc_cnt = subdesc_cnt; | ||
| 988 | } | ||
| 976 | hdr->tot_len = len; | 989 | hdr->tot_len = len; |
| 977 | 990 | ||
| 978 | /* Offload checksum calculation to HW */ | 991 | /* Offload checksum calculation to HW */ |
| @@ -1023,6 +1036,37 @@ static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry, · 44 unmodified lines | |||
| 1023 | gather->addr = data; | 1036 | gather->addr = data; |
| 1024 | } | 1037 | } |
| 1025 | 1038 | ||
| 1039 | /* Add HDR + IMMEDIATE subdescriptors right after descriptors of a TSO | ||
| 1040 | * packet so that a CQE is posted as a notifation for transmission of | ||
| 1041 | * TSO packet. | ||
| 1042 | */ | ||
| 1043 | static inline void nicvf_sq_add_cqe_subdesc(struct snd_queue *sq, int qentry, | ||
| 1044 | int tso_sqe, struct sk_buff *skb) | ||
| 1045 | { | ||
| 1046 | struct sq_imm_subdesc *imm; | ||
| 1047 | struct sq_hdr_subdesc *hdr; | ||
| 1048 | |||
| 1049 | sq->skbuff[qentry] = (u64)skb; | ||
| 1050 | |||
| 1051 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | ||
| 1052 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | ||
| 1053 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | ||
| 1054 | /* Enable notification via CQE after processing SQE */ | ||
| 1055 | hdr->post_cqe = 1; | ||
| 1056 | /* There is no packet to transmit here */ | ||
| 1057 | hdr->dont_send = 1; | ||
| 1058 | hdr->subdesc_cnt = POST_CQE_DESC_COUNT - 1; | ||
| 1059 | hdr->tot_len = 1; | ||
| 1060 | /* Actual TSO header SQE index, needed for cleanup */ | ||
| 1061 | hdr->rsvd2 = tso_sqe; | ||
| 1062 | |||
| 1063 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
| 1064 | imm = (struct sq_imm_subdesc *)GET_SQ_DESC(sq, qentry); | ||
| 1065 | memset(imm, 0, SND_QUEUE_DESC_SIZE); | ||
| 1066 | imm->subdesc_type = SQ_DESC_TYPE_IMMEDIATE; | ||
| 1067 | imm->len = 1; | ||
| 1068 | } | ||
| 1069 | |||
| 1026 | /* Segment a TSO packet into 'gso_size' segments and append | 1070 | /* Segment a TSO packet into 'gso_size' segments and append |
| 1027 | * them to SQ for transfer | 1071 | * them to SQ for transfer |
| 1028 | */ | 1072 | */ |
| @@ -1096,7 +1140,7 @@ static int nicvf_sq_append_tso(struct nicvf *nic, struct snd_queue *sq, · 67 unmodified lines | |||
| 1096 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | 1140 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) |
| 1097 | { | 1141 | { |
| 1098 | int i, size; | 1142 | int i, size; |
| 1099 | int subdesc_cnt; | 1143 | int subdesc_cnt, tso_sqe = 0; |
| 1100 | int sq_num, qentry; | 1144 | int sq_num, qentry; |
| 1101 | struct queue_set *qs; | 1145 | struct queue_set *qs; |
| 1102 | struct snd_queue *sq; | 1146 | struct snd_queue *sq; |
| @@ -1131,6 +1175,7 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) · 28 unmodified lines | |||
| 1131 | /* Add SQ header subdesc */ | 1175 | /* Add SQ header subdesc */ |
| 1132 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, | 1176 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, |
| 1133 | skb, skb->len); | 1177 | skb, skb->len); |
| 1178 | tso_sqe = qentry; | ||
| 1134 | 1179 | ||
| 1135 | /* Add SQ gather subdescs */ | 1180 | /* Add SQ gather subdescs */ |
| 1136 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | 1181 | qentry = nicvf_get_nxt_sqentry(sq, qentry); |
| @@ -1154,6 +1199,11 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) · 17 unmodified lines | |||
| 1154 | } | 1199 | } |
| 1155 | 1200 | ||
| 1156 | doorbell: | 1201 | doorbell: |
| 1202 | if (nic->t88 && skb_shinfo(skb)->gso_size) { | ||
| 1203 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
| 1204 | nicvf_sq_add_cqe_subdesc(sq, qentry, tso_sqe, skb); | ||
| 1205 | } | ||
| 1206 | |||
| 1157 | /* make sure all memory stores are done before ringing doorbell */ | 1207 | /* make sure all memory stores are done before ringing doorbell */ |
| 1158 | smp_wmb(); | 1208 | smp_wmb(); |
| 1159 | 1209 | ||
| @@ -419,8 +419,8 @@ struct link_config { · 418 unmodified lines | |||
| 419 | unsigned short supported; /* link capabilities */ | 419 | unsigned short supported; /* link capabilities */ |
| 420 | unsigned short advertising; /* advertised capabilities */ | 420 | unsigned short advertising; /* advertised capabilities */ |
| 421 | unsigned short lp_advertising; /* peer advertised capabilities */ | 421 | unsigned short lp_advertising; /* peer advertised capabilities */ |
| 422 | unsigned short requested_speed; /* speed user has requested */ | 422 | unsigned int requested_speed; /* speed user has requested */ |
| 423 | unsigned short speed; /* actual link speed */ | 423 | unsigned int speed; /* actual link speed */ |
| 424 | unsigned char requested_fc; /* flow control user has requested */ | 424 | unsigned char requested_fc; /* flow control user has requested */ |
| 425 | unsigned char fc; /* actual link flow control */ | 425 | unsigned char fc; /* actual link flow control */ |
| 426 | unsigned char autoneg; /* autonegotiating? */ | 426 | unsigned char autoneg; /* autonegotiating? */ |
| @@ -4305,10 +4305,17 @@ static const struct pci_error_handlers cxgb4_eeh = { · 4304 unmodified lines | |||
| 4305 | .resume = eeh_resume, | 4305 | .resume = eeh_resume, |
| 4306 | }; | 4306 | }; |
| 4307 | 4307 | ||
| 4308 | /* Return true if the Link Configuration supports "High Speeds" (those greater | ||
| 4309 | * than 1Gb/s). | ||
| 4310 | */ | ||
| 4308 | static inline bool is_x_10g_port(const struct link_config *lc) | 4311 | static inline bool is_x_10g_port(const struct link_config *lc) |
| 4309 | { | 4312 | { |
| 4310 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || | 4313 | unsigned int speeds, high_speeds; |
| 4311 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; | 4314 | |
| 4315 | speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); | ||
| 4316 | high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); | ||
| 4317 | |||
| 4318 | return high_speeds != 0; | ||
| 4312 | } | 4319 | } |
| 4313 | 4320 | ||
| 4314 | static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, | 4321 | static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, |
| @@ -4335,6 +4342,11 @@ static void cfg_queues(struct adapter *adap) · 20 unmodified lines | |||
| 4335 | #endif | 4342 | #endif |
| 4336 | int ciq_size; | 4343 | int ciq_size; |
| 4337 | 4344 | ||
| 4345 | /* Reduce memory usage in kdump environment, disable all offload. | ||
| 4346 | */ | ||
| 4347 | if (is_kdump_kernel()) | ||
| 4348 | adap->params.offload = 0; | ||
| 4349 | |||
| 4338 | for_each_port(adap, i) | 4350 | for_each_port(adap, i) |
| 4339 | n10g += is_x_10g_port(&adap2pinfo(adap, i)->link_cfg); | 4351 | n10g += is_x_10g_port(&adap2pinfo(adap, i)->link_cfg); |
| 4340 | #ifdef CONFIG_CHELSIO_T4_DCB | 4352 | #ifdef CONFIG_CHELSIO_T4_DCB |
| @@ -4365,11 +4377,6 @@ static void cfg_queues(struct adapter *adap) · 24 unmodified lines | |||
| 4365 | if (q10g > netif_get_num_default_rss_queues()) | 4377 | if (q10g > netif_get_num_default_rss_queues()) |
| 4366 | q10g = netif_get_num_default_rss_queues(); | 4378 | q10g = netif_get_num_default_rss_queues(); |
| 4367 | 4379 | ||
| 4368 | /* Reduce memory usage in kdump environment, disable all offload. | ||
| 4369 | */ | ||
| 4370 | if (is_kdump_kernel()) | ||
| 4371 | adap->params.offload = 0; | ||
| 4372 | |||
| 4373 | for_each_port(adap, i) { | 4380 | for_each_port(adap, i) { |
| 4374 | struct port_info *pi = adap2pinfo(adap, i); | 4381 | struct port_info *pi = adap2pinfo(adap, i); |
| 4375 | 4382 | ||
| @@ -4756,8 +4763,12 @@ static void print_port_info(const struct net_device *dev) · 380 unmodified lines | |||
| 4756 | bufp += sprintf(bufp, "1000/"); | 4763 | bufp += sprintf(bufp, "1000/"); |
| 4757 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) | 4764 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) |
| 4758 | bufp += sprintf(bufp, "10G/"); | 4765 | bufp += sprintf(bufp, "10G/"); |
| 4766 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_25G) | ||
| 4767 | bufp += sprintf(bufp, "25G/"); | ||
| 4759 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) | 4768 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) |
| 4760 | bufp += sprintf(bufp, "40G/"); | 4769 | bufp += sprintf(bufp, "40G/"); |
| 4770 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G) | ||
| 4771 | bufp += sprintf(bufp, "100G/"); | ||
| 4761 | if (bufp != buf) | 4772 | if (bufp != buf) |
| 4762 | --bufp; | 4773 | --bufp; |
| 4763 | sprintf(bufp, "BASE-%s", t4_get_port_type_description(pi->port_type)); | 4774 | sprintf(bufp, "BASE-%s", t4_get_port_type_description(pi->port_type)); |
| @@ -3627,7 +3627,8 @@ void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf) · 3626 unmodified lines | |||
| 3627 | } | 3627 | } |
| 3628 | 3628 | ||
| 3629 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 3629 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
| 3630 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ | 3630 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ |
| 3631 | FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ | ||
| 3631 | FW_PORT_CAP_ANEG) | 3632 | FW_PORT_CAP_ANEG) |
| 3632 | 3633 | ||
| 3633 | /** | 3634 | /** |
| @@ -7196,8 +7197,12 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) · 3562 unmodified lines | |||
| 7196 | speed = 1000; | 7197 | speed = 1000; |
| 7197 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) | 7198 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) |
| 7198 | speed = 10000; | 7199 | speed = 10000; |
| 7200 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) | ||
| 7201 | speed = 25000; | ||
| 7199 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) | 7202 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) |
| 7200 | speed = 40000; | 7203 | speed = 40000; |
| 7204 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) | ||
| 7205 | speed = 100000; | ||
| 7201 | 7206 | ||
| 7202 | lc = &pi->link_cfg; | 7207 | lc = &pi->link_cfg; |
| 7203 | 7208 | ||
| @@ -2265,6 +2265,12 @@ enum fw_port_cap { · 2264 unmodified lines | |||
| 2265 | FW_PORT_CAP_802_3_ASM_DIR = 0x8000, | 2265 | FW_PORT_CAP_802_3_ASM_DIR = 0x8000, |
| 2266 | }; | 2266 | }; |
| 2267 | 2267 | ||
| 2268 | #define FW_PORT_CAP_SPEED_S 0 | ||
| 2269 | #define FW_PORT_CAP_SPEED_M 0x3f | ||
| 2270 | #define FW_PORT_CAP_SPEED_V(x) ((x) << FW_PORT_CAP_SPEED_S) | ||
| 2271 | #define FW_PORT_CAP_SPEED_G(x) \ | ||
| 2272 | (((x) >> FW_PORT_CAP_SPEED_S) & FW_PORT_CAP_SPEED_M) | ||
| 2273 | |||
| 2268 | enum fw_port_mdi { | 2274 | enum fw_port_mdi { |
| 2269 | FW_PORT_CAP_MDI_UNCHANGED, | 2275 | FW_PORT_CAP_MDI_UNCHANGED, |
| 2270 | FW_PORT_CAP_MDI_AUTO, | 2276 | FW_PORT_CAP_MDI_AUTO, |
| @@ -108,8 +108,8 @@ struct link_config { · 107 unmodified lines | |||
| 108 | unsigned int supported; /* link capabilities */ | 108 | unsigned int supported; /* link capabilities */ |
| 109 | unsigned int advertising; /* advertised capabilities */ | 109 | unsigned int advertising; /* advertised capabilities */ |
| 110 | unsigned short lp_advertising; /* peer advertised capabilities */ | 110 | unsigned short lp_advertising; /* peer advertised capabilities */ |
| 111 | unsigned short requested_speed; /* speed user has requested */ | 111 | unsigned int requested_speed; /* speed user has requested */ |
| 112 | unsigned short speed; /* actual link speed */ | 112 | unsigned int speed; /* actual link speed */ |
| 113 | unsigned char requested_fc; /* flow control user has requested */ | 113 | unsigned char requested_fc; /* flow control user has requested */ |
| 114 | unsigned char fc; /* actual link flow control */ | 114 | unsigned char fc; /* actual link flow control */ |
| 115 | unsigned char autoneg; /* autonegotiating? */ | 115 | unsigned char autoneg; /* autonegotiating? */ |
| @@ -271,10 +271,17 @@ static inline bool is_10g_port(const struct link_config *lc) · 155 unmodified lines | |||
| 271 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; | 271 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /* Return true if the Link Configuration supports "High Speeds" (those greater | ||
| 275 | * than 1Gb/s). | ||
| 276 | */ | ||
| 274 | static inline bool is_x_10g_port(const struct link_config *lc) | 277 | static inline bool is_x_10g_port(const struct link_config *lc) |
| 275 | { | 278 | { |
| 276 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || | 279 | unsigned int speeds, high_speeds; |
| 277 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; | 280 | |
| 281 | speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); | ||
| 282 | high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); | ||
| 283 | |||
| 284 | return high_speeds != 0; | ||
| 278 | } | 285 | } |
| 279 | 286 | ||
| 280 | static inline unsigned int core_ticks_per_usec(const struct adapter *adapter) | 287 | static inline unsigned int core_ticks_per_usec(const struct adapter *adapter) |
| @@ -314,8 +314,9 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, · 313 unmodified lines | |||
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 316 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
| 317 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ | 317 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ |
| 318 | FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) | 318 | FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ |
| 319 | FW_PORT_CAP_ANEG) | ||
| 319 | 320 | ||
| 320 | /** | 321 | /** |
| 321 | * init_link_config - initialize a link's SW state | 322 | * init_link_config - initialize a link's SW state |
| @@ -1712,8 +1713,12 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl) · 1390 unmodified lines | |||
| 1712 | speed = 1000; | 1713 | speed = 1000; |
| 1713 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) | 1714 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) |
| 1714 | speed = 10000; | 1715 | speed = 10000; |
| 1716 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) | ||
| 1717 | speed = 25000; | ||
| 1715 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) | 1718 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) |
| 1716 | speed = 40000; | 1719 | speed = 40000; |
| 1720 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) | ||
| 1721 | speed = 100000; | ||
| 1717 | 1722 | ||
| 1718 | /* | 1723 | /* |
| 1719 | * Scan all of our "ports" (Virtual Interfaces) looking for | 1724 | * Scan all of our "ports" (Virtual Interfaces) looking for |
| @@ -2922,17 +2922,25 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus, · 2921 unmodified lines | |||
| 2922 | { | 2922 | { |
| 2923 | unsigned int size = lstatus & BD_LENGTH_MASK; | 2923 | unsigned int size = lstatus & BD_LENGTH_MASK; |
| 2924 | struct page *page = rxb->page; | 2924 | struct page *page = rxb->page; |
| 2925 | bool last = !!(lstatus & BD_LFLAG(RXBD_LAST)); | ||
| 2925 | 2926 | ||
| 2926 | /* Remove the FCS from the packet length */ | 2927 | /* Remove the FCS from the packet length */ |
| 2927 | if (likely(lstatus & BD_LFLAG(RXBD_LAST))) | 2928 | if (last) |
| 2928 | size -= ETH_FCS_LEN; | 2929 | size -= ETH_FCS_LEN; |
| 2929 | 2930 | ||
| 2930 | if (likely(first)) | 2931 | if (likely(first)) { |
| 2931 | skb_put(skb, size); | 2932 | skb_put(skb, size); |
| 2932 | else | 2933 | } else { |
| 2933 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | 2934 | /* the last fragments' length contains the full frame length */ |
| 2934 | rxb->page_offset + RXBUF_ALIGNMENT, | 2935 | if (last) |
| 2935 | size, GFAR_RXB_TRUESIZE); | 2936 | size -= skb->len; |
| 2937 | |||
| 2938 | /* in case the last fragment consisted only of the FCS */ | ||
| 2939 | if (size > 0) | ||
| 2940 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | ||
| 2941 | rxb->page_offset + RXBUF_ALIGNMENT, | ||
| 2942 | size, GFAR_RXB_TRUESIZE); | ||
| 2943 | } | ||
| 2936 | 2944 | ||
| 2937 | /* try reuse page */ | 2945 | /* try reuse page */ |
| 2938 | if (unlikely(page_count(page) != 1)) | 2946 | if (unlikely(page_count(page) != 1)) |
| @@ -100,7 +100,8 @@ extern const char gfar_driver_version[]; · 99 unmodified lines | |||
| 100 | #define DEFAULT_RX_LFC_THR 16 | 100 | #define DEFAULT_RX_LFC_THR 16 |
| 101 | #define DEFAULT_LFC_PTVVAL 4 | 101 | #define DEFAULT_LFC_PTVVAL 4 |
| 102 | 102 | ||
| 103 | #define GFAR_RXB_SIZE 1536 | 103 | /* prevent fragmenation by HW in DSA environments */ |
| 104 | #define GFAR_RXB_SIZE roundup(1536 + 8, 64) | ||
| 104 | #define GFAR_SKBFRAG_SIZE (RXBUF_ALIGNMENT + GFAR_RXB_SIZE \ | 105 | #define GFAR_SKBFRAG_SIZE (RXBUF_ALIGNMENT + GFAR_RXB_SIZE \ |
| 105 | + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) | 106 | + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) |
| 106 | #define GFAR_RXB_TRUESIZE 2048 | 107 | #define GFAR_RXB_TRUESIZE 2048 |
| @@ -328,9 +328,10 @@ static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb) · 327 unmodified lines | |||
| 328 | static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb) | 328 | static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb) |
| 329 | { | 329 | { |
| 330 | u32 port; | 330 | u32 port; |
| 331 | struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev; | ||
| 332 | 331 | ||
| 333 | if (ppe_cb->ppe_common_cb) { | 332 | if (ppe_cb->ppe_common_cb) { |
| 333 | struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev; | ||
| 334 | |||
| 334 | port = ppe_cb->index; | 335 | port = ppe_cb->index; |
| 335 | dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0); | 336 | dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0); |
| 336 | } | 337 | } |
| @@ -977,7 +977,37 @@ static void emac_set_multicast_list(struct net_device *ndev) · 976 unmodified lines | |||
| 977 | dev->mcast_pending = 1; | 977 | dev->mcast_pending = 1; |
| 978 | return; | 978 | return; |
| 979 | } | 979 | } |
| 980 | |||
| 981 | mutex_lock(&dev->link_lock); | ||
| 980 | __emac_set_multicast_list(dev); | 982 | __emac_set_multicast_list(dev); |
| 983 | mutex_unlock(&dev->link_lock); | ||
| 984 | } | ||
| 985 | |||
| 986 | static int emac_set_mac_address(struct net_device *ndev, void *sa) | ||
| 987 | { | ||
| 988 | struct emac_instance *dev = netdev_priv(ndev); | ||
| 989 | struct sockaddr *addr = sa; | ||
| 990 | struct emac_regs __iomem *p = dev->emacp; | ||
| 991 | |||
| 992 | if (!is_valid_ether_addr(addr->sa_data)) | ||
| 993 | return -EADDRNOTAVAIL; | ||
| 994 | |||
| 995 | mutex_lock(&dev->link_lock); | ||
| 996 | |||
| 997 | memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); | ||
| 998 | |||
| 999 | emac_rx_disable(dev); | ||
| 1000 | emac_tx_disable(dev); | ||
| 1001 | out_be32(&p->iahr, (ndev->dev_addr[0] << 8) | ndev->dev_addr[1]); | ||
| 1002 | out_be32(&p->ialr, (ndev->dev_addr[2] << 24) | | ||
| 1003 | (ndev->dev_addr[3] << 16) | (ndev->dev_addr[4] << 8) | | ||
| 1004 | ndev->dev_addr[5]); | ||
| 1005 | emac_tx_enable(dev); | ||
| 1006 | emac_rx_enable(dev); | ||
| 1007 | |||
| 1008 | mutex_unlock(&dev->link_lock); | ||
| 1009 | |||
| 1010 | return 0; | ||
| 981 | } | 1011 | } |
| 982 | 1012 | ||
| 983 | static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu) | 1013 | static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu) |
| @@ -2686,7 +2716,7 @@ static const struct net_device_ops emac_netdev_ops = { · 1702 unmodified lines | |||
| 2686 | .ndo_do_ioctl = emac_ioctl, | 2716 | .ndo_do_ioctl = emac_ioctl, |
| 2687 | .ndo_tx_timeout = emac_tx_timeout, | 2717 | .ndo_tx_timeout = emac_tx_timeout, |
| 2688 | .ndo_validate_addr = eth_validate_addr, | 2718 | .ndo_validate_addr = eth_validate_addr, |
| 2689 | .ndo_set_mac_address = eth_mac_addr, | 2719 | .ndo_set_mac_address = emac_set_mac_address, |
| 2690 | .ndo_start_xmit = emac_start_xmit, | 2720 | .ndo_start_xmit = emac_start_xmit, |
| 2691 | .ndo_change_mtu = eth_change_mtu, | 2721 | .ndo_change_mtu = eth_change_mtu, |
| 2692 | }; | 2722 | }; |
| @@ -2699,7 +2729,7 @@ static const struct net_device_ops emac_gige_netdev_ops = { · 6 unmodified lines | |||
| 2699 | .ndo_do_ioctl = emac_ioctl, | 2729 | .ndo_do_ioctl = emac_ioctl, |
| 2700 | .ndo_tx_timeout = emac_tx_timeout, | 2730 | .ndo_tx_timeout = emac_tx_timeout, |
| 2701 | .ndo_validate_addr = eth_validate_addr, | 2731 | .ndo_validate_addr = eth_validate_addr, |
| 2702 | .ndo_set_mac_address = eth_mac_addr, | 2732 | .ndo_set_mac_address = emac_set_mac_address, |
| 2703 | .ndo_start_xmit = emac_start_xmit_sg, | 2733 | .ndo_start_xmit = emac_start_xmit_sg, |
| 2704 | .ndo_change_mtu = emac_change_mtu, | 2734 | .ndo_change_mtu = emac_change_mtu, |
| 2705 | }; | 2735 | }; |
| @@ -199,6 +199,7 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi) · 198 unmodified lines | |||
| 199 | void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) | 199 | void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) |
| 200 | { | 200 | { |
| 201 | struct i40e_client_instance *cdev; | 201 | struct i40e_client_instance *cdev; |
| 202 | int ret = 0; | ||
| 202 | 203 | ||
| 203 | if (!vsi) | 204 | if (!vsi) |
| 204 | return; | 205 | return; |
| @@ -211,7 +212,14 @@ void i40e_notify_client_of_netdev_open(struct i40e_vsi *vsi) · 6 unmodified lines | |||
| 211 | "Cannot locate client instance open routine\n"); | 212 | "Cannot locate client instance open routine\n"); |
| 212 | continue; | 213 | continue; |
| 213 | } | 214 | } |
| 214 | cdev->client->ops->open(&cdev->lan_info, cdev->client); | 215 | if (!(test_bit(__I40E_CLIENT_INSTANCE_OPENED, |
| 216 | &cdev->state))) { | ||
| 217 | ret = cdev->client->ops->open(&cdev->lan_info, | ||
| 218 | cdev->client); | ||
| 219 | if (!ret) | ||
| 220 | set_bit(__I40E_CLIENT_INSTANCE_OPENED, | ||
| 221 | &cdev->state); | ||
| 222 | } | ||
| 215 | } | 223 | } |
| 216 | } | 224 | } |
| 217 | mutex_unlock(&i40e_client_instance_mutex); | 225 | mutex_unlock(&i40e_client_instance_mutex); |
| @@ -407,12 +415,14 @@ struct i40e_vsi *i40e_vsi_lookup(struct i40e_pf *pf, · 189 unmodified lines | |||
| 407 | * i40e_client_add_instance - add a client instance struct to the instance list | 415 | * i40e_client_add_instance - add a client instance struct to the instance list |
| 408 | * @pf: pointer to the board struct | 416 | * @pf: pointer to the board struct |
| 409 | * @client: pointer to a client struct in the client list. | 417 | * @client: pointer to a client struct in the client list. |
| 418 | * @existing: if there was already an existing instance | ||
| 410 | * | 419 | * |
| 411 | * Returns cdev ptr on success, NULL on failure | 420 | * Returns cdev ptr on success or if already exists, NULL on failure |
| 412 | **/ | 421 | **/ |
| 413 | static | 422 | static |
| 414 | struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, | 423 | struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, |
| 415 | struct i40e_client *client) | 424 | struct i40e_client *client, |
| 425 | bool *existing) | ||
| 416 | { | 426 | { |
| 417 | struct i40e_client_instance *cdev; | 427 | struct i40e_client_instance *cdev; |
| 418 | struct netdev_hw_addr *mac = NULL; | 428 | struct netdev_hw_addr *mac = NULL; |
| @@ -421,7 +431,7 @@ struct i40e_client_instance *i40e_client_add_instance(struct i40e_pf *pf, · 2 unmodified lines | |||
| 421 | mutex_lock(&i40e_client_instance_mutex); | 431 | mutex_lock(&i40e_client_instance_mutex); |
| 422 | list_for_each_entry(cdev, &i40e_client_instances, list) { | 432 | list_for_each_entry(cdev, &i40e_client_instances, list) { |
| 423 | if ((cdev->lan_info.pf == pf) && (cdev->client == client)) { | 433 | if ((cdev->lan_info.pf == pf) && (cdev->client == client)) { |
| 424 | cdev = NULL; | 434 | *existing = true; |
| 425 | goto out; | 435 | goto out; |
| 426 | } | 436 | } |
| 427 | } | 437 | } |
| @@ -505,6 +515,7 @@ void i40e_client_subtask(struct i40e_pf *pf) · 77 unmodified lines | |||
| 505 | { | 515 | { |
| 506 | struct i40e_client_instance *cdev; | 516 | struct i40e_client_instance *cdev; |
| 507 | struct i40e_client *client; | 517 | struct i40e_client *client; |
| 518 | bool existing = false; | ||
| 508 | int ret = 0; | 519 | int ret = 0; |
| 509 | 520 | ||
| 510 | if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED)) | 521 | if (!(pf->flags & I40E_FLAG_SERVICE_CLIENT_REQUESTED)) |
| @@ -528,18 +539,25 @@ void i40e_client_subtask(struct i40e_pf *pf) · 17 unmodified lines | |||
| 528 | /* check if L2 VSI is up, if not we are not ready */ | 539 | /* check if L2 VSI is up, if not we are not ready */ |
| 529 | if (test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state)) | 540 | if (test_bit(__I40E_DOWN, &pf->vsi[pf->lan_vsi]->state)) |
| 530 | continue; | 541 | continue; |
| 542 | } else { | ||
| 543 | dev_warn(&pf->pdev->dev, "This client %s is being instanciated at probe\n", | ||
| 544 | client->name); | ||
| 531 | } | 545 | } |
| 532 | 546 | ||
| 533 | /* Add the client instance to the instance list */ | 547 | /* Add the client instance to the instance list */ |
| 534 | cdev = i40e_client_add_instance(pf, client); | 548 | cdev = i40e_client_add_instance(pf, client, &existing); |
| 535 | if (!cdev) | 549 | if (!cdev) |
| 536 | continue; | 550 | continue; |
| 537 | 551 | ||
| 538 | /* Also up the ref_cnt of no. of instances of this client */ | 552 | if (!existing) { |
| 539 | atomic_inc(&client->ref_cnt); | 553 | /* Also up the ref_cnt for no. of instances of this |
| 540 | dev_info(&pf->pdev->dev, "Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n", | 554 | * client. |
| 541 | client->name, pf->hw.pf_id, | 555 | */ |
| 542 | pf->hw.bus.device, pf->hw.bus.func); | 556 | atomic_inc(&client->ref_cnt); |
| 557 | dev_info(&pf->pdev->dev, "Added instance of Client %s to PF%d bus=0x%02x func=0x%02x\n", | ||
| 558 | client->name, pf->hw.pf_id, | ||
| 559 | pf->hw.bus.device, pf->hw.bus.func); | ||
| 560 | } | ||
| 543 | 561 | ||
| 544 | /* Send an Open request to the client */ | 562 | /* Send an Open request to the client */ |
| 545 | atomic_inc(&cdev->ref_cnt); | 563 | atomic_inc(&cdev->ref_cnt); |
| @@ -588,7 +606,8 @@ int i40e_lan_add_device(struct i40e_pf *pf) · 42 unmodified lines | |||
| 588 | pf->hw.pf_id, pf->hw.bus.device, pf->hw.bus.func); | 606 | pf->hw.pf_id, pf->hw.bus.device, pf->hw.bus.func); |
| 589 | 607 | ||
| 590 | /* Since in some cases register may have happened before a device gets | 608 | /* Since in some cases register may have happened before a device gets |
| 591 | * added, we can schedule a subtask to go initiate the clients. | 609 | * added, we can schedule a subtask to go initiate the clients if |
| 610 | * they can be launched at probe time. | ||
| 592 | */ | 611 | */ |
| 593 | pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED; | 612 | pf->flags |= I40E_FLAG_SERVICE_CLIENT_REQUESTED; |
| 594 | i40e_service_event_schedule(pf); | 613 | i40e_service_event_schedule(pf); |
| @@ -5113,9 +5113,13 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) · 5112 unmodified lines | |||
| 5113 | DCB_CAP_DCBX_VER_IEEE; | 5113 | DCB_CAP_DCBX_VER_IEEE; |
| 5114 | 5114 | ||
| 5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; | 5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; |
| 5116 | /* Enable DCB tagging only when more than one TC */ | 5116 | /* Enable DCB tagging only when more than one TC |
| 5117 | * or explicitly disable if only one TC | ||
| 5118 | */ | ||
| 5117 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) | 5119 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) |
| 5118 | pf->flags |= I40E_FLAG_DCB_ENABLED; | 5120 | pf->flags |= I40E_FLAG_DCB_ENABLED; |
| 5121 | else | ||
| 5122 | pf->flags &= ~I40E_FLAG_DCB_ENABLED; | ||
| 5119 | dev_dbg(&pf->pdev->dev, | 5123 | dev_dbg(&pf->pdev->dev, |
| 5120 | "DCBX offload is supported for this PF.\n"); | 5124 | "DCBX offload is supported for this PF.\n"); |
| 5121 | } | 5125 | } |
| @@ -5431,7 +5435,6 @@ int i40e_open(struct net_device *netdev) · 309 unmodified lines | |||
| 5431 | wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16); | 5435 | wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16); |
| 5432 | 5436 | ||
| 5433 | udp_tunnel_get_rx_info(netdev); | 5437 | udp_tunnel_get_rx_info(netdev); |
| 5434 | i40e_notify_client_of_netdev_open(vsi); | ||
| 5435 | 5438 | ||
| 5436 | return 0; | 5439 | return 0; |
| 5437 | } | 5440 | } |
| @@ -5717,7 +5720,7 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, · 279 unmodified lines | |||
| 5717 | u8 type; | 5720 | u8 type; |
| 5718 | 5721 | ||
| 5719 | /* Not DCB capable or capability disabled */ | 5722 | /* Not DCB capable or capability disabled */ |
| 5720 | if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) | 5723 | if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) |
| 5721 | return ret; | 5724 | return ret; |
| 5722 | 5725 | ||
| 5723 | /* Ignore if event is not for Nearest Bridge */ | 5726 | /* Ignore if event is not for Nearest Bridge */ |
| @@ -7897,6 +7900,7 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf) · 2173 unmodified lines | |||
| 7897 | #endif | 7900 | #endif |
| 7898 | I40E_FLAG_RSS_ENABLED | | 7901 | I40E_FLAG_RSS_ENABLED | |
| 7899 | I40E_FLAG_DCB_CAPABLE | | 7902 | I40E_FLAG_DCB_CAPABLE | |
| 7903 | I40E_FLAG_DCB_ENABLED | | ||
| 7900 | I40E_FLAG_SRIOV_ENABLED | | 7904 | I40E_FLAG_SRIOV_ENABLED | |
| 7901 | I40E_FLAG_FD_SB_ENABLED | | 7905 | I40E_FLAG_FD_SB_ENABLED | |
| 7902 | I40E_FLAG_FD_ATR_ENABLED | | 7906 | I40E_FLAG_FD_ATR_ENABLED | |
| @@ -10503,6 +10507,7 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) · 2600 unmodified lines | |||
| 10503 | I40E_FLAG_FD_SB_ENABLED | | 10507 | I40E_FLAG_FD_SB_ENABLED | |
| 10504 | I40E_FLAG_FD_ATR_ENABLED | | 10508 | I40E_FLAG_FD_ATR_ENABLED | |
| 10505 | I40E_FLAG_DCB_CAPABLE | | 10509 | I40E_FLAG_DCB_CAPABLE | |
| 10510 | I40E_FLAG_DCB_ENABLED | | ||
| 10506 | I40E_FLAG_SRIOV_ENABLED | | 10511 | I40E_FLAG_SRIOV_ENABLED | |
| 10507 | I40E_FLAG_VMDQ_ENABLED); | 10512 | I40E_FLAG_VMDQ_ENABLED); |
| 10508 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | | 10513 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | |
| @@ -10526,7 +10531,8 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) · 17 unmodified lines | |||
| 10526 | /* Not enough queues for all TCs */ | 10531 | /* Not enough queues for all TCs */ |
| 10527 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && | 10532 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && |
| 10528 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { | 10533 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { |
| 10529 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10534 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | |
| 10535 | I40E_FLAG_DCB_ENABLED); | ||
| 10530 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); | 10536 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); |
| 10531 | } | 10537 | } |
| 10532 | pf->num_lan_qps = max_t(int, pf->rss_size_max, | 10538 | pf->num_lan_qps = max_t(int, pf->rss_size_max, |
| @@ -10923,7 +10929,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 390 unmodified lines | |||
| 10923 | err = i40e_init_pf_dcb(pf); | 10929 | err = i40e_init_pf_dcb(pf); |
| 10924 | if (err) { | 10930 | if (err) { |
| 10925 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); | 10931 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); |
| 10926 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10932 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE & I40E_FLAG_DCB_ENABLED); |
| 10927 | /* Continue without DCB enabled */ | 10933 | /* Continue without DCB enabled */ |
| 10928 | } | 10934 | } |
| 10929 | #endif /* CONFIG_I40E_DCB */ | 10935 | #endif /* CONFIG_I40E_DCB */ |
| @@ -2958,8 +2958,10 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) · 2957 unmodified lines | |||
| 2958 | } | 2958 | } |
| 2959 | 2959 | ||
| 2960 | /* was that the last pool using this rar? */ | 2960 | /* was that the last pool using this rar? */ |
| 2961 | if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0) | 2961 | if (mpsar_lo == 0 && mpsar_hi == 0 && |
| 2962 | rar != 0 && rar != hw->mac.san_mac_rar_index) | ||
| 2962 | hw->mac.ops.clear_rar(hw, rar); | 2963 | hw->mac.ops.clear_rar(hw, rar); |
| 2964 | |||
| 2963 | return 0; | 2965 | return 0; |
| 2964 | } | 2966 | } |
| 2965 | 2967 | ||
| @@ -50,6 +50,10 @@ static const struct mtk_ethtool_stats { · 49 unmodified lines | |||
| 50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), | 50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | static const char * const mtk_clks_source_name[] = { | ||
| 54 | "ethif", "esw", "gp1", "gp2" | ||
| 55 | }; | ||
| 56 | |||
| 53 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) | 57 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) |
| 54 | { | 58 | { |
| 55 | __raw_writel(val, eth->base + reg); | 59 | __raw_writel(val, eth->base + reg); |
| @@ -291,7 +295,7 @@ err_phy: · 235 unmodified lines | |||
| 291 | static int mtk_mdio_init(struct mtk_eth *eth) | 295 | static int mtk_mdio_init(struct mtk_eth *eth) |
| 292 | { | 296 | { |
| 293 | struct device_node *mii_np; | 297 | struct device_node *mii_np; |
| 294 | int err; | 298 | int ret; |
| 295 | 299 | ||
| 296 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); | 300 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); |
| 297 | if (!mii_np) { | 301 | if (!mii_np) { |
| @@ -300,13 +304,13 @@ static int mtk_mdio_init(struct mtk_eth *eth) · 2 unmodified lines | |||
| 300 | } | 304 | } |
| 301 | 305 | ||
| 302 | if (!of_device_is_available(mii_np)) { | 306 | if (!of_device_is_available(mii_np)) { |
| 303 | err = 0; | 307 | ret = -ENODEV; |
| 304 | goto err_put_node; | 308 | goto err_put_node; |
| 305 | } | 309 | } |
| 306 | 310 | ||
| 307 | eth->mii_bus = mdiobus_alloc(); | 311 | eth->mii_bus = devm_mdiobus_alloc(eth->dev); |
| 308 | if (!eth->mii_bus) { | 312 | if (!eth->mii_bus) { |
| 309 | err = -ENOMEM; | 313 | ret = -ENOMEM; |
| 310 | goto err_put_node; | 314 | goto err_put_node; |
| 311 | } | 315 | } |
| 312 | 316 | ||
| @@ -317,19 +321,11 @@ static int mtk_mdio_init(struct mtk_eth *eth) · 4 unmodified lines | |||
| 317 | eth->mii_bus->parent = eth->dev; | 321 | eth->mii_bus->parent = eth->dev; |
| 318 | 322 | ||
| 319 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); | 323 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); |
| 320 | err = of_mdiobus_register(eth->mii_bus, mii_np); | 324 | ret = of_mdiobus_register(eth->mii_bus, mii_np); |
| 321 | if (err) | ||
| 322 | goto err_free_bus; | ||
| 323 | |||
| 324 | return 0; | ||
| 325 | |||
| 326 | err_free_bus: | ||
| 327 | mdiobus_free(eth->mii_bus); | ||
| 328 | 325 | ||
| 329 | err_put_node: | 326 | err_put_node: |
| 330 | of_node_put(mii_np); | 327 | of_node_put(mii_np); |
| 331 | eth->mii_bus = NULL; | 328 | return ret; |
| 332 | return err; | ||
| 333 | } | 329 | } |
| 334 | 330 | ||
| 335 | static void mtk_mdio_cleanup(struct mtk_eth *eth) | 331 | static void mtk_mdio_cleanup(struct mtk_eth *eth) |
| @@ -338,8 +334,6 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) · 2 unmodified lines | |||
| 338 | return; | 334 | return; |
| 339 | 335 | ||
| 340 | mdiobus_unregister(eth->mii_bus); | 336 | mdiobus_unregister(eth->mii_bus); |
| 341 | of_node_put(eth->mii_bus->dev.of_node); | ||
| 342 | mdiobus_free(eth->mii_bus); | ||
| 343 | } | 337 | } |
| 344 | 338 | ||
| 345 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) | 339 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) |
| @@ -588,14 +582,15 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, · 242 unmodified lines | |||
| 588 | dma_addr_t mapped_addr; | 582 | dma_addr_t mapped_addr; |
| 589 | unsigned int nr_frags; | 583 | unsigned int nr_frags; |
| 590 | int i, n_desc = 1; | 584 | int i, n_desc = 1; |
| 591 | u32 txd4 = 0; | 585 | u32 txd4 = 0, fport; |
| 592 | 586 | ||
| 593 | itxd = ring->next_free; | 587 | itxd = ring->next_free; |
| 594 | if (itxd == ring->last_free) | 588 | if (itxd == ring->last_free) |
| 595 | return -ENOMEM; | 589 | return -ENOMEM; |
| 596 | 590 | ||
| 597 | /* set the forward port */ | 591 | /* set the forward port */ |
| 598 | txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT; | 592 | fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; |
| 593 | txd4 |= fport; | ||
| 599 | 594 | ||
| 600 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); | 595 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); |
| 601 | memset(tx_buf, 0, sizeof(*tx_buf)); | 596 | memset(tx_buf, 0, sizeof(*tx_buf)); |
| @@ -653,7 +648,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, · 51 unmodified lines | |||
| 653 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | | 648 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | |
| 654 | TX_DMA_PLEN0(frag_map_size) | | 649 | TX_DMA_PLEN0(frag_map_size) | |
| 655 | last_frag * TX_DMA_LS0)); | 650 | last_frag * TX_DMA_LS0)); |
| 656 | WRITE_ONCE(txd->txd4, 0); | 651 | WRITE_ONCE(txd->txd4, fport); |
| 657 | 652 | ||
| 658 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; | 653 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; |
| 659 | tx_buf = mtk_desc_to_tx_buf(ring, txd); | 654 | tx_buf = mtk_desc_to_tx_buf(ring, txd); |
| @@ -865,7 +860,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, · 205 unmodified lines | |||
| 865 | /* receive data */ | 860 | /* receive data */ |
| 866 | skb = build_skb(data, ring->frag_size); | 861 | skb = build_skb(data, ring->frag_size); |
| 867 | if (unlikely(!skb)) { | 862 | if (unlikely(!skb)) { |
| 868 | put_page(virt_to_head_page(new_data)); | 863 | skb_free_frag(new_data); |
| 869 | netdev->stats.rx_dropped++; | 864 | netdev->stats.rx_dropped++; |
| 870 | goto release_desc; | 865 | goto release_desc; |
| 871 | } | 866 | } |
| @@ -1506,10 +1501,7 @@ static void mtk_uninit(struct net_device *dev) · 634 unmodified lines | |||
| 1506 | struct mtk_eth *eth = mac->hw; | 1501 | struct mtk_eth *eth = mac->hw; |
| 1507 | 1502 | ||
| 1508 | phy_disconnect(mac->phy_dev); | 1503 | phy_disconnect(mac->phy_dev); |
| 1509 | mtk_mdio_cleanup(eth); | ||
| 1510 | mtk_irq_disable(eth, ~0); | 1504 | mtk_irq_disable(eth, ~0); |
| 1511 | free_irq(eth->irq[1], dev); | ||
| 1512 | free_irq(eth->irq[2], dev); | ||
| 1513 | } | 1505 | } |
| 1514 | 1506 | ||
| 1515 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1507 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
| @@ -1813,6 +1805,7 @@ static int mtk_probe(struct platform_device *pdev) · 297 unmodified lines | |||
| 1813 | if (!eth) | 1805 | if (!eth) |
| 1814 | return -ENOMEM; | 1806 | return -ENOMEM; |
| 1815 | 1807 | ||
| 1808 | eth->dev = &pdev->dev; | ||
| 1816 | eth->base = devm_ioremap_resource(&pdev->dev, res); | 1809 | eth->base = devm_ioremap_resource(&pdev->dev, res); |
| 1817 | if (IS_ERR(eth->base)) | 1810 | if (IS_ERR(eth->base)) |
| 1818 | return PTR_ERR(eth->base); | 1811 | return PTR_ERR(eth->base); |
| @@ -1847,21 +1840,21 @@ static int mtk_probe(struct platform_device *pdev) · 28 unmodified lines | |||
| 1847 | return -ENXIO; | 1840 | return -ENXIO; |
| 1848 | } | 1841 | } |
| 1849 | } | 1842 | } |
| 1843 | for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { | ||
| 1844 | eth->clks[i] = devm_clk_get(eth->dev, | ||
| 1845 | mtk_clks_source_name[i]); | ||
| 1846 | if (IS_ERR(eth->clks[i])) { | ||
| 1847 | if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) | ||
| 1848 | return -EPROBE_DEFER; | ||
| 1849 | return -ENODEV; | ||
| 1850 | } | ||
| 1851 | } | ||
| 1850 | 1852 | ||
| 1851 | eth->clk_ethif = devm_clk_get(&pdev->dev, "ethif"); | 1853 | clk_prepare_enable(eth->clks[MTK_CLK_ETHIF]); |
| 1852 | eth->clk_esw = devm_clk_get(&pdev->dev, "esw"); | 1854 | clk_prepare_enable(eth->clks[MTK_CLK_ESW]); |
| 1853 | eth->clk_gp1 = devm_clk_get(&pdev->dev, "gp1"); | 1855 | clk_prepare_enable(eth->clks[MTK_CLK_GP1]); |
| 1854 | eth->clk_gp2 = devm_clk_get(&pdev->dev, "gp2"); | 1856 | clk_prepare_enable(eth->clks[MTK_CLK_GP2]); |
| 1855 | if (IS_ERR(eth->clk_esw) || IS_ERR(eth->clk_gp1) || | ||
| 1856 | IS_ERR(eth->clk_gp2) || IS_ERR(eth->clk_ethif)) | ||
| 1857 | return -ENODEV; | ||
| 1858 | |||
| 1859 | clk_prepare_enable(eth->clk_ethif); | ||
| 1860 | clk_prepare_enable(eth->clk_esw); | ||
| 1861 | clk_prepare_enable(eth->clk_gp1); | ||
| 1862 | clk_prepare_enable(eth->clk_gp2); | ||
| 1863 | 1857 | ||
| 1864 | eth->dev = &pdev->dev; | ||
| 1865 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); | 1858 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); |
| 1866 | INIT_WORK(ð->pending_work, mtk_pending_work); | 1859 | INIT_WORK(ð->pending_work, mtk_pending_work); |
| 1867 | 1860 | ||
| @@ -1903,15 +1896,24 @@ err_free_dev: · 35 unmodified lines | |||
| 1903 | static int mtk_remove(struct platform_device *pdev) | 1896 | static int mtk_remove(struct platform_device *pdev) |
| 1904 | { | 1897 | { |
| 1905 | struct mtk_eth *eth = platform_get_drvdata(pdev); | 1898 | struct mtk_eth *eth = platform_get_drvdata(pdev); |
| 1899 | int i; | ||
| 1906 | 1900 | ||
| 1907 | clk_disable_unprepare(eth->clk_ethif); | 1901 | /* stop all devices to make sure that dma is properly shut down */ |
| 1908 | clk_disable_unprepare(eth->clk_esw); | 1902 | for (i = 0; i < MTK_MAC_COUNT; i++) { |
| 1909 | clk_disable_unprepare(eth->clk_gp1); | 1903 | if (!eth->netdev[i]) |
| 1910 | clk_disable_unprepare(eth->clk_gp2); | 1904 | continue; |
| 1905 | mtk_stop(eth->netdev[i]); | ||
| 1906 | } | ||
| 1907 | |||
| 1908 | clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]); | ||
| 1909 | clk_disable_unprepare(eth->clks[MTK_CLK_ESW]); | ||
| 1910 | clk_disable_unprepare(eth->clks[MTK_CLK_GP1]); | ||
| 1911 | clk_disable_unprepare(eth->clks[MTK_CLK_GP2]); | ||
| 1911 | 1912 | ||
| 1912 | netif_napi_del(ð->tx_napi); | 1913 | netif_napi_del(ð->tx_napi); |
| 1913 | netif_napi_del(ð->rx_napi); | 1914 | netif_napi_del(ð->rx_napi); |
| 1914 | mtk_cleanup(eth); | 1915 | mtk_cleanup(eth); |
| 1916 | mtk_mdio_cleanup(eth); | ||
| 1915 | platform_set_drvdata(pdev, NULL); | 1917 | platform_set_drvdata(pdev, NULL); |
| 1916 | 1918 | ||
| 1917 | return 0; | 1919 | return 0; |
| @@ -1921,6 +1923,7 @@ const struct of_device_id of_mtk_match[] = { · 3 unmodified lines | |||
| 1921 | { .compatible = "mediatek,mt7623-eth" }, | 1923 | { .compatible = "mediatek,mt7623-eth" }, |
| 1922 | {}, | 1924 | {}, |
| 1923 | }; | 1925 | }; |
| 1926 | MODULE_DEVICE_TABLE(of, of_mtk_match); | ||
| 1924 | 1927 | ||
| 1925 | static struct platform_driver mtk_driver = { | 1928 | static struct platform_driver mtk_driver = { |
| 1926 | .probe = mtk_probe, | 1929 | .probe = mtk_probe, |
| @@ -290,6 +290,17 @@ enum mtk_tx_flags { · 289 unmodified lines | |||
| 290 | MTK_TX_FLAGS_PAGE0 = 0x02, | 290 | MTK_TX_FLAGS_PAGE0 = 0x02, |
| 291 | }; | 291 | }; |
| 292 | 292 | ||
| 293 | /* This enum allows us to identify how the clock is defined on the array of the | ||
| 294 | * clock in the order | ||
| 295 | */ | ||
| 296 | enum mtk_clks_map { | ||
| 297 | MTK_CLK_ETHIF, | ||
| 298 | MTK_CLK_ESW, | ||
| 299 | MTK_CLK_GP1, | ||
| 300 | MTK_CLK_GP2, | ||
| 301 | MTK_CLK_MAX | ||
| 302 | }; | ||
| 303 | |||
| 293 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at | 304 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at |
| 294 | * by the TX descriptor s | 305 | * by the TX descriptor s |
| 295 | * @skb: The SKB pointer of the packet being sent | 306 | * @skb: The SKB pointer of the packet being sent |
| @@ -370,10 +381,7 @@ struct mtk_rx_ring { · 74 unmodified lines | |||
| 370 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring | 381 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring |
| 371 | * @phy_scratch_ring: physical address of scratch_ring | 382 | * @phy_scratch_ring: physical address of scratch_ring |
| 372 | * @scratch_head: The scratch memory that scratch_ring points to. | 383 | * @scratch_head: The scratch memory that scratch_ring points to. |
| 373 | * @clk_ethif: The ethif clock | 384 | * @clks: clock array for all clocks required |
| 374 | * @clk_esw: The switch clock | ||
| 375 | * @clk_gp1: The gmac1 clock | ||
| 376 | * @clk_gp2: The gmac2 clock | ||
| 377 | * @mii_bus: If there is a bus we need to create an instance for it | 385 | * @mii_bus: If there is a bus we need to create an instance for it |
| 378 | * @pending_work: The workqueue used to reset the dma ring | 386 | * @pending_work: The workqueue used to reset the dma ring |
| 379 | */ | 387 | */ |
| @@ -400,10 +408,8 @@ struct mtk_eth { · 20 unmodified lines | |||
| 400 | struct mtk_tx_dma *scratch_ring; | 408 | struct mtk_tx_dma *scratch_ring; |
| 401 | dma_addr_t phy_scratch_ring; | 409 | dma_addr_t phy_scratch_ring; |
| 402 | void *scratch_head; | 410 | void *scratch_head; |
| 403 | struct clk *clk_ethif; | 411 | struct clk *clks[MTK_CLK_MAX]; |
| 404 | struct clk *clk_esw; | 412 | |
| 405 | struct clk *clk_gp1; | ||
| 406 | struct clk *clk_gp2; | ||
| 407 | struct mii_bus *mii_bus; | 413 | struct mii_bus *mii_bus; |
| 408 | struct work_struct pending_work; | 414 | struct work_struct pending_work; |
| 409 | }; | 415 | }; |
| @@ -94,7 +94,7 @@ static u8 mlx4_en_dcbnl_getcap(struct net_device *dev, int capid, u8 *cap) · 93 unmodified lines | |||
| 94 | *cap = true; | 94 | *cap = true; |
| 95 | break; | 95 | break; |
| 96 | case DCB_CAP_ATTR_DCBX: | 96 | case DCB_CAP_ATTR_DCBX: |
| 97 | *cap = priv->cee_params.dcbx_cap; | 97 | *cap = priv->dcbx_cap; |
| 98 | break; | 98 | break; |
| 99 | case DCB_CAP_ATTR_PFC_TCS: | 99 | case DCB_CAP_ATTR_PFC_TCS: |
| 100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); | 100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); |
| @@ -111,14 +111,14 @@ static u8 mlx4_en_dcbnl_getpfcstate(struct net_device *netdev) · 10 unmodified lines | |||
| 111 | { | 111 | { |
| 112 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 112 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 113 | 113 | ||
| 114 | return priv->cee_params.dcb_cfg.pfc_state; | 114 | return priv->cee_config.pfc_state; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | 117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) |
| 118 | { | 118 | { |
| 119 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 119 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 120 | 120 | ||
| 121 | priv->cee_params.dcb_cfg.pfc_state = state; | 121 | priv->cee_config.pfc_state = state; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
| @@ -126,7 +126,7 @@ static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, · 1 unmodified line | |||
| 126 | { | 126 | { |
| 127 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 127 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 128 | 128 | ||
| 129 | *setting = priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc; | 129 | *setting = priv->cee_config.dcb_pfc[priority]; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | 132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, |
| @@ -134,8 +134,8 @@ static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, · 1 unmodified line | |||
| 134 | { | 134 | { |
| 135 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 135 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 136 | 136 | ||
| 137 | priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc = setting; | 137 | priv->cee_config.dcb_pfc[priority] = setting; |
| 138 | priv->cee_params.dcb_cfg.pfc_state = true; | 138 | priv->cee_config.pfc_state = true; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) | 141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) |
| @@ -157,13 +157,11 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) · 15 unmodified lines | |||
| 157 | { | 157 | { |
| 158 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 158 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 159 | struct mlx4_en_dev *mdev = priv->mdev; | 159 | struct mlx4_en_dev *mdev = priv->mdev; |
| 160 | struct mlx4_en_cee_config *dcb_cfg = &priv->cee_params.dcb_cfg; | ||
| 161 | int err = 0; | ||
| 162 | 160 | ||
| 163 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 161 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
| 164 | return -EINVAL; | 162 | return 1; |
| 165 | 163 | ||
| 166 | if (dcb_cfg->pfc_state) { | 164 | if (priv->cee_config.pfc_state) { |
| 167 | int tc; | 165 | int tc; |
| 168 | 166 | ||
| 169 | priv->prof->rx_pause = 0; | 167 | priv->prof->rx_pause = 0; |
| @@ -171,7 +169,7 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) · 1 unmodified line | |||
| 171 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { | 169 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { |
| 172 | u8 tc_mask = 1 << tc; | 170 | u8 tc_mask = 1 << tc; |
| 173 | 171 | ||
| 174 | switch (dcb_cfg->tc_config[tc].dcb_pfc) { | 172 | switch (priv->cee_config.dcb_pfc[tc]) { |
| 175 | case pfc_disabled: | 173 | case pfc_disabled: |
| 176 | priv->prof->tx_ppp &= ~tc_mask; | 174 | priv->prof->tx_ppp &= ~tc_mask; |
| 177 | priv->prof->rx_ppp &= ~tc_mask; | 175 | priv->prof->rx_ppp &= ~tc_mask; |
| @@ -199,15 +197,17 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) · 21 unmodified lines | |||
| 199 | en_dbg(DRV, priv, "Set pfc off\n"); | 197 | en_dbg(DRV, priv, "Set pfc off\n"); |
| 200 | } | 198 | } |
| 201 | 199 | ||
| 202 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 200 | if (mlx4_SET_PORT_general(mdev->dev, priv->port, |
| 203 | priv->rx_skb_size + ETH_FCS_LEN, | 201 | priv->rx_skb_size + ETH_FCS_LEN, |
| 204 | priv->prof->tx_pause, | 202 | priv->prof->tx_pause, |
| 205 | priv->prof->tx_ppp, | 203 | priv->prof->tx_ppp, |
| 206 | priv->prof->rx_pause, | 204 | priv->prof->rx_pause, |
| 207 | priv->prof->rx_ppp); | 205 | priv->prof->rx_ppp)) { |
| 208 | if (err) | ||
| 209 | en_err(priv, "Failed setting pause params\n"); | 206 | en_err(priv, "Failed setting pause params\n"); |
| 210 | return err; | 207 | return 1; |
| 208 | } | ||
| 209 | |||
| 210 | return 0; | ||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) | 213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) |
| @@ -225,7 +225,7 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) · 11 unmodified lines | |||
| 225 | struct mlx4_en_priv *priv = netdev_priv(dev); | 225 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 226 | int num_tcs = 0; | 226 | int num_tcs = 0; |
| 227 | 227 | ||
| 228 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 228 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
| 229 | return 1; | 229 | return 1; |
| 230 | 230 | ||
| 231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) | 231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) |
| @@ -238,7 +238,10 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) · 6 unmodified lines | |||
| 238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | return mlx4_en_setup_tc(dev, num_tcs); | 241 | if (mlx4_en_setup_tc(dev, num_tcs)) |
| 242 | return 1; | ||
| 243 | |||
| 244 | return 0; | ||
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | /* On success returns a non-zero 802.1p user priority bitmap | 247 | /* On success returns a non-zero 802.1p user priority bitmap |
| @@ -252,7 +255,7 @@ static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) · 7 unmodified lines | |||
| 252 | .selector = idtype, | 255 | .selector = idtype, |
| 253 | .protocol = id, | 256 | .protocol = id, |
| 254 | }; | 257 | }; |
| 255 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 258 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
| 256 | return 0; | 259 | return 0; |
| 257 | 260 | ||
| 258 | return dcb_getapp(netdev, &app); | 261 | return dcb_getapp(netdev, &app); |
| @@ -264,7 +267,7 @@ static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype, · 5 unmodified lines | |||
| 264 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 267 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
| 265 | struct dcb_app app; | 268 | struct dcb_app app; |
| 266 | 269 | ||
| 267 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 270 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
| 268 | return -EINVAL; | 271 | return -EINVAL; |
| 269 | 272 | ||
| 270 | memset(&app, 0, sizeof(struct dcb_app)); | 273 | memset(&app, 0, sizeof(struct dcb_app)); |
| @@ -433,7 +436,7 @@ static u8 mlx4_en_dcbnl_getdcbx(struct net_device *dev) · 162 unmodified lines | |||
| 433 | { | 436 | { |
| 434 | struct mlx4_en_priv *priv = netdev_priv(dev); | 437 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 435 | 438 | ||
| 436 | return priv->cee_params.dcbx_cap; | 439 | return priv->dcbx_cap; |
| 437 | } | 440 | } |
| 438 | 441 | ||
| 439 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | 442 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) |
| @@ -442,7 +445,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) · 2 unmodified lines | |||
| 442 | struct ieee_ets ets = {0}; | 445 | struct ieee_ets ets = {0}; |
| 443 | struct ieee_pfc pfc = {0}; | 446 | struct ieee_pfc pfc = {0}; |
| 444 | 447 | ||
| 445 | if (mode == priv->cee_params.dcbx_cap) | 448 | if (mode == priv->dcbx_cap) |
| 446 | return 0; | 449 | return 0; |
| 447 | 450 | ||
| 448 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || | 451 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || |
| @@ -451,7 +454,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) · 2 unmodified lines | |||
| 451 | !(mode & DCB_CAP_DCBX_HOST)) | 454 | !(mode & DCB_CAP_DCBX_HOST)) |
| 452 | goto err; | 455 | goto err; |
| 453 | 456 | ||
| 454 | priv->cee_params.dcbx_cap = mode; | 457 | priv->dcbx_cap = mode; |
| 455 | 458 | ||
| 456 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; | 459 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; |
| 457 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; | 460 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; |
| @@ -71,10 +71,11 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) · 70 unmodified lines | |||
| 71 | #ifdef CONFIG_MLX4_EN_DCB | 71 | #ifdef CONFIG_MLX4_EN_DCB |
| 72 | if (!mlx4_is_slave(priv->mdev->dev)) { | 72 | if (!mlx4_is_slave(priv->mdev->dev)) { |
| 73 | if (up) { | 73 | if (up) { |
| 74 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | 74 | if (priv->dcbx_cap) |
| 75 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | ||
| 75 | } else { | 76 | } else { |
| 76 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 77 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
| 77 | priv->cee_params.dcb_cfg.pfc_state = false; | 78 | priv->cee_config.pfc_state = false; |
| 78 | } | 79 | } |
| 79 | } | 80 | } |
| 80 | #endif /* CONFIG_MLX4_EN_DCB */ | 81 | #endif /* CONFIG_MLX4_EN_DCB */ |
| @@ -3048,9 +3049,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · 2967 unmodified lines | |||
| 3048 | struct mlx4_en_priv *priv; | 3049 | struct mlx4_en_priv *priv; |
| 3049 | int i; | 3050 | int i; |
| 3050 | int err; | 3051 | int err; |
| 3051 | #ifdef CONFIG_MLX4_EN_DCB | ||
| 3052 | struct tc_configuration *tc; | ||
| 3053 | #endif | ||
| 3054 | 3052 | ||
| 3055 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), | 3053 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), |
| 3056 | MAX_TX_RINGS, MAX_RX_RINGS); | 3054 | MAX_TX_RINGS, MAX_RX_RINGS); |
| @@ -3117,16 +3115,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · 60 unmodified lines | |||
| 3117 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 3115 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
| 3118 | #ifdef CONFIG_MLX4_EN_DCB | 3116 | #ifdef CONFIG_MLX4_EN_DCB |
| 3119 | if (!mlx4_is_slave(priv->mdev->dev)) { | 3117 | if (!mlx4_is_slave(priv->mdev->dev)) { |
| 3120 | priv->cee_params.dcbx_cap = DCB_CAP_DCBX_VER_CEE | | 3118 | priv->dcbx_cap = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_HOST | |
| 3121 | DCB_CAP_DCBX_HOST | | 3119 | DCB_CAP_DCBX_VER_IEEE; |
| 3122 | DCB_CAP_DCBX_VER_IEEE; | ||
| 3123 | priv->flags |= MLX4_EN_DCB_ENABLED; | 3120 | priv->flags |= MLX4_EN_DCB_ENABLED; |
| 3124 | priv->cee_params.dcb_cfg.pfc_state = false; | 3121 | priv->cee_config.pfc_state = false; |
| 3125 | 3122 | ||
| 3126 | for (i = 0; i < MLX4_EN_NUM_UP; i++) { | 3123 | for (i = 0; i < MLX4_EN_NUM_UP; i++) |
| 3127 | tc = &priv->cee_params.dcb_cfg.tc_config[i]; | 3124 | priv->cee_config.dcb_pfc[i] = pfc_disabled; |
| 3128 | tc->dcb_pfc = pfc_disabled; | ||
| 3129 | } | ||
| 3130 | 3125 | ||
| 3131 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { | 3126 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { |
| 3132 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; | 3127 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; |
| @@ -818,7 +818,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 817 unmodified lines | |||
| 818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, | 818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, |
| 819 | &inline_ok, &fragptr); | 819 | &inline_ok, &fragptr); |
| 820 | if (unlikely(!real_size)) | 820 | if (unlikely(!real_size)) |
| 821 | goto tx_drop; | 821 | goto tx_drop_count; |
| 822 | 822 | ||
| 823 | /* Align descriptor to TXBB size */ | 823 | /* Align descriptor to TXBB size */ |
| 824 | desc_size = ALIGN(real_size, TXBB_SIZE); | 824 | desc_size = ALIGN(real_size, TXBB_SIZE); |
| @@ -826,7 +826,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 1 unmodified line | |||
| 826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { | 826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { |
| 827 | if (netif_msg_tx_err(priv)) | 827 | if (netif_msg_tx_err(priv)) |
| 828 | en_warn(priv, "Oversized header or SG list\n"); | 828 | en_warn(priv, "Oversized header or SG list\n"); |
| 829 | goto tx_drop; | 829 | goto tx_drop_count; |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | bf_ok = ring->bf_enabled; | 832 | bf_ok = ring->bf_enabled; |
| @@ -1071,9 +1071,10 @@ tx_drop_unmap: · 238 unmodified lines | |||
| 1071 | PCI_DMA_TODEVICE); | 1071 | PCI_DMA_TODEVICE); |
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | tx_drop_count: | ||
| 1075 | ring->tx_dropped++; | ||
| 1074 | tx_drop: | 1076 | tx_drop: |
| 1075 | dev_kfree_skb_any(skb); | 1077 | dev_kfree_skb_any(skb); |
| 1076 | ring->tx_dropped++; | ||
| 1077 | return NETDEV_TX_OK; | 1078 | return NETDEV_TX_OK; |
| 1078 | } | 1079 | } |
| 1079 | 1080 | ||
| @@ -1106,7 +1107,7 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, · 26 unmodified lines | |||
| 1106 | goto tx_drop; | 1107 | goto tx_drop; |
| 1107 | 1108 | ||
| 1108 | if (mlx4_en_is_tx_ring_full(ring)) | 1109 | if (mlx4_en_is_tx_ring_full(ring)) |
| 1109 | goto tx_drop; | 1110 | goto tx_drop_count; |
| 1110 | 1111 | ||
| 1111 | /* fetch ring->cons far ahead before needing it to avoid stall */ | 1112 | /* fetch ring->cons far ahead before needing it to avoid stall */ |
| 1112 | ring_cons = READ_ONCE(ring->cons); | 1113 | ring_cons = READ_ONCE(ring->cons); |
| @@ -1176,7 +1177,8 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, · 63 unmodified lines | |||
| 1176 | 1177 | ||
| 1177 | return NETDEV_TX_OK; | 1178 | return NETDEV_TX_OK; |
| 1178 | 1179 | ||
| 1179 | tx_drop: | 1180 | tx_drop_count: |
| 1180 | ring->tx_dropped++; | 1181 | ring->tx_dropped++; |
| 1182 | tx_drop: | ||
| 1181 | return NETDEV_TX_BUSY; | 1183 | return NETDEV_TX_BUSY; |
| 1182 | } | 1184 | } |
| @@ -1305,8 +1305,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) · 1304 unmodified lines | |||
| 1305 | return 0; | 1305 | return 0; |
| 1306 | 1306 | ||
| 1307 | err_out_unmap: | 1307 | err_out_unmap: |
| 1308 | while (i >= 0) | 1308 | while (i > 0) |
| 1309 | mlx4_free_eq(dev, &priv->eq_table.eq[i--]); | 1309 | mlx4_free_eq(dev, &priv->eq_table.eq[--i]); |
| 1310 | #ifdef CONFIG_RFS_ACCEL | 1310 | #ifdef CONFIG_RFS_ACCEL |
| 1311 | for (i = 1; i <= dev->caps.num_ports; i++) { | 1311 | for (i = 1; i <= dev->caps.num_ports; i++) { |
| 1312 | if (mlx4_priv(dev)->port[i].rmap) { | 1312 | if (mlx4_priv(dev)->port[i].rmap) { |
| @@ -2970,6 +2970,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port) · 2969 unmodified lines | |||
| 2970 | mlx4_err(dev, "Failed to create mtu file for port %d\n", port); | 2970 | mlx4_err(dev, "Failed to create mtu file for port %d\n", port); |
| 2971 | device_remove_file(&info->dev->persist->pdev->dev, | 2971 | device_remove_file(&info->dev->persist->pdev->dev, |
| 2972 | &info->port_attr); | 2972 | &info->port_attr); |
| 2973 | devlink_port_unregister(&info->devlink_port); | ||
| 2973 | info->port = -1; | 2974 | info->port = -1; |
| 2974 | } | 2975 | } |
| 2975 | 2976 | ||
| @@ -2984,6 +2985,8 @@ static void mlx4_cleanup_port_info(struct mlx4_port_info *info) · 8 unmodified lines | |||
| 2984 | device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); | 2985 | device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); |
| 2985 | device_remove_file(&info->dev->persist->pdev->dev, | 2986 | device_remove_file(&info->dev->persist->pdev->dev, |
| 2986 | &info->port_mtu_attr); | 2987 | &info->port_mtu_attr); |
| 2988 | devlink_port_unregister(&info->devlink_port); | ||
| 2989 | |||
| 2987 | #ifdef CONFIG_RFS_ACCEL | 2990 | #ifdef CONFIG_RFS_ACCEL |
| 2988 | free_irq_cpu_rmap(info->rmap); | 2991 | free_irq_cpu_rmap(info->rmap); |
| 2989 | info->rmap = NULL; | 2992 | info->rmap = NULL; |
| @@ -482,20 +482,10 @@ enum dcb_pfc_type { · 481 unmodified lines | |||
| 482 | pfc_enabled_rx | 482 | pfc_enabled_rx |
| 483 | }; | 483 | }; |
| 484 | 484 | ||
| 485 | struct tc_configuration { | ||
| 486 | enum dcb_pfc_type dcb_pfc; | ||
| 487 | }; | ||
| 488 | |||
| 489 | struct mlx4_en_cee_config { | 485 | struct mlx4_en_cee_config { |
| 490 | bool pfc_state; | 486 | bool pfc_state; |
| 491 | struct tc_configuration tc_config[MLX4_EN_NUM_UP]; | 487 | enum dcb_pfc_type dcb_pfc[MLX4_EN_NUM_UP]; |
| 492 | }; | 488 | }; |
| 493 | |||
| 494 | struct mlx4_en_cee_params { | ||
| 495 | u8 dcbx_cap; | ||
| 496 | struct mlx4_en_cee_config dcb_cfg; | ||
| 497 | }; | ||
| 498 | |||
| 499 | #endif | 489 | #endif |
| 500 | 490 | ||
| 501 | struct ethtool_flow_id { | 491 | struct ethtool_flow_id { |
| @@ -624,7 +614,8 @@ struct mlx4_en_priv { · 122 unmodified lines | |||
| 624 | struct ieee_ets ets; | 614 | struct ieee_ets ets; |
| 625 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; | 615 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; |
| 626 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; | 616 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; |
| 627 | struct mlx4_en_cee_params cee_params; | 617 | struct mlx4_en_cee_config cee_config; |
| 618 | u8 dcbx_cap; | ||
| 628 | #endif | 619 | #endif |
| 629 | #ifdef CONFIG_RFS_ACCEL | 620 | #ifdef CONFIG_RFS_ACCEL |
| 630 | spinlock_t filters_lock; | 621 | spinlock_t filters_lock; |
| @@ -52,7 +52,7 @@ · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 | 53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 |
| 54 | #define MLX4_IGNORE_FCS_MASK 0x1 | 54 | #define MLX4_IGNORE_FCS_MASK 0x1 |
| 55 | #define MLNX4_TX_MAX_NUMBER 8 | 55 | #define MLX4_TC_MAX_NUMBER 8 |
| 56 | 56 | ||
| 57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) | 57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) |
| 58 | { | 58 | { |
| @@ -2022,7 +2022,7 @@ int mlx4_max_tc(struct mlx4_dev *dev) · 1963 unmodified lines | |||
| 2022 | u8 num_tc = dev->caps.max_tc_eth; | 2022 | u8 num_tc = dev->caps.max_tc_eth; |
| 2023 | 2023 | ||
| 2024 | if (!num_tc) | 2024 | if (!num_tc) |
| 2025 | num_tc = MLNX4_TX_MAX_NUMBER; | 2025 | num_tc = MLX4_TC_MAX_NUMBER; |
| 2026 | 2026 | ||
| 2027 | return num_tc; | 2027 | return num_tc; |
| 2028 | } | 2028 | } |
| @@ -143,13 +143,14 @@ static struct mlx5_cmd_layout *get_inst(struct mlx5_cmd *cmd, int idx) · 142 unmodified lines | |||
| 143 | return cmd->cmd_buf + (idx << cmd->log_stride); | 143 | return cmd->cmd_buf + (idx << cmd->log_stride); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static u8 xor8_buf(void *buf, int len) | 146 | static u8 xor8_buf(void *buf, size_t offset, int len) |
| 147 | { | 147 | { |
| 148 | u8 *ptr = buf; | 148 | u8 *ptr = buf; |
| 149 | u8 sum = 0; | 149 | u8 sum = 0; |
| 150 | int i; | 150 | int i; |
| 151 | int end = len + offset; | ||
| 151 | 152 | ||
| 152 | for (i = 0; i < len; i++) | 153 | for (i = offset; i < end; i++) |
| 153 | sum ^= ptr[i]; | 154 | sum ^= ptr[i]; |
| 154 | 155 | ||
| 155 | return sum; | 156 | return sum; |
| @@ -157,41 +158,49 @@ static u8 xor8_buf(void *buf, int len) · 1 unmodified line | |||
| 157 | 158 | ||
| 158 | static int verify_block_sig(struct mlx5_cmd_prot_block *block) | 159 | static int verify_block_sig(struct mlx5_cmd_prot_block *block) |
| 159 | { | 160 | { |
| 160 | if (xor8_buf(block->rsvd0, sizeof(*block) - sizeof(block->data) - 1) != 0xff) | 161 | size_t rsvd0_off = offsetof(struct mlx5_cmd_prot_block, rsvd0); |
| 162 | int xor_len = sizeof(*block) - sizeof(block->data) - 1; | ||
| 163 | |||
| 164 | if (xor8_buf(block, rsvd0_off, xor_len) != 0xff) | ||
| 161 | return -EINVAL; | 165 | return -EINVAL; |
| 162 | 166 | ||
| 163 | if (xor8_buf(block, sizeof(*block)) != 0xff) | 167 | if (xor8_buf(block, 0, sizeof(*block)) != 0xff) |
| 164 | return -EINVAL; | 168 | return -EINVAL; |
| 165 | 169 | ||
| 166 | return 0; | 170 | return 0; |
| 167 | } | 171 | } |
| 168 | 172 | ||
| 169 | static void calc_block_sig(struct mlx5_cmd_prot_block *block, u8 token, | 173 | static void calc_block_sig(struct mlx5_cmd_prot_block *block) |
| 170 | int csum) | ||
| 171 | { | 174 | { |
| 172 | block->token = token; | 175 | int ctrl_xor_len = sizeof(*block) - sizeof(block->data) - 2; |
| 173 | if (csum) { | 176 | size_t rsvd0_off = offsetof(struct mlx5_cmd_prot_block, rsvd0); |
| 174 | block->ctrl_sig = ~xor8_buf(block->rsvd0, sizeof(*block) - | 177 | |
| 175 | sizeof(block->data) - 2); | 178 | block->ctrl_sig = ~xor8_buf(block, rsvd0_off, ctrl_xor_len); |
| 176 | block->sig = ~xor8_buf(block, sizeof(*block) - 1); | 179 | block->sig = ~xor8_buf(block, 0, sizeof(*block) - 1); |
| 177 | } | ||
| 178 | } | 180 | } |
| 179 | 181 | ||
| 180 | static void calc_chain_sig(struct mlx5_cmd_msg *msg, u8 token, int csum) | 182 | static void calc_chain_sig(struct mlx5_cmd_msg *msg) |
| 181 | { | 183 | { |
| 182 | struct mlx5_cmd_mailbox *next = msg->next; | 184 | struct mlx5_cmd_mailbox *next = msg->next; |
| 183 | 185 | int size = msg->len; | |
| 184 | while (next) { | 186 | int blen = size - min_t(int, sizeof(msg->first.data), size); |
| 185 | calc_block_sig(next->buf, token, csum); | 187 | int n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) |
| 188 | / MLX5_CMD_DATA_BLOCK_SIZE; | ||
| 189 | int i = 0; | ||
| 190 | |||
| 191 | for (i = 0; i < n && next; i++) { | ||
| 192 | calc_block_sig(next->buf); | ||
| 186 | next = next->next; | 193 | next = next->next; |
| 187 | } | 194 | } |
| 188 | } | 195 | } |
| 189 | 196 | ||
| 190 | static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) | 197 | static void set_signature(struct mlx5_cmd_work_ent *ent, int csum) |
| 191 | { | 198 | { |
| 192 | ent->lay->sig = ~xor8_buf(ent->lay, sizeof(*ent->lay)); | 199 | ent->lay->sig = ~xor8_buf(ent->lay, 0, sizeof(*ent->lay)); |
| 193 | calc_chain_sig(ent->in, ent->token, csum); | 200 | if (csum) { |
| 194 | calc_chain_sig(ent->out, ent->token, csum); | 201 | calc_chain_sig(ent->in); |
| 202 | calc_chain_sig(ent->out); | ||
| 203 | } | ||
| 195 | } | 204 | } |
| 196 | 205 | ||
| 197 | static void poll_timeout(struct mlx5_cmd_work_ent *ent) | 206 | static void poll_timeout(struct mlx5_cmd_work_ent *ent) |
| @@ -222,12 +231,17 @@ static int verify_signature(struct mlx5_cmd_work_ent *ent) · 24 unmodified lines | |||
| 222 | struct mlx5_cmd_mailbox *next = ent->out->next; | 231 | struct mlx5_cmd_mailbox *next = ent->out->next; |
| 223 | int err; | 232 | int err; |
| 224 | u8 sig; | 233 | u8 sig; |
| 234 | int size = ent->out->len; | ||
| 235 | int blen = size - min_t(int, sizeof(ent->out->first.data), size); | ||
| 236 | int n = (blen + MLX5_CMD_DATA_BLOCK_SIZE - 1) | ||
| 237 | / MLX5_CMD_DATA_BLOCK_SIZE; | ||
| 238 | int i = 0; | ||
| 225 | 239 | ||
| 226 | sig = xor8_buf(ent->lay, sizeof(*ent->lay)); | 240 | sig = xor8_buf(ent->lay, 0, sizeof(*ent->lay)); |
| 227 | if (sig != 0xff) | 241 | if (sig != 0xff) |
| 228 | return -EINVAL; | 242 | return -EINVAL; |
| 229 | 243 | ||
| 230 | while (next) { | 244 | for (i = 0; i < n && next; i++) { |
| 231 | err = verify_block_sig(next->buf); | 245 | err = verify_block_sig(next->buf); |
| 232 | if (err) | 246 | if (err) |
| 233 | return err; | 247 | return err; |
| @@ -656,7 +670,6 @@ static void cmd_work_handler(struct work_struct *work) · 422 unmodified lines | |||
| 656 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); | 670 | spin_unlock_irqrestore(&cmd->alloc_lock, flags); |
| 657 | } | 671 | } |
| 658 | 672 | ||
| 659 | ent->token = alloc_token(cmd); | ||
| 660 | cmd->ent_arr[ent->idx] = ent; | 673 | cmd->ent_arr[ent->idx] = ent; |
| 661 | lay = get_inst(cmd, ent->idx); | 674 | lay = get_inst(cmd, ent->idx); |
| 662 | ent->lay = lay; | 675 | ent->lay = lay; |
| @@ -766,7 +779,8 @@ static u8 *get_status_ptr(struct mlx5_outbox_hdr *out) · 103 unmodified lines | |||
| 766 | static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, | 779 | static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, |
| 767 | struct mlx5_cmd_msg *out, void *uout, int uout_size, | 780 | struct mlx5_cmd_msg *out, void *uout, int uout_size, |
| 768 | mlx5_cmd_cbk_t callback, | 781 | mlx5_cmd_cbk_t callback, |
| 769 | void *context, int page_queue, u8 *status) | 782 | void *context, int page_queue, u8 *status, |
| 783 | u8 token) | ||
| 770 | { | 784 | { |
| 771 | struct mlx5_cmd *cmd = &dev->cmd; | 785 | struct mlx5_cmd *cmd = &dev->cmd; |
| 772 | struct mlx5_cmd_work_ent *ent; | 786 | struct mlx5_cmd_work_ent *ent; |
| @@ -783,6 +797,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, · 10 unmodified lines | |||
| 783 | if (IS_ERR(ent)) | 797 | if (IS_ERR(ent)) |
| 784 | return PTR_ERR(ent); | 798 | return PTR_ERR(ent); |
| 785 | 799 | ||
| 800 | ent->token = token; | ||
| 801 | |||
| 786 | if (!callback) | 802 | if (!callback) |
| 787 | init_completion(&ent->done); | 803 | init_completion(&ent->done); |
| 788 | 804 | ||
| @@ -854,7 +870,8 @@ static const struct file_operations fops = { · 65 unmodified lines | |||
| 854 | .write = dbg_write, | 870 | .write = dbg_write, |
| 855 | }; | 871 | }; |
| 856 | 872 | ||
| 857 | static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) | 873 | static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size, |
| 874 | u8 token) | ||
| 858 | { | 875 | { |
| 859 | struct mlx5_cmd_prot_block *block; | 876 | struct mlx5_cmd_prot_block *block; |
| 860 | struct mlx5_cmd_mailbox *next; | 877 | struct mlx5_cmd_mailbox *next; |
| @@ -880,6 +897,7 @@ static int mlx5_copy_to_msg(struct mlx5_cmd_msg *to, void *from, int size) · 19 unmodified lines | |||
| 880 | memcpy(block->data, from, copy); | 897 | memcpy(block->data, from, copy); |
| 881 | from += copy; | 898 | from += copy; |
| 882 | size -= copy; | 899 | size -= copy; |
| 900 | block->token = token; | ||
| 883 | next = next->next; | 901 | next = next->next; |
| 884 | } | 902 | } |
| 885 | 903 | ||
| @@ -949,7 +967,8 @@ static void free_cmd_box(struct mlx5_core_dev *dev, · 63 unmodified lines | |||
| 949 | } | 967 | } |
| 950 | 968 | ||
| 951 | static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, | 969 | static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, |
| 952 | gfp_t flags, int size) | 970 | gfp_t flags, int size, |
| 971 | u8 token) | ||
| 953 | { | 972 | { |
| 954 | struct mlx5_cmd_mailbox *tmp, *head = NULL; | 973 | struct mlx5_cmd_mailbox *tmp, *head = NULL; |
| 955 | struct mlx5_cmd_prot_block *block; | 974 | struct mlx5_cmd_prot_block *block; |
| @@ -978,6 +997,7 @@ static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, · 22 unmodified lines | |||
| 978 | tmp->next = head; | 997 | tmp->next = head; |
| 979 | block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); | 998 | block->next = cpu_to_be64(tmp->next ? tmp->next->dma : 0); |
| 980 | block->block_num = cpu_to_be32(n - i - 1); | 999 | block->block_num = cpu_to_be32(n - i - 1); |
| 1000 | block->token = token; | ||
| 981 | head = tmp; | 1001 | head = tmp; |
| 982 | } | 1002 | } |
| 983 | msg->next = head; | 1003 | msg->next = head; |
| @@ -1352,7 +1372,7 @@ static struct mlx5_cmd_msg *alloc_msg(struct mlx5_core_dev *dev, int in_size, · 368 unmodified lines | |||
| 1352 | } | 1372 | } |
| 1353 | 1373 | ||
| 1354 | if (IS_ERR(msg)) | 1374 | if (IS_ERR(msg)) |
| 1355 | msg = mlx5_alloc_cmd_msg(dev, gfp, in_size); | 1375 | msg = mlx5_alloc_cmd_msg(dev, gfp, in_size, 0); |
| 1356 | 1376 | ||
| 1357 | return msg; | 1377 | return msg; |
| 1358 | } | 1378 | } |
| @@ -1377,6 +1397,7 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, · 18 unmodified lines | |||
| 1377 | int err; | 1397 | int err; |
| 1378 | u8 status = 0; | 1398 | u8 status = 0; |
| 1379 | u32 drv_synd; | 1399 | u32 drv_synd; |
| 1400 | u8 token; | ||
| 1380 | 1401 | ||
| 1381 | if (pci_channel_offline(dev->pdev) || | 1402 | if (pci_channel_offline(dev->pdev) || |
| 1382 | dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | 1403 | dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
| @@ -1395,20 +1416,22 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, · 12 unmodified lines | |||
| 1395 | return err; | 1416 | return err; |
| 1396 | } | 1417 | } |
| 1397 | 1418 | ||
| 1398 | err = mlx5_copy_to_msg(inb, in, in_size); | 1419 | token = alloc_token(&dev->cmd); |
| 1420 | |||
| 1421 | err = mlx5_copy_to_msg(inb, in, in_size, token); | ||
| 1399 | if (err) { | 1422 | if (err) { |
| 1400 | mlx5_core_warn(dev, "err %d\n", err); | 1423 | mlx5_core_warn(dev, "err %d\n", err); |
| 1401 | goto out_in; | 1424 | goto out_in; |
| 1402 | } | 1425 | } |
| 1403 | 1426 | ||
| 1404 | outb = mlx5_alloc_cmd_msg(dev, gfp, out_size); | 1427 | outb = mlx5_alloc_cmd_msg(dev, gfp, out_size, token); |
| 1405 | if (IS_ERR(outb)) { | 1428 | if (IS_ERR(outb)) { |
| 1406 | err = PTR_ERR(outb); | 1429 | err = PTR_ERR(outb); |
| 1407 | goto out_in; | 1430 | goto out_in; |
| 1408 | } | 1431 | } |
| 1409 | 1432 | ||
| 1410 | err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, | 1433 | err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context, |
| 1411 | pages_queue, &status); | 1434 | pages_queue, &status, token); |
| 1412 | if (err) | 1435 | if (err) |
| 1413 | goto out_out; | 1436 | goto out_out; |
| 1414 | 1437 | ||
| @@ -1476,7 +1499,7 @@ static int create_msg_cache(struct mlx5_core_dev *dev) · 61 unmodified lines | |||
| 1476 | INIT_LIST_HEAD(&cmd->cache.med.head); | 1499 | INIT_LIST_HEAD(&cmd->cache.med.head); |
| 1477 | 1500 | ||
| 1478 | for (i = 0; i < NUM_LONG_LISTS; i++) { | 1501 | for (i = 0; i < NUM_LONG_LISTS; i++) { |
| 1479 | msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, LONG_LIST_SIZE); | 1502 | msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, LONG_LIST_SIZE, 0); |
| 1480 | if (IS_ERR(msg)) { | 1503 | if (IS_ERR(msg)) { |
| 1481 | err = PTR_ERR(msg); | 1504 | err = PTR_ERR(msg); |
| 1482 | goto ex_err; | 1505 | goto ex_err; |
| @@ -1486,7 +1509,7 @@ static int create_msg_cache(struct mlx5_core_dev *dev) · 3 unmodified lines | |||
| 1486 | } | 1509 | } |
| 1487 | 1510 | ||
| 1488 | for (i = 0; i < NUM_MED_LISTS; i++) { | 1511 | for (i = 0; i < NUM_MED_LISTS; i++) { |
| 1489 | msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, MED_LIST_SIZE); | 1512 | msg = mlx5_alloc_cmd_msg(dev, GFP_KERNEL, MED_LIST_SIZE, 0); |
| 1490 | if (IS_ERR(msg)) { | 1513 | if (IS_ERR(msg)) { |
| 1491 | err = PTR_ERR(msg); | 1514 | err = PTR_ERR(msg); |
| 1492 | goto ex_err; | 1515 | goto ex_err; |
| @@ -73,8 +73,12 @@ · 72 unmodified lines | |||
| 73 | #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER) | 73 | #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER) |
| 74 | #define MLX5_MPWRQ_STRIDES_PER_PAGE (MLX5_MPWRQ_NUM_STRIDES >> \ | 74 | #define MLX5_MPWRQ_STRIDES_PER_PAGE (MLX5_MPWRQ_NUM_STRIDES >> \ |
| 75 | MLX5_MPWRQ_WQE_PAGE_ORDER) | 75 | MLX5_MPWRQ_WQE_PAGE_ORDER) |
| 76 | #define MLX5_CHANNEL_MAX_NUM_MTTS (ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8) * \ | 76 | |
| 77 | BIT(MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW)) | 77 | #define MLX5_MTT_OCTW(npages) (ALIGN(npages, 8) / 2) |
| 78 | #define MLX5E_REQUIRED_MTTS(rqs, wqes)\ | ||
| 79 | (rqs * wqes * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8)) | ||
| 80 | #define MLX5E_VALID_NUM_MTTS(num_mtts) (MLX5_MTT_OCTW(num_mtts) <= U16_MAX) | ||
| 81 | |||
| 78 | #define MLX5_UMR_ALIGN (2048) | 82 | #define MLX5_UMR_ALIGN (2048) |
| 79 | #define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD (128) | 83 | #define MLX5_MPWRQ_SMALL_PACKET_THRESHOLD (128) |
| 80 | 84 | ||
| @@ -219,9 +223,8 @@ struct mlx5e_tstamp { · 138 unmodified lines | |||
| 219 | }; | 223 | }; |
| 220 | 224 | ||
| 221 | enum { | 225 | enum { |
| 222 | MLX5E_RQ_STATE_POST_WQES_ENABLE, | 226 | MLX5E_RQ_STATE_FLUSH, |
| 223 | MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, | 227 | MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, |
| 224 | MLX5E_RQ_STATE_FLUSH_TIMEOUT, | ||
| 225 | MLX5E_RQ_STATE_AM, | 228 | MLX5E_RQ_STATE_AM, |
| 226 | }; | 229 | }; |
| 227 | 230 | ||
| @@ -304,6 +307,7 @@ struct mlx5e_rq { · 76 unmodified lines | |||
| 304 | 307 | ||
| 305 | unsigned long state; | 308 | unsigned long state; |
| 306 | int ix; | 309 | int ix; |
| 310 | u32 mpwqe_mtt_offset; | ||
| 307 | 311 | ||
| 308 | struct mlx5e_rx_am am; /* Adaptive Moderation */ | 312 | struct mlx5e_rx_am am; /* Adaptive Moderation */ |
| 309 | 313 | ||
| @@ -365,9 +369,8 @@ struct mlx5e_sq_dma { · 55 unmodified lines | |||
| 365 | }; | 369 | }; |
| 366 | 370 | ||
| 367 | enum { | 371 | enum { |
| 368 | MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, | 372 | MLX5E_SQ_STATE_FLUSH, |
| 369 | MLX5E_SQ_STATE_BF_ENABLE, | 373 | MLX5E_SQ_STATE_BF_ENABLE, |
| 370 | MLX5E_SQ_STATE_TX_TIMEOUT, | ||
| 371 | }; | 374 | }; |
| 372 | 375 | ||
| 373 | struct mlx5e_ico_wqe_info { | 376 | struct mlx5e_ico_wqe_info { |
| @@ -698,7 +701,6 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget); · 324 unmodified lines | |||
| 698 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget); | 701 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget); |
| 699 | int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget); | 702 | int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget); |
| 700 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq); | 703 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq); |
| 701 | void mlx5e_free_rx_descs(struct mlx5e_rq *rq); | ||
| 702 | 704 | ||
| 703 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 705 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| 704 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 706 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| @@ -814,11 +816,6 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) · 109 unmodified lines | |||
| 814 | MLX5E_MAX_NUM_CHANNELS); | 816 | MLX5E_MAX_NUM_CHANNELS); |
| 815 | } | 817 | } |
| 816 | 818 | ||
| 817 | static inline int mlx5e_get_mtt_octw(int npages) | ||
| 818 | { | ||
| 819 | return ALIGN(npages, 8) / 2; | ||
| 820 | } | ||
| 821 | |||
| 822 | extern const struct ethtool_ops mlx5e_ethtool_ops; | 819 | extern const struct ethtool_ops mlx5e_ethtool_ops; |
| 823 | #ifdef CONFIG_MLX5_CORE_EN_DCB | 820 | #ifdef CONFIG_MLX5_CORE_EN_DCB |
| 824 | extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops; | 821 | extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops; |
| @@ -139,7 +139,7 @@ int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5_core_dev *mdev) · 138 unmodified lines | |||
| 139 | struct mlx5e_tir *tir; | 139 | struct mlx5e_tir *tir; |
| 140 | void *in; | 140 | void *in; |
| 141 | int inlen; | 141 | int inlen; |
| 142 | int err; | 142 | int err = 0; |
| 143 | 143 | ||
| 144 | inlen = MLX5_ST_SZ_BYTES(modify_tir_in); | 144 | inlen = MLX5_ST_SZ_BYTES(modify_tir_in); |
| 145 | in = mlx5_vzalloc(inlen); | 145 | in = mlx5_vzalloc(inlen); |
| @@ -151,10 +151,11 @@ int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5_core_dev *mdev) · 5 unmodified lines | |||
| 151 | list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) { | 151 | list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) { |
| 152 | err = mlx5_core_modify_tir(mdev, tir->tirn, in, inlen); | 152 | err = mlx5_core_modify_tir(mdev, tir->tirn, in, inlen); |
| 153 | if (err) | 153 | if (err) |
| 154 | return err; | 154 | goto out; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | out: | ||
| 157 | kvfree(in); | 158 | kvfree(in); |
| 158 | 159 | ||
| 159 | return 0; | 160 | return err; |
| 160 | } | 161 | } |
| @@ -127,29 +127,40 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) · 126 unmodified lines | |||
| 127 | return mlx5_set_port_tc_bw_alloc(mdev, tc_tx_bw); | 127 | return mlx5_set_port_tc_bw_alloc(mdev, tc_tx_bw); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static int mlx5e_dbcnl_validate_ets(struct ieee_ets *ets) | 130 | static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, |
| 131 | struct ieee_ets *ets) | ||
| 131 | { | 132 | { |
| 132 | int bw_sum = 0; | 133 | int bw_sum = 0; |
| 133 | int i; | 134 | int i; |
| 134 | 135 | ||
| 135 | /* Validate Priority */ | 136 | /* Validate Priority */ |
| 136 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { | 137 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { |
| 137 | if (ets->prio_tc[i] >= MLX5E_MAX_PRIORITY) | 138 | if (ets->prio_tc[i] >= MLX5E_MAX_PRIORITY) { |
| 139 | netdev_err(netdev, | ||
| 140 | "Failed to validate ETS: priority value greater than max(%d)\n", | ||
| 141 | MLX5E_MAX_PRIORITY); | ||
| 138 | return -EINVAL; | 142 | return -EINVAL; |
| 143 | } | ||
| 139 | } | 144 | } |
| 140 | 145 | ||
| 141 | /* Validate Bandwidth Sum */ | 146 | /* Validate Bandwidth Sum */ |
| 142 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { | 147 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { |
| 143 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { | 148 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { |
| 144 | if (!ets->tc_tx_bw[i]) | 149 | if (!ets->tc_tx_bw[i]) { |
| 150 | netdev_err(netdev, | ||
| 151 | "Failed to validate ETS: BW 0 is illegal\n"); | ||
| 145 | return -EINVAL; | 152 | return -EINVAL; |
| 153 | } | ||
| 146 | 154 | ||
| 147 | bw_sum += ets->tc_tx_bw[i]; | 155 | bw_sum += ets->tc_tx_bw[i]; |
| 148 | } | 156 | } |
| 149 | } | 157 | } |
| 150 | 158 | ||
| 151 | if (bw_sum != 0 && bw_sum != 100) | 159 | if (bw_sum != 0 && bw_sum != 100) { |
| 160 | netdev_err(netdev, | ||
| 161 | "Failed to validate ETS: BW sum is illegal\n"); | ||
| 152 | return -EINVAL; | 162 | return -EINVAL; |
| 163 | } | ||
| 153 | return 0; | 164 | return 0; |
| 154 | } | 165 | } |
| 155 | 166 | ||
| @@ -159,7 +170,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev, · 3 unmodified lines | |||
| 159 | struct mlx5e_priv *priv = netdev_priv(netdev); | 170 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 160 | int err; | 171 | int err; |
| 161 | 172 | ||
| 162 | err = mlx5e_dbcnl_validate_ets(ets); | 173 | err = mlx5e_dbcnl_validate_ets(netdev, ets); |
| 163 | if (err) | 174 | if (err) |
| 164 | return err; | 175 | return err; |
| 165 | 176 | ||
| @@ -331,7 +331,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev, · 330 unmodified lines | |||
| 331 | if (mlx5e_query_global_pause_combined(priv)) { | 331 | if (mlx5e_query_global_pause_combined(priv)) { |
| 332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { | 332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { |
| 333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], | 333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], |
| 334 | pport_per_prio_pfc_stats_desc, 0); | 334 | pport_per_prio_pfc_stats_desc, i); |
| 335 | } | 335 | } |
| 336 | } | 336 | } |
| 337 | 337 | ||
| @@ -352,15 +352,61 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev, · 14 unmodified lines | |||
| 352 | sq_stats_desc, j); | 352 | sq_stats_desc, j); |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | static u32 mlx5e_rx_wqes_to_packets(struct mlx5e_priv *priv, int rq_wq_type, | ||
| 356 | int num_wqe) | ||
| 357 | { | ||
| 358 | int packets_per_wqe; | ||
| 359 | int stride_size; | ||
| 360 | int num_strides; | ||
| 361 | int wqe_size; | ||
| 362 | |||
| 363 | if (rq_wq_type != MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) | ||
| 364 | return num_wqe; | ||
| 365 | |||
| 366 | stride_size = 1 << priv->params.mpwqe_log_stride_sz; | ||
| 367 | num_strides = 1 << priv->params.mpwqe_log_num_strides; | ||
| 368 | wqe_size = stride_size * num_strides; | ||
| 369 | |||
| 370 | packets_per_wqe = wqe_size / | ||
| 371 | ALIGN(ETH_DATA_LEN, stride_size); | ||
| 372 | return (1 << (order_base_2(num_wqe * packets_per_wqe) - 1)); | ||
| 373 | } | ||
| 374 | |||
| 375 | static u32 mlx5e_packets_to_rx_wqes(struct mlx5e_priv *priv, int rq_wq_type, | ||
| 376 | int num_packets) | ||
| 377 | { | ||
| 378 | int packets_per_wqe; | ||
| 379 | int stride_size; | ||
| 380 | int num_strides; | ||
| 381 | int wqe_size; | ||
| 382 | int num_wqes; | ||
| 383 | |||
| 384 | if (rq_wq_type != MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) | ||
| 385 | return num_packets; | ||
| 386 | |||
| 387 | stride_size = 1 << priv->params.mpwqe_log_stride_sz; | ||
| 388 | num_strides = 1 << priv->params.mpwqe_log_num_strides; | ||
| 389 | wqe_size = stride_size * num_strides; | ||
| 390 | |||
| 391 | num_packets = (1 << order_base_2(num_packets)); | ||
| 392 | |||
| 393 | packets_per_wqe = wqe_size / | ||
| 394 | ALIGN(ETH_DATA_LEN, stride_size); | ||
| 395 | num_wqes = DIV_ROUND_UP(num_packets, packets_per_wqe); | ||
| 396 | return 1 << (order_base_2(num_wqes)); | ||
| 397 | } | ||
| 398 | |||
| 355 | static void mlx5e_get_ringparam(struct net_device *dev, | 399 | static void mlx5e_get_ringparam(struct net_device *dev, |
| 356 | struct ethtool_ringparam *param) | 400 | struct ethtool_ringparam *param) |
| 357 | { | 401 | { |
| 358 | struct mlx5e_priv *priv = netdev_priv(dev); | 402 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 359 | int rq_wq_type = priv->params.rq_wq_type; | 403 | int rq_wq_type = priv->params.rq_wq_type; |
| 360 | 404 | ||
| 361 | param->rx_max_pending = 1 << mlx5_max_log_rq_size(rq_wq_type); | 405 | param->rx_max_pending = mlx5e_rx_wqes_to_packets(priv, rq_wq_type, |
| 406 | 1 << mlx5_max_log_rq_size(rq_wq_type)); | ||
| 362 | param->tx_max_pending = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; | 407 | param->tx_max_pending = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; |
| 363 | param->rx_pending = 1 << priv->params.log_rq_size; | 408 | param->rx_pending = mlx5e_rx_wqes_to_packets(priv, rq_wq_type, |
| 409 | 1 << priv->params.log_rq_size); | ||
| 364 | param->tx_pending = 1 << priv->params.log_sq_size; | 410 | param->tx_pending = 1 << priv->params.log_sq_size; |
| 365 | } | 411 | } |
| 366 | 412 | ||
| @@ -370,9 +416,13 @@ static int mlx5e_set_ringparam(struct net_device *dev, · 3 unmodified lines | |||
| 370 | struct mlx5e_priv *priv = netdev_priv(dev); | 416 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 371 | bool was_opened; | 417 | bool was_opened; |
| 372 | int rq_wq_type = priv->params.rq_wq_type; | 418 | int rq_wq_type = priv->params.rq_wq_type; |
| 419 | u32 rx_pending_wqes; | ||
| 420 | u32 min_rq_size; | ||
| 421 | u32 max_rq_size; | ||
| 373 | u16 min_rx_wqes; | 422 | u16 min_rx_wqes; |
| 374 | u8 log_rq_size; | 423 | u8 log_rq_size; |
| 375 | u8 log_sq_size; | 424 | u8 log_sq_size; |
| 425 | u32 num_mtts; | ||
| 376 | int err = 0; | 426 | int err = 0; |
| 377 | 427 | ||
| 378 | if (param->rx_jumbo_pending) { | 428 | if (param->rx_jumbo_pending) { |
| @@ -385,18 +435,36 @@ static int mlx5e_set_ringparam(struct net_device *dev, · 6 unmodified lines | |||
| 385 | __func__); | 435 | __func__); |
| 386 | return -EINVAL; | 436 | return -EINVAL; |
| 387 | } | 437 | } |
| 388 | if (param->rx_pending < (1 << mlx5_min_log_rq_size(rq_wq_type))) { | 438 | |
| 439 | min_rq_size = mlx5e_rx_wqes_to_packets(priv, rq_wq_type, | ||
| 440 | 1 << mlx5_min_log_rq_size(rq_wq_type)); | ||
| 441 | max_rq_size = mlx5e_rx_wqes_to_packets(priv, rq_wq_type, | ||
| 442 | 1 << mlx5_max_log_rq_size(rq_wq_type)); | ||
| 443 | rx_pending_wqes = mlx5e_packets_to_rx_wqes(priv, rq_wq_type, | ||
| 444 | param->rx_pending); | ||
| 445 | |||
| 446 | if (param->rx_pending < min_rq_size) { | ||
| 389 | netdev_info(dev, "%s: rx_pending (%d) < min (%d)\n", | 447 | netdev_info(dev, "%s: rx_pending (%d) < min (%d)\n", |
| 390 | __func__, param->rx_pending, | 448 | __func__, param->rx_pending, |
| 391 | 1 << mlx5_min_log_rq_size(rq_wq_type)); | 449 | min_rq_size); |
| 392 | return -EINVAL; | 450 | return -EINVAL; |
| 393 | } | 451 | } |
| 394 | if (param->rx_pending > (1 << mlx5_max_log_rq_size(rq_wq_type))) { | 452 | if (param->rx_pending > max_rq_size) { |
| 395 | netdev_info(dev, "%s: rx_pending (%d) > max (%d)\n", | 453 | netdev_info(dev, "%s: rx_pending (%d) > max (%d)\n", |
| 396 | __func__, param->rx_pending, | 454 | __func__, param->rx_pending, |
| 397 | 1 << mlx5_max_log_rq_size(rq_wq_type)); | 455 | max_rq_size); |
| 398 | return -EINVAL; | 456 | return -EINVAL; |
| 399 | } | 457 | } |
| 458 | |||
| 459 | num_mtts = MLX5E_REQUIRED_MTTS(priv->params.num_channels, | ||
| 460 | rx_pending_wqes); | ||
| 461 | if (priv->params.rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ && | ||
| 462 | !MLX5E_VALID_NUM_MTTS(num_mtts)) { | ||
| 463 | netdev_info(dev, "%s: rx_pending (%d) request can't be satisfied, try to reduce.\n", | ||
| 464 | __func__, param->rx_pending); | ||
| 465 | return -EINVAL; | ||
| 466 | } | ||
| 467 | |||
| 400 | if (param->tx_pending < (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) { | 468 | if (param->tx_pending < (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) { |
| 401 | netdev_info(dev, "%s: tx_pending (%d) < min (%d)\n", | 469 | netdev_info(dev, "%s: tx_pending (%d) < min (%d)\n", |
| 402 | __func__, param->tx_pending, | 470 | __func__, param->tx_pending, |
| @@ -410,9 +478,9 @@ static int mlx5e_set_ringparam(struct net_device *dev, · 7 unmodified lines | |||
| 410 | return -EINVAL; | 478 | return -EINVAL; |
| 411 | } | 479 | } |
| 412 | 480 | ||
| 413 | log_rq_size = order_base_2(param->rx_pending); | 481 | log_rq_size = order_base_2(rx_pending_wqes); |
| 414 | log_sq_size = order_base_2(param->tx_pending); | 482 | log_sq_size = order_base_2(param->tx_pending); |
| 415 | min_rx_wqes = mlx5_min_rx_wqes(rq_wq_type, param->rx_pending); | 483 | min_rx_wqes = mlx5_min_rx_wqes(rq_wq_type, rx_pending_wqes); |
| 416 | 484 | ||
| 417 | if (log_rq_size == priv->params.log_rq_size && | 485 | if (log_rq_size == priv->params.log_rq_size && |
| 418 | log_sq_size == priv->params.log_sq_size && | 486 | log_sq_size == priv->params.log_sq_size && |
| @@ -454,6 +522,7 @@ static int mlx5e_set_channels(struct net_device *dev, · 35 unmodified lines | |||
| 454 | unsigned int count = ch->combined_count; | 522 | unsigned int count = ch->combined_count; |
| 455 | bool arfs_enabled; | 523 | bool arfs_enabled; |
| 456 | bool was_opened; | 524 | bool was_opened; |
| 525 | u32 num_mtts; | ||
| 457 | int err = 0; | 526 | int err = 0; |
| 458 | 527 | ||
| 459 | if (!count) { | 528 | if (!count) { |
| @@ -472,6 +541,14 @@ static int mlx5e_set_channels(struct net_device *dev, · 12 unmodified lines | |||
| 472 | return -EINVAL; | 541 | return -EINVAL; |
| 473 | } | 542 | } |
| 474 | 543 | ||
| 544 | num_mtts = MLX5E_REQUIRED_MTTS(count, BIT(priv->params.log_rq_size)); | ||
| 545 | if (priv->params.rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ && | ||
| 546 | !MLX5E_VALID_NUM_MTTS(num_mtts)) { | ||
| 547 | netdev_info(dev, "%s: rx count (%d) request can't be satisfied, try to reduce.\n", | ||
| 548 | __func__, count); | ||
| 549 | return -EINVAL; | ||
| 550 | } | ||
| 551 | |||
| 475 | if (priv->params.num_channels == count) | 552 | if (priv->params.num_channels == count) |
| 476 | return 0; | 553 | return 0; |
| 477 | 554 | ||
| @@ -582,9 +659,10 @@ out: · 104 unmodified lines | |||
| 582 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, | 659 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, |
| 583 | u32 eth_proto_cap) | 660 | u32 eth_proto_cap) |
| 584 | { | 661 | { |
| 662 | unsigned long proto_cap = eth_proto_cap; | ||
| 585 | int proto; | 663 | int proto; |
| 586 | 664 | ||
| 587 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 665 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
| 588 | bitmap_or(supported_modes, supported_modes, | 666 | bitmap_or(supported_modes, supported_modes, |
| 589 | ptys2ethtool_table[proto].supported, | 667 | ptys2ethtool_table[proto].supported, |
| 590 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 668 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
| @@ -593,9 +671,10 @@ static void ptys2ethtool_supported_link(unsigned long *supported_modes, · 2 unmodified lines | |||
| 593 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, | 671 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, |
| 594 | u32 eth_proto_cap) | 672 | u32 eth_proto_cap) |
| 595 | { | 673 | { |
| 674 | unsigned long proto_cap = eth_proto_cap; | ||
| 596 | int proto; | 675 | int proto; |
| 597 | 676 | ||
| 598 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 677 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
| 599 | bitmap_or(advertising_modes, advertising_modes, | 678 | bitmap_or(advertising_modes, advertising_modes, |
| 600 | ptys2ethtool_table[proto].advertised, | 679 | ptys2ethtool_table[proto].advertised, |
| 601 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 680 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
| @@ -39,13 +39,6 @@ · 38 unmodified lines | |||
| 39 | #include "eswitch.h" | 39 | #include "eswitch.h" |
| 40 | #include "vxlan.h" | 40 | #include "vxlan.h" |
| 41 | 41 | ||
| 42 | enum { | ||
| 43 | MLX5_EN_QP_FLUSH_TIMEOUT_MS = 5000, | ||
| 44 | MLX5_EN_QP_FLUSH_MSLEEP_QUANT = 20, | ||
| 45 | MLX5_EN_QP_FLUSH_MAX_ITER = MLX5_EN_QP_FLUSH_TIMEOUT_MS / | ||
| 46 | MLX5_EN_QP_FLUSH_MSLEEP_QUANT, | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct mlx5e_rq_param { | 42 | struct mlx5e_rq_param { |
| 50 | u32 rqc[MLX5_ST_SZ_DW(rqc)]; | 43 | u32 rqc[MLX5_ST_SZ_DW(rqc)]; |
| 51 | struct mlx5_wq_param wq; | 44 | struct mlx5_wq_param wq; |
| @@ -162,6 +155,7 @@ static void mlx5e_update_sw_counters(struct mlx5e_priv *priv) · 110 unmodified lines | |||
| 162 | s->tx_queue_stopped += sq_stats->stopped; | 155 | s->tx_queue_stopped += sq_stats->stopped; |
| 163 | s->tx_queue_wake += sq_stats->wake; | 156 | s->tx_queue_wake += sq_stats->wake; |
| 164 | s->tx_queue_dropped += sq_stats->dropped; | 157 | s->tx_queue_dropped += sq_stats->dropped; |
| 158 | s->tx_xmit_more += sq_stats->xmit_more; | ||
| 165 | s->tx_csum_partial_inner += sq_stats->csum_partial_inner; | 159 | s->tx_csum_partial_inner += sq_stats->csum_partial_inner; |
| 166 | tx_offload_none += sq_stats->csum_none; | 160 | tx_offload_none += sq_stats->csum_none; |
| 167 | } | 161 | } |
| @@ -340,6 +334,9 @@ static int mlx5e_create_rq(struct mlx5e_channel *c, · 172 unmodified lines | |||
| 340 | rq->alloc_wqe = mlx5e_alloc_rx_mpwqe; | 334 | rq->alloc_wqe = mlx5e_alloc_rx_mpwqe; |
| 341 | rq->dealloc_wqe = mlx5e_dealloc_rx_mpwqe; | 335 | rq->dealloc_wqe = mlx5e_dealloc_rx_mpwqe; |
| 342 | 336 | ||
| 337 | rq->mpwqe_mtt_offset = c->ix * | ||
| 338 | MLX5E_REQUIRED_MTTS(1, BIT(priv->params.log_rq_size)); | ||
| 339 | |||
| 343 | rq->mpwqe_stride_sz = BIT(priv->params.mpwqe_log_stride_sz); | 340 | rq->mpwqe_stride_sz = BIT(priv->params.mpwqe_log_stride_sz); |
| 344 | rq->mpwqe_num_strides = BIT(priv->params.mpwqe_log_num_strides); | 341 | rq->mpwqe_num_strides = BIT(priv->params.mpwqe_log_num_strides); |
| 345 | rq->wqe_sz = rq->mpwqe_stride_sz * rq->mpwqe_num_strides; | 342 | rq->wqe_sz = rq->mpwqe_stride_sz * rq->mpwqe_num_strides; |
| @@ -428,7 +425,6 @@ static int mlx5e_enable_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param) · 82 unmodified lines | |||
| 428 | 425 | ||
| 429 | MLX5_SET(rqc, rqc, cqn, rq->cq.mcq.cqn); | 426 | MLX5_SET(rqc, rqc, cqn, rq->cq.mcq.cqn); |
| 430 | MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); | 427 | MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); |
| 431 | MLX5_SET(rqc, rqc, flush_in_error_en, 1); | ||
| 432 | MLX5_SET(rqc, rqc, vsd, priv->params.vlan_strip_disable); | 428 | MLX5_SET(rqc, rqc, vsd, priv->params.vlan_strip_disable); |
| 433 | MLX5_SET(wq, wq, log_wq_pg_sz, rq->wq_ctrl.buf.page_shift - | 429 | MLX5_SET(wq, wq, log_wq_pg_sz, rq->wq_ctrl.buf.page_shift - |
| 434 | MLX5_ADAPTER_PAGE_SHIFT); | 430 | MLX5_ADAPTER_PAGE_SHIFT); |
| @@ -525,6 +521,27 @@ static int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq) · 90 unmodified lines | |||
| 525 | return -ETIMEDOUT; | 521 | return -ETIMEDOUT; |
| 526 | } | 522 | } |
| 527 | 523 | ||
| 524 | static void mlx5e_free_rx_descs(struct mlx5e_rq *rq) | ||
| 525 | { | ||
| 526 | struct mlx5_wq_ll *wq = &rq->wq; | ||
| 527 | struct mlx5e_rx_wqe *wqe; | ||
| 528 | __be16 wqe_ix_be; | ||
| 529 | u16 wqe_ix; | ||
| 530 | |||
| 531 | /* UMR WQE (if in progress) is always at wq->head */ | ||
| 532 | if (test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state)) | ||
| 533 | mlx5e_free_rx_fragmented_mpwqe(rq, &rq->wqe_info[wq->head]); | ||
| 534 | |||
| 535 | while (!mlx5_wq_ll_is_empty(wq)) { | ||
| 536 | wqe_ix_be = *wq->tail_next; | ||
| 537 | wqe_ix = be16_to_cpu(wqe_ix_be); | ||
| 538 | wqe = mlx5_wq_ll_get_wqe(&rq->wq, wqe_ix); | ||
| 539 | rq->dealloc_wqe(rq, wqe_ix); | ||
| 540 | mlx5_wq_ll_pop(&rq->wq, wqe_ix_be, | ||
| 541 | &wqe->next.next_wqe_index); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | |||
| 528 | static int mlx5e_open_rq(struct mlx5e_channel *c, | 545 | static int mlx5e_open_rq(struct mlx5e_channel *c, |
| 529 | struct mlx5e_rq_param *param, | 546 | struct mlx5e_rq_param *param, |
| 530 | struct mlx5e_rq *rq) | 547 | struct mlx5e_rq *rq) |
| @@ -548,8 +565,6 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, · 17 unmodified lines | |||
| 548 | if (param->am_enabled) | 565 | if (param->am_enabled) |
| 549 | set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); | 566 | set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 550 | 567 | ||
| 551 | set_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state); | ||
| 552 | |||
| 553 | sq->ico_wqe_info[pi].opcode = MLX5_OPCODE_NOP; | 568 | sq->ico_wqe_info[pi].opcode = MLX5_OPCODE_NOP; |
| 554 | sq->ico_wqe_info[pi].num_wqebbs = 1; | 569 | sq->ico_wqe_info[pi].num_wqebbs = 1; |
| 555 | mlx5e_send_nop(sq, true); /* trigger mlx5e_post_rx_wqes() */ | 570 | mlx5e_send_nop(sq, true); /* trigger mlx5e_post_rx_wqes() */ |
| @@ -566,23 +581,8 @@ err_destroy_rq: · 10 unmodified lines | |||
| 566 | 581 | ||
| 567 | static void mlx5e_close_rq(struct mlx5e_rq *rq) | 582 | static void mlx5e_close_rq(struct mlx5e_rq *rq) |
| 568 | { | 583 | { |
| 569 | int tout = 0; | 584 | set_bit(MLX5E_RQ_STATE_FLUSH, &rq->state); |
| 570 | int err; | ||
| 571 | |||
| 572 | clear_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state); | ||
| 573 | napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */ | 585 | napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */ |
| 574 | |||
| 575 | err = mlx5e_modify_rq_state(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); | ||
| 576 | while (!mlx5_wq_ll_is_empty(&rq->wq) && !err && | ||
| 577 | tout++ < MLX5_EN_QP_FLUSH_MAX_ITER) | ||
| 578 | msleep(MLX5_EN_QP_FLUSH_MSLEEP_QUANT); | ||
| 579 | |||
| 580 | if (err || tout == MLX5_EN_QP_FLUSH_MAX_ITER) | ||
| 581 | set_bit(MLX5E_RQ_STATE_FLUSH_TIMEOUT, &rq->state); | ||
| 582 | |||
| 583 | /* avoid destroying rq before mlx5e_poll_rx_cq() is done with it */ | ||
| 584 | napi_synchronize(&rq->channel->napi); | ||
| 585 | |||
| 586 | cancel_work_sync(&rq->am.work); | 586 | cancel_work_sync(&rq->am.work); |
| 587 | 587 | ||
| 588 | mlx5e_disable_rq(rq); | 588 | mlx5e_disable_rq(rq); |
| @@ -821,7 +821,6 @@ static int mlx5e_open_sq(struct mlx5e_channel *c, · 232 unmodified lines | |||
| 821 | goto err_disable_sq; | 821 | goto err_disable_sq; |
| 822 | 822 | ||
| 823 | if (sq->txq) { | 823 | if (sq->txq) { |
| 824 | set_bit(MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, &sq->state); | ||
| 825 | netdev_tx_reset_queue(sq->txq); | 824 | netdev_tx_reset_queue(sq->txq); |
| 826 | netif_tx_start_queue(sq->txq); | 825 | netif_tx_start_queue(sq->txq); |
| 827 | } | 826 | } |
| @@ -845,38 +844,20 @@ static inline void netif_tx_disable_queue(struct netdev_queue *txq) · 17 unmodified lines | |||
| 845 | 844 | ||
| 846 | static void mlx5e_close_sq(struct mlx5e_sq *sq) | 845 | static void mlx5e_close_sq(struct mlx5e_sq *sq) |
| 847 | { | 846 | { |
| 848 | int tout = 0; | 847 | set_bit(MLX5E_SQ_STATE_FLUSH, &sq->state); |
| 849 | int err; | 848 | /* prevent netif_tx_wake_queue */ |
| 849 | napi_synchronize(&sq->channel->napi); | ||
| 850 | 850 | ||
| 851 | if (sq->txq) { | 851 | if (sq->txq) { |
| 852 | clear_bit(MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, &sq->state); | ||
| 853 | /* prevent netif_tx_wake_queue */ | ||
| 854 | napi_synchronize(&sq->channel->napi); | ||
| 855 | netif_tx_disable_queue(sq->txq); | 852 | netif_tx_disable_queue(sq->txq); |
| 856 | 853 | ||
| 857 | /* ensure hw is notified of all pending wqes */ | 854 | /* last doorbell out, godspeed .. */ |
| 858 | if (mlx5e_sq_has_room_for(sq, 1)) | 855 | if (mlx5e_sq_has_room_for(sq, 1)) |
| 859 | mlx5e_send_nop(sq, true); | 856 | mlx5e_send_nop(sq, true); |
| 860 | |||
| 861 | err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, | ||
| 862 | MLX5_SQC_STATE_ERR, false, 0); | ||
| 863 | if (err) | ||
| 864 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | ||
| 865 | } | ||
| 866 | |||
| 867 | /* wait till sq is empty, unless a TX timeout occurred on this SQ */ | ||
| 868 | while (sq->cc != sq->pc && | ||
| 869 | !test_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state)) { | ||
| 870 | msleep(MLX5_EN_QP_FLUSH_MSLEEP_QUANT); | ||
| 871 | if (tout++ > MLX5_EN_QP_FLUSH_MAX_ITER) | ||
| 872 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | ||
| 873 | } | 857 | } |
| 874 | 858 | ||
| 875 | /* avoid destroying sq before mlx5e_poll_tx_cq() is done with it */ | ||
| 876 | napi_synchronize(&sq->channel->napi); | ||
| 877 | |||
| 878 | mlx5e_free_tx_descs(sq); | ||
| 879 | mlx5e_disable_sq(sq); | 859 | mlx5e_disable_sq(sq); |
| 860 | mlx5e_free_tx_descs(sq); | ||
| 880 | mlx5e_destroy_sq(sq); | 861 | mlx5e_destroy_sq(sq); |
| 881 | } | 862 | } |
| 882 | 863 | ||
| @@ -1826,10 +1807,6 @@ int mlx5e_open_locked(struct net_device *netdev) · 943 unmodified lines | |||
| 1826 | netif_set_real_num_tx_queues(netdev, num_txqs); | 1807 | netif_set_real_num_tx_queues(netdev, num_txqs); |
| 1827 | netif_set_real_num_rx_queues(netdev, priv->params.num_channels); | 1808 | netif_set_real_num_rx_queues(netdev, priv->params.num_channels); |
| 1828 | 1809 | ||
| 1829 | err = mlx5e_set_dev_port_mtu(netdev); | ||
| 1830 | if (err) | ||
| 1831 | goto err_clear_state_opened_flag; | ||
| 1832 | |||
| 1833 | err = mlx5e_open_channels(priv); | 1810 | err = mlx5e_open_channels(priv); |
| 1834 | if (err) { | 1811 | if (err) { |
| 1835 | netdev_err(netdev, "%s: mlx5e_open_channels failed, %d\n", | 1812 | netdev_err(netdev, "%s: mlx5e_open_channels failed, %d\n", |
| @@ -2573,6 +2550,7 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) · 737 unmodified lines | |||
| 2573 | u16 max_mtu; | 2550 | u16 max_mtu; |
| 2574 | u16 min_mtu; | 2551 | u16 min_mtu; |
| 2575 | int err = 0; | 2552 | int err = 0; |
| 2553 | bool reset; | ||
| 2576 | 2554 | ||
| 2577 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); | 2555 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); |
| 2578 | 2556 | ||
| @@ -2588,13 +2566,18 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) · 9 unmodified lines | |||
| 2588 | 2566 | ||
| 2589 | mutex_lock(&priv->state_lock); | 2567 | mutex_lock(&priv->state_lock); |
| 2590 | 2568 | ||
| 2569 | reset = !priv->params.lro_en && | ||
| 2570 | (priv->params.rq_wq_type != | ||
| 2571 | MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ); | ||
| 2572 | |||
| 2591 | was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); | 2573 | was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); |
| 2592 | if (was_opened) | 2574 | if (was_opened && reset) |
| 2593 | mlx5e_close_locked(netdev); | 2575 | mlx5e_close_locked(netdev); |
| 2594 | 2576 | ||
| 2595 | netdev->mtu = new_mtu; | 2577 | netdev->mtu = new_mtu; |
| 2578 | mlx5e_set_dev_port_mtu(netdev); | ||
| 2596 | 2579 | ||
| 2597 | if (was_opened) | 2580 | if (was_opened && reset) |
| 2598 | err = mlx5e_open_locked(netdev); | 2581 | err = mlx5e_open_locked(netdev); |
| 2599 | 2582 | ||
| 2600 | mutex_unlock(&priv->state_lock); | 2583 | mutex_unlock(&priv->state_lock); |
| @@ -2794,7 +2777,7 @@ static void mlx5e_tx_timeout(struct net_device *dev) · 193 unmodified lines | |||
| 2794 | if (!netif_xmit_stopped(netdev_get_tx_queue(dev, i))) | 2777 | if (!netif_xmit_stopped(netdev_get_tx_queue(dev, i))) |
| 2795 | continue; | 2778 | continue; |
| 2796 | sched_work = true; | 2779 | sched_work = true; |
| 2797 | set_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state); | 2780 | set_bit(MLX5E_SQ_STATE_FLUSH, &sq->state); |
| 2798 | netdev_err(dev, "TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x\n", | 2781 | netdev_err(dev, "TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x\n", |
| 2799 | i, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc); | 2782 | i, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc); |
| 2800 | } | 2783 | } |
| @@ -3231,8 +3214,8 @@ static int mlx5e_create_umr_mkey(struct mlx5e_priv *priv) · 430 unmodified lines | |||
| 3231 | struct mlx5_create_mkey_mbox_in *in; | 3214 | struct mlx5_create_mkey_mbox_in *in; |
| 3232 | struct mlx5_mkey_seg *mkc; | 3215 | struct mlx5_mkey_seg *mkc; |
| 3233 | int inlen = sizeof(*in); | 3216 | int inlen = sizeof(*in); |
| 3234 | u64 npages = | 3217 | u64 npages = MLX5E_REQUIRED_MTTS(priv->profile->max_nch(mdev), |
| 3235 | priv->profile->max_nch(mdev) * MLX5_CHANNEL_MAX_NUM_MTTS; | 3218 | BIT(MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW)); |
| 3236 | int err; | 3219 | int err; |
| 3237 | 3220 | ||
| 3238 | in = mlx5_vzalloc(inlen); | 3221 | in = mlx5_vzalloc(inlen); |
| @@ -3246,10 +3229,12 @@ static int mlx5e_create_umr_mkey(struct mlx5e_priv *priv) · 7 unmodified lines | |||
| 3246 | MLX5_PERM_LOCAL_WRITE | | 3229 | MLX5_PERM_LOCAL_WRITE | |
| 3247 | MLX5_ACCESS_MODE_MTT; | 3230 | MLX5_ACCESS_MODE_MTT; |
| 3248 | 3231 | ||
| 3232 | npages = min_t(u32, ALIGN(U16_MAX, 4) * 2, npages); | ||
| 3233 | |||
| 3249 | mkc->qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); | 3234 | mkc->qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); |
| 3250 | mkc->flags_pd = cpu_to_be32(mdev->mlx5e_res.pdn); | 3235 | mkc->flags_pd = cpu_to_be32(mdev->mlx5e_res.pdn); |
| 3251 | mkc->len = cpu_to_be64(npages << PAGE_SHIFT); | 3236 | mkc->len = cpu_to_be64(npages << PAGE_SHIFT); |
| 3252 | mkc->xlt_oct_size = cpu_to_be32(mlx5e_get_mtt_octw(npages)); | 3237 | mkc->xlt_oct_size = cpu_to_be32(MLX5_MTT_OCTW(npages)); |
| 3253 | mkc->log2_page_size = PAGE_SHIFT; | 3238 | mkc->log2_page_size = PAGE_SHIFT; |
| 3254 | 3239 | ||
| 3255 | err = mlx5_core_create_mkey(mdev, &priv->umr_mkey, in, inlen, NULL, | 3240 | err = mlx5_core_create_mkey(mdev, &priv->umr_mkey, in, inlen, NULL, |
| @@ -3385,6 +3370,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) · 129 unmodified lines | |||
| 3385 | queue_work(priv->wq, &priv->set_rx_mode_work); | 3370 | queue_work(priv->wq, &priv->set_rx_mode_work); |
| 3386 | 3371 | ||
| 3387 | if (MLX5_CAP_GEN(mdev, vport_group_manager)) { | 3372 | if (MLX5_CAP_GEN(mdev, vport_group_manager)) { |
| 3373 | mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id); | ||
| 3388 | rep.load = mlx5e_nic_rep_load; | 3374 | rep.load = mlx5e_nic_rep_load; |
| 3389 | rep.unload = mlx5e_nic_rep_unload; | 3375 | rep.unload = mlx5e_nic_rep_unload; |
| 3390 | rep.vport = 0; | 3376 | rep.vport = 0; |
| @@ -3463,6 +3449,8 @@ void *mlx5e_create_netdev(struct mlx5_core_dev *mdev, · 72 unmodified lines | |||
| 3463 | 3449 | ||
| 3464 | mlx5e_init_l2_addr(priv); | 3450 | mlx5e_init_l2_addr(priv); |
| 3465 | 3451 | ||
| 3452 | mlx5e_set_dev_port_mtu(netdev); | ||
| 3453 | |||
| 3466 | err = register_netdev(netdev); | 3454 | err = register_netdev(netdev); |
| 3467 | if (err) { | 3455 | if (err) { |
| 3468 | mlx5_core_err(mdev, "register_netdev failed, %d\n", err); | 3456 | mlx5_core_err(mdev, "register_netdev failed, %d\n", err); |
| @@ -3501,16 +3489,20 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev) · 32 unmodified lines | |||
| 3501 | struct mlx5_eswitch *esw = mdev->priv.eswitch; | 3489 | struct mlx5_eswitch *esw = mdev->priv.eswitch; |
| 3502 | int total_vfs = MLX5_TOTAL_VPORTS(mdev); | 3490 | int total_vfs = MLX5_TOTAL_VPORTS(mdev); |
| 3503 | int vport; | 3491 | int vport; |
| 3492 | u8 mac[ETH_ALEN]; | ||
| 3504 | 3493 | ||
| 3505 | if (!MLX5_CAP_GEN(mdev, vport_group_manager)) | 3494 | if (!MLX5_CAP_GEN(mdev, vport_group_manager)) |
| 3506 | return; | 3495 | return; |
| 3507 | 3496 | ||
| 3497 | mlx5_query_nic_vport_mac_address(mdev, 0, mac); | ||
| 3498 | |||
| 3508 | for (vport = 1; vport < total_vfs; vport++) { | 3499 | for (vport = 1; vport < total_vfs; vport++) { |
| 3509 | struct mlx5_eswitch_rep rep; | 3500 | struct mlx5_eswitch_rep rep; |
| 3510 | 3501 | ||
| 3511 | rep.load = mlx5e_vport_rep_load; | 3502 | rep.load = mlx5e_vport_rep_load; |
| 3512 | rep.unload = mlx5e_vport_rep_unload; | 3503 | rep.unload = mlx5e_vport_rep_unload; |
| 3513 | rep.vport = vport; | 3504 | rep.vport = vport; |
| 3505 | ether_addr_copy(rep.hw_id, mac); | ||
| 3514 | mlx5_eswitch_register_vport_rep(esw, &rep); | 3506 | mlx5_eswitch_register_vport_rep(esw, &rep); |
| 3515 | } | 3507 | } |
| 3516 | } | 3508 | } |
| @@ -135,17 +135,16 @@ static const struct ethtool_ops mlx5e_rep_ethtool_ops = { · 134 unmodified lines | |||
| 135 | int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr) | 135 | int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr) |
| 136 | { | 136 | { |
| 137 | struct mlx5e_priv *priv = netdev_priv(dev); | 137 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 138 | struct mlx5_eswitch_rep *rep = priv->ppriv; | ||
| 138 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | 139 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
| 139 | u8 mac[ETH_ALEN]; | ||
| 140 | 140 | ||
| 141 | if (esw->mode == SRIOV_NONE) | 141 | if (esw->mode == SRIOV_NONE) |
| 142 | return -EOPNOTSUPP; | 142 | return -EOPNOTSUPP; |
| 143 | 143 | ||
| 144 | switch (attr->id) { | 144 | switch (attr->id) { |
| 145 | case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: | 145 | case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: |
| 146 | mlx5_query_nic_vport_mac_address(priv->mdev, 0, mac); | ||
| 147 | attr->u.ppid.id_len = ETH_ALEN; | 146 | attr->u.ppid.id_len = ETH_ALEN; |
| 148 | memcpy(&attr->u.ppid.id, &mac, ETH_ALEN); | 147 | ether_addr_copy(attr->u.ppid.id, rep->hw_id); |
| 149 | break; | 148 | break; |
| 150 | default: | 149 | default: |
| 151 | return -EOPNOTSUPP; | 150 | return -EOPNOTSUPP; |
| @@ -324,9 +324,9 @@ mlx5e_copy_skb_header_fragmented_mpwqe(struct device *pdev, · 323 unmodified lines | |||
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | static u16 mlx5e_get_wqe_mtt_offset(u16 rq_ix, u16 wqe_ix) | 327 | static u32 mlx5e_get_wqe_mtt_offset(struct mlx5e_rq *rq, u16 wqe_ix) |
| 328 | { | 328 | { |
| 329 | return rq_ix * MLX5_CHANNEL_MAX_NUM_MTTS + | 329 | return rq->mpwqe_mtt_offset + |
| 330 | wqe_ix * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8); | 330 | wqe_ix * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| @@ -340,7 +340,7 @@ static void mlx5e_build_umr_wqe(struct mlx5e_rq *rq, · 7 unmodified lines | |||
| 340 | struct mlx5_wqe_data_seg *dseg = &wqe->data; | 340 | struct mlx5_wqe_data_seg *dseg = &wqe->data; |
| 341 | struct mlx5e_mpw_info *wi = &rq->wqe_info[ix]; | 341 | struct mlx5e_mpw_info *wi = &rq->wqe_info[ix]; |
| 342 | u8 ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS); | 342 | u8 ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS); |
| 343 | u16 umr_wqe_mtt_offset = mlx5e_get_wqe_mtt_offset(rq->ix, ix); | 343 | u32 umr_wqe_mtt_offset = mlx5e_get_wqe_mtt_offset(rq, ix); |
| 344 | 344 | ||
| 345 | memset(wqe, 0, sizeof(*wqe)); | 345 | memset(wqe, 0, sizeof(*wqe)); |
| 346 | cseg->opmod_idx_opcode = | 346 | cseg->opmod_idx_opcode = |
| @@ -353,9 +353,9 @@ static void mlx5e_build_umr_wqe(struct mlx5e_rq *rq, · 6 unmodified lines | |||
| 353 | 353 | ||
| 354 | ucseg->flags = MLX5_UMR_TRANSLATION_OFFSET_EN; | 354 | ucseg->flags = MLX5_UMR_TRANSLATION_OFFSET_EN; |
| 355 | ucseg->klm_octowords = | 355 | ucseg->klm_octowords = |
| 356 | cpu_to_be16(mlx5e_get_mtt_octw(MLX5_MPWRQ_PAGES_PER_WQE)); | 356 | cpu_to_be16(MLX5_MTT_OCTW(MLX5_MPWRQ_PAGES_PER_WQE)); |
| 357 | ucseg->bsf_octowords = | 357 | ucseg->bsf_octowords = |
| 358 | cpu_to_be16(mlx5e_get_mtt_octw(umr_wqe_mtt_offset)); | 358 | cpu_to_be16(MLX5_MTT_OCTW(umr_wqe_mtt_offset)); |
| 359 | ucseg->mkey_mask = cpu_to_be64(MLX5_MKEY_MASK_FREE); | 359 | ucseg->mkey_mask = cpu_to_be64(MLX5_MKEY_MASK_FREE); |
| 360 | 360 | ||
| 361 | dseg->lkey = sq->mkey_be; | 361 | dseg->lkey = sq->mkey_be; |
| @@ -423,7 +423,7 @@ static int mlx5e_alloc_rx_fragmented_mpwqe(struct mlx5e_rq *rq, · 61 unmodified lines | |||
| 423 | { | 423 | { |
| 424 | struct mlx5e_mpw_info *wi = &rq->wqe_info[ix]; | 424 | struct mlx5e_mpw_info *wi = &rq->wqe_info[ix]; |
| 425 | int mtt_sz = mlx5e_get_wqe_mtt_sz(); | 425 | int mtt_sz = mlx5e_get_wqe_mtt_sz(); |
| 426 | u32 dma_offset = mlx5e_get_wqe_mtt_offset(rq->ix, ix) << PAGE_SHIFT; | 426 | u64 dma_offset = (u64)mlx5e_get_wqe_mtt_offset(rq, ix) << PAGE_SHIFT; |
| 427 | int i; | 427 | int i; |
| 428 | 428 | ||
| 429 | wi->umr.dma_info = kmalloc(sizeof(*wi->umr.dma_info) * | 429 | wi->umr.dma_info = kmalloc(sizeof(*wi->umr.dma_info) * |
| @@ -506,6 +506,12 @@ void mlx5e_post_rx_fragmented_mpwqe(struct mlx5e_rq *rq) · 76 unmodified lines | |||
| 506 | struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(wq, wq->head); | 506 | struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(wq, wq->head); |
| 507 | 507 | ||
| 508 | clear_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state); | 508 | clear_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state); |
| 509 | |||
| 510 | if (unlikely(test_bit(MLX5E_RQ_STATE_FLUSH, &rq->state))) { | ||
| 511 | mlx5e_free_rx_fragmented_mpwqe(rq, &rq->wqe_info[wq->head]); | ||
| 512 | return; | ||
| 513 | } | ||
| 514 | |||
| 509 | mlx5_wq_ll_push(wq, be16_to_cpu(wqe->next.next_wqe_index)); | 515 | mlx5_wq_ll_push(wq, be16_to_cpu(wqe->next.next_wqe_index)); |
| 510 | rq->stats.mpwqe_frag++; | 516 | rq->stats.mpwqe_frag++; |
| 511 | 517 | ||
| @@ -595,26 +601,9 @@ void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) · 83 unmodified lines | |||
| 595 | wi->free_wqe(rq, wi); | 601 | wi->free_wqe(rq, wi); |
| 596 | } | 602 | } |
| 597 | 603 | ||
| 598 | void mlx5e_free_rx_descs(struct mlx5e_rq *rq) | ||
| 599 | { | ||
| 600 | struct mlx5_wq_ll *wq = &rq->wq; | ||
| 601 | struct mlx5e_rx_wqe *wqe; | ||
| 602 | __be16 wqe_ix_be; | ||
| 603 | u16 wqe_ix; | ||
| 604 | |||
| 605 | while (!mlx5_wq_ll_is_empty(wq)) { | ||
| 606 | wqe_ix_be = *wq->tail_next; | ||
| 607 | wqe_ix = be16_to_cpu(wqe_ix_be); | ||
| 608 | wqe = mlx5_wq_ll_get_wqe(&rq->wq, wqe_ix); | ||
| 609 | rq->dealloc_wqe(rq, wqe_ix); | ||
| 610 | mlx5_wq_ll_pop(&rq->wq, wqe_ix_be, | ||
| 611 | &wqe->next.next_wqe_index); | ||
| 612 | } | ||
| 613 | } | ||
| 614 | |||
| 615 | #define RQ_CANNOT_POST(rq) \ | 604 | #define RQ_CANNOT_POST(rq) \ |
| 616 | (!test_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state) || \ | 605 | (test_bit(MLX5E_RQ_STATE_FLUSH, &rq->state) || \ |
| 617 | test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state)) | 606 | test_bit(MLX5E_RQ_STATE_UMR_WQE_IN_PROGRESS, &rq->state)) |
| 618 | 607 | ||
| 619 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) | 608 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) |
| 620 | { | 609 | { |
| @@ -648,24 +637,32 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) · 27 unmodified lines | |||
| 648 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, | 637 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, |
| 649 | u32 cqe_bcnt) | 638 | u32 cqe_bcnt) |
| 650 | { | 639 | { |
| 651 | struct ethhdr *eth = (struct ethhdr *)(skb->data); | 640 | struct ethhdr *eth = (struct ethhdr *)(skb->data); |
| 652 | struct iphdr *ipv4 = (struct iphdr *)(skb->data + ETH_HLEN); | 641 | struct iphdr *ipv4; |
| 653 | struct ipv6hdr *ipv6 = (struct ipv6hdr *)(skb->data + ETH_HLEN); | 642 | struct ipv6hdr *ipv6; |
| 654 | struct tcphdr *tcp; | 643 | struct tcphdr *tcp; |
| 644 | int network_depth = 0; | ||
| 645 | __be16 proto; | ||
| 646 | u16 tot_len; | ||
| 655 | 647 | ||
| 656 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); | 648 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); |
| 657 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || | 649 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || |
| 658 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); | 650 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); |
| 659 | 651 | ||
| 660 | u16 tot_len = cqe_bcnt - ETH_HLEN; | 652 | skb->mac_len = ETH_HLEN; |
| 653 | proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth); | ||
| 654 | |||
| 655 | ipv4 = (struct iphdr *)(skb->data + network_depth); | ||
| 656 | ipv6 = (struct ipv6hdr *)(skb->data + network_depth); | ||
| 657 | tot_len = cqe_bcnt - network_depth; | ||
| 661 | 658 | ||
| 662 | if (eth->h_proto == htons(ETH_P_IP)) { | 659 | if (proto == htons(ETH_P_IP)) { |
| 663 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 660 | tcp = (struct tcphdr *)(skb->data + network_depth + |
| 664 | sizeof(struct iphdr)); | 661 | sizeof(struct iphdr)); |
| 665 | ipv6 = NULL; | 662 | ipv6 = NULL; |
| 666 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 663 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
| 667 | } else { | 664 | } else { |
| 668 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 665 | tcp = (struct tcphdr *)(skb->data + network_depth + |
| 669 | sizeof(struct ipv6hdr)); | 666 | sizeof(struct ipv6hdr)); |
| 670 | ipv4 = NULL; | 667 | ipv4 = NULL; |
| 671 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 668 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
| @@ -916,7 +913,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) · 244 unmodified lines | |||
| 916 | struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); | 913 | struct mlx5e_rq *rq = container_of(cq, struct mlx5e_rq, cq); |
| 917 | int work_done = 0; | 914 | int work_done = 0; |
| 918 | 915 | ||
| 919 | if (unlikely(test_bit(MLX5E_RQ_STATE_FLUSH_TIMEOUT, &rq->state))) | 916 | if (unlikely(test_bit(MLX5E_RQ_STATE_FLUSH, &rq->state))) |
| 920 | return 0; | 917 | return 0; |
| 921 | 918 | ||
| 922 | if (cq->decmprs_left) | 919 | if (cq->decmprs_left) |
| @@ -70,6 +70,7 @@ struct mlx5e_sw_stats { · 69 unmodified lines | |||
| 70 | u64 tx_queue_stopped; | 70 | u64 tx_queue_stopped; |
| 71 | u64 tx_queue_wake; | 71 | u64 tx_queue_wake; |
| 72 | u64 tx_queue_dropped; | 72 | u64 tx_queue_dropped; |
| 73 | u64 tx_xmit_more; | ||
| 73 | u64 rx_wqe_err; | 74 | u64 rx_wqe_err; |
| 74 | u64 rx_mpwqe_filler; | 75 | u64 rx_mpwqe_filler; |
| 75 | u64 rx_mpwqe_frag; | 76 | u64 rx_mpwqe_frag; |
| @@ -101,6 +102,7 @@ static const struct counter_desc sw_stats_desc[] = { · 25 unmodified lines | |||
| 101 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) }, | 102 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) }, |
| 102 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) }, | 103 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) }, |
| 103 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) }, | 104 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) }, |
| 105 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) }, | ||
| 104 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) }, | 106 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) }, |
| 105 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) }, | 107 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) }, |
| 106 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_frag) }, | 108 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_frag) }, |
| @@ -298,6 +300,7 @@ struct mlx5e_sq_stats { · 191 unmodified lines | |||
| 298 | /* commonly accessed in data path */ | 300 | /* commonly accessed in data path */ |
| 299 | u64 packets; | 301 | u64 packets; |
| 300 | u64 bytes; | 302 | u64 bytes; |
| 303 | u64 xmit_more; | ||
| 301 | u64 tso_packets; | 304 | u64 tso_packets; |
| 302 | u64 tso_bytes; | 305 | u64 tso_bytes; |
| 303 | u64 tso_inner_packets; | 306 | u64 tso_inner_packets; |
| @@ -324,6 +327,7 @@ static const struct counter_desc sq_stats_desc[] = { · 20 unmodified lines | |||
| 324 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) }, | 327 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) }, |
| 325 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) }, | 328 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) }, |
| 326 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) }, | 329 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) }, |
| 330 | { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) }, | ||
| 327 | }; | 331 | }; |
| 328 | 332 | ||
| 329 | #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc) | 333 | #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc) |
| @@ -170,7 +170,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv, struct mlx5_flow_spec *spec · 169 unmodified lines | |||
| 170 | if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) { | 170 | if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) { |
| 171 | struct flow_dissector_key_control *key = | 171 | struct flow_dissector_key_control *key = |
| 172 | skb_flow_dissector_target(f->dissector, | 172 | skb_flow_dissector_target(f->dissector, |
| 173 | FLOW_DISSECTOR_KEY_BASIC, | 173 | FLOW_DISSECTOR_KEY_CONTROL, |
| 174 | f->key); | 174 | f->key); |
| 175 | addr_type = key->addr_type; | 175 | addr_type = key->addr_type; |
| 176 | } | 176 | } |
| @@ -356,6 +356,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 355 unmodified lines | |||
| 356 | sq->stats.stopped++; | 356 | sq->stats.stopped++; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | sq->stats.xmit_more += skb->xmit_more; | ||
| 359 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { | 360 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { |
| 360 | int bf_sz = 0; | 361 | int bf_sz = 0; |
| 361 | 362 | ||
| @@ -394,35 +395,6 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev) · 32 unmodified lines | |||
| 394 | return mlx5e_sq_xmit(sq, skb); | 395 | return mlx5e_sq_xmit(sq, skb); |
| 395 | } | 396 | } |
| 396 | 397 | ||
| 397 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq) | ||
| 398 | { | ||
| 399 | struct mlx5e_tx_wqe_info *wi; | ||
| 400 | struct sk_buff *skb; | ||
| 401 | u16 ci; | ||
| 402 | int i; | ||
| 403 | |||
| 404 | while (sq->cc != sq->pc) { | ||
| 405 | ci = sq->cc & sq->wq.sz_m1; | ||
| 406 | skb = sq->skb[ci]; | ||
| 407 | wi = &sq->wqe_info[ci]; | ||
| 408 | |||
| 409 | if (!skb) { /* nop */ | ||
| 410 | sq->cc++; | ||
| 411 | continue; | ||
| 412 | } | ||
| 413 | |||
| 414 | for (i = 0; i < wi->num_dma; i++) { | ||
| 415 | struct mlx5e_sq_dma *dma = | ||
| 416 | mlx5e_dma_get(sq, sq->dma_fifo_cc++); | ||
| 417 | |||
| 418 | mlx5e_tx_dma_unmap(sq->pdev, dma); | ||
| 419 | } | ||
| 420 | |||
| 421 | dev_kfree_skb_any(skb); | ||
| 422 | sq->cc += wi->num_wqebbs; | ||
| 423 | } | ||
| 424 | } | ||
| 425 | |||
| 426 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) | 398 | bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) |
| 427 | { | 399 | { |
| 428 | struct mlx5e_sq *sq; | 400 | struct mlx5e_sq *sq; |
| @@ -434,7 +406,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) · 5 unmodified lines | |||
| 434 | 406 | ||
| 435 | sq = container_of(cq, struct mlx5e_sq, cq); | 407 | sq = container_of(cq, struct mlx5e_sq, cq); |
| 436 | 408 | ||
| 437 | if (unlikely(test_bit(MLX5E_SQ_STATE_TX_TIMEOUT, &sq->state))) | 409 | if (unlikely(test_bit(MLX5E_SQ_STATE_FLUSH, &sq->state))) |
| 438 | return false; | 410 | return false; |
| 439 | 411 | ||
| 440 | npkts = 0; | 412 | npkts = 0; |
| @@ -512,11 +484,39 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) · 71 unmodified lines | |||
| 512 | netdev_tx_completed_queue(sq->txq, npkts, nbytes); | 484 | netdev_tx_completed_queue(sq->txq, npkts, nbytes); |
| 513 | 485 | ||
| 514 | if (netif_tx_queue_stopped(sq->txq) && | 486 | if (netif_tx_queue_stopped(sq->txq) && |
| 515 | mlx5e_sq_has_room_for(sq, MLX5E_SQ_STOP_ROOM) && | 487 | mlx5e_sq_has_room_for(sq, MLX5E_SQ_STOP_ROOM)) { |
| 516 | likely(test_bit(MLX5E_SQ_STATE_WAKE_TXQ_ENABLE, &sq->state))) { | 488 | netif_tx_wake_queue(sq->txq); |
| 517 | netif_tx_wake_queue(sq->txq); | 489 | sq->stats.wake++; |
| 518 | sq->stats.wake++; | ||
| 519 | } | 490 | } |
| 520 | 491 | ||
| 521 | return (i == MLX5E_TX_CQ_POLL_BUDGET); | 492 | return (i == MLX5E_TX_CQ_POLL_BUDGET); |
| 522 | } | 493 | } |
| 494 | |||
| 495 | void mlx5e_free_tx_descs(struct mlx5e_sq *sq) | ||
| 496 | { | ||
| 497 | struct mlx5e_tx_wqe_info *wi; | ||
| 498 | struct sk_buff *skb; | ||
| 499 | u16 ci; | ||
| 500 | int i; | ||
| 501 | |||
| 502 | while (sq->cc != sq->pc) { | ||
| 503 | ci = sq->cc & sq->wq.sz_m1; | ||
| 504 | skb = sq->skb[ci]; | ||
| 505 | wi = &sq->wqe_info[ci]; | ||
| 506 | |||
| 507 | if (!skb) { /* nop */ | ||
| 508 | sq->cc++; | ||
| 509 | continue; | ||
| 510 | } | ||
| 511 | |||
| 512 | for (i = 0; i < wi->num_dma; i++) { | ||
| 513 | struct mlx5e_sq_dma *dma = | ||
| 514 | mlx5e_dma_get(sq, sq->dma_fifo_cc++); | ||
| 515 | |||
| 516 | mlx5e_tx_dma_unmap(sq->pdev, dma); | ||
| 517 | } | ||
| 518 | |||
| 519 | dev_kfree_skb_any(skb); | ||
| 520 | sq->cc += wi->num_wqebbs; | ||
| 521 | } | ||
| 522 | } | ||
| @@ -51,16 +51,18 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq) · 50 unmodified lines | |||
| 51 | 51 | ||
| 52 | static void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) | 52 | static void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
| 53 | { | 53 | { |
| 54 | struct mlx5e_sq *sq = container_of(cq, struct mlx5e_sq, cq); | ||
| 54 | struct mlx5_wq_cyc *wq; | 55 | struct mlx5_wq_cyc *wq; |
| 55 | struct mlx5_cqe64 *cqe; | 56 | struct mlx5_cqe64 *cqe; |
| 56 | struct mlx5e_sq *sq; | ||
| 57 | u16 sqcc; | 57 | u16 sqcc; |
| 58 | 58 | ||
| 59 | if (unlikely(test_bit(MLX5E_SQ_STATE_FLUSH, &sq->state))) | ||
| 60 | return; | ||
| 61 | |||
| 59 | cqe = mlx5e_get_cqe(cq); | 62 | cqe = mlx5e_get_cqe(cq); |
| 60 | if (likely(!cqe)) | 63 | if (likely(!cqe)) |
| 61 | return; | 64 | return; |
| 62 | 65 | ||
| 63 | sq = container_of(cq, struct mlx5e_sq, cq); | ||
| 64 | wq = &sq->wq; | 66 | wq = &sq->wq; |
| 65 | 67 | ||
| 66 | /* sq->cc must be updated only after mlx5_cqwq_update_db_record(), | 68 | /* sq->cc must be updated only after mlx5_cqwq_update_db_record(), |
| @@ -1451,7 +1451,8 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num, · 1450 unmodified lines | |||
| 1451 | 1451 | ||
| 1452 | esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num); | 1452 | esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num); |
| 1453 | 1453 | ||
| 1454 | if (vport_num) { /* Only VFs need ACLs for VST and spoofchk filtering */ | 1454 | /* Only VFs need ACLs for VST and spoofchk filtering */ |
| 1455 | if (vport_num && esw->mode == SRIOV_LEGACY) { | ||
| 1455 | esw_vport_ingress_config(esw, vport); | 1456 | esw_vport_ingress_config(esw, vport); |
| 1456 | esw_vport_egress_config(esw, vport); | 1457 | esw_vport_egress_config(esw, vport); |
| 1457 | } | 1458 | } |
| @@ -1502,7 +1503,7 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, int vport_num) · 44 unmodified lines | |||
| 1502 | */ | 1503 | */ |
| 1503 | esw_vport_change_handle_locked(vport); | 1504 | esw_vport_change_handle_locked(vport); |
| 1504 | vport->enabled_events = 0; | 1505 | vport->enabled_events = 0; |
| 1505 | if (vport_num) { | 1506 | if (vport_num && esw->mode == SRIOV_LEGACY) { |
| 1506 | esw_vport_disable_egress_acl(esw, vport); | 1507 | esw_vport_disable_egress_acl(esw, vport); |
| 1507 | esw_vport_disable_ingress_acl(esw, vport); | 1508 | esw_vport_disable_ingress_acl(esw, vport); |
| 1508 | } | 1509 | } |
| @@ -1553,6 +1554,7 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) · 44 unmodified lines | |||
| 1553 | 1554 | ||
| 1554 | abort: | 1555 | abort: |
| 1555 | esw_enable_vport(esw, 0, UC_ADDR_CHANGE); | 1556 | esw_enable_vport(esw, 0, UC_ADDR_CHANGE); |
| 1557 | esw->mode = SRIOV_NONE; | ||
| 1556 | return err; | 1558 | return err; |
| 1557 | } | 1559 | } |
| 1558 | 1560 | ||
| @@ -1767,7 +1769,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, · 208 unmodified lines | |||
| 1767 | vport, err); | 1769 | vport, err); |
| 1768 | 1770 | ||
| 1769 | mutex_lock(&esw->state_lock); | 1771 | mutex_lock(&esw->state_lock); |
| 1770 | if (evport->enabled) | 1772 | if (evport->enabled && esw->mode == SRIOV_LEGACY) |
| 1771 | err = esw_vport_ingress_config(esw, evport); | 1773 | err = esw_vport_ingress_config(esw, evport); |
| 1772 | mutex_unlock(&esw->state_lock); | 1774 | mutex_unlock(&esw->state_lock); |
| 1773 | return err; | 1775 | return err; |
| @@ -1839,7 +1841,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, · 65 unmodified lines | |||
| 1839 | mutex_lock(&esw->state_lock); | 1841 | mutex_lock(&esw->state_lock); |
| 1840 | evport->vlan = vlan; | 1842 | evport->vlan = vlan; |
| 1841 | evport->qos = qos; | 1843 | evport->qos = qos; |
| 1842 | if (evport->enabled) { | 1844 | if (evport->enabled && esw->mode == SRIOV_LEGACY) { |
| 1843 | err = esw_vport_ingress_config(esw, evport); | 1845 | err = esw_vport_ingress_config(esw, evport); |
| 1844 | if (err) | 1846 | if (err) |
| 1845 | goto out; | 1847 | goto out; |
| @@ -1868,10 +1870,11 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, · 22 unmodified lines | |||
| 1868 | mutex_lock(&esw->state_lock); | 1870 | mutex_lock(&esw->state_lock); |
| 1869 | pschk = evport->spoofchk; | 1871 | pschk = evport->spoofchk; |
| 1870 | evport->spoofchk = spoofchk; | 1872 | evport->spoofchk = spoofchk; |
| 1871 | if (evport->enabled) | 1873 | if (evport->enabled && esw->mode == SRIOV_LEGACY) { |
| 1872 | err = esw_vport_ingress_config(esw, evport); | 1874 | err = esw_vport_ingress_config(esw, evport); |
| 1873 | if (err) | 1875 | if (err) |
| 1874 | evport->spoofchk = pschk; | 1876 | evport->spoofchk = pschk; |
| 1877 | } | ||
| 1875 | mutex_unlock(&esw->state_lock); | 1878 | mutex_unlock(&esw->state_lock); |
| 1876 | 1879 | ||
| 1877 | return err; | 1880 | return err; |
| @@ -174,6 +174,7 @@ struct mlx5_eswitch_rep { · 173 unmodified lines | |||
| 174 | void *priv_data; | 174 | void *priv_data; |
| 175 | struct list_head vport_sqs_list; | 175 | struct list_head vport_sqs_list; |
| 176 | bool valid; | 176 | bool valid; |
| 177 | u8 hw_id[ETH_ALEN]; | ||
| 177 | }; | 178 | }; |
| 178 | 179 | ||
| 179 | struct mlx5_esw_offload { | 180 | struct mlx5_esw_offload { |
| @@ -113,7 +113,7 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn · 112 unmodified lines | |||
| 113 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 113 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
| 114 | dest.vport_num = vport; | 114 | dest.vport_num = vport; |
| 115 | 115 | ||
| 116 | flow_rule = mlx5_add_flow_rule(esw->fdb_table.fdb, spec, | 116 | flow_rule = mlx5_add_flow_rule(esw->fdb_table.offloads.fdb, spec, |
| 117 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, | 117 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, |
| 118 | 0, &dest); | 118 | 0, &dest); |
| 119 | if (IS_ERR(flow_rule)) | 119 | if (IS_ERR(flow_rule)) |
| @@ -446,7 +446,7 @@ out: · 326 unmodified lines | |||
| 446 | 446 | ||
| 447 | static int esw_offloads_start(struct mlx5_eswitch *esw) | 447 | static int esw_offloads_start(struct mlx5_eswitch *esw) |
| 448 | { | 448 | { |
| 449 | int err, num_vfs = esw->dev->priv.sriov.num_vfs; | 449 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; |
| 450 | 450 | ||
| 451 | if (esw->mode != SRIOV_LEGACY) { | 451 | if (esw->mode != SRIOV_LEGACY) { |
| 452 | esw_warn(esw->dev, "Can't set offloads mode, SRIOV legacy not enabled\n"); | 452 | esw_warn(esw->dev, "Can't set offloads mode, SRIOV legacy not enabled\n"); |
| @@ -455,8 +455,12 @@ static int esw_offloads_start(struct mlx5_eswitch *esw) · 2 unmodified lines | |||
| 455 | 455 | ||
| 456 | mlx5_eswitch_disable_sriov(esw); | 456 | mlx5_eswitch_disable_sriov(esw); |
| 457 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); | 457 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); |
| 458 | if (err) | 458 | if (err) { |
| 459 | esw_warn(esw->dev, "Failed set eswitch to offloads, err %d\n", err); | 459 | esw_warn(esw->dev, "Failed setting eswitch to offloads, err %d\n", err); |
| 460 | err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); | ||
| 461 | if (err1) | ||
| 462 | esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err); | ||
| 463 | } | ||
| 460 | return err; | 464 | return err; |
| 461 | } | 465 | } |
| 462 | 466 | ||
| @@ -508,12 +512,16 @@ create_ft_err: · 45 unmodified lines | |||
| 508 | 512 | ||
| 509 | static int esw_offloads_stop(struct mlx5_eswitch *esw) | 513 | static int esw_offloads_stop(struct mlx5_eswitch *esw) |
| 510 | { | 514 | { |
| 511 | int err, num_vfs = esw->dev->priv.sriov.num_vfs; | 515 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; |
| 512 | 516 | ||
| 513 | mlx5_eswitch_disable_sriov(esw); | 517 | mlx5_eswitch_disable_sriov(esw); |
| 514 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); | 518 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); |
| 515 | if (err) | 519 | if (err) { |
| 516 | esw_warn(esw->dev, "Failed set eswitch legacy mode. err %d\n", err); | 520 | esw_warn(esw->dev, "Failed setting eswitch to legacy, err %d\n", err); |
| 521 | err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); | ||
| 522 | if (err1) | ||
| 523 | esw_warn(esw->dev, "Failed setting eswitch back to offloads, err %d\n", err); | ||
| 524 | } | ||
| 517 | 525 | ||
| 518 | return err; | 526 | return err; |
| 519 | } | 527 | } |
| @@ -535,7 +543,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw, int nvports) · 15 unmodified lines | |||
| 535 | esw_destroy_offloads_fdb_table(esw); | 543 | esw_destroy_offloads_fdb_table(esw); |
| 536 | } | 544 | } |
| 537 | 545 | ||
| 538 | static int mlx5_esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) | 546 | static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) |
| 539 | { | 547 | { |
| 540 | switch (mode) { | 548 | switch (mode) { |
| 541 | case DEVLINK_ESWITCH_MODE_LEGACY: | 549 | case DEVLINK_ESWITCH_MODE_LEGACY: |
| @@ -551,6 +559,22 @@ static int mlx5_esw_mode_from_devlink(u16 mode, u16 *mlx5_mode) · 9 unmodified lines | |||
| 551 | return 0; | 559 | return 0; |
| 552 | } | 560 | } |
| 553 | 561 | ||
| 562 | static int esw_mode_to_devlink(u16 mlx5_mode, u16 *mode) | ||
| 563 | { | ||
| 564 | switch (mlx5_mode) { | ||
| 565 | case SRIOV_LEGACY: | ||
| 566 | *mode = DEVLINK_ESWITCH_MODE_LEGACY; | ||
| 567 | break; | ||
| 568 | case SRIOV_OFFLOADS: | ||
| 569 | *mode = DEVLINK_ESWITCH_MODE_SWITCHDEV; | ||
| 570 | break; | ||
| 571 | default: | ||
| 572 | return -EINVAL; | ||
| 573 | } | ||
| 574 | |||
| 575 | return 0; | ||
| 576 | } | ||
| 577 | |||
| 554 | int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) | 578 | int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) |
| 555 | { | 579 | { |
| 556 | struct mlx5_core_dev *dev; | 580 | struct mlx5_core_dev *dev; |
| @@ -566,7 +590,7 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode) · 9 unmodified lines | |||
| 566 | if (cur_mlx5_mode == SRIOV_NONE) | 590 | if (cur_mlx5_mode == SRIOV_NONE) |
| 567 | return -EOPNOTSUPP; | 591 | return -EOPNOTSUPP; |
| 568 | 592 | ||
| 569 | if (mlx5_esw_mode_from_devlink(mode, &mlx5_mode)) | 593 | if (esw_mode_from_devlink(mode, &mlx5_mode)) |
| 570 | return -EINVAL; | 594 | return -EINVAL; |
| 571 | 595 | ||
| 572 | if (cur_mlx5_mode == mlx5_mode) | 596 | if (cur_mlx5_mode == mlx5_mode) |
| @@ -592,9 +616,7 @@ int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode) · 19 unmodified lines | |||
| 592 | if (dev->priv.eswitch->mode == SRIOV_NONE) | 616 | if (dev->priv.eswitch->mode == SRIOV_NONE) |
| 593 | return -EOPNOTSUPP; | 617 | return -EOPNOTSUPP; |
| 594 | 618 | ||
| 595 | *mode = dev->priv.eswitch->mode; | 619 | return esw_mode_to_devlink(dev->priv.eswitch->mode, mode); |
| 596 | |||
| 597 | return 0; | ||
| 598 | } | 620 | } |
| 599 | 621 | ||
| 600 | void mlx5_eswitch_register_vport_rep(struct mlx5_eswitch *esw, | 622 | void mlx5_eswitch_register_vport_rep(struct mlx5_eswitch *esw, |
| @@ -425,11 +425,11 @@ struct mlx5_cmd_fc_bulk * · 424 unmodified lines | |||
| 425 | mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u16 id, int num) | 425 | mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u16 id, int num) |
| 426 | { | 426 | { |
| 427 | struct mlx5_cmd_fc_bulk *b; | 427 | struct mlx5_cmd_fc_bulk *b; |
| 428 | int outlen = sizeof(*b) + | 428 | int outlen = |
| 429 | MLX5_ST_SZ_BYTES(query_flow_counter_out) + | 429 | MLX5_ST_SZ_BYTES(query_flow_counter_out) + |
| 430 | MLX5_ST_SZ_BYTES(traffic_counter) * num; | 430 | MLX5_ST_SZ_BYTES(traffic_counter) * num; |
| 431 | 431 | ||
| 432 | b = kzalloc(outlen, GFP_KERNEL); | 432 | b = kzalloc(sizeof(*b) + outlen, GFP_KERNEL); |
| 433 | if (!b) | 433 | if (!b) |
| 434 | return NULL; | 434 | return NULL; |
| 435 | 435 | ||
| @@ -80,7 +80,7 @@ · 79 unmodified lines | |||
| 80 | LEFTOVERS_NUM_PRIOS) | 80 | LEFTOVERS_NUM_PRIOS) |
| 81 | 81 | ||
| 82 | #define ETHTOOL_PRIO_NUM_LEVELS 1 | 82 | #define ETHTOOL_PRIO_NUM_LEVELS 1 |
| 83 | #define ETHTOOL_NUM_PRIOS 10 | 83 | #define ETHTOOL_NUM_PRIOS 11 |
| 84 | #define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) | 84 | #define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) |
| 85 | /* Vlan, mac, ttc, aRFS */ | 85 | /* Vlan, mac, ttc, aRFS */ |
| 86 | #define KERNEL_NIC_PRIO_NUM_LEVELS 4 | 86 | #define KERNEL_NIC_PRIO_NUM_LEVELS 4 |
| @@ -126,12 +126,21 @@ static struct rb_node *mlx5_fc_stats_query(struct mlx5_core_dev *dev, · 125 unmodified lines | |||
| 126 | for (node = &first->node; node; node = rb_next(node)) { | 126 | for (node = &first->node; node; node = rb_next(node)) { |
| 127 | struct mlx5_fc *counter = rb_entry(node, struct mlx5_fc, node); | 127 | struct mlx5_fc *counter = rb_entry(node, struct mlx5_fc, node); |
| 128 | struct mlx5_fc_cache *c = &counter->cache; | 128 | struct mlx5_fc_cache *c = &counter->cache; |
| 129 | u64 packets; | ||
| 130 | u64 bytes; | ||
| 129 | 131 | ||
| 130 | if (counter->id > last_id) | 132 | if (counter->id > last_id) |
| 131 | break; | 133 | break; |
| 132 | 134 | ||
| 133 | mlx5_cmd_fc_bulk_get(dev, b, | 135 | mlx5_cmd_fc_bulk_get(dev, b, |
| 134 | counter->id, &c->packets, &c->bytes); | 136 | counter->id, &packets, &bytes); |
| 137 | |||
| 138 | if (c->packets == packets) | ||
| 139 | continue; | ||
| 140 | |||
| 141 | c->packets = packets; | ||
| 142 | c->bytes = bytes; | ||
| 143 | c->lastuse = jiffies; | ||
| 135 | } | 144 | } |
| 136 | 145 | ||
| 137 | out: | 146 | out: |
| @@ -1420,36 +1420,12 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, · 1419 unmodified lines | |||
| 1420 | dev_info(&pdev->dev, "%s was called\n", __func__); | 1420 | dev_info(&pdev->dev, "%s was called\n", __func__); |
| 1421 | mlx5_enter_error_state(dev); | 1421 | mlx5_enter_error_state(dev); |
| 1422 | mlx5_unload_one(dev, priv); | 1422 | mlx5_unload_one(dev, priv); |
| 1423 | pci_save_state(pdev); | ||
| 1423 | mlx5_pci_disable_device(dev); | 1424 | mlx5_pci_disable_device(dev); |
| 1424 | return state == pci_channel_io_perm_failure ? | 1425 | return state == pci_channel_io_perm_failure ? |
| 1425 | PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; | 1426 | PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; |
| 1426 | } | 1427 | } |
| 1427 | 1428 | ||
| 1428 | static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) | ||
| 1429 | { | ||
| 1430 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | ||
| 1431 | int err = 0; | ||
| 1432 | |||
| 1433 | dev_info(&pdev->dev, "%s was called\n", __func__); | ||
| 1434 | |||
| 1435 | err = mlx5_pci_enable_device(dev); | ||
| 1436 | if (err) { | ||
| 1437 | dev_err(&pdev->dev, "%s: mlx5_pci_enable_device failed with error code: %d\n" | ||
| 1438 | , __func__, err); | ||
| 1439 | return PCI_ERS_RESULT_DISCONNECT; | ||
| 1440 | } | ||
| 1441 | pci_set_master(pdev); | ||
| 1442 | pci_set_power_state(pdev, PCI_D0); | ||
| 1443 | pci_restore_state(pdev); | ||
| 1444 | |||
| 1445 | return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; | ||
| 1446 | } | ||
| 1447 | |||
| 1448 | void mlx5_disable_device(struct mlx5_core_dev *dev) | ||
| 1449 | { | ||
| 1450 | mlx5_pci_err_detected(dev->pdev, 0); | ||
| 1451 | } | ||
| 1452 | |||
| 1453 | /* wait for the device to show vital signs by waiting | 1429 | /* wait for the device to show vital signs by waiting |
| 1454 | * for the health counter to start counting. | 1430 | * for the health counter to start counting. |
| 1455 | */ | 1431 | */ |
| @@ -1477,21 +1453,44 @@ static int wait_vital(struct pci_dev *pdev) · 21 unmodified lines | |||
| 1477 | return -ETIMEDOUT; | 1453 | return -ETIMEDOUT; |
| 1478 | } | 1454 | } |
| 1479 | 1455 | ||
| 1480 | static void mlx5_pci_resume(struct pci_dev *pdev) | 1456 | static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) |
| 1481 | { | 1457 | { |
| 1482 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | 1458 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
| 1483 | struct mlx5_priv *priv = &dev->priv; | ||
| 1484 | int err; | 1459 | int err; |
| 1485 | 1460 | ||
| 1486 | dev_info(&pdev->dev, "%s was called\n", __func__); | 1461 | dev_info(&pdev->dev, "%s was called\n", __func__); |
| 1487 | 1462 | ||
| 1488 | pci_save_state(pdev); | 1463 | err = mlx5_pci_enable_device(dev); |
| 1489 | err = wait_vital(pdev); | ||
| 1490 | if (err) { | 1464 | if (err) { |
| 1465 | dev_err(&pdev->dev, "%s: mlx5_pci_enable_device failed with error code: %d\n" | ||
| 1466 | , __func__, err); | ||
| 1467 | return PCI_ERS_RESULT_DISCONNECT; | ||
| 1468 | } | ||
| 1469 | |||
| 1470 | pci_set_master(pdev); | ||
| 1471 | pci_restore_state(pdev); | ||
| 1472 | |||
| 1473 | if (wait_vital(pdev)) { | ||
| 1491 | dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); | 1474 | dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); |
| 1492 | return; | 1475 | return PCI_ERS_RESULT_DISCONNECT; |
| 1493 | } | 1476 | } |
| 1494 | 1477 | ||
| 1478 | return PCI_ERS_RESULT_RECOVERED; | ||
| 1479 | } | ||
| 1480 | |||
| 1481 | void mlx5_disable_device(struct mlx5_core_dev *dev) | ||
| 1482 | { | ||
| 1483 | mlx5_pci_err_detected(dev->pdev, 0); | ||
| 1484 | } | ||
| 1485 | |||
| 1486 | static void mlx5_pci_resume(struct pci_dev *pdev) | ||
| 1487 | { | ||
| 1488 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | ||
| 1489 | struct mlx5_priv *priv = &dev->priv; | ||
| 1490 | int err; | ||
| 1491 | |||
| 1492 | dev_info(&pdev->dev, "%s was called\n", __func__); | ||
| 1493 | |||
| 1495 | err = mlx5_load_one(dev, priv); | 1494 | err = mlx5_load_one(dev, priv); |
| 1496 | if (err) | 1495 | if (err) |
| 1497 | dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" | 1496 | dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" |
| @@ -56,6 +56,7 @@ · 55 unmodified lines | |||
| 56 | #define MLXSW_PORT_PHY_BITS_MASK (MLXSW_PORT_MAX_PHY_PORTS - 1) | 56 | #define MLXSW_PORT_PHY_BITS_MASK (MLXSW_PORT_MAX_PHY_PORTS - 1) |
| 57 | 57 | ||
| 58 | #define MLXSW_PORT_CPU_PORT 0x0 | 58 | #define MLXSW_PORT_CPU_PORT 0x0 |
| 59 | #define MLXSW_PORT_ROUTER_PORT (MLXSW_PORT_MAX_PHY_PORTS + 2) | ||
| 59 | 60 | ||
| 60 | #define MLXSW_PORT_DONT_CARE (MLXSW_PORT_MAX_PORTS) | 61 | #define MLXSW_PORT_DONT_CARE (MLXSW_PORT_MAX_PORTS) |
| 61 | 62 | ||
| @@ -56,6 +56,7 @@ · 55 unmodified lines | |||
| 56 | #include <generated/utsrelease.h> | 56 | #include <generated/utsrelease.h> |
| 57 | #include <net/pkt_cls.h> | 57 | #include <net/pkt_cls.h> |
| 58 | #include <net/tc_act/tc_mirred.h> | 58 | #include <net/tc_act/tc_mirred.h> |
| 59 | #include <net/netevent.h> | ||
| 59 | 60 | ||
| 60 | #include "spectrum.h" | 61 | #include "spectrum.h" |
| 61 | #include "core.h" | 62 | #include "core.h" |
| @@ -2105,6 +2106,13 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 2043 unmodified lines | |||
| 2105 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; | 2106 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; |
| 2106 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; | 2107 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; |
| 2107 | 2108 | ||
| 2109 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
| 2110 | if (err) { | ||
| 2111 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
| 2112 | mlxsw_sp_port->local_port); | ||
| 2113 | goto err_port_swid_set; | ||
| 2114 | } | ||
| 2115 | |||
| 2108 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); | 2116 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); |
| 2109 | if (err) { | 2117 | if (err) { |
| 2110 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", | 2118 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", |
| @@ -2130,13 +2138,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 19 unmodified lines | |||
| 2130 | goto err_port_system_port_mapping_set; | 2138 | goto err_port_system_port_mapping_set; |
| 2131 | } | 2139 | } |
| 2132 | 2140 | ||
| 2133 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
| 2134 | if (err) { | ||
| 2135 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
| 2136 | mlxsw_sp_port->local_port); | ||
| 2137 | goto err_port_swid_set; | ||
| 2138 | } | ||
| 2139 | |||
| 2140 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); | 2141 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); |
| 2141 | if (err) { | 2142 | if (err) { |
| 2142 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", | 2143 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", |
| @@ -2218,10 +2219,10 @@ err_port_buffers_init: · 75 unmodified lines | |||
| 2218 | err_port_admin_status_set: | 2219 | err_port_admin_status_set: |
| 2219 | err_port_mtu_set: | 2220 | err_port_mtu_set: |
| 2220 | err_port_speed_by_width_set: | 2221 | err_port_speed_by_width_set: |
| 2221 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
| 2222 | err_port_swid_set: | ||
| 2223 | err_port_system_port_mapping_set: | 2222 | err_port_system_port_mapping_set: |
| 2224 | err_dev_addr_init: | 2223 | err_dev_addr_init: |
| 2224 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
| 2225 | err_port_swid_set: | ||
| 2225 | free_percpu(mlxsw_sp_port->pcpu_stats); | 2226 | free_percpu(mlxsw_sp_port->pcpu_stats); |
| 2226 | err_alloc_stats: | 2227 | err_alloc_stats: |
| 2227 | kfree(mlxsw_sp_port->untagged_vlans); | 2228 | kfree(mlxsw_sp_port->untagged_vlans); |
| @@ -3324,6 +3325,39 @@ static struct mlxsw_sp_fid *mlxsw_sp_bridge_fid_get(struct mlxsw_sp *mlxsw_sp, · 1096 unmodified lines | |||
| 3324 | return mlxsw_sp_fid_find(mlxsw_sp, fid); | 3325 | return mlxsw_sp_fid_find(mlxsw_sp, fid); |
| 3325 | } | 3326 | } |
| 3326 | 3327 | ||
| 3328 | static enum mlxsw_flood_table_type mlxsw_sp_flood_table_type_get(u16 fid) | ||
| 3329 | { | ||
| 3330 | return mlxsw_sp_fid_is_vfid(fid) ? MLXSW_REG_SFGC_TABLE_TYPE_FID : | ||
| 3331 | MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFEST; | ||
| 3332 | } | ||
| 3333 | |||
| 3334 | static u16 mlxsw_sp_flood_table_index_get(u16 fid) | ||
| 3335 | { | ||
| 3336 | return mlxsw_sp_fid_is_vfid(fid) ? mlxsw_sp_fid_to_vfid(fid) : fid; | ||
| 3337 | } | ||
| 3338 | |||
| 3339 | static int mlxsw_sp_router_port_flood_set(struct mlxsw_sp *mlxsw_sp, u16 fid, | ||
| 3340 | bool set) | ||
| 3341 | { | ||
| 3342 | enum mlxsw_flood_table_type table_type; | ||
| 3343 | char *sftr_pl; | ||
| 3344 | u16 index; | ||
| 3345 | int err; | ||
| 3346 | |||
| 3347 | sftr_pl = kmalloc(MLXSW_REG_SFTR_LEN, GFP_KERNEL); | ||
| 3348 | if (!sftr_pl) | ||
| 3349 | return -ENOMEM; | ||
| 3350 | |||
| 3351 | table_type = mlxsw_sp_flood_table_type_get(fid); | ||
| 3352 | index = mlxsw_sp_flood_table_index_get(fid); | ||
| 3353 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, index, table_type, | ||
| 3354 | 1, MLXSW_PORT_ROUTER_PORT, set); | ||
| 3355 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | ||
| 3356 | |||
| 3357 | kfree(sftr_pl); | ||
| 3358 | return err; | ||
| 3359 | } | ||
| 3360 | |||
| 3327 | static enum mlxsw_reg_ritr_if_type mlxsw_sp_rif_type_get(u16 fid) | 3361 | static enum mlxsw_reg_ritr_if_type mlxsw_sp_rif_type_get(u16 fid) |
| 3328 | { | 3362 | { |
| 3329 | if (mlxsw_sp_fid_is_vfid(fid)) | 3363 | if (mlxsw_sp_fid_is_vfid(fid)) |
| @@ -3360,10 +3394,14 @@ static int mlxsw_sp_rif_bridge_create(struct mlxsw_sp *mlxsw_sp, · 30 unmodified lines | |||
| 3360 | if (rif == MLXSW_SP_RIF_MAX) | 3394 | if (rif == MLXSW_SP_RIF_MAX) |
| 3361 | return -ERANGE; | 3395 | return -ERANGE; |
| 3362 | 3396 | ||
| 3363 | err = mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, true); | 3397 | err = mlxsw_sp_router_port_flood_set(mlxsw_sp, f->fid, true); |
| 3364 | if (err) | 3398 | if (err) |
| 3365 | return err; | 3399 | return err; |
| 3366 | 3400 | ||
| 3401 | err = mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, true); | ||
| 3402 | if (err) | ||
| 3403 | goto err_rif_bridge_op; | ||
| 3404 | |||
| 3367 | err = mlxsw_sp_rif_fdb_op(mlxsw_sp, l3_dev->dev_addr, f->fid, true); | 3405 | err = mlxsw_sp_rif_fdb_op(mlxsw_sp, l3_dev->dev_addr, f->fid, true); |
| 3368 | if (err) | 3406 | if (err) |
| 3369 | goto err_rif_fdb_op; | 3407 | goto err_rif_fdb_op; |
| @@ -3385,6 +3423,8 @@ err_rif_alloc: · 15 unmodified lines | |||
| 3385 | mlxsw_sp_rif_fdb_op(mlxsw_sp, l3_dev->dev_addr, f->fid, false); | 3423 | mlxsw_sp_rif_fdb_op(mlxsw_sp, l3_dev->dev_addr, f->fid, false); |
| 3386 | err_rif_fdb_op: | 3424 | err_rif_fdb_op: |
| 3387 | mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, false); | 3425 | mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, false); |
| 3426 | err_rif_bridge_op: | ||
| 3427 | mlxsw_sp_router_port_flood_set(mlxsw_sp, f->fid, false); | ||
| 3388 | return err; | 3428 | return err; |
| 3389 | } | 3429 | } |
| 3390 | 3430 | ||
| @@ -3404,6 +3444,8 @@ void mlxsw_sp_rif_bridge_destroy(struct mlxsw_sp *mlxsw_sp, · 13 unmodified lines | |||
| 3404 | 3444 | ||
| 3405 | mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, false); | 3445 | mlxsw_sp_rif_bridge_op(mlxsw_sp, l3_dev, f->fid, rif, false); |
| 3406 | 3446 | ||
| 3447 | mlxsw_sp_router_port_flood_set(mlxsw_sp, f->fid, false); | ||
| 3448 | |||
| 3407 | netdev_dbg(l3_dev, "RIF=%d destroyed\n", rif); | 3449 | netdev_dbg(l3_dev, "RIF=%d destroyed\n", rif); |
| 3408 | } | 3450 | } |
| 3409 | 3451 | ||
| @@ -4500,18 +4542,26 @@ static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = { · 1090 unmodified lines | |||
| 4500 | .priority = 10, /* Must be called before FIB notifier block */ | 4542 | .priority = 10, /* Must be called before FIB notifier block */ |
| 4501 | }; | 4543 | }; |
| 4502 | 4544 | ||
| 4545 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
| 4546 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
| 4547 | }; | ||
| 4548 | |||
| 4503 | static int __init mlxsw_sp_module_init(void) | 4549 | static int __init mlxsw_sp_module_init(void) |
| 4504 | { | 4550 | { |
| 4505 | int err; | 4551 | int err; |
| 4506 | 4552 | ||
| 4507 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4553 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
| 4508 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4554 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
| 4555 | register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
| 4556 | |||
| 4509 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); | 4557 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); |
| 4510 | if (err) | 4558 | if (err) |
| 4511 | goto err_core_driver_register; | 4559 | goto err_core_driver_register; |
| 4512 | return 0; | 4560 | return 0; |
| 4513 | 4561 | ||
| 4514 | err_core_driver_register: | 4562 | err_core_driver_register: |
| 4563 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
| 4564 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | ||
| 4515 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4565 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
| 4516 | return err; | 4566 | return err; |
| 4517 | } | 4567 | } |
| @@ -4519,6 +4569,7 @@ err_core_driver_register: · 1 unmodified line | |||
| 4519 | static void __exit mlxsw_sp_module_exit(void) | 4569 | static void __exit mlxsw_sp_module_exit(void) |
| 4520 | { | 4570 | { |
| 4521 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); | 4571 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); |
| 4572 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
| 4522 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4573 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
| 4523 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4574 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
| 4524 | } | 4575 | } |
| @@ -587,6 +587,8 @@ int mlxsw_sp_router_neigh_construct(struct net_device *dev, · 586 unmodified lines | |||
| 587 | struct neighbour *n); | 587 | struct neighbour *n); |
| 588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, | 588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, |
| 589 | struct neighbour *n); | 589 | struct neighbour *n); |
| 590 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | ||
| 591 | unsigned long event, void *ptr); | ||
| 590 | 592 | ||
| 591 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); | 593 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); |
| 592 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); | 594 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); |
| @@ -717,22 +717,18 @@ int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port, · 716 unmodified lines | |||
| 717 | u8 local_port = mlxsw_sp_port->local_port; | 717 | u8 local_port = mlxsw_sp_port->local_port; |
| 718 | u8 pg_buff = tc_index; | 718 | u8 pg_buff = tc_index; |
| 719 | enum mlxsw_reg_sbxx_dir dir = pool_type; | 719 | enum mlxsw_reg_sbxx_dir dir = pool_type; |
| 720 | u8 pool = pool_index; | 720 | u8 pool = pool_get(pool_index); |
| 721 | u32 max_buff; | 721 | u32 max_buff; |
| 722 | int err; | 722 | int err; |
| 723 | 723 | ||
| 724 | if (dir != dir_get(pool_index)) | ||
| 725 | return -EINVAL; | ||
| 726 | |||
| 724 | err = mlxsw_sp_sb_threshold_in(mlxsw_sp, pool, dir, | 727 | err = mlxsw_sp_sb_threshold_in(mlxsw_sp, pool, dir, |
| 725 | threshold, &max_buff); | 728 | threshold, &max_buff); |
| 726 | if (err) | 729 | if (err) |
| 727 | return err; | 730 | return err; |
| 728 | 731 | ||
| 729 | if (pool_type == DEVLINK_SB_POOL_TYPE_EGRESS) { | ||
| 730 | if (pool < MLXSW_SP_SB_POOL_COUNT) | ||
| 731 | return -EINVAL; | ||
| 732 | pool -= MLXSW_SP_SB_POOL_COUNT; | ||
| 733 | } else if (pool >= MLXSW_SP_SB_POOL_COUNT) { | ||
| 734 | return -EINVAL; | ||
| 735 | } | ||
| 736 | return mlxsw_sp_sb_cm_write(mlxsw_sp, local_port, pg_buff, dir, | 732 | return mlxsw_sp_sb_cm_write(mlxsw_sp, local_port, pg_buff, dir, |
| 737 | 0, max_buff, pool); | 733 | 0, max_buff, pool); |
| 738 | } | 734 | } |
| @@ -107,6 +107,7 @@ mlxsw_sp_prefix_usage_clear(struct mlxsw_sp_prefix_usage *prefix_usage, · 106 unmodified lines | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | struct mlxsw_sp_fib_key { | 109 | struct mlxsw_sp_fib_key { |
| 110 | struct net_device *dev; | ||
| 110 | unsigned char addr[sizeof(struct in6_addr)]; | 111 | unsigned char addr[sizeof(struct in6_addr)]; |
| 111 | unsigned char prefix_len; | 112 | unsigned char prefix_len; |
| 112 | }; | 113 | }; |
| @@ -123,7 +124,7 @@ struct mlxsw_sp_fib_entry { · 10 unmodified lines | |||
| 123 | struct rhash_head ht_node; | 124 | struct rhash_head ht_node; |
| 124 | struct mlxsw_sp_fib_key key; | 125 | struct mlxsw_sp_fib_key key; |
| 125 | enum mlxsw_sp_fib_entry_type type; | 126 | enum mlxsw_sp_fib_entry_type type; |
| 126 | u8 added:1; | 127 | unsigned int ref_count; |
| 127 | u16 rif; /* used for action local */ | 128 | u16 rif; /* used for action local */ |
| 128 | struct mlxsw_sp_vr *vr; | 129 | struct mlxsw_sp_vr *vr; |
| 129 | struct list_head nexthop_group_node; | 130 | struct list_head nexthop_group_node; |
| @@ -171,13 +172,15 @@ static void mlxsw_sp_fib_entry_remove(struct mlxsw_sp_fib *fib, · 41 unmodified lines | |||
| 171 | 172 | ||
| 172 | static struct mlxsw_sp_fib_entry * | 173 | static struct mlxsw_sp_fib_entry * |
| 173 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, | 174 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, |
| 174 | size_t addr_len, unsigned char prefix_len) | 175 | size_t addr_len, unsigned char prefix_len, |
| 176 | struct net_device *dev) | ||
| 175 | { | 177 | { |
| 176 | struct mlxsw_sp_fib_entry *fib_entry; | 178 | struct mlxsw_sp_fib_entry *fib_entry; |
| 177 | 179 | ||
| 178 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); | 180 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); |
| 179 | if (!fib_entry) | 181 | if (!fib_entry) |
| 180 | return NULL; | 182 | return NULL; |
| 183 | fib_entry->key.dev = dev; | ||
| 181 | memcpy(fib_entry->key.addr, addr, addr_len); | 184 | memcpy(fib_entry->key.addr, addr, addr_len); |
| 182 | fib_entry->key.prefix_len = prefix_len; | 185 | fib_entry->key.prefix_len = prefix_len; |
| 183 | return fib_entry; | 186 | return fib_entry; |
| @@ -190,10 +193,13 @@ static void mlxsw_sp_fib_entry_destroy(struct mlxsw_sp_fib_entry *fib_entry) · 6 unmodified lines | |||
| 190 | 193 | ||
| 191 | static struct mlxsw_sp_fib_entry * | 194 | static struct mlxsw_sp_fib_entry * |
| 192 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, | 195 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, |
| 193 | size_t addr_len, unsigned char prefix_len) | 196 | size_t addr_len, unsigned char prefix_len, |
| 197 | struct net_device *dev) | ||
| 194 | { | 198 | { |
| 195 | struct mlxsw_sp_fib_key key = {{ 0 } }; | 199 | struct mlxsw_sp_fib_key key; |
| 196 | 200 | ||
| 201 | memset(&key, 0, sizeof(key)); | ||
| 202 | key.dev = dev; | ||
| 197 | memcpy(key.addr, addr, addr_len); | 203 | memcpy(key.addr, addr, addr_len); |
| 198 | key.prefix_len = prefix_len; | 204 | key.prefix_len = prefix_len; |
| 199 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); | 205 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); |
| @@ -657,7 +663,7 @@ int mlxsw_sp_router_neigh_construct(struct net_device *dev, · 457 unmodified lines | |||
| 657 | return 0; | 663 | return 0; |
| 658 | } | 664 | } |
| 659 | 665 | ||
| 660 | r = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); | 666 | r = mlxsw_sp_rif_find_by_dev(mlxsw_sp, n->dev); |
| 661 | if (WARN_ON(!r)) | 667 | if (WARN_ON(!r)) |
| 662 | return -EINVAL; | 668 | return -EINVAL; |
| 663 | 669 | ||
| @@ -938,8 +944,8 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work) · 274 unmodified lines | |||
| 938 | mlxsw_sp_port_dev_put(mlxsw_sp_port); | 944 | mlxsw_sp_port_dev_put(mlxsw_sp_port); |
| 939 | } | 945 | } |
| 940 | 946 | ||
| 941 | static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | 947 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, |
| 942 | unsigned long event, void *ptr) | 948 | unsigned long event, void *ptr) |
| 943 | { | 949 | { |
| 944 | struct mlxsw_sp_neigh_entry *neigh_entry; | 950 | struct mlxsw_sp_neigh_entry *neigh_entry; |
| 945 | struct mlxsw_sp_port *mlxsw_sp_port; | 951 | struct mlxsw_sp_port *mlxsw_sp_port; |
| @@ -1009,10 +1015,6 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, · 63 unmodified lines | |||
| 1009 | return NOTIFY_DONE; | 1015 | return NOTIFY_DONE; |
| 1010 | } | 1016 | } |
| 1011 | 1017 | ||
| 1012 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
| 1013 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
| 1014 | }; | ||
| 1015 | |||
| 1016 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | 1018 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) |
| 1017 | { | 1019 | { |
| 1018 | int err; | 1020 | int err; |
| @@ -1027,10 +1029,6 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) · 8 unmodified lines | |||
| 1027 | */ | 1029 | */ |
| 1028 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); | 1030 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); |
| 1029 | 1031 | ||
| 1030 | err = register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
| 1031 | if (err) | ||
| 1032 | goto err_register_netevent_notifier; | ||
| 1033 | |||
| 1034 | /* Create the delayed works for the activity_update */ | 1032 | /* Create the delayed works for the activity_update */ |
| 1035 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, | 1033 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, |
| 1036 | mlxsw_sp_router_neighs_update_work); | 1034 | mlxsw_sp_router_neighs_update_work); |
| @@ -1039,17 +1037,12 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) · 2 unmodified lines | |||
| 1039 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); | 1037 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); |
| 1040 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); | 1038 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); |
| 1041 | return 0; | 1039 | return 0; |
| 1042 | |||
| 1043 | err_register_netevent_notifier: | ||
| 1044 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | ||
| 1045 | return err; | ||
| 1046 | } | 1040 | } |
| 1047 | 1041 | ||
| 1048 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) | 1042 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) |
| 1049 | { | 1043 | { |
| 1050 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); | 1044 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); |
| 1051 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); | 1045 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); |
| 1052 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
| 1053 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | 1046 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); |
| 1054 | } | 1047 | } |
| 1055 | 1048 | ||
| @@ -1524,7 +1517,14 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp) · 468 unmodified lines | |||
| 1524 | return err; | 1517 | return err; |
| 1525 | mlxsw_sp_lpm_init(mlxsw_sp); | 1518 | mlxsw_sp_lpm_init(mlxsw_sp); |
| 1526 | mlxsw_sp_vrs_init(mlxsw_sp); | 1519 | mlxsw_sp_vrs_init(mlxsw_sp); |
| 1527 | return mlxsw_sp_neigh_init(mlxsw_sp); | 1520 | err = mlxsw_sp_neigh_init(mlxsw_sp); |
| 1521 | if (err) | ||
| 1522 | goto err_neigh_init; | ||
| 1523 | return 0; | ||
| 1524 | |||
| 1525 | err_neigh_init: | ||
| 1526 | __mlxsw_sp_router_fini(mlxsw_sp); | ||
| 1527 | return err; | ||
| 1528 | } | 1528 | } |
| 1529 | 1529 | ||
| 1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) | 1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) |
| @@ -1626,11 +1626,8 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp, · 95 unmodified lines | |||
| 1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, | 1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, |
| 1627 | struct mlxsw_sp_fib_entry *fib_entry) | 1627 | struct mlxsw_sp_fib_entry *fib_entry) |
| 1628 | { | 1628 | { |
| 1629 | enum mlxsw_reg_ralue_op op; | 1629 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, |
| 1630 | 1630 | MLXSW_REG_RALUE_OP_WRITE_WRITE); | |
| 1631 | op = !fib_entry->added ? MLXSW_REG_RALUE_OP_WRITE_WRITE : | ||
| 1632 | MLXSW_REG_RALUE_OP_WRITE_UPDATE; | ||
| 1633 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, op); | ||
| 1634 | } | 1631 | } |
| 1635 | 1632 | ||
| 1636 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, | 1633 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, |
| @@ -1695,34 +1692,93 @@ mlxsw_sp_router_fib4_entry_fini(struct mlxsw_sp *mlxsw_sp, · 58 unmodified lines | |||
| 1695 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); | 1692 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); |
| 1696 | } | 1693 | } |
| 1697 | 1694 | ||
| 1698 | static int | 1695 | static struct mlxsw_sp_fib_entry * |
| 1699 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | 1696 | mlxsw_sp_fib_entry_get(struct mlxsw_sp *mlxsw_sp, |
| 1700 | const struct switchdev_obj_ipv4_fib *fib4, | 1697 | const struct switchdev_obj_ipv4_fib *fib4) |
| 1701 | struct switchdev_trans *trans) | ||
| 1702 | { | 1698 | { |
| 1703 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
| 1704 | struct mlxsw_sp_router_fib4_add_info *info; | ||
| 1705 | struct mlxsw_sp_fib_entry *fib_entry; | 1699 | struct mlxsw_sp_fib_entry *fib_entry; |
| 1700 | struct fib_info *fi = fib4->fi; | ||
| 1706 | struct mlxsw_sp_vr *vr; | 1701 | struct mlxsw_sp_vr *vr; |
| 1707 | int err; | 1702 | int err; |
| 1708 | 1703 | ||
| 1709 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, | 1704 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, |
| 1710 | MLXSW_SP_L3_PROTO_IPV4); | 1705 | MLXSW_SP_L3_PROTO_IPV4); |
| 1711 | if (IS_ERR(vr)) | 1706 | if (IS_ERR(vr)) |
| 1712 | return PTR_ERR(vr); | 1707 | return ERR_CAST(vr); |
| 1713 | 1708 | ||
| 1709 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
| 1710 | sizeof(fib4->dst), | ||
| 1711 | fib4->dst_len, fi->fib_dev); | ||
| 1712 | if (fib_entry) { | ||
| 1713 | /* Already exists, just take a reference */ | ||
| 1714 | fib_entry->ref_count++; | ||
| 1715 | return fib_entry; | ||
| 1716 | } | ||
| 1714 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, | 1717 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, |
| 1715 | sizeof(fib4->dst), fib4->dst_len); | 1718 | sizeof(fib4->dst), |
| 1719 | fib4->dst_len, fi->fib_dev); | ||
| 1716 | if (!fib_entry) { | 1720 | if (!fib_entry) { |
| 1717 | err = -ENOMEM; | 1721 | err = -ENOMEM; |
| 1718 | goto err_fib_entry_create; | 1722 | goto err_fib_entry_create; |
| 1719 | } | 1723 | } |
| 1720 | fib_entry->vr = vr; | 1724 | fib_entry->vr = vr; |
| 1725 | fib_entry->ref_count = 1; | ||
| 1721 | 1726 | ||
| 1722 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); | 1727 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); |
| 1723 | if (err) | 1728 | if (err) |
| 1724 | goto err_fib4_entry_init; | 1729 | goto err_fib4_entry_init; |
| 1725 | 1730 | ||
| 1731 | return fib_entry; | ||
| 1732 | |||
| 1733 | err_fib4_entry_init: | ||
| 1734 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
| 1735 | err_fib_entry_create: | ||
| 1736 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
| 1737 | |||
| 1738 | return ERR_PTR(err); | ||
| 1739 | } | ||
| 1740 | |||
| 1741 | static struct mlxsw_sp_fib_entry * | ||
| 1742 | mlxsw_sp_fib_entry_find(struct mlxsw_sp *mlxsw_sp, | ||
| 1743 | const struct switchdev_obj_ipv4_fib *fib4) | ||
| 1744 | { | ||
| 1745 | struct mlxsw_sp_vr *vr; | ||
| 1746 | |||
| 1747 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | ||
| 1748 | if (!vr) | ||
| 1749 | return NULL; | ||
| 1750 | |||
| 1751 | return mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
| 1752 | sizeof(fib4->dst), fib4->dst_len, | ||
| 1753 | fib4->fi->fib_dev); | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | void mlxsw_sp_fib_entry_put(struct mlxsw_sp *mlxsw_sp, | ||
| 1757 | struct mlxsw_sp_fib_entry *fib_entry) | ||
| 1758 | { | ||
| 1759 | struct mlxsw_sp_vr *vr = fib_entry->vr; | ||
| 1760 | |||
| 1761 | if (--fib_entry->ref_count == 0) { | ||
| 1762 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | ||
| 1763 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
| 1764 | } | ||
| 1765 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
| 1766 | } | ||
| 1767 | |||
| 1768 | static int | ||
| 1769 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | ||
| 1770 | const struct switchdev_obj_ipv4_fib *fib4, | ||
| 1771 | struct switchdev_trans *trans) | ||
| 1772 | { | ||
| 1773 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
| 1774 | struct mlxsw_sp_router_fib4_add_info *info; | ||
| 1775 | struct mlxsw_sp_fib_entry *fib_entry; | ||
| 1776 | int err; | ||
| 1777 | |||
| 1778 | fib_entry = mlxsw_sp_fib_entry_get(mlxsw_sp, fib4); | ||
| 1779 | if (IS_ERR(fib_entry)) | ||
| 1780 | return PTR_ERR(fib_entry); | ||
| 1781 | |||
| 1726 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1782 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
| 1727 | if (!info) { | 1783 | if (!info) { |
| 1728 | err = -ENOMEM; | 1784 | err = -ENOMEM; |
| @@ -1736,11 +1792,7 @@ mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, · 7 unmodified lines | |||
| 1736 | return 0; | 1792 | return 0; |
| 1737 | 1793 | ||
| 1738 | err_alloc_info: | 1794 | err_alloc_info: |
| 1739 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1795 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
| 1740 | err_fib4_entry_init: | ||
| 1741 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
| 1742 | err_fib_entry_create: | ||
| 1743 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
| 1744 | return err; | 1796 | return err; |
| 1745 | } | 1797 | } |
| 1746 | 1798 | ||
| @@ -1759,11 +1811,14 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, · 12 unmodified lines | |||
| 1759 | fib_entry = info->fib_entry; | 1811 | fib_entry = info->fib_entry; |
| 1760 | kfree(info); | 1812 | kfree(info); |
| 1761 | 1813 | ||
| 1814 | if (fib_entry->ref_count != 1) | ||
| 1815 | return 0; | ||
| 1816 | |||
| 1762 | vr = fib_entry->vr; | 1817 | vr = fib_entry->vr; |
| 1763 | err = mlxsw_sp_fib_entry_insert(fib_entry->vr->fib, fib_entry); | 1818 | err = mlxsw_sp_fib_entry_insert(vr->fib, fib_entry); |
| 1764 | if (err) | 1819 | if (err) |
| 1765 | goto err_fib_entry_insert; | 1820 | goto err_fib_entry_insert; |
| 1766 | err = mlxsw_sp_fib_entry_update(mlxsw_sp, fib_entry); | 1821 | err = mlxsw_sp_fib_entry_update(mlxsw_sp_port->mlxsw_sp, fib_entry); |
| 1767 | if (err) | 1822 | if (err) |
| 1768 | goto err_fib_entry_add; | 1823 | goto err_fib_entry_add; |
| 1769 | return 0; | 1824 | return 0; |
| @@ -1771,9 +1826,7 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, · 1 unmodified line | |||
| 1771 | err_fib_entry_add: | 1826 | err_fib_entry_add: |
| 1772 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1827 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); |
| 1773 | err_fib_entry_insert: | 1828 | err_fib_entry_insert: |
| 1774 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1829 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
| 1775 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
| 1776 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
| 1777 | return err; | 1830 | return err; |
| 1778 | } | 1831 | } |
| 1779 | 1832 | ||
| @@ -1793,23 +1846,18 @@ int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port, · 13 unmodified lines | |||
| 1793 | { | 1846 | { |
| 1794 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 1847 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
| 1795 | struct mlxsw_sp_fib_entry *fib_entry; | 1848 | struct mlxsw_sp_fib_entry *fib_entry; |
| 1796 | struct mlxsw_sp_vr *vr; | ||
| 1797 | 1849 | ||
| 1798 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | 1850 | fib_entry = mlxsw_sp_fib_entry_find(mlxsw_sp, fib4); |
| 1799 | if (!vr) { | ||
| 1800 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find virtual router for FIB4 entry being removed.\n"); | ||
| 1801 | return -ENOENT; | ||
| 1802 | } | ||
| 1803 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
| 1804 | sizeof(fib4->dst), fib4->dst_len); | ||
| 1805 | if (!fib_entry) { | 1851 | if (!fib_entry) { |
| 1806 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); | 1852 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); |
| 1807 | return -ENOENT; | 1853 | return -ENOENT; |
| 1808 | } | 1854 | } |
| 1809 | mlxsw_sp_fib_entry_del(mlxsw_sp_port->mlxsw_sp, fib_entry); | 1855 | |
| 1810 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1856 | if (fib_entry->ref_count == 1) { |
| 1811 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1857 | mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry); |
| 1812 | mlxsw_sp_fib_entry_destroy(fib_entry); | 1858 | mlxsw_sp_fib_entry_remove(fib_entry->vr->fib, fib_entry); |
| 1813 | mlxsw_sp_vr_put(mlxsw_sp, vr); | 1859 | } |
| 1860 | |||
| 1861 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); | ||
| 1814 | return 0; | 1862 | return 0; |
| 1815 | } | 1863 | } |
| @@ -167,8 +167,8 @@ static int mlxsw_sp_port_attr_stp_state_set(struct mlxsw_sp_port *mlxsw_sp_port, · 166 unmodified lines | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, | 169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| 170 | u16 idx_begin, u16 idx_end, bool set, | 170 | u16 idx_begin, u16 idx_end, bool uc_set, |
| 171 | bool only_uc) | 171 | bool bm_set) |
| 172 | { | 172 | { |
| 173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
| 174 | u16 local_port = mlxsw_sp_port->local_port; | 174 | u16 local_port = mlxsw_sp_port->local_port; |
| @@ -187,28 +187,22 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, · 12 unmodified lines | |||
| 187 | return -ENOMEM; | 187 | return -ENOMEM; |
| 188 | 188 | ||
| 189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
| 190 | table_type, range, local_port, set); | 190 | table_type, range, local_port, uc_set); |
| 191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
| 192 | if (err) | 192 | if (err) |
| 193 | goto buffer_out; | 193 | goto buffer_out; |
| 194 | 194 | ||
| 195 | /* Flooding control allows one to decide whether a given port will | ||
| 196 | * flood unicast traffic for which there is no FDB entry. | ||
| 197 | */ | ||
| 198 | if (only_uc) | ||
| 199 | goto buffer_out; | ||
| 200 | |||
| 201 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, | 195 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, |
| 202 | table_type, range, local_port, set); | 196 | table_type, range, local_port, bm_set); |
| 203 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 197 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
| 204 | if (err) | 198 | if (err) |
| 205 | goto err_flood_bm_set; | 199 | goto err_flood_bm_set; |
| 206 | else | 200 | |
| 207 | goto buffer_out; | 201 | goto buffer_out; |
| 208 | 202 | ||
| 209 | err_flood_bm_set: | 203 | err_flood_bm_set: |
| 210 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 204 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
| 211 | table_type, range, local_port, !set); | 205 | table_type, range, local_port, !uc_set); |
| 212 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 206 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
| 213 | buffer_out: | 207 | buffer_out: |
| 214 | kfree(sftr_pl); | 208 | kfree(sftr_pl); |
| @@ -257,8 +251,7 @@ int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid, · 42 unmodified lines | |||
| 257 | * the start of the vFIDs range. | 251 | * the start of the vFIDs range. |
| 258 | */ | 252 | */ |
| 259 | vfid = mlxsw_sp_fid_to_vfid(fid); | 253 | vfid = mlxsw_sp_fid_to_vfid(fid); |
| 260 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, | 254 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, set); |
| 261 | false); | ||
| 262 | } | 255 | } |
| 263 | 256 | ||
| 264 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, | 257 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| @@ -460,6 +453,9 @@ static int __mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, · 195 unmodified lines | |||
| 460 | { | 453 | { |
| 461 | struct mlxsw_sp_fid *f; | 454 | struct mlxsw_sp_fid *f; |
| 462 | 455 | ||
| 456 | if (test_bit(fid, mlxsw_sp_port->active_vlans)) | ||
| 457 | return 0; | ||
| 458 | |||
| 463 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); | 459 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); |
| 464 | if (!f) { | 460 | if (!f) { |
| 465 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); | 461 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); |
| @@ -517,7 +513,7 @@ static int mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, · 51 unmodified lines | |||
| 517 | } | 513 | } |
| 518 | 514 | ||
| 519 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, | 515 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, |
| 520 | true, false); | 516 | mlxsw_sp_port->uc_flood, true); |
| 521 | if (err) | 517 | if (err) |
| 522 | goto err_port_flood_set; | 518 | goto err_port_flood_set; |
| 523 | 519 | ||
| @@ -41,7 +41,6 @@ · 40 unmodified lines | |||
| 41 | * Chris Telfer <chris.telfer@netronome.com> | 41 | * Chris Telfer <chris.telfer@netronome.com> |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | #include <linux/version.h> | ||
| 45 | #include <linux/module.h> | 44 | #include <linux/module.h> |
| 46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
| 47 | #include <linux/init.h> | 46 | #include <linux/init.h> |
| @@ -1441,10 +1440,6 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget) · 1393 unmodified lines | |||
| 1441 | 1440 | ||
| 1442 | nfp_net_set_hash(nn->netdev, skb, rxd); | 1441 | nfp_net_set_hash(nn->netdev, skb, rxd); |
| 1443 | 1442 | ||
| 1444 | /* Pad small frames to minimum */ | ||
| 1445 | if (skb_put_padto(skb, 60)) | ||
| 1446 | break; | ||
| 1447 | |||
| 1448 | /* Stats update */ | 1443 | /* Stats update */ |
| 1449 | u64_stats_update_begin(&r_vec->rx_sync); | 1444 | u64_stats_update_begin(&r_vec->rx_sync); |
| 1450 | r_vec->rx_pkts++; | 1445 | r_vec->rx_pkts++; |
| @@ -2049,12 +2044,16 @@ static int nfp_net_netdev_open(struct net_device *netdev) · 598 unmodified lines | |||
| 2049 | 2044 | ||
| 2050 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), | 2045 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), |
| 2051 | GFP_KERNEL); | 2046 | GFP_KERNEL); |
| 2052 | if (!nn->rx_rings) | 2047 | if (!nn->rx_rings) { |
| 2048 | err = -ENOMEM; | ||
| 2053 | goto err_free_lsc; | 2049 | goto err_free_lsc; |
| 2050 | } | ||
| 2054 | nn->tx_rings = kcalloc(nn->num_tx_rings, sizeof(*nn->tx_rings), | 2051 | nn->tx_rings = kcalloc(nn->num_tx_rings, sizeof(*nn->tx_rings), |
| 2055 | GFP_KERNEL); | 2052 | GFP_KERNEL); |
| 2056 | if (!nn->tx_rings) | 2053 | if (!nn->tx_rings) { |
| 2054 | err = -ENOMEM; | ||
| 2057 | goto err_free_rx_rings; | 2055 | goto err_free_rx_rings; |
| 2056 | } | ||
| 2058 | 2057 | ||
| 2059 | for (r = 0; r < nn->num_r_vecs; r++) { | 2058 | for (r = 0; r < nn->num_r_vecs; r++) { |
| 2060 | err = nfp_net_prepare_vector(nn, &nn->r_vecs[r], r); | 2059 | err = nfp_net_prepare_vector(nn, &nn->r_vecs[r], r); |
| @@ -40,7 +40,6 @@ · 39 unmodified lines | |||
| 40 | * Brad Petrus <brad.petrus@netronome.com> | 40 | * Brad Petrus <brad.petrus@netronome.com> |
| 41 | */ | 41 | */ |
| 42 | 42 | ||
| 43 | #include <linux/version.h> | ||
3 more lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 333 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 380 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 381 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 474 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 119 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 181 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 253 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 126 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 210 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 295 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 197 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 259 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 180 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 885 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 1354 lines aren’t shown here.
This diff is large: its 848 lines aren’t shown here.
This diff is large: its 3219 lines aren’t shown here.
This diff is large: its 1122 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 359 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 245 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 504 lines aren’t shown here.
This diff is large: its 346 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 192 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 348 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 671 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 195 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 241 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 1050 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 398 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 234 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 201 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 487 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 199 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 213 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 279 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.