Linux 4.3-rc4 Pulling in v4.3-rc4 to avoid conflicts with NVMe fixes that have gone in since for-4.4/core was based.
Unified · Split
| @@ -43,7 +43,7 @@ o udev 081 # udevd --version · 42 unmodified lines | ||
| 43 | 43 | o grub 0.93 # grub --version || grub-install --version |
| 44 | 44 | o mcelog 0.6 # mcelog --version |
| 45 | 45 | o iptables 1.4.2 # iptables -V |
| 46 | −o openssl & libcrypto 1.0.1k # openssl version | |
| 46 | +o openssl & libcrypto 1.0.0 # openssl version | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | Kernel compilation |
| @@ -57,6 +57,8 @@ used to route Message Signalled Interrupts (MSI) to the CPUs. · 56 unmodified lines | ||
| 57 | 57 | These nodes must have the following properties: |
| 58 | 58 | - compatible : Should at least contain "arm,gic-v3-its". |
| 59 | 59 | - msi-controller : Boolean property. Identifies the node as an MSI controller |
| 60 | +- #msi-cells: Must be <1>. The single msi-cell is the DeviceID of the device | |
| 61 | + which will generate the MSI. | |
| 60 | 62 | - reg: Specifies the base physical address and size of the ITS |
| 61 | 63 | registers. |
| 62 | 64 | |
| @@ -83,6 +85,7 @@ Examples: · 20 unmodified lines | ||
| 83 | 85 | gic-its@2c200000 { |
| 84 | 86 | compatible = "arm,gic-v3-its"; |
| 85 | 87 | msi-controller; |
| 88 | + #msi-cells = <1>; | |
| 86 | 89 | reg = <0x0 0x2c200000 0 0x200000>; |
| 87 | 90 | }; |
| 88 | 91 | }; |
| @@ -107,12 +110,14 @@ Examples: · 18 unmodified lines | ||
| 107 | 110 | gic-its@2c200000 { |
| 108 | 111 | compatible = "arm,gic-v3-its"; |
| 109 | 112 | msi-controller; |
| 113 | + #msi-cells = <1>; | |
| 110 | 114 | reg = <0x0 0x2c200000 0 0x200000>; |
| 111 | 115 | }; |
| 112 | 116 | |
| 113 | 117 | gic-its@2c400000 { |
| 114 | 118 | compatible = "arm,gic-v3-its"; |
| 115 | 119 | msi-controller; |
| 120 | + #msi-cells = <1>; | |
| 116 | 121 | reg = <0x0 0x2c400000 0 0x200000>; |
| 117 | 122 | }; |
| 118 | 123 | }; |
| @@ -497,7 +497,7 @@ cpus { · 496 unmodified lines | ||
| 497 | 497 | }; |
| 498 | 498 | |
| 499 | 499 | idle-states { |
| 500 | − entry-method = "arm,psci"; | |
| 500 | + entry-method = "psci"; | |
| 501 | 501 | |
| 502 | 502 | CPU_RETENTION_0_0: cpu-retention-0-0 { |
| 503 | 503 | compatible = "arm,idle-state"; |
| @@ -16,7 +16,9 @@ properties, each containing a 'gpio-list': · 15 unmodified lines | ||
| 16 | 16 | GPIO properties should be named "[<name>-]gpios", with <name> being the purpose |
| 17 | 17 | of this GPIO for the device. While a non-existent <name> is considered valid |
| 18 | 18 | for compatibility reasons (resolving to the "gpios" property), it is not allowed |
| 19 | −for new bindings. | |
| 19 | +for new bindings. Also, GPIO properties named "[<name>-]gpio" are valid and old | |
| 20 | +bindings use it, but are only supported for compatibility reasons and should not | |
| 21 | +be used for newer bindings since it has been deprecated. | |
| 20 | 22 | |
| 21 | 23 | GPIO properties can contain one or more GPIO phandles, but only in exceptional |
| 22 | 24 | cases should they contain more than one. If your device uses several GPIOs with |
| @@ -1,10 +1,11 @@ | ||
| 1 | −* Bosch BMA180 triaxial acceleration sensor | |
| 1 | +* Bosch BMA180 / BMA250 triaxial acceleration sensor | |
| 2 | 2 | |
| 3 | 3 | http://omapworld.com/BMA180_111_1002839.pdf |
| 4 | +http://ae-bst.resource.bosch.com/media/products/dokumente/bma250/bst-bma250-ds002-05.pdf | |
| 4 | 5 | |
| 5 | 6 | Required properties: |
| 6 | 7 | |
| 7 | − - compatible : should be "bosch,bma180" | |
| 8 | + - compatible : should be "bosch,bma180" or "bosch,bma250" | |
| 8 | 9 | - reg : the I2C address of the sensor |
| 9 | 10 | |
| 10 | 11 | Optional properties: |
| @@ -13,6 +14,9 @@ Optional properties: · 2 unmodified lines | ||
| 13 | 14 | |
| 14 | 15 | - interrupts : interrupt mapping for GPIO IRQ, it should by configured with |
| 15 | 16 | flags IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING |
| 17 | + For the bma250 the first interrupt listed must be the one | |
| 18 | + connected to the INT1 pin, the second (optional) interrupt | |
| 19 | + listed must be the one connected to the INT2 pin. | |
| 16 | 20 | |
| 17 | 21 | Example: |
| 18 | 22 | |
| @@ -25,7 +25,7 @@ Example: · 24 unmodified lines | ||
| 25 | 25 | /* Cypress Gen3 touchpad */ |
| 26 | 26 | touchpad@67 { |
| 27 | 27 | compatible = "cypress,cyapa"; |
| 28 | − reg = <0x24>; | |
| 28 | + reg = <0x67>; | |
| 29 | 29 | interrupt-parent = <&gpio>; |
| 30 | 30 | interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO 2 */ |
| 31 | 31 | wakeup-source; |
| @@ -4,8 +4,8 @@ The MISC interrupt controller is a secondary controller for lower priority · 3 unmodified lines | ||
| 4 | 4 | interrupt. |
| 5 | 5 | |
| 6 | 6 | Required Properties: |
| 7 | −- compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-misc-intc" | |
| 8 | − as fallback | |
| 7 | +- compatible: has to be "qca,<soctype>-cpu-intc", "qca,ar7100-misc-intc" or | |
| 8 | + "qca,<soctype>-cpu-intc", "qca,ar7240-misc-intc" | |
| 9 | 9 | - reg: Base address and size of the controllers memory area |
| 10 | 10 | - interrupt-parent: phandle of the parent interrupt controller. |
| 11 | 11 | - interrupts: Interrupt specifier for the controllers interrupt. |
| @@ -13,6 +13,9 @@ Required Properties: · 1 unmodified line | ||
| 13 | 13 | - #interrupt-cells : Specifies the number of cells needed to encode interrupt |
| 14 | 14 | source, should be 1 |
| 15 | 15 | |
| 16 | +Compatible fallback depends on the SoC. Use ar7100 for ar71xx and ar913x, | |
| 17 | +use ar7240 for all other SoCs. | |
| 18 | + | |
| 16 | 19 | Please refer to interrupts.txt in this directory for details of the common |
| 17 | 20 | Interrupt Controllers bindings used by client devices. |
| 18 | 21 | |
| @@ -28,3 +31,16 @@ Example: · 9 unmodified lines | ||
| 28 | 31 | interrupt-controller; |
| 29 | 32 | #interrupt-cells = <1>; |
| 30 | 33 | }; |
| 34 | + | |
| 35 | +Another example: | |
| 36 | + | |
| 37 | + interrupt-controller@18060010 { | |
| 38 | + compatible = "qca,ar9331-misc-intc", qca,ar7240-misc-intc"; | |
| 39 | + reg = <0x18060010 0x4>; | |
| 40 | + | |
| 41 | + interrupt-parent = <&cpuintc>; | |
| 42 | + interrupts = <6>; | |
| 43 | + | |
| 44 | + interrupt-controller; | |
| 45 | + #interrupt-cells = <1>; | |
| 46 | + }; | |
| @@ -7,7 +7,8 @@ OHCI and EHCI controllers. · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | Required properties: |
| 9 | 9 | - compatible: "renesas,pci-r8a7790" for the R8A7790 SoC; |
| 10 | − "renesas,pci-r8a7791" for the R8A7791 SoC. | |
| 10 | + "renesas,pci-r8a7791" for the R8A7791 SoC; | |
| 11 | + "renesas,pci-r8a7794" for the R8A7794 SoC. | |
| 11 | 12 | - reg: A list of physical regions to access the device: the first is |
| 12 | 13 | the operational registers for the OHCI/EHCI controllers and the |
| 13 | 14 | second is for the bridge configuration and control registers. |
| @@ -2,7 +2,12 @@ PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs. · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | Required properties: |
| 4 | 4 | - compatible: |
| 5 | − - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7. | |
| 5 | + - should be "ti,pbias-dra7" for DRA7 | |
| 6 | + - should be "ti,pbias-omap2" for OMAP2 | |
| 7 | + - should be "ti,pbias-omap3" for OMAP3 | |
| 8 | + - should be "ti,pbias-omap4" for OMAP4 | |
| 9 | + - should be "ti,pbias-omap5" for OMAP5 | |
| 10 | + - "ti,pbias-omap" is deprecated | |
| 6 | 11 | - reg: pbias register offset from syscon base and size of pbias register. |
| 7 | 12 | - syscon : phandle of the system control module |
| 8 | 13 | - regulator-name : should be |
| @@ -15,17 +15,18 @@ Required properties: · 14 unmodified lines | ||
| 15 | 15 | - interrupts: Should contain spi interrupt |
| 16 | 16 | |
| 17 | 17 | - clocks: phandles to input clocks. |
| 18 | − The first should be <&topckgen CLK_TOP_SPI_SEL>. | |
| 19 | − The second should be one of the following. | |
| 18 | + The first should be one of the following. It's PLL. | |
| 20 | 19 | - <&clk26m>: specify parent clock 26MHZ. |
| 21 | 20 | - <&topckgen CLK_TOP_SYSPLL3_D2>: specify parent clock 109MHZ. |
| 22 | 21 | It's the default one. |
| 23 | 22 | - <&topckgen CLK_TOP_SYSPLL4_D2>: specify parent clock 78MHZ. |
| 24 | 23 | - <&topckgen CLK_TOP_UNIVPLL2_D4>: specify parent clock 104MHZ. |
| 25 | 24 | - <&topckgen CLK_TOP_UNIVPLL1_D8>: specify parent clock 78MHZ. |
| 25 | + The second should be <&topckgen CLK_TOP_SPI_SEL>. It's clock mux. | |
| 26 | + The third is <&pericfg CLK_PERI_SPI0>. It's clock gate. | |
| 26 | 27 | |
| 27 | −- clock-names: shall be "spi-clk" for the controller clock, and | |
| 28 | − "parent-clk" for the parent clock. | |
| 28 | +- clock-names: shall be "parent-clk" for the parent clock, "sel-clk" for the | |
| 29 | + muxes clock, and "spi-clk" for the clock gate. | |
| 29 | 30 | |
| 30 | 31 | Optional properties: |
| 31 | 32 | - mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi |
| @@ -44,8 +45,11 @@ spi: spi@1100a000 { · 12 unmodified lines | ||
| 44 | 45 | #size-cells = <0>; |
| 45 | 46 | reg = <0 0x1100a000 0 0x1000>; |
| 46 | 47 | interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_LOW>; |
| 47 | − clocks = <&topckgen CLK_TOP_SPI_SEL>, <&topckgen CLK_TOP_SYSPLL3_D2>; | |
| 48 | − clock-names = "spi-clk", "parent-clk"; | |
| 48 | + clocks = <&topckgen CLK_TOP_SYSPLL3_D2>, | |
| 49 | + <&topckgen CLK_TOP_SPI_SEL>, | |
| 50 | + <&pericfg CLK_PERI_SPI0>; | |
| 51 | + clock-names = "parent-clk", "sel-clk", "spi-clk"; | |
| 52 | + | |
| 49 | 53 | mediatek,pad-select = <0>; |
| 50 | 54 | status = "disabled"; |
| 51 | 55 | }; |
| @@ -55,19 +55,11 @@ of heat dissipation). For example a fan's cooling states correspond to · 54 unmodified lines | ||
| 55 | 55 | the different fan speeds possible. Cooling states are referred to by |
| 56 | 56 | single unsigned integers, where larger numbers mean greater heat |
| 57 | 57 | dissipation. The precise set of cooling states associated with a device |
| 58 | −(as referred to be the cooling-min-state and cooling-max-state | |
| 58 | +(as referred to by the cooling-min-level and cooling-max-level | |
| 59 | 59 | properties) should be defined in a particular device's binding. |
| 60 | 60 | For more examples of cooling devices, refer to the example sections below. |
| 61 | 61 | |
| 62 | 62 | Required properties: |
| 63 | −- cooling-min-state: An integer indicating the smallest | |
| 64 | − Type: unsigned cooling state accepted. Typically 0. | |
| 65 | − Size: one cell | |
| 66 | − | |
| 67 | −- cooling-max-state: An integer indicating the largest | |
| 68 | − Type: unsigned cooling state accepted. | |
| 69 | − Size: one cell | |
| 70 | − | |
| 71 | 63 | - #cooling-cells: Used to provide cooling device specific information |
| 72 | 64 | Type: unsigned while referring to it. Must be at least 2, in order |
| 73 | 65 | Size: one cell to specify minimum and maximum cooling state used |
| @@ -77,6 +69,15 @@ Required properties: · 3 unmodified lines | ||
| 77 | 69 | See Cooling device maps section below for more details |
| 78 | 70 | on how consumers refer to cooling devices. |
| 79 | 71 | |
| 72 | +Optional properties: | |
| 73 | +- cooling-min-level: An integer indicating the smallest | |
| 74 | + Type: unsigned cooling state accepted. Typically 0. | |
| 75 | + Size: one cell | |
| 76 | + | |
| 77 | +- cooling-max-level: An integer indicating the largest | |
| 78 | + Type: unsigned cooling state accepted. | |
| 79 | + Size: one cell | |
| 80 | + | |
| 80 | 81 | * Trip points |
| 81 | 82 | |
| 82 | 83 | The trip node is a node to describe a point in the temperature domain |
| @@ -225,8 +226,8 @@ cpus { · 142 unmodified lines | ||
| 225 | 226 | 396000 950000 |
| 226 | 227 | 198000 850000 |
| 227 | 228 | >; |
| 228 | − cooling-min-state = <0>; | |
| 229 | − cooling-max-state = <3>; | |
| 229 | + cooling-min-level = <0>; | |
| 230 | + cooling-max-level = <3>; | |
| 230 | 231 | #cooling-cells = <2>; /* min followed by max */ |
| 231 | 232 | }; |
| 232 | 233 | ... |
| @@ -240,8 +241,8 @@ cpus { · 7 unmodified lines | ||
| 240 | 241 | */ |
| 241 | 242 | fan0: fan@0x48 { |
| 242 | 243 | ... |
| 243 | − cooling-min-state = <0>; | |
| 244 | − cooling-max-state = <9>; | |
| 244 | + cooling-min-level = <0>; | |
| 245 | + cooling-max-level = <9>; | |
| 245 | 246 | #cooling-cells = <2>; /* min followed by max */ |
| 246 | 247 | }; |
| 247 | 248 | }; |
| @@ -6,6 +6,7 @@ Required properties: · 5 unmodified lines | ||
| 6 | 6 | "lsi,zevio-usb" |
| 7 | 7 | "qcom,ci-hdrc" |
| 8 | 8 | "chipidea,usb2" |
| 9 | + "xlnx,zynq-usb-2.20a" | |
| 9 | 10 | - reg: base address and length of the registers |
| 10 | 11 | - interrupts: interrupt for the USB controller |
| 11 | 12 | |
| @@ -203,6 +203,7 @@ sitronix Sitronix Technology Corporation · 202 unmodified lines | ||
| 203 | 203 | skyworks Skyworks Solutions, Inc. |
| 204 | 204 | smsc Standard Microsystems Corporation |
| 205 | 205 | snps Synopsys, Inc. |
| 206 | +socionext Socionext Inc. | |
| 206 | 207 | solidrun SolidRun |
| 207 | 208 | solomon Solomon Systech Limited |
| 208 | 209 | sony Sony Corporation |
| @@ -361,7 +361,7 @@ For win8 devices with both T and C coordinates, the position mapping is · 360 unmodified lines | ||
| 361 | 361 | ABS_MT_POSITION_X := T_X |
| 362 | 362 | ABS_MT_POSITION_Y := T_Y |
| 363 | 363 | ABS_MT_TOOL_X := C_X |
| 364 | − ABS_MT_TOOL_X := C_Y | |
| 364 | + ABS_MT_TOOL_Y := C_Y | |
| 365 | 365 | |
| 366 | 366 | Unfortunately, there is not enough information to specify both the touching |
| 367 | 367 | ellipse and the tool ellipse, so one has to resort to approximations. One |
| @@ -0,0 +1,96 @@ | ||
| 1 | +Virtual Routing and Forwarding (VRF) | |
| 2 | +==================================== | |
| 3 | +The VRF device combined with ip rules provides the ability to create virtual | |
| 4 | +routing and forwarding domains (aka VRFs, VRF-lite to be specific) in the | |
| 5 | +Linux network stack. One use case is the multi-tenancy problem where each | |
| 6 | +tenant has their own unique routing tables and in the very least need | |
| 7 | +different default gateways. | |
| 8 | + | |
| 9 | +Processes can be "VRF aware" by binding a socket to the VRF device. Packets | |
| 10 | +through the socket then use the routing table associated with the VRF | |
| 11 | +device. An important feature of the VRF device implementation is that it | |
| 12 | +impacts only Layer 3 and above so L2 tools (e.g., LLDP) are not affected | |
| 13 | +(ie., they do not need to be run in each VRF). The design also allows | |
| 14 | +the use of higher priority ip rules (Policy Based Routing, PBR) to take | |
| 15 | +precedence over the VRF device rules directing specific traffic as desired. | |
| 16 | + | |
| 17 | +In addition, VRF devices allow VRFs to be nested within namespaces. For | |
| 18 | +example network namespaces provide separation of network interfaces at L1 | |
| 19 | +(Layer 1 separation), VLANs on the interfaces within a namespace provide | |
| 20 | +L2 separation and then VRF devices provide L3 separation. | |
| 21 | + | |
| 22 | +Design | |
| 23 | +------ | |
| 24 | +A VRF device is created with an associated route table. Network interfaces | |
| 25 | +are then enslaved to a VRF device: | |
| 26 | + | |
| 27 | + +-----------------------------+ | |
| 28 | + | vrf-blue | ===> route table 10 | |
| 29 | + +-----------------------------+ | |
| 30 | + | | | | |
| 31 | + +------+ +------+ +-------------+ | |
| 32 | + | eth1 | | eth2 | ... | bond1 | | |
| 33 | + +------+ +------+ +-------------+ | |
| 34 | + | | | |
| 35 | + +------+ +------+ | |
| 36 | + | eth8 | | eth9 | | |
| 37 | + +------+ +------+ | |
| 38 | + | |
| 39 | +Packets received on an enslaved device and are switched to the VRF device | |
| 40 | +using an rx_handler which gives the impression that packets flow through | |
| 41 | +the VRF device. Similarly on egress routing rules are used to send packets | |
| 42 | +to the VRF device driver before getting sent out the actual interface. This | |
| 43 | +allows tcpdump on a VRF device to capture all packets into and out of the | |
| 44 | +VRF as a whole.[1] Similiarly, netfilter [2] and tc rules can be applied | |
| 45 | +using the VRF device to specify rules that apply to the VRF domain as a whole. | |
| 46 | + | |
| 47 | +[1] Packets in the forwarded state do not flow through the device, so those | |
| 48 | + packets are not seen by tcpdump. Will revisit this limitation in a | |
| 49 | + future release. | |
| 50 | + | |
| 51 | +[2] Iptables on ingress is limited to NF_INET_PRE_ROUTING only with skb->dev | |
| 52 | + set to real ingress device and egress is limited to NF_INET_POST_ROUTING. | |
| 53 | + Will revisit this limitation in a future release. | |
| 54 | + | |
| 55 | + | |
| 56 | +Setup | |
| 57 | +----- | |
| 58 | +1. VRF device is created with an association to a FIB table. | |
| 59 | + e.g, ip link add vrf-blue type vrf table 10 | |
| 60 | + ip link set dev vrf-blue up | |
| 61 | + | |
| 62 | +2. Rules are added that send lookups to the associated FIB table when the | |
| 63 | + iif or oif is the VRF device. e.g., | |
| 64 | + ip ru add oif vrf-blue table 10 | |
| 65 | + ip ru add iif vrf-blue table 10 | |
| 66 | + | |
| 67 | + Set the default route for the table (and hence default route for the VRF). | |
| 68 | + e.g, ip route add table 10 prohibit default | |
| 69 | + | |
| 70 | +3. Enslave L3 interfaces to a VRF device. | |
| 71 | + e.g, ip link set dev eth1 master vrf-blue | |
| 72 | + | |
| 73 | + Local and connected routes for enslaved devices are automatically moved to | |
| 74 | + the table associated with VRF device. Any additional routes depending on | |
| 75 | + the enslaved device will need to be reinserted following the enslavement. | |
| 76 | + | |
| 77 | +4. Additional VRF routes are added to associated table. | |
| 78 | + e.g., ip route add table 10 ... | |
| 79 | + | |
| 80 | + | |
| 81 | +Applications | |
| 82 | +------------ | |
| 83 | +Applications that are to work within a VRF need to bind their socket to the | |
| 84 | +VRF device: | |
| 85 | + | |
| 86 | + setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1); | |
| 87 | + | |
| 88 | +or to specify the output device using cmsg and IP_PKTINFO. | |
| 89 | + | |
| 90 | + | |
| 91 | +Limitations | |
| 92 | +----------- | |
| 93 | +VRF device currently only works for IPv4. Support for IPv6 is under development. | |
| 94 | + | |
| 95 | +Index of original ingress interface is not available via cmsg. Will address | |
| 96 | +soon. | |
| @@ -979,20 +979,45 @@ every time right after the runtime_resume() callback has returned · 978 unmodified lines | ||
| 979 | 979 | (alternatively, the runtime_suspend() callback will have to check if the |
| 980 | 980 | device should really be suspended and return -EAGAIN if that is not the case). |
| 981 | 981 | |
| 982 | −The runtime PM of PCI devices is disabled by default. It is also blocked by | |
| 983 | −pci_pm_init() that runs the pm_runtime_forbid() helper function. If a PCI | |
| 984 | −driver implements the runtime PM callbacks and intends to use the runtime PM | |
| 985 | −framework provided by the PM core and the PCI subsystem, it should enable this | |
| 986 | −feature by executing the pm_runtime_enable() helper function. However, the | |
| 987 | −driver should not call the pm_runtime_allow() helper function unblocking | |
| 988 | −the runtime PM of the device. Instead, it should allow user space or some | |
| 989 | −platform-specific code to do that (user space can do it via sysfs), although | |
| 990 | −once it has called pm_runtime_enable(), it must be prepared to handle the | |
| 982 | +The runtime PM of PCI devices is enabled by default by the PCI core. PCI | |
| 983 | +device drivers do not need to enable it and should not attempt to do so. | |
| 984 | +However, it is blocked by pci_pm_init() that runs the pm_runtime_forbid() | |
| 985 | +helper function. In addition to that, the runtime PM usage counter of | |
| 986 | +each PCI device is incremented by local_pci_probe() before executing the | |
| 987 | +probe callback provided by the device's driver. | |
| 988 | + | |
| 989 | +If a PCI driver implements the runtime PM callbacks and intends to use the | |
| 990 | +runtime PM framework provided by the PM core and the PCI subsystem, it needs | |
| 991 | +to decrement the device's runtime PM usage counter in its probe callback | |
| 992 | +function. If it doesn't do that, the counter will always be different from | |
| 993 | +zero for the device and it will never be runtime-suspended. The simplest | |
| 994 | +way to do that is by calling pm_runtime_put_noidle(), but if the driver | |
| 995 | +wants to schedule an autosuspend right away, for example, it may call | |
| 996 | +pm_runtime_put_autosuspend() instead for this purpose. Generally, it | |
| 997 | +just needs to call a function that decrements the devices usage counter | |
| 998 | +from its probe routine to make runtime PM work for the device. | |
| 999 | + | |
| 1000 | +It is important to remember that the driver's runtime_suspend() callback | |
| 1001 | +may be executed right after the usage counter has been decremented, because | |
| 1002 | +user space may already have cuased the pm_runtime_allow() helper function | |
| 1003 | +unblocking the runtime PM of the device to run via sysfs, so the driver must | |
| 1004 | +be prepared to cope with that. | |
| 1005 | + | |
| 1006 | +The driver itself should not call pm_runtime_allow(), though. Instead, it | |
| 1007 | +should let user space or some platform-specific code do that (user space can | |
| 1008 | +do it via sysfs as stated above), but it must be prepared to handle the | |
| 991 | 1009 | runtime PM of the device correctly as soon as pm_runtime_allow() is called |
| 992 | −(which may happen at any time). [It also is possible that user space causes | |
| 993 | −pm_runtime_allow() to be called via sysfs before the driver is loaded, so in | |
| 994 | −fact the driver has to be prepared to handle the runtime PM of the device as | |
| 995 | −soon as it calls pm_runtime_enable().] | |
| 1010 | +(which may happen at any time, even before the driver is loaded). | |
| 1011 | + | |
| 1012 | +When the driver's remove callback runs, it has to balance the decrementation | |
| 1013 | +of the device's runtime PM usage counter at the probe time. For this reason, | |
| 1014 | +if it has decremented the counter in its probe callback, it must run | |
| 1015 | +pm_runtime_get_noresume() in its remove callback. [Since the core carries | |
| 1016 | +out a runtime resume of the device and bumps up the device's usage counter | |
| 1017 | +before running the driver's remove callback, the runtime PM of the device | |
| 1018 | +is effectively disabled for the duration of the remove execution and all | |
| 1019 | +runtime PM helper functions incrementing the device's usage counter are | |
| 1020 | +then effectively equivalent to pm_runtime_get_noresume().] | |
| 996 | 1021 | |
| 997 | 1022 | The runtime PM framework works by processing requests to suspend or resume |
| 998 | 1023 | devices, or to check if they are idle (in which cases it is reasonable to |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | 19 | */ |
| 20 | 20 | #define _GNU_SOURCE |
| 21 | +#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */ | |
| 21 | 22 | #include <errno.h> |
| 22 | 23 | #include <fcntl.h> |
| 23 | 24 | #include <inttypes.h> |
| @@ -54,13 +54,15 @@ default_qdisc · 53 unmodified lines | ||
| 54 | 54 | -------------- |
| 55 | 55 | |
| 56 | 56 | The default queuing discipline to use for network devices. This allows |
| 57 | −overriding the default queue discipline of pfifo_fast with an | |
| 58 | −alternative. Since the default queuing discipline is created with the | |
| 59 | −no additional parameters so is best suited to queuing disciplines that | |
| 60 | −work well without configuration like stochastic fair queue (sfq), | |
| 61 | −CoDel (codel) or fair queue CoDel (fq_codel). Don't use queuing disciplines | |
| 62 | −like Hierarchical Token Bucket or Deficit Round Robin which require setting | |
| 63 | −up classes and bandwidths. | |
| 57 | +overriding the default of pfifo_fast with an alternative. Since the default | |
| 58 | +queuing discipline is created without additional parameters so is best suited | |
| 59 | +to queuing disciplines that work well without configuration like stochastic | |
| 60 | +fair queue (sfq), CoDel (codel) or fair queue CoDel (fq_codel). Don't use | |
| 61 | +queuing disciplines like Hierarchical Token Bucket or Deficit Round Robin | |
| 62 | +which require setting up classes and bandwidths. Note that physical multiqueue | |
| 63 | +interfaces still use mq as root qdisc, which in turn uses this default for its | |
| 64 | +leaves. Virtual devices (like e.g. lo or veth) ignore this setting and instead | |
| 65 | +default to noqueue. | |
| 64 | 66 | Default: pfifo_fast |
| 65 | 67 | |
| 66 | 68 | busy_read |
| @@ -4,7 +4,7 @@ Power allocator governor tunables · 3 unmodified lines | ||
| 4 | 4 | Trip points |
| 5 | 5 | ----------- |
| 6 | 6 | |
| 7 | −The governor requires the following two passive trip points: | |
| 7 | +The governor works optimally with the following two passive trip points: | |
| 8 | 8 | |
| 9 | 9 | 1. "switch on" trip point: temperature above which the governor |
| 10 | 10 | control loop starts operating. This is the first passive trip |
| @@ -615,9 +615,8 @@ F: Documentation/hwmon/fam15h_power · 614 unmodified lines | ||
| 615 | 615 | F: drivers/hwmon/fam15h_power.c |
| 616 | 616 | |
| 617 | 617 | AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER |
| 618 | −M: Thomas Dahlmann <dahlmann.thomas@arcor.de> | |
| 619 | 618 | L: linux-geode@lists.infradead.org (moderated for non-subscribers) |
| 620 | −S: Supported | |
| 619 | +S: Orphan | |
| 621 | 620 | F: drivers/usb/gadget/udc/amd5536udc.* |
| 622 | 621 | |
| 623 | 622 | AMD GEODE PROCESSOR/CHIPSET SUPPORT |
| @@ -808,6 +807,13 @@ S: Maintained · 184 unmodified lines | ||
| 808 | 807 | F: drivers/video/fbdev/arcfb.c |
| 809 | 808 | F: drivers/video/fbdev/core/fb_defio.c |
| 810 | 809 | |
| 810 | +ARCNET NETWORK LAYER | |
| 811 | +M: Michael Grzeschik <m.grzeschik@pengutronix.de> | |
| 812 | +L: netdev@vger.kernel.org | |
| 813 | +S: Maintained | |
| 814 | +F: drivers/net/arcnet/ | |
| 815 | +F: include/uapi/linux/if_arcnet.h | |
| 816 | + | |
| 811 | 817 | ARM MFM AND FLOPPY DRIVERS |
| 812 | 818 | M: Ian Molton <spyro@f2s.com> |
| 813 | 819 | S: Maintained |
| @@ -3394,7 +3400,6 @@ F: drivers/staging/dgnc/ · 2580 unmodified lines | ||
| 3394 | 3400 | |
| 3395 | 3401 | DIGI EPCA PCI PRODUCTS |
| 3396 | 3402 | M: Lidza Louina <lidza.louina@gmail.com> |
| 3397 | −M: Mark Hounschell <markh@compro.net> | |
| 3398 | 3403 | M: Daeseok Youn <daeseok.youn@gmail.com> |
| 3399 | 3404 | L: driverdev-devel@linuxdriverproject.org |
| 3400 | 3405 | S: Maintained |
| @@ -5952,7 +5957,7 @@ F: virt/kvm/ · 2551 unmodified lines | ||
| 5952 | 5957 | KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V |
| 5953 | 5958 | M: Joerg Roedel <joro@8bytes.org> |
| 5954 | 5959 | L: kvm@vger.kernel.org |
| 5955 | −W: http://kvm.qumranet.com | |
| 5960 | +W: http://www.linux-kvm.org/ | |
| 5956 | 5961 | S: Maintained |
| 5957 | 5962 | F: arch/x86/include/asm/svm.h |
| 5958 | 5963 | F: arch/x86/kvm/svm.c |
| @@ -5960,7 +5965,7 @@ F: arch/x86/kvm/svm.c · 1 unmodified line | ||
| 5960 | 5965 | KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC |
| 5961 | 5966 | M: Alexander Graf <agraf@suse.com> |
| 5962 | 5967 | L: kvm-ppc@vger.kernel.org |
| 5963 | −W: http://kvm.qumranet.com | |
| 5968 | +W: http://www.linux-kvm.org/ | |
| 5964 | 5969 | T: git git://github.com/agraf/linux-2.6.git |
| 5965 | 5970 | S: Supported |
| 5966 | 5971 | F: arch/powerpc/include/asm/kvm* |
| @@ -8500,7 +8505,6 @@ F: Documentation/networking/LICENSE.qla3xxx · 2533 unmodified lines | ||
| 8500 | 8505 | F: drivers/net/ethernet/qlogic/qla3xxx.* |
| 8501 | 8506 | |
| 8502 | 8507 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER |
| 8503 | −M: Shahed Shaikh <shahed.shaikh@qlogic.com> | |
| 8504 | 8508 | M: Dept-GELinuxNICDev@qlogic.com |
| 8505 | 8509 | L: netdev@vger.kernel.org |
| 8506 | 8510 | S: Supported |
| @@ -9904,8 +9908,8 @@ F: drivers/staging/media/lirc/ · 1397 unmodified lines | ||
| 9904 | 9908 | STAGING - LUSTRE PARALLEL FILESYSTEM |
| 9905 | 9909 | M: Oleg Drokin <oleg.drokin@intel.com> |
| 9906 | 9910 | M: Andreas Dilger <andreas.dilger@intel.com> |
| 9907 | −L: HPDD-discuss@lists.01.org (moderated for non-subscribers) | |
| 9908 | −W: http://lustre.opensfs.org/ | |
| 9911 | +L: lustre-devel@lists.lustre.org (moderated for non-subscribers) | |
| 9912 | +W: http://wiki.lustre.org/ | |
| 9909 | 9913 | S: Maintained |
| 9910 | 9914 | F: drivers/staging/lustre |
| 9911 | 9915 | |
| @@ -10338,6 +10342,16 @@ F: include/uapi/linux/thermal.h · 426 unmodified lines | ||
| 10338 | 10342 | F: include/linux/cpu_cooling.h |
| 10339 | 10343 | F: Documentation/devicetree/bindings/thermal/ |
| 10340 | 10344 | |
| 10345 | +THERMAL/CPU_COOLING | |
| 10346 | +M: Amit Daniel Kachhap <amit.kachhap@gmail.com> | |
| 10347 | +M: Viresh Kumar <viresh.kumar@linaro.org> | |
| 10348 | +M: Javi Merino <javi.merino@arm.com> | |
| 10349 | +L: linux-pm@vger.kernel.org | |
| 10350 | +S: Supported | |
| 10351 | +F: Documentation/thermal/cpu-cooling-api.txt | |
| 10352 | +F: drivers/thermal/cpu_cooling.c | |
| 10353 | +F: include/linux/cpu_cooling.h | |
| 10354 | + | |
| 10341 | 10355 | THINGM BLINK(1) USB RGB LED DRIVER |
| 10342 | 10356 | M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
| 10343 | 10357 | S: Maintained |
| @@ -11187,7 +11201,7 @@ F: drivers/vlynq/vlynq.c · 843 unmodified lines | ||
| 11187 | 11201 | F: include/linux/vlynq.h |
| 11188 | 11202 | |
| 11189 | 11203 | VME SUBSYSTEM |
| 11190 | −M: Martyn Welch <martyn.welch@ge.com> | |
| 11204 | +M: Martyn Welch <martyn@welchs.me.uk> | |
| 11191 | 11205 | M: Manohar Vanga <manohar.vanga@gmail.com> |
| 11192 | 11206 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| 11193 | 11207 | L: devel@driverdev.osuosl.org |
| @@ -11239,7 +11253,6 @@ VOLTAGE AND CURRENT REGULATOR FRAMEWORK · 45 unmodified lines | ||
| 11239 | 11253 | M: Liam Girdwood <lgirdwood@gmail.com> |
| 11240 | 11254 | M: Mark Brown <broonie@kernel.org> |
| 11241 | 11255 | L: linux-kernel@vger.kernel.org |
| 11242 | −W: http://opensource.wolfsonmicro.com/node/15 | |
| 11243 | 11256 | W: http://www.slimlogic.co.uk/?p=48 |
| 11244 | 11257 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git |
| 11245 | 11258 | S: Supported |
| @@ -11253,6 +11266,7 @@ L: netdev@vger.kernel.org · 7 unmodified lines | ||
| 11253 | 11266 | S: Maintained |
| 11254 | 11267 | F: drivers/net/vrf.c |
| 11255 | 11268 | F: include/net/vrf.h |
| 11269 | +F: Documentation/networking/vrf.txt | |
| 11256 | 11270 | |
| 11257 | 11271 | VT1211 HARDWARE MONITOR DRIVER |
| 11258 | 11272 | M: Juerg Haefliger <juergh@gmail.com> |
| @@ -11368,17 +11382,15 @@ WM97XX TOUCHSCREEN DRIVERS · 109 unmodified lines | ||
| 11368 | 11382 | M: Mark Brown <broonie@kernel.org> |
| 11369 | 11383 | M: Liam Girdwood <lrg@slimlogic.co.uk> |
| 11370 | 11384 | L: linux-input@vger.kernel.org |
| 11371 | −T: git git://opensource.wolfsonmicro.com/linux-2.6-touch | |
| 11372 | −W: http://opensource.wolfsonmicro.com/node/7 | |
| 11385 | +W: https://github.com/CirrusLogic/linux-drivers/wiki | |
| 11373 | 11386 | S: Supported |
| 11374 | 11387 | F: drivers/input/touchscreen/*wm97* |
| 11375 | 11388 | F: include/linux/wm97xx.h |
| 11376 | 11389 | |
| 11377 | 11390 | WOLFSON MICROELECTRONICS DRIVERS |
| 11378 | 11391 | L: patches@opensource.wolfsonmicro.com |
| 11379 | −T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc | |
| 11380 | −T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus | |
| 11381 | −W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices | |
| 11392 | +T: git https://github.com/CirrusLogic/linux-drivers.git | |
| 11393 | +W: https://github.com/CirrusLogic/linux-drivers/wiki | |
| 11382 | 11394 | S: Supported |
| 11383 | 11395 | F: Documentation/hwmon/wm83?? |
| 11384 | 11396 | F: arch/arm/mach-s3c64xx/mach-crag6410* |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 3 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc2 | |
| 4 | +EXTRAVERSION = -rc4 | |
| 5 | 5 | NAME = Hurr durr I'ma sheep |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -242,7 +242,12 @@ pci_restore_srm_config(void) · 241 unmodified lines | ||
| 242 | 242 | |
| 243 | 243 | void pcibios_fixup_bus(struct pci_bus *bus) |
| 244 | 244 | { |
| 245 | − struct pci_dev *dev; | |
| 245 | + struct pci_dev *dev = bus->self; | |
| 246 | + | |
| 247 | + if (pci_has_flag(PCI_PROBE_ONLY) && dev && | |
| 248 | + (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | |
| 249 | + pci_read_bridge_bases(bus); | |
| 250 | + } | |
| 246 | 251 | |
| 247 | 252 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| 248 | 253 | pdev_save_srm_config(dev); |
| @@ -48,4 +48,5 @@ generic-y += types.h · 47 unmodified lines | ||
| 48 | 48 | generic-y += ucontext.h |
| 49 | 49 | generic-y += user.h |
| 50 | 50 | generic-y += vga.h |
| 51 | +generic-y += word-at-a-time.h | |
| 51 | 52 | generic-y += xor.h |
| @@ -252,10 +252,10 @@ · 251 unmodified lines | ||
| 252 | 252 | }; |
| 253 | 253 | |
| 254 | 254 | vdd1_reg: regulator@2 { |
| 255 | − /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */ | |
| 255 | + /* VDD_MPU voltage limits 0.95V - 1.325V with +/-4% tolerance */ | |
| 256 | 256 | regulator-name = "vdd_mpu"; |
| 257 | 257 | regulator-min-microvolt = <912500>; |
| 258 | − regulator-max-microvolt = <1312500>; | |
| 258 | + regulator-max-microvolt = <1378000>; | |
| 259 | 259 | regulator-boot-on; |
| 260 | 260 | regulator-always-on; |
| 261 | 261 | }; |
| @@ -98,13 +98,6 @@ · 97 unmodified lines | ||
| 98 | 98 | pinctrl-0 = <&extcon_usb1_pins>; |
| 99 | 99 | }; |
| 100 | 100 | |
| 101 | − extcon_usb2: extcon_usb2 { | |
| 102 | − compatible = "linux,extcon-usb-gpio"; | |
| 103 | − id-gpio = <&gpio7 24 GPIO_ACTIVE_HIGH>; | |
| 104 | − pinctrl-names = "default"; | |
| 105 | − pinctrl-0 = <&extcon_usb2_pins>; | |
| 106 | − }; | |
| 107 | − | |
| 108 | 101 | hdmi0: connector { |
| 109 | 102 | compatible = "hdmi-connector"; |
| 110 | 103 | label = "hdmi"; |
| @@ -326,12 +319,6 @@ · 215 unmodified lines | ||
| 326 | 319 | >; |
| 327 | 320 | }; |
| 328 | 321 | |
| 329 | − extcon_usb2_pins: extcon_usb2_pins { | |
| 330 | − pinctrl-single,pins = < | |
| 331 | − 0x3e8 (PIN_INPUT_PULLUP | MUX_MODE14) /* uart1_ctsn.gpio7_24 */ | |
| 332 | − >; | |
| 333 | − }; | |
| 334 | − | |
| 335 | 322 | tpd12s015_pins: pinmux_tpd12s015_pins { |
| 336 | 323 | pinctrl-single,pins = < |
| 337 | 324 | 0x3b0 (PIN_OUTPUT | MUX_MODE14) /* gpio7_10 CT_CP_HPD */ |
| @@ -432,7 +419,7 @@ · 94 unmodified lines | ||
| 432 | 419 | }; |
| 433 | 420 | |
| 434 | 421 | ldo3_reg: ldo3 { |
| 435 | − /* VDDA_1V8_PHY */ | |
| 422 | + /* VDDA_1V8_PHYA */ | |
| 436 | 423 | regulator-name = "ldo3"; |
| 437 | 424 | regulator-min-microvolt = <1800000>; |
| 438 | 425 | regulator-max-microvolt = <1800000>; |
| @@ -440,6 +427,15 @@ · 1 unmodified line | ||
| 440 | 427 | regulator-boot-on; |
| 441 | 428 | }; |
| 442 | 429 | |
| 430 | + ldo4_reg: ldo4 { | |
| 431 | + /* VDDA_1V8_PHYB */ | |
| 432 | + regulator-name = "ldo4"; | |
| 433 | + regulator-min-microvolt = <1800000>; | |
| 434 | + regulator-max-microvolt = <1800000>; | |
| 435 | + regulator-always-on; | |
| 436 | + regulator-boot-on; | |
| 437 | + }; | |
| 438 | + | |
| 443 | 439 | ldo9_reg: ldo9 { |
| 444 | 440 | /* VDD_RTC */ |
| 445 | 441 | regulator-name = "ldo9"; |
| @@ -495,6 +491,14 @@ · 49 unmodified lines | ||
| 495 | 491 | gpio-controller; |
| 496 | 492 | #gpio-cells = <2>; |
| 497 | 493 | }; |
| 494 | + | |
| 495 | + extcon_usb2: tps659038_usb { | |
| 496 | + compatible = "ti,palmas-usb-vid"; | |
| 497 | + ti,enable-vbus-detection; | |
| 498 | + ti,enable-id-detection; | |
| 499 | + id-gpios = <&gpio7 24 GPIO_ACTIVE_HIGH>; | |
| 500 | + }; | |
| 501 | + | |
| 498 | 502 | }; |
| 499 | 503 | |
| 500 | 504 | tmp102: tmp102@48 { |
| @@ -517,7 +521,8 @@ · 16 unmodified lines | ||
| 517 | 521 | mcp_rtc: rtc@6f { |
| 518 | 522 | compatible = "microchip,mcp7941x"; |
| 519 | 523 | reg = <0x6f>; |
| 520 | − interrupts = <GIC_SPI 2 IRQ_TYPE_EDGE_RISING>; /* IRQ_SYS_1N */ | |
| 524 | + interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>, | |
| 525 | + <&dra7_pmx_core 0x424>; | |
| 521 | 526 | |
| 522 | 527 | pinctrl-names = "default"; |
| 523 | 528 | pinctrl-0 = <&mcp79410_pins_default>; |
| @@ -579,7 +584,6 @@ · 55 unmodified lines | ||
| 579 | 584 | pinctrl-0 = <&mmc1_pins_default>; |
| 580 | 585 | |
| 581 | 586 | vmmc-supply = <&ldo1_reg>; |
| 582 | − vmmc_aux-supply = <&vdd_3v3>; | |
| 583 | 587 | bus-width = <4>; |
| 584 | 588 | cd-gpios = <&gpio6 27 0>; /* gpio 219 */ |
| 585 | 589 | }; |
| @@ -623,6 +627,14 @@ · 37 unmodified lines | ||
| 623 | 627 | }; |
| 624 | 628 | |
| 625 | 629 | &usb2 { |
| 630 | + /* | |
| 631 | + * Stand alone usage is peripheral only. | |
| 632 | + * However, with some resistor modifications | |
| 633 | + * this port can be used via expansion connectors | |
| 634 | + * as "host" or "dual-role". If so, provide | |
| 635 | + * the necessary dr_mode override in the expansion | |
| 636 | + * board's DT. | |
| 637 | + */ | |
| 626 | 638 | dr_mode = "peripheral"; |
| 627 | 639 | }; |
| 628 | 640 | |
| @@ -681,7 +693,7 @@ · 52 unmodified lines | ||
| 681 | 693 | |
| 682 | 694 | &hdmi { |
| 683 | 695 | status = "ok"; |
| 684 | − vdda-supply = <&ldo3_reg>; | |
| 696 | + vdda-supply = <&ldo4_reg>; | |
| 685 | 697 | |
| 686 | 698 | pinctrl-names = "default"; |
| 687 | 699 | pinctrl-0 = <&hdmi_pins>; |
| @@ -19,10 +19,10 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | &cpsw_emac0 { |
| 21 | 21 | phy_id = <&davinci_mdio>, <0>; |
| 22 | − phy-mode = "mii"; | |
| 22 | + phy-mode = "rgmii"; | |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | &cpsw_emac1 { |
| 26 | 26 | phy_id = <&davinci_mdio>, <1>; |
| 27 | − phy-mode = "mii"; | |
| 27 | + phy-mode = "rgmii"; | |
| 28 | 28 | }; |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include "dm814x.dtsi" |
| 9 | 9 | |
| 10 | 10 | / { |
| 11 | − model = "DM8148 EVM"; | |
| 11 | + model = "HP t410 Smart Zero Client"; | |
| 12 | 12 | compatible = "hp,t410", "ti,dm8148"; |
| 13 | 13 | |
| 14 | 14 | memory { |
| @@ -19,10 +19,10 @@ · 4 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | &cpsw_emac0 { |
| 21 | 21 | phy_id = <&davinci_mdio>, <0>; |
| 22 | − phy-mode = "mii"; | |
| 22 | + phy-mode = "rgmii"; | |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | &cpsw_emac1 { |
| 26 | 26 | phy_id = <&davinci_mdio>, <1>; |
| 27 | − phy-mode = "mii"; | |
| 27 | + phy-mode = "rgmii"; | |
| 28 | 28 | }; |
| @@ -181,9 +181,9 @@ · 180 unmodified lines | ||
| 181 | 181 | ti,hwmods = "timer3"; |
| 182 | 182 | }; |
| 183 | 183 | |
| 184 | − control: control@160000 { | |
| 184 | + control: control@140000 { | |
| 185 | 185 | compatible = "ti,dm814-scm", "simple-bus"; |
| 186 | − reg = <0x160000 0x16d000>; | |
| 186 | + reg = <0x140000 0x16d000>; | |
| 187 | 187 | #address-cells = <1>; |
| 188 | 188 | #size-cells = <1>; |
| 189 | 189 | ranges = <0 0x160000 0x16d000>; |
| @@ -321,9 +321,9 @@ · 131 unmodified lines | ||
| 321 | 321 | mac-address = [ 00 00 00 00 00 00 ]; |
| 322 | 322 | }; |
| 323 | 323 | |
| 324 | − phy_sel: cpsw-phy-sel@0x48160650 { | |
| 324 | + phy_sel: cpsw-phy-sel@48140650 { | |
| 325 | 325 | compatible = "ti,am3352-cpsw-phy-sel"; |
| 326 | − reg= <0x48160650 0x4>; | |
| 326 | + reg= <0x48140650 0x4>; | |
| 327 | 327 | reg-names = "gmii-sel"; |
| 328 | 328 | }; |
| 329 | 329 | }; |
| @@ -120,9 +120,10 @@ · 119 unmodified lines | ||
| 120 | 120 | reg = <0x0 0x1400>; |
| 121 | 121 | #address-cells = <1>; |
| 122 | 122 | #size-cells = <1>; |
| 123 | + ranges = <0 0x0 0x1400>; | |
| 123 | 124 | |
| 124 | 125 | pbias_regulator: pbias_regulator { |
| 125 | − compatible = "ti,pbias-omap"; | |
| 126 | + compatible = "ti,pbias-dra7", "ti,pbias-omap"; | |
| 126 | 127 | reg = <0xe00 0x4>; |
| 127 | 128 | syscon = <&scm_conf>; |
| 128 | 129 | pbias_mmc_reg: pbias_mmc_omap5 { |
| @@ -1417,7 +1418,7 @@ · 1288 unmodified lines | ||
| 1417 | 1418 | ti,irqs-safe-map = <0>; |
| 1418 | 1419 | }; |
| 1419 | 1420 | |
| 1420 | − mac: ethernet@4a100000 { | |
| 1421 | + mac: ethernet@48484000 { | |
| 1421 | 1422 | compatible = "ti,dra7-cpsw","ti,cpsw"; |
| 1422 | 1423 | ti,hwmods = "gmac"; |
| 1423 | 1424 | clocks = <&dpll_gmac_ck>, <&gmac_gmii_ref_clk_div>; |
| @@ -56,6 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | reg = <0x270 0x240>; |
| 57 | 57 | #address-cells = <1>; |
| 58 | 58 | #size-cells = <1>; |
| 59 | + ranges = <0 0x270 0x240>; | |
| 59 | 60 | |
| 60 | 61 | scm_clocks: clocks { |
| 61 | 62 | #address-cells = <1>; |
| @@ -63,7 +64,7 @@ · 1 unmodified line | ||
| 63 | 64 | }; |
| 64 | 65 | |
| 65 | 66 | pbias_regulator: pbias_regulator { |
| 66 | − compatible = "ti,pbias-omap"; | |
| 67 | + compatible = "ti,pbias-omap2", "ti,pbias-omap"; | |
| 67 | 68 | reg = <0x230 0x4>; |
| 68 | 69 | syscon = <&scm_conf>; |
| 69 | 70 | pbias_mmc_reg: pbias_mmc_omap2430 { |
| @@ -202,7 +202,7 @@ · 201 unmodified lines | ||
| 202 | 202 | |
| 203 | 203 | tfp410_pins: pinmux_tfp410_pins { |
| 204 | 204 | pinctrl-single,pins = < |
| 205 | − 0x194 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ | |
| 205 | + 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ | |
| 206 | 206 | >; |
| 207 | 207 | }; |
| 208 | 208 | |
| @@ -78,12 +78,6 @@ · 77 unmodified lines | ||
| 78 | 78 | >; |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | − smsc9221_pins: pinmux_smsc9221_pins { | |
| 82 | − pinctrl-single,pins = < | |
| 83 | − 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */ | |
| 84 | − >; | |
| 85 | − }; | |
| 86 | − | |
| 87 | 81 | i2c1_pins: pinmux_i2c1_pins { |
| 88 | 82 | pinctrl-single,pins = < |
| 89 | 83 | 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */ |
| @@ -156,6 +156,12 @@ · 155 unmodified lines | ||
| 156 | 156 | OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */ |
| 157 | 157 | >; |
| 158 | 158 | }; |
| 159 | + | |
| 160 | + smsc9221_pins: pinmux_smsc9221_pins { | |
| 161 | + pinctrl-single,pins = < | |
| 162 | + OMAP3_CORE1_IOPAD(0x21d2, PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */ | |
| 163 | + >; | |
| 164 | + }; | |
| 159 | 165 | }; |
| 160 | 166 | |
| 161 | 167 | &omap3_pmx_core2 { |
| @@ -113,10 +113,22 @@ · 112 unmodified lines | ||
| 113 | 113 | }; |
| 114 | 114 | |
| 115 | 115 | scm_conf: scm_conf@270 { |
| 116 | − compatible = "syscon"; | |
| 116 | + compatible = "syscon", "simple-bus"; | |
| 117 | 117 | reg = <0x270 0x330>; |
| 118 | 118 | #address-cells = <1>; |
| 119 | 119 | #size-cells = <1>; |
| 120 | + ranges = <0 0x270 0x330>; | |
| 121 | + | |
| 122 | + pbias_regulator: pbias_regulator { | |
| 123 | + compatible = "ti,pbias-omap3", "ti,pbias-omap"; | |
| 124 | + reg = <0x2b0 0x4>; | |
| 125 | + syscon = <&scm_conf>; | |
| 126 | + pbias_mmc_reg: pbias_mmc_omap2430 { | |
| 127 | + regulator-name = "pbias_mmc_omap2430"; | |
| 128 | + regulator-min-microvolt = <1800000>; | |
| 129 | + regulator-max-microvolt = <3000000>; | |
| 130 | + }; | |
| 131 | + }; | |
| 120 | 132 | |
| 121 | 133 | scm_clocks: clocks { |
| 122 | 134 | #address-cells = <1>; |
| @@ -202,17 +214,6 @@ · 79 unmodified lines | ||
| 202 | 214 | dma-requests = <96>; |
| 203 | 215 | }; |
| 204 | 216 | |
| 205 | − pbias_regulator: pbias_regulator { | |
| 206 | − compatible = "ti,pbias-omap"; | |
| 207 | − reg = <0x2b0 0x4>; | |
| 208 | − syscon = <&scm_conf>; | |
| 209 | − pbias_mmc_reg: pbias_mmc_omap2430 { | |
| 210 | − regulator-name = "pbias_mmc_omap2430"; | |
| 211 | − regulator-min-microvolt = <1800000>; | |
| 212 | − regulator-max-microvolt = <3000000>; | |
| 213 | − }; | |
| 214 | − }; | |
| 215 | − | |
| 216 | 217 | gpio1: gpio@48310000 { |
| 217 | 218 | compatible = "ti,omap3-gpio"; |
| 218 | 219 | reg = <0x48310000 0x200>; |
| @@ -196,9 +196,10 @@ · 195 unmodified lines | ||
| 196 | 196 | reg = <0x5a0 0x170>; |
| 197 | 197 | #address-cells = <1>; |
| 198 | 198 | #size-cells = <1>; |
| 199 | + ranges = <0 0x5a0 0x170>; | |
| 199 | 200 | |
| 200 | 201 | pbias_regulator: pbias_regulator { |
| 201 | − compatible = "ti,pbias-omap"; | |
| 202 | + compatible = "ti,pbias-omap4", "ti,pbias-omap"; | |
| 202 | 203 | reg = <0x60 0x4>; |
| 203 | 204 | syscon = <&omap4_padconf_global>; |
| 204 | 205 | pbias_mmc_reg: pbias_mmc_omap4 { |
| @@ -174,8 +174,8 @@ · 173 unmodified lines | ||
| 174 | 174 | |
| 175 | 175 | i2c5_pins: pinmux_i2c5_pins { |
| 176 | 176 | pinctrl-single,pins = < |
| 177 | − 0x184 (PIN_INPUT | MUX_MODE0) /* i2c5_scl */ | |
| 178 | − 0x186 (PIN_INPUT | MUX_MODE0) /* i2c5_sda */ | |
| 177 | + 0x186 (PIN_INPUT | MUX_MODE0) /* i2c5_scl */ | |
| 178 | + 0x188 (PIN_INPUT | MUX_MODE0) /* i2c5_sda */ | |
| 179 | 179 | >; |
| 180 | 180 | }; |
| 181 | 181 | |
| @@ -185,9 +185,10 @@ · 184 unmodified lines | ||
| 185 | 185 | reg = <0x5a0 0xec>; |
| 186 | 186 | #address-cells = <1>; |
| 187 | 187 | #size-cells = <1>; |
| 188 | + ranges = <0 0x5a0 0xec>; | |
| 188 | 189 | |
| 189 | 190 | pbias_regulator: pbias_regulator { |
| 190 | − compatible = "ti,pbias-omap"; | |
| 191 | + compatible = "ti,pbias-omap5", "ti,pbias-omap"; | |
| 191 | 192 | reg = <0x60 0x4>; |
| 192 | 193 | syscon = <&omap5_padconf_global>; |
| 193 | 194 | pbias_mmc_reg: pbias_mmc_omap5 { |
| @@ -158,6 +158,7 @@ · 157 unmodified lines | ||
| 158 | 158 | }; |
| 159 | 159 | |
| 160 | 160 | &hdmi { |
| 161 | + ddc-i2c-bus = <&i2c5>; | |
| 161 | 162 | status = "okay"; |
| 162 | 163 | }; |
| 163 | 164 | |
| @@ -103,48 +103,46 @@ · 102 unmodified lines | ||
| 103 | 103 | <&clk_s_d0_quadfs 0>, |
| 104 | 104 | <&clk_s_d2_quadfs 0>, |
| 105 | 105 | <&clk_s_d2_quadfs 0>; |
| 106 | − ranges; | |
| 107 | − | |
| 108 | − sti-hdmi@8d04000 { | |
| 109 | − compatible = "st,stih407-hdmi"; | |
| 110 | − reg = <0x8d04000 0x1000>; | |
| 111 | − reg-names = "hdmi-reg"; | |
| 112 | − interrupts = <GIC_SPI 106 IRQ_TYPE_NONE>; | |
| 113 | − interrupt-names = "irq"; | |
| 114 | − clock-names = "pix", | |
| 115 | − "tmds", | |
| 116 | − "phy", | |
| 117 | − "audio", | |
| 118 | − "main_parent", | |
| 119 | − "aux_parent"; | |
| 120 | − | |
| 121 | − clocks = <&clk_s_d2_flexgen CLK_PIX_HDMI>, | |
| 122 | − <&clk_s_d2_flexgen CLK_TMDS_HDMI>, | |
| 123 | − <&clk_s_d2_flexgen CLK_REF_HDMIPHY>, | |
| 124 | − <&clk_s_d0_flexgen CLK_PCM_0>, | |
| 125 | − <&clk_s_d2_quadfs 0>, | |
| 126 | − <&clk_s_d2_quadfs 1>; | |
| 127 | − | |
| 128 | − hdmi,hpd-gpio = <&pio5 3>; | |
| 129 | − reset-names = "hdmi"; | |
| 130 | − resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>; | |
| 131 | − ddc = <&hdmiddc>; | |
| 132 | − | |
| 133 | − }; | |
| 134 | − | |
| 135 | − sti-hda@8d02000 { | |
| 136 | − compatible = "st,stih407-hda"; | |
| 137 | − reg = <0x8d02000 0x400>, <0x92b0120 0x4>; | |
| 138 | − reg-names = "hda-reg", "video-dacs-ctrl"; | |
| 139 | − clock-names = "pix", | |
| 140 | − "hddac", | |
| 141 | − "main_parent", | |
| 142 | − "aux_parent"; | |
| 143 | − clocks = <&clk_s_d2_flexgen CLK_PIX_HDDAC>, | |
| 144 | − <&clk_s_d2_flexgen CLK_HDDAC>, | |
| 145 | − <&clk_s_d2_quadfs 0>, | |
| 146 | − <&clk_s_d2_quadfs 1>; | |
| 147 | − }; | |
| 106 | + }; | |
| 107 | + | |
| 108 | + sti-hdmi@8d04000 { | |
| 109 | + compatible = "st,stih407-hdmi"; | |
| 110 | + reg = <0x8d04000 0x1000>; | |
| 111 | + reg-names = "hdmi-reg"; | |
| 112 | + interrupts = <GIC_SPI 106 IRQ_TYPE_NONE>; | |
| 113 | + interrupt-names = "irq"; | |
| 114 | + clock-names = "pix", | |
| 115 | + "tmds", | |
| 116 | + "phy", | |
| 117 | + "audio", | |
| 118 | + "main_parent", | |
| 119 | + "aux_parent"; | |
| 120 | + | |
| 121 | + clocks = <&clk_s_d2_flexgen CLK_PIX_HDMI>, | |
| 122 | + <&clk_s_d2_flexgen CLK_TMDS_HDMI>, | |
| 123 | + <&clk_s_d2_flexgen CLK_REF_HDMIPHY>, | |
| 124 | + <&clk_s_d0_flexgen CLK_PCM_0>, | |
| 125 | + <&clk_s_d2_quadfs 0>, | |
| 126 | + <&clk_s_d2_quadfs 1>; | |
| 127 | + | |
| 128 | + hdmi,hpd-gpio = <&pio5 3>; | |
| 129 | + reset-names = "hdmi"; | |
| 130 | + resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>; | |
| 131 | + ddc = <&hdmiddc>; | |
| 132 | + }; | |
| 133 | + | |
| 134 | + sti-hda@8d02000 { | |
| 135 | + compatible = "st,stih407-hda"; | |
| 136 | + reg = <0x8d02000 0x400>, <0x92b0120 0x4>; | |
| 137 | + reg-names = "hda-reg", "video-dacs-ctrl"; | |
| 138 | + clock-names = "pix", | |
| 139 | + "hddac", | |
| 140 | + "main_parent", | |
| 141 | + "aux_parent"; | |
| 142 | + clocks = <&clk_s_d2_flexgen CLK_PIX_HDDAC>, | |
| 143 | + <&clk_s_d2_flexgen CLK_HDDAC>, | |
| 144 | + <&clk_s_d2_quadfs 0>, | |
| 145 | + <&clk_s_d2_quadfs 1>; | |
| 148 | 146 | }; |
| 149 | 147 | }; |
| 150 | 148 | }; |
| @@ -178,48 +178,46 @@ · 177 unmodified lines | ||
| 178 | 178 | <&clk_s_d0_quadfs 0>, |
| 179 | 179 | <&clk_s_d2_quadfs 0>, |
| 180 | 180 | <&clk_s_d2_quadfs 0>; |
| 181 | − ranges; | |
| 182 | − | |
| 183 | − sti-hdmi@8d04000 { | |
| 184 | − compatible = "st,stih407-hdmi"; | |
| 185 | − reg = <0x8d04000 0x1000>; | |
| 186 | − reg-names = "hdmi-reg"; | |
| 187 | − interrupts = <GIC_SPI 106 IRQ_TYPE_NONE>; | |
| 188 | − interrupt-names = "irq"; | |
| 189 | − clock-names = "pix", | |
| 190 | − "tmds", | |
| 191 | − "phy", | |
| 192 | − "audio", | |
| 193 | − "main_parent", | |
| 194 | − "aux_parent"; | |
| 195 | − | |
| 196 | − clocks = <&clk_s_d2_flexgen CLK_PIX_HDMI>, | |
| 197 | − <&clk_s_d2_flexgen CLK_TMDS_HDMI>, | |
| 198 | − <&clk_s_d2_flexgen CLK_REF_HDMIPHY>, | |
| 199 | − <&clk_s_d0_flexgen CLK_PCM_0>, | |
| 200 | − <&clk_s_d2_quadfs 0>, | |
| 201 | − <&clk_s_d2_quadfs 1>; | |
| 202 | − | |
| 203 | − hdmi,hpd-gpio = <&pio5 3>; | |
| 204 | − reset-names = "hdmi"; | |
| 205 | − resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>; | |
| 206 | − ddc = <&hdmiddc>; | |
| 207 | − | |
| 208 | − }; | |
| 209 | − | |
| 210 | − sti-hda@8d02000 { | |
| 211 | − compatible = "st,stih407-hda"; | |
| 212 | − reg = <0x8d02000 0x400>, <0x92b0120 0x4>; | |
| 213 | − reg-names = "hda-reg", "video-dacs-ctrl"; | |
| 214 | − clock-names = "pix", | |
| 215 | − "hddac", | |
| 216 | − "main_parent", | |
| 217 | − "aux_parent"; | |
| 218 | − clocks = <&clk_s_d2_flexgen CLK_PIX_HDDAC>, | |
| 219 | − <&clk_s_d2_flexgen CLK_HDDAC>, | |
| 220 | − <&clk_s_d2_quadfs 0>, | |
| 221 | − <&clk_s_d2_quadfs 1>; | |
| 222 | − }; | |
| 181 | + }; | |
| 182 | + | |
| 183 | + sti-hdmi@8d04000 { | |
| 184 | + compatible = "st,stih407-hdmi"; | |
| 185 | + reg = <0x8d04000 0x1000>; | |
| 186 | + reg-names = "hdmi-reg"; | |
| 187 | + interrupts = <GIC_SPI 106 IRQ_TYPE_NONE>; | |
| 188 | + interrupt-names = "irq"; | |
| 189 | + clock-names = "pix", | |
| 190 | + "tmds", | |
| 191 | + "phy", | |
| 192 | + "audio", | |
| 193 | + "main_parent", | |
| 194 | + "aux_parent"; | |
| 195 | + | |
| 196 | + clocks = <&clk_s_d2_flexgen CLK_PIX_HDMI>, | |
| 197 | + <&clk_s_d2_flexgen CLK_TMDS_HDMI>, | |
| 198 | + <&clk_s_d2_flexgen CLK_REF_HDMIPHY>, | |
| 199 | + <&clk_s_d0_flexgen CLK_PCM_0>, | |
| 200 | + <&clk_s_d2_quadfs 0>, | |
| 201 | + <&clk_s_d2_quadfs 1>; | |
| 202 | + | |
| 203 | + hdmi,hpd-gpio = <&pio5 3>; | |
| 204 | + reset-names = "hdmi"; | |
| 205 | + resets = <&softreset STIH407_HDMI_TX_PHY_SOFTRESET>; | |
| 206 | + ddc = <&hdmiddc>; | |
| 207 | + }; | |
| 208 | + | |
| 209 | + sti-hda@8d02000 { | |
| 210 | + compatible = "st,stih407-hda"; | |
| 211 | + reg = <0x8d02000 0x400>, <0x92b0120 0x4>; | |
| 212 | + reg-names = "hda-reg", "video-dacs-ctrl"; | |
| 213 | + clock-names = "pix", | |
| 214 | + "hddac", | |
| 215 | + "main_parent", | |
| 216 | + "aux_parent"; | |
| 217 | + clocks = <&clk_s_d2_flexgen CLK_PIX_HDDAC>, | |
| 218 | + <&clk_s_d2_flexgen CLK_HDDAC>, | |
| 219 | + <&clk_s_d2_quadfs 0>, | |
| 220 | + <&clk_s_d2_quadfs 1>; | |
| 223 | 221 | }; |
| 224 | 222 | }; |
| 225 | 223 | |
| @@ -240,7 +240,8 @@ CONFIG_SSI_PROTOCOL=m · 239 unmodified lines | ||
| 240 | 240 | CONFIG_PINCTRL_SINGLE=y |
| 241 | 241 | CONFIG_DEBUG_GPIO=y |
| 242 | 242 | CONFIG_GPIO_SYSFS=y |
| 243 | −CONFIG_GPIO_PCF857X=m | |
| 243 | +CONFIG_GPIO_PCA953X=m | |
| 244 | +CONFIG_GPIO_PCF857X=y | |
| 244 | 245 | CONFIG_GPIO_TWL4030=y |
| 245 | 246 | CONFIG_GPIO_PALMAS=y |
| 246 | 247 | CONFIG_W1=m |
| @@ -350,6 +351,8 @@ CONFIG_USB_MUSB_HDRC=m · 103 unmodified lines | ||
| 350 | 351 | CONFIG_USB_MUSB_OMAP2PLUS=m |
| 351 | 352 | CONFIG_USB_MUSB_AM35X=m |
| 352 | 353 | CONFIG_USB_MUSB_DSPS=m |
| 354 | +CONFIG_USB_INVENTRA_DMA=y | |
| 355 | +CONFIG_USB_TI_CPPI41_DMA=y | |
| 353 | 356 | CONFIG_USB_DWC3=m |
| 354 | 357 | CONFIG_USB_TEST=m |
| 355 | 358 | CONFIG_AM335X_PHY_USB=y |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #define KVM_PRIVATE_MEM_SLOTS 4 |
| 34 | 34 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
| 35 | 35 | #define KVM_HAVE_ONE_REG |
| 36 | +#define KVM_HALT_POLL_NS_DEFAULT 500000 | |
| 36 | 37 | |
| 37 | 38 | #define KVM_VCPU_MAX_FEATURES 2 |
| 38 | 39 | |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | * This may need to be greater than __NR_last_syscall+1 in order to |
| 20 | 20 | * account for the padding in the syscall table |
| 21 | 21 | */ |
| 22 | −#define __NR_syscalls (388) | |
| 22 | +#define __NR_syscalls (392) | |
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | 25 | * *NOTE*: This is a ghost syscall private to the kernel. Only the |
| @@ -414,6 +414,8 @@ · 413 unmodified lines | ||
| 414 | 414 | #define __NR_memfd_create (__NR_SYSCALL_BASE+385) |
| 415 | 415 | #define __NR_bpf (__NR_SYSCALL_BASE+386) |
| 416 | 416 | #define __NR_execveat (__NR_SYSCALL_BASE+387) |
| 417 | +#define __NR_userfaultfd (__NR_SYSCALL_BASE+388) | |
| 418 | +#define __NR_membarrier (__NR_SYSCALL_BASE+389) | |
| 417 | 419 | |
| 418 | 420 | /* |
| 419 | 421 | * The following SWIs are ARM private. |
| @@ -397,6 +397,8 @@ · 396 unmodified lines | ||
| 397 | 397 | /* 385 */ CALL(sys_memfd_create) |
| 398 | 398 | CALL(sys_bpf) |
| 399 | 399 | CALL(sys_execveat) |
| 400 | + CALL(sys_userfaultfd) | |
| 401 | + CALL(sys_membarrier) | |
| 400 | 402 | #ifndef syscalls_counted |
| 401 | 403 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
| 402 | 404 | #define syscalls_counted |
| @@ -44,10 +44,11 @@ config SOC_OMAP5 · 43 unmodified lines | ||
| 44 | 44 | select ARM_CPU_SUSPEND if PM |
| 45 | 45 | select ARM_GIC |
| 46 | 46 | select HAVE_ARM_SCU if SMP |
| 47 | − select HAVE_ARM_TWD if SMP | |
| 48 | 47 | select HAVE_ARM_ARCH_TIMER |
| 49 | 48 | select ARM_ERRATA_798181 if SMP |
| 49 | + select OMAP_INTERCONNECT | |
| 50 | 50 | select OMAP_INTERCONNECT_BARRIER |
| 51 | + select PM_OPP if PM | |
| 51 | 52 | |
| 52 | 53 | config SOC_AM33XX |
| 53 | 54 | bool "TI AM33XX" |
| @@ -70,10 +71,13 @@ config SOC_DRA7XX · 16 unmodified lines | ||
| 70 | 71 | select ARCH_OMAP2PLUS |
| 71 | 72 | select ARM_CPU_SUSPEND if PM |
| 72 | 73 | select ARM_GIC |
| 74 | + select HAVE_ARM_SCU if SMP | |
| 73 | 75 | select HAVE_ARM_ARCH_TIMER |
| 74 | 76 | select IRQ_CROSSBAR |
| 75 | 77 | select ARM_ERRATA_798181 if SMP |
| 78 | + select OMAP_INTERCONNECT | |
| 76 | 79 | select OMAP_INTERCONNECT_BARRIER |
| 80 | + select PM_OPP if PM | |
| 77 | 81 | |
| 78 | 82 | config ARCH_OMAP2PLUS |
| 79 | 83 | bool |
| @@ -20,13 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #include "common.h" |
| 22 | 22 | |
| 23 | −#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)) | |
| 24 | −#define intc_of_init NULL | |
| 25 | −#endif | |
| 26 | −#ifndef CONFIG_ARCH_OMAP4 | |
| 27 | −#define gic_of_init NULL | |
| 28 | −#endif | |
| 29 | − | |
| 30 | 23 | static const struct of_device_id omap_dt_match_table[] __initconst = { |
| 31 | 24 | { .compatible = "simple-bus", }, |
| 32 | 25 | { .compatible = "ti,omap-infra", }, |
| @@ -653,8 +653,12 @@ void __init dra7xxx_check_revision(void) · 652 unmodified lines | ||
| 653 | 653 | omap_revision = DRA752_REV_ES1_0; |
| 654 | 654 | break; |
| 655 | 655 | case 1: |
| 656 | − default: | |
| 657 | 656 | omap_revision = DRA752_REV_ES1_1; |
| 657 | + break; | |
| 658 | + case 2: | |
| 659 | + default: | |
| 660 | + omap_revision = DRA752_REV_ES2_0; | |
| 661 | + break; | |
| 658 | 662 | } |
| 659 | 663 | break; |
| 660 | 664 | |
| @@ -674,7 +678,7 @@ void __init dra7xxx_check_revision(void) · 13 unmodified lines | ||
| 674 | 678 | /* Unknown default to latest silicon rev as default*/ |
| 675 | 679 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%x)\n", |
| 676 | 680 | __func__, idcode, hawkeye, rev); |
| 677 | − omap_revision = DRA752_REV_ES1_1; | |
| 681 | + omap_revision = DRA752_REV_ES2_0; | |
| 678 | 682 | } |
| 679 | 683 | |
| 680 | 684 | sprintf(soc_name, "DRA%03x", omap_rev() >> 16); |
| @@ -676,6 +676,7 @@ void __init am43xx_init_early(void) · 675 unmodified lines | ||
| 676 | 676 | void __init am43xx_init_late(void) |
| 677 | 677 | { |
| 678 | 678 | omap_common_late_init(); |
| 679 | + omap2_clk_enable_autoidle_all(); | |
| 679 | 680 | } |
| 680 | 681 | #endif |
| 681 | 682 | |
| @@ -901,7 +901,8 @@ static int __init omap_device_late_idle(struct device *dev, void *data) · 900 unmodified lines | ||
| 901 | 901 | if (od->hwmods[i]->flags & HWMOD_INIT_NO_IDLE) |
| 902 | 902 | return 0; |
| 903 | 903 | |
| 904 | − if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) { | |
| 904 | + if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER && | |
| 905 | + od->_driver_status != BUS_NOTIFY_BIND_DRIVER) { | |
| 905 | 906 | if (od->_state == OMAP_DEVICE_STATE_ENABLED) { |
| 906 | 907 | dev_warn(dev, "%s: enabled but no driver. Idling\n", |
| 907 | 908 | __func__); |
| @@ -103,7 +103,8 @@ static inline void enable_omap3630_toggle_l2_on_restore(void) { } · 102 unmodified lines | ||
| 103 | 103 | #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) |
| 104 | 104 | #define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1) |
| 105 | 105 | |
| 106 | −#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) | |
| 106 | +#if defined(CONFIG_PM) && (defined(CONFIG_ARCH_OMAP4) ||\ | |
| 107 | + defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)) | |
| 107 | 108 | extern u16 pm44xx_errata; |
| 108 | 109 | #define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id)) |
| 109 | 110 | #else |
| @@ -469,6 +469,8 @@ IS_OMAP_TYPE(3430, 0x3430) · 468 unmodified lines | ||
| 469 | 469 | #define DRA7XX_CLASS 0x07000000 |
| 470 | 470 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) |
| 471 | 471 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) |
| 472 | +#define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8)) | |
| 473 | +#define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) | |
| 472 | 474 | #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) |
| 473 | 475 | |
| 474 | 476 | void omap2xxx_check_revision(void); |
| @@ -297,12 +297,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, · 296 unmodified lines | ||
| 297 | 297 | if (IS_ERR(src)) |
| 298 | 298 | return PTR_ERR(src); |
| 299 | 299 | |
| 300 | − r = clk_set_parent(timer->fclk, src); | |
| 301 | − if (r < 0) { | |
| 302 | − pr_warn("%s: %s cannot set source\n", __func__, oh->name); | |
| 303 | − clk_put(src); | |
| 304 | − return r; | |
| 305 | − } | |
| 300 | + WARN(clk_set_parent(timer->fclk, src) < 0, | |
| 301 | + "Cannot set timer parent clock, no PLL clock driver?"); | |
| 306 | 302 | |
| 307 | 303 | clk_put(src); |
| 308 | 304 | |
| @@ -300,7 +300,7 @@ static void __init omap3_vc_init_pmic_signaling(struct voltagedomain *voltdm) · 299 unmodified lines | ||
| 300 | 300 | |
| 301 | 301 | val = voltdm->read(OMAP3_PRM_POLCTRL_OFFSET); |
| 302 | 302 | if (!(val & OMAP3430_PRM_POLCTRL_CLKREQ_POL) || |
| 303 | − (val & OMAP3430_PRM_POLCTRL_CLKREQ_POL)) { | |
| 303 | + (val & OMAP3430_PRM_POLCTRL_OFFMODE_POL)) { | |
| 304 | 304 | val |= OMAP3430_PRM_POLCTRL_CLKREQ_POL; |
| 305 | 305 | val &= ~OMAP3430_PRM_POLCTRL_OFFMODE_POL; |
| 306 | 306 | pr_debug("PM: fixing sys_clkreq and sys_off_mode polarity to 0x%x\n", |
| @@ -502,7 +502,7 @@ static void balloon3_irq_handler(struct irq_desc *desc) · 501 unmodified lines | ||
| 502 | 502 | balloon3_irq_enabled; |
| 503 | 503 | do { |
| 504 | 504 | struct irq_data *d = irq_desc_get_irq_data(desc); |
| 505 | − struct irq_chip *chip = irq_data_get_chip(d); | |
| 505 | + struct irq_chip *chip = irq_desc_get_chip(desc); | |
| 506 | 506 | unsigned int irq; |
| 507 | 507 | |
| 508 | 508 | /* clear useless edge notification */ |
| @@ -43,6 +43,13 @@ · 42 unmodified lines | ||
| 43 | 43 | * 0xf6200000..0xf6201000 |
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | +/* | |
| 47 | + * DFI Bus for NAND, PXA3xx only | |
| 48 | + */ | |
| 49 | +#define NAND_PHYS 0x43100000 | |
| 50 | +#define NAND_VIRT IOMEM(0xf6300000) | |
| 51 | +#define NAND_SIZE 0x00100000 | |
| 52 | + | |
| 46 | 53 | /* |
| 47 | 54 | * Internal Memory Controller (PXA27x and later) |
| 48 | 55 | */ |
| @@ -47,6 +47,13 @@ extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)); · 46 unmodified lines | ||
| 47 | 47 | #define ISRAM_START 0x5c000000 |
| 48 | 48 | #define ISRAM_SIZE SZ_256K |
| 49 | 49 | |
| 50 | +/* | |
| 51 | + * NAND NFC: DFI bus arbitration subset | |
| 52 | + */ | |
| 53 | +#define NDCR (*(volatile u32 __iomem*)(NAND_VIRT + 0)) | |
| 54 | +#define NDCR_ND_ARB_EN (1 << 12) | |
| 55 | +#define NDCR_ND_ARB_CNTL (1 << 19) | |
| 56 | + | |
| 50 | 57 | static void __iomem *sram; |
| 51 | 58 | static unsigned long wakeup_src; |
| 52 | 59 | |
| @@ -362,7 +369,12 @@ static struct map_desc pxa3xx_io_desc[] __initdata = { · 309 unmodified lines | ||
| 362 | 369 | .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE), |
| 363 | 370 | .length = SMEMC_SIZE, |
| 364 | 371 | .type = MT_DEVICE |
| 365 | − } | |
| 372 | + }, { | |
| 373 | + .virtual = (unsigned long)NAND_VIRT, | |
| 374 | + .pfn = __phys_to_pfn(NAND_PHYS), | |
| 375 | + .length = NAND_SIZE, | |
| 376 | + .type = MT_DEVICE | |
| 377 | + }, | |
| 366 | 378 | }; |
| 367 | 379 | |
| 368 | 380 | void __init pxa3xx_map_io(void) |
| @@ -419,6 +431,13 @@ static int __init pxa3xx_init(void) · 50 unmodified lines | ||
| 419 | 431 | */ |
| 420 | 432 | ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); |
| 421 | 433 | |
| 434 | + /* | |
| 435 | + * Disable DFI bus arbitration, to prevent a system bus lock if | |
| 436 | + * somebody disables the NAND clock (unused clock) while this | |
| 437 | + * bit remains set. | |
| 438 | + */ | |
| 439 | + NDCR = (NDCR & ~NDCR_ND_ARB_EN) | NDCR_ND_ARB_CNTL; | |
| 440 | + | |
| 422 | 441 | if ((ret = pxa_init_dma(IRQ_DMA, 32))) |
| 423 | 442 | return ret; |
| 424 | 443 | |
| @@ -365,15 +365,21 @@ do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *r · 364 unmodified lines | ||
| 365 | 365 | user: |
| 366 | 366 | if (LDST_L_BIT(instr)) { |
| 367 | 367 | unsigned long val; |
| 368 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 369 | + | |
| 368 | 370 | get16t_unaligned_check(val, addr); |
| 371 | + uaccess_restore(__ua_flags); | |
| 369 | 372 | |
| 370 | 373 | /* signed half-word? */ |
| 371 | 374 | if (instr & 0x40) |
| 372 | 375 | val = (signed long)((signed short) val); |
| 373 | 376 | |
| 374 | 377 | regs->uregs[rd] = val; |
| 375 | − } else | |
| 378 | + } else { | |
| 379 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 376 | 380 | put16t_unaligned_check(regs->uregs[rd], addr); |
| 381 | + uaccess_restore(__ua_flags); | |
| 382 | + } | |
| 377 | 383 | |
| 378 | 384 | return TYPE_LDST; |
| 379 | 385 | |
| @@ -420,14 +426,21 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, · 40 unmodified lines | ||
| 420 | 426 | |
| 421 | 427 | user: |
| 422 | 428 | if (load) { |
| 423 | − unsigned long val; | |
| 429 | + unsigned long val, val2; | |
| 430 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 431 | + | |
| 424 | 432 | get32t_unaligned_check(val, addr); |
| 433 | + get32t_unaligned_check(val2, addr + 4); | |
| 434 | + | |
| 435 | + uaccess_restore(__ua_flags); | |
| 436 | + | |
| 425 | 437 | regs->uregs[rd] = val; |
| 426 | − get32t_unaligned_check(val, addr + 4); | |
| 427 | − regs->uregs[rd2] = val; | |
| 438 | + regs->uregs[rd2] = val2; | |
| 428 | 439 | } else { |
| 440 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 429 | 441 | put32t_unaligned_check(regs->uregs[rd], addr); |
| 430 | 442 | put32t_unaligned_check(regs->uregs[rd2], addr + 4); |
| 443 | + uaccess_restore(__ua_flags); | |
| 431 | 444 | } |
| 432 | 445 | |
| 433 | 446 | return TYPE_LDST; |
| @@ -458,10 +471,15 @@ do_alignment_ldrstr(unsigned long addr, unsigned long instr, struct pt_regs *reg · 24 unmodified lines | ||
| 458 | 471 | trans: |
| 459 | 472 | if (LDST_L_BIT(instr)) { |
| 460 | 473 | unsigned int val; |
| 474 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 461 | 475 | get32t_unaligned_check(val, addr); |
| 476 | + uaccess_restore(__ua_flags); | |
| 462 | 477 | regs->uregs[rd] = val; |
| 463 | − } else | |
| 478 | + } else { | |
| 479 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 464 | 480 | put32t_unaligned_check(regs->uregs[rd], addr); |
| 481 | + uaccess_restore(__ua_flags); | |
| 482 | + } | |
| 465 | 483 | return TYPE_LDST; |
| 466 | 484 | |
| 467 | 485 | fault: |
| @@ -531,6 +549,7 @@ do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *reg · 63 unmodified lines | ||
| 531 | 549 | #endif |
| 532 | 550 | |
| 533 | 551 | if (user_mode(regs)) { |
| 552 | + unsigned int __ua_flags = uaccess_save_and_enable(); | |
| 534 | 553 | for (regbits = REGMASK_BITS(instr), rd = 0; regbits; |
| 535 | 554 | regbits >>= 1, rd += 1) |
| 536 | 555 | if (regbits & 1) { |
| @@ -542,6 +561,7 @@ do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *reg · 5 unmodified lines | ||
| 542 | 561 | put32t_unaligned_check(regs->uregs[rd], eaddr); |
| 543 | 562 | eaddr += 4; |
| 544 | 563 | } |
| 564 | + uaccess_restore(__ua_flags); | |
| 545 | 565 | } else { |
| 546 | 566 | for (regbits = REGMASK_BITS(instr), rd = 0; regbits; |
| 547 | 567 | regbits >>= 1, rd += 1) |
| @@ -107,7 +107,6 @@ static const struct of_device_id pxa_ssp_of_ids[] = { · 106 unmodified lines | ||
| 107 | 107 | { .compatible = "mvrl,pxa168-ssp", .data = (void *) PXA168_SSP }, |
| 108 | 108 | { .compatible = "mrvl,pxa910-ssp", .data = (void *) PXA910_SSP }, |
| 109 | 109 | { .compatible = "mrvl,ce4100-ssp", .data = (void *) CE4100_SSP }, |
| 110 | − { .compatible = "mrvl,lpss-ssp", .data = (void *) LPSS_SSP }, | |
| 111 | 110 | { }, |
| 112 | 111 | }; |
| 113 | 112 | MODULE_DEVICE_TABLE(of, pxa_ssp_of_ids); |
| @@ -81,7 +81,7 @@ · 80 unmodified lines | ||
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | 83 | idle-states { |
| 84 | − entry-method = "arm,psci"; | |
| 84 | + entry-method = "psci"; | |
| 85 | 85 | |
| 86 | 86 | CPU_SLEEP_0: cpu-sleep-0 { |
| 87 | 87 | compatible = "arm,idle-state"; |
| @@ -106,7 +106,7 @@ · 105 unmodified lines | ||
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | idle-states { |
| 109 | − entry-method = "arm,psci"; | |
| 109 | + entry-method = "psci"; | |
| 110 | 110 | |
| 111 | 111 | cpu_sleep: cpu-sleep-0 { |
| 112 | 112 | compatible = "arm,idle-state"; |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #define KVM_USER_MEM_SLOTS 32 |
| 34 | 34 | #define KVM_PRIVATE_MEM_SLOTS 4 |
| 35 | 35 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
| 36 | +#define KVM_HALT_POLL_NS_DEFAULT 500000 | |
| 36 | 37 | |
| 37 | 38 | #include <kvm/arm_vgic.h> |
| 38 | 39 | #include <kvm/arm_arch_timer.h> |
| @@ -79,7 +79,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); · 78 unmodified lines | ||
| 79 | 79 | #define PAGE_S2 __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY) |
| 80 | 80 | #define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_UXN) |
| 81 | 81 | |
| 82 | −#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) | |
| 82 | +#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) | |
| 83 | 83 | #define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) |
| 84 | 84 | #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE) |
| 85 | 85 | #define PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) |
| @@ -496,7 +496,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long addr) · 410 unmodified lines | ||
| 496 | 496 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
| 497 | 497 | { |
| 498 | 498 | const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | |
| 499 | − PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK; | |
| 499 | + PTE_PROT_NONE | PTE_VALID | PTE_WRITE; | |
| 500 | 500 | /* preserve the hardware dirty information */ |
| 501 | 501 | if (pte_hw_dirty(pte)) |
| 502 | 502 | pte = pte_mkdirty(pte); |
| @@ -258,7 +258,8 @@ static bool __init efi_virtmap_init(void) · 257 unmodified lines | ||
| 258 | 258 | */ |
| 259 | 259 | if (!is_normal_ram(md)) |
| 260 | 260 | prot = __pgprot(PROT_DEVICE_nGnRE); |
| 261 | − else if (md->type == EFI_RUNTIME_SERVICES_CODE) | |
| 261 | + else if (md->type == EFI_RUNTIME_SERVICES_CODE || | |
| 262 | + !PAGE_ALIGNED(md->phys_addr)) | |
| 262 | 263 | prot = PAGE_KERNEL_EXEC; |
| 263 | 264 | else |
| 264 | 265 | prot = PAGE_KERNEL; |
| @@ -178,6 +178,24 @@ ENTRY(ftrace_stub) · 177 unmodified lines | ||
| 178 | 178 | ENDPROC(ftrace_stub) |
| 179 | 179 | |
| 180 | 180 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 181 | + /* save return value regs*/ | |
| 182 | + .macro save_return_regs | |
| 183 | + sub sp, sp, #64 | |
| 184 | + stp x0, x1, [sp] | |
| 185 | + stp x2, x3, [sp, #16] | |
| 186 | + stp x4, x5, [sp, #32] | |
| 187 | + stp x6, x7, [sp, #48] | |
| 188 | + .endm | |
| 189 | + | |
| 190 | + /* restore return value regs*/ | |
| 191 | + .macro restore_return_regs | |
| 192 | + ldp x0, x1, [sp] | |
| 193 | + ldp x2, x3, [sp, #16] | |
| 194 | + ldp x4, x5, [sp, #32] | |
| 195 | + ldp x6, x7, [sp, #48] | |
| 196 | + add sp, sp, #64 | |
| 197 | + .endm | |
| 198 | + | |
| 181 | 199 | /* |
| 182 | 200 | * void ftrace_graph_caller(void) |
| 183 | 201 | * |
| @@ -204,11 +222,11 @@ ENDPROC(ftrace_graph_caller) · 20 unmodified lines | ||
| 204 | 222 | * only when CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST is enabled. |
| 205 | 223 | */ |
| 206 | 224 | ENTRY(return_to_handler) |
| 207 | − str x0, [sp, #-16]! | |
| 225 | + save_return_regs | |
| 208 | 226 | mov x0, x29 // parent's fp |
| 209 | 227 | bl ftrace_return_to_handler// addr = ftrace_return_to_hander(fp); |
| 210 | 228 | mov x30, x0 // restore the original return address |
| 211 | − ldr x0, [sp], #16 | |
| 229 | + restore_return_regs | |
| 212 | 230 | ret |
| 213 | 231 | END(return_to_handler) |
| 214 | 232 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| @@ -20,4 +20,5 @@ generic-y += sections.h · 19 unmodified lines | ||
| 20 | 20 | generic-y += topology.h |
| 21 | 21 | generic-y += trace_clock.h |
| 22 | 22 | generic-y += vga.h |
| 23 | +generic-y += word-at-a-time.h | |
| 23 | 24 | generic-y += xor.h |
| @@ -46,4 +46,5 @@ generic-y += types.h · 45 unmodified lines | ||
| 46 | 46 | generic-y += ucontext.h |
| 47 | 47 | generic-y += unaligned.h |
| 48 | 48 | generic-y += user.h |
| 49 | +generic-y += word-at-a-time.h | |
| 49 | 50 | generic-y += xor.h |
| @@ -59,4 +59,5 @@ generic-y += types.h · 58 unmodified lines | ||
| 59 | 59 | generic-y += ucontext.h |
| 60 | 60 | generic-y += user.h |
| 61 | 61 | generic-y += vga.h |
| 62 | +generic-y += word-at-a-time.h | |
| 62 | 63 | generic-y += xor.h |
| @@ -43,4 +43,5 @@ generic-y += topology.h · 42 unmodified lines | ||
| 43 | 43 | generic-y += trace_clock.h |
| 44 | 44 | generic-y += types.h |
| 45 | 45 | generic-y += vga.h |
| 46 | +generic-y += word-at-a-time.h | |
| 46 | 47 | generic-y += xor.h |
| @@ -7,3 +7,4 @@ generic-y += mcs_spinlock.h · 6 unmodified lines | ||
| 7 | 7 | generic-y += mm-arch-hooks.h |
| 8 | 8 | generic-y += preempt.h |
| 9 | 9 | generic-y += trace_clock.h |
| 10 | +generic-y += word-at-a-time.h | |
| @@ -294,6 +294,8 @@ void pcibios_fixup_bus(struct pci_bus *bus) · 293 unmodified lines | ||
| 294 | 294 | printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); |
| 295 | 295 | #endif |
| 296 | 296 | |
| 297 | + pci_read_bridge_bases(bus); | |
| 298 | + | |
| 297 | 299 | if (bus->number == 0) { |
| 298 | 300 | struct pci_dev *dev; |
| 299 | 301 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| @@ -58,4 +58,5 @@ generic-y += types.h · 57 unmodified lines | ||
| 58 | 58 | generic-y += ucontext.h |
| 59 | 59 | generic-y += unaligned.h |
| 60 | 60 | generic-y += vga.h |
| 61 | +generic-y += word-at-a-time.h | |
| 61 | 62 | generic-y += xor.h |
| @@ -8,3 +8,4 @@ generic-y += mm-arch-hooks.h · 7 unmodified lines | ||
| 8 | 8 | generic-y += preempt.h |
| 9 | 9 | generic-y += trace_clock.h |
| 10 | 10 | generic-y += vtime.h |
| 11 | +generic-y += word-at-a-time.h | |
| @@ -533,9 +533,10 @@ void pcibios_fixup_bus(struct pci_bus *b) · 532 unmodified lines | ||
| 533 | 533 | { |
| 534 | 534 | struct pci_dev *dev; |
| 535 | 535 | |
| 536 | − if (b->self) | |
| 536 | + if (b->self) { | |
| 537 | + pci_read_bridge_bases(b); | |
| 537 | 538 | pcibios_fixup_bridge_resources(b->self); |
| 538 | − | |
| 539 | + } | |
| 539 | 540 | list_for_each_entry(dev, &b->devices, bus_list) |
| 540 | 541 | pcibios_fixup_device_resources(dev); |
| 541 | 542 | platform_pci_fixup_bus(b); |
| @@ -9,3 +9,4 @@ generic-y += module.h · 8 unmodified lines | ||
| 9 | 9 | generic-y += preempt.h |
| 10 | 10 | generic-y += sections.h |
| 11 | 11 | generic-y += trace_clock.h |
| 12 | +generic-y += word-at-a-time.h | |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -57,7 +58,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 41 unmodified lines | ||
| 57 | 58 | CONFIG_NET_IPGRE=m |
| 58 | 59 | CONFIG_NET_IPVTI=m |
| 59 | 60 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 60 | −CONFIG_GENEVE_CORE=m | |
| 61 | 61 | CONFIG_INET_AH=m |
| 62 | 62 | CONFIG_INET_ESP=m |
| 63 | 63 | CONFIG_INET_IPCOMP=m |
| @@ -67,10 +67,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 67 | 67 | # CONFIG_INET_LRO is not set |
| 68 | 68 | CONFIG_INET_DIAG=m |
| 69 | 69 | CONFIG_INET_UDP_DIAG=m |
| 70 | +CONFIG_IPV6=m | |
| 70 | 71 | CONFIG_IPV6_ROUTER_PREF=y |
| 71 | 72 | CONFIG_INET6_AH=m |
| 72 | 73 | CONFIG_INET6_ESP=m |
| 73 | 74 | CONFIG_INET6_IPCOMP=m |
| 75 | +CONFIG_IPV6_ILA=m | |
| 74 | 76 | CONFIG_IPV6_VTI=m |
| 75 | 77 | CONFIG_IPV6_GRE=m |
| 76 | 78 | CONFIG_NETFILTER=y |
| @@ -179,6 +181,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 179 | 181 | CONFIG_IP_SET_LIST_SET=m |
| 180 | 182 | CONFIG_NF_CONNTRACK_IPV4=m |
| 181 | 183 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 184 | +CONFIG_NFT_DUP_IPV4=m | |
| 182 | 185 | CONFIG_NF_TABLES_ARP=m |
| 183 | 186 | CONFIG_NF_LOG_ARP=m |
| 184 | 187 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -206,6 +209,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 206 | 209 | CONFIG_IP_NF_ARP_MANGLE=m |
| 207 | 210 | CONFIG_NF_CONNTRACK_IPV6=m |
| 208 | 211 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 212 | +CONFIG_NFT_DUP_IPV6=m | |
| 209 | 213 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 210 | 214 | CONFIG_NFT_MASQ_IPV6=m |
| 211 | 215 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -271,6 +275,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 271 | 275 | CONFIG_MPLS=y |
| 272 | 276 | CONFIG_NET_MPLS_GSO=m |
| 273 | 277 | CONFIG_MPLS_ROUTING=m |
| 278 | +CONFIG_MPLS_IPTUNNEL=m | |
| 274 | 279 | # CONFIG_WIRELESS is not set |
| 275 | 280 | # CONFIG_UEVENT_HELPER is not set |
| 276 | 281 | CONFIG_DEVTMPFS=y |
| @@ -370,6 +375,7 @@ CONFIG_ZORRO8390=y · 93 unmodified lines | ||
| 370 | 375 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 371 | 376 | # CONFIG_NET_VENDOR_SMSC is not set |
| 372 | 377 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 378 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 373 | 379 | # CONFIG_NET_VENDOR_VIA is not set |
| 374 | 380 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 375 | 381 | CONFIG_PPP=m |
| @@ -537,6 +543,7 @@ CONFIG_TEST_USER_COPY=m · 161 unmodified lines | ||
| 537 | 543 | CONFIG_TEST_BPF=m |
| 538 | 544 | CONFIG_TEST_FIRMWARE=m |
| 539 | 545 | CONFIG_TEST_UDELAY=m |
| 546 | +CONFIG_TEST_STATIC_KEYS=m | |
| 540 | 547 | CONFIG_EARLY_PRINTK=y |
| 541 | 548 | CONFIG_ENCRYPTED_KEYS=m |
| 542 | 549 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -55,7 +56,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 39 unmodified lines | ||
| 55 | 56 | CONFIG_NET_IPGRE=m |
| 56 | 57 | CONFIG_NET_IPVTI=m |
| 57 | 58 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 58 | −CONFIG_GENEVE_CORE=m | |
| 59 | 59 | CONFIG_INET_AH=m |
| 60 | 60 | CONFIG_INET_ESP=m |
| 61 | 61 | CONFIG_INET_IPCOMP=m |
| @@ -65,10 +65,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 65 | 65 | # CONFIG_INET_LRO is not set |
| 66 | 66 | CONFIG_INET_DIAG=m |
| 67 | 67 | CONFIG_INET_UDP_DIAG=m |
| 68 | +CONFIG_IPV6=m | |
| 68 | 69 | CONFIG_IPV6_ROUTER_PREF=y |
| 69 | 70 | CONFIG_INET6_AH=m |
| 70 | 71 | CONFIG_INET6_ESP=m |
| 71 | 72 | CONFIG_INET6_IPCOMP=m |
| 73 | +CONFIG_IPV6_ILA=m | |
| 72 | 74 | CONFIG_IPV6_VTI=m |
| 73 | 75 | CONFIG_IPV6_GRE=m |
| 74 | 76 | CONFIG_NETFILTER=y |
| @@ -177,6 +179,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 177 | 179 | CONFIG_IP_SET_LIST_SET=m |
| 178 | 180 | CONFIG_NF_CONNTRACK_IPV4=m |
| 179 | 181 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 182 | +CONFIG_NFT_DUP_IPV4=m | |
| 180 | 183 | CONFIG_NF_TABLES_ARP=m |
| 181 | 184 | CONFIG_NF_LOG_ARP=m |
| 182 | 185 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -204,6 +207,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 204 | 207 | CONFIG_IP_NF_ARP_MANGLE=m |
| 205 | 208 | CONFIG_NF_CONNTRACK_IPV6=m |
| 206 | 209 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 210 | +CONFIG_NFT_DUP_IPV6=m | |
| 207 | 211 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 208 | 212 | CONFIG_NFT_MASQ_IPV6=m |
| 209 | 213 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -269,6 +273,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 269 | 273 | CONFIG_MPLS=y |
| 270 | 274 | CONFIG_NET_MPLS_GSO=m |
| 271 | 275 | CONFIG_MPLS_ROUTING=m |
| 276 | +CONFIG_MPLS_IPTUNNEL=m | |
| 272 | 277 | # CONFIG_WIRELESS is not set |
| 273 | 278 | # CONFIG_UEVENT_HELPER is not set |
| 274 | 279 | CONFIG_DEVTMPFS=y |
| @@ -344,6 +349,7 @@ CONFIG_VETH=m · 69 unmodified lines | ||
| 344 | 349 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 345 | 350 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 346 | 351 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 352 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 347 | 353 | # CONFIG_NET_VENDOR_VIA is not set |
| 348 | 354 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 349 | 355 | CONFIG_PPP=m |
| @@ -495,6 +501,7 @@ CONFIG_TEST_USER_COPY=m · 145 unmodified lines | ||
| 495 | 501 | CONFIG_TEST_BPF=m |
| 496 | 502 | CONFIG_TEST_FIRMWARE=m |
| 497 | 503 | CONFIG_TEST_UDELAY=m |
| 504 | +CONFIG_TEST_STATIC_KEYS=m | |
| 498 | 505 | CONFIG_EARLY_PRINTK=y |
| 499 | 506 | CONFIG_ENCRYPTED_KEYS=m |
| 500 | 507 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -55,7 +56,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 39 unmodified lines | ||
| 55 | 56 | CONFIG_NET_IPGRE=m |
| 56 | 57 | CONFIG_NET_IPVTI=m |
| 57 | 58 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 58 | −CONFIG_GENEVE_CORE=m | |
| 59 | 59 | CONFIG_INET_AH=m |
| 60 | 60 | CONFIG_INET_ESP=m |
| 61 | 61 | CONFIG_INET_IPCOMP=m |
| @@ -65,10 +65,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 65 | 65 | # CONFIG_INET_LRO is not set |
| 66 | 66 | CONFIG_INET_DIAG=m |
| 67 | 67 | CONFIG_INET_UDP_DIAG=m |
| 68 | +CONFIG_IPV6=m | |
| 68 | 69 | CONFIG_IPV6_ROUTER_PREF=y |
| 69 | 70 | CONFIG_INET6_AH=m |
| 70 | 71 | CONFIG_INET6_ESP=m |
| 71 | 72 | CONFIG_INET6_IPCOMP=m |
| 73 | +CONFIG_IPV6_ILA=m | |
| 72 | 74 | CONFIG_IPV6_VTI=m |
| 73 | 75 | CONFIG_IPV6_GRE=m |
| 74 | 76 | CONFIG_NETFILTER=y |
| @@ -177,6 +179,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 177 | 179 | CONFIG_IP_SET_LIST_SET=m |
| 178 | 180 | CONFIG_NF_CONNTRACK_IPV4=m |
| 179 | 181 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 182 | +CONFIG_NFT_DUP_IPV4=m | |
| 180 | 183 | CONFIG_NF_TABLES_ARP=m |
| 181 | 184 | CONFIG_NF_LOG_ARP=m |
| 182 | 185 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -204,6 +207,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 204 | 207 | CONFIG_IP_NF_ARP_MANGLE=m |
| 205 | 208 | CONFIG_NF_CONNTRACK_IPV6=m |
| 206 | 209 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 210 | +CONFIG_NFT_DUP_IPV6=m | |
| 207 | 211 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 208 | 212 | CONFIG_NFT_MASQ_IPV6=m |
| 209 | 213 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -269,6 +273,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 269 | 273 | CONFIG_MPLS=y |
| 270 | 274 | CONFIG_NET_MPLS_GSO=m |
| 271 | 275 | CONFIG_MPLS_ROUTING=m |
| 276 | +CONFIG_MPLS_IPTUNNEL=m | |
| 272 | 277 | # CONFIG_WIRELESS is not set |
| 273 | 278 | # CONFIG_UEVENT_HELPER is not set |
| 274 | 279 | CONFIG_DEVTMPFS=y |
| @@ -355,6 +360,7 @@ CONFIG_NE2000=y · 80 unmodified lines | ||
| 355 | 360 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 356 | 361 | CONFIG_SMC91X=y |
| 357 | 362 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 363 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 358 | 364 | # CONFIG_NET_VENDOR_VIA is not set |
| 359 | 365 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 360 | 366 | CONFIG_PPP=m |
| @@ -517,6 +523,7 @@ CONFIG_TEST_USER_COPY=m · 156 unmodified lines | ||
| 517 | 523 | CONFIG_TEST_BPF=m |
| 518 | 524 | CONFIG_TEST_FIRMWARE=m |
| 519 | 525 | CONFIG_TEST_UDELAY=m |
| 526 | +CONFIG_TEST_STATIC_KEYS=m | |
| 520 | 527 | CONFIG_EARLY_PRINTK=y |
| 521 | 528 | CONFIG_ENCRYPTED_KEYS=m |
| 522 | 529 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -53,7 +54,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 37 unmodified lines | ||
| 53 | 54 | CONFIG_NET_IPGRE=m |
| 54 | 55 | CONFIG_NET_IPVTI=m |
| 55 | 56 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 56 | −CONFIG_GENEVE_CORE=m | |
| 57 | 57 | CONFIG_INET_AH=m |
| 58 | 58 | CONFIG_INET_ESP=m |
| 59 | 59 | CONFIG_INET_IPCOMP=m |
| @@ -63,10 +63,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 63 | 63 | # CONFIG_INET_LRO is not set |
| 64 | 64 | CONFIG_INET_DIAG=m |
| 65 | 65 | CONFIG_INET_UDP_DIAG=m |
| 66 | +CONFIG_IPV6=m | |
| 66 | 67 | CONFIG_IPV6_ROUTER_PREF=y |
| 67 | 68 | CONFIG_INET6_AH=m |
| 68 | 69 | CONFIG_INET6_ESP=m |
| 69 | 70 | CONFIG_INET6_IPCOMP=m |
| 71 | +CONFIG_IPV6_ILA=m | |
| 70 | 72 | CONFIG_IPV6_VTI=m |
| 71 | 73 | CONFIG_IPV6_GRE=m |
| 72 | 74 | CONFIG_NETFILTER=y |
| @@ -175,6 +177,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 175 | 177 | CONFIG_IP_SET_LIST_SET=m |
| 176 | 178 | CONFIG_NF_CONNTRACK_IPV4=m |
| 177 | 179 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 180 | +CONFIG_NFT_DUP_IPV4=m | |
| 178 | 181 | CONFIG_NF_TABLES_ARP=m |
| 179 | 182 | CONFIG_NF_LOG_ARP=m |
| 180 | 183 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -202,6 +205,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 202 | 205 | CONFIG_IP_NF_ARP_MANGLE=m |
| 203 | 206 | CONFIG_NF_CONNTRACK_IPV6=m |
| 204 | 207 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 208 | +CONFIG_NFT_DUP_IPV6=m | |
| 205 | 209 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 206 | 210 | CONFIG_NFT_MASQ_IPV6=m |
| 207 | 211 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -267,6 +271,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 267 | 271 | CONFIG_MPLS=y |
| 268 | 272 | CONFIG_NET_MPLS_GSO=m |
| 269 | 273 | CONFIG_MPLS_ROUTING=m |
| 274 | +CONFIG_MPLS_IPTUNNEL=m | |
| 270 | 275 | # CONFIG_WIRELESS is not set |
| 271 | 276 | # CONFIG_UEVENT_HELPER is not set |
| 272 | 277 | CONFIG_DEVTMPFS=y |
| @@ -343,6 +348,7 @@ CONFIG_BVME6000_NET=y · 70 unmodified lines | ||
| 343 | 348 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 344 | 349 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 345 | 350 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 351 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 346 | 352 | # CONFIG_NET_VENDOR_VIA is not set |
| 347 | 353 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 348 | 354 | CONFIG_PPP=m |
| @@ -488,6 +494,7 @@ CONFIG_TEST_USER_COPY=m · 139 unmodified lines | ||
| 488 | 494 | CONFIG_TEST_BPF=m |
| 489 | 495 | CONFIG_TEST_FIRMWARE=m |
| 490 | 496 | CONFIG_TEST_UDELAY=m |
| 497 | +CONFIG_TEST_STATIC_KEYS=m | |
| 491 | 498 | CONFIG_EARLY_PRINTK=y |
| 492 | 499 | CONFIG_ENCRYPTED_KEYS=m |
| 493 | 500 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -55,7 +56,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 39 unmodified lines | ||
| 55 | 56 | CONFIG_NET_IPGRE=m |
| 56 | 57 | CONFIG_NET_IPVTI=m |
| 57 | 58 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 58 | −CONFIG_GENEVE_CORE=m | |
| 59 | 59 | CONFIG_INET_AH=m |
| 60 | 60 | CONFIG_INET_ESP=m |
| 61 | 61 | CONFIG_INET_IPCOMP=m |
| @@ -65,10 +65,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 65 | 65 | # CONFIG_INET_LRO is not set |
| 66 | 66 | CONFIG_INET_DIAG=m |
| 67 | 67 | CONFIG_INET_UDP_DIAG=m |
| 68 | +CONFIG_IPV6=m | |
| 68 | 69 | CONFIG_IPV6_ROUTER_PREF=y |
| 69 | 70 | CONFIG_INET6_AH=m |
| 70 | 71 | CONFIG_INET6_ESP=m |
| 71 | 72 | CONFIG_INET6_IPCOMP=m |
| 73 | +CONFIG_IPV6_ILA=m | |
| 72 | 74 | CONFIG_IPV6_VTI=m |
| 73 | 75 | CONFIG_IPV6_GRE=m |
| 74 | 76 | CONFIG_NETFILTER=y |
| @@ -177,6 +179,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 177 | 179 | CONFIG_IP_SET_LIST_SET=m |
| 178 | 180 | CONFIG_NF_CONNTRACK_IPV4=m |
| 179 | 181 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 182 | +CONFIG_NFT_DUP_IPV4=m | |
| 180 | 183 | CONFIG_NF_TABLES_ARP=m |
| 181 | 184 | CONFIG_NF_LOG_ARP=m |
| 182 | 185 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -204,6 +207,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 204 | 207 | CONFIG_IP_NF_ARP_MANGLE=m |
| 205 | 208 | CONFIG_NF_CONNTRACK_IPV6=m |
| 206 | 209 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 210 | +CONFIG_NFT_DUP_IPV6=m | |
| 207 | 211 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 208 | 212 | CONFIG_NFT_MASQ_IPV6=m |
| 209 | 213 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -269,6 +273,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 269 | 273 | CONFIG_MPLS=y |
| 270 | 274 | CONFIG_NET_MPLS_GSO=m |
| 271 | 275 | CONFIG_MPLS_ROUTING=m |
| 276 | +CONFIG_MPLS_IPTUNNEL=m | |
| 272 | 277 | # CONFIG_WIRELESS is not set |
| 273 | 278 | # CONFIG_UEVENT_HELPER is not set |
| 274 | 279 | CONFIG_DEVTMPFS=y |
| @@ -345,6 +350,7 @@ CONFIG_HPLANCE=y · 70 unmodified lines | ||
| 345 | 350 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 346 | 351 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 347 | 352 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 353 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 348 | 354 | # CONFIG_NET_VENDOR_VIA is not set |
| 349 | 355 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 350 | 356 | CONFIG_PPP=m |
| @@ -497,6 +503,7 @@ CONFIG_TEST_USER_COPY=m · 146 unmodified lines | ||
| 497 | 503 | CONFIG_TEST_BPF=m |
| 498 | 504 | CONFIG_TEST_FIRMWARE=m |
| 499 | 505 | CONFIG_TEST_UDELAY=m |
| 506 | +CONFIG_TEST_STATIC_KEYS=m | |
| 500 | 507 | CONFIG_EARLY_PRINTK=y |
| 501 | 508 | CONFIG_ENCRYPTED_KEYS=m |
| 502 | 509 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -54,7 +55,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 38 unmodified lines | ||
| 54 | 55 | CONFIG_NET_IPGRE=m |
| 55 | 56 | CONFIG_NET_IPVTI=m |
| 56 | 57 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 57 | −CONFIG_GENEVE_CORE=m | |
| 58 | 58 | CONFIG_INET_AH=m |
| 59 | 59 | CONFIG_INET_ESP=m |
| 60 | 60 | CONFIG_INET_IPCOMP=m |
| @@ -64,10 +64,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 64 | 64 | # CONFIG_INET_LRO is not set |
| 65 | 65 | CONFIG_INET_DIAG=m |
| 66 | 66 | CONFIG_INET_UDP_DIAG=m |
| 67 | +CONFIG_IPV6=m | |
| 67 | 68 | CONFIG_IPV6_ROUTER_PREF=y |
| 68 | 69 | CONFIG_INET6_AH=m |
| 69 | 70 | CONFIG_INET6_ESP=m |
| 70 | 71 | CONFIG_INET6_IPCOMP=m |
| 72 | +CONFIG_IPV6_ILA=m | |
| 71 | 73 | CONFIG_IPV6_VTI=m |
| 72 | 74 | CONFIG_IPV6_GRE=m |
| 73 | 75 | CONFIG_NETFILTER=y |
| @@ -176,6 +178,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 176 | 178 | CONFIG_IP_SET_LIST_SET=m |
| 177 | 179 | CONFIG_NF_CONNTRACK_IPV4=m |
| 178 | 180 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 181 | +CONFIG_NFT_DUP_IPV4=m | |
| 179 | 182 | CONFIG_NF_TABLES_ARP=m |
| 180 | 183 | CONFIG_NF_LOG_ARP=m |
| 181 | 184 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -203,6 +206,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 203 | 206 | CONFIG_IP_NF_ARP_MANGLE=m |
| 204 | 207 | CONFIG_NF_CONNTRACK_IPV6=m |
| 205 | 208 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 209 | +CONFIG_NFT_DUP_IPV6=m | |
| 206 | 210 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 207 | 211 | CONFIG_NFT_MASQ_IPV6=m |
| 208 | 212 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -271,6 +275,7 @@ CONFIG_NETLINK_DIAG=m · 62 unmodified lines | ||
| 271 | 275 | CONFIG_MPLS=y |
| 272 | 276 | CONFIG_NET_MPLS_GSO=m |
| 273 | 277 | CONFIG_MPLS_ROUTING=m |
| 278 | +CONFIG_MPLS_IPTUNNEL=m | |
| 274 | 279 | # CONFIG_WIRELESS is not set |
| 275 | 280 | # CONFIG_UEVENT_HELPER is not set |
| 276 | 281 | CONFIG_DEVTMPFS=y |
| @@ -364,6 +369,7 @@ CONFIG_MAC8390=y · 87 unmodified lines | ||
| 364 | 369 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 365 | 370 | # CONFIG_NET_VENDOR_SMSC is not set |
| 366 | 371 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 372 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 367 | 373 | # CONFIG_NET_VENDOR_VIA is not set |
| 368 | 374 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 369 | 375 | CONFIG_PPP=m |
| @@ -519,6 +525,7 @@ CONFIG_TEST_USER_COPY=m · 149 unmodified lines | ||
| 519 | 525 | CONFIG_TEST_BPF=m |
| 520 | 526 | CONFIG_TEST_FIRMWARE=m |
| 521 | 527 | CONFIG_TEST_UDELAY=m |
| 528 | +CONFIG_TEST_STATIC_KEYS=m | |
| 522 | 529 | CONFIG_EARLY_PRINTK=y |
| 523 | 530 | CONFIG_ENCRYPTED_KEYS=m |
| 524 | 531 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -64,7 +65,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 48 unmodified lines | ||
| 64 | 65 | CONFIG_NET_IPGRE=m |
| 65 | 66 | CONFIG_NET_IPVTI=m |
| 66 | 67 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 67 | −CONFIG_GENEVE_CORE=m | |
| 68 | 68 | CONFIG_INET_AH=m |
| 69 | 69 | CONFIG_INET_ESP=m |
| 70 | 70 | CONFIG_INET_IPCOMP=m |
| @@ -74,10 +74,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 74 | 74 | # CONFIG_INET_LRO is not set |
| 75 | 75 | CONFIG_INET_DIAG=m |
| 76 | 76 | CONFIG_INET_UDP_DIAG=m |
| 77 | +CONFIG_IPV6=m | |
| 77 | 78 | CONFIG_IPV6_ROUTER_PREF=y |
| 78 | 79 | CONFIG_INET6_AH=m |
| 79 | 80 | CONFIG_INET6_ESP=m |
| 80 | 81 | CONFIG_INET6_IPCOMP=m |
| 82 | +CONFIG_IPV6_ILA=m | |
| 81 | 83 | CONFIG_IPV6_VTI=m |
| 82 | 84 | CONFIG_IPV6_GRE=m |
| 83 | 85 | CONFIG_NETFILTER=y |
| @@ -186,6 +188,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 186 | 188 | CONFIG_IP_SET_LIST_SET=m |
| 187 | 189 | CONFIG_NF_CONNTRACK_IPV4=m |
| 188 | 190 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 191 | +CONFIG_NFT_DUP_IPV4=m | |
| 189 | 192 | CONFIG_NF_TABLES_ARP=m |
| 190 | 193 | CONFIG_NF_LOG_ARP=m |
| 191 | 194 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -213,6 +216,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 213 | 216 | CONFIG_IP_NF_ARP_MANGLE=m |
| 214 | 217 | CONFIG_NF_CONNTRACK_IPV6=m |
| 215 | 218 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 219 | +CONFIG_NFT_DUP_IPV6=m | |
| 216 | 220 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 217 | 221 | CONFIG_NFT_MASQ_IPV6=m |
| 218 | 222 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -281,6 +285,7 @@ CONFIG_NETLINK_DIAG=m · 62 unmodified lines | ||
| 281 | 285 | CONFIG_MPLS=y |
| 282 | 286 | CONFIG_NET_MPLS_GSO=m |
| 283 | 287 | CONFIG_MPLS_ROUTING=m |
| 288 | +CONFIG_MPLS_IPTUNNEL=m | |
| 284 | 289 | # CONFIG_WIRELESS is not set |
| 285 | 290 | # CONFIG_UEVENT_HELPER is not set |
| 286 | 291 | CONFIG_DEVTMPFS=y |
| @@ -410,6 +415,7 @@ CONFIG_ZORRO8390=y · 123 unmodified lines | ||
| 410 | 415 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 411 | 416 | CONFIG_SMC91X=y |
| 412 | 417 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 418 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 413 | 419 | # CONFIG_NET_VENDOR_VIA is not set |
| 414 | 420 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 415 | 421 | CONFIG_PLIP=m |
| @@ -599,6 +605,7 @@ CONFIG_TEST_USER_COPY=m · 183 unmodified lines | ||
| 599 | 605 | CONFIG_TEST_BPF=m |
| 600 | 606 | CONFIG_TEST_FIRMWARE=m |
| 601 | 607 | CONFIG_TEST_UDELAY=m |
| 608 | +CONFIG_TEST_STATIC_KEYS=m | |
| 602 | 609 | CONFIG_EARLY_PRINTK=y |
| 603 | 610 | CONFIG_ENCRYPTED_KEYS=m |
| 604 | 611 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -52,7 +53,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 36 unmodified lines | ||
| 52 | 53 | CONFIG_NET_IPGRE=m |
| 53 | 54 | CONFIG_NET_IPVTI=m |
| 54 | 55 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 55 | −CONFIG_GENEVE_CORE=m | |
| 56 | 56 | CONFIG_INET_AH=m |
| 57 | 57 | CONFIG_INET_ESP=m |
| 58 | 58 | CONFIG_INET_IPCOMP=m |
| @@ -62,10 +62,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 62 | 62 | # CONFIG_INET_LRO is not set |
| 63 | 63 | CONFIG_INET_DIAG=m |
| 64 | 64 | CONFIG_INET_UDP_DIAG=m |
| 65 | +CONFIG_IPV6=m | |
| 65 | 66 | CONFIG_IPV6_ROUTER_PREF=y |
| 66 | 67 | CONFIG_INET6_AH=m |
| 67 | 68 | CONFIG_INET6_ESP=m |
| 68 | 69 | CONFIG_INET6_IPCOMP=m |
| 70 | +CONFIG_IPV6_ILA=m | |
| 69 | 71 | CONFIG_IPV6_VTI=m |
| 70 | 72 | CONFIG_IPV6_GRE=m |
| 71 | 73 | CONFIG_NETFILTER=y |
| @@ -174,6 +176,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 174 | 176 | CONFIG_IP_SET_LIST_SET=m |
| 175 | 177 | CONFIG_NF_CONNTRACK_IPV4=m |
| 176 | 178 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 179 | +CONFIG_NFT_DUP_IPV4=m | |
| 177 | 180 | CONFIG_NF_TABLES_ARP=m |
| 178 | 181 | CONFIG_NF_LOG_ARP=m |
| 179 | 182 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -201,6 +204,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 201 | 204 | CONFIG_IP_NF_ARP_MANGLE=m |
| 202 | 205 | CONFIG_NF_CONNTRACK_IPV6=m |
| 203 | 206 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 207 | +CONFIG_NFT_DUP_IPV6=m | |
| 204 | 208 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 205 | 209 | CONFIG_NFT_MASQ_IPV6=m |
| 206 | 210 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -266,6 +270,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 266 | 270 | CONFIG_MPLS=y |
| 267 | 271 | CONFIG_NET_MPLS_GSO=m |
| 268 | 272 | CONFIG_MPLS_ROUTING=m |
| 273 | +CONFIG_MPLS_IPTUNNEL=m | |
| 269 | 274 | # CONFIG_WIRELESS is not set |
| 270 | 275 | # CONFIG_UEVENT_HELPER is not set |
| 271 | 276 | CONFIG_DEVTMPFS=y |
| @@ -343,6 +348,7 @@ CONFIG_MVME147_NET=y · 71 unmodified lines | ||
| 343 | 348 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 344 | 349 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 345 | 350 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 351 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 346 | 352 | # CONFIG_NET_VENDOR_VIA is not set |
| 347 | 353 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 348 | 354 | CONFIG_PPP=m |
| @@ -488,6 +494,7 @@ CONFIG_TEST_USER_COPY=m · 139 unmodified lines | ||
| 488 | 494 | CONFIG_TEST_BPF=m |
| 489 | 495 | CONFIG_TEST_FIRMWARE=m |
| 490 | 496 | CONFIG_TEST_UDELAY=m |
| 497 | +CONFIG_TEST_STATIC_KEYS=m | |
| 491 | 498 | CONFIG_EARLY_PRINTK=y |
| 492 | 499 | CONFIG_ENCRYPTED_KEYS=m |
| 493 | 500 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -53,7 +54,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 37 unmodified lines | ||
| 53 | 54 | CONFIG_NET_IPGRE=m |
| 54 | 55 | CONFIG_NET_IPVTI=m |
| 55 | 56 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 56 | −CONFIG_GENEVE_CORE=m | |
| 57 | 57 | CONFIG_INET_AH=m |
| 58 | 58 | CONFIG_INET_ESP=m |
| 59 | 59 | CONFIG_INET_IPCOMP=m |
| @@ -63,10 +63,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 63 | 63 | # CONFIG_INET_LRO is not set |
| 64 | 64 | CONFIG_INET_DIAG=m |
| 65 | 65 | CONFIG_INET_UDP_DIAG=m |
| 66 | +CONFIG_IPV6=m | |
| 66 | 67 | CONFIG_IPV6_ROUTER_PREF=y |
| 67 | 68 | CONFIG_INET6_AH=m |
| 68 | 69 | CONFIG_INET6_ESP=m |
| 69 | 70 | CONFIG_INET6_IPCOMP=m |
| 71 | +CONFIG_IPV6_ILA=m | |
| 70 | 72 | CONFIG_IPV6_VTI=m |
| 71 | 73 | CONFIG_IPV6_GRE=m |
| 72 | 74 | CONFIG_NETFILTER=y |
| @@ -175,6 +177,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 175 | 177 | CONFIG_IP_SET_LIST_SET=m |
| 176 | 178 | CONFIG_NF_CONNTRACK_IPV4=m |
| 177 | 179 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 180 | +CONFIG_NFT_DUP_IPV4=m | |
| 178 | 181 | CONFIG_NF_TABLES_ARP=m |
| 179 | 182 | CONFIG_NF_LOG_ARP=m |
| 180 | 183 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -202,6 +205,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 202 | 205 | CONFIG_IP_NF_ARP_MANGLE=m |
| 203 | 206 | CONFIG_NF_CONNTRACK_IPV6=m |
| 204 | 207 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 208 | +CONFIG_NFT_DUP_IPV6=m | |
| 205 | 209 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 206 | 210 | CONFIG_NFT_MASQ_IPV6=m |
| 207 | 211 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -267,6 +271,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 267 | 271 | CONFIG_MPLS=y |
| 268 | 272 | CONFIG_NET_MPLS_GSO=m |
| 269 | 273 | CONFIG_MPLS_ROUTING=m |
| 274 | +CONFIG_MPLS_IPTUNNEL=m | |
| 270 | 275 | # CONFIG_WIRELESS is not set |
| 271 | 276 | # CONFIG_UEVENT_HELPER is not set |
| 272 | 277 | CONFIG_DEVTMPFS=y |
| @@ -343,6 +348,7 @@ CONFIG_MVME16x_NET=y · 70 unmodified lines | ||
| 343 | 348 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 344 | 349 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 345 | 350 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 351 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 346 | 352 | # CONFIG_NET_VENDOR_VIA is not set |
| 347 | 353 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 348 | 354 | CONFIG_PPP=m |
| @@ -488,6 +494,7 @@ CONFIG_TEST_USER_COPY=m · 139 unmodified lines | ||
| 488 | 494 | CONFIG_TEST_BPF=m |
| 489 | 495 | CONFIG_TEST_FIRMWARE=m |
| 490 | 496 | CONFIG_TEST_UDELAY=m |
| 497 | +CONFIG_TEST_STATIC_KEYS=m | |
| 491 | 498 | CONFIG_EARLY_PRINTK=y |
| 492 | 499 | CONFIG_ENCRYPTED_KEYS=m |
| 493 | 500 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -53,7 +54,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 37 unmodified lines | ||
| 53 | 54 | CONFIG_NET_IPGRE=m |
| 54 | 55 | CONFIG_NET_IPVTI=m |
| 55 | 56 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 56 | −CONFIG_GENEVE_CORE=m | |
| 57 | 57 | CONFIG_INET_AH=m |
| 58 | 58 | CONFIG_INET_ESP=m |
| 59 | 59 | CONFIG_INET_IPCOMP=m |
| @@ -63,10 +63,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 63 | 63 | # CONFIG_INET_LRO is not set |
| 64 | 64 | CONFIG_INET_DIAG=m |
| 65 | 65 | CONFIG_INET_UDP_DIAG=m |
| 66 | +CONFIG_IPV6=m | |
| 66 | 67 | CONFIG_IPV6_ROUTER_PREF=y |
| 67 | 68 | CONFIG_INET6_AH=m |
| 68 | 69 | CONFIG_INET6_ESP=m |
| 69 | 70 | CONFIG_INET6_IPCOMP=m |
| 71 | +CONFIG_IPV6_ILA=m | |
| 70 | 72 | CONFIG_IPV6_VTI=m |
| 71 | 73 | CONFIG_IPV6_GRE=m |
| 72 | 74 | CONFIG_NETFILTER=y |
| @@ -175,6 +177,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 175 | 177 | CONFIG_IP_SET_LIST_SET=m |
| 176 | 178 | CONFIG_NF_CONNTRACK_IPV4=m |
| 177 | 179 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 180 | +CONFIG_NFT_DUP_IPV4=m | |
| 178 | 181 | CONFIG_NF_TABLES_ARP=m |
| 179 | 182 | CONFIG_NF_LOG_ARP=m |
| 180 | 183 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -202,6 +205,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 202 | 205 | CONFIG_IP_NF_ARP_MANGLE=m |
| 203 | 206 | CONFIG_NF_CONNTRACK_IPV6=m |
| 204 | 207 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 208 | +CONFIG_NFT_DUP_IPV6=m | |
| 205 | 209 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 206 | 210 | CONFIG_NFT_MASQ_IPV6=m |
| 207 | 211 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -267,6 +271,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 267 | 271 | CONFIG_MPLS=y |
| 268 | 272 | CONFIG_NET_MPLS_GSO=m |
| 269 | 273 | CONFIG_MPLS_ROUTING=m |
| 274 | +CONFIG_MPLS_IPTUNNEL=m | |
| 270 | 275 | # CONFIG_WIRELESS is not set |
| 271 | 276 | # CONFIG_UEVENT_HELPER is not set |
| 272 | 277 | CONFIG_DEVTMPFS=y |
| @@ -354,6 +359,7 @@ CONFIG_NE2000=y · 81 unmodified lines | ||
| 354 | 359 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 355 | 360 | # CONFIG_NET_VENDOR_SMSC is not set |
| 356 | 361 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 362 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 357 | 363 | # CONFIG_NET_VENDOR_VIA is not set |
| 358 | 364 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 359 | 365 | CONFIG_PLIP=m |
| @@ -510,6 +516,7 @@ CONFIG_TEST_USER_COPY=m · 150 unmodified lines | ||
| 510 | 516 | CONFIG_TEST_BPF=m |
| 511 | 517 | CONFIG_TEST_FIRMWARE=m |
| 512 | 518 | CONFIG_TEST_UDELAY=m |
| 519 | +CONFIG_TEST_STATIC_KEYS=m | |
| 513 | 520 | CONFIG_EARLY_PRINTK=y |
| 514 | 521 | CONFIG_ENCRYPTED_KEYS=m |
| 515 | 522 | CONFIG_CRYPTO_RSA=m |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -50,7 +51,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 34 unmodified lines | ||
| 50 | 51 | CONFIG_NET_IPGRE=m |
| 51 | 52 | CONFIG_NET_IPVTI=m |
| 52 | 53 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 53 | −CONFIG_GENEVE_CORE=m | |
| 54 | 54 | CONFIG_INET_AH=m |
| 55 | 55 | CONFIG_INET_ESP=m |
| 56 | 56 | CONFIG_INET_IPCOMP=m |
| @@ -60,10 +60,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 60 | 60 | # CONFIG_INET_LRO is not set |
| 61 | 61 | CONFIG_INET_DIAG=m |
| 62 | 62 | CONFIG_INET_UDP_DIAG=m |
| 63 | +CONFIG_IPV6=m | |
| 63 | 64 | CONFIG_IPV6_ROUTER_PREF=y |
| 64 | 65 | CONFIG_INET6_AH=m |
| 65 | 66 | CONFIG_INET6_ESP=m |
| 66 | 67 | CONFIG_INET6_IPCOMP=m |
| 68 | +CONFIG_IPV6_ILA=m | |
| 67 | 69 | CONFIG_IPV6_VTI=m |
| 68 | 70 | CONFIG_IPV6_GRE=m |
| 69 | 71 | CONFIG_NETFILTER=y |
| @@ -172,6 +174,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 172 | 174 | CONFIG_IP_SET_LIST_SET=m |
| 173 | 175 | CONFIG_NF_CONNTRACK_IPV4=m |
| 174 | 176 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 177 | +CONFIG_NFT_DUP_IPV4=m | |
| 175 | 178 | CONFIG_NF_TABLES_ARP=m |
| 176 | 179 | CONFIG_NF_LOG_ARP=m |
| 177 | 180 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -199,6 +202,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 199 | 202 | CONFIG_IP_NF_ARP_MANGLE=m |
| 200 | 203 | CONFIG_NF_CONNTRACK_IPV6=m |
| 201 | 204 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 205 | +CONFIG_NFT_DUP_IPV6=m | |
| 202 | 206 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 203 | 207 | CONFIG_NFT_MASQ_IPV6=m |
| 204 | 208 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -264,6 +268,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 264 | 268 | CONFIG_MPLS=y |
| 265 | 269 | CONFIG_NET_MPLS_GSO=m |
| 266 | 270 | CONFIG_MPLS_ROUTING=m |
| 271 | +CONFIG_MPLS_IPTUNNEL=m | |
| 267 | 272 | # CONFIG_WIRELESS is not set |
| 268 | 273 | # CONFIG_UEVENT_HELPER is not set |
| 269 | 274 | CONFIG_DEVTMPFS=y |
| @@ -341,6 +346,7 @@ CONFIG_SUN3_82586=y · 71 unmodified lines | ||
| 341 | 346 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 342 | 347 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 343 | 348 | # CONFIG_NET_VENDOR_SUN is not set |
| 349 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 344 | 350 | # CONFIG_NET_VENDOR_VIA is not set |
| 345 | 351 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 346 | 352 | CONFIG_PPP=m |
| @@ -489,6 +495,7 @@ CONFIG_TEST_USER_COPY=m · 142 unmodified lines | ||
| 489 | 495 | CONFIG_TEST_BPF=m |
| 490 | 496 | CONFIG_TEST_FIRMWARE=m |
| 491 | 497 | CONFIG_TEST_UDELAY=m |
| 498 | +CONFIG_TEST_STATIC_KEYS=m | |
| 492 | 499 | CONFIG_ENCRYPTED_KEYS=m |
| 493 | 500 | CONFIG_CRYPTO_RSA=m |
| 494 | 501 | CONFIG_CRYPTO_MANAGER=y |
| @@ -10,6 +10,7 @@ CONFIG_LOG_BUF_SHIFT=16 · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | # CONFIG_NET_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_USERFAULTFD=y | |
| 13 | 14 | CONFIG_SLAB=y |
| 14 | 15 | CONFIG_MODULES=y |
| 15 | 16 | CONFIG_MODULE_UNLOAD=y |
| @@ -50,7 +51,6 @@ CONFIG_NET_IPGRE_DEMUX=m · 34 unmodified lines | ||
| 50 | 51 | CONFIG_NET_IPGRE=m |
| 51 | 52 | CONFIG_NET_IPVTI=m |
| 52 | 53 | CONFIG_NET_FOU_IP_TUNNELS=y |
| 53 | −CONFIG_GENEVE_CORE=m | |
| 54 | 54 | CONFIG_INET_AH=m |
| 55 | 55 | CONFIG_INET_ESP=m |
| 56 | 56 | CONFIG_INET_IPCOMP=m |
| @@ -60,10 +60,12 @@ CONFIG_INET_XFRM_MODE_BEET=m · 3 unmodified lines | ||
| 60 | 60 | # CONFIG_INET_LRO is not set |
| 61 | 61 | CONFIG_INET_DIAG=m |
| 62 | 62 | CONFIG_INET_UDP_DIAG=m |
| 63 | +CONFIG_IPV6=m | |
| 63 | 64 | CONFIG_IPV6_ROUTER_PREF=y |
| 64 | 65 | CONFIG_INET6_AH=m |
| 65 | 66 | CONFIG_INET6_ESP=m |
| 66 | 67 | CONFIG_INET6_IPCOMP=m |
| 68 | +CONFIG_IPV6_ILA=m | |
| 67 | 69 | CONFIG_IPV6_VTI=m |
| 68 | 70 | CONFIG_IPV6_GRE=m |
| 69 | 71 | CONFIG_NETFILTER=y |
| @@ -172,6 +174,7 @@ CONFIG_IP_SET_HASH_NETIFACE=m · 102 unmodified lines | ||
| 172 | 174 | CONFIG_IP_SET_LIST_SET=m |
| 173 | 175 | CONFIG_NF_CONNTRACK_IPV4=m |
| 174 | 176 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
| 177 | +CONFIG_NFT_DUP_IPV4=m | |
| 175 | 178 | CONFIG_NF_TABLES_ARP=m |
| 176 | 179 | CONFIG_NF_LOG_ARP=m |
| 177 | 180 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
| @@ -199,6 +202,7 @@ CONFIG_IP_NF_ARPFILTER=m · 21 unmodified lines | ||
| 199 | 202 | CONFIG_IP_NF_ARP_MANGLE=m |
| 200 | 203 | CONFIG_NF_CONNTRACK_IPV6=m |
| 201 | 204 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
| 205 | +CONFIG_NFT_DUP_IPV6=m | |
| 202 | 206 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
| 203 | 207 | CONFIG_NFT_MASQ_IPV6=m |
| 204 | 208 | CONFIG_NFT_REDIR_IPV6=m |
| @@ -264,6 +268,7 @@ CONFIG_NETLINK_DIAG=m · 59 unmodified lines | ||
| 264 | 268 | CONFIG_MPLS=y |
| 265 | 269 | CONFIG_NET_MPLS_GSO=m |
| 266 | 270 | CONFIG_MPLS_ROUTING=m |
| 271 | +CONFIG_MPLS_IPTUNNEL=m | |
| 267 | 272 | # CONFIG_WIRELESS is not set |
| 268 | 273 | # CONFIG_UEVENT_HELPER is not set |
| 269 | 274 | CONFIG_DEVTMPFS=y |
| @@ -341,6 +346,7 @@ CONFIG_SUN3LANCE=y · 71 unmodified lines | ||
| 341 | 346 | # CONFIG_NET_VENDOR_SAMSUNG is not set |
| 342 | 347 | # CONFIG_NET_VENDOR_SEEQ is not set |
| 343 | 348 | # CONFIG_NET_VENDOR_STMICRO is not set |
| 349 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 344 | 350 | # CONFIG_NET_VENDOR_VIA is not set |
| 345 | 351 | # CONFIG_NET_VENDOR_WIZNET is not set |
| 346 | 352 | CONFIG_PPP=m |
| @@ -489,6 +495,7 @@ CONFIG_TEST_USER_COPY=m · 142 unmodified lines | ||
| 489 | 495 | CONFIG_TEST_BPF=m |
| 490 | 496 | CONFIG_TEST_FIRMWARE=m |
| 491 | 497 | CONFIG_TEST_UDELAY=m |
| 498 | +CONFIG_TEST_STATIC_KEYS=m | |
| 492 | 499 | CONFIG_EARLY_PRINTK=y |
| 493 | 500 | CONFIG_ENCRYPTED_KEYS=m |
| 494 | 501 | CONFIG_CRYPTO_RSA=m |
| @@ -4,4 +4,34 @@ · 3 unmodified lines | ||
| 4 | 4 | #define __ALIGN .align 4 |
| 5 | 5 | #define __ALIGN_STR ".align 4" |
| 6 | 6 | |
| 7 | +/* | |
| 8 | + * Make sure the compiler doesn't do anything stupid with the | |
| 9 | + * arguments on the stack - they are owned by the *caller*, not | |
| 10 | + * the callee. This just fools gcc into not spilling into them, | |
| 11 | + * and keeps it from doing tailcall recursion and/or using the | |
| 12 | + * stack slots for temporaries, since they are live and "used" | |
| 13 | + * all the way to the end of the function. | |
| 14 | + */ | |
| 15 | +#define asmlinkage_protect(n, ret, args...) \ | |
| 16 | + __asmlinkage_protect##n(ret, ##args) | |
| 17 | +#define __asmlinkage_protect_n(ret, args...) \ | |
| 18 | + __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args) | |
| 19 | +#define __asmlinkage_protect0(ret) \ | |
| 20 | + __asmlinkage_protect_n(ret) | |
| 21 | +#define __asmlinkage_protect1(ret, arg1) \ | |
| 22 | + __asmlinkage_protect_n(ret, "m" (arg1)) | |
| 23 | +#define __asmlinkage_protect2(ret, arg1, arg2) \ | |
| 24 | + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2)) | |
| 25 | +#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \ | |
| 26 | + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3)) | |
| 27 | +#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \ | |
| 28 | + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ | |
| 29 | + "m" (arg4)) | |
| 30 | +#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \ | |
| 31 | + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ | |
| 32 | + "m" (arg4), "m" (arg5)) | |
| 33 | +#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \ | |
| 34 | + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ | |
| 35 | + "m" (arg4), "m" (arg5), "m" (arg6)) | |
| 36 | + | |
| 7 | 37 | #endif |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <uapi/asm/unistd.h> |
| 5 | 5 | |
| 6 | 6 | |
| 7 | −#define NR_syscalls 356 | |
| 7 | +#define NR_syscalls 375 | |
| 8 | 8 | |
| 9 | 9 | #define __ARCH_WANT_OLD_READDIR |
| 10 | 10 | #define __ARCH_WANT_OLD_STAT |
| @@ -361,5 +361,24 @@ · 360 unmodified lines | ||
| 361 | 361 | #define __NR_memfd_create 353 |
| 362 | 362 | #define __NR_bpf 354 |
| 363 | 363 | #define __NR_execveat 355 |
| 364 | +#define __NR_socket 356 | |
| 365 | +#define __NR_socketpair 357 | |
| 366 | +#define __NR_bind 358 | |
| 367 | +#define __NR_connect 359 | |
| 368 | +#define __NR_listen 360 | |
| 369 | +#define __NR_accept4 361 | |
| 370 | +#define __NR_getsockopt 362 | |
| 371 | +#define __NR_setsockopt 363 | |
| 372 | +#define __NR_getsockname 364 | |
| 373 | +#define __NR_getpeername 365 | |
| 374 | +#define __NR_sendto 366 | |
| 375 | +#define __NR_sendmsg 367 | |
| 376 | +#define __NR_recvfrom 368 | |
| 377 | +#define __NR_recvmsg 369 | |
| 378 | +#define __NR_shutdown 370 | |
| 379 | +#define __NR_recvmmsg 371 | |
| 380 | +#define __NR_sendmmsg 372 | |
| 381 | +#define __NR_userfaultfd 373 | |
| 382 | +#define __NR_membarrier 374 | |
| 364 | 383 | |
| 365 | 384 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
| @@ -376,4 +376,22 @@ ENTRY(sys_call_table) · 375 unmodified lines | ||
| 376 | 376 | .long sys_memfd_create |
| 377 | 377 | .long sys_bpf |
| 378 | 378 | .long sys_execveat /* 355 */ |
| 379 | − | |
| 379 | + .long sys_socket | |
| 380 | + .long sys_socketpair | |
| 381 | + .long sys_bind | |
| 382 | + .long sys_connect | |
| 383 | + .long sys_listen /* 360 */ | |
| 384 | + .long sys_accept4 | |
| 385 | + .long sys_getsockopt | |
| 386 | + .long sys_setsockopt | |
| 387 | + .long sys_getsockname | |
| 388 | + .long sys_getpeername /* 365 */ | |
| 389 | + .long sys_sendto | |
| 390 | + .long sys_sendmsg | |
| 391 | + .long sys_recvfrom | |
| 392 | + .long sys_recvmsg | |
| 393 | + .long sys_shutdown /* 370 */ | |
| 394 | + .long sys_recvmmsg | |
| 395 | + .long sys_sendmmsg | |
| 396 | + .long sys_userfaultfd | |
| 397 | + .long sys_membarrier | |
| @@ -54,4 +54,5 @@ generic-y += ucontext.h · 53 unmodified lines | ||
| 54 | 54 | generic-y += unaligned.h |
| 55 | 55 | generic-y += user.h |
| 56 | 56 | generic-y += vga.h |
| 57 | +generic-y += word-at-a-time.h | |
| 57 | 58 | generic-y += xor.h |
| @@ -10,3 +10,4 @@ generic-y += mm-arch-hooks.h · 9 unmodified lines | ||
| 10 | 10 | generic-y += preempt.h |
| 11 | 11 | generic-y += syscalls.h |
| 12 | 12 | generic-y += trace_clock.h |
| 13 | +generic-y += word-at-a-time.h | |
| @@ -863,7 +863,14 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) · 862 unmodified lines | ||
| 863 | 863 | |
| 864 | 864 | void pcibios_fixup_bus(struct pci_bus *bus) |
| 865 | 865 | { |
| 866 | − /* Fixup the bus */ | |
| 866 | + /* When called from the generic PCI probe, read PCI<->PCI bridge | |
| 867 | + * bases. This is -not- called when generating the PCI tree from | |
| 868 | + * the OF device-tree. | |
| 869 | + */ | |
| 870 | + if (bus->self != NULL) | |
| 871 | + pci_read_bridge_bases(bus); | |
| 872 | + | |
| 873 | + /* Now fixup the bus bus */ | |
| 867 | 874 | pcibios_setup_bus_self(bus); |
| 868 | 875 | |
| 869 | 876 | /* Now fixup devices on that bus */ |
| @@ -293,8 +293,26 @@ static int __init ath79_misc_intc_of_init( · 292 unmodified lines | ||
| 293 | 293 | |
| 294 | 294 | return 0; |
| 295 | 295 | } |
| 296 | −IRQCHIP_DECLARE(ath79_misc_intc, "qca,ar7100-misc-intc", | |
| 297 | − ath79_misc_intc_of_init); | |
| 296 | + | |
| 297 | +static int __init ar7100_misc_intc_of_init( | |
| 298 | + struct device_node *node, struct device_node *parent) | |
| 299 | +{ | |
| 300 | + ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; | |
| 301 | + return ath79_misc_intc_of_init(node, parent); | |
| 302 | +} | |
| 303 | + | |
| 304 | +IRQCHIP_DECLARE(ar7100_misc_intc, "qca,ar7100-misc-intc", | |
| 305 | + ar7100_misc_intc_of_init); | |
| 306 | + | |
| 307 | +static int __init ar7240_misc_intc_of_init( | |
| 308 | + struct device_node *node, struct device_node *parent) | |
| 309 | +{ | |
| 310 | + ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; | |
| 311 | + return ath79_misc_intc_of_init(node, parent); | |
| 312 | +} | |
| 313 | + | |
| 314 | +IRQCHIP_DECLARE(ar7240_misc_intc, "qca,ar7240-misc-intc", | |
| 315 | + ar7240_misc_intc_of_init); | |
| 298 | 316 | |
| 299 | 317 | static int __init ar79_cpu_intc_of_init( |
| 300 | 318 | struct device_node *node, struct device_node *parent) |
| @@ -933,7 +933,7 @@ void __init plat_mem_setup(void) · 932 unmodified lines | ||
| 933 | 933 | while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX) |
| 934 | 934 | && (total < MAX_MEMORY)) { |
| 935 | 935 | memory = cvmx_bootmem_phy_alloc(mem_alloc_size, |
| 936 | − __pa_symbol(&__init_end), -1, | |
| 936 | + __pa_symbol(&_end), -1, | |
| 937 | 937 | 0x100000, |
| 938 | 938 | CVMX_BOOTMEM_FLAG_NO_LOCKING); |
| 939 | 939 | if (memory >= 0) { |
| @@ -17,4 +17,5 @@ generic-y += segment.h · 16 unmodified lines | ||
| 17 | 17 | generic-y += serial.h |
| 18 | 18 | generic-y += trace_clock.h |
| 19 | 19 | generic-y += user.h |
| 20 | +generic-y += word-at-a-time.h | |
| 20 | 21 | generic-y += xor.h |
| @@ -20,6 +20,9 @@ · 19 unmodified lines | ||
| 20 | 20 | #ifndef cpu_has_tlb |
| 21 | 21 | #define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) |
| 22 | 22 | #endif |
| 23 | +#ifndef cpu_has_ftlb | |
| 24 | +#define cpu_has_ftlb (cpu_data[0].options & MIPS_CPU_FTLB) | |
| 25 | +#endif | |
| 23 | 26 | #ifndef cpu_has_tlbinv |
| 24 | 27 | #define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV) |
| 25 | 28 | #endif |
| @@ -385,6 +385,7 @@ enum cpu_type_enum { · 384 unmodified lines | ||
| 385 | 385 | #define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */ |
| 386 | 386 | #define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */ |
| 387 | 387 | #define MIPS_CPU_SP 0x10000000000ull /* Small (1KB) page support */ |
| 388 | +#define MIPS_CPU_FTLB 0x20000000000ull /* CPU has Fixed-page-size TLB */ | |
| 388 | 389 | |
| 389 | 390 | /* |
| 390 | 391 | * CPU ASE encodings |
| @@ -61,6 +61,7 @@ · 60 unmodified lines | ||
| 61 | 61 | #define KVM_PRIVATE_MEM_SLOTS 0 |
| 62 | 62 | |
| 63 | 63 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
| 64 | +#define KVM_HALT_POLL_NS_DEFAULT 500000 | |
| 64 | 65 | |
| 65 | 66 | |
| 66 | 67 | |
| @@ -65,6 +65,15 @@ static inline void write_maar_pair(unsigned idx, phys_addr_t lower, · 64 unmodified lines | ||
| 65 | 65 | back_to_back_c0_hazard(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | +/** | |
| 69 | + * maar_init() - initialise MAARs | |
| 70 | + * | |
| 71 | + * Performs initialisation of MAARs for the current CPU, making use of the | |
| 72 | + * platforms implementation of platform_maar_init where necessary and | |
| 73 | + * duplicating the setup it provides on secondary CPUs. | |
| 74 | + */ | |
| 75 | +extern void maar_init(void); | |
| 76 | + | |
| 68 | 77 | /** |
| 69 | 78 | * struct maar_config - MAAR configuration data |
| 70 | 79 | * @lower: The lowest address that the MAAR pair will affect. Must be |
| @@ -194,6 +194,7 @@ BUILD_CM_RW(reg3_mask, MIPS_CM_GCB_OFS + 0xc8) · 193 unmodified lines | ||
| 194 | 194 | BUILD_CM_R_(gic_status, MIPS_CM_GCB_OFS + 0xd0) |
| 195 | 195 | BUILD_CM_R_(cpc_status, MIPS_CM_GCB_OFS + 0xf0) |
| 196 | 196 | BUILD_CM_RW(l2_config, MIPS_CM_GCB_OFS + 0x130) |
| 197 | +BUILD_CM_RW(sys_config2, MIPS_CM_GCB_OFS + 0x150) | |
| 197 | 198 | |
| 198 | 199 | /* Core Local & Core Other register accessor functions */ |
| 199 | 200 | BUILD_CM_Cx_RW(reset_release, 0x00) |
| @@ -316,6 +317,10 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80) · 116 unmodified lines | ||
| 316 | 317 | #define CM_GCR_L2_CONFIG_ASSOC_SHF 0 |
| 317 | 318 | #define CM_GCR_L2_CONFIG_ASSOC_MSK (_ULCAST_(0xff) << 0) |
| 318 | 319 | |
| 320 | +/* GCR_SYS_CONFIG2 register fields */ | |
| 321 | +#define CM_GCR_SYS_CONFIG2_MAXVPW_SHF 0 | |
| 322 | +#define CM_GCR_SYS_CONFIG2_MAXVPW_MSK (_ULCAST_(0xf) << 0) | |
| 323 | + | |
| 319 | 324 | /* GCR_Cx_COHERENCE register fields */ |
| 320 | 325 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0 |
| 321 | 326 | #define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0) |
| @@ -405,4 +410,38 @@ static inline int mips_cm_revision(void) · 83 unmodified lines | ||
| 405 | 410 | return read_gcr_rev(); |
| 406 | 411 | } |
| 407 | 412 | |
| 413 | +/** | |
| 414 | + * mips_cm_max_vp_width() - return the width in bits of VP indices | |
| 415 | + * | |
| 416 | + * Return: the width, in bits, of VP indices in fields that combine core & VP | |
| 417 | + * indices. | |
| 418 | + */ | |
| 419 | +static inline unsigned int mips_cm_max_vp_width(void) | |
| 420 | +{ | |
| 421 | + extern int smp_num_siblings; | |
| 422 | + | |
| 423 | + if (mips_cm_revision() >= CM_REV_CM3) | |
| 424 | + return read_gcr_sys_config2() & CM_GCR_SYS_CONFIG2_MAXVPW_MSK; | |
| 425 | + | |
| 426 | + return smp_num_siblings; | |
| 427 | +} | |
| 428 | + | |
| 429 | +/** | |
| 430 | + * mips_cm_vp_id() - calculate the hardware VP ID for a CPU | |
| 431 | + * @cpu: the CPU whose VP ID to calculate | |
| 432 | + * | |
| 433 | + * Hardware such as the GIC uses identifiers for VPs which may not match the | |
| 434 | + * CPU numbers used by Linux. This function calculates the hardware VP | |
| 435 | + * identifier corresponding to a given CPU. | |
| 436 | + * | |
| 437 | + * Return: the VP ID for the CPU. | |
| 438 | + */ | |
| 439 | +static inline unsigned int mips_cm_vp_id(unsigned int cpu) | |
| 440 | +{ | |
| 441 | + unsigned int core = cpu_data[cpu].core; | |
| 442 | + unsigned int vp = cpu_vpe_id(&cpu_data[cpu]); | |
| 443 | + | |
| 444 | + return (core * mips_cm_max_vp_width()) + vp; | |
| 445 | +} | |
| 446 | + | |
| 408 | 447 | #endif /* __MIPS_ASM_MIPS_CM_H__ */ |
| @@ -487,6 +487,8 @@ · 486 unmodified lines | ||
| 487 | 487 | |
| 488 | 488 | /* Bits specific to the MIPS32/64 PRA. */ |
| 489 | 489 | #define MIPS_CONF_MT (_ULCAST_(7) << 7) |
| 490 | +#define MIPS_CONF_MT_TLB (_ULCAST_(1) << 7) | |
| 491 | +#define MIPS_CONF_MT_FTLB (_ULCAST_(4) << 7) | |
| 490 | 492 | #define MIPS_CONF_AR (_ULCAST_(7) << 10) |
| 491 | 493 | #define MIPS_CONF_AT (_ULCAST_(3) << 13) |
| 492 | 494 | #define MIPS_CONF_M (_ULCAST_(1) << 31) |
| @@ -377,16 +377,18 @@ · 376 unmodified lines | ||
| 377 | 377 | #define __NR_memfd_create (__NR_Linux + 354) |
| 378 | 378 | #define __NR_bpf (__NR_Linux + 355) |
| 379 | 379 | #define __NR_execveat (__NR_Linux + 356) |
| 380 | +#define __NR_userfaultfd (__NR_Linux + 357) | |
| 381 | +#define __NR_membarrier (__NR_Linux + 358) | |
| 380 | 382 | |
| 381 | 383 | /* |
| 382 | 384 | * Offset of the last Linux o32 flavoured syscall |
| 383 | 385 | */ |
| 384 | −#define __NR_Linux_syscalls 356 | |
| 386 | +#define __NR_Linux_syscalls 358 | |
| 385 | 387 | |
| 386 | 388 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
| 387 | 389 | |
| 388 | 390 | #define __NR_O32_Linux 4000 |
| 389 | −#define __NR_O32_Linux_syscalls 356 | |
| 391 | +#define __NR_O32_Linux_syscalls 358 | |
| 390 | 392 | |
| 391 | 393 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
| 392 | 394 | |
| @@ -711,16 +713,18 @@ · 318 unmodified lines | ||
| 711 | 713 | #define __NR_memfd_create (__NR_Linux + 314) |
| 712 | 714 | #define __NR_bpf (__NR_Linux + 315) |
| 713 | 715 | #define __NR_execveat (__NR_Linux + 316) |
| 716 | +#define __NR_userfaultfd (__NR_Linux + 317) | |
| 717 | +#define __NR_membarrier (__NR_Linux + 318) | |
| 714 | 718 | |
| 715 | 719 | /* |
| 716 | 720 | * Offset of the last Linux 64-bit flavoured syscall |
| 717 | 721 | */ |
| 718 | −#define __NR_Linux_syscalls 316 | |
| 722 | +#define __NR_Linux_syscalls 318 | |
| 719 | 723 | |
| 720 | 724 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
| 721 | 725 | |
| 722 | 726 | #define __NR_64_Linux 5000 |
| 723 | −#define __NR_64_Linux_syscalls 316 | |
| 727 | +#define __NR_64_Linux_syscalls 318 | |
| 724 | 728 | |
| 725 | 729 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
| 726 | 730 | |
| @@ -1049,15 +1053,17 @@ · 322 unmodified lines | ||
| 1049 | 1053 | #define __NR_memfd_create (__NR_Linux + 318) |
| 1050 | 1054 | #define __NR_bpf (__NR_Linux + 319) |
| 1051 | 1055 | #define __NR_execveat (__NR_Linux + 320) |
| 1056 | +#define __NR_userfaultfd (__NR_Linux + 321) | |
| 1057 | +#define __NR_membarrier (__NR_Linux + 322) | |
| 1052 | 1058 | |
| 1053 | 1059 | /* |
| 1054 | 1060 | * Offset of the last N32 flavoured syscall |
| 1055 | 1061 | */ |
| 1056 | −#define __NR_Linux_syscalls 320 | |
| 1062 | +#define __NR_Linux_syscalls 322 | |
| 1057 | 1063 | |
| 1058 | 1064 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
| 1059 | 1065 | |
| 1060 | 1066 | #define __NR_N32_Linux 6000 |
| 1061 | −#define __NR_N32_Linux_syscalls 320 | |
| 1067 | +#define __NR_N32_Linux_syscalls 322 | |
| 1062 | 1068 | |
| 1063 | 1069 | #endif /* _UAPI_ASM_UNISTD_H */ |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/power/jz4740-battery.h> |
| 27 | 27 | #include <linux/power/gpio-charger.h> |
| 28 | 28 | |
| 29 | +#include <asm/mach-jz4740/gpio.h> | |
| 29 | 30 | #include <asm/mach-jz4740/jz4740_fb.h> |
| 30 | 31 | #include <asm/mach-jz4740/jz4740_mmc.h> |
| 31 | 32 | #include <asm/mach-jz4740/jz4740_nand.h> |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <linux/seq_file.h> |
| 29 | 29 | |
| 30 | 30 | #include <asm/mach-jz4740/base.h> |
| 31 | +#include <asm/mach-jz4740/gpio.h> | |
| 31 | 32 | |
| 32 | 33 | #define JZ4740_GPIO_BASE_A (32*0) |
| 33 | 34 | #define JZ4740_GPIO_BASE_B (32*1) |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | mfc0 \dest, CP0_CONFIG, 3 |
| 40 | 40 | andi \dest, \dest, MIPS_CONF3_MT |
| 41 | 41 | beqz \dest, \nomt |
| 42 | + nop | |
| 42 | 43 | .endm |
| 43 | 44 | |
| 44 | 45 | .section .text.cps-vec |
| @@ -223,10 +224,9 @@ LEAF(excep_ejtag) · 178 unmodified lines | ||
| 223 | 224 | END(excep_ejtag) |
| 224 | 225 | |
| 225 | 226 | LEAF(mips_cps_core_init) |
| 226 | −#ifdef CONFIG_MIPS_MT | |
| 227 | +#ifdef CONFIG_MIPS_MT_SMP | |
| 227 | 228 | /* Check that the core implements the MT ASE */ |
| 228 | 229 | has_mt t0, 3f |
| 229 | − nop | |
| 230 | 230 | |
| 231 | 231 | .set push |
| 232 | 232 | .set mips64r2 |
| @@ -310,8 +310,9 @@ LEAF(mips_cps_boot_vpes) · 77 unmodified lines | ||
| 310 | 310 | PTR_ADDU t0, t0, t1 |
| 311 | 311 | |
| 312 | 312 | /* Calculate this VPEs ID. If the core doesn't support MT use 0 */ |
| 313 | + li t9, 0 | |
| 314 | +#ifdef CONFIG_MIPS_MT_SMP | |
| 313 | 315 | has_mt ta2, 1f |
| 314 | − li t9, 0 | |
| 315 | 316 | |
| 316 | 317 | /* Find the number of VPEs present in the core */ |
| 317 | 318 | mfc0 t1, CP0_MVPCONF0 |
| @@ -330,6 +331,7 @@ LEAF(mips_cps_boot_vpes) · 12 unmodified lines | ||
| 330 | 331 | /* Retrieve the VPE ID from EBase.CPUNum */ |
| 331 | 332 | mfc0 t9, $15, 1 |
| 332 | 333 | and t9, t9, t1 |
| 334 | +#endif | |
| 333 | 335 | |
| 334 | 336 | 1: /* Calculate a pointer to this VPEs struct vpe_boot_config */ |
| 335 | 337 | li t1, VPEBOOTCFG_SIZE |
| @@ -337,7 +339,7 @@ LEAF(mips_cps_boot_vpes) · 1 unmodified line | ||
| 337 | 339 | PTR_L ta3, COREBOOTCFG_VPECONFIG(t0) |
| 338 | 340 | PTR_ADDU v0, v0, ta3 |
| 339 | 341 | |
| 340 | −#ifdef CONFIG_MIPS_MT | |
| 342 | +#ifdef CONFIG_MIPS_MT_SMP | |
| 341 | 343 | |
| 342 | 344 | /* If the core doesn't support MT then return */ |
| 343 | 345 | bnez ta2, 1f |
| @@ -451,7 +453,7 @@ LEAF(mips_cps_boot_vpes) · 107 unmodified lines | ||
| 451 | 453 | |
| 452 | 454 | 2: .set pop |
| 453 | 455 | |
| 454 | −#endif /* CONFIG_MIPS_MT */ | |
| 456 | +#endif /* CONFIG_MIPS_MT_SMP */ | |
| 455 | 457 | |
| 456 | 458 | /* Return */ |
| 457 | 459 | jr ra |
| @@ -410,16 +410,18 @@ static int set_ftlb_enable(struct cpuinfo_mips *c, int enable) · 409 unmodified lines | ||
| 410 | 410 | static inline unsigned int decode_config0(struct cpuinfo_mips *c) |
| 411 | 411 | { |
| 412 | 412 | unsigned int config0; |
| 413 | − int isa; | |
| 413 | + int isa, mt; | |
| 414 | 414 | |
| 415 | 415 | config0 = read_c0_config(); |
| 416 | 416 | |
| 417 | 417 | /* |
| 418 | 418 | * Look for Standard TLB or Dual VTLB and FTLB |
| 419 | 419 | */ |
| 420 | − if ((((config0 & MIPS_CONF_MT) >> 7) == 1) || | |
| 421 | − (((config0 & MIPS_CONF_MT) >> 7) == 4)) | |
| 420 | + mt = config0 & MIPS_CONF_MT; | |
| 421 | + if (mt == MIPS_CONF_MT_TLB) | |
| 422 | 422 | c->options |= MIPS_CPU_TLB; |
| 423 | + else if (mt == MIPS_CONF_MT_FTLB) | |
| 424 | + c->options |= MIPS_CPU_TLB | MIPS_CPU_FTLB; | |
| 423 | 425 | |
| 424 | 426 | isa = (config0 & MIPS_CONF_AT) >> 13; |
| 425 | 427 | switch (isa) { |
| @@ -559,15 +561,18 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c) · 133 unmodified lines | ||
| 559 | 561 | if (cpu_has_tlb) { |
| 560 | 562 | if (((config4 & MIPS_CONF4_IE) >> 29) == 2) |
| 561 | 563 | c->options |= MIPS_CPU_TLBINV; |
| 564 | + | |
| 562 | 565 | /* |
| 563 | − * This is a bit ugly. R6 has dropped that field from | |
| 564 | − * config4 and the only valid configuration is VTLB+FTLB so | |
| 565 | − * set a good value for mmuextdef for that case. | |
| 566 | + * R6 has dropped the MMUExtDef field from config4. | |
| 567 | + * On R6 the fields always describe the FTLB, and only if it is | |
| 568 | + * present according to Config.MT. | |
| 566 | 569 | */ |
| 567 | − if (cpu_has_mips_r6) | |
| 570 | + if (!cpu_has_mips_r6) | |
| 571 | + mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF; | |
| 572 | + else if (cpu_has_ftlb) | |
| 568 | 573 | mmuextdef = MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT; |
| 569 | 574 | else |
| 570 | − mmuextdef = config4 & MIPS_CONF4_MMUEXTDEF; | |
| 575 | + mmuextdef = 0; | |
| 571 | 576 | |
| 572 | 577 | switch (mmuextdef) { |
| 573 | 578 | case MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT: |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | .set pop |
| 19 | 19 | /* |
| 20 | 20 | * task_struct *resume(task_struct *prev, task_struct *next, |
| 21 | − * struct thread_info *next_ti, int usedfpu) | |
| 21 | + * struct thread_info *next_ti) | |
| 22 | 22 | */ |
| 23 | 23 | .align 7 |
| 24 | 24 | LEAF(resume) |
| @@ -28,30 +28,6 @@ · 3 unmodified lines | ||
| 28 | 28 | cpu_save_nonscratch a0 |
| 29 | 29 | LONG_S ra, THREAD_REG31(a0) |
| 30 | 30 | |
| 31 | − /* | |
| 32 | − * check if we need to save FPU registers | |
| 33 | − */ | |
| 34 | − .set push | |
| 35 | − .set noreorder | |
| 36 | − beqz a3, 1f | |
| 37 | − PTR_L t3, TASK_THREAD_INFO(a0) | |
| 38 | − .set pop | |
| 39 | − | |
| 40 | − /* | |
| 41 | − * clear saved user stack CU1 bit | |
| 42 | − */ | |
| 43 | − LONG_L t0, ST_OFF(t3) | |
| 44 | − li t1, ~ST0_CU1 | |
| 45 | − and t0, t0, t1 | |
| 46 | − LONG_S t0, ST_OFF(t3) | |
| 47 | − | |
| 48 | − .set push | |
| 49 | − .set arch=mips64r2 | |
| 50 | − fpu_save_double a0 t0 t1 # c0_status passed in t0 | |
| 51 | − # clobbers t1 | |
| 52 | − .set pop | |
| 53 | −1: | |
| 54 | − | |
| 55 | 31 | #if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 |
| 56 | 32 | /* Check if we need to store CVMSEG state */ |
| 57 | 33 | dmfc0 t0, $11,7 /* CvmMemCtl */ |
| @@ -30,19 +30,9 @@ · 29 unmodified lines | ||
| 30 | 30 | */ |
| 31 | 31 | #define ST_OFF (_THREAD_SIZE - 32 - PT_SIZE + PT_STATUS) |
| 32 | 32 | |
| 33 | −/* | |
| 34 | − * FPU context is saved iff the process has used it's FPU in the current | |
| 35 | − * time slice as indicated by TIF_USEDFPU. In any case, the CU1 bit for user | |
| 36 | − * space STATUS register should be 0, so that a process *always* starts its | |
| 37 | − * userland with FPU disabled after each context switch. | |
| 38 | − * | |
| 39 | − * FPU will be enabled as soon as the process accesses FPU again, through | |
| 40 | − * do_cpu() trap. | |
| 41 | − */ | |
| 42 | − | |
| 43 | 33 | /* |
| 44 | 34 | * task_struct *resume(task_struct *prev, task_struct *next, |
| 45 | − * struct thread_info *next_ti, int usedfpu) | |
| 35 | + * struct thread_info *next_ti) | |
| 46 | 36 | */ |
| 47 | 37 | LEAF(resume) |
| 48 | 38 | mfc0 t1, CP0_STATUS |
| @@ -50,22 +40,6 @@ LEAF(resume) · 1 unmodified line | ||
| 50 | 40 | cpu_save_nonscratch a0 |
| 51 | 41 | sw ra, THREAD_REG31(a0) |
| 52 | 42 | |
| 53 | − beqz a3, 1f | |
| 54 | − | |
| 55 | − PTR_L t3, TASK_THREAD_INFO(a0) | |
| 56 | − | |
| 57 | − /* | |
| 58 | − * clear saved user stack CU1 bit | |
| 59 | − */ | |
| 60 | − lw t0, ST_OFF(t3) | |
| 61 | − li t1, ~ST0_CU1 | |
| 62 | − and t0, t0, t1 | |
| 63 | − sw t0, ST_OFF(t3) | |
| 64 | − | |
| 65 | − fpu_save_single a0, t0 # clobbers t0 | |
| 66 | − | |
| 67 | −1: | |
| 68 | − | |
| 69 | 43 | #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) |
| 70 | 44 | PTR_LA t8, __stack_chk_guard |
| 71 | 45 | LONG_L t9, TASK_STACK_CANARY(a1) |
| @@ -36,16 +36,8 @@ NESTED(handle_sys, PT_SIZE, sp) · 35 unmodified lines | ||
| 36 | 36 | lw t1, PT_EPC(sp) # skip syscall on return |
| 37 | 37 | |
| 38 | 38 | subu v0, v0, __NR_O32_Linux # check syscall number |
| 39 | − sltiu t0, v0, __NR_O32_Linux_syscalls + 1 | |
| 40 | 39 | addiu t1, 4 # skip to next instruction |
| 41 | 40 | sw t1, PT_EPC(sp) |
| 42 | − beqz t0, illegal_syscall | |
| 43 | − | |
| 44 | − sll t0, v0, 2 | |
| 45 | − la t1, sys_call_table | |
| 46 | − addu t1, t0 | |
| 47 | − lw t2, (t1) # syscall routine | |
| 48 | − beqz t2, illegal_syscall | |
| 49 | 41 | |
| 50 | 42 | sw a3, PT_R26(sp) # save a3 for syscall restarting |
| 51 | 43 | |
| @@ -96,6 +88,16 @@ loads_done: · 44 unmodified lines | ||
| 96 | 88 | li t1, _TIF_WORK_SYSCALL_ENTRY |
| 97 | 89 | and t0, t1 |
| 98 | 90 | bnez t0, syscall_trace_entry # -> yes |
| 91 | +syscall_common: | |
| 92 | + sltiu t0, v0, __NR_O32_Linux_syscalls + 1 | |
| 93 | + beqz t0, illegal_syscall | |
| 94 | + | |
| 95 | + sll t0, v0, 2 | |
| 96 | + la t1, sys_call_table | |
| 97 | + addu t1, t0 | |
| 98 | + lw t2, (t1) # syscall routine | |
| 99 | + | |
| 100 | + beqz t2, illegal_syscall | |
| 99 | 101 | |
| 100 | 102 | jalr t2 # Do The Real Thing (TM) |
| 101 | 103 | |
| @@ -116,7 +118,7 @@ o32_syscall_exit: · 14 unmodified lines | ||
| 116 | 118 | |
| 117 | 119 | syscall_trace_entry: |
| 118 | 120 | SAVE_STATIC |
| 119 | − move s0, t2 | |
| 121 | + move s0, v0 | |
| 120 | 122 | move a0, sp |
| 121 | 123 | |
| 122 | 124 | /* |
| @@ -129,27 +131,18 @@ syscall_trace_entry: · 6 unmodified lines | ||
| 129 | 131 | |
| 130 | 132 | 1: jal syscall_trace_enter |
| 131 | 133 | |
| 132 | − bltz v0, 2f # seccomp failed? Skip syscall | |
| 134 | + bltz v0, 1f # seccomp failed? Skip syscall | |
| 135 | + | |
| 136 | + move v0, s0 # restore syscall | |
| 133 | 137 | |
| 134 | − move t0, s0 | |
| 135 | 138 | RESTORE_STATIC |
| 136 | 139 | lw a0, PT_R4(sp) # Restore argument registers |
| 137 | 140 | lw a1, PT_R5(sp) |
| 138 | 141 | lw a2, PT_R6(sp) |
| 139 | 142 | lw a3, PT_R7(sp) |
| 140 | − jalr t0 | |
| 141 | − | |
| 142 | − li t0, -EMAXERRNO - 1 # error? | |
| 143 | − sltu t0, t0, v0 | |
| 144 | − sw t0, PT_R7(sp) # set error flag | |
| 145 | − beqz t0, 1f | |
| 146 | − | |
| 147 | − lw t1, PT_R2(sp) # syscall number | |
| 148 | − negu v0 # error | |
| 149 | − sw t1, PT_R0(sp) # save it for syscall restarting | |
| 150 | −1: sw v0, PT_R2(sp) # result | |
| 143 | + j syscall_common | |
| 151 | 144 | |
| 152 | −2: j syscall_exit | |
| 145 | +1: j syscall_exit | |
| 153 | 146 | |
| 154 | 147 | /* ------------------------------------------------------------------------ */ |
| 155 | 148 | |
| @@ -599,3 +592,5 @@ EXPORT(sys_call_table) · 443 unmodified lines | ||
| 599 | 592 | PTR sys_memfd_create |
| 600 | 593 | PTR sys_bpf /* 4355 */ |
| 601 | 594 | PTR sys_execveat |
| 595 | + PTR sys_userfaultfd | |
| 596 | + PTR sys_membarrier | |
| @@ -39,18 +39,11 @@ NESTED(handle_sys64, PT_SIZE, sp) · 38 unmodified lines | ||
| 39 | 39 | .set at |
| 40 | 40 | #endif |
| 41 | 41 | |
| 42 | − dsubu t0, v0, __NR_64_Linux # check syscall number | |
| 43 | − sltiu t0, t0, __NR_64_Linux_syscalls + 1 | |
| 44 | 42 | #if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32) |
| 45 | 43 | ld t1, PT_EPC(sp) # skip syscall on return |
| 46 | 44 | daddiu t1, 4 # skip to next instruction |
| 47 | 45 | sd t1, PT_EPC(sp) |
| 48 | 46 | #endif |
| 49 | − beqz t0, illegal_syscall | |
| 50 | − | |
| 51 | − dsll t0, v0, 3 # offset into table | |
| 52 | − ld t2, (sys_call_table - (__NR_64_Linux * 8))(t0) | |
| 53 | − # syscall routine | |
| 54 | 47 | |
| 55 | 48 | sd a3, PT_R26(sp) # save a3 for syscall restarting |
| 56 | 49 | |
| @@ -59,6 +52,17 @@ NESTED(handle_sys64, PT_SIZE, sp) · 2 unmodified lines | ||
| 59 | 52 | and t0, t1, t0 |
| 60 | 53 | bnez t0, syscall_trace_entry |
| 61 | 54 | |
| 55 | +syscall_common: | |
| 56 | + dsubu t2, v0, __NR_64_Linux | |
| 57 | + sltiu t0, t2, __NR_64_Linux_syscalls + 1 | |
| 58 | + beqz t0, illegal_syscall | |
| 59 | + | |
| 60 | + dsll t0, t2, 3 # offset into table | |
| 61 | + dla t2, sys_call_table | |
| 62 | + daddu t0, t2, t0 | |
| 63 | + ld t2, (t0) # syscall routine | |
| 64 | + beqz t2, illegal_syscall | |
| 65 | + | |
| 62 | 66 | jalr t2 # Do The Real Thing (TM) |
| 63 | 67 | |
| 64 | 68 | li t0, -EMAXERRNO - 1 # error? |
| @@ -78,14 +82,14 @@ n64_syscall_exit: · 13 unmodified lines | ||
| 78 | 82 | |
| 79 | 83 | syscall_trace_entry: |
| 80 | 84 | SAVE_STATIC |
| 81 | − move s0, t2 | |
| 85 | + move s0, v0 | |
| 82 | 86 | move a0, sp |
| 83 | 87 | move a1, v0 |
| 84 | 88 | jal syscall_trace_enter |
| 85 | 89 | |
| 86 | − bltz v0, 2f # seccomp failed? Skip syscall | |
| 90 | + bltz v0, 1f # seccomp failed? Skip syscall | |
| 87 | 91 | |
| 88 | − move t0, s0 | |
| 92 | + move v0, s0 | |
| 89 | 93 | RESTORE_STATIC |
| 90 | 94 | ld a0, PT_R4(sp) # Restore argument registers |
| 91 | 95 | ld a1, PT_R5(sp) |
| @@ -93,19 +97,9 @@ syscall_trace_entry: · 1 unmodified line | ||
| 93 | 97 | ld a3, PT_R7(sp) |
| 94 | 98 | ld a4, PT_R8(sp) |
| 95 | 99 | ld a5, PT_R9(sp) |
| 96 | − jalr t0 | |
| 97 | − | |
| 98 | − li t0, -EMAXERRNO - 1 # error? | |
| 99 | − sltu t0, t0, v0 | |
| 100 | − sd t0, PT_R7(sp) # set error flag | |
| 101 | − beqz t0, 1f | |
| 102 | − | |
| 103 | − ld t1, PT_R2(sp) # syscall number | |
| 104 | − dnegu v0 # error | |
| 105 | − sd t1, PT_R0(sp) # save it for syscall restarting | |
| 106 | −1: sd v0, PT_R2(sp) # result | |
| 100 | + j syscall_common | |
| 107 | 101 | |
| 108 | −2: j syscall_exit | |
| 102 | +1: j syscall_exit | |
| 109 | 103 | |
| 110 | 104 | illegal_syscall: |
| 111 | 105 | /* This also isn't a 64-bit syscall, throw an error. */ |
| @@ -436,4 +430,6 @@ EXPORT(sys_call_table) · 324 unmodified lines | ||
| 436 | 430 | PTR sys_memfd_create |
| 437 | 431 | PTR sys_bpf /* 5315 */ |
| 438 | 432 | PTR sys_execveat |
| 433 | + PTR sys_userfaultfd | |
| 434 | + PTR sys_membarrier | |
| 439 | 435 | .size sys_call_table,.-sys_call_table |
| @@ -52,6 +52,7 @@ NESTED(handle_sysn32, PT_SIZE, sp) · 51 unmodified lines | ||
| 52 | 52 | and t0, t1, t0 |
| 53 | 53 | bnez t0, n32_syscall_trace_entry |
| 54 | 54 | |
| 55 | +syscall_common: | |
| 55 | 56 | jalr t2 # Do The Real Thing (TM) |
| 56 | 57 | |
| 57 | 58 | li t0, -EMAXERRNO - 1 # error? |
| @@ -75,9 +76,9 @@ n32_syscall_trace_entry: · 17 unmodified lines | ||
| 75 | 76 | move a1, v0 |
| 76 | 77 | jal syscall_trace_enter |
| 77 | 78 | |
| 78 | − bltz v0, 2f # seccomp failed? Skip syscall | |
| 79 | + bltz v0, 1f # seccomp failed? Skip syscall | |
| 79 | 80 | |
| 80 | − move t0, s0 | |
| 81 | + move t2, s0 | |
| 81 | 82 | RESTORE_STATIC |
| 82 | 83 | ld a0, PT_R4(sp) # Restore argument registers |
| 83 | 84 | ld a1, PT_R5(sp) |
| @@ -85,19 +86,9 @@ n32_syscall_trace_entry: · 1 unmodified line | ||
| 85 | 86 | ld a3, PT_R7(sp) |
| 86 | 87 | ld a4, PT_R8(sp) |
| 87 | 88 | ld a5, PT_R9(sp) |
| 88 | − jalr t0 | |
| 89 | + j syscall_common | |
| 89 | 90 | |
| 90 | − li t0, -EMAXERRNO - 1 # error? | |
| 91 | − sltu t0, t0, v0 | |
| 92 | − sd t0, PT_R7(sp) # set error flag | |
| 93 | − beqz t0, 1f | |
| 94 | − | |
| 95 | − ld t1, PT_R2(sp) # syscall number | |
| 96 | − dnegu v0 # error | |
| 97 | − sd t1, PT_R0(sp) # save it for syscall restarting | |
| 98 | −1: sd v0, PT_R2(sp) # result | |
| 99 | − | |
| 100 | −2: j syscall_exit | |
| 91 | +1: j syscall_exit | |
| 101 | 92 | |
| 102 | 93 | not_n32_scall: |
| 103 | 94 | /* This is not an n32 compatibility syscall, pass it on to |
| @@ -429,4 +420,6 @@ EXPORT(sysn32_call_table) · 325 unmodified lines | ||
| 429 | 420 | PTR sys_memfd_create |
| 430 | 421 | PTR sys_bpf |
| 431 | 422 | PTR compat_sys_execveat /* 6320 */ |
| 423 | + PTR sys_userfaultfd | |
| 424 | + PTR sys_membarrier | |
| 432 | 425 | .size sysn32_call_table,.-sysn32_call_table |
| @@ -87,6 +87,7 @@ loads_done: · 86 unmodified lines | ||
| 87 | 87 | and t0, t1, t0 |
| 88 | 88 | bnez t0, trace_a_syscall |
| 89 | 89 | |
| 90 | +syscall_common: | |
| 90 | 91 | jalr t2 # Do The Real Thing (TM) |
| 91 | 92 | |
| 92 | 93 | li t0, -EMAXERRNO - 1 # error? |
| @@ -130,9 +131,9 @@ trace_a_syscall: · 37 unmodified lines | ||
| 130 | 131 | |
| 131 | 132 | 1: jal syscall_trace_enter |
| 132 | 133 | |
| 133 | − bltz v0, 2f # seccomp failed? Skip syscall | |
| 134 | + bltz v0, 1f # seccomp failed? Skip syscall | |
| 134 | 135 | |
| 135 | − move t0, s0 | |
| 136 | + move t2, s0 | |
| 136 | 137 | RESTORE_STATIC |
| 137 | 138 | ld a0, PT_R4(sp) # Restore argument registers |
| 138 | 139 | ld a1, PT_R5(sp) |
| @@ -142,19 +143,9 @@ trace_a_syscall: · 3 unmodified lines | ||
| 142 | 143 | ld a5, PT_R9(sp) |
| 143 | 144 | ld a6, PT_R10(sp) |
| 144 | 145 | ld a7, PT_R11(sp) # For indirect syscalls |
| 145 | − jalr t0 | |
| 146 | + j syscall_common | |
| 146 | 147 | |
| 147 | − li t0, -EMAXERRNO - 1 # error? | |
| 148 | − sltu t0, t0, v0 | |
| 149 | − sd t0, PT_R7(sp) # set error flag | |
| 150 | − beqz t0, 1f | |
| 151 | − | |
| 152 | − ld t1, PT_R2(sp) # syscall number | |
| 153 | − dnegu v0 # error | |
| 154 | − sd t1, PT_R0(sp) # save it for syscall restarting | |
| 155 | −1: sd v0, PT_R2(sp) # result | |
| 156 | − | |
| 157 | −2: j syscall_exit | |
| 148 | +1: j syscall_exit | |
| 158 | 149 | |
| 159 | 150 | /* ------------------------------------------------------------------------ */ |
| 160 | 151 | |
| @@ -584,4 +575,6 @@ EXPORT(sys32_call_table) · 423 unmodified lines | ||
| 584 | 575 | PTR sys_memfd_create |
| 585 | 576 | PTR sys_bpf /* 4355 */ |
| 586 | 577 | PTR compat_sys_execveat |
| 578 | + PTR sys_userfaultfd | |
| 579 | + PTR sys_membarrier | |
| 587 | 580 | .size sys32_call_table,.-sys32_call_table |
| @@ -338,7 +338,7 @@ static void __init bootmem_init(void) · 337 unmodified lines | ||
| 338 | 338 | if (end <= reserved_end) |
| 339 | 339 | continue; |
| 340 | 340 | #ifdef CONFIG_BLK_DEV_INITRD |
| 341 | − /* mapstart should be after initrd_end */ | |
| 341 | + /* Skip zones before initrd and initrd itself */ | |
| 342 | 342 | if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end))) |
| 343 | 343 | continue; |
| 344 | 344 | #endif |
| @@ -371,6 +371,14 @@ static void __init bootmem_init(void) · 26 unmodified lines | ||
| 371 | 371 | max_low_pfn = PFN_DOWN(HIGHMEM_START); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | +#ifdef CONFIG_BLK_DEV_INITRD | |
| 375 | + /* | |
| 376 | + * mapstart should be after initrd_end | |
| 377 | + */ | |
| 378 | + if (initrd_end) | |
| 379 | + mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end))); | |
| 380 | +#endif | |
| 381 | + | |
| 374 | 382 | /* |
| 375 | 383 | * Initialize the boot-time allocator with low memory only. |
| 376 | 384 | */ |
| @@ -42,6 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | #include <asm/mmu_context.h> |
| 43 | 43 | #include <asm/time.h> |
| 44 | 44 | #include <asm/setup.h> |
| 45 | +#include <asm/maar.h> | |
| 45 | 46 | |
| 46 | 47 | cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ |
| 47 | 48 | |
| @@ -157,6 +158,7 @@ asmlinkage void start_secondary(void) · 109 unmodified lines | ||
| 157 | 158 | mips_clockevent_init(); |
| 158 | 159 | mp_ops->init_secondary(); |
| 159 | 160 | cpu_report(); |
| 161 | + maar_init(); | |
| 160 | 162 | |
| 161 | 163 | /* |
| 162 | 164 | * XXX parity protection should be folded in here when it's converted |
| @@ -64,6 +64,9 @@ void __init prom_init_env(void) · 63 unmodified lines | ||
| 64 | 64 | } |
| 65 | 65 | if (memsize == 0) |
| 66 | 66 | memsize = 256; |
| 67 | + | |
| 68 | + loongson_sysconf.nr_uarts = 1; | |
| 69 | + | |
| 67 | 70 | pr_info("memsize=%u, highmemsize=%u\n", memsize, highmemsize); |
| 68 | 71 | #else |
| 69 | 72 | struct boot_params *boot_p; |
| @@ -100,7 +100,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) · 99 unmodified lines | ||
| 100 | 100 | else |
| 101 | 101 | #endif |
| 102 | 102 | #if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32) |
| 103 | − if (dev->coherent_dma_mask < DMA_BIT_MASK(64)) | |
| 103 | + if (dev->coherent_dma_mask < DMA_BIT_MASK(sizeof(phys_addr_t) * 8)) | |
| 104 | 104 | dma_flag = __GFP_DMA; |
| 105 | 105 | else |
| 106 | 106 | #endif |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <asm/pgalloc.h> |
| 45 | 45 | #include <asm/tlb.h> |
| 46 | 46 | #include <asm/fixmap.h> |
| 47 | +#include <asm/maar.h> | |
| 47 | 48 | |
| 48 | 49 | /* |
| 49 | 50 | * We have up to 8 empty zeroed pages so we can map one of the right colour |
| @@ -252,6 +253,119 @@ void __init fixrange_init(unsigned long start, unsigned long end, · 202 unmodified lines | ||
| 252 | 253 | #endif |
| 253 | 254 | } |
| 254 | 255 | |
| 256 | +unsigned __weak platform_maar_init(unsigned num_pairs) | |
| 257 | +{ | |
| 258 | + struct maar_config cfg[BOOT_MEM_MAP_MAX]; | |
| 259 | + unsigned i, num_configured, num_cfg = 0; | |
| 260 | + phys_addr_t skip; | |
| 261 | + | |
| 262 | + for (i = 0; i < boot_mem_map.nr_map; i++) { | |
| 263 | + switch (boot_mem_map.map[i].type) { | |
| 264 | + case BOOT_MEM_RAM: | |
| 265 | + case BOOT_MEM_INIT_RAM: | |
| 266 | + break; | |
| 267 | + default: | |
| 268 | + continue; | |
| 269 | + } | |
| 270 | + | |
| 271 | + skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | |
| 272 | + | |
| 273 | + cfg[num_cfg].lower = boot_mem_map.map[i].addr; | |
| 274 | + cfg[num_cfg].lower += skip; | |
| 275 | + | |
| 276 | + cfg[num_cfg].upper = cfg[num_cfg].lower; | |
| 277 | + cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | |
| 278 | + cfg[num_cfg].upper -= skip; | |
| 279 | + | |
| 280 | + cfg[num_cfg].attrs = MIPS_MAAR_S; | |
| 281 | + num_cfg++; | |
| 282 | + } | |
| 283 | + | |
| 284 | + num_configured = maar_config(cfg, num_cfg, num_pairs); | |
| 285 | + if (num_configured < num_cfg) | |
| 286 | + pr_warn("Not enough MAAR pairs (%u) for all bootmem regions (%u)\n", | |
| 287 | + num_pairs, num_cfg); | |
| 288 | + | |
| 289 | + return num_configured; | |
| 290 | +} | |
| 291 | + | |
| 292 | +void maar_init(void) | |
| 293 | +{ | |
| 294 | + unsigned num_maars, used, i; | |
| 295 | + phys_addr_t lower, upper, attr; | |
| 296 | + static struct { | |
| 297 | + struct maar_config cfgs[3]; | |
| 298 | + unsigned used; | |
| 299 | + } recorded = { { { 0 } }, 0 }; | |
| 300 | + | |
| 301 | + if (!cpu_has_maar) | |
| 302 | + return; | |
| 303 | + | |
| 304 | + /* Detect the number of MAARs */ | |
| 305 | + write_c0_maari(~0); | |
| 306 | + back_to_back_c0_hazard(); | |
| 307 | + num_maars = read_c0_maari() + 1; | |
| 308 | + | |
| 309 | + /* MAARs should be in pairs */ | |
| 310 | + WARN_ON(num_maars % 2); | |
| 311 | + | |
| 312 | + /* Set MAARs using values we recorded already */ | |
| 313 | + if (recorded.used) { | |
| 314 | + used = maar_config(recorded.cfgs, recorded.used, num_maars / 2); | |
| 315 | + BUG_ON(used != recorded.used); | |
| 316 | + } else { | |
| 317 | + /* Configure the required MAARs */ | |
| 318 | + used = platform_maar_init(num_maars / 2); | |
| 319 | + } | |
| 320 | + | |
| 321 | + /* Disable any further MAARs */ | |
| 322 | + for (i = (used * 2); i < num_maars; i++) { | |
| 323 | + write_c0_maari(i); | |
| 324 | + back_to_back_c0_hazard(); | |
| 325 | + write_c0_maar(0); | |
| 326 | + back_to_back_c0_hazard(); | |
| 327 | + } | |
| 328 | + | |
| 329 | + if (recorded.used) | |
| 330 | + return; | |
| 331 | + | |
| 332 | + pr_info("MAAR configuration:\n"); | |
| 333 | + for (i = 0; i < num_maars; i += 2) { | |
| 334 | + write_c0_maari(i); | |
| 335 | + back_to_back_c0_hazard(); | |
| 336 | + upper = read_c0_maar(); | |
| 337 | + | |
| 338 | + write_c0_maari(i + 1); | |
| 339 | + back_to_back_c0_hazard(); | |
| 340 | + lower = read_c0_maar(); | |
| 341 | + | |
| 342 | + attr = lower & upper; | |
| 343 | + lower = (lower & MIPS_MAAR_ADDR) << 4; | |
| 344 | + upper = ((upper & MIPS_MAAR_ADDR) << 4) | 0xffff; | |
| 345 | + | |
| 346 | + pr_info(" [%d]: ", i / 2); | |
| 347 | + if (!(attr & MIPS_MAAR_V)) { | |
| 348 | + pr_cont("disabled\n"); | |
| 349 | + continue; | |
| 350 | + } | |
| 351 | + | |
| 352 | + pr_cont("%pa-%pa", &lower, &upper); | |
| 353 | + | |
| 354 | + if (attr & MIPS_MAAR_S) | |
| 355 | + pr_cont(" speculate"); | |
| 356 | + | |
| 357 | + pr_cont("\n"); | |
| 358 | + | |
| 359 | + /* Record the setup for use on secondary CPUs */ | |
| 360 | + if (used <= ARRAY_SIZE(recorded.cfgs)) { | |
| 361 | + recorded.cfgs[recorded.used].lower = lower; | |
| 362 | + recorded.cfgs[recorded.used].upper = upper; | |
| 363 | + recorded.cfgs[recorded.used].attrs = attr; | |
| 364 | + recorded.used++; | |
| 365 | + } | |
| 366 | + } | |
| 367 | +} | |
| 368 | + | |
| 255 | 369 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
| 256 | 370 | int page_is_ram(unsigned long pagenr) |
| 257 | 371 | { |
| @@ -334,69 +448,6 @@ static inline void mem_init_free_highmem(void) · 76 unmodified lines | ||
| 334 | 448 | #endif |
| 335 | 449 | } |
| 336 | 450 | |
| 337 | −unsigned __weak platform_maar_init(unsigned num_pairs) | |
| 338 | −{ | |
| 339 | − struct maar_config cfg[BOOT_MEM_MAP_MAX]; | |
| 340 | − unsigned i, num_configured, num_cfg = 0; | |
| 341 | − phys_addr_t skip; | |
| 342 | − | |
| 343 | − for (i = 0; i < boot_mem_map.nr_map; i++) { | |
| 344 | − switch (boot_mem_map.map[i].type) { | |
| 345 | − case BOOT_MEM_RAM: | |
| 346 | − case BOOT_MEM_INIT_RAM: | |
| 347 | − break; | |
| 348 | − default: | |
| 349 | − continue; | |
| 350 | − } | |
| 351 | − | |
| 352 | − skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | |
| 353 | − | |
| 354 | − cfg[num_cfg].lower = boot_mem_map.map[i].addr; | |
| 355 | − cfg[num_cfg].lower += skip; | |
| 356 | − | |
| 357 | − cfg[num_cfg].upper = cfg[num_cfg].lower; | |
| 358 | − cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | |
| 359 | − cfg[num_cfg].upper -= skip; | |
| 360 | − | |
| 361 | − cfg[num_cfg].attrs = MIPS_MAAR_S; | |
| 362 | − num_cfg++; | |
| 363 | − } | |
| 364 | − | |
| 365 | − num_configured = maar_config(cfg, num_cfg, num_pairs); | |
| 366 | − if (num_configured < num_cfg) | |
| 367 | − pr_warn("Not enough MAAR pairs (%u) for all bootmem regions (%u)\n", | |
| 368 | − num_pairs, num_cfg); | |
| 369 | − | |
| 370 | − return num_configured; | |
| 371 | −} | |
| 372 | − | |
| 373 | −static void maar_init(void) | |
| 374 | −{ | |
| 375 | − unsigned num_maars, used, i; | |
| 376 | − | |
| 377 | − if (!cpu_has_maar) | |
| 378 | − return; | |
| 379 | − | |
| 380 | − /* Detect the number of MAARs */ | |
| 381 | − write_c0_maari(~0); | |
| 382 | − back_to_back_c0_hazard(); | |
| 383 | − num_maars = read_c0_maari() + 1; | |
| 384 | − | |
| 385 | − /* MAARs should be in pairs */ | |
| 386 | − WARN_ON(num_maars % 2); | |
| 387 | − | |
| 388 | − /* Configure the required MAARs */ | |
| 389 | − used = platform_maar_init(num_maars / 2); | |
| 390 | − | |
| 391 | − /* Disable any further MAARs */ | |
| 392 | − for (i = (used * 2); i < num_maars; i++) { | |
| 393 | − write_c0_maari(i); | |
| 394 | − back_to_back_c0_hazard(); | |
| 395 | − write_c0_maar(0); | |
| 396 | − back_to_back_c0_hazard(); | |
| 397 | − } | |
| 398 | −} | |
| 399 | − | |
| 400 | 451 | void __init mem_init(void) |
| 401 | 452 | { |
| 402 | 453 | #ifdef CONFIG_HIGHMEM |
| @@ -57,15 +57,28 @@ · 56 unmodified lines | ||
| 57 | 57 | |
| 58 | 58 | LEAF(sk_load_word) |
| 59 | 59 | is_offset_negative(word) |
| 60 | − .globl sk_load_word_positive | |
| 61 | −sk_load_word_positive: | |
| 60 | +FEXPORT(sk_load_word_positive) | |
| 62 | 61 | is_offset_in_header(4, word) |
| 63 | 62 | /* Offset within header boundaries */ |
| 64 | 63 | PTR_ADDU t1, $r_skb_data, offset |
| 64 | + .set reorder | |
| 65 | 65 | lw $r_A, 0(t1) |
| 66 | + .set noreorder | |
| 66 | 67 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
| 68 | +# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | |
| 67 | 69 | wsbh t0, $r_A |
| 68 | 70 | rotr $r_A, t0, 16 |
| 71 | +# else | |
| 72 | + sll t0, $r_A, 24 | |
| 73 | + srl t1, $r_A, 24 | |
| 74 | + srl t2, $r_A, 8 | |
| 75 | + or t0, t0, t1 | |
| 76 | + andi t2, t2, 0xff00 | |
| 77 | + andi t1, $r_A, 0xff00 | |
| 78 | + or t0, t0, t2 | |
| 79 | + sll t1, t1, 8 | |
| 80 | + or $r_A, t0, t1 | |
| 81 | +# endif | |
| 69 | 82 | #endif |
| 70 | 83 | jr $r_ra |
| 71 | 84 | move $r_ret, zero |
| @@ -73,15 +86,24 @@ sk_load_word_positive: · 1 unmodified line | ||
| 73 | 86 | |
| 74 | 87 | LEAF(sk_load_half) |
| 75 | 88 | is_offset_negative(half) |
| 76 | − .globl sk_load_half_positive | |
| 77 | −sk_load_half_positive: | |
| 89 | +FEXPORT(sk_load_half_positive) | |
| 78 | 90 | is_offset_in_header(2, half) |
| 79 | 91 | /* Offset within header boundaries */ |
| 80 | 92 | PTR_ADDU t1, $r_skb_data, offset |
| 93 | + .set reorder | |
| 81 | 94 | lh $r_A, 0(t1) |
| 95 | + .set noreorder | |
| 82 | 96 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
| 97 | +# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | |
| 83 | 98 | wsbh t0, $r_A |
| 84 | 99 | seh $r_A, t0 |
| 100 | +# else | |
| 101 | + sll t0, $r_A, 24 | |
| 102 | + andi t1, $r_A, 0xff00 | |
| 103 | + sra t0, t0, 16 | |
| 104 | + srl t1, t1, 8 | |
| 105 | + or $r_A, t0, t1 | |
| 106 | +# endif | |
| 85 | 107 | #endif |
| 86 | 108 | jr $r_ra |
| 87 | 109 | move $r_ret, zero |
| @@ -89,8 +111,7 @@ sk_load_half_positive: · 1 unmodified line | ||
| 89 | 111 | |
| 90 | 112 | LEAF(sk_load_byte) |
| 91 | 113 | is_offset_negative(byte) |
| 92 | − .globl sk_load_byte_positive | |
| 93 | −sk_load_byte_positive: | |
| 114 | +FEXPORT(sk_load_byte_positive) | |
| 94 | 115 | is_offset_in_header(1, byte) |
| 95 | 116 | /* Offset within header boundaries */ |
| 96 | 117 | PTR_ADDU t1, $r_skb_data, offset |
| @@ -148,23 +169,47 @@ sk_load_byte_positive: · 51 unmodified lines | ||
| 148 | 169 | NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp) |
| 149 | 170 | bpf_slow_path_common(4) |
| 150 | 171 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
| 172 | +# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | |
| 151 | 173 | wsbh t0, $r_s0 |
| 152 | 174 | jr $r_ra |
| 153 | 175 | rotr $r_A, t0, 16 |
| 154 | −#endif | |
| 176 | +# else | |
| 177 | + sll t0, $r_s0, 24 | |
| 178 | + srl t1, $r_s0, 24 | |
| 179 | + srl t2, $r_s0, 8 | |
| 180 | + or t0, t0, t1 | |
| 181 | + andi t2, t2, 0xff00 | |
| 182 | + andi t1, $r_s0, 0xff00 | |
| 183 | + or t0, t0, t2 | |
| 184 | + sll t1, t1, 8 | |
| 185 | + jr $r_ra | |
| 186 | + or $r_A, t0, t1 | |
| 187 | +# endif | |
| 188 | +#else | |
| 155 | 189 | jr $r_ra |
| 156 | − move $r_A, $r_s0 | |
| 190 | + move $r_A, $r_s0 | |
| 191 | +#endif | |
| 157 | 192 | |
| 158 | 193 | END(bpf_slow_path_word) |
| 159 | 194 | |
| 160 | 195 | NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp) |
| 161 | 196 | bpf_slow_path_common(2) |
| 162 | 197 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
| 198 | +# if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) | |
| 163 | 199 | jr $r_ra |
| 164 | 200 | wsbh $r_A, $r_s0 |
| 165 | −#endif | |
| 201 | +# else | |
| 202 | + sll t0, $r_s0, 8 | |
| 203 | + andi t1, $r_s0, 0xff00 | |
| 204 | + andi t0, t0, 0xff00 | |
| 205 | + srl t1, t1, 8 | |
| 206 | + jr $r_ra | |
| 207 | + or $r_A, t0, t1 | |
| 208 | +# endif | |
| 209 | +#else | |
| 166 | 210 | jr $r_ra |
| 167 | 211 | move $r_A, $r_s0 |
| 212 | +#endif | |
| 168 | 213 | |
| 169 | 214 | END(bpf_slow_path_half) |
| 170 | 215 | |
| @@ -311,6 +311,12 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) · 310 unmodified lines | ||
| 311 | 311 | |
| 312 | 312 | void pcibios_fixup_bus(struct pci_bus *bus) |
| 313 | 313 | { |
| 314 | + struct pci_dev *dev = bus->self; | |
| 315 | + | |
| 316 | + if (pci_has_flag(PCI_PROBE_ONLY) && dev && | |
| 317 | + (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | |
| 318 | + pci_read_bridge_bases(bus); | |
| 319 | + } | |
| 314 | 320 | } |
| 315 | 321 | |
| 316 | 322 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); |
| @@ -9,3 +9,4 @@ generic-y += mm-arch-hooks.h · 8 unmodified lines | ||
| 9 | 9 | generic-y += preempt.h |
| 10 | 10 | generic-y += sections.h |
| 11 | 11 | generic-y += trace_clock.h |
| 12 | +generic-y += word-at-a-time.h | |
| @@ -324,6 +324,7 @@ void pcibios_fixup_bus(struct pci_bus *bus) · 323 unmodified lines | ||
| 324 | 324 | struct pci_dev *dev; |
| 325 | 325 | |
| 326 | 326 | if (bus->self) { |
| 327 | + pci_read_bridge_bases(bus); | |
| 327 | 328 | pcibios_fixup_bridge_resources(bus->self); |
| 328 | 329 | } |
| 329 | 330 | |
| @@ -61,4 +61,5 @@ generic-y += types.h · 60 unmodified lines | ||
| 61 | 61 | generic-y += unaligned.h |
| 62 | 62 | generic-y += user.h |
| 63 | 63 | generic-y += vga.h |
| 64 | +generic-y += word-at-a-time.h | |
| 64 | 65 | generic-y += xor.h |
| @@ -7,3 +7,4 @@ generic-y += mcs_spinlock.h · 6 unmodified lines | ||
| 7 | 7 | generic-y += preempt.h |
| 8 | 8 | generic-y += rwsem.h |
| 9 | 9 | generic-y += vtime.h |
| 10 | +generic-y += word-at-a-time.h | |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #ifdef CONFIG_KVM_MMIO |
| 45 | 45 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 |
| 46 | 46 | #endif |
| 47 | +#define KVM_HALT_POLL_NS_DEFAULT 500000 | |
| 47 | 48 | |
| 48 | 49 | /* These values are internal and can be increased later */ |
| 49 | 50 | #define KVM_NR_IRQCHIPS 1 |
| @@ -369,3 +369,4 @@ SYSCALL_SPU(bpf) · 368 unmodified lines | ||
| 369 | 369 | COMPAT_SYS(execveat) |
| 370 | 370 | PPC64ONLY(switch_endian) |
| 371 | 371 | SYSCALL_SPU(userfaultfd) |
| 372 | +SYSCALL_SPU(membarrier) | |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <uapi/asm/unistd.h> |
| 13 | 13 | |
| 14 | 14 | |
| 15 | −#define __NR_syscalls 365 | |
| 15 | +#define __NR_syscalls 366 | |
| 16 | 16 | |
| 17 | 17 | #define __NR__exit __NR_exit |
| 18 | 18 | #define NR_syscalls __NR_syscalls |
| @@ -387,5 +387,6 @@ · 386 unmodified lines | ||
| 387 | 387 | #define __NR_execveat 362 |
| 388 | 388 | #define __NR_switch_endian 363 |
| 389 | 389 | #define __NR_userfaultfd 364 |
| 390 | +#define __NR_membarrier 365 | |
| 390 | 391 | |
| 391 | 392 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
| @@ -1032,7 +1032,13 @@ void pcibios_set_master(struct pci_dev *dev) · 1031 unmodified lines | ||
| 1032 | 1032 | |
| 1033 | 1033 | void pcibios_fixup_bus(struct pci_bus *bus) |
| 1034 | 1034 | { |
| 1035 | − /* Fixup the bus */ | |
| 1035 | + /* When called from the generic PCI probe, read PCI<->PCI bridge | |
| 1036 | + * bases. This is -not- called when generating the PCI tree from | |
| 1037 | + * the OF device-tree. | |
| 1038 | + */ | |
| 1039 | + pci_read_bridge_bases(bus); | |
| 1040 | + | |
| 1041 | + /* Now fixup the bus bus */ | |
| 1036 | 1042 | pcibios_setup_bus_self(bus); |
| 1037 | 1043 | |
| 1038 | 1044 | /* Now fixup devices on that bus */ |
| @@ -829,12 +829,15 @@ int kvmppc_h_logical_ci_load(struct kvm_vcpu *vcpu) · 828 unmodified lines | ||
| 829 | 829 | unsigned long size = kvmppc_get_gpr(vcpu, 4); |
| 830 | 830 | unsigned long addr = kvmppc_get_gpr(vcpu, 5); |
| 831 | 831 | u64 buf; |
| 832 | + int srcu_idx; | |
| 832 | 833 | int ret; |
| 833 | 834 | |
| 834 | 835 | if (!is_power_of_2(size) || (size > sizeof(buf))) |
| 835 | 836 | return H_TOO_HARD; |
| 836 | 837 | |
| 838 | + srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); | |
| 837 | 839 | ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, addr, size, &buf); |
| 840 | + srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx); | |
| 838 | 841 | if (ret != 0) |
| 839 | 842 | return H_TOO_HARD; |
| 840 | 843 | |
| @@ -869,6 +872,7 @@ int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu) · 28 unmodified lines | ||
| 869 | 872 | unsigned long addr = kvmppc_get_gpr(vcpu, 5); |
| 870 | 873 | unsigned long val = kvmppc_get_gpr(vcpu, 6); |
| 871 | 874 | u64 buf; |
| 875 | + int srcu_idx; | |
| 872 | 876 | int ret; |
| 873 | 877 | |
| 874 | 878 | switch (size) { |
| @@ -892,7 +896,9 @@ int kvmppc_h_logical_ci_store(struct kvm_vcpu *vcpu) · 17 unmodified lines | ||
| 892 | 896 | return H_TOO_HARD; |
| 893 | 897 | } |
| 894 | 898 | |
| 899 | + srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); | |
| 895 | 900 | ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, addr, size, &buf); |
| 901 | + srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx); | |
| 896 | 902 | if (ret != 0) |
| 897 | 903 | return H_TOO_HARD; |
| 898 | 904 | |
| @@ -2692,9 +2692,13 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) · 2691 unmodified lines | ||
| 2692 | 2692 | |
| 2693 | 2693 | while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE && |
| 2694 | 2694 | (vc->vcore_state == VCORE_RUNNING || |
| 2695 | − vc->vcore_state == VCORE_EXITING)) | |
| 2695 | + vc->vcore_state == VCORE_EXITING || | |
| 2696 | + vc->vcore_state == VCORE_PIGGYBACK)) | |
| 2696 | 2697 | kvmppc_wait_for_exec(vc, vcpu, TASK_UNINTERRUPTIBLE); |
| 2697 | 2698 | |
| 2699 | + if (vc->vcore_state == VCORE_PREEMPT && vc->runner == NULL) | |
| 2700 | + kvmppc_vcore_end_preempt(vc); | |
| 2701 | + | |
| 2698 | 2702 | if (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE) { |
| 2699 | 2703 | kvmppc_remove_runnable(vc, vcpu); |
| 2700 | 2704 | vcpu->stat.signal_exits++; |
| @@ -1257,6 +1257,7 @@ mc_cont: · 1256 unmodified lines | ||
| 1257 | 1257 | bl kvmhv_accumulate_time |
| 1258 | 1258 | #endif |
| 1259 | 1259 | |
| 1260 | + mr r3, r12 | |
| 1260 | 1261 | /* Increment exit count, poke other threads to exit */ |
| 1261 | 1262 | bl kvmhv_commence_exit |
| 1262 | 1263 | nop |
| @@ -6,3 +6,4 @@ generic-y += mcs_spinlock.h · 5 unmodified lines | ||
| 6 | 6 | generic-y += mm-arch-hooks.h |
| 7 | 7 | generic-y += preempt.h |
| 8 | 8 | generic-y += trace_clock.h |
| 9 | +generic-y += word-at-a-time.h | |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | */ |
| 36 | 36 | #define KVM_NR_IRQCHIPS 1 |
| 37 | 37 | #define KVM_IRQCHIP_NUM_PINS 4096 |
| 38 | +#define KVM_HALT_POLL_NS_DEFAULT 0 | |
| 38 | 39 | |
| 39 | 40 | #define SIGP_CTRL_C 0x80 |
| 40 | 41 | #define SIGP_CTRL_SCN_MASK 0x3f |
| @@ -13,3 +13,4 @@ generic-y += sections.h · 12 unmodified lines | ||
| 13 | 13 | generic-y += trace_clock.h |
| 14 | 14 | generic-y += xor.h |
| 15 | 15 | generic-y += serial.h |
| 16 | +generic-y += word-at-a-time.h | |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/errno.h> |
| 20 | 20 | #include <linux/io.h> |
| 21 | 21 | #include <linux/module.h> |
| 22 | +#include <linux/string.h> | |
| 22 | 23 | |
| 23 | 24 | #include <gxio/iorpc_globals.h> |
| 24 | 25 | #include <gxio/iorpc_mpipe.h> |
| @@ -29,32 +30,6 @@ · 4 unmodified lines | ||
| 29 | 30 | /* HACK: Avoid pointless "shadow" warnings. */ |
| 30 | 31 | #define link link_shadow |
| 31 | 32 | |
| 32 | −/** | |
| 33 | − * strscpy - Copy a C-string into a sized buffer, but only if it fits | |
| 34 | − * @dest: Where to copy the string to | |
| 35 | − * @src: Where to copy the string from | |
| 36 | − * @size: size of destination buffer | |
| 37 | − * | |
| 38 | − * Use this routine to avoid copying too-long strings. | |
| 39 | − * The routine returns the total number of bytes copied | |
| 40 | − * (including the trailing NUL) or zero if the buffer wasn't | |
| 41 | − * big enough. To ensure that programmers pay attention | |
| 42 | − * to the return code, the destination has a single NUL | |
| 43 | − * written at the front (if size is non-zero) when the | |
| 44 | − * buffer is not big enough. | |
| 45 | − */ | |
| 46 | −static size_t strscpy(char *dest, const char *src, size_t size) | |
| 47 | −{ | |
| 48 | − size_t len = strnlen(src, size) + 1; | |
| 49 | − if (len > size) { | |
| 50 | − if (size) | |
| 51 | − dest[0] = '\0'; | |
| 52 | − return 0; | |
| 53 | − } | |
| 54 | − memcpy(dest, src, len); | |
| 55 | − return len; | |
| 56 | −} | |
| 57 | − | |
| 58 | 33 | int gxio_mpipe_init(gxio_mpipe_context_t *context, unsigned int mpipe_index) |
| 59 | 34 | { |
| 60 | 35 | char file[32]; |
| @@ -540,7 +515,7 @@ int gxio_mpipe_link_instance(const char *link_name) · 479 unmodified lines | ||
| 540 | 515 | if (!context) |
| 541 | 516 | return GXIO_ERR_NO_DEVICE; |
| 542 | 517 | |
| 543 | − if (strscpy(name.name, link_name, sizeof(name.name)) == 0) | |
| 518 | + if (strscpy(name.name, link_name, sizeof(name.name)) < 0) | |
| 544 | 519 | return GXIO_ERR_NO_DEVICE; |
| 545 | 520 | |
| 546 | 521 | return gxio_mpipe_info_instance_aux(context, name); |
| @@ -559,7 +534,7 @@ int gxio_mpipe_link_enumerate_mac(int idx, char *link_name, uint8_t *link_mac) · 12 unmodified lines | ||
| 559 | 534 | |
| 560 | 535 | rv = gxio_mpipe_info_enumerate_aux(context, idx, &name, &mac); |
| 561 | 536 | if (rv >= 0) { |
| 562 | − if (strscpy(link_name, name.name, sizeof(name.name)) == 0) | |
| 537 | + if (strscpy(link_name, name.name, sizeof(name.name)) < 0) | |
| 563 | 538 | return GXIO_ERR_INVAL_MEMORY_SIZE; |
| 564 | 539 | memcpy(link_mac, mac.mac, sizeof(mac.mac)); |
| 565 | 540 | } |
| @@ -576,7 +551,7 @@ int gxio_mpipe_link_open(gxio_mpipe_link_t *link, · 10 unmodified lines | ||
| 576 | 551 | _gxio_mpipe_link_name_t name; |
| 577 | 552 | int rv; |
| 578 | 553 | |
| 579 | − if (strscpy(name.name, link_name, sizeof(name.name)) == 0) | |
| 554 | + if (strscpy(name.name, link_name, sizeof(name.name)) < 0) | |
| 580 | 555 | return GXIO_ERR_NO_DEVICE; |
| 581 | 556 | |
| 582 | 557 | rv = gxio_mpipe_link_open_aux(context, name, flags); |
| @@ -40,4 +40,5 @@ generic-y += termbits.h · 39 unmodified lines | ||
| 40 | 40 | generic-y += termios.h |
| 41 | 41 | generic-y += trace_clock.h |
| 42 | 42 | generic-y += types.h |
| 43 | +generic-y += word-at-a-time.h | |
| 43 | 44 | generic-y += xor.h |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/platform_device.h> |
| 23 | 23 | #include <linux/usb/tilegx.h> |
| 24 | 24 | #include <linux/init.h> |
| 25 | +#include <linux/module.h> | |
| 25 | 26 | #include <linux/types.h> |
| 26 | 27 | |
| 27 | 28 | static u64 ehci_dmamask = DMA_BIT_MASK(32); |
| @@ -25,4 +25,5 @@ generic-y += preempt.h · 24 unmodified lines | ||
| 25 | 25 | generic-y += switch_to.h |
| 26 | 26 | generic-y += topology.h |
| 27 | 27 | generic-y += trace_clock.h |
| 28 | +generic-y += word-at-a-time.h | |
| 28 | 29 | generic-y += xor.h |
| @@ -62,4 +62,5 @@ generic-y += ucontext.h · 61 unmodified lines | ||
| 62 | 62 | generic-y += unaligned.h |
| 63 | 63 | generic-y += user.h |
| 64 | 64 | generic-y += vga.h |
| 65 | +generic-y += word-at-a-time.h | |
| 65 | 66 | generic-y += xor.h |
| @@ -1128,7 +1128,18 @@ END(error_exit) · 1127 unmodified lines | ||
| 1128 | 1128 | |
| 1129 | 1129 | /* Runs on exception stack */ |
| 1130 | 1130 | ENTRY(nmi) |
| 1131 | + /* | |
| 1132 | + * Fix up the exception frame if we're on Xen. | |
| 1133 | + * PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most | |
| 1134 | + * one value to the stack on native, so it may clobber the rdx | |
| 1135 | + * scratch slot, but it won't clobber any of the important | |
| 1136 | + * slots past it. | |
| 1137 | + * | |
| 1138 | + * Xen is a different story, because the Xen frame itself overlaps | |
| 1139 | + * the "NMI executing" variable. | |
| 1140 | + */ | |
| 1131 | 1141 | PARAVIRT_ADJUST_EXCEPTION_FRAME |
| 1142 | + | |
| 1132 | 1143 | /* |
| 1133 | 1144 | * We allow breakpoints in NMIs. If a breakpoint occurs, then |
| 1134 | 1145 | * the iretq it performs will take us out of NMI context. |
| @@ -1179,9 +1190,12 @@ ENTRY(nmi) · 44 unmodified lines | ||
| 1179 | 1190 | * we don't want to enable interrupts, because then we'll end |
| 1180 | 1191 | * up in an awkward situation in which IRQs are on but NMIs |
| 1181 | 1192 | * are off. |
| 1193 | + * | |
| 1194 | + * We also must not push anything to the stack before switching | |
| 1195 | + * stacks lest we corrupt the "NMI executing" variable. | |
| 1182 | 1196 | */ |
| 1183 | 1197 | |
| 1184 | − SWAPGS | |
| 1198 | + SWAPGS_UNSAFE_STACK | |
| 1185 | 1199 | cld |
| 1186 | 1200 | movq %rsp, %rdx |
| 1187 | 1201 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp |
| @@ -193,7 +193,7 @@ · 192 unmodified lines | ||
| 193 | 193 | #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ |
| 194 | 194 | #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ |
| 195 | 195 | #define X86_FEATURE_HWP ( 7*32+ 10) /* "hwp" Intel HWP */ |
| 196 | −#define X86_FEATURE_HWP_NOITFY ( 7*32+ 11) /* Intel HWP_NOTIFY */ | |
| 196 | +#define X86_FEATURE_HWP_NOTIFY ( 7*32+ 11) /* Intel HWP_NOTIFY */ | |
| 197 | 197 | #define X86_FEATURE_HWP_ACT_WINDOW ( 7*32+ 12) /* Intel HWP_ACT_WINDOW */ |
| 198 | 198 | #define X86_FEATURE_HWP_EPP ( 7*32+13) /* Intel HWP_EPP */ |
| 199 | 199 | #define X86_FEATURE_HWP_PKG_REQ ( 7*32+14) /* Intel HWP_PKG_REQ */ |
| @@ -86,6 +86,18 @@ extern u64 asmlinkage efi_call(void *fp, ...); · 85 unmodified lines | ||
| 86 | 86 | extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size, |
| 87 | 87 | u32 type, u64 attribute); |
| 88 | 88 | |
| 89 | +#ifdef CONFIG_KASAN | |
| 90 | +/* | |
| 91 | + * CONFIG_KASAN may redefine memset to __memset. __memset function is present | |
| 92 | + * only in kernel binary. Since the EFI stub linked into a separate binary it | |
| 93 | + * doesn't have __memset(). So we should use standard memset from | |
| 94 | + * arch/x86/boot/compressed/string.c. The same applies to memcpy and memmove. | |
| 95 | + */ | |
| 96 | +#undef memcpy | |
| 97 | +#undef memset | |
| 98 | +#undef memmove | |
| 99 | +#endif | |
| 100 | + | |
| 89 | 101 | #endif /* CONFIG_X86_32 */ |
| 90 | 102 | |
| 91 | 103 | extern struct efi_scratch efi_scratch; |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #define KVM_PIO_PAGE_OFFSET 1 |
| 42 | 42 | #define KVM_COALESCED_MMIO_PAGE_OFFSET 2 |
| 43 | +#define KVM_HALT_POLL_NS_DEFAULT 500000 | |
| 43 | 44 | |
| 44 | 45 | #define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS |
| 45 | 46 | |
| @@ -141,6 +141,8 @@ · 140 unmodified lines | ||
| 141 | 141 | #define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10) |
| 142 | 142 | #define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11) |
| 143 | 143 | |
| 144 | +#define MSR_PEBS_FRONTEND 0x000003f7 | |
| 145 | + | |
| 144 | 146 | #define MSR_IA32_POWER_CTL 0x000001fc |
| 145 | 147 | |
| 146 | 148 | #define MSR_IA32_MC0_CTL 0x00000400 |
| @@ -331,6 +333,7 @@ · 184 unmodified lines | ||
| 331 | 333 | /* C1E active bits in int pending message */ |
| 332 | 334 | #define K8_INTP_C1E_ACTIVE_MASK 0x18000000 |
| 333 | 335 | #define MSR_K8_TSEG_ADDR 0xc0010112 |
| 336 | +#define MSR_K8_TSEG_MASK 0xc0010113 | |
| 334 | 337 | #define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */ |
| 335 | 338 | #define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */ |
| 336 | 339 | #define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */ |
| @@ -41,6 +41,7 @@ struct pvclock_wall_clock { · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | #define PVCLOCK_TSC_STABLE_BIT (1 << 0) |
| 43 | 43 | #define PVCLOCK_GUEST_STOPPED (1 << 1) |
| 44 | +/* PVCLOCK_COUNTS_FROM_ZERO broke ABI and can't be used anymore. */ | |
| 44 | 45 | #define PVCLOCK_COUNTS_FROM_ZERO (1 << 2) |
| 45 | 46 | #endif /* __ASSEMBLY__ */ |
| 46 | 47 | #endif /* _ASM_X86_PVCLOCK_ABI_H */ |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | #ifndef __ASM_X86_BITSPERLONG_H |
| 2 | 2 | #define __ASM_X86_BITSPERLONG_H |
| 3 | 3 | |
| 4 | −#ifdef __x86_64__ | |
| 4 | +#if defined(__x86_64__) && !defined(__ILP32__) | |
| 5 | 5 | # define __BITS_PER_LONG 64 |
| 6 | 6 | #else |
| 7 | 7 | # define __BITS_PER_LONG 32 |
| @@ -34,11 +34,10 @@ · 33 unmodified lines | ||
| 34 | 34 | struct ms_hyperv_info ms_hyperv; |
| 35 | 35 | EXPORT_SYMBOL_GPL(ms_hyperv); |
| 36 | 36 | |
| 37 | −static void (*hv_kexec_handler)(void); | |
| 38 | −static void (*hv_crash_handler)(struct pt_regs *regs); | |
| 39 | − | |
| 40 | 37 | #if IS_ENABLED(CONFIG_HYPERV) |
| 41 | 38 | static void (*vmbus_handler)(void); |
| 39 | +static void (*hv_kexec_handler)(void); | |
| 40 | +static void (*hv_crash_handler)(struct pt_regs *regs); | |
| 42 | 41 | |
| 43 | 42 | void hyperv_vector_handler(struct pt_regs *regs) |
| 44 | 43 | { |
| @@ -96,8 +95,8 @@ void hv_remove_crash_handler(void) · 51 unmodified lines | ||
| 96 | 95 | hv_crash_handler = NULL; |
| 97 | 96 | } |
| 98 | 97 | EXPORT_SYMBOL_GPL(hv_remove_crash_handler); |
| 99 | −#endif | |
| 100 | 98 | |
| 99 | +#ifdef CONFIG_KEXEC_CORE | |
| 101 | 100 | static void hv_machine_shutdown(void) |
| 102 | 101 | { |
| 103 | 102 | if (kexec_in_progress && hv_kexec_handler) |
| @@ -111,7 +110,8 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs) · 7 unmodified lines | ||
| 111 | 110 | hv_crash_handler(regs); |
| 112 | 111 | native_machine_crash_shutdown(regs); |
| 113 | 112 | } |
| 114 | − | |
| 113 | +#endif /* CONFIG_KEXEC_CORE */ | |
| 114 | +#endif /* CONFIG_HYPERV */ | |
| 115 | 115 | |
| 116 | 116 | static uint32_t __init ms_hyperv_platform(void) |
| 117 | 117 | { |
| @@ -186,8 +186,10 @@ static void __init ms_hyperv_init_platform(void) · 68 unmodified lines | ||
| 186 | 186 | no_timer_check = 1; |
| 187 | 187 | #endif |
| 188 | 188 | |
| 189 | +#if IS_ENABLED(CONFIG_HYPERV) && defined(CONFIG_KEXEC_CORE) | |
| 189 | 190 | machine_ops.shutdown = hv_machine_shutdown; |
| 190 | 191 | machine_ops.crash_shutdown = hv_machine_crash_shutdown; |
| 192 | +#endif | |
| 191 | 193 | mark_tsc_unstable("running on Hyper-V"); |
| 192 | 194 | } |
| 193 | 195 | |
| @@ -47,6 +47,7 @@ enum extra_reg_type { · 46 unmodified lines | ||
| 47 | 47 | EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */ |
| 48 | 48 | EXTRA_REG_LBR = 2, /* lbr_select */ |
| 49 | 49 | EXTRA_REG_LDLAT = 3, /* ld_lat_threshold */ |
| 50 | + EXTRA_REG_FE = 4, /* fe_* */ | |
| 50 | 51 | |
| 51 | 52 | EXTRA_REG_MAX /* number of entries needed */ |
| 52 | 53 | }; |
| @@ -205,6 +205,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = { · 204 unmodified lines | ||
| 205 | 205 | INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), |
| 206 | 206 | INTEL_UEVENT_EXTRA_REG(0x01bb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), |
| 207 | 207 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), |
| 208 | + /* | |
| 209 | + * Note the low 8 bits eventsel code is not a continuous field, containing | |
| 210 | + * some #GPing bits. These are masked out. | |
| 211 | + */ | |
| 212 | + INTEL_UEVENT_EXTRA_REG(0x01c6, MSR_PEBS_FRONTEND, 0x7fff17, FE), | |
| 208 | 213 | EVENT_EXTRA_END |
| 209 | 214 | }; |
| 210 | 215 | |
| @@ -250,7 +255,7 @@ struct event_constraint intel_bdw_event_constraints[] = { · 39 unmodified lines | ||
| 250 | 255 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| 251 | 256 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
| 252 | 257 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ |
| 253 | − INTEL_EVENT_CONSTRAINT(0xa3, 0x4), /* CYCLE_ACTIVITY.* */ | |
| 258 | + INTEL_UEVENT_CONSTRAINT(0x8a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_MISS */ | |
| 254 | 259 | EVENT_CONSTRAINT_END |
| 255 | 260 | }; |
| 256 | 261 | |
| @@ -2891,6 +2896,8 @@ PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); · 2634 unmodified lines | ||
| 2891 | 2896 | |
| 2892 | 2897 | PMU_FORMAT_ATTR(ldlat, "config1:0-15"); |
| 2893 | 2898 | |
| 2899 | +PMU_FORMAT_ATTR(frontend, "config1:0-23"); | |
| 2900 | + | |
| 2894 | 2901 | static struct attribute *intel_arch3_formats_attr[] = { |
| 2895 | 2902 | &format_attr_event.attr, |
| 2896 | 2903 | &format_attr_umask.attr, |
| @@ -2907,6 +2914,11 @@ static struct attribute *intel_arch3_formats_attr[] = { · 10 unmodified lines | ||
| 2907 | 2914 | NULL, |
| 2908 | 2915 | }; |
| 2909 | 2916 | |
| 2917 | +static struct attribute *skl_format_attr[] = { | |
| 2918 | + &format_attr_frontend.attr, | |
| 2919 | + NULL, | |
| 2920 | +}; | |
| 2921 | + | |
| 2910 | 2922 | static __initconst const struct x86_pmu core_pmu = { |
| 2911 | 2923 | .name = "core", |
| 2912 | 2924 | .handle_irq = x86_pmu_handle_irq, |
| @@ -3516,7 +3528,8 @@ __init int intel_pmu_init(void) · 603 unmodified lines | ||
| 3516 | 3528 | |
| 3517 | 3529 | x86_pmu.hw_config = hsw_hw_config; |
| 3518 | 3530 | x86_pmu.get_event_constraints = hsw_get_event_constraints; |
| 3519 | − x86_pmu.cpu_events = hsw_events_attrs; | |
| 3531 | + x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr, | |
| 3532 | + skl_format_attr); | |
| 3520 | 3533 | WARN_ON(!x86_pmu.format_attrs); |
| 3521 | 3534 | x86_pmu.cpu_events = hsw_events_attrs; |
| 3522 | 3535 | pr_cont("Skylake events, "); |
| @@ -10,12 +10,12 @@ enum perf_msr_id { · 9 unmodified lines | ||
| 10 | 10 | PERF_MSR_EVENT_MAX, |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | −bool test_aperfmperf(int idx) | |
| 13 | +static bool test_aperfmperf(int idx) | |
| 14 | 14 | { |
| 15 | 15 | return boot_cpu_has(X86_FEATURE_APERFMPERF); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | −bool test_intel(int idx) | |
| 18 | +static bool test_intel(int idx) | |
| 19 | 19 | { |
| 20 | 20 | if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || |
| 21 | 21 | boot_cpu_data.x86 != 6) |
| @@ -37,7 +37,7 @@ void init_scattered_cpuid_features(struct cpuinfo_x86 *c) · 36 unmodified lines | ||
| 37 | 37 | { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 }, |
| 38 | 38 | { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 }, |
| 39 | 39 | { X86_FEATURE_HWP, CR_EAX, 7, 0x00000006, 0 }, |
| 40 | − { X86_FEATURE_HWP_NOITFY, CR_EAX, 8, 0x00000006, 0 }, | |
| 40 | + { X86_FEATURE_HWP_NOTIFY, CR_EAX, 8, 0x00000006, 0 }, | |
| 41 | 41 | { X86_FEATURE_HWP_ACT_WINDOW, CR_EAX, 9, 0x00000006, 0 }, |
| 42 | 42 | { X86_FEATURE_HWP_EPP, CR_EAX,10, 0x00000006, 0 }, |
| 43 | 43 | { X86_FEATURE_HWP_PKG_REQ, CR_EAX,11, 0x00000006, 0 }, |
| @@ -185,10 +185,9 @@ void native_machine_crash_shutdown(struct pt_regs *regs) · 184 unmodified lines | ||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | #ifdef CONFIG_KEXEC_FILE |
| 188 | −static int get_nr_ram_ranges_callback(unsigned long start_pfn, | |
| 189 | − unsigned long nr_pfn, void *arg) | |
| 188 | +static int get_nr_ram_ranges_callback(u64 start, u64 end, void *arg) | |
| 190 | 189 | { |
| 191 | − int *nr_ranges = arg; | |
| 190 | + unsigned int *nr_ranges = arg; | |
| 192 | 191 | |
| 193 | 192 | (*nr_ranges)++; |
| 194 | 193 | return 0; |
| @@ -214,7 +213,7 @@ static void fill_up_crash_elf_data(struct crash_elf_data *ced, · 19 unmodified lines | ||
| 214 | 213 | |
| 215 | 214 | ced->image = image; |
| 216 | 215 | |
| 217 | − walk_system_ram_range(0, -1, &nr_ranges, | |
| 216 | + walk_system_ram_res(0, -1, &nr_ranges, | |
| 218 | 217 | get_nr_ram_ranges_callback); |
| 219 | 218 | |
| 220 | 219 | ced->max_nr_ranges = nr_ranges; |
| @@ -41,10 +41,18 @@ · 40 unmodified lines | ||
| 41 | 41 | #include <asm/timer.h> |
| 42 | 42 | #include <asm/special_insns.h> |
| 43 | 43 | |
| 44 | −/* nop stub */ | |
| 45 | −void _paravirt_nop(void) | |
| 46 | −{ | |
| 47 | −} | |
| 44 | +/* | |
| 45 | + * nop stub, which must not clobber anything *including the stack* to | |
| 46 | + * avoid confusing the entry prologues. | |
| 47 | + */ | |
| 48 | +extern void _paravirt_nop(void); | |
| 49 | +asm (".pushsection .entry.text, \"ax\"\n" | |
| 50 | + ".global _paravirt_nop\n" | |
| 51 | + "_paravirt_nop:\n\t" | |
| 52 | + "ret\n\t" | |
| 53 | + ".size _paravirt_nop, . - _paravirt_nop\n\t" | |
| 54 | + ".type _paravirt_nop, @function\n\t" | |
| 55 | + ".popsection"); | |
| 48 | 56 | |
| 49 | 57 | /* identity function, which can be inlined */ |
| 50 | 58 | u32 _paravirt_ident_32(u32 x) |
| @@ -506,3 +506,58 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) · 505 unmodified lines | ||
| 506 | 506 | return randomize_range(mm->brk, range_end, 0) ? : mm->brk; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | +/* | |
| 510 | + * Called from fs/proc with a reference on @p to find the function | |
| 511 | + * which called into schedule(). This needs to be done carefully | |
| 512 | + * because the task might wake up and we might look at a stack | |
| 513 | + * changing under us. | |
| 514 | + */ | |
| 515 | +unsigned long get_wchan(struct task_struct *p) | |
| 516 | +{ | |
| 517 | + unsigned long start, bottom, top, sp, fp, ip; | |
| 518 | + int count = 0; | |
| 519 | + | |
| 520 | + if (!p || p == current || p->state == TASK_RUNNING) | |
| 521 | + return 0; | |
| 522 | + | |
| 523 | + start = (unsigned long)task_stack_page(p); | |
| 524 | + if (!start) | |
| 525 | + return 0; | |
| 526 | + | |
| 527 | + /* | |
| 528 | + * Layout of the stack page: | |
| 529 | + * | |
| 530 | + * ----------- topmax = start + THREAD_SIZE - sizeof(unsigned long) | |
| 531 | + * PADDING | |
| 532 | + * ----------- top = topmax - TOP_OF_KERNEL_STACK_PADDING | |
| 533 | + * stack | |
| 534 | + * ----------- bottom = start + sizeof(thread_info) | |
| 535 | + * thread_info | |
| 536 | + * ----------- start | |
| 537 | + * | |
| 538 | + * The tasks stack pointer points at the location where the | |
| 539 | + * framepointer is stored. The data on the stack is: | |
| 540 | + * ... IP FP ... IP FP | |
| 541 | + * | |
| 542 | + * We need to read FP and IP, so we need to adjust the upper | |
| 543 | + * bound by another unsigned long. | |
| 544 | + */ | |
| 545 | + top = start + THREAD_SIZE - TOP_OF_KERNEL_STACK_PADDING; | |
| 546 | + top -= 2 * sizeof(unsigned long); | |
| 547 | + bottom = start + sizeof(struct thread_info); | |
| 548 | + | |
| 549 | + sp = READ_ONCE(p->thread.sp); | |
| 550 | + if (sp < bottom || sp > top) | |
| 551 | + return 0; | |
| 552 | + | |
| 553 | + fp = READ_ONCE(*(unsigned long *)sp); | |
| 554 | + do { | |
| 555 | + if (fp < bottom || fp > top) | |
| 556 | + return 0; | |
| 557 | + ip = READ_ONCE(*(unsigned long *)(fp + sizeof(unsigned long))); | |
| 558 | + if (!in_sched_functions(ip)) | |
| 559 | + return ip; | |
| 560 | + fp = READ_ONCE(*(unsigned long *)fp); | |
| 561 | + } while (count++ < 16 && p->state != TASK_RUNNING); | |
| 562 | + return 0; | |
| 563 | +} | |
| @@ -324,31 +324,3 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 323 unmodified lines | ||
| 324 | 324 | |
| 325 | 325 | return prev_p; |
| 326 | 326 | } |
| 327 | − | |
| 328 | −#define top_esp (THREAD_SIZE - sizeof(unsigned long)) | |
| 329 | −#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) | |
| 330 | − | |
| 331 | −unsigned long get_wchan(struct task_struct *p) | |
| 332 | −{ | |
| 333 | − unsigned long bp, sp, ip; | |
| 334 | − unsigned long stack_page; | |
| 335 | − int count = 0; | |
| 336 | − if (!p || p == current || p->state == TASK_RUNNING) | |
| 337 | − return 0; | |
| 338 | − stack_page = (unsigned long)task_stack_page(p); | |
| 339 | − sp = p->thread.sp; | |
| 340 | − if (!stack_page || sp < stack_page || sp > top_esp+stack_page) | |
| 341 | − return 0; | |
| 342 | − /* include/asm-i386/system.h:switch_to() pushes bp last. */ | |
| 343 | − bp = *(unsigned long *) sp; | |
| 344 | − do { | |
| 345 | − if (bp < stack_page || bp > top_ebp+stack_page) | |
| 346 | − return 0; | |
| 347 | − ip = *(unsigned long *) (bp+4); | |
| 348 | − if (!in_sched_functions(ip)) | |
| 349 | − return ip; | |
| 350 | − bp = *(unsigned long *) bp; | |
| 351 | − } while (count++ < 16); | |
| 352 | − return 0; | |
| 353 | −} | |
| 354 | − | |
| @@ -499,30 +499,6 @@ void set_personality_ia32(bool x32) · 498 unmodified lines | ||
| 499 | 499 | } |
| 500 | 500 | EXPORT_SYMBOL_GPL(set_personality_ia32); |
| 501 | 501 | |
| 502 | −unsigned long get_wchan(struct task_struct *p) | |
| 503 | −{ | |
| 504 | − unsigned long stack; | |
| 505 | − u64 fp, ip; | |
| 506 | − int count = 0; | |
| 507 | − | |
| 508 | − if (!p || p == current || p->state == TASK_RUNNING) | |
| 509 | − return 0; | |
| 510 | − stack = (unsigned long)task_stack_page(p); | |
| 511 | − if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE) | |
| 512 | − return 0; | |
| 513 | − fp = *(u64 *)(p->thread.sp); | |
| 514 | − do { | |
| 515 | − if (fp < (unsigned long)stack || | |
| 516 | − fp >= (unsigned long)stack+THREAD_SIZE) | |
| 517 | − return 0; | |
| 518 | − ip = *(u64 *)(fp+8); | |
| 519 | − if (!in_sched_functions(ip)) | |
| 520 | − return ip; | |
| 521 | − fp = *(u64 *)fp; | |
| 522 | − } while (count++ < 16); | |
| 523 | − return 0; | |
| 524 | −} | |
| 525 | − | |
| 526 | 502 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) |
| 527 | 503 | { |
| 528 | 504 | int ret = 0; |
| @@ -3322,7 +3322,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) · 3321 unmodified lines | ||
| 3322 | 3322 | break; |
| 3323 | 3323 | |
| 3324 | 3324 | reserved |= is_shadow_zero_bits_set(&vcpu->arch.mmu, spte, |
| 3325 | − leaf); | |
| 3325 | + iterator.level); | |
| 3326 | 3326 | } |
| 3327 | 3327 | |
| 3328 | 3328 | walk_shadow_page_lockless_end(vcpu); |
| @@ -3614,7 +3614,7 @@ static void · 285 unmodified lines | ||
| 3614 | 3614 | __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, |
| 3615 | 3615 | struct rsvd_bits_validate *rsvd_check, |
| 3616 | 3616 | int maxphyaddr, int level, bool nx, bool gbpages, |
| 3617 | − bool pse) | |
| 3617 | + bool pse, bool amd) | |
| 3618 | 3618 | { |
| 3619 | 3619 | u64 exb_bit_rsvd = 0; |
| 3620 | 3620 | u64 gbpages_bit_rsvd = 0; |
| @@ -3631,7 +3631,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, · 10 unmodified lines | ||
| 3631 | 3631 | * Non-leaf PML4Es and PDPEs reserve bit 8 (which would be the G bit for |
| 3632 | 3632 | * leaf entries) on AMD CPUs only. |
| 3633 | 3633 | */ |
| 3634 | − if (guest_cpuid_is_amd(vcpu)) | |
| 3634 | + if (amd) | |
| 3635 | 3635 | nonleaf_bit8_rsvd = rsvd_bits(8, 8); |
| 3636 | 3636 | |
| 3637 | 3637 | switch (level) { |
| @@ -3699,7 +3699,7 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, · 61 unmodified lines | ||
| 3699 | 3699 | __reset_rsvds_bits_mask(vcpu, &context->guest_rsvd_check, |
| 3700 | 3700 | cpuid_maxphyaddr(vcpu), context->root_level, |
| 3701 | 3701 | context->nx, guest_cpuid_has_gbpages(vcpu), |
| 3702 | − is_pse(vcpu)); | |
| 3702 | + is_pse(vcpu), guest_cpuid_is_amd(vcpu)); | |
| 3703 | 3703 | } |
| 3704 | 3704 | |
| 3705 | 3705 | static void |
| @@ -3749,13 +3749,24 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu, · 43 unmodified lines | ||
| 3749 | 3749 | void |
| 3750 | 3750 | reset_shadow_zero_bits_mask(struct kvm_vcpu *vcpu, struct kvm_mmu *context) |
| 3751 | 3751 | { |
| 3752 | + /* | |
| 3753 | + * Passing "true" to the last argument is okay; it adds a check | |
| 3754 | + * on bit 8 of the SPTEs which KVM doesn't use anyway. | |
| 3755 | + */ | |
| 3752 | 3756 | __reset_rsvds_bits_mask(vcpu, &context->shadow_zero_check, |
| 3753 | 3757 | boot_cpu_data.x86_phys_bits, |
| 3754 | 3758 | context->shadow_root_level, context->nx, |
| 3755 | − guest_cpuid_has_gbpages(vcpu), is_pse(vcpu)); | |
| 3759 | + guest_cpuid_has_gbpages(vcpu), is_pse(vcpu), | |
| 3760 | + true); | |
| 3756 | 3761 | } |
| 3757 | 3762 | EXPORT_SYMBOL_GPL(reset_shadow_zero_bits_mask); |
| 3758 | 3763 | |
| 3764 | +static inline bool boot_cpu_is_amd(void) | |
| 3765 | +{ | |
| 3766 | + WARN_ON_ONCE(!tdp_enabled); | |
| 3767 | + return shadow_x_mask == 0; | |
| 3768 | +} | |
| 3769 | + | |
| 3759 | 3770 | /* |
| 3760 | 3771 | * the direct page table on host, use as much mmu features as |
| 3761 | 3772 | * possible, however, kvm currently does not do execution-protection. |
| @@ -3764,11 +3775,11 @@ static void · 2 unmodified lines | ||
| 3764 | 3775 | reset_tdp_shadow_zero_bits_mask(struct kvm_vcpu *vcpu, |
| 3765 | 3776 | struct kvm_mmu *context) |
| 3766 | 3777 | { |
| 3767 | − if (guest_cpuid_is_amd(vcpu)) | |
| 3778 | + if (boot_cpu_is_amd()) | |
| 3768 | 3779 | __reset_rsvds_bits_mask(vcpu, &context->shadow_zero_check, |
| 3769 | 3780 | boot_cpu_data.x86_phys_bits, |
| 3770 | 3781 | context->shadow_root_level, false, |
| 3771 | − cpu_has_gbpages, true); | |
| 3782 | + cpu_has_gbpages, true, true); | |
| 3772 | 3783 | else |
| 3773 | 3784 | __reset_rsvds_bits_mask_ept(&context->shadow_zero_check, |
| 3774 | 3785 | boot_cpu_data.x86_phys_bits, |
| @@ -202,6 +202,7 @@ module_param(npt, int, S_IRUGO); · 201 unmodified lines | ||
| 202 | 202 | static int nested = true; |
| 203 | 203 | module_param(nested, int, S_IRUGO); |
| 204 | 204 | |
| 205 | +static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); | |
| 205 | 206 | static void svm_flush_tlb(struct kvm_vcpu *vcpu); |
| 206 | 207 | static void svm_complete_interrupts(struct vcpu_svm *svm); |
| 207 | 208 | |
| @@ -513,7 +514,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) · 305 unmodified lines | ||
| 513 | 514 | struct vcpu_svm *svm = to_svm(vcpu); |
| 514 | 515 | |
| 515 | 516 | if (svm->vmcb->control.next_rip != 0) { |
| 516 | − WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); | |
| 517 | + WARN_ON_ONCE(!static_cpu_has(X86_FEATURE_NRIPS)); | |
| 517 | 518 | svm->next_rip = svm->vmcb->control.next_rip; |
| 518 | 519 | } |
| 519 | 520 | |
| @@ -865,64 +866,6 @@ static void svm_disable_lbrv(struct vcpu_svm *svm) · 345 unmodified lines | ||
| 865 | 866 | set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0); |
| 866 | 867 | } |
| 867 | 868 | |
| 868 | −#define MTRR_TYPE_UC_MINUS 7 | |
| 869 | −#define MTRR2PROTVAL_INVALID 0xff | |
| 870 | − | |
| 871 | −static u8 mtrr2protval[8]; | |
| 872 | − | |
| 873 | −static u8 fallback_mtrr_type(int mtrr) | |
| 874 | −{ | |
| 875 | − /* | |
| 876 | − * WT and WP aren't always available in the host PAT. Treat | |
| 877 | − * them as UC and UC- respectively. Everything else should be | |
| 878 | − * there. | |
| 879 | − */ | |
| 880 | − switch (mtrr) | |
| 881 | − { | |
| 882 | − case MTRR_TYPE_WRTHROUGH: | |
| 883 | − return MTRR_TYPE_UNCACHABLE; | |
| 884 | − case MTRR_TYPE_WRPROT: | |
| 885 | − return MTRR_TYPE_UC_MINUS; | |
| 886 | − default: | |
| 887 | − BUG(); | |
| 888 | − } | |
| 889 | −} | |
| 890 | − | |
| 891 | −static void build_mtrr2protval(void) | |
| 892 | −{ | |
| 893 | − int i; | |
| 894 | − u64 pat; | |
| 895 | − | |
| 896 | − for (i = 0; i < 8; i++) | |
| 897 | − mtrr2protval[i] = MTRR2PROTVAL_INVALID; | |
| 898 | − | |
| 899 | − /* Ignore the invalid MTRR types. */ | |
| 900 | − mtrr2protval[2] = 0; | |
| 901 | − mtrr2protval[3] = 0; | |
| 902 | − | |
| 903 | − /* | |
| 904 | − * Use host PAT value to figure out the mapping from guest MTRR | |
| 905 | − * values to nested page table PAT/PCD/PWT values. We do not | |
| 906 | − * want to change the host PAT value every time we enter the | |
| 907 | − * guest. | |
| 908 | − */ | |
| 909 | − rdmsrl(MSR_IA32_CR_PAT, pat); | |
| 910 | − for (i = 0; i < 8; i++) { | |
| 911 | − u8 mtrr = pat >> (8 * i); | |
| 912 | − | |
| 913 | − if (mtrr2protval[mtrr] == MTRR2PROTVAL_INVALID) | |
| 914 | − mtrr2protval[mtrr] = __cm_idx2pte(i); | |
| 915 | − } | |
| 916 | − | |
| 917 | − for (i = 0; i < 8; i++) { | |
| 918 | − if (mtrr2protval[i] == MTRR2PROTVAL_INVALID) { | |
| 919 | − u8 fallback = fallback_mtrr_type(i); | |
| 920 | − mtrr2protval[i] = mtrr2protval[fallback]; | |
| 921 | − BUG_ON(mtrr2protval[i] == MTRR2PROTVAL_INVALID); | |
| 922 | − } | |
| 923 | − } | |
| 924 | −} | |
| 925 | − | |
| 926 | 869 | static __init int svm_hardware_setup(void) |
| 927 | 870 | { |
| 928 | 871 | int cpu; |
| @@ -989,7 +932,6 @@ static __init int svm_hardware_setup(void) · 60 unmodified lines | ||
| 989 | 932 | } else |
| 990 | 933 | kvm_disable_tdp(); |
| 991 | 934 | |
| 992 | − build_mtrr2protval(); | |
| 993 | 935 | return 0; |
| 994 | 936 | |
| 995 | 937 | err: |
| @@ -1144,43 +1086,6 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) · 148 unmodified lines | ||
| 1144 | 1086 | return target_tsc - tsc; |
| 1145 | 1087 | } |
| 1146 | 1088 | |
| 1147 | −static void svm_set_guest_pat(struct vcpu_svm *svm, u64 *g_pat) | |
| 1148 | −{ | |
| 1149 | − struct kvm_vcpu *vcpu = &svm->vcpu; | |
| 1150 | − | |
| 1151 | − /* Unlike Intel, AMD takes the guest's CR0.CD into account. | |
| 1152 | − * | |
| 1153 | − * AMD does not have IPAT. To emulate it for the case of guests | |
| 1154 | − * with no assigned devices, just set everything to WB. If guests | |
| 1155 | − * have assigned devices, however, we cannot force WB for RAM | |
| 1156 | − * pages only, so use the guest PAT directly. | |
| 1157 | − */ | |
| 1158 | − if (!kvm_arch_has_assigned_device(vcpu->kvm)) | |
| 1159 | − *g_pat = 0x0606060606060606; | |
| 1160 | − else | |
| 1161 | − *g_pat = vcpu->arch.pat; | |
| 1162 | −} | |
| 1163 | − | |
| 1164 | −static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |
| 1165 | −{ | |
| 1166 | − u8 mtrr; | |
| 1167 | − | |
| 1168 | − /* | |
| 1169 | − * 1. MMIO: trust guest MTRR, so same as item 3. | |
| 1170 | − * 2. No passthrough: always map as WB, and force guest PAT to WB as well | |
| 1171 | − * 3. Passthrough: can't guarantee the result, try to trust guest. | |
| 1172 | − */ | |
| 1173 | − if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm)) | |
| 1174 | − return 0; | |
| 1175 | − | |
| 1176 | − if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED) && | |
| 1177 | − kvm_read_cr0(vcpu) & X86_CR0_CD) | |
| 1178 | − return _PAGE_NOCACHE; | |
| 1179 | − | |
| 1180 | − mtrr = kvm_mtrr_get_guest_memory_type(vcpu, gfn); | |
| 1181 | − return mtrr2protval[mtrr]; | |
| 1182 | −} | |
| 1183 | − | |
| 1184 | 1089 | static void init_vmcb(struct vcpu_svm *svm, bool init_event) |
| 1185 | 1090 | { |
| 1186 | 1091 | struct vmcb_control_area *control = &svm->vmcb->control; |
| @@ -1263,7 +1168,8 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event) · 76 unmodified lines | ||
| 1263 | 1168 | * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0. |
| 1264 | 1169 | * It also updates the guest-visible cr0 value. |
| 1265 | 1170 | */ |
| 1266 | − (void)kvm_set_cr0(&svm->vcpu, X86_CR0_NW | X86_CR0_CD | X86_CR0_ET); | |
| 1171 | + svm_set_cr0(&svm->vcpu, X86_CR0_NW | X86_CR0_CD | X86_CR0_ET); | |
| 1172 | + kvm_mmu_reset_context(&svm->vcpu); | |
| 1267 | 1173 | |
| 1268 | 1174 | save->cr4 = X86_CR4_PAE; |
| 1269 | 1175 | /* rdx = ?? */ |
| @@ -1276,7 +1182,6 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event) · 6 unmodified lines | ||
| 1276 | 1182 | clr_cr_intercept(svm, INTERCEPT_CR3_READ); |
| 1277 | 1183 | clr_cr_intercept(svm, INTERCEPT_CR3_WRITE); |
| 1278 | 1184 | save->g_pat = svm->vcpu.arch.pat; |
| 1279 | − svm_set_guest_pat(svm, &save->g_pat); | |
| 1280 | 1185 | save->cr3 = 0; |
| 1281 | 1186 | save->cr4 = 0; |
| 1282 | 1187 | } |
| @@ -1671,10 +1576,13 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 388 unmodified lines | ||
| 1671 | 1576 | |
| 1672 | 1577 | if (!vcpu->fpu_active) |
| 1673 | 1578 | cr0 |= X86_CR0_TS; |
| 1674 | − | |
| 1675 | − /* These are emulated via page tables. */ | |
| 1676 | − cr0 &= ~(X86_CR0_CD | X86_CR0_NW); | |
| 1677 | − | |
| 1579 | + /* | |
| 1580 | + * re-enable caching here because the QEMU bios | |
| 1581 | + * does not do it - this results in some delay at | |
| 1582 | + * reboot | |
| 1583 | + */ | |
| 1584 | + if (kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED)) | |
| 1585 | + cr0 &= ~(X86_CR0_CD | X86_CR0_NW); | |
| 1678 | 1586 | svm->vmcb->save.cr0 = cr0; |
| 1679 | 1587 | mark_dirty(svm->vmcb, VMCB_CR); |
| 1680 | 1588 | update_cr0_intercept(svm); |
| @@ -3349,16 +3257,6 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1668 unmodified lines | ||
| 3349 | 3257 | case MSR_VM_IGNNE: |
| 3350 | 3258 | vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); |
| 3351 | 3259 | break; |
| 3352 | − case MSR_IA32_CR_PAT: | |
| 3353 | − if (npt_enabled) { | |
| 3354 | − if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data)) | |
| 3355 | − return 1; | |
| 3356 | − vcpu->arch.pat = data; | |
| 3357 | − svm_set_guest_pat(svm, &svm->vmcb->save.g_pat); | |
| 3358 | − mark_dirty(svm->vmcb, VMCB_NPT); | |
| 3359 | − break; | |
| 3360 | − } | |
| 3361 | − /* fall through */ | |
| 3362 | 3260 | default: |
| 3363 | 3261 | return kvm_set_msr_common(vcpu, msr); |
| 3364 | 3262 | } |
| @@ -4193,6 +4091,11 @@ static bool svm_has_high_real_mode_segbase(void) · 828 unmodified lines | ||
| 4193 | 4091 | return true; |
| 4194 | 4092 | } |
| 4195 | 4093 | |
| 4094 | +static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) | |
| 4095 | +{ | |
| 4096 | + return 0; | |
| 4097 | +} | |
| 4098 | + | |
| 4196 | 4099 | static void svm_cpuid_update(struct kvm_vcpu *vcpu) |
| 4197 | 4100 | { |
| 4198 | 4101 | } |
| @@ -8617,17 +8617,22 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) · 8616 unmodified lines | ||
| 8617 | 8617 | u64 ipat = 0; |
| 8618 | 8618 | |
| 8619 | 8619 | /* For VT-d and EPT combination |
| 8620 | − * 1. MMIO: guest may want to apply WC, trust it. | |
| 8620 | + * 1. MMIO: always map as UC | |
| 8621 | 8621 | * 2. EPT with VT-d: |
| 8622 | 8622 | * a. VT-d without snooping control feature: can't guarantee the |
| 8623 | − * result, try to trust guest. So the same as item 1. | |
| 8623 | + * result, try to trust guest. | |
| 8624 | 8624 | * b. VT-d with snooping control feature: snooping control feature of |
| 8625 | 8625 | * VT-d engine can guarantee the cache correctness. Just set it |
| 8626 | 8626 | * to WB to keep consistent with host. So the same as item 3. |
| 8627 | 8627 | * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep |
| 8628 | 8628 | * consistent with host MTRR |
| 8629 | 8629 | */ |
| 8630 | − if (!is_mmio && !kvm_arch_has_noncoherent_dma(vcpu->kvm)) { | |
| 8630 | + if (is_mmio) { | |
| 8631 | + cache = MTRR_TYPE_UNCACHABLE; | |
| 8632 | + goto exit; | |
| 8633 | + } | |
| 8634 | + | |
| 8635 | + if (!kvm_arch_has_noncoherent_dma(vcpu->kvm)) { | |
| 8631 | 8636 | ipat = VMX_EPT_IPAT_BIT; |
| 8632 | 8637 | cache = MTRR_TYPE_WRBACK; |
| 8633 | 8638 | goto exit; |
| @@ -1708,8 +1708,6 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) · 1707 unmodified lines | ||
| 1708 | 1708 | vcpu->pvclock_set_guest_stopped_request = false; |
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | − pvclock_flags |= PVCLOCK_COUNTS_FROM_ZERO; | |
| 1712 | − | |
| 1713 | 1711 | /* If the host uses TSC clocksource, then it is stable */ |
| 1714 | 1712 | if (use_master_clock) |
| 1715 | 1713 | pvclock_flags |= PVCLOCK_TSC_STABLE_BIT; |
| @@ -2007,8 +2005,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 291 unmodified lines | ||
| 2007 | 2005 | &vcpu->requests); |
| 2008 | 2006 | |
| 2009 | 2007 | ka->boot_vcpu_runs_old_kvmclock = tmp; |
| 2010 | − | |
| 2011 | − ka->kvmclock_offset = -get_kernel_ns(); | |
| 2012 | 2008 | } |
| 2013 | 2009 | |
| 2014 | 2010 | vcpu->arch.time = data; |
| @@ -2190,6 +2186,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 175 unmodified lines | ||
| 2190 | 2186 | case MSR_IA32_LASTINTFROMIP: |
| 2191 | 2187 | case MSR_IA32_LASTINTTOIP: |
| 2192 | 2188 | case MSR_K8_SYSCFG: |
| 2189 | + case MSR_K8_TSEG_ADDR: | |
| 2190 | + case MSR_K8_TSEG_MASK: | |
| 2193 | 2191 | case MSR_K7_HWCR: |
| 2194 | 2192 | case MSR_VM_HSAVE_PA: |
| 2195 | 2193 | case MSR_K8_INT_PENDING_MSG: |
| @@ -1132,7 +1132,7 @@ void mark_rodata_ro(void) · 1131 unmodified lines | ||
| 1132 | 1132 | * has been zapped already via cleanup_highmem(). |
| 1133 | 1133 | */ |
| 1134 | 1134 | all_end = roundup((unsigned long)_brk_end, PMD_SIZE); |
| 1135 | − set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); | |
| 1135 | + set_memory_nx(text_end, (all_end - text_end) >> PAGE_SHIFT); | |
| 1136 | 1136 | |
| 1137 | 1137 | rodata_test(); |
| 1138 | 1138 | |
| @@ -166,6 +166,7 @@ void pcibios_fixup_bus(struct pci_bus *b) · 165 unmodified lines | ||
| 166 | 166 | { |
| 167 | 167 | struct pci_dev *dev; |
| 168 | 168 | |
| 169 | + pci_read_bridge_bases(b); | |
| 169 | 170 | list_for_each_entry(dev, &b->devices, bus_list) |
| 170 | 171 | pcibios_fixup_device_resources(dev); |
| 171 | 172 | } |
| @@ -704,6 +704,70 @@ out: · 703 unmodified lines | ||
| 704 | 704 | return ret; |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | +/* | |
| 708 | + * Iterate the EFI memory map in reverse order because the regions | |
| 709 | + * will be mapped top-down. The end result is the same as if we had | |
| 710 | + * mapped things forward, but doesn't require us to change the | |
| 711 | + * existing implementation of efi_map_region(). | |
| 712 | + */ | |
| 713 | +static inline void *efi_map_next_entry_reverse(void *entry) | |
| 714 | +{ | |
| 715 | + /* Initial call */ | |
| 716 | + if (!entry) | |
| 717 | + return memmap.map_end - memmap.desc_size; | |
| 718 | + | |
| 719 | + entry -= memmap.desc_size; | |
| 720 | + if (entry < memmap.map) | |
| 721 | + return NULL; | |
| 722 | + | |
| 723 | + return entry; | |
| 724 | +} | |
| 725 | + | |
| 726 | +/* | |
| 727 | + * efi_map_next_entry - Return the next EFI memory map descriptor | |
| 728 | + * @entry: Previous EFI memory map descriptor | |
| 729 | + * | |
| 730 | + * This is a helper function to iterate over the EFI memory map, which | |
| 731 | + * we do in different orders depending on the current configuration. | |
| 732 | + * | |
| 733 | + * To begin traversing the memory map @entry must be %NULL. | |
| 734 | + * | |
| 735 | + * Returns %NULL when we reach the end of the memory map. | |
| 736 | + */ | |
| 737 | +static void *efi_map_next_entry(void *entry) | |
| 738 | +{ | |
| 739 | + if (!efi_enabled(EFI_OLD_MEMMAP) && efi_enabled(EFI_64BIT)) { | |
| 740 | + /* | |
| 741 | + * Starting in UEFI v2.5 the EFI_PROPERTIES_TABLE | |
| 742 | + * config table feature requires us to map all entries | |
| 743 | + * in the same order as they appear in the EFI memory | |
| 744 | + * map. That is to say, entry N must have a lower | |
| 745 | + * virtual address than entry N+1. This is because the | |
| 746 | + * firmware toolchain leaves relative references in | |
| 747 | + * the code/data sections, which are split and become | |
| 748 | + * separate EFI memory regions. Mapping things | |
| 749 | + * out-of-order leads to the firmware accessing | |
| 750 | + * unmapped addresses. | |
| 751 | + * | |
| 752 | + * Since we need to map things this way whether or not | |
| 753 | + * the kernel actually makes use of | |
| 754 | + * EFI_PROPERTIES_TABLE, let's just switch to this | |
| 755 | + * scheme by default for 64-bit. | |
| 756 | + */ | |
| 757 | + return efi_map_next_entry_reverse(entry); | |
| 758 | + } | |
| 759 | + | |
| 760 | + /* Initial call */ | |
| 761 | + if (!entry) | |
| 762 | + return memmap.map; | |
| 763 | + | |
| 764 | + entry += memmap.desc_size; | |
| 765 | + if (entry >= memmap.map_end) | |
| 766 | + return NULL; | |
| 767 | + | |
| 768 | + return entry; | |
| 769 | +} | |
| 770 | + | |
| 707 | 771 | /* |
| 708 | 772 | * Map the efi memory ranges of the runtime services and update new_mmap with |
| 709 | 773 | * virtual addresses. |
| @@ -714,7 +778,8 @@ static void * __init efi_map_regions(int *count, int *pg_shift) · 4 unmodified lines | ||
| 714 | 778 | unsigned long left = 0; |
| 715 | 779 | efi_memory_desc_t *md; |
| 716 | 780 | |
| 717 | − for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | |
| 781 | + p = NULL; | |
| 782 | + while ((p = efi_map_next_entry(p))) { | |
| 718 | 783 | md = p; |
| 719 | 784 | if (!(md->attribute & EFI_MEMORY_RUNTIME)) { |
| 720 | 785 | #ifdef CONFIG_X86_64 |
| @@ -28,4 +28,5 @@ generic-y += statfs.h · 27 unmodified lines | ||
| 28 | 28 | generic-y += termios.h |
| 29 | 29 | generic-y += topology.h |
| 30 | 30 | generic-y += trace_clock.h |
| 31 | +generic-y += word-at-a-time.h | |
| 31 | 32 | generic-y += xor.h |
| @@ -210,6 +210,10 @@ subsys_initcall(pcibios_init); · 209 unmodified lines | ||
| 210 | 210 | |
| 211 | 211 | void pcibios_fixup_bus(struct pci_bus *bus) |
| 212 | 212 | { |
| 213 | + if (bus->parent) { | |
| 214 | + /* This is a subordinate bridge */ | |
| 215 | + pci_read_bridge_bases(bus); | |
| 216 | + } | |
| 213 | 217 | } |
| 214 | 218 | |
| 215 | 219 | void pcibios_set_master(struct pci_dev *dev) |
| @@ -31,7 +31,8 @@ static int get_first_sibling(unsigned int cpu) · 30 unmodified lines | ||
| 31 | 31 | return cpu; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | −int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues) | |
| 34 | +int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues, | |
| 35 | + const struct cpumask *online_mask) | |
| 35 | 36 | { |
| 36 | 37 | unsigned int i, nr_cpus, nr_uniq_cpus, queue, first_sibling; |
| 37 | 38 | cpumask_var_t cpus; |
| @@ -41,7 +42,7 @@ int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues) · 3 unmodified lines | ||
| 41 | 42 | |
| 42 | 43 | cpumask_clear(cpus); |
| 43 | 44 | nr_cpus = nr_uniq_cpus = 0; |
| 44 | − for_each_online_cpu(i) { | |
| 45 | + for_each_cpu(i, online_mask) { | |
| 45 | 46 | nr_cpus++; |
| 46 | 47 | first_sibling = get_first_sibling(i); |
| 47 | 48 | if (!cpumask_test_cpu(first_sibling, cpus)) |
| @@ -51,7 +52,7 @@ int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues) · 3 unmodified lines | ||
| 51 | 52 | |
| 52 | 53 | queue = 0; |
| 53 | 54 | for_each_possible_cpu(i) { |
| 54 | − if (!cpu_online(i)) { | |
| 55 | + if (!cpumask_test_cpu(i, online_mask)) { | |
| 55 | 56 | map[i] = 0; |
| 56 | 57 | continue; |
| 57 | 58 | } |
| @@ -95,7 +96,7 @@ unsigned int *blk_mq_make_queue_map(struct blk_mq_tag_set *set) · 37 unmodified lines | ||
| 95 | 96 | if (!map) |
| 96 | 97 | return NULL; |
| 97 | 98 | |
| 98 | − if (!blk_mq_update_queue_map(map, set->nr_hw_queues)) | |
| 99 | + if (!blk_mq_update_queue_map(map, set->nr_hw_queues, cpu_online_mask)) | |
| 99 | 100 | return map; |
| 100 | 101 | |
| 101 | 102 | kfree(map); |
| @@ -229,8 +229,6 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page) · 228 unmodified lines | ||
| 229 | 229 | unsigned int i, first = 1; |
| 230 | 230 | ssize_t ret = 0; |
| 231 | 231 | |
| 232 | − blk_mq_disable_hotplug(); | |
| 233 | − | |
| 234 | 232 | for_each_cpu(i, hctx->cpumask) { |
| 235 | 233 | if (first) |
| 236 | 234 | ret += sprintf(ret + page, "%u", i); |
| @@ -240,8 +238,6 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page) · 3 unmodified lines | ||
| 240 | 238 | first = 0; |
| 241 | 239 | } |
| 242 | 240 | |
| 243 | − blk_mq_enable_hotplug(); | |
| 244 | − | |
| 245 | 241 | ret += sprintf(ret + page, "\n"); |
| 246 | 242 | return ret; |
| 247 | 243 | } |
| @@ -343,7 +339,7 @@ static void blk_mq_unregister_hctx(struct blk_mq_hw_ctx *hctx) · 95 unmodified lines | ||
| 343 | 339 | struct blk_mq_ctx *ctx; |
| 344 | 340 | int i; |
| 345 | 341 | |
| 346 | − if (!hctx->nr_ctx || !(hctx->flags & BLK_MQ_F_SYSFS_UP)) | |
| 342 | + if (!hctx->nr_ctx) | |
| 347 | 343 | return; |
| 348 | 344 | |
| 349 | 345 | hctx_for_each_ctx(hctx, ctx, i) |
| @@ -358,7 +354,7 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx) · 8 unmodified lines | ||
| 358 | 354 | struct blk_mq_ctx *ctx; |
| 359 | 355 | int i, ret; |
| 360 | 356 | |
| 361 | − if (!hctx->nr_ctx || !(hctx->flags & BLK_MQ_F_SYSFS_UP)) | |
| 357 | + if (!hctx->nr_ctx) | |
| 362 | 358 | return 0; |
| 363 | 359 | |
| 364 | 360 | ret = kobject_add(&hctx->kobj, &q->mq_kobj, "%u", hctx->queue_num); |
| @@ -381,6 +377,8 @@ void blk_mq_unregister_disk(struct gendisk *disk) · 16 unmodified lines | ||
| 381 | 377 | struct blk_mq_ctx *ctx; |
| 382 | 378 | int i, j; |
| 383 | 379 | |
| 380 | + blk_mq_disable_hotplug(); | |
| 381 | + | |
| 384 | 382 | queue_for_each_hw_ctx(q, hctx, i) { |
| 385 | 383 | blk_mq_unregister_hctx(hctx); |
| 386 | 384 | |
| @@ -395,6 +393,9 @@ void blk_mq_unregister_disk(struct gendisk *disk) · 8 unmodified lines | ||
| 395 | 393 | kobject_put(&q->mq_kobj); |
| 396 | 394 | |
| 397 | 395 | kobject_put(&disk_to_dev(disk)->kobj); |
| 396 | + | |
| 397 | + q->mq_sysfs_init_done = false; | |
| 398 | + blk_mq_enable_hotplug(); | |
| 398 | 399 | } |
| 399 | 400 | |
| 400 | 401 | static void blk_mq_sysfs_init(struct request_queue *q) |
| @@ -425,27 +426,30 @@ int blk_mq_register_disk(struct gendisk *disk) · 24 unmodified lines | ||
| 425 | 426 | struct blk_mq_hw_ctx *hctx; |
| 426 | 427 | int ret, i; |
| 427 | 428 | |
| 429 | + blk_mq_disable_hotplug(); | |
| 430 | + | |
| 428 | 431 | blk_mq_sysfs_init(q); |
| 429 | 432 | |
| 430 | 433 | ret = kobject_add(&q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq"); |
| 431 | 434 | if (ret < 0) |
| 432 | − return ret; | |
| 435 | + goto out; | |
| 433 | 436 | |
| 434 | 437 | kobject_uevent(&q->mq_kobj, KOBJ_ADD); |
| 435 | 438 | |
| 436 | 439 | queue_for_each_hw_ctx(q, hctx, i) { |
| 437 | − hctx->flags |= BLK_MQ_F_SYSFS_UP; | |
| 438 | 440 | ret = blk_mq_register_hctx(hctx); |
| 439 | 441 | if (ret) |
| 440 | 442 | break; |
| 441 | 443 | } |
| 442 | 444 | |
| 443 | − if (ret) { | |
| 445 | + if (ret) | |
| 444 | 446 | blk_mq_unregister_disk(disk); |
| 445 | − return ret; | |
| 446 | − } | |
| 447 | + else | |
| 448 | + q->mq_sysfs_init_done = true; | |
| 449 | +out: | |
| 450 | + blk_mq_enable_hotplug(); | |
| 447 | 451 | |
| 448 | − return 0; | |
| 452 | + return ret; | |
| 449 | 453 | } |
| 450 | 454 | EXPORT_SYMBOL_GPL(blk_mq_register_disk); |
| 451 | 455 | |
| @@ -454,6 +458,9 @@ void blk_mq_sysfs_unregister(struct request_queue *q) · 2 unmodified lines | ||
| 454 | 458 | struct blk_mq_hw_ctx *hctx; |
| 455 | 459 | int i; |
| 456 | 460 | |
| 461 | + if (!q->mq_sysfs_init_done) | |
| 462 | + return; | |
| 463 | + | |
| 457 | 464 | queue_for_each_hw_ctx(q, hctx, i) |
| 458 | 465 | blk_mq_unregister_hctx(hctx); |
| 459 | 466 | } |
| @@ -463,6 +470,9 @@ int blk_mq_sysfs_register(struct request_queue *q) · 3 unmodified lines | ||
| 463 | 470 | struct blk_mq_hw_ctx *hctx; |
| 464 | 471 | int i, ret = 0; |
| 465 | 472 | |
| 473 | + if (!q->mq_sysfs_init_done) | |
| 474 | + return ret; | |
| 475 | + | |
| 466 | 476 | queue_for_each_hw_ctx(q, hctx, i) { |
| 467 | 477 | ret = blk_mq_register_hctx(hctx); |
| 468 | 478 | if (ret) |
| @@ -471,17 +471,30 @@ void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn, · 470 unmodified lines | ||
| 471 | 471 | } |
| 472 | 472 | EXPORT_SYMBOL(blk_mq_all_tag_busy_iter); |
| 473 | 473 | |
| 474 | −void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, | |
| 474 | +void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn, | |
| 475 | 475 | void *priv) |
| 476 | 476 | { |
| 477 | − struct blk_mq_tags *tags = hctx->tags; | |
| 477 | + struct blk_mq_hw_ctx *hctx; | |
| 478 | + int i; | |
| 479 | + | |
| 480 | + | |
| 481 | + queue_for_each_hw_ctx(q, hctx, i) { | |
| 482 | + struct blk_mq_tags *tags = hctx->tags; | |
| 483 | + | |
| 484 | + /* | |
| 485 | + * If not software queues are currently mapped to this | |
| 486 | + * hardware queue, there's nothing to check | |
| 487 | + */ | |
| 488 | + if (!blk_mq_hw_queue_mapped(hctx)) | |
| 489 | + continue; | |
| 490 | + | |
| 491 | + if (tags->nr_reserved_tags) | |
| 492 | + bt_for_each(hctx, &tags->breserved_tags, 0, fn, priv, true); | |
| 493 | + bt_for_each(hctx, &tags->bitmap_tags, tags->nr_reserved_tags, fn, priv, | |
| 494 | + false); | |
| 495 | + } | |
| 478 | 496 | |
| 479 | − if (tags->nr_reserved_tags) | |
| 480 | − bt_for_each(hctx, &tags->breserved_tags, 0, fn, priv, true); | |
| 481 | − bt_for_each(hctx, &tags->bitmap_tags, tags->nr_reserved_tags, fn, priv, | |
| 482 | − false); | |
| 483 | 497 | } |
| 484 | −EXPORT_SYMBOL(blk_mq_tag_busy_iter); | |
| 485 | 498 | |
| 486 | 499 | static unsigned int bt_unused_tags(struct blk_mq_bitmap_tags *bt) |
| 487 | 500 | { |
| @@ -58,6 +58,8 @@ extern ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page); · 57 unmodified lines | ||
| 58 | 58 | extern void blk_mq_tag_init_last_tag(struct blk_mq_tags *tags, unsigned int *last_tag); |
| 59 | 59 | extern int blk_mq_tag_update_depth(struct blk_mq_tags *tags, unsigned int depth); |
| 60 | 60 | extern void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool); |
| 61 | +void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn, | |
| 62 | + void *priv); | |
| 61 | 63 | |
| 62 | 64 | enum { |
| 63 | 65 | BLK_MQ_TAG_CACHE_MIN = 1, |
| @@ -394,14 +394,16 @@ void __blk_mq_complete_request(struct request *rq) · 393 unmodified lines | ||
| 394 | 394 | * Ends all I/O on a request. It does not handle partial completions. |
| 395 | 395 | * The actual completion happens out-of-order, through a IPI handler. |
| 396 | 396 | **/ |
| 397 | −void blk_mq_complete_request(struct request *rq) | |
| 397 | +void blk_mq_complete_request(struct request *rq, int error) | |
| 398 | 398 | { |
| 399 | 399 | struct request_queue *q = rq->q; |
| 400 | 400 | |
| 401 | 401 | if (unlikely(blk_should_fake_timeout(q))) |
| 402 | 402 | return; |
| 403 | − if (!blk_mark_rq_complete(rq)) | |
| 403 | + if (!blk_mark_rq_complete(rq)) { | |
| 404 | + rq->errors = error; | |
| 404 | 405 | __blk_mq_complete_request(rq); |
| 406 | + } | |
| 405 | 407 | } |
| 406 | 408 | EXPORT_SYMBOL(blk_mq_complete_request); |
| 407 | 409 | |
| @@ -617,10 +619,8 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx, · 209 unmodified lines | ||
| 617 | 619 | * If a request wasn't started before the queue was |
| 618 | 620 | * marked dying, kill it here or it'll go unnoticed. |
| 619 | 621 | */ |
| 620 | − if (unlikely(blk_queue_dying(rq->q))) { | |
| 621 | − rq->errors = -EIO; | |
| 622 | − blk_mq_complete_request(rq); | |
| 623 | − } | |
| 622 | + if (unlikely(blk_queue_dying(rq->q))) | |
| 623 | + blk_mq_complete_request(rq, -EIO); | |
| 624 | 624 | return; |
| 625 | 625 | } |
| 626 | 626 | if (rq->cmd_flags & REQ_NO_TIMEOUT) |
| @@ -642,24 +642,16 @@ static void blk_mq_rq_timer(unsigned long priv) · 15 unmodified lines | ||
| 642 | 642 | .next = 0, |
| 643 | 643 | .next_set = 0, |
| 644 | 644 | }; |
| 645 | − struct blk_mq_hw_ctx *hctx; | |
| 646 | 645 | int i; |
| 647 | 646 | |
| 648 | − queue_for_each_hw_ctx(q, hctx, i) { | |
| 649 | − /* | |
| 650 | − * If not software queues are currently mapped to this | |
| 651 | − * hardware queue, there's nothing to check | |
| 652 | − */ | |
| 653 | − if (!blk_mq_hw_queue_mapped(hctx)) | |
| 654 | − continue; | |
| 655 | − | |
| 656 | − blk_mq_tag_busy_iter(hctx, blk_mq_check_expired, &data); | |
| 657 | − } | |
| 647 | + blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &data); | |
| 658 | 648 | |
| 659 | 649 | if (data.next_set) { |
| 660 | 650 | data.next = blk_rq_timeout(round_jiffies_up(data.next)); |
| 661 | 651 | mod_timer(&q->timeout, data.next); |
| 662 | 652 | } else { |
| 653 | + struct blk_mq_hw_ctx *hctx; | |
| 654 | + | |
| 663 | 655 | queue_for_each_hw_ctx(q, hctx, i) { |
| 664 | 656 | /* the hctx may be unmapped, so check it here */ |
| 665 | 657 | if (blk_mq_hw_queue_mapped(hctx)) |
| @@ -1800,13 +1792,19 @@ static void blk_mq_init_cpu_queues(struct request_queue *q, · 1134 unmodified lines | ||
| 1800 | 1792 | } |
| 1801 | 1793 | } |
| 1802 | 1794 | |
| 1803 | −static void blk_mq_map_swqueue(struct request_queue *q) | |
| 1795 | +static void blk_mq_map_swqueue(struct request_queue *q, | |
| 1796 | + const struct cpumask *online_mask) | |
| 1804 | 1797 | { |
| 1805 | 1798 | unsigned int i; |
| 1806 | 1799 | struct blk_mq_hw_ctx *hctx; |
| 1807 | 1800 | struct blk_mq_ctx *ctx; |
| 1808 | 1801 | struct blk_mq_tag_set *set = q->tag_set; |
| 1809 | 1802 | |
| 1803 | + /* | |
| 1804 | + * Avoid others reading imcomplete hctx->cpumask through sysfs | |
| 1805 | + */ | |
| 1806 | + mutex_lock(&q->sysfs_lock); | |
| 1807 | + | |
| 1810 | 1808 | queue_for_each_hw_ctx(q, hctx, i) { |
| 1811 | 1809 | cpumask_clear(hctx->cpumask); |
| 1812 | 1810 | hctx->nr_ctx = 0; |
| @@ -1817,16 +1815,17 @@ static void blk_mq_map_swqueue(struct request_queue *q) · 4 unmodified lines | ||
| 1817 | 1815 | */ |
| 1818 | 1816 | queue_for_each_ctx(q, ctx, i) { |
| 1819 | 1817 | /* If the cpu isn't online, the cpu is mapped to first hctx */ |
| 1820 | − if (!cpu_online(i)) | |
| 1818 | + if (!cpumask_test_cpu(i, online_mask)) | |
| 1821 | 1819 | continue; |
| 1822 | 1820 | |
| 1823 | 1821 | hctx = q->mq_ops->map_queue(q, i); |
| 1824 | 1822 | cpumask_set_cpu(i, hctx->cpumask); |
| 1825 | − cpumask_set_cpu(i, hctx->tags->cpumask); | |
| 1826 | 1823 | ctx->index_hw = hctx->nr_ctx; |
| 1827 | 1824 | hctx->ctxs[hctx->nr_ctx++] = ctx; |
| 1828 | 1825 | } |
| 1829 | 1826 | |
| 1827 | + mutex_unlock(&q->sysfs_lock); | |
| 1828 | + | |
| 1830 | 1829 | queue_for_each_hw_ctx(q, hctx, i) { |
| 1831 | 1830 | struct blk_mq_ctxmap *map = &hctx->ctx_map; |
| 1832 | 1831 | |
| @@ -1862,6 +1861,14 @@ static void blk_mq_map_swqueue(struct request_queue *q) · 29 unmodified lines | ||
| 1862 | 1861 | hctx->next_cpu = cpumask_first(hctx->cpumask); |
| 1863 | 1862 | hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH; |
| 1864 | 1863 | } |
| 1864 | + | |
| 1865 | + queue_for_each_ctx(q, ctx, i) { | |
| 1866 | + if (!cpumask_test_cpu(i, online_mask)) | |
| 1867 | + continue; | |
| 1868 | + | |
| 1869 | + hctx = q->mq_ops->map_queue(q, i); | |
| 1870 | + cpumask_set_cpu(i, hctx->tags->cpumask); | |
| 1871 | + } | |
| 1865 | 1872 | } |
| 1866 | 1873 | |
| 1867 | 1874 | static void blk_mq_update_tag_set_depth(struct blk_mq_tag_set *set) |
| @@ -1929,6 +1936,9 @@ void blk_mq_release(struct request_queue *q) · 61 unmodified lines | ||
| 1929 | 1936 | kfree(hctx); |
| 1930 | 1937 | } |
| 1931 | 1938 | |
| 1939 | + kfree(q->mq_map); | |
| 1940 | + q->mq_map = NULL; | |
| 1941 | + | |
| 1932 | 1942 | kfree(q->queue_hw_ctx); |
| 1933 | 1943 | |
| 1934 | 1944 | /* ctx kobj stays in queue_ctx */ |
| @@ -2038,13 +2048,15 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, · 103 unmodified lines | ||
| 2038 | 2048 | if (blk_mq_init_hw_queues(q, set)) |
| 2039 | 2049 | goto err_hctxs; |
| 2040 | 2050 | |
| 2051 | + get_online_cpus(); | |
| 2041 | 2052 | mutex_lock(&all_q_mutex); |
| 2042 | − list_add_tail(&q->all_q_node, &all_q_list); | |
| 2043 | − mutex_unlock(&all_q_mutex); | |
| 2044 | 2053 | |
| 2054 | + list_add_tail(&q->all_q_node, &all_q_list); | |
| 2045 | 2055 | blk_mq_add_queue_tag_set(set, q); |
| 2056 | + blk_mq_map_swqueue(q, cpu_online_mask); | |
| 2046 | 2057 | |
| 2047 | − blk_mq_map_swqueue(q); | |
| 2058 | + mutex_unlock(&all_q_mutex); | |
| 2059 | + put_online_cpus(); | |
| 2048 | 2060 | |
| 2049 | 2061 | return q; |
| 2050 | 2062 | |
| @@ -2068,30 +2080,27 @@ void blk_mq_free_queue(struct request_queue *q) · 17 unmodified lines | ||
| 2068 | 2080 | { |
| 2069 | 2081 | struct blk_mq_tag_set *set = q->tag_set; |
| 2070 | 2082 | |
| 2083 | + mutex_lock(&all_q_mutex); | |
| 2084 | + list_del_init(&q->all_q_node); | |
| 2085 | + mutex_unlock(&all_q_mutex); | |
| 2086 | + | |
| 2071 | 2087 | blk_mq_del_queue_tag_set(q); |
| 2072 | 2088 | |
| 2073 | 2089 | blk_mq_exit_hw_queues(q, set, set->nr_hw_queues); |
| 2074 | 2090 | blk_mq_free_hw_queues(q, set); |
| 2075 | 2091 | |
| 2076 | 2092 | percpu_ref_exit(&q->mq_usage_counter); |
| 2077 | − | |
| 2078 | − kfree(q->mq_map); | |
| 2079 | − | |
| 2080 | − q->mq_map = NULL; | |
| 2081 | − | |
| 2082 | − mutex_lock(&all_q_mutex); | |
| 2083 | − list_del_init(&q->all_q_node); | |
| 2084 | − mutex_unlock(&all_q_mutex); | |
| 2085 | 2093 | } |
| 2086 | 2094 | |
| 2087 | 2095 | /* Basically redo blk_mq_init_queue with queue frozen */ |
| 2088 | −static void blk_mq_queue_reinit(struct request_queue *q) | |
| 2096 | +static void blk_mq_queue_reinit(struct request_queue *q, | |
| 2097 | + const struct cpumask *online_mask) | |
| 2089 | 2098 | { |
| 2090 | 2099 | WARN_ON_ONCE(!atomic_read(&q->mq_freeze_depth)); |
| 2091 | 2100 | |
| 2092 | 2101 | blk_mq_sysfs_unregister(q); |
| 2093 | 2102 | |
| 2094 | − blk_mq_update_queue_map(q->mq_map, q->nr_hw_queues); | |
| 2103 | + blk_mq_update_queue_map(q->mq_map, q->nr_hw_queues, online_mask); | |
| 2095 | 2104 | |
| 2096 | 2105 | /* |
| 2097 | 2106 | * redo blk_mq_init_cpu_queues and blk_mq_init_hw_queues. FIXME: maybe |
| @@ -2099,7 +2108,7 @@ static void blk_mq_queue_reinit(struct request_queue *q) · 1 unmodified line | ||
| 2099 | 2108 | * involves free and re-allocate memory, worthy doing?) |
| 2100 | 2109 | */ |
| 2101 | 2110 | |
| 2102 | − blk_mq_map_swqueue(q); | |
| 2111 | + blk_mq_map_swqueue(q, online_mask); | |
| 2103 | 2112 | |
| 2104 | 2113 | blk_mq_sysfs_register(q); |
| 2105 | 2114 | } |
| @@ -2108,16 +2117,43 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, · 2 unmodified lines | ||
| 2108 | 2117 | unsigned long action, void *hcpu) |
| 2109 | 2118 | { |
| 2110 | 2119 | struct request_queue *q; |
| 2120 | + int cpu = (unsigned long)hcpu; | |
| 2121 | + /* | |
| 2122 | + * New online cpumask which is going to be set in this hotplug event. | |
| 2123 | + * Declare this cpumasks as global as cpu-hotplug operation is invoked | |
| 2124 | + * one-by-one and dynamically allocating this could result in a failure. | |
| 2125 | + */ | |
| 2126 | + static struct cpumask online_new; | |
| 2111 | 2127 | |
| 2112 | 2128 | /* |
| 2113 | − * Before new mappings are established, hotadded cpu might already | |
| 2114 | − * start handling requests. This doesn't break anything as we map | |
| 2115 | − * offline CPUs to first hardware queue. We will re-init the queue | |
| 2116 | − * below to get optimal settings. | |
| 2129 | + * Before hotadded cpu starts handling requests, new mappings must | |
| 2130 | + * be established. Otherwise, these requests in hw queue might | |
| 2131 | + * never be dispatched. | |
| 2132 | + * | |
| 2133 | + * For example, there is a single hw queue (hctx) and two CPU queues | |
| 2134 | + * (ctx0 for CPU0, and ctx1 for CPU1). | |
| 2135 | + * | |
| 2136 | + * Now CPU1 is just onlined and a request is inserted into | |
| 2137 | + * ctx1->rq_list and set bit0 in pending bitmap as ctx1->index_hw is | |
| 2138 | + * still zero. | |
| 2139 | + * | |
| 2140 | + * And then while running hw queue, flush_busy_ctxs() finds bit0 is | |
| 2141 | + * set in pending bitmap and tries to retrieve requests in | |
| 2142 | + * hctx->ctxs[0]->rq_list. But htx->ctxs[0] is a pointer to ctx0, | |
| 2143 | + * so the request in ctx1->rq_list is ignored. | |
| 2117 | 2144 | */ |
| 2118 | − if (action != CPU_DEAD && action != CPU_DEAD_FROZEN && | |
| 2119 | − action != CPU_ONLINE && action != CPU_ONLINE_FROZEN) | |
| 2145 | + switch (action & ~CPU_TASKS_FROZEN) { | |
| 2146 | + case CPU_DEAD: | |
| 2147 | + case CPU_UP_CANCELED: | |
| 2148 | + cpumask_copy(&online_new, cpu_online_mask); | |
| 2149 | + break; | |
| 2150 | + case CPU_UP_PREPARE: | |
| 2151 | + cpumask_copy(&online_new, cpu_online_mask); | |
| 2152 | + cpumask_set_cpu(cpu, &online_new); | |
| 2153 | + break; | |
| 2154 | + default: | |
| 2120 | 2155 | return NOTIFY_OK; |
| 2156 | + } | |
| 2121 | 2157 | |
| 2122 | 2158 | mutex_lock(&all_q_mutex); |
| 2123 | 2159 | |
| @@ -2141,7 +2177,7 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, · 17 unmodified lines | ||
| 2141 | 2177 | } |
| 2142 | 2178 | |
| 2143 | 2179 | list_for_each_entry(q, &all_q_list, all_q_node) |
| 2144 | − blk_mq_queue_reinit(q); | |
| 2180 | + blk_mq_queue_reinit(q, &online_new); | |
| 2145 | 2181 | |
| 2146 | 2182 | list_for_each_entry(q, &all_q_list, all_q_node) |
| 2147 | 2183 | blk_mq_unfreeze_queue(q); |
| @@ -51,7 +51,8 @@ void blk_mq_disable_hotplug(void); · 50 unmodified lines | ||
| 51 | 51 | * CPU -> queue mappings |
| 52 | 52 | */ |
| 53 | 53 | extern unsigned int *blk_mq_make_queue_map(struct blk_mq_tag_set *set); |
| 54 | −extern int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues); | |
| 54 | +extern int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues, | |
| 55 | + const struct cpumask *online_mask); | |
| 55 | 56 | extern int blk_mq_hw_queue_to_node(unsigned int *map, unsigned int); |
| 56 | 57 | |
| 57 | 58 | /* |
| @@ -332,10 +332,6 @@ static int x509_key_preparse(struct key_preparsed_payload *prep) · 331 unmodified lines | ||
| 332 | 332 | srlen = cert->raw_serial_size; |
| 333 | 333 | q = cert->raw_serial; |
| 334 | 334 | } |
| 335 | − if (srlen > 1 && *q == 0) { | |
| 336 | − srlen--; | |
| 337 | − q++; | |
| 338 | − } | |
| 339 | 335 | |
| 340 | 336 | ret = -ENOMEM; |
| 341 | 337 | desc = kmalloc(sulen + 2 + srlen * 2 + 1, GFP_KERNEL); |
| @@ -1044,8 +1044,10 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data) · 1043 unmodified lines | ||
| 1044 | 1044 | goto err_exit; |
| 1045 | 1045 | |
| 1046 | 1046 | mutex_lock(&ec->mutex); |
| 1047 | + result = -ENODATA; | |
| 1047 | 1048 | list_for_each_entry(handler, &ec->list, node) { |
| 1048 | 1049 | if (value == handler->query_bit) { |
| 1050 | + result = 0; | |
| 1049 | 1051 | q->handler = acpi_ec_get_query_handler(handler); |
| 1050 | 1052 | ec_dbg_evt("Query(0x%02x) scheduled", |
| 1051 | 1053 | q->handler->query_bit); |
| @@ -372,6 +372,7 @@ static int acpi_isa_register_gsi(struct pci_dev *dev) · 371 unmodified lines | ||
| 372 | 372 | |
| 373 | 373 | /* Interrupt Line values above 0xF are forbidden */ |
| 374 | 374 | if (dev->irq > 0 && (dev->irq <= 0xF) && |
| 375 | + acpi_isa_irq_available(dev->irq) && | |
| 375 | 376 | (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { |
| 376 | 377 | dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", |
| 377 | 378 | pin_name(dev->pin), dev->irq); |
| @@ -498,8 +498,7 @@ int __init acpi_irq_penalty_init(void) · 497 unmodified lines | ||
| 498 | 498 | PIRQ_PENALTY_PCI_POSSIBLE; |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | − /* Add a penalty for the SCI */ | |
| 502 | − acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; | |
| 501 | + | |
| 503 | 502 | return 0; |
| 504 | 503 | } |
| 505 | 504 | |
| @@ -553,6 +552,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) · 47 unmodified lines | ||
| 553 | 552 | irq = link->irq.possible[i]; |
| 554 | 553 | } |
| 555 | 554 | } |
| 555 | + if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { | |
| 556 | + printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " | |
| 557 | + "Try pci=noacpi or acpi=off\n", | |
| 558 | + acpi_device_name(link->device), | |
| 559 | + acpi_device_bid(link->device)); | |
| 560 | + return -ENODEV; | |
| 561 | + } | |
| 556 | 562 | |
| 557 | 563 | /* Attempt to enable the link device at this IRQ. */ |
| 558 | 564 | if (acpi_pci_link_set(link, irq)) { |
| @@ -821,6 +827,12 @@ void acpi_penalize_isa_irq(int irq, int active) · 262 unmodified lines | ||
| 821 | 827 | } |
| 822 | 828 | } |
| 823 | 829 | |
| 830 | +bool acpi_isa_irq_available(int irq) | |
| 831 | +{ | |
| 832 | + return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) || | |
| 833 | + acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS); | |
| 834 | +} | |
| 835 | + | |
| 824 | 836 | /* |
| 825 | 837 | * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with |
| 826 | 838 | * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for |
| @@ -1578,9 +1578,7 @@ he_stop(struct he_dev *he_dev) · 1577 unmodified lines | ||
| 1578 | 1578 | |
| 1579 | 1579 | kfree(he_dev->rbpl_virt); |
| 1580 | 1580 | kfree(he_dev->rbpl_table); |
| 1581 | − | |
| 1582 | − if (he_dev->rbpl_pool) | |
| 1583 | − dma_pool_destroy(he_dev->rbpl_pool); | |
| 1581 | + dma_pool_destroy(he_dev->rbpl_pool); | |
| 1584 | 1582 | |
| 1585 | 1583 | if (he_dev->rbrq_base) |
| 1586 | 1584 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq), |
| @@ -1594,8 +1592,7 @@ he_stop(struct he_dev *he_dev) · 7 unmodified lines | ||
| 1594 | 1592 | dma_free_coherent(&he_dev->pci_dev->dev, CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq), |
| 1595 | 1593 | he_dev->tpdrq_base, he_dev->tpdrq_phys); |
| 1596 | 1594 | |
| 1597 | − if (he_dev->tpd_pool) | |
| 1598 | − dma_pool_destroy(he_dev->tpd_pool); | |
| 1595 | + dma_pool_destroy(he_dev->tpd_pool); | |
| 1599 | 1596 | |
| 1600 | 1597 | if (he_dev->pci_dev) { |
| 1601 | 1598 | pci_read_config_word(he_dev->pci_dev, PCI_COMMAND, &command); |
| @@ -805,7 +805,12 @@ static void solos_bh(unsigned long card_arg) · 804 unmodified lines | ||
| 805 | 805 | continue; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | − skb = alloc_skb(size + 1, GFP_ATOMIC); | |
| 808 | + /* Use netdev_alloc_skb() because it adds NET_SKB_PAD of | |
| 809 | + * headroom, and ensures we can route packets back out an | |
| 810 | + * Ethernet interface (for example) without having to | |
| 811 | + * reallocate. Adding NET_IP_ALIGN also ensures that both | |
| 812 | + * PPPoATM and PPPoEoBR2684 packets end up aligned. */ | |
| 813 | + skb = netdev_alloc_skb_ip_align(NULL, size + 1); | |
| 809 | 814 | if (!skb) { |
| 810 | 815 | if (net_ratelimit()) |
| 811 | 816 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff for RX\n"); |
| @@ -869,7 +874,10 @@ static void solos_bh(unsigned long card_arg) · 57 unmodified lines | ||
| 869 | 874 | /* Allocate RX skbs for any ports which need them */ |
| 870 | 875 | if (card->using_dma && card->atmdev[port] && |
| 871 | 876 | !card->rx_skb[port]) { |
| 872 | − struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, GFP_ATOMIC); | |
| 877 | + /* Unlike the MMIO case (qv) we can't add NET_IP_ALIGN | |
| 878 | + * here; the FPGA can only DMA to addresses which are | |
| 879 | + * aligned to 4 bytes. */ | |
| 880 | + struct sk_buff *skb = dev_alloc_skb(RX_DMA_SIZE); | |
| 873 | 881 | if (skb) { |
| 874 | 882 | SKB_CB(skb)->dma_addr = |
| 875 | 883 | dma_map_single(&card->dev->dev, skb->data, |
| @@ -148,7 +148,11 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 147 unmodified lines | ||
| 148 | 148 | |
| 149 | 149 | if (sibling == cpu) /* skip itself */ |
| 150 | 150 | continue; |
| 151 | + | |
| 151 | 152 | sib_cpu_ci = get_cpu_cacheinfo(sibling); |
| 153 | + if (!sib_cpu_ci->info_list) | |
| 154 | + continue; | |
| 155 | + | |
| 152 | 156 | sib_leaf = sib_cpu_ci->info_list + index; |
| 153 | 157 | cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); |
| 154 | 158 | cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map); |
| @@ -159,6 +163,9 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 4 unmodified lines | ||
| 159 | 163 | |
| 160 | 164 | static void free_cache_attributes(unsigned int cpu) |
| 161 | 165 | { |
| 166 | + if (!per_cpu_cacheinfo(cpu)) | |
| 167 | + return; | |
| 168 | + | |
| 162 | 169 | cache_shared_cpu_map_remove(cpu); |
| 163 | 170 | |
| 164 | 171 | kfree(per_cpu_cacheinfo(cpu)); |
| @@ -514,8 +521,7 @@ static int cacheinfo_cpu_callback(struct notifier_block *nfb, · 349 unmodified lines | ||
| 514 | 521 | break; |
| 515 | 522 | case CPU_DEAD: |
| 516 | 523 | cache_remove_dev(cpu); |
| 517 | − if (per_cpu_cacheinfo(cpu)) | |
| 518 | − free_cache_attributes(cpu); | |
| 524 | + free_cache_attributes(cpu); | |
| 519 | 525 | break; |
| 520 | 526 | } |
| 521 | 527 | return notifier_from_errno(rc); |
| @@ -892,10 +892,17 @@ static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev) · 891 unmodified lines | ||
| 892 | 892 | u32 microvolt[3] = {0}; |
| 893 | 893 | int count, ret; |
| 894 | 894 | |
| 895 | − count = of_property_count_u32_elems(opp->np, "opp-microvolt"); | |
| 896 | − if (!count) | |
| 895 | + /* Missing property isn't a problem, but an invalid entry is */ | |
| 896 | + if (!of_find_property(opp->np, "opp-microvolt", NULL)) | |
| 897 | 897 | return 0; |
| 898 | 898 | |
| 899 | + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); | |
| 900 | + if (count < 0) { | |
| 901 | + dev_err(dev, "%s: Invalid opp-microvolt property (%d)\n", | |
| 902 | + __func__, count); | |
| 903 | + return count; | |
| 904 | + } | |
| 905 | + | |
| 899 | 906 | /* There can be one or three elements here */ |
| 900 | 907 | if (count != 1 && count != 3) { |
| 901 | 908 | dev_err(dev, "%s: Invalid number of elements in opp-microvolt property (%d)\n", |
| @@ -1063,7 +1070,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_add); · 161 unmodified lines | ||
| 1063 | 1070 | * share a common logic which is isolated here. |
| 1064 | 1071 | * |
| 1065 | 1072 | * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the |
| 1066 | − * copy operation, returns 0 if no modifcation was done OR modification was | |
| 1073 | + * copy operation, returns 0 if no modification was done OR modification was | |
| 1067 | 1074 | * successful. |
| 1068 | 1075 | * |
| 1069 | 1076 | * Locking: The internal device_opp and opp structures are RCU protected. |
| @@ -1151,7 +1158,7 @@ unlock: · 81 unmodified lines | ||
| 1151 | 1158 | * mutex locking or synchronize_rcu() blocking calls cannot be used. |
| 1152 | 1159 | * |
| 1153 | 1160 | * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the |
| 1154 | − * copy operation, returns 0 if no modifcation was done OR modification was | |
| 1161 | + * copy operation, returns 0 if no modification was done OR modification was | |
| 1155 | 1162 | * successful. |
| 1156 | 1163 | */ |
| 1157 | 1164 | int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
| @@ -1177,7 +1184,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_enable); · 19 unmodified lines | ||
| 1177 | 1184 | * mutex locking or synchronize_rcu() blocking calls cannot be used. |
| 1178 | 1185 | * |
| 1179 | 1186 | * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the |
| 1180 | − * copy operation, returns 0 if no modifcation was done OR modification was | |
| 1187 | + * copy operation, returns 0 if no modification was done OR modification was | |
| 1181 | 1188 | * successful. |
| 1182 | 1189 | */ |
| 1183 | 1190 | int dev_pm_opp_disable(struct device *dev, unsigned long freq) |
| @@ -1486,17 +1486,16 @@ static void loop_handle_cmd(struct loop_cmd *cmd) · 1485 unmodified lines | ||
| 1486 | 1486 | { |
| 1487 | 1487 | const bool write = cmd->rq->cmd_flags & REQ_WRITE; |
| 1488 | 1488 | struct loop_device *lo = cmd->rq->q->queuedata; |
| 1489 | − int ret = -EIO; | |
| 1489 | + int ret = 0; | |
| 1490 | 1490 | |
| 1491 | − if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) | |
| 1491 | + if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) { | |
| 1492 | + ret = -EIO; | |
| 1492 | 1493 | goto failed; |
| 1494 | + } | |
| 1493 | 1495 | |
| 1494 | 1496 | ret = do_req_filebacked(lo, cmd->rq); |
| 1495 | − | |
| 1496 | 1497 | failed: |
| 1497 | − if (ret) | |
| 1498 | − cmd->rq->errors = -EIO; | |
| 1499 | − blk_mq_complete_request(cmd->rq); | |
| 1498 | + blk_mq_complete_request(cmd->rq, ret ? -EIO : 0); | |
| 1500 | 1499 | } |
| 1501 | 1500 | |
| 1502 | 1501 | static void loop_queue_write_work(struct work_struct *work) |
| @@ -289,7 +289,7 @@ static inline void null_handle_cmd(struct nullb_cmd *cmd) · 288 unmodified lines | ||
| 289 | 289 | case NULL_IRQ_SOFTIRQ: |
| 290 | 290 | switch (queue_mode) { |
| 291 | 291 | case NULL_Q_MQ: |
| 292 | − blk_mq_complete_request(cmd->rq); | |
| 292 | + blk_mq_complete_request(cmd->rq, cmd->rq->errors); | |
| 293 | 293 | break; |
| 294 | 294 | case NULL_Q_RQ: |
| 295 | 295 | blk_complete_request(cmd->rq); |
| @@ -618,16 +618,15 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx, · 617 unmodified lines | ||
| 618 | 618 | spin_unlock_irqrestore(req->q->queue_lock, flags); |
| 619 | 619 | return; |
| 620 | 620 | } |
| 621 | + | |
| 621 | 622 | if (req->cmd_type == REQ_TYPE_DRV_PRIV) { |
| 622 | 623 | if (cmd_rq->ctx == CMD_CTX_CANCELLED) |
| 623 | − req->errors = -EINTR; | |
| 624 | − else | |
| 625 | − req->errors = status; | |
| 624 | + status = -EINTR; | |
| 626 | 625 | } else { |
| 627 | − req->errors = nvme_error_status(status); | |
| 626 | + status = nvme_error_status(status); | |
| 628 | 627 | } |
| 629 | − } else | |
| 630 | − req->errors = 0; | |
| 628 | + } | |
| 629 | + | |
| 631 | 630 | if (req->cmd_type == REQ_TYPE_DRV_PRIV) { |
| 632 | 631 | u32 result = le32_to_cpup(&cqe->result); |
| 633 | 632 | req->special = (void *)(uintptr_t)result; |
| @@ -650,7 +649,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx, · 16 unmodified lines | ||
| 650 | 649 | } |
| 651 | 650 | nvme_free_iod(nvmeq->dev, iod); |
| 652 | 651 | |
| 653 | − blk_mq_complete_request(req); | |
| 652 | + blk_mq_complete_request(req, status); | |
| 654 | 653 | } |
| 655 | 654 | |
| 656 | 655 | /* length is in bytes. gfp flags indicates whether we may sleep. */ |
| @@ -863,8 +862,7 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx, · 206 unmodified lines | ||
| 863 | 862 | if (ns && ns->ms && !blk_integrity_rq(req)) { |
| 864 | 863 | if (!(ns->pi_type && ns->ms == 8) && |
| 865 | 864 | req->cmd_type != REQ_TYPE_DRV_PRIV) { |
| 866 | − req->errors = -EFAULT; | |
| 867 | − blk_mq_complete_request(req); | |
| 865 | + blk_mq_complete_request(req, -EFAULT); | |
| 868 | 866 | return BLK_MQ_RQ_QUEUE_OK; |
| 869 | 867 | } |
| 870 | 868 | } |
| @@ -2439,6 +2437,22 @@ static void nvme_scan_namespaces(struct nvme_dev *dev, unsigned nn) · 1568 unmodified lines | ||
| 2439 | 2437 | list_sort(NULL, &dev->namespaces, ns_cmp); |
| 2440 | 2438 | } |
| 2441 | 2439 | |
| 2440 | +static void nvme_set_irq_hints(struct nvme_dev *dev) | |
| 2441 | +{ | |
| 2442 | + struct nvme_queue *nvmeq; | |
| 2443 | + int i; | |
| 2444 | + | |
| 2445 | + for (i = 0; i < dev->online_queues; i++) { | |
| 2446 | + nvmeq = dev->queues[i]; | |
| 2447 | + | |
| 2448 | + if (!nvmeq->tags || !(*nvmeq->tags)) | |
| 2449 | + continue; | |
| 2450 | + | |
| 2451 | + irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector, | |
| 2452 | + blk_mq_tags_cpumask(*nvmeq->tags)); | |
| 2453 | + } | |
| 2454 | +} | |
| 2455 | + | |
| 2442 | 2456 | static void nvme_dev_scan(struct work_struct *work) |
| 2443 | 2457 | { |
| 2444 | 2458 | struct nvme_dev *dev = container_of(work, struct nvme_dev, scan_work); |
| @@ -2450,6 +2464,7 @@ static void nvme_dev_scan(struct work_struct *work) · 5 unmodified lines | ||
| 2450 | 2464 | return; |
| 2451 | 2465 | nvme_scan_namespaces(dev, le32_to_cpup(&ctrl->nn)); |
| 2452 | 2466 | kfree(ctrl); |
| 2467 | + nvme_set_irq_hints(dev); | |
| 2453 | 2468 | } |
| 2454 | 2469 | |
| 2455 | 2470 | /* |
| @@ -2953,22 +2968,6 @@ static const struct file_operations nvme_dev_fops = { · 497 unmodified lines | ||
| 2953 | 2968 | .compat_ioctl = nvme_dev_ioctl, |
| 2954 | 2969 | }; |
| 2955 | 2970 | |
| 2956 | −static void nvme_set_irq_hints(struct nvme_dev *dev) | |
| 2957 | −{ | |
| 2958 | − struct nvme_queue *nvmeq; | |
| 2959 | − int i; | |
| 2960 | − | |
| 2961 | − for (i = 0; i < dev->online_queues; i++) { | |
| 2962 | − nvmeq = dev->queues[i]; | |
| 2963 | − | |
| 2964 | − if (!nvmeq->tags || !(*nvmeq->tags)) | |
| 2965 | − continue; | |
| 2966 | − | |
| 2967 | − irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector, | |
| 2968 | − blk_mq_tags_cpumask(*nvmeq->tags)); | |
| 2969 | − } | |
| 2970 | −} | |
| 2971 | − | |
| 2972 | 2971 | static int nvme_dev_start(struct nvme_dev *dev) |
| 2973 | 2972 | { |
| 2974 | 2973 | int result; |
| @@ -3010,8 +3009,6 @@ static int nvme_dev_start(struct nvme_dev *dev) · 35 unmodified lines | ||
| 3010 | 3009 | if (result) |
| 3011 | 3010 | goto free_tags; |
| 3012 | 3011 | |
| 3013 | − nvme_set_irq_hints(dev); | |
| 3014 | − | |
| 3015 | 3012 | dev->event_limit = 1; |
| 3016 | 3013 | return result; |
| 3017 | 3014 | |
| @@ -3062,7 +3059,6 @@ static int nvme_dev_resume(struct nvme_dev *dev) · 44 unmodified lines | ||
| 3062 | 3059 | } else { |
| 3063 | 3060 | nvme_unfreeze_queues(dev); |
| 3064 | 3061 | nvme_dev_add(dev); |
| 3065 | − nvme_set_irq_hints(dev); | |
| 3066 | 3062 | } |
| 3067 | 3063 | return 0; |
| 3068 | 3064 | } |
| @@ -144,7 +144,7 @@ static void virtblk_done(struct virtqueue *vq) · 143 unmodified lines | ||
| 144 | 144 | do { |
| 145 | 145 | virtqueue_disable_cb(vq); |
| 146 | 146 | while ((vbr = virtqueue_get_buf(vblk->vqs[qid].vq, &len)) != NULL) { |
| 147 | − blk_mq_complete_request(vbr->req); | |
| 147 | + blk_mq_complete_request(vbr->req, vbr->req->errors); | |
| 148 | 148 | req_done = true; |
| 149 | 149 | } |
| 150 | 150 | if (unlikely(virtqueue_is_broken(vq))) |
| @@ -212,6 +212,9 @@ static int xen_blkif_map(struct xen_blkif *blkif, grant_ref_t *gref, · 211 unmodified lines | ||
| 212 | 212 | |
| 213 | 213 | static int xen_blkif_disconnect(struct xen_blkif *blkif) |
| 214 | 214 | { |
| 215 | + struct pending_req *req, *n; | |
| 216 | + int i = 0, j; | |
| 217 | + | |
| 215 | 218 | if (blkif->xenblkd) { |
| 216 | 219 | kthread_stop(blkif->xenblkd); |
| 217 | 220 | wake_up(&blkif->shutdown_wq); |
| @@ -238,13 +241,28 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) · 20 unmodified lines | ||
| 238 | 241 | /* Remove all persistent grants and the cache of ballooned pages. */ |
| 239 | 242 | xen_blkbk_free_caches(blkif); |
| 240 | 243 | |
| 244 | + /* Check that there is no request in use */ | |
| 245 | + list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { | |
| 246 | + list_del(&req->free_list); | |
| 247 | + | |
| 248 | + for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) | |
| 249 | + kfree(req->segments[j]); | |
| 250 | + | |
| 251 | + for (j = 0; j < MAX_INDIRECT_PAGES; j++) | |
| 252 | + kfree(req->indirect_pages[j]); | |
| 253 | + | |
| 254 | + kfree(req); | |
| 255 | + i++; | |
| 256 | + } | |
| 257 | + | |
| 258 | + WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages)); | |
| 259 | + blkif->nr_ring_pages = 0; | |
| 260 | + | |
| 241 | 261 | return 0; |
| 242 | 262 | } |
| 243 | 263 | |
| 244 | 264 | static void xen_blkif_free(struct xen_blkif *blkif) |
| 245 | 265 | { |
| 246 | − struct pending_req *req, *n; | |
| 247 | − int i = 0, j; | |
| 248 | 266 | |
| 249 | 267 | xen_blkif_disconnect(blkif); |
| 250 | 268 | xen_vbd_free(&blkif->vbd); |
| @@ -257,22 +275,6 @@ static void xen_blkif_free(struct xen_blkif *blkif) · 6 unmodified lines | ||
| 257 | 275 | BUG_ON(!list_empty(&blkif->free_pages)); |
| 258 | 276 | BUG_ON(!RB_EMPTY_ROOT(&blkif->persistent_gnts)); |
| 259 | 277 | |
| 260 | − /* Check that there is no request in use */ | |
| 261 | − list_for_each_entry_safe(req, n, &blkif->pending_free, free_list) { | |
| 262 | − list_del(&req->free_list); | |
| 263 | − | |
| 264 | − for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) | |
| 265 | − kfree(req->segments[j]); | |
| 266 | − | |
| 267 | − for (j = 0; j < MAX_INDIRECT_PAGES; j++) | |
| 268 | − kfree(req->indirect_pages[j]); | |
| 269 | − | |
| 270 | − kfree(req); | |
| 271 | − i++; | |
| 272 | − } | |
| 273 | − | |
| 274 | − WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages)); | |
| 275 | − | |
| 276 | 278 | kmem_cache_free(xen_blkif_cachep, blkif); |
| 277 | 279 | } |
| 278 | 280 | |
| @@ -1142,6 +1142,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) · 1141 unmodified lines | ||
| 1142 | 1142 | RING_IDX i, rp; |
| 1143 | 1143 | unsigned long flags; |
| 1144 | 1144 | struct blkfront_info *info = (struct blkfront_info *)dev_id; |
| 1145 | + int error; | |
| 1145 | 1146 | |
| 1146 | 1147 | spin_lock_irqsave(&info->io_lock, flags); |
| 1147 | 1148 | |
| @@ -1182,37 +1183,37 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) · 34 unmodified lines | ||
| 1182 | 1183 | continue; |
| 1183 | 1184 | } |
| 1184 | 1185 | |
| 1185 | − req->errors = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; | |
| 1186 | + error = (bret->status == BLKIF_RSP_OKAY) ? 0 : -EIO; | |
| 1186 | 1187 | switch (bret->operation) { |
| 1187 | 1188 | case BLKIF_OP_DISCARD: |
| 1188 | 1189 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
| 1189 | 1190 | struct request_queue *rq = info->rq; |
| 1190 | 1191 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
| 1191 | 1192 | info->gd->disk_name, op_name(bret->operation)); |
| 1192 | − req->errors = -EOPNOTSUPP; | |
| 1193 | + error = -EOPNOTSUPP; | |
| 1193 | 1194 | info->feature_discard = 0; |
| 1194 | 1195 | info->feature_secdiscard = 0; |
| 1195 | 1196 | queue_flag_clear(QUEUE_FLAG_DISCARD, rq); |
| 1196 | 1197 | queue_flag_clear(QUEUE_FLAG_SECDISCARD, rq); |
| 1197 | 1198 | } |
| 1198 | − blk_mq_complete_request(req); | |
| 1199 | + blk_mq_complete_request(req, error); | |
| 1199 | 1200 | break; |
| 1200 | 1201 | case BLKIF_OP_FLUSH_DISKCACHE: |
| 1201 | 1202 | case BLKIF_OP_WRITE_BARRIER: |
| 1202 | 1203 | if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { |
| 1203 | 1204 | printk(KERN_WARNING "blkfront: %s: %s op failed\n", |
| 1204 | 1205 | info->gd->disk_name, op_name(bret->operation)); |
| 1205 | − req->errors = -EOPNOTSUPP; | |
| 1206 | + error = -EOPNOTSUPP; | |
| 1206 | 1207 | } |
| 1207 | 1208 | if (unlikely(bret->status == BLKIF_RSP_ERROR && |
| 1208 | 1209 | info->shadow[id].req.u.rw.nr_segments == 0)) { |
| 1209 | 1210 | printk(KERN_WARNING "blkfront: %s: empty %s op failed\n", |
| 1210 | 1211 | info->gd->disk_name, op_name(bret->operation)); |
| 1211 | − req->errors = -EOPNOTSUPP; | |
| 1212 | + error = -EOPNOTSUPP; | |
| 1212 | 1213 | } |
| 1213 | − if (unlikely(req->errors)) { | |
| 1214 | − if (req->errors == -EOPNOTSUPP) | |
| 1215 | − req->errors = 0; | |
| 1214 | + if (unlikely(error)) { | |
| 1215 | + if (error == -EOPNOTSUPP) | |
| 1216 | + error = 0; | |
| 1216 | 1217 | info->feature_flush = 0; |
| 1217 | 1218 | xlvbd_flush(info); |
| 1218 | 1219 | } |
| @@ -1223,7 +1224,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) · 4 unmodified lines | ||
| 1223 | 1224 | dev_dbg(&info->xbdev->dev, "Bad return from blkdev data " |
| 1224 | 1225 | "request: %x\n", bret->status); |
| 1225 | 1226 | |
| 1226 | − blk_mq_complete_request(req); | |
| 1227 | + blk_mq_complete_request(req, error); | |
| 1227 | 1228 | break; |
| 1228 | 1229 | default: |
| 1229 | 1230 | BUG(); |
| @@ -344,11 +344,12 @@ static int xgene_rng_probe(struct platform_device *pdev) · 343 unmodified lines | ||
| 344 | 344 | if (IS_ERR(ctx->csr_base)) |
| 345 | 345 | return PTR_ERR(ctx->csr_base); |
| 346 | 346 | |
| 347 | − ctx->irq = platform_get_irq(pdev, 0); | |
| 348 | − if (ctx->irq < 0) { | |
| 347 | + rc = platform_get_irq(pdev, 0); | |
| 348 | + if (rc < 0) { | |
| 349 | 349 | dev_err(&pdev->dev, "No IRQ resource\n"); |
| 350 | − return ctx->irq; | |
| 350 | + return rc; | |
| 351 | 351 | } |
| 352 | + ctx->irq = rc; | |
| 352 | 353 | |
| 353 | 354 | dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d", |
| 354 | 355 | ctx->csr_base, ctx->irq); |
| @@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np) · 147 unmodified lines | ||
| 148 | 148 | bc_timer.freq = clk_get_rate(timer_clk); |
| 149 | 149 | |
| 150 | 150 | irq = irq_of_parse_and_map(np, 0); |
| 151 | − if (irq == NO_IRQ) { | |
| 151 | + if (!irq) { | |
| 152 | 152 | pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME); |
| 153 | 153 | return; |
| 154 | 154 | } |
| @@ -152,7 +152,7 @@ static void __init keystone_timer_init(struct device_node *np) · 151 unmodified lines | ||
| 152 | 152 | int irq, error; |
| 153 | 153 | |
| 154 | 154 | irq = irq_of_parse_and_map(np, 0); |
| 155 | − if (irq == NO_IRQ) { | |
| 155 | + if (!irq) { | |
| 156 | 156 | pr_err("%s: failed to map interrupts\n", __func__); |
| 157 | 157 | return; |
| 158 | 158 | } |
| @@ -687,6 +687,33 @@ static inline u32 mv_cesa_get_int_mask(struct mv_cesa_engine *engine) · 686 unmodified lines | ||
| 687 | 687 | |
| 688 | 688 | int mv_cesa_queue_req(struct crypto_async_request *req); |
| 689 | 689 | |
| 690 | +/* | |
| 691 | + * Helper function that indicates whether a crypto request needs to be | |
| 692 | + * cleaned up or not after being enqueued using mv_cesa_queue_req(). | |
| 693 | + */ | |
| 694 | +static inline int mv_cesa_req_needs_cleanup(struct crypto_async_request *req, | |
| 695 | + int ret) | |
| 696 | +{ | |
| 697 | + /* | |
| 698 | + * The queue still had some space, the request was queued | |
| 699 | + * normally, so there's no need to clean it up. | |
| 700 | + */ | |
| 701 | + if (ret == -EINPROGRESS) | |
| 702 | + return false; | |
| 703 | + | |
| 704 | + /* | |
| 705 | + * The queue had not space left, but since the request is | |
| 706 | + * flagged with CRYPTO_TFM_REQ_MAY_BACKLOG, it was added to | |
| 707 | + * the backlog and will be processed later. There's no need to | |
| 708 | + * clean it up. | |
| 709 | + */ | |
| 710 | + if (ret == -EBUSY && req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG) | |
| 711 | + return false; | |
| 712 | + | |
| 713 | + /* Request wasn't queued, we need to clean it up */ | |
| 714 | + return true; | |
| 715 | +} | |
| 716 | + | |
| 690 | 717 | /* TDMA functions */ |
| 691 | 718 | |
| 692 | 719 | static inline void mv_cesa_req_dma_iter_init(struct mv_cesa_dma_iter *iter, |
| @@ -189,7 +189,6 @@ static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req, · 188 unmodified lines | ||
| 189 | 189 | { |
| 190 | 190 | struct ablkcipher_request *ablkreq = ablkcipher_request_cast(req); |
| 191 | 191 | struct mv_cesa_ablkcipher_req *creq = ablkcipher_request_ctx(ablkreq); |
| 192 | − | |
| 193 | 192 | creq->req.base.engine = engine; |
| 194 | 193 | |
| 195 | 194 | if (creq->req.base.type == CESA_DMA_REQ) |
| @@ -431,7 +430,7 @@ static int mv_cesa_des_op(struct ablkcipher_request *req, · 235 unmodified lines | ||
| 431 | 430 | return ret; |
| 432 | 431 | |
| 433 | 432 | ret = mv_cesa_queue_req(&req->base); |
| 434 | − if (ret && ret != -EINPROGRESS) | |
| 433 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 435 | 434 | mv_cesa_ablkcipher_cleanup(req); |
| 436 | 435 | |
| 437 | 436 | return ret; |
| @@ -551,7 +550,7 @@ static int mv_cesa_des3_op(struct ablkcipher_request *req, · 113 unmodified lines | ||
| 551 | 550 | return ret; |
| 552 | 551 | |
| 553 | 552 | ret = mv_cesa_queue_req(&req->base); |
| 554 | − if (ret && ret != -EINPROGRESS) | |
| 553 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 555 | 554 | mv_cesa_ablkcipher_cleanup(req); |
| 556 | 555 | |
| 557 | 556 | return ret; |
| @@ -693,7 +692,7 @@ static int mv_cesa_aes_op(struct ablkcipher_request *req, · 135 unmodified lines | ||
| 693 | 692 | return ret; |
| 694 | 693 | |
| 695 | 694 | ret = mv_cesa_queue_req(&req->base); |
| 696 | − if (ret && ret != -EINPROGRESS) | |
| 695 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 697 | 696 | mv_cesa_ablkcipher_cleanup(req); |
| 698 | 697 | |
| 699 | 698 | return ret; |
| @@ -739,10 +739,8 @@ static int mv_cesa_ahash_update(struct ahash_request *req) · 738 unmodified lines | ||
| 739 | 739 | return 0; |
| 740 | 740 | |
| 741 | 741 | ret = mv_cesa_queue_req(&req->base); |
| 742 | − if (ret && ret != -EINPROGRESS) { | |
| 742 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 743 | 743 | mv_cesa_ahash_cleanup(req); |
| 744 | − return ret; | |
| 745 | − } | |
| 746 | 744 | |
| 747 | 745 | return ret; |
| 748 | 746 | } |
| @@ -766,7 +764,7 @@ static int mv_cesa_ahash_final(struct ahash_request *req) · 17 unmodified lines | ||
| 766 | 764 | return 0; |
| 767 | 765 | |
| 768 | 766 | ret = mv_cesa_queue_req(&req->base); |
| 769 | − if (ret && ret != -EINPROGRESS) | |
| 767 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 770 | 768 | mv_cesa_ahash_cleanup(req); |
| 771 | 769 | |
| 772 | 770 | return ret; |
| @@ -791,7 +789,7 @@ static int mv_cesa_ahash_finup(struct ahash_request *req) · 18 unmodified lines | ||
| 791 | 789 | return 0; |
| 792 | 790 | |
| 793 | 791 | ret = mv_cesa_queue_req(&req->base); |
| 794 | − if (ret && ret != -EINPROGRESS) | |
| 792 | + if (mv_cesa_req_needs_cleanup(&req->base, ret)) | |
| 795 | 793 | mv_cesa_ahash_cleanup(req); |
| 796 | 794 | |
| 797 | 795 | return ret; |
| @@ -88,6 +88,9 @@ static void adf_dev_restore(struct adf_accel_dev *accel_dev) · 87 unmodified lines | ||
| 88 | 88 | struct pci_dev *parent = pdev->bus->self; |
| 89 | 89 | uint16_t bridge_ctl = 0; |
| 90 | 90 | |
| 91 | + if (accel_dev->is_vf) | |
| 92 | + return; | |
| 93 | + | |
| 91 | 94 | dev_info(&GET_DEV(accel_dev), "Resetting device qat_dev%d\n", |
| 92 | 95 | accel_dev->accel_id); |
| 93 | 96 | |
| @@ -455,6 +455,15 @@ static struct at_xdmac_desc *at_xdmac_alloc_desc(struct dma_chan *chan, · 454 unmodified lines | ||
| 455 | 455 | return desc; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | +void at_xdmac_init_used_desc(struct at_xdmac_desc *desc) | |
| 459 | +{ | |
| 460 | + memset(&desc->lld, 0, sizeof(desc->lld)); | |
| 461 | + INIT_LIST_HEAD(&desc->descs_list); | |
| 462 | + desc->direction = DMA_TRANS_NONE; | |
| 463 | + desc->xfer_size = 0; | |
| 464 | + desc->active_xfer = false; | |
| 465 | +} | |
| 466 | + | |
| 458 | 467 | /* Call must be protected by lock. */ |
| 459 | 468 | static struct at_xdmac_desc *at_xdmac_get_desc(struct at_xdmac_chan *atchan) |
| 460 | 469 | { |
| @@ -466,7 +475,7 @@ static struct at_xdmac_desc *at_xdmac_get_desc(struct at_xdmac_chan *atchan) · 5 unmodified lines | ||
| 466 | 475 | desc = list_first_entry(&atchan->free_descs_list, |
| 467 | 476 | struct at_xdmac_desc, desc_node); |
| 468 | 477 | list_del(&desc->desc_node); |
| 469 | − desc->active_xfer = false; | |
| 478 | + at_xdmac_init_used_desc(desc); | |
| 470 | 479 | } |
| 471 | 480 | |
| 472 | 481 | return desc; |
| @@ -875,14 +884,14 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan, · 402 unmodified lines | ||
| 875 | 884 | |
| 876 | 885 | if (xt->src_inc) { |
| 877 | 886 | if (xt->src_sgl) |
| 878 | − chan_cc |= AT_XDMAC_CC_SAM_UBS_DS_AM; | |
| 887 | + chan_cc |= AT_XDMAC_CC_SAM_UBS_AM; | |
| 879 | 888 | else |
| 880 | 889 | chan_cc |= AT_XDMAC_CC_SAM_INCREMENTED_AM; |
| 881 | 890 | } |
| 882 | 891 | |
| 883 | 892 | if (xt->dst_inc) { |
| 884 | 893 | if (xt->dst_sgl) |
| 885 | − chan_cc |= AT_XDMAC_CC_DAM_UBS_DS_AM; | |
| 894 | + chan_cc |= AT_XDMAC_CC_DAM_UBS_AM; | |
| 886 | 895 | else |
| 887 | 896 | chan_cc |= AT_XDMAC_CC_DAM_INCREMENTED_AM; |
| 888 | 897 | } |
| @@ -554,10 +554,18 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan) · 553 unmodified lines | ||
| 554 | 554 | mutex_lock(&dma_list_mutex); |
| 555 | 555 | |
| 556 | 556 | if (chan->client_count == 0) { |
| 557 | + struct dma_device *device = chan->device; | |
| 558 | + | |
| 559 | + dma_cap_set(DMA_PRIVATE, device->cap_mask); | |
| 560 | + device->privatecnt++; | |
| 557 | 561 | err = dma_chan_get(chan); |
| 558 | − if (err) | |
| 562 | + if (err) { | |
| 559 | 563 | pr_debug("%s: failed to get %s: (%d)\n", |
| 560 | 564 | __func__, dma_chan_name(chan), err); |
| 565 | + chan = NULL; | |
| 566 | + if (--device->privatecnt == 0) | |
| 567 | + dma_cap_clear(DMA_PRIVATE, device->cap_mask); | |
| 568 | + } | |
| 561 | 569 | } else |
| 562 | 570 | chan = NULL; |
| 563 | 571 | |
| @@ -1591,7 +1591,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) · 1590 unmodified lines | ||
| 1591 | 1591 | INIT_LIST_HEAD(&dw->dma.channels); |
| 1592 | 1592 | for (i = 0; i < nr_channels; i++) { |
| 1593 | 1593 | struct dw_dma_chan *dwc = &dw->chan[i]; |
| 1594 | − int r = nr_channels - i - 1; | |
| 1595 | 1594 | |
| 1596 | 1595 | dwc->chan.device = &dw->dma; |
| 1597 | 1596 | dma_cookie_init(&dwc->chan); |
| @@ -1603,7 +1602,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) · 5 unmodified lines | ||
| 1603 | 1602 | |
| 1604 | 1603 | /* 7 is highest priority & 0 is lowest. */ |
| 1605 | 1604 | if (pdata->chan_priority == CHAN_PRIORITY_ASCENDING) |
| 1606 | − dwc->priority = r; | |
| 1605 | + dwc->priority = nr_channels - i - 1; | |
| 1607 | 1606 | else |
| 1608 | 1607 | dwc->priority = i; |
| 1609 | 1608 | |
| @@ -1622,6 +1621,7 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) · 12 unmodified lines | ||
| 1622 | 1621 | /* Hardware configuration */ |
| 1623 | 1622 | if (autocfg) { |
| 1624 | 1623 | unsigned int dwc_params; |
| 1624 | + unsigned int r = DW_DMA_MAX_NR_CHANNELS - i - 1; | |
| 1625 | 1625 | void __iomem *addr = chip->regs + r * sizeof(u32); |
| 1626 | 1626 | |
| 1627 | 1627 | dwc_params = dma_read_byaddr(addr, DWC_PARAMS); |
| @@ -355,23 +355,23 @@ static size_t idma64_active_desc_size(struct idma64_chan *idma64c) · 354 unmodified lines | ||
| 355 | 355 | struct idma64_desc *desc = idma64c->desc; |
| 356 | 356 | struct idma64_hw_desc *hw; |
| 357 | 357 | size_t bytes = desc->length; |
| 358 | − u64 llp; | |
| 359 | − u32 ctlhi; | |
| 358 | + u64 llp = channel_readq(idma64c, LLP); | |
| 359 | + u32 ctlhi = channel_readl(idma64c, CTL_HI); | |
| 360 | 360 | unsigned int i = 0; |
| 361 | 361 | |
| 362 | − llp = channel_readq(idma64c, LLP); | |
| 363 | 362 | do { |
| 364 | 363 | hw = &desc->hw[i]; |
| 365 | − } while ((hw->llp != llp) && (++i < desc->ndesc)); | |
| 364 | + if (hw->llp == llp) | |
| 365 | + break; | |
| 366 | + bytes -= hw->len; | |
| 367 | + } while (++i < desc->ndesc); | |
| 366 | 368 | |
| 367 | 369 | if (!i) |
| 368 | 370 | return bytes; |
| 369 | 371 | |
| 370 | − do { | |
| 371 | − bytes -= desc->hw[--i].len; | |
| 372 | − } while (i); | |
| 372 | + /* The current chunk is not fully transfered yet */ | |
| 373 | + bytes += desc->hw[--i].len; | |
| 373 | 374 | |
| 374 | − ctlhi = channel_readl(idma64c, CTL_HI); | |
| 375 | 375 | return bytes - IDMA64C_CTLH_BLOCK_TS(ctlhi); |
| 376 | 376 | } |
| 377 | 377 | |
| @@ -473,8 +473,10 @@ static void pxad_free_phy(struct pxad_chan *chan) · 472 unmodified lines | ||
| 473 | 473 | return; |
| 474 | 474 | |
| 475 | 475 | /* clear the channel mapping in DRCMR */ |
| 476 | − reg = pxad_drcmr(chan->drcmr); | |
| 477 | − writel_relaxed(0, chan->phy->base + reg); | |
| 476 | + if (chan->drcmr <= DRCMR_CHLNUM) { | |
| 477 | + reg = pxad_drcmr(chan->drcmr); | |
| 478 | + writel_relaxed(0, chan->phy->base + reg); | |
| 479 | + } | |
| 478 | 480 | |
| 479 | 481 | spin_lock_irqsave(&pdev->phy_lock, flags); |
| 480 | 482 | for (i = 0; i < 32; i++) |
| @@ -516,8 +518,10 @@ static void phy_enable(struct pxad_phy *phy, bool misaligned) · 35 unmodified lines | ||
| 516 | 518 | "%s(); phy=%p(%d) misaligned=%d\n", __func__, |
| 517 | 519 | phy, phy->idx, misaligned); |
| 518 | 520 | |
| 519 | − reg = pxad_drcmr(phy->vchan->drcmr); | |
| 520 | − writel_relaxed(DRCMR_MAPVLD | phy->idx, phy->base + reg); | |
| 521 | + if (phy->vchan->drcmr <= DRCMR_CHLNUM) { | |
| 522 | + reg = pxad_drcmr(phy->vchan->drcmr); | |
| 523 | + writel_relaxed(DRCMR_MAPVLD | phy->idx, phy->base + reg); | |
| 524 | + } | |
| 521 | 525 | |
| 522 | 526 | dalgn = phy_readl_relaxed(phy, DALGN); |
| 523 | 527 | if (misaligned) |
| @@ -887,6 +891,7 @@ pxad_tx_prep(struct virt_dma_chan *vc, struct virt_dma_desc *vd, · 363 unmodified lines | ||
| 887 | 891 | struct dma_async_tx_descriptor *tx; |
| 888 | 892 | struct pxad_chan *chan = container_of(vc, struct pxad_chan, vc); |
| 889 | 893 | |
| 894 | + INIT_LIST_HEAD(&vd->node); | |
| 890 | 895 | tx = vchan_tx_prep(vc, vd, tx_flags); |
| 891 | 896 | tx->tx_submit = pxad_tx_submit; |
| 892 | 897 | dev_dbg(&chan->vc.chan.dev->device, |
| @@ -910,14 +915,18 @@ static void pxad_get_config(struct pxad_chan *chan, · 17 unmodified lines | ||
| 910 | 915 | width = chan->cfg.src_addr_width; |
| 911 | 916 | dev_addr = chan->cfg.src_addr; |
| 912 | 917 | *dev_src = dev_addr; |
| 913 | − *dcmd |= PXA_DCMD_INCTRGADDR | PXA_DCMD_FLOWSRC; | |
| 918 | + *dcmd |= PXA_DCMD_INCTRGADDR; | |
| 919 | + if (chan->drcmr <= DRCMR_CHLNUM) | |
| 920 | + *dcmd |= PXA_DCMD_FLOWSRC; | |
| 914 | 921 | } |
| 915 | 922 | if (dir == DMA_MEM_TO_DEV) { |
| 916 | 923 | maxburst = chan->cfg.dst_maxburst; |
| 917 | 924 | width = chan->cfg.dst_addr_width; |
| 918 | 925 | dev_addr = chan->cfg.dst_addr; |
| 919 | 926 | *dev_dst = dev_addr; |
| 920 | − *dcmd |= PXA_DCMD_INCSRCADDR | PXA_DCMD_FLOWTRG; | |
| 927 | + *dcmd |= PXA_DCMD_INCSRCADDR; | |
| 928 | + if (chan->drcmr <= DRCMR_CHLNUM) | |
| 929 | + *dcmd |= PXA_DCMD_FLOWTRG; | |
| 921 | 930 | } |
| 922 | 931 | if (dir == DMA_MEM_TO_MEM) |
| 923 | 932 | *dcmd |= PXA_DCMD_BURST32 | PXA_DCMD_INCTRGADDR | |
| @@ -1177,6 +1186,16 @@ static unsigned int pxad_residue(struct pxad_chan *chan, · 253 unmodified lines | ||
| 1177 | 1186 | else |
| 1178 | 1187 | curr = phy_readl_relaxed(chan->phy, DTADR); |
| 1179 | 1188 | |
| 1189 | + /* | |
| 1190 | + * curr has to be actually read before checking descriptor | |
| 1191 | + * completion, so that a curr inside a status updater | |
| 1192 | + * descriptor implies the following test returns true, and | |
| 1193 | + * preventing reordering of curr load and the test. | |
| 1194 | + */ | |
| 1195 | + rmb(); | |
| 1196 | + if (is_desc_completed(vd)) | |
| 1197 | + goto out; | |
| 1198 | + | |
| 1180 | 1199 | for (i = 0; i < sw_desc->nb_desc - 1; i++) { |
| 1181 | 1200 | hw_desc = sw_desc->hw_desc[i]; |
| 1182 | 1201 | if (sw_desc->hw_desc[0]->dcmd & PXA_DCMD_INCSRCADDR) |
| @@ -599,13 +599,13 @@ get_next_cyclic_promise(struct sun4i_dma_contract *contract) · 598 unmodified lines | ||
| 599 | 599 | static void sun4i_dma_free_contract(struct virt_dma_desc *vd) |
| 600 | 600 | { |
| 601 | 601 | struct sun4i_dma_contract *contract = to_sun4i_dma_contract(vd); |
| 602 | − struct sun4i_dma_promise *promise; | |
| 602 | + struct sun4i_dma_promise *promise, *tmp; | |
| 603 | 603 | |
| 604 | 604 | /* Free all the demands and completed demands */ |
| 605 | − list_for_each_entry(promise, &contract->demands, list) | |
| 605 | + list_for_each_entry_safe(promise, tmp, &contract->demands, list) | |
| 606 | 606 | kfree(promise); |
| 607 | 607 | |
| 608 | − list_for_each_entry(promise, &contract->completed_demands, list) | |
| 608 | + list_for_each_entry_safe(promise, tmp, &contract->completed_demands, list) | |
| 609 | 609 | kfree(promise); |
| 610 | 610 | |
| 611 | 611 | kfree(contract); |
| @@ -59,7 +59,6 @@ · 58 unmodified lines | ||
| 59 | 59 | #define XGENE_DMA_RING_MEM_RAM_SHUTDOWN 0xD070 |
| 60 | 60 | #define XGENE_DMA_RING_BLK_MEM_RDY 0xD074 |
| 61 | 61 | #define XGENE_DMA_RING_BLK_MEM_RDY_VAL 0xFFFFFFFF |
| 62 | −#define XGENE_DMA_RING_DESC_CNT(v) (((v) & 0x0001FFFE) >> 1) | |
| 63 | 62 | #define XGENE_DMA_RING_ID_GET(owner, num) (((owner) << 6) | (num)) |
| 64 | 63 | #define XGENE_DMA_RING_DST_ID(v) ((1 << 10) | (v)) |
| 65 | 64 | #define XGENE_DMA_RING_CMD_OFFSET 0x2C |
| @@ -379,14 +378,6 @@ static u8 xgene_dma_encode_xor_flyby(u32 src_cnt) · 313 unmodified lines | ||
| 379 | 378 | return flyby_type[src_cnt]; |
| 380 | 379 | } |
| 381 | 380 | |
| 382 | −static u32 xgene_dma_ring_desc_cnt(struct xgene_dma_ring *ring) | |
| 383 | −{ | |
| 384 | − u32 __iomem *cmd_base = ring->cmd_base; | |
| 385 | − u32 ring_state = ioread32(&cmd_base[1]); | |
| 386 | − | |
| 387 | − return XGENE_DMA_RING_DESC_CNT(ring_state); | |
| 388 | −} | |
| 389 | − | |
| 390 | 381 | static void xgene_dma_set_src_buffer(__le64 *ext8, size_t *len, |
| 391 | 382 | dma_addr_t *paddr) |
| 392 | 383 | { |
| @@ -659,15 +650,12 @@ static void xgene_dma_clean_running_descriptor(struct xgene_dma_chan *chan, · 266 unmodified lines | ||
| 659 | 650 | dma_pool_free(chan->desc_pool, desc, desc->tx.phys); |
| 660 | 651 | } |
| 661 | 652 | |
| 662 | −static int xgene_chan_xfer_request(struct xgene_dma_ring *ring, | |
| 663 | − struct xgene_dma_desc_sw *desc_sw) | |
| 653 | +static void xgene_chan_xfer_request(struct xgene_dma_chan *chan, | |
| 654 | + struct xgene_dma_desc_sw *desc_sw) | |
| 664 | 655 | { |
| 656 | + struct xgene_dma_ring *ring = &chan->tx_ring; | |
| 665 | 657 | struct xgene_dma_desc_hw *desc_hw; |
| 666 | 658 | |
| 667 | − /* Check if can push more descriptor to hw for execution */ | |
| 668 | − if (xgene_dma_ring_desc_cnt(ring) > (ring->slots - 2)) | |
| 669 | − return -EBUSY; | |
| 670 | − | |
| 671 | 659 | /* Get hw descriptor from DMA tx ring */ |
| 672 | 660 | desc_hw = &ring->desc_hw[ring->head]; |
| 673 | 661 | |
| @@ -694,11 +682,13 @@ static int xgene_chan_xfer_request(struct xgene_dma_ring *ring, · 20 unmodified lines | ||
| 694 | 682 | memcpy(desc_hw, &desc_sw->desc2, sizeof(*desc_hw)); |
| 695 | 683 | } |
| 696 | 684 | |
| 685 | + /* Increment the pending transaction count */ | |
| 686 | + chan->pending += ((desc_sw->flags & | |
| 687 | + XGENE_DMA_FLAG_64B_DESC) ? 2 : 1); | |
| 688 | + | |
| 697 | 689 | /* Notify the hw that we have descriptor ready for execution */ |
| 698 | 690 | iowrite32((desc_sw->flags & XGENE_DMA_FLAG_64B_DESC) ? |
| 699 | 691 | 2 : 1, ring->cmd); |
| 700 | − | |
| 701 | − return 0; | |
| 702 | 692 | } |
| 703 | 693 | |
| 704 | 694 | /** |
| @@ -710,7 +700,6 @@ static int xgene_chan_xfer_request(struct xgene_dma_ring *ring, · 5 unmodified lines | ||
| 710 | 700 | static void xgene_chan_xfer_ld_pending(struct xgene_dma_chan *chan) |
| 711 | 701 | { |
| 712 | 702 | struct xgene_dma_desc_sw *desc_sw, *_desc_sw; |
| 713 | − int ret; | |
| 714 | 703 | |
| 715 | 704 | /* |
| 716 | 705 | * If the list of pending descriptors is empty, then we |
| @@ -735,18 +724,13 @@ static void xgene_chan_xfer_ld_pending(struct xgene_dma_chan *chan) · 18 unmodified lines | ||
| 735 | 724 | if (chan->pending >= chan->max_outstanding) |
| 736 | 725 | return; |
| 737 | 726 | |
| 738 | − ret = xgene_chan_xfer_request(&chan->tx_ring, desc_sw); | |
| 739 | − if (ret) | |
| 740 | − return; | |
| 727 | + xgene_chan_xfer_request(chan, desc_sw); | |
| 741 | 728 | |
| 742 | 729 | /* |
| 743 | 730 | * Delete this element from ld pending queue and append it to |
| 744 | 731 | * ld running queue |
| 745 | 732 | */ |
| 746 | 733 | list_move_tail(&desc_sw->node, &chan->ld_running); |
| 747 | − | |
| 748 | − /* Increment the pending transaction count */ | |
| 749 | − chan->pending++; | |
| 750 | 734 | } |
| 751 | 735 | } |
| 752 | 736 | |
| @@ -821,7 +805,8 @@ static void xgene_dma_cleanup_descriptors(struct xgene_dma_chan *chan) · 68 unmodified lines | ||
| 821 | 805 | * Decrement the pending transaction count |
| 822 | 806 | * as we have processed one |
| 823 | 807 | */ |
| 824 | − chan->pending--; | |
| 808 | + chan->pending -= ((desc_sw->flags & | |
| 809 | + XGENE_DMA_FLAG_64B_DESC) ? 2 : 1); | |
| 825 | 810 | |
| 826 | 811 | /* |
| 827 | 812 | * Delete this node from ld running queue and append it to |
| @@ -1421,15 +1406,18 @@ static int xgene_dma_create_ring_one(struct xgene_dma_chan *chan, · 593 unmodified lines | ||
| 1421 | 1406 | struct xgene_dma_ring *ring, |
| 1422 | 1407 | enum xgene_dma_ring_cfgsize cfgsize) |
| 1423 | 1408 | { |
| 1409 | + int ret; | |
| 1410 | + | |
| 1424 | 1411 | /* Setup DMA ring descriptor variables */ |
| 1425 | 1412 | ring->pdma = chan->pdma; |
| 1426 | 1413 | ring->cfgsize = cfgsize; |
| 1427 | 1414 | ring->num = chan->pdma->ring_num++; |
| 1428 | 1415 | ring->id = XGENE_DMA_RING_ID_GET(ring->owner, ring->buf_num); |
| 1429 | 1416 | |
| 1430 | − ring->size = xgene_dma_get_ring_size(chan, cfgsize); | |
| 1431 | − if (ring->size <= 0) | |
| 1432 | − return ring->size; | |
| 1417 | + ret = xgene_dma_get_ring_size(chan, cfgsize); | |
| 1418 | + if (ret <= 0) | |
| 1419 | + return ret; | |
| 1420 | + ring->size = ret; | |
| 1433 | 1421 | |
| 1434 | 1422 | /* Allocate memory for DMA ring descriptor */ |
| 1435 | 1423 | ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size, |
| @@ -1482,7 +1470,7 @@ static int xgene_dma_create_chan_rings(struct xgene_dma_chan *chan) · 46 unmodified lines | ||
| 1482 | 1470 | tx_ring->id, tx_ring->num, tx_ring->desc_vaddr); |
| 1483 | 1471 | |
| 1484 | 1472 | /* Set the max outstanding request possible to this channel */ |
| 1485 | − chan->max_outstanding = rx_ring->slots; | |
| 1473 | + chan->max_outstanding = tx_ring->slots; | |
| 1486 | 1474 | |
| 1487 | 1475 | return ret; |
| 1488 | 1476 | } |
| @@ -739,7 +739,7 @@ static struct dma_chan *zx_of_dma_simple_xlate(struct of_phandle_args *dma_spec, · 738 unmodified lines | ||
| 739 | 739 | struct dma_chan *chan; |
| 740 | 740 | struct zx_dma_chan *c; |
| 741 | 741 | |
| 742 | − if (request > d->dma_requests) | |
| 742 | + if (request >= d->dma_requests) | |
| 743 | 743 | return NULL; |
| 744 | 744 | |
| 745 | 745 | chan = dma_get_any_slave_channel(&d->slave); |
| @@ -159,7 +159,7 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) · 158 unmodified lines | ||
| 159 | 159 | static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached) |
| 160 | 160 | { |
| 161 | 161 | if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) { |
| 162 | − *attached = new ? true : false; | |
| 162 | + *attached = ((new >> idx) & 0x1) ? true : false; | |
| 163 | 163 | return true; |
| 164 | 164 | } |
| 165 | 165 | |
| @@ -139,6 +139,14 @@ config QCOM_SCM · 138 unmodified lines | ||
| 139 | 139 | bool |
| 140 | 140 | depends on ARM || ARM64 |
| 141 | 141 | |
| 142 | +config QCOM_SCM_32 | |
| 143 | + def_bool y | |
| 144 | + depends on QCOM_SCM && ARM | |
| 145 | + | |
| 146 | +config QCOM_SCM_64 | |
| 147 | + def_bool y | |
| 148 | + depends on QCOM_SCM && ARM64 | |
| 149 | + | |
| 142 | 150 | source "drivers/firmware/broadcom/Kconfig" |
| 143 | 151 | source "drivers/firmware/google/Kconfig" |
| 144 | 152 | source "drivers/firmware/efi/Kconfig" |
| @@ -13,7 +13,8 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o · 12 unmodified lines | ||
| 13 | 13 | obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o |
| 14 | 14 | obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o |
| 15 | 15 | obj-$(CONFIG_QCOM_SCM) += qcom_scm.o |
| 16 | −obj-$(CONFIG_QCOM_SCM) += qcom_scm-32.o | |
| 16 | +obj-$(CONFIG_QCOM_SCM_64) += qcom_scm-64.o | |
| 17 | +obj-$(CONFIG_QCOM_SCM_32) += qcom_scm-32.o | |
| 17 | 18 | CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1) |
| 18 | 19 | |
| 19 | 20 | obj-y += broadcom/ |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | #include <linux/efi.h> |
| 16 | +#include <linux/sort.h> | |
| 16 | 17 | #include <asm/efi.h> |
| 17 | 18 | |
| 18 | 19 | #include "efistub.h" |
| @@ -305,6 +306,44 @@ fail: · 286 unmodified lines | ||
| 305 | 306 | */ |
| 306 | 307 | #define EFI_RT_VIRTUAL_BASE 0x40000000 |
| 307 | 308 | |
| 309 | +static int cmp_mem_desc(const void *l, const void *r) | |
| 310 | +{ | |
| 311 | + const efi_memory_desc_t *left = l, *right = r; | |
| 312 | + | |
| 313 | + return (left->phys_addr > right->phys_addr) ? 1 : -1; | |
| 314 | +} | |
| 315 | + | |
| 316 | +/* | |
| 317 | + * Returns whether region @left ends exactly where region @right starts, | |
| 318 | + * or false if either argument is NULL. | |
| 319 | + */ | |
| 320 | +static bool regions_are_adjacent(efi_memory_desc_t *left, | |
| 321 | + efi_memory_desc_t *right) | |
| 322 | +{ | |
| 323 | + u64 left_end; | |
| 324 | + | |
| 325 | + if (left == NULL || right == NULL) | |
| 326 | + return false; | |
| 327 | + | |
| 328 | + left_end = left->phys_addr + left->num_pages * EFI_PAGE_SIZE; | |
| 329 | + | |
| 330 | + return left_end == right->phys_addr; | |
| 331 | +} | |
| 332 | + | |
| 333 | +/* | |
| 334 | + * Returns whether region @left and region @right have compatible memory type | |
| 335 | + * mapping attributes, and are both EFI_MEMORY_RUNTIME regions. | |
| 336 | + */ | |
| 337 | +static bool regions_have_compatible_memory_type_attrs(efi_memory_desc_t *left, | |
| 338 | + efi_memory_desc_t *right) | |
| 339 | +{ | |
| 340 | + static const u64 mem_type_mask = EFI_MEMORY_WB | EFI_MEMORY_WT | | |
| 341 | + EFI_MEMORY_WC | EFI_MEMORY_UC | | |
| 342 | + EFI_MEMORY_RUNTIME; | |
| 343 | + | |
| 344 | + return ((left->attribute ^ right->attribute) & mem_type_mask) == 0; | |
| 345 | +} | |
| 346 | + | |
| 308 | 347 | /* |
| 309 | 348 | * efi_get_virtmap() - create a virtual mapping for the EFI memory map |
| 310 | 349 | * |
| @@ -317,33 +356,52 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, · 6 unmodified lines | ||
| 317 | 356 | int *count) |
| 318 | 357 | { |
| 319 | 358 | u64 efi_virt_base = EFI_RT_VIRTUAL_BASE; |
| 320 | − efi_memory_desc_t *out = runtime_map; | |
| 359 | + efi_memory_desc_t *in, *prev = NULL, *out = runtime_map; | |
| 321 | 360 | int l; |
| 322 | 361 | |
| 323 | − for (l = 0; l < map_size; l += desc_size) { | |
| 324 | − efi_memory_desc_t *in = (void *)memory_map + l; | |
| 362 | + /* | |
| 363 | + * To work around potential issues with the Properties Table feature | |
| 364 | + * introduced in UEFI 2.5, which may split PE/COFF executable images | |
| 365 | + * in memory into several RuntimeServicesCode and RuntimeServicesData | |
| 366 | + * regions, we need to preserve the relative offsets between adjacent | |
| 367 | + * EFI_MEMORY_RUNTIME regions with the same memory type attributes. | |
| 368 | + * The easiest way to find adjacent regions is to sort the memory map | |
| 369 | + * before traversing it. | |
| 370 | + */ | |
| 371 | + sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL); | |
| 372 | + | |
| 373 | + for (l = 0; l < map_size; l += desc_size, prev = in) { | |
| 325 | 374 | u64 paddr, size; |
| 326 | 375 | |
| 376 | + in = (void *)memory_map + l; | |
| 327 | 377 | if (!(in->attribute & EFI_MEMORY_RUNTIME)) |
| 328 | 378 | continue; |
| 329 | 379 | |
| 380 | + paddr = in->phys_addr; | |
| 381 | + size = in->num_pages * EFI_PAGE_SIZE; | |
| 382 | + | |
| 330 | 383 | /* |
| 331 | 384 | * Make the mapping compatible with 64k pages: this allows |
| 332 | 385 | * a 4k page size kernel to kexec a 64k page size kernel and |
| 333 | 386 | * vice versa. |
| 334 | 387 | */ |
| 335 | − paddr = round_down(in->phys_addr, SZ_64K); | |
| 336 | − size = round_up(in->num_pages * EFI_PAGE_SIZE + | |
| 337 | − in->phys_addr - paddr, SZ_64K); | |
| 338 | − | |
| 339 | − /* | |
| 340 | − * Avoid wasting memory on PTEs by choosing a virtual base that | |
| 341 | − * is compatible with section mappings if this region has the | |
| 342 | − * appropriate size and physical alignment. (Sections are 2 MB | |
| 343 | − * on 4k granule kernels) | |
| 344 | − */ | |
| 345 | − if (IS_ALIGNED(in->phys_addr, SZ_2M) && size >= SZ_2M) | |
| 346 | − efi_virt_base = round_up(efi_virt_base, SZ_2M); | |
| 388 | + if (!regions_are_adjacent(prev, in) || | |
| 389 | + !regions_have_compatible_memory_type_attrs(prev, in)) { | |
| 390 | + | |
| 391 | + paddr = round_down(in->phys_addr, SZ_64K); | |
| 392 | + size += in->phys_addr - paddr; | |
| 393 | + | |
| 394 | + /* | |
| 395 | + * Avoid wasting memory on PTEs by choosing a virtual | |
| 396 | + * base that is compatible with section mappings if this | |
| 397 | + * region has the appropriate size and physical | |
| 398 | + * alignment. (Sections are 2 MB on 4k granule kernels) | |
| 399 | + */ | |
| 400 | + if (IS_ALIGNED(in->phys_addr, SZ_2M) && size >= SZ_2M) | |
| 401 | + efi_virt_base = round_up(efi_virt_base, SZ_2M); | |
| 402 | + else | |
| 403 | + efi_virt_base = round_up(efi_virt_base, SZ_64K); | |
| 404 | + } | |
| 347 | 405 | |
| 348 | 406 | in->virt_addr = efi_virt_base + in->phys_addr - paddr; |
| 349 | 407 | efi_virt_base += size; |
| @@ -5,10 +5,6 @@ · 4 unmodified lines | ||
| 5 | 5 | /* error code which can't be mistaken for valid address */ |
| 6 | 6 | #define EFI_ERROR (~0UL) |
| 7 | 7 | |
| 8 | −#undef memcpy | |
| 9 | −#undef memset | |
| 10 | −#undef memmove | |
| 11 | − | |
| 12 | 8 | void efi_char16_printk(efi_system_table_t *, efi_char16_t *); |
| 13 | 9 | |
| 14 | 10 | efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg, void *__image, |
| @@ -0,0 +1,63 @@ | ||
| 1 | +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. | |
| 2 | + * | |
| 3 | + * This program is free software; you can redistribute it and/or modify | |
| 4 | + * it under the terms of the GNU General Public License version 2 and | |
| 5 | + * only version 2 as published by the Free Software Foundation. | |
| 6 | + * | |
| 7 | + * This program is distributed in the hope that it will be useful, | |
| 8 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 | + * GNU General Public License for more details. | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#include <linux/io.h> | |
| 14 | +#include <linux/errno.h> | |
| 15 | +#include <linux/qcom_scm.h> | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus | |
| 19 | + * @entry: Entry point function for the cpus | |
| 20 | + * @cpus: The cpumask of cpus that will use the entry point | |
| 21 | + * | |
| 22 | + * Set the cold boot address of the cpus. Any cpu outside the supported | |
| 23 | + * range would be removed from the cpu present mask. | |
| 24 | + */ | |
| 25 | +int __qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus) | |
| 26 | +{ | |
| 27 | + return -ENOTSUPP; | |
| 28 | +} | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus | |
| 32 | + * @entry: Entry point function for the cpus | |
| 33 | + * @cpus: The cpumask of cpus that will use the entry point | |
| 34 | + * | |
| 35 | + * Set the Linux entry point for the SCM to transfer control to when coming | |
| 36 | + * out of a power down. CPU power down may be executed on cpuidle or hotplug. | |
| 37 | + */ | |
| 38 | +int __qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus) | |
| 39 | +{ | |
| 40 | + return -ENOTSUPP; | |
| 41 | +} | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * qcom_scm_cpu_power_down() - Power down the cpu | |
| 45 | + * @flags - Flags to flush cache | |
| 46 | + * | |
| 47 | + * This is an end point to power down cpu. If there was a pending interrupt, | |
| 48 | + * the control would return from this function, otherwise, the cpu jumps to the | |
| 49 | + * warm boot entry point set for this cpu upon reset. | |
| 50 | + */ | |
| 51 | +void __qcom_scm_cpu_power_down(u32 flags) | |
| 52 | +{ | |
| 53 | +} | |
| 54 | + | |
| 55 | +int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id) | |
| 56 | +{ | |
| 57 | + return -ENOTSUPP; | |
| 58 | +} | |
| 59 | + | |
| 60 | +int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) | |
| 61 | +{ | |
| 62 | + return -ENOTSUPP; | |
| 63 | +} | |
| @@ -82,6 +82,7 @@ extern int amdgpu_vm_block_size; · 81 unmodified lines | ||
| 82 | 82 | extern int amdgpu_enable_scheduler; |
| 83 | 83 | extern int amdgpu_sched_jobs; |
| 84 | 84 | extern int amdgpu_sched_hw_submission; |
| 85 | +extern int amdgpu_enable_semaphores; | |
| 85 | 86 | |
| 86 | 87 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 |
| 87 | 88 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
| @@ -432,7 +433,7 @@ int amdgpu_fence_driver_init(struct amdgpu_device *adev); · 344 unmodified lines | ||
| 432 | 433 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev); |
| 433 | 434 | void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); |
| 434 | 435 | |
| 435 | −void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring); | |
| 436 | +int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring); | |
| 436 | 437 | int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, |
| 437 | 438 | struct amdgpu_irq_src *irq_src, |
| 438 | 439 | unsigned irq_type); |
| @@ -890,7 +891,7 @@ struct amdgpu_ring { · 451 unmodified lines | ||
| 890 | 891 | struct amdgpu_device *adev; |
| 891 | 892 | const struct amdgpu_ring_funcs *funcs; |
| 892 | 893 | struct amdgpu_fence_driver fence_drv; |
| 893 | − struct amd_gpu_scheduler *scheduler; | |
| 894 | + struct amd_gpu_scheduler sched; | |
| 894 | 895 | |
| 895 | 896 | spinlock_t fence_lock; |
| 896 | 897 | struct mutex *ring_lock; |
| @@ -1201,8 +1202,6 @@ struct amdgpu_gfx { · 304 unmodified lines | ||
| 1201 | 1202 | struct amdgpu_irq_src priv_inst_irq; |
| 1202 | 1203 | /* gfx status */ |
| 1203 | 1204 | uint32_t gfx_current_status; |
| 1204 | − /* sync signal for const engine */ | |
| 1205 | − unsigned ce_sync_offs; | |
| 1206 | 1205 | /* ce ram size*/ |
| 1207 | 1206 | unsigned ce_ram_size; |
| 1208 | 1207 | }; |
| @@ -1274,8 +1273,10 @@ struct amdgpu_job { · 65 unmodified lines | ||
| 1274 | 1273 | uint32_t num_ibs; |
| 1275 | 1274 | struct mutex job_lock; |
| 1276 | 1275 | struct amdgpu_user_fence uf; |
| 1277 | − int (*free_job)(struct amdgpu_job *sched_job); | |
| 1276 | + int (*free_job)(struct amdgpu_job *job); | |
| 1278 | 1277 | }; |
| 1278 | +#define to_amdgpu_job(sched_job) \ | |
| 1279 | + container_of((sched_job), struct amdgpu_job, base) | |
| 1279 | 1280 | |
| 1280 | 1281 | static inline u32 amdgpu_get_ib_value(struct amdgpu_cs_parser *p, uint32_t ib_idx, int idx) |
| 1281 | 1282 | { |
| @@ -183,7 +183,7 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, · 182 unmodified lines | ||
| 183 | 183 | return -ENOMEM; |
| 184 | 184 | |
| 185 | 185 | r = amdgpu_bo_create(rdev, size, PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_GTT, |
| 186 | − AMDGPU_GEM_CREATE_CPU_GTT_USWC, NULL, &(*mem)->bo); | |
| 186 | + AMDGPU_GEM_CREATE_CPU_GTT_USWC, NULL, NULL, &(*mem)->bo); | |
| 187 | 187 | if (r) { |
| 188 | 188 | dev_err(rdev->dev, |
| 189 | 189 | "failed to allocate BO for amdkfd (%d)\n", r); |
| @@ -79,7 +79,8 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, · 78 unmodified lines | ||
| 79 | 79 | int time; |
| 80 | 80 | |
| 81 | 81 | n = AMDGPU_BENCHMARK_ITERATIONS; |
| 82 | − r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, sdomain, 0, NULL, &sobj); | |
| 82 | + r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, sdomain, 0, NULL, | |
| 83 | + NULL, &sobj); | |
| 83 | 84 | if (r) { |
| 84 | 85 | goto out_cleanup; |
| 85 | 86 | } |
| @@ -91,7 +92,8 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, · 5 unmodified lines | ||
| 91 | 92 | if (r) { |
| 92 | 93 | goto out_cleanup; |
| 93 | 94 | } |
| 94 | − r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, ddomain, 0, NULL, &dobj); | |
| 95 | + r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, ddomain, 0, NULL, | |
| 96 | + NULL, &dobj); | |
| 95 | 97 | if (r) { |
| 96 | 98 | goto out_cleanup; |
| 97 | 99 | } |
| @@ -86,7 +86,7 @@ static int amdgpu_cgs_gmap_kmem(void *cgs_device, void *kmem, · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | struct sg_table *sg = drm_prime_pages_to_sg(&kmem_page, npages); |
| 88 | 88 | ret = amdgpu_bo_create(adev, size, PAGE_SIZE, false, |
| 89 | − AMDGPU_GEM_DOMAIN_GTT, 0, sg, &bo); | |
| 89 | + AMDGPU_GEM_DOMAIN_GTT, 0, sg, NULL, &bo); | |
| 90 | 90 | if (ret) |
| 91 | 91 | return ret; |
| 92 | 92 | ret = amdgpu_bo_reserve(bo, false); |
| @@ -197,7 +197,8 @@ static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device, · 104 unmodified lines | ||
| 197 | 197 | |
| 198 | 198 | ret = amdgpu_bo_create_restricted(adev, size, PAGE_SIZE, |
| 199 | 199 | true, domain, flags, |
| 200 | − NULL, &placement, &obj); | |
| 200 | + NULL, &placement, NULL, | |
| 201 | + &obj); | |
| 201 | 202 | if (ret) { |
| 202 | 203 | DRM_ERROR("(%d) bo create failed\n", ret); |
| 203 | 204 | return ret; |
| @@ -207,44 +208,6 @@ static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device, · 3 unmodified lines | ||
| 207 | 208 | return ret; |
| 208 | 209 | } |
| 209 | 210 | |
| 210 | −static int amdgpu_cgs_import_gpu_mem(void *cgs_device, int dmabuf_fd, | |
| 211 | − cgs_handle_t *handle) | |
| 212 | −{ | |
| 213 | − CGS_FUNC_ADEV; | |
| 214 | − int r; | |
| 215 | − uint32_t dma_handle; | |
| 216 | − struct drm_gem_object *obj; | |
| 217 | − struct amdgpu_bo *bo; | |
| 218 | − struct drm_device *dev = adev->ddev; | |
| 219 | − struct drm_file *file_priv = NULL, *priv; | |
| 220 | − | |
| 221 | − mutex_lock(&dev->struct_mutex); | |
| 222 | − list_for_each_entry(priv, &dev->filelist, lhead) { | |
| 223 | − rcu_read_lock(); | |
| 224 | − if (priv->pid == get_pid(task_pid(current))) | |
| 225 | − file_priv = priv; | |
| 226 | − rcu_read_unlock(); | |
| 227 | − if (file_priv) | |
| 228 | − break; | |
| 229 | − } | |
| 230 | − mutex_unlock(&dev->struct_mutex); | |
| 231 | − r = dev->driver->prime_fd_to_handle(dev, | |
| 232 | − file_priv, dmabuf_fd, | |
| 233 | − &dma_handle); | |
| 234 | − spin_lock(&file_priv->table_lock); | |
| 235 | − | |
| 236 | − /* Check if we currently have a reference on the object */ | |
| 237 | − obj = idr_find(&file_priv->object_idr, dma_handle); | |
| 238 | − if (obj == NULL) { | |
| 239 | − spin_unlock(&file_priv->table_lock); | |
| 240 | − return -EINVAL; | |
| 241 | − } | |
| 242 | − spin_unlock(&file_priv->table_lock); | |
| 243 | − bo = gem_to_amdgpu_bo(obj); | |
| 244 | − *handle = (cgs_handle_t)bo; | |
| 245 | − return 0; | |
| 246 | −} | |
| 247 | − | |
| 248 | 211 | static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle) |
| 249 | 212 | { |
| 250 | 213 | struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; |
| @@ -809,7 +772,6 @@ static const struct cgs_ops amdgpu_cgs_ops = { · 558 unmodified lines | ||
| 809 | 772 | }; |
| 810 | 773 | |
| 811 | 774 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { |
| 812 | − amdgpu_cgs_import_gpu_mem, | |
| 813 | 775 | amdgpu_cgs_add_irq_source, |
| 814 | 776 | amdgpu_cgs_irq_get, |
| 815 | 777 | amdgpu_cgs_irq_put |
| @@ -154,42 +154,42 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 153 unmodified lines | ||
| 154 | 154 | { |
| 155 | 155 | union drm_amdgpu_cs *cs = data; |
| 156 | 156 | uint64_t *chunk_array_user; |
| 157 | − uint64_t *chunk_array = NULL; | |
| 157 | + uint64_t *chunk_array; | |
| 158 | 158 | struct amdgpu_fpriv *fpriv = p->filp->driver_priv; |
| 159 | − unsigned size, i; | |
| 160 | − int r = 0; | |
| 159 | + unsigned size; | |
| 160 | + int i; | |
| 161 | + int ret; | |
| 161 | 162 | |
| 162 | − if (!cs->in.num_chunks) | |
| 163 | − goto out; | |
| 163 | + if (cs->in.num_chunks == 0) | |
| 164 | + return 0; | |
| 165 | + | |
| 166 | + chunk_array = kmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL); | |
| 167 | + if (!chunk_array) | |
| 168 | + return -ENOMEM; | |
| 164 | 169 | |
| 165 | 170 | p->ctx = amdgpu_ctx_get(fpriv, cs->in.ctx_id); |
| 166 | 171 | if (!p->ctx) { |
| 167 | − r = -EINVAL; | |
| 168 | − goto out; | |
| 172 | + ret = -EINVAL; | |
| 173 | + goto free_chunk; | |
| 169 | 174 | } |
| 175 | + | |
| 170 | 176 | p->bo_list = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle); |
| 171 | 177 | |
| 172 | 178 | /* get chunks */ |
| 173 | 179 | INIT_LIST_HEAD(&p->validated); |
| 174 | − chunk_array = kmalloc_array(cs->in.num_chunks, sizeof(uint64_t), GFP_KERNEL); | |
| 175 | − if (chunk_array == NULL) { | |
| 176 | − r = -ENOMEM; | |
| 177 | − goto out; | |
| 178 | − } | |
| 179 | − | |
| 180 | 180 | chunk_array_user = (uint64_t __user *)(cs->in.chunks); |
| 181 | 181 | if (copy_from_user(chunk_array, chunk_array_user, |
| 182 | 182 | sizeof(uint64_t)*cs->in.num_chunks)) { |
| 183 | − r = -EFAULT; | |
| 184 | − goto out; | |
| 183 | + ret = -EFAULT; | |
| 184 | + goto put_bo_list; | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | p->nchunks = cs->in.num_chunks; |
| 188 | 188 | p->chunks = kmalloc_array(p->nchunks, sizeof(struct amdgpu_cs_chunk), |
| 189 | 189 | GFP_KERNEL); |
| 190 | − if (p->chunks == NULL) { | |
| 191 | − r = -ENOMEM; | |
| 192 | − goto out; | |
| 190 | + if (!p->chunks) { | |
| 191 | + ret = -ENOMEM; | |
| 192 | + goto put_bo_list; | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | for (i = 0; i < p->nchunks; i++) { |
| @@ -200,8 +200,9 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 4 unmodified lines | ||
| 200 | 200 | chunk_ptr = (void __user *)chunk_array[i]; |
| 201 | 201 | if (copy_from_user(&user_chunk, chunk_ptr, |
| 202 | 202 | sizeof(struct drm_amdgpu_cs_chunk))) { |
| 203 | − r = -EFAULT; | |
| 204 | − goto out; | |
| 203 | + ret = -EFAULT; | |
| 204 | + i--; | |
| 205 | + goto free_partial_kdata; | |
| 205 | 206 | } |
| 206 | 207 | p->chunks[i].chunk_id = user_chunk.chunk_id; |
| 207 | 208 | p->chunks[i].length_dw = user_chunk.length_dw; |
| @@ -212,13 +213,14 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 4 unmodified lines | ||
| 212 | 213 | |
| 213 | 214 | p->chunks[i].kdata = drm_malloc_ab(size, sizeof(uint32_t)); |
| 214 | 215 | if (p->chunks[i].kdata == NULL) { |
| 215 | − r = -ENOMEM; | |
| 216 | − goto out; | |
| 216 | + ret = -ENOMEM; | |
| 217 | + i--; | |
| 218 | + goto free_partial_kdata; | |
| 217 | 219 | } |
| 218 | 220 | size *= sizeof(uint32_t); |
| 219 | 221 | if (copy_from_user(p->chunks[i].kdata, cdata, size)) { |
| 220 | − r = -EFAULT; | |
| 221 | − goto out; | |
| 222 | + ret = -EFAULT; | |
| 223 | + goto free_partial_kdata; | |
| 222 | 224 | } |
| 223 | 225 | |
| 224 | 226 | switch (p->chunks[i].chunk_id) { |
| @@ -238,15 +240,15 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 13 unmodified lines | ||
| 238 | 240 | gobj = drm_gem_object_lookup(p->adev->ddev, |
| 239 | 241 | p->filp, handle); |
| 240 | 242 | if (gobj == NULL) { |
| 241 | − r = -EINVAL; | |
| 242 | − goto out; | |
| 243 | + ret = -EINVAL; | |
| 244 | + goto free_partial_kdata; | |
| 243 | 245 | } |
| 244 | 246 | |
| 245 | 247 | p->uf.bo = gem_to_amdgpu_bo(gobj); |
| 246 | 248 | p->uf.offset = fence_data->offset; |
| 247 | 249 | } else { |
| 248 | − r = -EINVAL; | |
| 249 | − goto out; | |
| 250 | + ret = -EINVAL; | |
| 251 | + goto free_partial_kdata; | |
| 250 | 252 | } |
| 251 | 253 | break; |
| 252 | 254 | |
| @@ -254,19 +256,35 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) · 1 unmodified line | ||
| 254 | 256 | break; |
| 255 | 257 | |
| 256 | 258 | default: |
| 257 | − r = -EINVAL; | |
| 258 | − goto out; | |
| 259 | + ret = -EINVAL; | |
| 260 | + goto free_partial_kdata; | |
| 259 | 261 | } |
| 260 | 262 | } |
| 261 | 263 | |
| 262 | 264 | |
| 263 | 265 | p->ibs = kcalloc(p->num_ibs, sizeof(struct amdgpu_ib), GFP_KERNEL); |
| 264 | − if (!p->ibs) | |
| 265 | − r = -ENOMEM; | |
| 266 | + if (!p->ibs) { | |
| 267 | + ret = -ENOMEM; | |
| 268 | + goto free_all_kdata; | |
| 269 | + } | |
| 266 | 270 | |
| 267 | −out: | |
| 268 | 271 | kfree(chunk_array); |
| 269 | − return r; | |
| 272 | + return 0; | |
| 273 | + | |
| 274 | +free_all_kdata: | |
| 275 | + i = p->nchunks - 1; | |
| 276 | +free_partial_kdata: | |
| 277 | + for (; i >= 0; i--) | |
| 278 | + drm_free_large(p->chunks[i].kdata); | |
| 279 | + kfree(p->chunks); | |
| 280 | +put_bo_list: | |
| 281 | + if (p->bo_list) | |
| 282 | + amdgpu_bo_list_put(p->bo_list); | |
| 283 | + amdgpu_ctx_put(p->ctx); | |
| 284 | +free_chunk: | |
| 285 | + kfree(chunk_array); | |
| 286 | + | |
| 287 | + return ret; | |
| 270 | 288 | } |
| 271 | 289 | |
| 272 | 290 | /* Returns how many bytes TTM can move per IB. |
| @@ -321,25 +339,17 @@ static u64 amdgpu_cs_get_threshold_for_moves(struct amdgpu_device *adev) · 48 unmodified lines | ||
| 321 | 339 | return max(bytes_moved_threshold, 1024*1024ull); |
| 322 | 340 | } |
| 323 | 341 | |
| 324 | −int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p) | |
| 342 | +int amdgpu_cs_list_validate(struct amdgpu_device *adev, | |
| 343 | + struct amdgpu_vm *vm, | |
| 344 | + struct list_head *validated) | |
| 325 | 345 | { |
| 326 | − struct amdgpu_fpriv *fpriv = p->filp->driver_priv; | |
| 327 | − struct amdgpu_vm *vm = &fpriv->vm; | |
| 328 | − struct amdgpu_device *adev = p->adev; | |
| 329 | 346 | struct amdgpu_bo_list_entry *lobj; |
| 330 | − struct list_head duplicates; | |
| 331 | 347 | struct amdgpu_bo *bo; |
| 332 | 348 | u64 bytes_moved = 0, initial_bytes_moved; |
| 333 | 349 | u64 bytes_moved_threshold = amdgpu_cs_get_threshold_for_moves(adev); |
| 334 | 350 | int r; |
| 335 | 351 | |
| 336 | − INIT_LIST_HEAD(&duplicates); | |
| 337 | − r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates); | |
| 338 | − if (unlikely(r != 0)) { | |
| 339 | − return r; | |
| 340 | − } | |
| 341 | − | |
| 342 | − list_for_each_entry(lobj, &p->validated, tv.head) { | |
| 352 | + list_for_each_entry(lobj, validated, tv.head) { | |
| 343 | 353 | bo = lobj->robj; |
| 344 | 354 | if (!bo->pin_count) { |
| 345 | 355 | u32 domain = lobj->prefered_domains; |
| @@ -373,7 +383,6 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p) · 27 unmodified lines | ||
| 373 | 383 | domain = lobj->allowed_domains; |
| 374 | 384 | goto retry; |
| 375 | 385 | } |
| 376 | − ttm_eu_backoff_reservation(&p->ticket, &p->validated); | |
| 377 | 386 | return r; |
| 378 | 387 | } |
| 379 | 388 | } |
| @@ -386,6 +395,7 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p) · 6 unmodified lines | ||
| 386 | 395 | { |
| 387 | 396 | struct amdgpu_fpriv *fpriv = p->filp->driver_priv; |
| 388 | 397 | struct amdgpu_cs_buckets buckets; |
| 398 | + struct list_head duplicates; | |
| 389 | 399 | bool need_mmap_lock = false; |
| 390 | 400 | int i, r; |
| 391 | 401 | |
| @@ -405,8 +415,22 @@ static int amdgpu_cs_parser_relocs(struct amdgpu_cs_parser *p) · 13 unmodified lines | ||
| 405 | 415 | if (need_mmap_lock) |
| 406 | 416 | down_read(¤t->mm->mmap_sem); |
| 407 | 417 | |
| 408 | − r = amdgpu_cs_list_validate(p); | |
| 418 | + INIT_LIST_HEAD(&duplicates); | |
| 419 | + r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, &duplicates); | |
| 420 | + if (unlikely(r != 0)) | |
| 421 | + goto error_reserve; | |
| 422 | + | |
| 423 | + r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &p->validated); | |
| 424 | + if (r) | |
| 425 | + goto error_validate; | |
| 426 | + | |
| 427 | + r = amdgpu_cs_list_validate(p->adev, &fpriv->vm, &duplicates); | |
| 428 | + | |
| 429 | +error_validate: | |
| 430 | + if (r) | |
| 431 | + ttm_eu_backoff_reservation(&p->ticket, &p->validated); | |
| 409 | 432 | |
| 433 | +error_reserve: | |
| 410 | 434 | if (need_mmap_lock) |
| 411 | 435 | up_read(¤t->mm->mmap_sem); |
| 412 | 436 | |
| @@ -772,15 +796,15 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, · 359 unmodified lines | ||
| 772 | 796 | return 0; |
| 773 | 797 | } |
| 774 | 798 | |
| 775 | −static int amdgpu_cs_free_job(struct amdgpu_job *sched_job) | |
| 799 | +static int amdgpu_cs_free_job(struct amdgpu_job *job) | |
| 776 | 800 | { |
| 777 | 801 | int i; |
| 778 | − if (sched_job->ibs) | |
| 779 | − for (i = 0; i < sched_job->num_ibs; i++) | |
| 780 | − amdgpu_ib_free(sched_job->adev, &sched_job->ibs[i]); | |
| 781 | − kfree(sched_job->ibs); | |
| 782 | − if (sched_job->uf.bo) | |
| 783 | − drm_gem_object_unreference_unlocked(&sched_job->uf.bo->gem_base); | |
| 802 | + if (job->ibs) | |
| 803 | + for (i = 0; i < job->num_ibs; i++) | |
| 804 | + amdgpu_ib_free(job->adev, &job->ibs[i]); | |
| 805 | + kfree(job->ibs); | |
| 806 | + if (job->uf.bo) | |
| 807 | + drm_gem_object_unreference_unlocked(&job->uf.bo->gem_base); | |
| 784 | 808 | return 0; |
| 785 | 809 | } |
| 786 | 810 | |
| @@ -804,7 +828,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 17 unmodified lines | ||
| 804 | 828 | r = amdgpu_cs_parser_init(parser, data); |
| 805 | 829 | if (r) { |
| 806 | 830 | DRM_ERROR("Failed to initialize parser !\n"); |
| 807 | − amdgpu_cs_parser_fini(parser, r, false); | |
| 831 | + kfree(parser); | |
| 808 | 832 | up_read(&adev->exclusive_lock); |
| 809 | 833 | r = amdgpu_cs_handle_lockup(adev, r); |
| 810 | 834 | return r; |
| @@ -842,7 +866,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 31 unmodified lines | ||
| 842 | 866 | job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL); |
| 843 | 867 | if (!job) |
| 844 | 868 | return -ENOMEM; |
| 845 | − job->base.sched = ring->scheduler; | |
| 869 | + job->base.sched = &ring->sched; | |
| 846 | 870 | job->base.s_entity = &parser->ctx->rings[ring->idx].entity; |
| 847 | 871 | job->adev = parser->adev; |
| 848 | 872 | job->ibs = parser->ibs; |
| @@ -857,7 +881,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 8 unmodified lines | ||
| 857 | 881 | |
| 858 | 882 | job->free_job = amdgpu_cs_free_job; |
| 859 | 883 | mutex_lock(&job->job_lock); |
| 860 | − r = amd_sched_entity_push_job((struct amd_sched_job *)job); | |
| 884 | + r = amd_sched_entity_push_job(&job->base); | |
| 861 | 885 | if (r) { |
| 862 | 886 | mutex_unlock(&job->job_lock); |
| 863 | 887 | amdgpu_cs_free_job(job); |
| @@ -43,10 +43,10 @@ int amdgpu_ctx_init(struct amdgpu_device *adev, bool kernel, · 42 unmodified lines | ||
| 43 | 43 | for (i = 0; i < adev->num_rings; i++) { |
| 44 | 44 | struct amd_sched_rq *rq; |
| 45 | 45 | if (kernel) |
| 46 | − rq = &adev->rings[i]->scheduler->kernel_rq; | |
| 46 | + rq = &adev->rings[i]->sched.kernel_rq; | |
| 47 | 47 | else |
| 48 | − rq = &adev->rings[i]->scheduler->sched_rq; | |
| 49 | − r = amd_sched_entity_init(adev->rings[i]->scheduler, | |
| 48 | + rq = &adev->rings[i]->sched.sched_rq; | |
| 49 | + r = amd_sched_entity_init(&adev->rings[i]->sched, | |
| 50 | 50 | &ctx->rings[i].entity, |
| 51 | 51 | rq, amdgpu_sched_jobs); |
| 52 | 52 | if (r) |
| @@ -55,7 +55,7 @@ int amdgpu_ctx_init(struct amdgpu_device *adev, bool kernel, · 2 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | if (i < adev->num_rings) { |
| 57 | 57 | for (j = 0; j < i; j++) |
| 58 | − amd_sched_entity_fini(adev->rings[j]->scheduler, | |
| 58 | + amd_sched_entity_fini(&adev->rings[j]->sched, | |
| 59 | 59 | &ctx->rings[j].entity); |
| 60 | 60 | kfree(ctx); |
| 61 | 61 | return r; |
| @@ -75,7 +75,7 @@ void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) · 13 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | if (amdgpu_enable_scheduler) { |
| 77 | 77 | for (i = 0; i < adev->num_rings; i++) |
| 78 | − amd_sched_entity_fini(adev->rings[i]->scheduler, | |
| 78 | + amd_sched_entity_fini(&adev->rings[i]->sched, | |
| 79 | 79 | &ctx->rings[i].entity); |
| 80 | 80 | } |
| 81 | 81 | } |
| @@ -246,7 +246,7 @@ static int amdgpu_vram_scratch_init(struct amdgpu_device *adev) · 245 unmodified lines | ||
| 246 | 246 | r = amdgpu_bo_create(adev, AMDGPU_GPU_PAGE_SIZE, |
| 247 | 247 | PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, |
| 248 | 248 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 249 | − NULL, &adev->vram_scratch.robj); | |
| 249 | + NULL, NULL, &adev->vram_scratch.robj); | |
| 250 | 250 | if (r) { |
| 251 | 251 | return r; |
| 252 | 252 | } |
| @@ -449,7 +449,8 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) · 196 unmodified lines | ||
| 449 | 449 | |
| 450 | 450 | if (adev->wb.wb_obj == NULL) { |
| 451 | 451 | r = amdgpu_bo_create(adev, AMDGPU_MAX_WB * 4, PAGE_SIZE, true, |
| 452 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, &adev->wb.wb_obj); | |
| 452 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 453 | + &adev->wb.wb_obj); | |
| 453 | 454 | if (r) { |
| 454 | 455 | dev_warn(adev->dev, "(%d) create WB bo failed\n", r); |
| 455 | 456 | return r; |
| @@ -1650,9 +1651,11 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) · 1194 unmodified lines | ||
| 1650 | 1651 | drm_kms_helper_poll_disable(dev); |
| 1651 | 1652 | |
| 1652 | 1653 | /* turn off display hw */ |
| 1654 | + drm_modeset_lock_all(dev); | |
| 1653 | 1655 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1654 | 1656 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
| 1655 | 1657 | } |
| 1658 | + drm_modeset_unlock_all(dev); | |
| 1656 | 1659 | |
| 1657 | 1660 | /* unpin the front buffers */ |
| 1658 | 1661 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| @@ -1747,9 +1750,11 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon) · 88 unmodified lines | ||
| 1747 | 1750 | if (fbcon) { |
| 1748 | 1751 | drm_helper_resume_force_mode(dev); |
| 1749 | 1752 | /* turn on display hw */ |
| 1753 | + drm_modeset_lock_all(dev); | |
| 1750 | 1754 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1751 | 1755 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
| 1752 | 1756 | } |
| 1757 | + drm_modeset_unlock_all(dev); | |
| 1753 | 1758 | } |
| 1754 | 1759 | |
| 1755 | 1760 | drm_kms_helper_poll_enable(dev); |
| @@ -79,6 +79,7 @@ int amdgpu_exp_hw_support = 0; · 78 unmodified lines | ||
| 79 | 79 | int amdgpu_enable_scheduler = 0; |
| 80 | 80 | int amdgpu_sched_jobs = 16; |
| 81 | 81 | int amdgpu_sched_hw_submission = 2; |
| 82 | +int amdgpu_enable_semaphores = 1; | |
| 82 | 83 | |
| 83 | 84 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
| 84 | 85 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); |
| @@ -152,6 +153,9 @@ module_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444); · 67 unmodified lines | ||
| 152 | 153 | MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default 2)"); |
| 153 | 154 | module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444); |
| 154 | 155 | |
| 156 | +MODULE_PARM_DESC(enable_semaphores, "Enable semaphores (1 = enable (default), 0 = disable)"); | |
| 157 | +module_param_named(enable_semaphores, amdgpu_enable_semaphores, int, 0644); | |
| 158 | + | |
| 155 | 159 | static struct pci_device_id pciidlist[] = { |
| 156 | 160 | #ifdef CONFIG_DRM_AMDGPU_CIK |
| 157 | 161 | /* Kaveri */ |
| @@ -609,9 +609,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, · 608 unmodified lines | ||
| 609 | 609 | * Init the fence driver for the requested ring (all asics). |
| 610 | 610 | * Helper function for amdgpu_fence_driver_init(). |
| 611 | 611 | */ |
| 612 | −void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) | |
| 612 | +int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) | |
| 613 | 613 | { |
| 614 | − int i; | |
| 614 | + int i, r; | |
| 615 | 615 | |
| 616 | 616 | ring->fence_drv.cpu_addr = NULL; |
| 617 | 617 | ring->fence_drv.gpu_addr = 0; |
| @@ -625,15 +625,19 @@ void amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) · 7 unmodified lines | ||
| 625 | 625 | amdgpu_fence_check_lockup); |
| 626 | 626 | ring->fence_drv.ring = ring; |
| 627 | 627 | |
| 628 | + init_waitqueue_head(&ring->fence_drv.fence_queue); | |
| 629 | + | |
| 628 | 630 | if (amdgpu_enable_scheduler) { |
| 629 | − ring->scheduler = amd_sched_create(&amdgpu_sched_ops, | |
| 630 | − ring->idx, | |
| 631 | − amdgpu_sched_hw_submission, | |
| 632 | − (void *)ring->adev); | |
| 633 | − if (!ring->scheduler) | |
| 634 | − DRM_ERROR("Failed to create scheduler on ring %d.\n", | |
| 635 | − ring->idx); | |
| 631 | + r = amd_sched_init(&ring->sched, &amdgpu_sched_ops, | |
| 632 | + amdgpu_sched_hw_submission, ring->name); | |
| 633 | + if (r) { | |
| 634 | + DRM_ERROR("Failed to create scheduler on ring %s.\n", | |
| 635 | + ring->name); | |
| 636 | + return r; | |
| 637 | + } | |
| 636 | 638 | } |
| 639 | + | |
| 640 | + return 0; | |
| 637 | 641 | } |
| 638 | 642 | |
| 639 | 643 | /** |
| @@ -681,8 +685,7 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) · 41 unmodified lines | ||
| 681 | 685 | wake_up_all(&ring->fence_drv.fence_queue); |
| 682 | 686 | amdgpu_irq_put(adev, ring->fence_drv.irq_src, |
| 683 | 687 | ring->fence_drv.irq_type); |
| 684 | − if (ring->scheduler) | |
| 685 | − amd_sched_destroy(ring->scheduler); | |
| 688 | + amd_sched_fini(&ring->sched); | |
| 686 | 689 | ring->fence_drv.initialized = false; |
| 687 | 690 | } |
| 688 | 691 | mutex_unlock(&adev->ring_lock); |
| @@ -127,7 +127,7 @@ int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev) · 126 unmodified lines | ||
| 127 | 127 | r = amdgpu_bo_create(adev, adev->gart.table_size, |
| 128 | 128 | PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, |
| 129 | 129 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 130 | − NULL, &adev->gart.robj); | |
| 130 | + NULL, NULL, &adev->gart.robj); | |
| 131 | 131 | if (r) { |
| 132 | 132 | return r; |
| 133 | 133 | } |
| @@ -69,7 +69,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, · 68 unmodified lines | ||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | retry: |
| 72 | − r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain, flags, NULL, &robj); | |
| 72 | + r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain, | |
| 73 | + flags, NULL, NULL, &robj); | |
| 73 | 74 | if (r) { |
| 74 | 75 | if (r != -ERESTARTSYS) { |
| 75 | 76 | if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) { |
| @@ -426,6 +427,10 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, · 350 unmodified lines | ||
| 426 | 427 | &args->data.data_size_bytes, |
| 427 | 428 | &args->data.flags); |
| 428 | 429 | } else if (args->op == AMDGPU_GEM_METADATA_OP_SET_METADATA) { |
| 430 | + if (args->data.data_size_bytes > sizeof(args->data.data)) { | |
| 431 | + r = -EINVAL; | |
| 432 | + goto unreserve; | |
| 433 | + } | |
| 429 | 434 | r = amdgpu_bo_set_tiling_flags(robj, args->data.tiling_info); |
| 430 | 435 | if (!r) |
| 431 | 436 | r = amdgpu_bo_set_metadata(robj, args->data.data, |
| @@ -433,6 +438,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, · 1 unmodified line | ||
| 433 | 438 | args->data.flags); |
| 434 | 439 | } |
| 435 | 440 | |
| 441 | +unreserve: | |
| 436 | 442 | amdgpu_bo_unreserve(robj); |
| 437 | 443 | out: |
| 438 | 444 | drm_gem_object_unreference_unlocked(gobj); |
| @@ -454,11 +460,12 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 15 unmodified lines | ||
| 454 | 460 | struct ttm_validate_buffer tv, *entry; |
| 455 | 461 | struct amdgpu_bo_list_entry *vm_bos; |
| 456 | 462 | struct ww_acquire_ctx ticket; |
| 457 | − struct list_head list; | |
| 463 | + struct list_head list, duplicates; | |
| 458 | 464 | unsigned domain; |
| 459 | 465 | int r; |
| 460 | 466 | |
| 461 | 467 | INIT_LIST_HEAD(&list); |
| 468 | + INIT_LIST_HEAD(&duplicates); | |
| 462 | 469 | |
| 463 | 470 | tv.bo = &bo_va->bo->tbo; |
| 464 | 471 | tv.shared = true; |
| @@ -468,7 +475,8 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 3 unmodified lines | ||
| 468 | 475 | if (!vm_bos) |
| 469 | 476 | return; |
| 470 | 477 | |
| 471 | − r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL); | |
| 478 | + /* Provide duplicates to avoid -EALREADY */ | |
| 479 | + r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates); | |
| 472 | 480 | if (r) |
| 473 | 481 | goto error_free; |
| 474 | 482 | |
| @@ -651,7 +659,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, · 176 unmodified lines | ||
| 651 | 659 | int r; |
| 652 | 660 | |
| 653 | 661 | args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8); |
| 654 | − args->size = args->pitch * args->height; | |
| 662 | + args->size = (u64)args->pitch * args->height; | |
| 655 | 663 | args->size = ALIGN(args->size, PAGE_SIZE); |
| 656 | 664 | |
| 657 | 665 | r = amdgpu_gem_object_create(adev, args->size, 0, |
| @@ -43,7 +43,7 @@ static int amdgpu_ih_ring_alloc(struct amdgpu_device *adev) · 42 unmodified lines | ||
| 43 | 43 | r = amdgpu_bo_create(adev, adev->irq.ih.ring_size, |
| 44 | 44 | PAGE_SIZE, true, |
| 45 | 45 | AMDGPU_GEM_DOMAIN_GTT, 0, |
| 46 | − NULL, &adev->irq.ih.ring_obj); | |
| 46 | + NULL, NULL, &adev->irq.ih.ring_obj); | |
| 47 | 47 | if (r) { |
| 48 | 48 | DRM_ERROR("amdgpu: failed to create ih ring buffer (%d).\n", r); |
| 49 | 49 | return r; |
| @@ -140,7 +140,7 @@ void amdgpu_irq_preinstall(struct drm_device *dev) · 139 unmodified lines | ||
| 140 | 140 | */ |
| 141 | 141 | int amdgpu_irq_postinstall(struct drm_device *dev) |
| 142 | 142 | { |
| 143 | − dev->max_vblank_count = 0x001fffff; | |
| 143 | + dev->max_vblank_count = 0x00ffffff; | |
| 144 | 144 | return 0; |
| 145 | 145 | } |
| 146 | 146 | |
| @@ -390,7 +390,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 389 unmodified lines | ||
| 390 | 390 | min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0; |
| 391 | 391 | } |
| 392 | 392 | case AMDGPU_INFO_READ_MMR_REG: { |
| 393 | − unsigned n, alloc_size = info->read_mmr_reg.count * 4; | |
| 393 | + unsigned n, alloc_size; | |
| 394 | 394 | uint32_t *regs; |
| 395 | 395 | unsigned se_num = (info->read_mmr_reg.instance >> |
| 396 | 396 | AMDGPU_INFO_MMR_SE_INDEX_SHIFT) & |
| @@ -406,9 +406,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 9 unmodified lines | ||
| 406 | 406 | if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK) |
| 407 | 407 | sh_num = 0xffffffff; |
| 408 | 408 | |
| 409 | − regs = kmalloc(alloc_size, GFP_KERNEL); | |
| 409 | + regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), GFP_KERNEL); | |
| 410 | 410 | if (!regs) |
| 411 | 411 | return -ENOMEM; |
| 412 | + alloc_size = info->read_mmr_reg.count * sizeof(*regs); | |
| 412 | 413 | |
| 413 | 414 | for (i = 0; i < info->read_mmr_reg.count; i++) |
| 414 | 415 | if (amdgpu_asic_read_register(adev, se_num, sh_num, |
| @@ -215,6 +215,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, · 214 unmodified lines | ||
| 215 | 215 | bool kernel, u32 domain, u64 flags, |
| 216 | 216 | struct sg_table *sg, |
| 217 | 217 | struct ttm_placement *placement, |
| 218 | + struct reservation_object *resv, | |
| 218 | 219 | struct amdgpu_bo **bo_ptr) |
| 219 | 220 | { |
| 220 | 221 | struct amdgpu_bo *bo; |
| @@ -261,7 +262,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, · 40 unmodified lines | ||
| 261 | 262 | /* Kernel allocation are uninterruptible */ |
| 262 | 263 | r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, |
| 263 | 264 | &bo->placement, page_align, !kernel, NULL, |
| 264 | − acc_size, sg, NULL, &amdgpu_ttm_bo_destroy); | |
| 265 | + acc_size, sg, resv, &amdgpu_ttm_bo_destroy); | |
| 265 | 266 | if (unlikely(r != 0)) { |
| 266 | 267 | return r; |
| 267 | 268 | } |
| @@ -275,7 +276,9 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, · 7 unmodified lines | ||
| 275 | 276 | int amdgpu_bo_create(struct amdgpu_device *adev, |
| 276 | 277 | unsigned long size, int byte_align, |
| 277 | 278 | bool kernel, u32 domain, u64 flags, |
| 278 | − struct sg_table *sg, struct amdgpu_bo **bo_ptr) | |
| 279 | + struct sg_table *sg, | |
| 280 | + struct reservation_object *resv, | |
| 281 | + struct amdgpu_bo **bo_ptr) | |
| 279 | 282 | { |
| 280 | 283 | struct ttm_placement placement = {0}; |
| 281 | 284 | struct ttm_place placements[AMDGPU_GEM_DOMAIN_MAX + 1]; |
| @@ -286,11 +289,9 @@ int amdgpu_bo_create(struct amdgpu_device *adev, · 4 unmodified lines | ||
| 286 | 289 | amdgpu_ttm_placement_init(adev, &placement, |
| 287 | 290 | placements, domain, flags); |
| 288 | 291 | |
| 289 | − return amdgpu_bo_create_restricted(adev, size, byte_align, | |
| 290 | − kernel, domain, flags, | |
| 291 | − sg, | |
| 292 | − &placement, | |
| 293 | − bo_ptr); | |
| 292 | + return amdgpu_bo_create_restricted(adev, size, byte_align, kernel, | |
| 293 | + domain, flags, sg, &placement, | |
| 294 | + resv, bo_ptr); | |
| 294 | 295 | } |
| 295 | 296 | |
| 296 | 297 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr) |
| @@ -535,12 +536,10 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, · 238 unmodified lines | ||
| 535 | 536 | if (metadata == NULL) |
| 536 | 537 | return -EINVAL; |
| 537 | 538 | |
| 538 | − buffer = kzalloc(metadata_size, GFP_KERNEL); | |
| 539 | + buffer = kmemdup(metadata, metadata_size, GFP_KERNEL); | |
| 539 | 540 | if (buffer == NULL) |
| 540 | 541 | return -ENOMEM; |
| 541 | 542 | |
| 542 | − memcpy(buffer, metadata, metadata_size); | |
| 543 | − | |
| 544 | 543 | kfree(bo->metadata); |
| 545 | 544 | bo->metadata_flags = flags; |
| 546 | 545 | bo->metadata = buffer; |
| @@ -129,12 +129,14 @@ int amdgpu_bo_create(struct amdgpu_device *adev, · 128 unmodified lines | ||
| 129 | 129 | unsigned long size, int byte_align, |
| 130 | 130 | bool kernel, u32 domain, u64 flags, |
| 131 | 131 | struct sg_table *sg, |
| 132 | + struct reservation_object *resv, | |
| 132 | 133 | struct amdgpu_bo **bo_ptr); |
| 133 | 134 | int amdgpu_bo_create_restricted(struct amdgpu_device *adev, |
| 134 | 135 | unsigned long size, int byte_align, |
| 135 | 136 | bool kernel, u32 domain, u64 flags, |
| 136 | 137 | struct sg_table *sg, |
| 137 | 138 | struct ttm_placement *placement, |
| 139 | + struct reservation_object *resv, | |
| 138 | 140 | struct amdgpu_bo **bo_ptr); |
| 139 | 141 | int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr); |
| 140 | 142 | void amdgpu_bo_kunmap(struct amdgpu_bo *bo); |
| @@ -61,12 +61,15 @@ struct drm_gem_object *amdgpu_gem_prime_import_sg_table(struct drm_device *dev, · 60 unmodified lines | ||
| 61 | 61 | struct dma_buf_attachment *attach, |
| 62 | 62 | struct sg_table *sg) |
| 63 | 63 | { |
| 64 | + struct reservation_object *resv = attach->dmabuf->resv; | |
| 64 | 65 | struct amdgpu_device *adev = dev->dev_private; |
| 65 | 66 | struct amdgpu_bo *bo; |
| 66 | 67 | int ret; |
| 67 | 68 | |
| 69 | + ww_mutex_lock(&resv->lock, NULL); | |
| 68 | 70 | ret = amdgpu_bo_create(adev, attach->dmabuf->size, PAGE_SIZE, false, |
| 69 | − AMDGPU_GEM_DOMAIN_GTT, 0, sg, &bo); | |
| 71 | + AMDGPU_GEM_DOMAIN_GTT, 0, sg, resv, &bo); | |
| 72 | + ww_mutex_unlock(&resv->lock); | |
| 70 | 73 | if (ret) |
| 71 | 74 | return ERR_PTR(ret); |
| 72 | 75 | |
| @@ -357,11 +357,11 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, · 356 unmodified lines | ||
| 357 | 357 | ring->adev = adev; |
| 358 | 358 | ring->idx = adev->num_rings++; |
| 359 | 359 | adev->rings[ring->idx] = ring; |
| 360 | − amdgpu_fence_driver_init_ring(ring); | |
| 360 | + r = amdgpu_fence_driver_init_ring(ring); | |
| 361 | + if (r) | |
| 362 | + return r; | |
| 361 | 363 | } |
| 362 | 364 | |
| 363 | − init_waitqueue_head(&ring->fence_drv.fence_queue); | |
| 364 | − | |
| 365 | 365 | r = amdgpu_wb_get(adev, &ring->rptr_offs); |
| 366 | 366 | if (r) { |
| 367 | 367 | dev_err(adev->dev, "(%d) ring rptr_offs wb alloc failed\n", r); |
| @@ -407,7 +407,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, · 39 unmodified lines | ||
| 407 | 407 | if (ring->ring_obj == NULL) { |
| 408 | 408 | r = amdgpu_bo_create(adev, ring->ring_size, PAGE_SIZE, true, |
| 409 | 409 | AMDGPU_GEM_DOMAIN_GTT, 0, |
| 410 | − NULL, &ring->ring_obj); | |
| 410 | + NULL, NULL, &ring->ring_obj); | |
| 411 | 411 | if (r) { |
| 412 | 412 | dev_err(adev->dev, "(%d) ring create failed\n", r); |
| 413 | 413 | return r; |
| @@ -64,8 +64,8 @@ int amdgpu_sa_bo_manager_init(struct amdgpu_device *adev, · 63 unmodified lines | ||
| 64 | 64 | INIT_LIST_HEAD(&sa_manager->flist[i]); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | − r = amdgpu_bo_create(adev, size, align, true, | |
| 68 | − domain, 0, NULL, &sa_manager->bo); | |
| 67 | + r = amdgpu_bo_create(adev, size, align, true, domain, | |
| 68 | + 0, NULL, NULL, &sa_manager->bo); | |
| 69 | 69 | if (r) { |
| 70 | 70 | dev_err(adev->dev, "(%d) failed to allocate bo for manager\n", r); |
| 71 | 71 | return r; |
| @@ -145,8 +145,13 @@ static uint32_t amdgpu_sa_get_ring_from_fence(struct fence *f) · 73 unmodified lines | ||
| 145 | 145 | struct amd_sched_fence *s_fence; |
| 146 | 146 | |
| 147 | 147 | s_fence = to_amd_sched_fence(f); |
| 148 | − if (s_fence) | |
| 149 | − return s_fence->scheduler->ring_id; | |
| 148 | + if (s_fence) { | |
| 149 | + struct amdgpu_ring *ring; | |
| 150 | + | |
| 151 | + ring = container_of(s_fence->sched, struct amdgpu_ring, sched); | |
| 152 | + return ring->idx; | |
| 153 | + } | |
| 154 | + | |
| 150 | 155 | a_fence = to_amdgpu_fence(f); |
| 151 | 156 | if (a_fence) |
| 152 | 157 | return a_fence->ring->idx; |
| @@ -412,6 +417,26 @@ void amdgpu_sa_bo_free(struct amdgpu_device *adev, struct amdgpu_sa_bo **sa_bo, · 259 unmodified lines | ||
| 412 | 417 | } |
| 413 | 418 | |
| 414 | 419 | #if defined(CONFIG_DEBUG_FS) |
| 420 | + | |
| 421 | +static void amdgpu_sa_bo_dump_fence(struct fence *fence, struct seq_file *m) | |
| 422 | +{ | |
| 423 | + struct amdgpu_fence *a_fence = to_amdgpu_fence(fence); | |
| 424 | + struct amd_sched_fence *s_fence = to_amd_sched_fence(fence); | |
| 425 | + | |
| 426 | + if (a_fence) | |
| 427 | + seq_printf(m, " protected by 0x%016llx on ring %d", | |
| 428 | + a_fence->seq, a_fence->ring->idx); | |
| 429 | + | |
| 430 | + if (s_fence) { | |
| 431 | + struct amdgpu_ring *ring; | |
| 432 | + | |
| 433 | + | |
| 434 | + ring = container_of(s_fence->sched, struct amdgpu_ring, sched); | |
| 435 | + seq_printf(m, " protected by 0x%016x on ring %d", | |
| 436 | + s_fence->base.seqno, ring->idx); | |
| 437 | + } | |
| 438 | +} | |
| 439 | + | |
| 415 | 440 | void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, |
| 416 | 441 | struct seq_file *m) |
| 417 | 442 | { |
| @@ -428,18 +453,8 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, · 10 unmodified lines | ||
| 428 | 453 | } |
| 429 | 454 | seq_printf(m, "[0x%010llx 0x%010llx] size %8lld", |
| 430 | 455 | soffset, eoffset, eoffset - soffset); |
| 431 | − if (i->fence) { | |
| 432 | − struct amdgpu_fence *a_fence = to_amdgpu_fence(i->fence); | |
| 433 | − struct amd_sched_fence *s_fence = to_amd_sched_fence(i->fence); | |
| 434 | − if (a_fence) | |
| 435 | − seq_printf(m, " protected by 0x%016llx on ring %d", | |
| 436 | − a_fence->seq, a_fence->ring->idx); | |
| 437 | − if (s_fence) | |
| 438 | − seq_printf(m, " protected by 0x%016x on ring %d", | |
| 439 | − s_fence->base.seqno, | |
| 440 | − s_fence->scheduler->ring_id); | |
| 441 | − | |
| 442 | − } | |
| 456 | + if (i->fence) | |
| 457 | + amdgpu_sa_bo_dump_fence(i->fence, m); | |
| 443 | 458 | seq_printf(m, "\n"); |
| 444 | 459 | } |
| 445 | 460 | spin_unlock(&sa_manager->wq.lock); |
| @@ -27,63 +27,48 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <drm/drmP.h> |
| 28 | 28 | #include "amdgpu.h" |
| 29 | 29 | |
| 30 | −static struct fence *amdgpu_sched_dependency(struct amd_sched_job *job) | |
| 30 | +static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job) | |
| 31 | 31 | { |
| 32 | − struct amdgpu_job *sched_job = (struct amdgpu_job *)job; | |
| 33 | − return amdgpu_sync_get_fence(&sched_job->ibs->sync); | |
| 32 | + struct amdgpu_job *job = to_amdgpu_job(sched_job); | |
| 33 | + return amdgpu_sync_get_fence(&job->ibs->sync); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | −static struct fence *amdgpu_sched_run_job(struct amd_sched_job *job) | |
| 36 | +static struct fence *amdgpu_sched_run_job(struct amd_sched_job *sched_job) | |
| 37 | 37 | { |
| 38 | − struct amdgpu_job *sched_job; | |
| 39 | − struct amdgpu_fence *fence; | |
| 38 | + struct amdgpu_fence *fence = NULL; | |
| 39 | + struct amdgpu_job *job; | |
| 40 | 40 | int r; |
| 41 | 41 | |
| 42 | − if (!job) { | |
| 42 | + if (!sched_job) { | |
| 43 | 43 | DRM_ERROR("job is null\n"); |
| 44 | 44 | return NULL; |
| 45 | 45 | } |
| 46 | − sched_job = (struct amdgpu_job *)job; | |
| 47 | − mutex_lock(&sched_job->job_lock); | |
| 48 | − r = amdgpu_ib_schedule(sched_job->adev, | |
| 49 | − sched_job->num_ibs, | |
| 50 | − sched_job->ibs, | |
| 51 | − sched_job->base.owner); | |
| 52 | − if (r) | |
| 46 | + job = to_amdgpu_job(sched_job); | |
| 47 | + mutex_lock(&job->job_lock); | |
| 48 | + r = amdgpu_ib_schedule(job->adev, | |
| 49 | + job->num_ibs, | |
| 50 | + job->ibs, | |
| 51 | + job->base.owner); | |
| 52 | + if (r) { | |
| 53 | + DRM_ERROR("Error scheduling IBs (%d)\n", r); | |
| 53 | 54 | goto err; |
| 54 | − fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence); | |
| 55 | − | |
| 56 | − if (sched_job->free_job) | |
| 57 | − sched_job->free_job(sched_job); | |
| 55 | + } | |
| 58 | 56 | |
| 59 | − mutex_unlock(&sched_job->job_lock); | |
| 60 | − return &fence->base; | |
| 57 | + fence = amdgpu_fence_ref(job->ibs[job->num_ibs - 1].fence); | |
| 61 | 58 | |
| 62 | 59 | err: |
| 63 | − DRM_ERROR("Run job error\n"); | |
| 64 | − mutex_unlock(&sched_job->job_lock); | |
| 65 | − job->sched->ops->process_job(job); | |
| 66 | − return NULL; | |
| 67 | −} | |
| 60 | + if (job->free_job) | |
| 61 | + job->free_job(job); | |
| 68 | 62 | |
| 69 | −static void amdgpu_sched_process_job(struct amd_sched_job *job) | |
| 70 | −{ | |
| 71 | − struct amdgpu_job *sched_job; | |
| 72 | − | |
| 73 | − if (!job) { | |
| 74 | − DRM_ERROR("job is null\n"); | |
| 75 | − return; | |
| 76 | − } | |
| 77 | − sched_job = (struct amdgpu_job *)job; | |
| 78 | − /* after processing job, free memory */ | |
| 79 | − fence_put(&sched_job->base.s_fence->base); | |
| 80 | − kfree(sched_job); | |
| 63 | + mutex_unlock(&job->job_lock); | |
| 64 | + fence_put(&job->base.s_fence->base); | |
| 65 | + kfree(job); | |
| 66 | + return fence ? &fence->base : NULL; | |
| 81 | 67 | } |
| 82 | 68 | |
| 83 | 69 | struct amd_sched_backend_ops amdgpu_sched_ops = { |
| 84 | 70 | .dependency = amdgpu_sched_dependency, |
| 85 | 71 | .run_job = amdgpu_sched_run_job, |
| 86 | − .process_job = amdgpu_sched_process_job | |
| 87 | 72 | }; |
| 88 | 73 | |
| 89 | 74 | int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev, |
| @@ -100,7 +85,7 @@ int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev, · 10 unmodified lines | ||
| 100 | 85 | kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL); |
| 101 | 86 | if (!job) |
| 102 | 87 | return -ENOMEM; |
| 103 | − job->base.sched = ring->scheduler; | |
| 88 | + job->base.sched = &ring->sched; | |
| 104 | 89 | job->base.s_entity = &adev->kernel_ctx.rings[ring->idx].entity; |
| 105 | 90 | job->adev = adev; |
| 106 | 91 | job->ibs = ibs; |
| @@ -109,7 +94,7 @@ int amdgpu_sched_ib_submit_kernel_helper(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 109 | 94 | mutex_init(&job->job_lock); |
| 110 | 95 | job->free_job = free_job; |
| 111 | 96 | mutex_lock(&job->job_lock); |
| 112 | − r = amd_sched_entity_push_job((struct amd_sched_job *)job); | |
| 97 | + r = amd_sched_entity_push_job(&job->base); | |
| 113 | 98 | if (r) { |
| 114 | 99 | mutex_unlock(&job->job_lock); |
| 115 | 100 | kfree(job); |
| @@ -65,8 +65,14 @@ static bool amdgpu_sync_same_dev(struct amdgpu_device *adev, struct fence *f) · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | if (a_fence) |
| 67 | 67 | return a_fence->ring->adev == adev; |
| 68 | − if (s_fence) | |
| 69 | − return (struct amdgpu_device *)s_fence->scheduler->priv == adev; | |
| 68 | + | |
| 69 | + if (s_fence) { | |
| 70 | + struct amdgpu_ring *ring; | |
| 71 | + | |
| 72 | + ring = container_of(s_fence->sched, struct amdgpu_ring, sched); | |
| 73 | + return ring->adev == adev; | |
| 74 | + } | |
| 75 | + | |
| 70 | 76 | return false; |
| 71 | 77 | } |
| 72 | 78 | |
| @@ -251,6 +257,20 @@ int amdgpu_sync_wait(struct amdgpu_sync *sync) · 178 unmodified lines | ||
| 251 | 257 | fence_put(e->fence); |
| 252 | 258 | kfree(e); |
| 253 | 259 | } |
| 260 | + | |
| 261 | + if (amdgpu_enable_semaphores) | |
| 262 | + return 0; | |
| 263 | + | |
| 264 | + for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | |
| 265 | + struct amdgpu_fence *fence = sync->sync_to[i]; | |
| 266 | + if (!fence) | |
| 267 | + continue; | |
| 268 | + | |
| 269 | + r = fence_wait(&fence->base, false); | |
| 270 | + if (r) | |
| 271 | + return r; | |
| 272 | + } | |
| 273 | + | |
| 254 | 274 | return 0; |
| 255 | 275 | } |
| 256 | 276 | |
| @@ -285,7 +305,8 @@ int amdgpu_sync_rings(struct amdgpu_sync *sync, · 28 unmodified lines | ||
| 285 | 305 | return -EINVAL; |
| 286 | 306 | } |
| 287 | 307 | |
| 288 | − if (amdgpu_enable_scheduler || (count >= AMDGPU_NUM_SYNCS)) { | |
| 308 | + if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores || | |
| 309 | + (count >= AMDGPU_NUM_SYNCS)) { | |
| 289 | 310 | /* not enough room, wait manually */ |
| 290 | 311 | r = fence_wait(&fence->base, false); |
| 291 | 312 | if (r) |
| @@ -59,8 +59,9 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) · 58 unmodified lines | ||
| 59 | 59 | goto out_cleanup; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | − r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, 0, | |
| 63 | − NULL, &vram_obj); | |
| 62 | + r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, | |
| 63 | + AMDGPU_GEM_DOMAIN_VRAM, 0, | |
| 64 | + NULL, NULL, &vram_obj); | |
| 64 | 65 | if (r) { |
| 65 | 66 | DRM_ERROR("Failed to create VRAM object\n"); |
| 66 | 67 | goto out_cleanup; |
| @@ -80,7 +81,8 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) · 13 unmodified lines | ||
| 80 | 81 | struct fence *fence = NULL; |
| 81 | 82 | |
| 82 | 83 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, |
| 83 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, gtt_obj + i); | |
| 84 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, | |
| 85 | + NULL, gtt_obj + i); | |
| 84 | 86 | if (r) { |
| 85 | 87 | DRM_ERROR("Failed to create GTT object %d\n", i); |
| 86 | 88 | goto out_lclean; |
| @@ -861,7 +861,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) · 860 unmodified lines | ||
| 861 | 861 | r = amdgpu_bo_create(adev, 256 * 1024, PAGE_SIZE, true, |
| 862 | 862 | AMDGPU_GEM_DOMAIN_VRAM, |
| 863 | 863 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 864 | − NULL, &adev->stollen_vga_memory); | |
| 864 | + NULL, NULL, &adev->stollen_vga_memory); | |
| 865 | 865 | if (r) { |
| 866 | 866 | return r; |
| 867 | 867 | } |
| @@ -247,7 +247,7 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev) · 246 unmodified lines | ||
| 247 | 247 | const struct common_firmware_header *header = NULL; |
| 248 | 248 | |
| 249 | 249 | err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true, |
| 250 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, bo); | |
| 250 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, bo); | |
| 251 | 251 | if (err) { |
| 252 | 252 | dev_err(adev->dev, "(%d) Firmware buffer allocate failed\n", err); |
| 253 | 253 | err = -ENOMEM; |
| @@ -156,7 +156,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · 155 unmodified lines | ||
| 156 | 156 | r = amdgpu_bo_create(adev, bo_size, PAGE_SIZE, true, |
| 157 | 157 | AMDGPU_GEM_DOMAIN_VRAM, |
| 158 | 158 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 159 | − NULL, &adev->uvd.vcpu_bo); | |
| 159 | + NULL, NULL, &adev->uvd.vcpu_bo); | |
| 160 | 160 | if (r) { |
| 161 | 161 | dev_err(adev->dev, "(%d) failed to allocate UVD bo\n", r); |
| 162 | 162 | return r; |
| @@ -543,46 +543,60 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx, · 380 unmodified lines | ||
| 543 | 543 | return -EINVAL; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | − if (msg_type == 1) { | |
| 546 | + switch (msg_type) { | |
| 547 | + case 0: | |
| 548 | + /* it's a create msg, calc image size (width * height) */ | |
| 549 | + amdgpu_bo_kunmap(bo); | |
| 550 | + | |
| 551 | + /* try to alloc a new handle */ | |
| 552 | + for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { | |
| 553 | + if (atomic_read(&adev->uvd.handles[i]) == handle) { | |
| 554 | + DRM_ERROR("Handle 0x%x already in use!\n", handle); | |
| 555 | + return -EINVAL; | |
| 556 | + } | |
| 557 | + | |
| 558 | + if (!atomic_cmpxchg(&adev->uvd.handles[i], 0, handle)) { | |
| 559 | + adev->uvd.filp[i] = ctx->parser->filp; | |
| 560 | + return 0; | |
| 561 | + } | |
| 562 | + } | |
| 563 | + | |
| 564 | + DRM_ERROR("No more free UVD handles!\n"); | |
| 565 | + return -EINVAL; | |
| 566 | + | |
| 567 | + case 1: | |
| 547 | 568 | /* it's a decode msg, calc buffer sizes */ |
| 548 | 569 | r = amdgpu_uvd_cs_msg_decode(msg, ctx->buf_sizes); |
| 549 | 570 | amdgpu_bo_kunmap(bo); |
| 550 | 571 | if (r) |
| 551 | 572 | return r; |
| 552 | 573 | |
| 553 | − } else if (msg_type == 2) { | |
| 574 | + /* validate the handle */ | |
| 575 | + for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { | |
| 576 | + if (atomic_read(&adev->uvd.handles[i]) == handle) { | |
| 577 | + if (adev->uvd.filp[i] != ctx->parser->filp) { | |
| 578 | + DRM_ERROR("UVD handle collision detected!\n"); | |
| 579 | + return -EINVAL; | |
| 580 | + } | |
| 581 | + return 0; | |
| 582 | + } | |
| 583 | + } | |
| 584 | + | |
| 585 | + DRM_ERROR("Invalid UVD handle 0x%x!\n", handle); | |
| 586 | + return -ENOENT; | |
| 587 | + | |
| 588 | + case 2: | |
| 554 | 589 | /* it's a destroy msg, free the handle */ |
| 555 | 590 | for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) |
| 556 | 591 | atomic_cmpxchg(&adev->uvd.handles[i], handle, 0); |
| 557 | 592 | amdgpu_bo_kunmap(bo); |
| 558 | 593 | return 0; |
| 559 | − } else { | |
| 560 | − /* it's a create msg */ | |
| 561 | − amdgpu_bo_kunmap(bo); | |
| 562 | − | |
| 563 | − if (msg_type != 0) { | |
| 564 | − DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); | |
| 565 | − return -EINVAL; | |
| 566 | − } | |
| 567 | − | |
| 568 | − /* it's a create msg, no special handling needed */ | |
| 569 | − } | |
| 570 | − | |
| 571 | − /* create or decode, validate the handle */ | |
| 572 | − for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { | |
| 573 | − if (atomic_read(&adev->uvd.handles[i]) == handle) | |
| 574 | − return 0; | |
| 575 | − } | |
| 576 | 594 | |
| 577 | − /* handle not found try to alloc a new one */ | |
| 578 | − for (i = 0; i < AMDGPU_MAX_UVD_HANDLES; ++i) { | |
| 579 | − if (!atomic_cmpxchg(&adev->uvd.handles[i], 0, handle)) { | |
| 580 | − adev->uvd.filp[i] = ctx->parser->filp; | |
| 581 | − return 0; | |
| 582 | − } | |
| 595 | + default: | |
| 596 | + DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); | |
| 597 | + return -EINVAL; | |
| 583 | 598 | } |
| 584 | − | |
| 585 | − DRM_ERROR("No more free UVD handles!\n"); | |
| 599 | + BUG(); | |
| 586 | 600 | return -EINVAL; |
| 587 | 601 | } |
| 588 | 602 | |
| @@ -805,10 +819,10 @@ int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx) · 216 unmodified lines | ||
| 805 | 819 | } |
| 806 | 820 | |
| 807 | 821 | static int amdgpu_uvd_free_job( |
| 808 | − struct amdgpu_job *sched_job) | |
| 822 | + struct amdgpu_job *job) | |
| 809 | 823 | { |
| 810 | − amdgpu_ib_free(sched_job->adev, sched_job->ibs); | |
| 811 | − kfree(sched_job->ibs); | |
| 824 | + amdgpu_ib_free(job->adev, job->ibs); | |
| 825 | + kfree(job->ibs); | |
| 812 | 826 | return 0; |
| 813 | 827 | } |
| 814 | 828 | |
| @@ -905,7 +919,7 @@ int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 90 unmodified lines | ||
| 905 | 919 | r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true, |
| 906 | 920 | AMDGPU_GEM_DOMAIN_VRAM, |
| 907 | 921 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 908 | − NULL, &bo); | |
| 922 | + NULL, NULL, &bo); | |
| 909 | 923 | if (r) |
| 910 | 924 | return r; |
| 911 | 925 | |
| @@ -954,7 +968,7 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, · 42 unmodified lines | ||
| 954 | 968 | r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true, |
| 955 | 969 | AMDGPU_GEM_DOMAIN_VRAM, |
| 956 | 970 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 957 | − NULL, &bo); | |
| 971 | + NULL, NULL, &bo); | |
| 958 | 972 | if (r) |
| 959 | 973 | return r; |
| 960 | 974 | |
| @@ -143,7 +143,7 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size) · 142 unmodified lines | ||
| 143 | 143 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, |
| 144 | 144 | AMDGPU_GEM_DOMAIN_VRAM, |
| 145 | 145 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 146 | − NULL, &adev->vce.vcpu_bo); | |
| 146 | + NULL, NULL, &adev->vce.vcpu_bo); | |
| 147 | 147 | if (r) { |
| 148 | 148 | dev_err(adev->dev, "(%d) failed to allocate VCE bo\n", r); |
| 149 | 149 | return r; |
| @@ -342,10 +342,10 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp) · 192 unmodified lines | ||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | static int amdgpu_vce_free_job( |
| 345 | − struct amdgpu_job *sched_job) | |
| 345 | + struct amdgpu_job *job) | |
| 346 | 346 | { |
| 347 | − amdgpu_ib_free(sched_job->adev, sched_job->ibs); | |
| 348 | − kfree(sched_job->ibs); | |
| 347 | + amdgpu_ib_free(job->adev, job->ibs); | |
| 348 | + kfree(job->ibs); | |
| 349 | 349 | return 0; |
| 350 | 350 | } |
| 351 | 351 | |
| @@ -316,12 +316,12 @@ static void amdgpu_vm_update_pages(struct amdgpu_device *adev, · 315 unmodified lines | ||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | −int amdgpu_vm_free_job(struct amdgpu_job *sched_job) | |
| 319 | +int amdgpu_vm_free_job(struct amdgpu_job *job) | |
| 320 | 320 | { |
| 321 | 321 | int i; |
| 322 | − for (i = 0; i < sched_job->num_ibs; i++) | |
| 323 | − amdgpu_ib_free(sched_job->adev, &sched_job->ibs[i]); | |
| 324 | − kfree(sched_job->ibs); | |
| 322 | + for (i = 0; i < job->num_ibs; i++) | |
| 323 | + amdgpu_ib_free(job->adev, &job->ibs[i]); | |
| 324 | + kfree(job->ibs); | |
| 325 | 325 | return 0; |
| 326 | 326 | } |
| 327 | 327 | |
| @@ -685,31 +685,6 @@ static int amdgpu_vm_update_ptes(struct amdgpu_device *adev, · 357 unmodified lines | ||
| 685 | 685 | return 0; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | −/** | |
| 689 | − * amdgpu_vm_fence_pts - fence page tables after an update | |
| 690 | − * | |
| 691 | − * @vm: requested vm | |
| 692 | − * @start: start of GPU address range | |
| 693 | − * @end: end of GPU address range | |
| 694 | − * @fence: fence to use | |
| 695 | − * | |
| 696 | − * Fence the page tables in the range @start - @end (cayman+). | |
| 697 | − * | |
| 698 | − * Global and local mutex must be locked! | |
| 699 | − */ | |
| 700 | −static void amdgpu_vm_fence_pts(struct amdgpu_vm *vm, | |
| 701 | − uint64_t start, uint64_t end, | |
| 702 | − struct fence *fence) | |
| 703 | −{ | |
| 704 | − unsigned i; | |
| 705 | − | |
| 706 | − start >>= amdgpu_vm_block_size; | |
| 707 | − end >>= amdgpu_vm_block_size; | |
| 708 | − | |
| 709 | − for (i = start; i <= end; ++i) | |
| 710 | − amdgpu_bo_fence(vm->page_tables[i].bo, fence, true); | |
| 711 | −} | |
| 712 | − | |
| 713 | 688 | /** |
| 714 | 689 | * amdgpu_vm_bo_update_mapping - update a mapping in the vm page table |
| 715 | 690 | * |
| @@ -813,8 +788,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · 97 unmodified lines | ||
| 813 | 788 | if (r) |
| 814 | 789 | goto error_free; |
| 815 | 790 | |
| 816 | − amdgpu_vm_fence_pts(vm, mapping->it.start, | |
| 817 | − mapping->it.last + 1, f); | |
| 791 | + amdgpu_bo_fence(vm->page_directory, f, true); | |
| 818 | 792 | if (fence) { |
| 819 | 793 | fence_put(*fence); |
| 820 | 794 | *fence = fence_get(f); |
| @@ -855,7 +829,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, · 34 unmodified lines | ||
| 855 | 829 | int r; |
| 856 | 830 | |
| 857 | 831 | if (mem) { |
| 858 | − addr = mem->start << PAGE_SHIFT; | |
| 832 | + addr = (u64)mem->start << PAGE_SHIFT; | |
| 859 | 833 | if (mem->mem_type != TTM_PL_TT) |
| 860 | 834 | addr += adev->vm_manager.vram_base_offset; |
| 861 | 835 | } else { |
| @@ -1089,6 +1063,7 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 227 unmodified lines | ||
| 1089 | 1063 | |
| 1090 | 1064 | /* walk over the address space and allocate the page tables */ |
| 1091 | 1065 | for (pt_idx = saddr; pt_idx <= eaddr; ++pt_idx) { |
| 1066 | + struct reservation_object *resv = vm->page_directory->tbo.resv; | |
| 1092 | 1067 | struct amdgpu_bo *pt; |
| 1093 | 1068 | |
| 1094 | 1069 | if (vm->page_tables[pt_idx].bo) |
| @@ -1097,11 +1072,13 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 1097 | 1072 | /* drop mutex to allocate and clear page table */ |
| 1098 | 1073 | mutex_unlock(&vm->mutex); |
| 1099 | 1074 | |
| 1075 | + ww_mutex_lock(&resv->lock, NULL); | |
| 1100 | 1076 | r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8, |
| 1101 | 1077 | AMDGPU_GPU_PAGE_SIZE, true, |
| 1102 | 1078 | AMDGPU_GEM_DOMAIN_VRAM, |
| 1103 | 1079 | AMDGPU_GEM_CREATE_NO_CPU_ACCESS, |
| 1104 | − NULL, &pt); | |
| 1080 | + NULL, resv, &pt); | |
| 1081 | + ww_mutex_unlock(&resv->lock); | |
| 1105 | 1082 | if (r) |
| 1106 | 1083 | goto error_free; |
| 1107 | 1084 | |
| @@ -1303,7 +1280,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) · 195 unmodified lines | ||
| 1303 | 1280 | r = amdgpu_bo_create(adev, pd_size, align, true, |
| 1304 | 1281 | AMDGPU_GEM_DOMAIN_VRAM, |
| 1305 | 1282 | AMDGPU_GEM_CREATE_NO_CPU_ACCESS, |
| 1306 | − NULL, &vm->page_directory); | |
| 1283 | + NULL, NULL, &vm->page_directory); | |
| 1307 | 1284 | if (r) |
| 1308 | 1285 | return r; |
| 1309 | 1286 | |
| @@ -1279,8 +1279,7 @@ amdgpu_atombios_encoder_setup_dig(struct drm_encoder *encoder, int action) · 1278 unmodified lines | ||
| 1279 | 1279 | amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); |
| 1280 | 1280 | } |
| 1281 | 1281 | if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
| 1282 | − amdgpu_atombios_encoder_setup_dig_transmitter(encoder, | |
| 1283 | − ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0); | |
| 1282 | + amdgpu_atombios_encoder_set_backlight_level(amdgpu_encoder, dig->backlight_level); | |
| 1284 | 1283 | if (ext_encoder) |
| 1285 | 1284 | amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_ENABLE); |
| 1286 | 1285 | } else { |
| @@ -814,7 +814,8 @@ int cz_smu_init(struct amdgpu_device *adev) · 813 unmodified lines | ||
| 814 | 814 | * 3. map kernel virtual address |
| 815 | 815 | */ |
| 816 | 816 | ret = amdgpu_bo_create(adev, priv->toc_buffer.data_size, PAGE_SIZE, |
| 817 | − true, AMDGPU_GEM_DOMAIN_GTT, 0, NULL, toc_buf); | |
| 817 | + true, AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 818 | + toc_buf); | |
| 818 | 819 | |
| 819 | 820 | if (ret) { |
| 820 | 821 | dev_err(adev->dev, "(%d) SMC TOC buffer allocation failed\n", ret); |
| @@ -822,7 +823,8 @@ int cz_smu_init(struct amdgpu_device *adev) · 1 unmodified line | ||
| 822 | 823 | } |
| 823 | 824 | |
| 824 | 825 | ret = amdgpu_bo_create(adev, priv->smu_buffer.data_size, PAGE_SIZE, |
| 825 | − true, AMDGPU_GEM_DOMAIN_GTT, 0, NULL, smu_buf); | |
| 826 | + true, AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 827 | + smu_buf); | |
| 826 | 828 | |
| 827 | 829 | if (ret) { |
| 828 | 830 | dev_err(adev->dev, "(%d) SMC Internal buffer allocation failed\n", ret); |
| @@ -764,7 +764,7 @@ int fiji_smu_init(struct amdgpu_device *adev) · 763 unmodified lines | ||
| 764 | 764 | ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, |
| 765 | 765 | true, AMDGPU_GEM_DOMAIN_VRAM, |
| 766 | 766 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 767 | − NULL, toc_buf); | |
| 767 | + NULL, NULL, toc_buf); | |
| 768 | 768 | if (ret) { |
| 769 | 769 | DRM_ERROR("Failed to allocate memory for TOC buffer\n"); |
| 770 | 770 | return -ENOMEM; |
| @@ -774,7 +774,7 @@ int fiji_smu_init(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 774 | 774 | ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE, |
| 775 | 775 | true, AMDGPU_GEM_DOMAIN_VRAM, |
| 776 | 776 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 777 | − NULL, smu_buf); | |
| 777 | + NULL, NULL, smu_buf); | |
| 778 | 778 | if (ret) { |
| 779 | 779 | DRM_ERROR("Failed to allocate memory for SMU internal buffer\n"); |
| 780 | 780 | return -ENOMEM; |
| @@ -3206,7 +3206,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev) · 3205 unmodified lines | ||
| 3206 | 3206 | r = amdgpu_bo_create(adev, |
| 3207 | 3207 | adev->gfx.mec.num_mec *adev->gfx.mec.num_pipe * MEC_HPD_SIZE * 2, |
| 3208 | 3208 | PAGE_SIZE, true, |
| 3209 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, | |
| 3209 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 3210 | 3210 | &adev->gfx.mec.hpd_eop_obj); |
| 3211 | 3211 | if (r) { |
| 3212 | 3212 | dev_warn(adev->dev, "(%d) create HDP EOP bo failed\n", r); |
| @@ -3373,7 +3373,7 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev) · 160 unmodified lines | ||
| 3373 | 3373 | r = amdgpu_bo_create(adev, |
| 3374 | 3374 | sizeof(struct bonaire_mqd), |
| 3375 | 3375 | PAGE_SIZE, true, |
| 3376 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, | |
| 3376 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 3377 | 3377 | &ring->mqd_obj); |
| 3378 | 3378 | if (r) { |
| 3379 | 3379 | dev_warn(adev->dev, "(%d) create MQD bo failed\n", r); |
| @@ -3610,41 +3610,6 @@ static int gfx_v7_0_cp_resume(struct amdgpu_device *adev) · 230 unmodified lines | ||
| 3610 | 3610 | return 0; |
| 3611 | 3611 | } |
| 3612 | 3612 | |
| 3613 | −static void gfx_v7_0_ce_sync_me(struct amdgpu_ring *ring) | |
| 3614 | −{ | |
| 3615 | − struct amdgpu_device *adev = ring->adev; | |
| 3616 | − u64 gpu_addr = adev->wb.gpu_addr + adev->gfx.ce_sync_offs * 4; | |
| 3617 | − | |
| 3618 | − /* instruct DE to set a magic number */ | |
| 3619 | − amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | |
| 3620 | − amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 3621 | − WRITE_DATA_DST_SEL(5))); | |
| 3622 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 3623 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 3624 | − amdgpu_ring_write(ring, 1); | |
| 3625 | − | |
| 3626 | − /* let CE wait till condition satisfied */ | |
| 3627 | − amdgpu_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | |
| 3628 | − amdgpu_ring_write(ring, (WAIT_REG_MEM_OPERATION(0) | /* wait */ | |
| 3629 | − WAIT_REG_MEM_MEM_SPACE(1) | /* memory */ | |
| 3630 | − WAIT_REG_MEM_FUNCTION(3) | /* == */ | |
| 3631 | − WAIT_REG_MEM_ENGINE(2))); /* ce */ | |
| 3632 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 3633 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 3634 | − amdgpu_ring_write(ring, 1); | |
| 3635 | − amdgpu_ring_write(ring, 0xffffffff); | |
| 3636 | − amdgpu_ring_write(ring, 4); /* poll interval */ | |
| 3637 | − | |
| 3638 | − /* instruct CE to reset wb of ce_sync to zero */ | |
| 3639 | − amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | |
| 3640 | − amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(2) | | |
| 3641 | − WRITE_DATA_DST_SEL(5) | | |
| 3642 | − WR_CONFIRM)); | |
| 3643 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 3644 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 3645 | − amdgpu_ring_write(ring, 0); | |
| 3646 | −} | |
| 3647 | − | |
| 3648 | 3613 | /* |
| 3649 | 3614 | * vm |
| 3650 | 3615 | * VMID 0 is the physical GPU addresses as used by the kernel. |
| @@ -3663,6 +3628,13 @@ static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring, · 12 unmodified lines | ||
| 3663 | 3628 | unsigned vm_id, uint64_t pd_addr) |
| 3664 | 3629 | { |
| 3665 | 3630 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); |
| 3631 | + if (usepfp) { | |
| 3632 | + /* synce CE with ME to prevent CE fetch CEIB before context switch done */ | |
| 3633 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 3634 | + amdgpu_ring_write(ring, 0); | |
| 3635 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 3636 | + amdgpu_ring_write(ring, 0); | |
| 3637 | + } | |
| 3666 | 3638 | |
| 3667 | 3639 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 3668 | 3640 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
| @@ -3703,7 +3675,10 @@ static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring, · 34 unmodified lines | ||
| 3703 | 3675 | amdgpu_ring_write(ring, 0x0); |
| 3704 | 3676 | |
| 3705 | 3677 | /* synce CE with ME to prevent CE fetch CEIB before context switch done */ |
| 3706 | − gfx_v7_0_ce_sync_me(ring); | |
| 3678 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 3679 | + amdgpu_ring_write(ring, 0); | |
| 3680 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 3681 | + amdgpu_ring_write(ring, 0); | |
| 3707 | 3682 | } |
| 3708 | 3683 | } |
| 3709 | 3684 | |
| @@ -3788,7 +3763,8 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev) · 78 unmodified lines | ||
| 3788 | 3763 | r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, |
| 3789 | 3764 | AMDGPU_GEM_DOMAIN_VRAM, |
| 3790 | 3765 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 3791 | − NULL, &adev->gfx.rlc.save_restore_obj); | |
| 3766 | + NULL, NULL, | |
| 3767 | + &adev->gfx.rlc.save_restore_obj); | |
| 3792 | 3768 | if (r) { |
| 3793 | 3769 | dev_warn(adev->dev, "(%d) create RLC sr bo failed\n", r); |
| 3794 | 3770 | return r; |
| @@ -3831,7 +3807,8 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev) · 36 unmodified lines | ||
| 3831 | 3807 | r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, |
| 3832 | 3808 | AMDGPU_GEM_DOMAIN_VRAM, |
| 3833 | 3809 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 3834 | − NULL, &adev->gfx.rlc.clear_state_obj); | |
| 3810 | + NULL, NULL, | |
| 3811 | + &adev->gfx.rlc.clear_state_obj); | |
| 3835 | 3812 | if (r) { |
| 3836 | 3813 | dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r); |
| 3837 | 3814 | gfx_v7_0_rlc_fini(adev); |
| @@ -3870,7 +3847,8 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev) · 32 unmodified lines | ||
| 3870 | 3847 | r = amdgpu_bo_create(adev, adev->gfx.rlc.cp_table_size, PAGE_SIZE, true, |
| 3871 | 3848 | AMDGPU_GEM_DOMAIN_VRAM, |
| 3872 | 3849 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 3873 | − NULL, &adev->gfx.rlc.cp_table_obj); | |
| 3850 | + NULL, NULL, | |
| 3851 | + &adev->gfx.rlc.cp_table_obj); | |
| 3874 | 3852 | if (r) { |
| 3875 | 3853 | dev_warn(adev->dev, "(%d) create RLC cp table bo failed\n", r); |
| 3876 | 3854 | gfx_v7_0_rlc_fini(adev); |
| @@ -4802,12 +4780,6 @@ static int gfx_v7_0_sw_init(void *handle) · 925 unmodified lines | ||
| 4802 | 4780 | return r; |
| 4803 | 4781 | } |
| 4804 | 4782 | |
| 4805 | − r = amdgpu_wb_get(adev, &adev->gfx.ce_sync_offs); | |
| 4806 | − if (r) { | |
| 4807 | − DRM_ERROR("(%d) gfx.ce_sync_offs wb alloc failed\n", r); | |
| 4808 | − return r; | |
| 4809 | − } | |
| 4810 | − | |
| 4811 | 4783 | for (i = 0; i < adev->gfx.num_gfx_rings; i++) { |
| 4812 | 4784 | ring = &adev->gfx.gfx_ring[i]; |
| 4813 | 4785 | ring->ring_obj = NULL; |
| @@ -4851,21 +4823,21 @@ static int gfx_v7_0_sw_init(void *handle) · 37 unmodified lines | ||
| 4851 | 4823 | r = amdgpu_bo_create(adev, adev->gds.mem.gfx_partition_size, |
| 4852 | 4824 | PAGE_SIZE, true, |
| 4853 | 4825 | AMDGPU_GEM_DOMAIN_GDS, 0, |
| 4854 | − NULL, &adev->gds.gds_gfx_bo); | |
| 4826 | + NULL, NULL, &adev->gds.gds_gfx_bo); | |
| 4855 | 4827 | if (r) |
| 4856 | 4828 | return r; |
| 4857 | 4829 | |
| 4858 | 4830 | r = amdgpu_bo_create(adev, adev->gds.gws.gfx_partition_size, |
| 4859 | 4831 | PAGE_SIZE, true, |
| 4860 | 4832 | AMDGPU_GEM_DOMAIN_GWS, 0, |
| 4861 | − NULL, &adev->gds.gws_gfx_bo); | |
| 4833 | + NULL, NULL, &adev->gds.gws_gfx_bo); | |
| 4862 | 4834 | if (r) |
| 4863 | 4835 | return r; |
| 4864 | 4836 | |
| 4865 | 4837 | r = amdgpu_bo_create(adev, adev->gds.oa.gfx_partition_size, |
| 4866 | 4838 | PAGE_SIZE, true, |
| 4867 | 4839 | AMDGPU_GEM_DOMAIN_OA, 0, |
| 4868 | − NULL, &adev->gds.oa_gfx_bo); | |
| 4840 | + NULL, NULL, &adev->gds.oa_gfx_bo); | |
| 4869 | 4841 | if (r) |
| 4870 | 4842 | return r; |
| 4871 | 4843 | |
| @@ -4886,8 +4858,6 @@ static int gfx_v7_0_sw_fini(void *handle) · 14 unmodified lines | ||
| 4886 | 4858 | for (i = 0; i < adev->gfx.num_compute_rings; i++) |
| 4887 | 4859 | amdgpu_ring_fini(&adev->gfx.compute_ring[i]); |
| 4888 | 4860 | |
| 4889 | − amdgpu_wb_free(adev, adev->gfx.ce_sync_offs); | |
| 4890 | − | |
| 4891 | 4861 | gfx_v7_0_cp_compute_fini(adev); |
| 4892 | 4862 | gfx_v7_0_rlc_fini(adev); |
| 4893 | 4863 | gfx_v7_0_mec_fini(adev); |
| @@ -868,7 +868,7 @@ static int gfx_v8_0_mec_init(struct amdgpu_device *adev) · 867 unmodified lines | ||
| 868 | 868 | r = amdgpu_bo_create(adev, |
| 869 | 869 | adev->gfx.mec.num_mec *adev->gfx.mec.num_pipe * MEC_HPD_SIZE * 2, |
| 870 | 870 | PAGE_SIZE, true, |
| 871 | − AMDGPU_GEM_DOMAIN_GTT, 0, NULL, | |
| 871 | + AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | |
| 872 | 872 | &adev->gfx.mec.hpd_eop_obj); |
| 873 | 873 | if (r) { |
| 874 | 874 | dev_warn(adev->dev, "(%d) create HDP EOP bo failed\n", r); |
| @@ -940,12 +940,6 @@ static int gfx_v8_0_sw_init(void *handle) · 65 unmodified lines | ||
| 940 | 940 | return r; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | − r = amdgpu_wb_get(adev, &adev->gfx.ce_sync_offs); | |
| 944 | − if (r) { | |
| 945 | − DRM_ERROR("(%d) gfx.ce_sync_offs wb alloc failed\n", r); | |
| 946 | − return r; | |
| 947 | − } | |
| 948 | − | |
| 949 | 943 | /* set up the gfx ring */ |
| 950 | 944 | for (i = 0; i < adev->gfx.num_gfx_rings; i++) { |
| 951 | 945 | ring = &adev->gfx.gfx_ring[i]; |
| @@ -995,21 +989,21 @@ static int gfx_v8_0_sw_init(void *handle) · 43 unmodified lines | ||
| 995 | 989 | /* reserve GDS, GWS and OA resource for gfx */ |
| 996 | 990 | r = amdgpu_bo_create(adev, adev->gds.mem.gfx_partition_size, |
| 997 | 991 | PAGE_SIZE, true, |
| 998 | − AMDGPU_GEM_DOMAIN_GDS, 0, | |
| 992 | + AMDGPU_GEM_DOMAIN_GDS, 0, NULL, | |
| 999 | 993 | NULL, &adev->gds.gds_gfx_bo); |
| 1000 | 994 | if (r) |
| 1001 | 995 | return r; |
| 1002 | 996 | |
| 1003 | 997 | r = amdgpu_bo_create(adev, adev->gds.gws.gfx_partition_size, |
| 1004 | 998 | PAGE_SIZE, true, |
| 1005 | − AMDGPU_GEM_DOMAIN_GWS, 0, | |
| 999 | + AMDGPU_GEM_DOMAIN_GWS, 0, NULL, | |
| 1006 | 1000 | NULL, &adev->gds.gws_gfx_bo); |
| 1007 | 1001 | if (r) |
| 1008 | 1002 | return r; |
| 1009 | 1003 | |
| 1010 | 1004 | r = amdgpu_bo_create(adev, adev->gds.oa.gfx_partition_size, |
| 1011 | 1005 | PAGE_SIZE, true, |
| 1012 | − AMDGPU_GEM_DOMAIN_OA, 0, | |
| 1006 | + AMDGPU_GEM_DOMAIN_OA, 0, NULL, | |
| 1013 | 1007 | NULL, &adev->gds.oa_gfx_bo); |
| 1014 | 1008 | if (r) |
| 1015 | 1009 | return r; |
| @@ -1033,8 +1027,6 @@ static int gfx_v8_0_sw_fini(void *handle) · 17 unmodified lines | ||
| 1033 | 1027 | for (i = 0; i < adev->gfx.num_compute_rings; i++) |
| 1034 | 1028 | amdgpu_ring_fini(&adev->gfx.compute_ring[i]); |
| 1035 | 1029 | |
| 1036 | − amdgpu_wb_free(adev, adev->gfx.ce_sync_offs); | |
| 1037 | − | |
| 1038 | 1030 | gfx_v8_0_mec_fini(adev); |
| 1039 | 1031 | |
| 1040 | 1032 | return 0; |
| @@ -3106,7 +3098,7 @@ static int gfx_v8_0_cp_compute_resume(struct amdgpu_device *adev) · 2065 unmodified lines | ||
| 3106 | 3098 | sizeof(struct vi_mqd), |
| 3107 | 3099 | PAGE_SIZE, true, |
| 3108 | 3100 | AMDGPU_GEM_DOMAIN_GTT, 0, NULL, |
| 3109 | − &ring->mqd_obj); | |
| 3101 | + NULL, &ring->mqd_obj); | |
| 3110 | 3102 | if (r) { |
| 3111 | 3103 | dev_warn(adev->dev, "(%d) create MQD bo failed\n", r); |
| 3112 | 3104 | return r; |
| @@ -3965,6 +3957,7 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr, · 852 unmodified lines | ||
| 3965 | 3957 | DATA_SEL(write64bit ? 2 : 1) | INT_SEL(int_sel ? 2 : 0)); |
| 3966 | 3958 | amdgpu_ring_write(ring, lower_32_bits(seq)); |
| 3967 | 3959 | amdgpu_ring_write(ring, upper_32_bits(seq)); |
| 3960 | + | |
| 3968 | 3961 | } |
| 3969 | 3962 | |
| 3970 | 3963 | /** |
| @@ -4005,49 +3998,34 @@ static bool gfx_v8_0_ring_emit_semaphore(struct amdgpu_ring *ring, · 34 unmodified lines | ||
| 4005 | 3998 | return true; |
| 4006 | 3999 | } |
| 4007 | 4000 | |
| 4008 | −static void gfx_v8_0_ce_sync_me(struct amdgpu_ring *ring) | |
| 4001 | +static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, | |
| 4002 | + unsigned vm_id, uint64_t pd_addr) | |
| 4009 | 4003 | { |
| 4010 | − struct amdgpu_device *adev = ring->adev; | |
| 4011 | − u64 gpu_addr = adev->wb.gpu_addr + adev->gfx.ce_sync_offs * 4; | |
| 4012 | − | |
| 4013 | − /* instruct DE to set a magic number */ | |
| 4014 | − amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | |
| 4015 | − amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | |
| 4016 | − WRITE_DATA_DST_SEL(5))); | |
| 4017 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 4018 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 4019 | − amdgpu_ring_write(ring, 1); | |
| 4004 | + int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | |
| 4005 | + uint32_t seq = ring->fence_drv.sync_seq[ring->idx]; | |
| 4006 | + uint64_t addr = ring->fence_drv.gpu_addr; | |
| 4020 | 4007 | |
| 4021 | − /* let CE wait till condition satisfied */ | |
| 4022 | 4008 | amdgpu_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); |
| 4023 | − amdgpu_ring_write(ring, (WAIT_REG_MEM_OPERATION(0) | /* wait */ | |
| 4024 | − WAIT_REG_MEM_MEM_SPACE(1) | /* memory */ | |
| 4025 | − WAIT_REG_MEM_FUNCTION(3) | /* == */ | |
| 4026 | − WAIT_REG_MEM_ENGINE(2))); /* ce */ | |
| 4027 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 4028 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 4029 | − amdgpu_ring_write(ring, 1); | |
| 4009 | + amdgpu_ring_write(ring, (WAIT_REG_MEM_MEM_SPACE(1) | /* memory */ | |
| 4010 | + WAIT_REG_MEM_FUNCTION(3))); /* equal */ | |
| 4011 | + amdgpu_ring_write(ring, addr & 0xfffffffc); | |
| 4012 | + amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff); | |
| 4013 | + amdgpu_ring_write(ring, seq); | |
| 4030 | 4014 | amdgpu_ring_write(ring, 0xffffffff); |
| 4031 | 4015 | amdgpu_ring_write(ring, 4); /* poll interval */ |
| 4032 | 4016 | |
| 4033 | − /* instruct CE to reset wb of ce_sync to zero */ | |
| 4034 | − amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | |
| 4035 | − amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(2) | | |
| 4036 | − WRITE_DATA_DST_SEL(5) | | |
| 4037 | − WR_CONFIRM)); | |
| 4038 | − amdgpu_ring_write(ring, gpu_addr & 0xfffffffc); | |
| 4039 | − amdgpu_ring_write(ring, upper_32_bits(gpu_addr) & 0xffffffff); | |
| 4040 | − amdgpu_ring_write(ring, 0); | |
| 4041 | −} | |
| 4042 | − | |
| 4043 | −static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, | |
| 4044 | − unsigned vm_id, uint64_t pd_addr) | |
| 4045 | −{ | |
| 4046 | − int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | |
| 4017 | + if (usepfp) { | |
| 4018 | + /* synce CE with ME to prevent CE fetch CEIB before context switch done */ | |
| 4019 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 4020 | + amdgpu_ring_write(ring, 0); | |
| 4021 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 4022 | + amdgpu_ring_write(ring, 0); | |
| 4023 | + } | |
| 4047 | 4024 | |
| 4048 | 4025 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
| 4049 | 4026 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
| 4050 | − WRITE_DATA_DST_SEL(0))); | |
| 4027 | + WRITE_DATA_DST_SEL(0)) | | |
| 4028 | + WR_CONFIRM); | |
| 4051 | 4029 | if (vm_id < 8) { |
| 4052 | 4030 | amdgpu_ring_write(ring, |
| 4053 | 4031 | (mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR + vm_id)); |
| @@ -4083,9 +4061,10 @@ static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, · 29 unmodified lines | ||
| 4083 | 4061 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ |
| 4084 | 4062 | amdgpu_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); |
| 4085 | 4063 | amdgpu_ring_write(ring, 0x0); |
| 4086 | − | |
| 4087 | − /* synce CE with ME to prevent CE fetch CEIB before context switch done */ | |
| 4088 | − gfx_v8_0_ce_sync_me(ring); | |
| 4064 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 4065 | + amdgpu_ring_write(ring, 0); | |
| 4066 | + amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | |
| 4067 | + amdgpu_ring_write(ring, 0); | |
| 4089 | 4068 | } |
| 4090 | 4069 | } |
| 4091 | 4070 | |
| @@ -1262,6 +1262,12 @@ static int gmc_v7_0_process_interrupt(struct amdgpu_device *adev, · 1261 unmodified lines | ||
| 1262 | 1262 | addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR); |
| 1263 | 1263 | status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS); |
| 1264 | 1264 | mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); |
| 1265 | + /* reset addr and status */ | |
| 1266 | + WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1); | |
| 1267 | + | |
| 1268 | + if (!addr && !status) | |
| 1269 | + return 0; | |
| 1270 | + | |
| 1265 | 1271 | dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n", |
| 1266 | 1272 | entry->src_id, entry->src_data); |
| 1267 | 1273 | dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
| @@ -1269,8 +1275,6 @@ static int gmc_v7_0_process_interrupt(struct amdgpu_device *adev, · 1 unmodified line | ||
| 1269 | 1275 | dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
| 1270 | 1276 | status); |
| 1271 | 1277 | gmc_v7_0_vm_decode_fault(adev, status, addr, mc_client); |
| 1272 | − /* reset addr and status */ | |
| 1273 | − WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1); | |
| 1274 | 1278 | |
| 1275 | 1279 | return 0; |
| 1276 | 1280 | } |
| @@ -1262,6 +1262,12 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev, · 1261 unmodified lines | ||
| 1262 | 1262 | addr = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_ADDR); |
| 1263 | 1263 | status = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_STATUS); |
| 1264 | 1264 | mc_client = RREG32(mmVM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); |
| 1265 | + /* reset addr and status */ | |
| 1266 | + WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1); | |
| 1267 | + | |
| 1268 | + if (!addr && !status) | |
| 1269 | + return 0; | |
| 1270 | + | |
| 1265 | 1271 | dev_err(adev->dev, "GPU fault detected: %d 0x%08x\n", |
| 1266 | 1272 | entry->src_id, entry->src_data); |
| 1267 | 1273 | dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
| @@ -1269,8 +1275,6 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev, · 1 unmodified line | ||
| 1269 | 1275 | dev_err(adev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
| 1270 | 1276 | status); |
| 1271 | 1277 | gmc_v8_0_vm_decode_fault(adev, status, addr, mc_client); |
| 1272 | − /* reset addr and status */ | |
| 1273 | − WREG32_P(mmVM_CONTEXT1_CNTL2, 1, ~1); | |
| 1274 | 1278 | |
| 1275 | 1279 | return 0; |
| 1276 | 1280 | } |
| @@ -625,7 +625,7 @@ int iceland_smu_init(struct amdgpu_device *adev) · 624 unmodified lines | ||
| 625 | 625 | ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, |
| 626 | 626 | true, AMDGPU_GEM_DOMAIN_VRAM, |
| 627 | 627 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 628 | − NULL, toc_buf); | |
| 628 | + NULL, NULL, toc_buf); | |
| 629 | 629 | if (ret) { |
| 630 | 630 | DRM_ERROR("Failed to allocate memory for TOC buffer\n"); |
| 631 | 631 | return -ENOMEM; |
| @@ -763,7 +763,7 @@ int tonga_smu_init(struct amdgpu_device *adev) · 762 unmodified lines | ||
| 763 | 763 | ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, |
| 764 | 764 | true, AMDGPU_GEM_DOMAIN_VRAM, |
| 765 | 765 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 766 | − NULL, toc_buf); | |
| 766 | + NULL, NULL, toc_buf); | |
| 767 | 767 | if (ret) { |
| 768 | 768 | DRM_ERROR("Failed to allocate memory for TOC buffer\n"); |
| 769 | 769 | return -ENOMEM; |
| @@ -773,7 +773,7 @@ int tonga_smu_init(struct amdgpu_device *adev) · 3 unmodified lines | ||
| 773 | 773 | ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE, |
| 774 | 774 | true, AMDGPU_GEM_DOMAIN_VRAM, |
| 775 | 775 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
| 776 | − NULL, smu_buf); | |
| 776 | + NULL, NULL, smu_buf); | |
| 777 | 777 | if (ret) { |
| 778 | 778 | DRM_ERROR("Failed to allocate memory for SMU internal buffer\n"); |
| 779 | 779 | return -ENOMEM; |
| @@ -224,11 +224,11 @@ static int uvd_v4_2_suspend(void *handle) · 223 unmodified lines | ||
| 224 | 224 | int r; |
| 225 | 225 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 226 | 226 | |
| 227 | − r = uvd_v4_2_hw_fini(adev); | |
| 227 | + r = amdgpu_uvd_suspend(adev); | |
| 228 | 228 | if (r) |
| 229 | 229 | return r; |
| 230 | 230 | |
| 231 | − r = amdgpu_uvd_suspend(adev); | |
| 231 | + r = uvd_v4_2_hw_fini(adev); | |
| 232 | 232 | if (r) |
| 233 | 233 | return r; |
| 234 | 234 | |
| @@ -220,11 +220,11 @@ static int uvd_v5_0_suspend(void *handle) · 219 unmodified lines | ||
| 220 | 220 | int r; |
| 221 | 221 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 222 | 222 | |
| 223 | − r = uvd_v5_0_hw_fini(adev); | |
| 223 | + r = amdgpu_uvd_suspend(adev); | |
| 224 | 224 | if (r) |
| 225 | 225 | return r; |
| 226 | 226 | |
| 227 | − r = amdgpu_uvd_suspend(adev); | |
| 227 | + r = uvd_v5_0_hw_fini(adev); | |
| 228 | 228 | if (r) |
| 229 | 229 | return r; |
| 230 | 230 | |
| @@ -214,14 +214,16 @@ static int uvd_v6_0_suspend(void *handle) · 213 unmodified lines | ||
| 214 | 214 | int r; |
| 215 | 215 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 216 | 216 | |
| 217 | + /* Skip this for APU for now */ | |
| 218 | + if (!(adev->flags & AMD_IS_APU)) { | |
| 219 | + r = amdgpu_uvd_suspend(adev); | |
| 220 | + if (r) | |
| 221 | + return r; | |
| 222 | + } | |
| 217 | 223 | r = uvd_v6_0_hw_fini(adev); |
| 218 | 224 | if (r) |
| 219 | 225 | return r; |
| 220 | 226 | |
| 221 | − r = amdgpu_uvd_suspend(adev); | |
| 222 | − if (r) | |
| 223 | − return r; | |
| 224 | − | |
| 225 | 227 | return r; |
| 226 | 228 | } |
| 227 | 229 | |
| @@ -230,10 +232,12 @@ static int uvd_v6_0_resume(void *handle) · 2 unmodified lines | ||
| 230 | 232 | int r; |
| 231 | 233 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 232 | 234 | |
| 233 | − r = amdgpu_uvd_resume(adev); | |
| 234 | − if (r) | |
| 235 | − return r; | |
| 236 | − | |
| 235 | + /* Skip this for APU for now */ | |
| 236 | + if (!(adev->flags & AMD_IS_APU)) { | |
| 237 | + r = amdgpu_uvd_resume(adev); | |
| 238 | + if (r) | |
| 239 | + return r; | |
| 240 | + } | |
| 237 | 241 | r = uvd_v6_0_hw_init(adev); |
| 238 | 242 | if (r) |
| 239 | 243 | return r; |
| @@ -1400,7 +1400,8 @@ static int vi_common_early_init(void *handle) · 1399 unmodified lines | ||
| 1400 | 1400 | case CHIP_CARRIZO: |
| 1401 | 1401 | adev->has_uvd = true; |
| 1402 | 1402 | adev->cg_flags = 0; |
| 1403 | − adev->pg_flags = AMDGPU_PG_SUPPORT_UVD | AMDGPU_PG_SUPPORT_VCE; | |
| 1403 | + /* Disable UVD pg */ | |
| 1404 | + adev->pg_flags = /* AMDGPU_PG_SUPPORT_UVD | */AMDGPU_PG_SUPPORT_VCE; | |
| 1404 | 1405 | adev->external_rev_id = adev->rev_id + 0x1; |
| 1405 | 1406 | if (amdgpu_smc_load_fw && smc_enabled) |
| 1406 | 1407 | adev->firmware.smu_load = true; |
| @@ -26,19 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | #include "cgs_common.h" |
| 28 | 28 | |
| 29 | −/** | |
| 30 | − * cgs_import_gpu_mem() - Import dmabuf handle | |
| 31 | − * @cgs_device: opaque device handle | |
| 32 | − * @dmabuf_fd: DMABuf file descriptor | |
| 33 | − * @handle: memory handle (output) | |
| 34 | − * | |
| 35 | − * Must be called in the process context that dmabuf_fd belongs to. | |
| 36 | − * | |
| 37 | − * Return: 0 on success, -errno otherwise | |
| 38 | − */ | |
| 39 | −typedef int (*cgs_import_gpu_mem_t)(void *cgs_device, int dmabuf_fd, | |
| 40 | − cgs_handle_t *handle); | |
| 41 | − | |
| 42 | 29 | /** |
| 43 | 30 | * cgs_irq_source_set_func() - Callback for enabling/disabling interrupt sources |
| 44 | 31 | * @private_data: private data provided to cgs_add_irq_source |
| @@ -114,16 +101,12 @@ typedef int (*cgs_irq_get_t)(void *cgs_device, unsigned src_id, unsigned type); · 69 unmodified lines | ||
| 114 | 101 | typedef int (*cgs_irq_put_t)(void *cgs_device, unsigned src_id, unsigned type); |
| 115 | 102 | |
| 116 | 103 | struct cgs_os_ops { |
| 117 | − cgs_import_gpu_mem_t import_gpu_mem; | |
| 118 | − | |
| 119 | 104 | /* IRQ handling */ |
| 120 | 105 | cgs_add_irq_source_t add_irq_source; |
| 121 | 106 | cgs_irq_get_t irq_get; |
| 122 | 107 | cgs_irq_put_t irq_put; |
| 123 | 108 | }; |
| 124 | 109 | |
| 125 | −#define cgs_import_gpu_mem(dev,dmabuf_fd,handle) \ | |
| 126 | − CGS_OS_CALL(import_gpu_mem,dev,dmabuf_fd,handle) | |
| 127 | 110 | #define cgs_add_irq_source(dev,src_id,num_types,set,handler,private_data) \ |
| 128 | 111 | CGS_OS_CALL(add_irq_source,dev,src_id,num_types,set,handler, \ |
| 129 | 112 | private_data) |
| @@ -0,0 +1,41 @@ | ||
| 1 | +#if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) | |
| 2 | +#define _GPU_SCHED_TRACE_H_ | |
| 3 | + | |
| 4 | +#include <linux/stringify.h> | |
| 5 | +#include <linux/types.h> | |
| 6 | +#include <linux/tracepoint.h> | |
| 7 | + | |
| 8 | +#include <drm/drmP.h> | |
| 9 | + | |
| 10 | +#undef TRACE_SYSTEM | |
| 11 | +#define TRACE_SYSTEM gpu_sched | |
| 12 | +#define TRACE_INCLUDE_FILE gpu_sched_trace | |
| 13 | + | |
| 14 | +TRACE_EVENT(amd_sched_job, | |
| 15 | + TP_PROTO(struct amd_sched_job *sched_job), | |
| 16 | + TP_ARGS(sched_job), | |
| 17 | + TP_STRUCT__entry( | |
| 18 | + __field(struct amd_sched_entity *, entity) | |
| 19 | + __field(const char *, name) | |
| 20 | + __field(u32, job_count) | |
| 21 | + __field(int, hw_job_count) | |
| 22 | + ), | |
| 23 | + | |
| 24 | + TP_fast_assign( | |
| 25 | + __entry->entity = sched_job->s_entity; | |
| 26 | + __entry->name = sched_job->sched->name; | |
| 27 | + __entry->job_count = kfifo_len( | |
| 28 | + &sched_job->s_entity->job_queue) / sizeof(sched_job); | |
| 29 | + __entry->hw_job_count = atomic_read( | |
| 30 | + &sched_job->sched->hw_rq_count); | |
| 31 | + ), | |
| 32 | + TP_printk("entity=%p, ring=%s, job count:%u, hw job count:%d", | |
| 33 | + __entry->entity, __entry->name, __entry->job_count, | |
| 34 | + __entry->hw_job_count) | |
| 35 | +); | |
| 36 | +#endif | |
| 37 | + | |
| 38 | +/* This part must be outside protection */ | |
| 39 | +#undef TRACE_INCLUDE_PATH | |
| 40 | +#define TRACE_INCLUDE_PATH . | |
| 41 | +#include <trace/define_trace.h> | |
| @@ -27,6 +27,9 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <drm/drmP.h> |
| 28 | 28 | #include "gpu_scheduler.h" |
| 29 | 29 | |
| 30 | +#define CREATE_TRACE_POINTS | |
| 31 | +#include "gpu_sched_trace.h" | |
| 32 | + | |
| 30 | 33 | static struct amd_sched_job * |
| 31 | 34 | amd_sched_entity_pop_job(struct amd_sched_entity *entity); |
| 32 | 35 | static void amd_sched_wakeup(struct amd_gpu_scheduler *sched); |
| @@ -65,29 +68,29 @@ static struct amd_sched_job * · 32 unmodified lines | ||
| 65 | 68 | amd_sched_rq_select_job(struct amd_sched_rq *rq) |
| 66 | 69 | { |
| 67 | 70 | struct amd_sched_entity *entity; |
| 68 | − struct amd_sched_job *job; | |
| 71 | + struct amd_sched_job *sched_job; | |
| 69 | 72 | |
| 70 | 73 | spin_lock(&rq->lock); |
| 71 | 74 | |
| 72 | 75 | entity = rq->current_entity; |
| 73 | 76 | if (entity) { |
| 74 | 77 | list_for_each_entry_continue(entity, &rq->entities, list) { |
| 75 | − job = amd_sched_entity_pop_job(entity); | |
| 76 | − if (job) { | |
| 78 | + sched_job = amd_sched_entity_pop_job(entity); | |
| 79 | + if (sched_job) { | |
| 77 | 80 | rq->current_entity = entity; |
| 78 | 81 | spin_unlock(&rq->lock); |
| 79 | − return job; | |
| 82 | + return sched_job; | |
| 80 | 83 | } |
| 81 | 84 | } |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | list_for_each_entry(entity, &rq->entities, list) { |
| 85 | 88 | |
| 86 | − job = amd_sched_entity_pop_job(entity); | |
| 87 | − if (job) { | |
| 89 | + sched_job = amd_sched_entity_pop_job(entity); | |
| 90 | + if (sched_job) { | |
| 88 | 91 | rq->current_entity = entity; |
| 89 | 92 | spin_unlock(&rq->lock); |
| 90 | − return job; | |
| 93 | + return sched_job; | |
| 91 | 94 | } |
| 92 | 95 | |
| 93 | 96 | if (entity == rq->current_entity) |
| @@ -115,23 +118,27 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, · 21 unmodified lines | ||
| 115 | 118 | struct amd_sched_rq *rq, |
| 116 | 119 | uint32_t jobs) |
| 117 | 120 | { |
| 121 | + int r; | |
| 122 | + | |
| 118 | 123 | if (!(sched && entity && rq)) |
| 119 | 124 | return -EINVAL; |
| 120 | 125 | |
| 121 | 126 | memset(entity, 0, sizeof(struct amd_sched_entity)); |
| 122 | − entity->belongto_rq = rq; | |
| 123 | − entity->scheduler = sched; | |
| 124 | − entity->fence_context = fence_context_alloc(1); | |
| 125 | − if(kfifo_alloc(&entity->job_queue, | |
| 126 | − jobs * sizeof(void *), | |
| 127 | − GFP_KERNEL)) | |
| 128 | − return -EINVAL; | |
| 127 | + INIT_LIST_HEAD(&entity->list); | |
| 128 | + entity->rq = rq; | |
| 129 | + entity->sched = sched; | |
| 129 | 130 | |
| 130 | 131 | spin_lock_init(&entity->queue_lock); |
| 132 | + r = kfifo_alloc(&entity->job_queue, jobs * sizeof(void *), GFP_KERNEL); | |
| 133 | + if (r) | |
| 134 | + return r; | |
| 135 | + | |
| 131 | 136 | atomic_set(&entity->fence_seq, 0); |
| 137 | + entity->fence_context = fence_context_alloc(1); | |
| 132 | 138 | |
| 133 | 139 | /* Add the entity to the run queue */ |
| 134 | 140 | amd_sched_rq_add_entity(rq, entity); |
| 141 | + | |
| 135 | 142 | return 0; |
| 136 | 143 | } |
| 137 | 144 | |
| @@ -146,8 +153,8 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, · 8 unmodified lines | ||
| 146 | 153 | static bool amd_sched_entity_is_initialized(struct amd_gpu_scheduler *sched, |
| 147 | 154 | struct amd_sched_entity *entity) |
| 148 | 155 | { |
| 149 | − return entity->scheduler == sched && | |
| 150 | − entity->belongto_rq != NULL; | |
| 156 | + return entity->sched == sched && | |
| 157 | + entity->rq != NULL; | |
| 151 | 158 | } |
| 152 | 159 | |
| 153 | 160 | /** |
| @@ -177,7 +184,7 @@ static bool amd_sched_entity_is_idle(struct amd_sched_entity *entity) · 23 unmodified lines | ||
| 177 | 184 | void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, |
| 178 | 185 | struct amd_sched_entity *entity) |
| 179 | 186 | { |
| 180 | − struct amd_sched_rq *rq = entity->belongto_rq; | |
| 187 | + struct amd_sched_rq *rq = entity->rq; | |
| 181 | 188 | |
| 182 | 189 | if (!amd_sched_entity_is_initialized(sched, entity)) |
| 183 | 190 | return; |
| @@ -198,22 +205,22 @@ static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb) · 14 unmodified lines | ||
| 198 | 205 | container_of(cb, struct amd_sched_entity, cb); |
| 199 | 206 | entity->dependency = NULL; |
| 200 | 207 | fence_put(f); |
| 201 | − amd_sched_wakeup(entity->scheduler); | |
| 208 | + amd_sched_wakeup(entity->sched); | |
| 202 | 209 | } |
| 203 | 210 | |
| 204 | 211 | static struct amd_sched_job * |
| 205 | 212 | amd_sched_entity_pop_job(struct amd_sched_entity *entity) |
| 206 | 213 | { |
| 207 | − struct amd_gpu_scheduler *sched = entity->scheduler; | |
| 208 | − struct amd_sched_job *job; | |
| 214 | + struct amd_gpu_scheduler *sched = entity->sched; | |
| 215 | + struct amd_sched_job *sched_job; | |
| 209 | 216 | |
| 210 | 217 | if (ACCESS_ONCE(entity->dependency)) |
| 211 | 218 | return NULL; |
| 212 | 219 | |
| 213 | − if (!kfifo_out_peek(&entity->job_queue, &job, sizeof(job))) | |
| 220 | + if (!kfifo_out_peek(&entity->job_queue, &sched_job, sizeof(sched_job))) | |
| 214 | 221 | return NULL; |
| 215 | 222 | |
| 216 | − while ((entity->dependency = sched->ops->dependency(job))) { | |
| 223 | + while ((entity->dependency = sched->ops->dependency(sched_job))) { | |
| 217 | 224 | |
| 218 | 225 | if (fence_add_callback(entity->dependency, &entity->cb, |
| 219 | 226 | amd_sched_entity_wakeup)) |
| @@ -222,32 +229,33 @@ amd_sched_entity_pop_job(struct amd_sched_entity *entity) · 2 unmodified lines | ||
| 222 | 229 | return NULL; |
| 223 | 230 | } |
| 224 | 231 | |
| 225 | − return job; | |
| 232 | + return sched_job; | |
| 226 | 233 | } |
| 227 | 234 | |
| 228 | 235 | /** |
| 229 | 236 | * Helper to submit a job to the job queue |
| 230 | 237 | * |
| 231 | − * @job The pointer to job required to submit | |
| 238 | + * @sched_job The pointer to job required to submit | |
| 232 | 239 | * |
| 233 | 240 | * Returns true if we could submit the job. |
| 234 | 241 | */ |
| 235 | −static bool amd_sched_entity_in(struct amd_sched_job *job) | |
| 242 | +static bool amd_sched_entity_in(struct amd_sched_job *sched_job) | |
| 236 | 243 | { |
| 237 | − struct amd_sched_entity *entity = job->s_entity; | |
| 244 | + struct amd_sched_entity *entity = sched_job->s_entity; | |
| 238 | 245 | bool added, first = false; |
| 239 | 246 | |
| 240 | 247 | spin_lock(&entity->queue_lock); |
| 241 | − added = kfifo_in(&entity->job_queue, &job, sizeof(job)) == sizeof(job); | |
| 248 | + added = kfifo_in(&entity->job_queue, &sched_job, | |
| 249 | + sizeof(sched_job)) == sizeof(sched_job); | |
| 242 | 250 | |
| 243 | − if (added && kfifo_len(&entity->job_queue) == sizeof(job)) | |
| 251 | + if (added && kfifo_len(&entity->job_queue) == sizeof(sched_job)) | |
| 244 | 252 | first = true; |
| 245 | 253 | |
| 246 | 254 | spin_unlock(&entity->queue_lock); |
| 247 | 255 | |
| 248 | 256 | /* first job wakes up scheduler */ |
| 249 | 257 | if (first) |
| 250 | − amd_sched_wakeup(job->sched); | |
| 258 | + amd_sched_wakeup(sched_job->sched); | |
| 251 | 259 | |
| 252 | 260 | return added; |
| 253 | 261 | } |
| @@ -255,7 +263,7 @@ static bool amd_sched_entity_in(struct amd_sched_job *job) · 1 unmodified line | ||
| 255 | 263 | /** |
| 256 | 264 | * Submit a job to the job queue |
| 257 | 265 | * |
| 258 | − * @job The pointer to job required to submit | |
| 266 | + * @sched_job The pointer to job required to submit | |
| 259 | 267 | * |
| 260 | 268 | * Returns 0 for success, negative error code otherwise. |
| 261 | 269 | */ |
| @@ -271,9 +279,9 @@ int amd_sched_entity_push_job(struct amd_sched_job *sched_job) · 9 unmodified lines | ||
| 271 | 279 | fence_get(&fence->base); |
| 272 | 280 | sched_job->s_fence = fence; |
| 273 | 281 | |
| 274 | − wait_event(entity->scheduler->job_scheduled, | |
| 282 | + wait_event(entity->sched->job_scheduled, | |
| 275 | 283 | amd_sched_entity_in(sched_job)); |
| 276 | − | |
| 284 | + trace_amd_sched_job(sched_job); | |
| 277 | 285 | return 0; |
| 278 | 286 | } |
| 279 | 287 | |
| @@ -301,30 +309,28 @@ static void amd_sched_wakeup(struct amd_gpu_scheduler *sched) · 21 unmodified lines | ||
| 301 | 309 | static struct amd_sched_job * |
| 302 | 310 | amd_sched_select_job(struct amd_gpu_scheduler *sched) |
| 303 | 311 | { |
| 304 | − struct amd_sched_job *job; | |
| 312 | + struct amd_sched_job *sched_job; | |
| 305 | 313 | |
| 306 | 314 | if (!amd_sched_ready(sched)) |
| 307 | 315 | return NULL; |
| 308 | 316 | |
| 309 | 317 | /* Kernel run queue has higher priority than normal run queue*/ |
| 310 | − job = amd_sched_rq_select_job(&sched->kernel_rq); | |
| 311 | − if (job == NULL) | |
| 312 | − job = amd_sched_rq_select_job(&sched->sched_rq); | |
| 318 | + sched_job = amd_sched_rq_select_job(&sched->kernel_rq); | |
| 319 | + if (sched_job == NULL) | |
| 320 | + sched_job = amd_sched_rq_select_job(&sched->sched_rq); | |
| 313 | 321 | |
| 314 | − return job; | |
| 322 | + return sched_job; | |
| 315 | 323 | } |
| 316 | 324 | |
| 317 | 325 | static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) |
| 318 | 326 | { |
| 319 | − struct amd_sched_job *sched_job = | |
| 320 | − container_of(cb, struct amd_sched_job, cb); | |
| 321 | − struct amd_gpu_scheduler *sched; | |
| 327 | + struct amd_sched_fence *s_fence = | |
| 328 | + container_of(cb, struct amd_sched_fence, cb); | |
| 329 | + struct amd_gpu_scheduler *sched = s_fence->sched; | |
| 322 | 330 | |
| 323 | − sched = sched_job->sched; | |
| 324 | − amd_sched_fence_signal(sched_job->s_fence); | |
| 325 | 331 | atomic_dec(&sched->hw_rq_count); |
| 326 | − fence_put(&sched_job->s_fence->base); | |
| 327 | − sched->ops->process_job(sched_job); | |
| 332 | + amd_sched_fence_signal(s_fence); | |
| 333 | + fence_put(&s_fence->base); | |
| 328 | 334 | wake_up_interruptible(&sched->wake_up_worker); |
| 329 | 335 | } |
| 330 | 336 | |
| @@ -338,87 +344,82 @@ static int amd_sched_main(void *param) · 7 unmodified lines | ||
| 338 | 344 | |
| 339 | 345 | while (!kthread_should_stop()) { |
| 340 | 346 | struct amd_sched_entity *entity; |
| 341 | − struct amd_sched_job *job; | |
| 347 | + struct amd_sched_fence *s_fence; | |
| 348 | + struct amd_sched_job *sched_job; | |
| 342 | 349 | struct fence *fence; |
| 343 | 350 | |
| 344 | 351 | wait_event_interruptible(sched->wake_up_worker, |
| 345 | 352 | kthread_should_stop() || |
| 346 | − (job = amd_sched_select_job(sched))); | |
| 353 | + (sched_job = amd_sched_select_job(sched))); | |
| 347 | 354 | |
| 348 | − if (!job) | |
| 355 | + if (!sched_job) | |
| 349 | 356 | continue; |
| 350 | 357 | |
| 351 | − entity = job->s_entity; | |
| 358 | + entity = sched_job->s_entity; | |
| 359 | + s_fence = sched_job->s_fence; | |
| 352 | 360 | atomic_inc(&sched->hw_rq_count); |
| 353 | − fence = sched->ops->run_job(job); | |
| 361 | + fence = sched->ops->run_job(sched_job); | |
| 354 | 362 | if (fence) { |
| 355 | − r = fence_add_callback(fence, &job->cb, | |
| 363 | + r = fence_add_callback(fence, &s_fence->cb, | |
| 356 | 364 | amd_sched_process_job); |
| 357 | 365 | if (r == -ENOENT) |
| 358 | − amd_sched_process_job(fence, &job->cb); | |
| 366 | + amd_sched_process_job(fence, &s_fence->cb); | |
| 359 | 367 | else if (r) |
| 360 | 368 | DRM_ERROR("fence add callback failed (%d)\n", r); |
| 361 | 369 | fence_put(fence); |
| 370 | + } else { | |
| 371 | + DRM_ERROR("Failed to run job!\n"); | |
| 372 | + amd_sched_process_job(NULL, &s_fence->cb); | |
| 362 | 373 | } |
| 363 | 374 | |
| 364 | − count = kfifo_out(&entity->job_queue, &job, sizeof(job)); | |
| 365 | − WARN_ON(count != sizeof(job)); | |
| 375 | + count = kfifo_out(&entity->job_queue, &sched_job, | |
| 376 | + sizeof(sched_job)); | |
| 377 | + WARN_ON(count != sizeof(sched_job)); | |
| 366 | 378 | wake_up(&sched->job_scheduled); |
| 367 | 379 | } |
| 368 | 380 | return 0; |
| 369 | 381 | } |
| 370 | 382 | |
| 371 | 383 | /** |
| 372 | − * Create a gpu scheduler | |
| 384 | + * Init a gpu scheduler instance | |
| 373 | 385 | * |
| 386 | + * @sched The pointer to the scheduler | |
| 374 | 387 | * @ops The backend operations for this scheduler. |
| 375 | − * @ring The the ring id for the scheduler. | |
| 376 | 388 | * @hw_submissions Number of hw submissions to do. |
| 389 | + * @name Name used for debugging | |
| 377 | 390 | * |
| 378 | − * Return the pointer to scheduler for success, otherwise return NULL | |
| 391 | + * Return 0 on success, otherwise error code. | |
| 379 | 392 | */ |
| 380 | −struct amd_gpu_scheduler *amd_sched_create(struct amd_sched_backend_ops *ops, | |
| 381 | − unsigned ring, unsigned hw_submission, | |
| 382 | − void *priv) | |
| 393 | +int amd_sched_init(struct amd_gpu_scheduler *sched, | |
| 394 | + struct amd_sched_backend_ops *ops, | |
| 395 | + unsigned hw_submission, const char *name) | |
| 383 | 396 | { |
| 384 | − struct amd_gpu_scheduler *sched; | |
| 385 | − | |
| 386 | − sched = kzalloc(sizeof(struct amd_gpu_scheduler), GFP_KERNEL); | |
| 387 | − if (!sched) | |
| 388 | − return NULL; | |
| 389 | − | |
| 390 | 397 | sched->ops = ops; |
| 391 | − sched->ring_id = ring; | |
| 392 | 398 | sched->hw_submission_limit = hw_submission; |
| 393 | − sched->priv = priv; | |
| 394 | − snprintf(sched->name, sizeof(sched->name), "amdgpu[%d]", ring); | |
| 399 | + sched->name = name; | |
| 395 | 400 | amd_sched_rq_init(&sched->sched_rq); |
| 396 | 401 | amd_sched_rq_init(&sched->kernel_rq); |
| 397 | 402 | |
| 398 | 403 | init_waitqueue_head(&sched->wake_up_worker); |
| 399 | 404 | init_waitqueue_head(&sched->job_scheduled); |
| 400 | 405 | atomic_set(&sched->hw_rq_count, 0); |
| 406 | + | |
| 401 | 407 | /* Each scheduler will run on a seperate kernel thread */ |
| 402 | 408 | sched->thread = kthread_run(amd_sched_main, sched, sched->name); |
| 403 | 409 | if (IS_ERR(sched->thread)) { |
| 404 | − DRM_ERROR("Failed to create scheduler for id %d.\n", ring); | |
| 405 | − kfree(sched); | |
| 406 | − return NULL; | |
| 410 | + DRM_ERROR("Failed to create scheduler for %s.\n", name); | |
| 411 | + return PTR_ERR(sched->thread); | |
| 407 | 412 | } |
| 408 | 413 | |
| 409 | − return sched; | |
| 414 | + return 0; | |
| 410 | 415 | } |
| 411 | 416 | |
| 412 | 417 | /** |
| 413 | 418 | * Destroy a gpu scheduler |
| 414 | 419 | * |
| 415 | 420 | * @sched The pointer to the scheduler |
| 416 | − * | |
| 417 | − * return 0 if succeed. -1 if failed. | |
| 418 | 421 | */ |
| 419 | −int amd_sched_destroy(struct amd_gpu_scheduler *sched) | |
| 422 | +void amd_sched_fini(struct amd_gpu_scheduler *sched) | |
| 420 | 423 | { |
| 421 | 424 | kthread_stop(sched->thread); |
| 422 | − kfree(sched); | |
| 423 | − return 0; | |
| 424 | 425 | } |
| @@ -38,13 +38,15 @@ struct amd_sched_rq; · 37 unmodified lines | ||
| 38 | 38 | */ |
| 39 | 39 | struct amd_sched_entity { |
| 40 | 40 | struct list_head list; |
| 41 | − struct amd_sched_rq *belongto_rq; | |
| 42 | − atomic_t fence_seq; | |
| 43 | − /* the job_queue maintains the jobs submitted by clients */ | |
| 44 | − struct kfifo job_queue; | |
| 41 | + struct amd_sched_rq *rq; | |
| 42 | + struct amd_gpu_scheduler *sched; | |
| 43 | + | |
| 45 | 44 | spinlock_t queue_lock; |
| 46 | − struct amd_gpu_scheduler *scheduler; | |
| 45 | + struct kfifo job_queue; | |
| 46 | + | |
| 47 | + atomic_t fence_seq; | |
| 47 | 48 | uint64_t fence_context; |
| 49 | + | |
| 48 | 50 | struct fence *dependency; |
| 49 | 51 | struct fence_cb cb; |
| 50 | 52 | }; |
| @@ -62,13 +64,13 @@ struct amd_sched_rq { · 11 unmodified lines | ||
| 62 | 64 | |
| 63 | 65 | struct amd_sched_fence { |
| 64 | 66 | struct fence base; |
| 65 | − struct amd_gpu_scheduler *scheduler; | |
| 67 | + struct fence_cb cb; | |
| 68 | + struct amd_gpu_scheduler *sched; | |
| 66 | 69 | spinlock_t lock; |
| 67 | 70 | void *owner; |
| 68 | 71 | }; |
| 69 | 72 | |
| 70 | 73 | struct amd_sched_job { |
| 71 | − struct fence_cb cb; | |
| 72 | 74 | struct amd_gpu_scheduler *sched; |
| 73 | 75 | struct amd_sched_entity *s_entity; |
| 74 | 76 | struct amd_sched_fence *s_fence; |
| @@ -91,32 +93,29 @@ static inline struct amd_sched_fence *to_amd_sched_fence(struct fence *f) · 16 unmodified lines | ||
| 91 | 93 | * these functions should be implemented in driver side |
| 92 | 94 | */ |
| 93 | 95 | struct amd_sched_backend_ops { |
| 94 | − struct fence *(*dependency)(struct amd_sched_job *job); | |
| 95 | − struct fence *(*run_job)(struct amd_sched_job *job); | |
| 96 | − void (*process_job)(struct amd_sched_job *job); | |
| 96 | + struct fence *(*dependency)(struct amd_sched_job *sched_job); | |
| 97 | + struct fence *(*run_job)(struct amd_sched_job *sched_job); | |
| 97 | 98 | }; |
| 98 | 99 | |
| 99 | 100 | /** |
| 100 | 101 | * One scheduler is implemented for each hardware ring |
| 101 | 102 | */ |
| 102 | 103 | struct amd_gpu_scheduler { |
| 103 | − struct task_struct *thread; | |
| 104 | + struct amd_sched_backend_ops *ops; | |
| 105 | + uint32_t hw_submission_limit; | |
| 106 | + const char *name; | |
| 104 | 107 | struct amd_sched_rq sched_rq; |
| 105 | 108 | struct amd_sched_rq kernel_rq; |
| 106 | − atomic_t hw_rq_count; | |
| 107 | − struct amd_sched_backend_ops *ops; | |
| 108 | − uint32_t ring_id; | |
| 109 | 109 | wait_queue_head_t wake_up_worker; |
| 110 | 110 | wait_queue_head_t job_scheduled; |
| 111 | − uint32_t hw_submission_limit; | |
| 112 | − char name[20]; | |
| 113 | − void *priv; | |
| 111 | + atomic_t hw_rq_count; | |
| 112 | + struct task_struct *thread; | |
| 114 | 113 | }; |
| 115 | 114 | |
| 116 | −struct amd_gpu_scheduler * | |
| 117 | −amd_sched_create(struct amd_sched_backend_ops *ops, | |
| 118 | − uint32_t ring, uint32_t hw_submission, void *priv); | |
| 119 | −int amd_sched_destroy(struct amd_gpu_scheduler *sched); | |
| 115 | +int amd_sched_init(struct amd_gpu_scheduler *sched, | |
| 116 | + struct amd_sched_backend_ops *ops, | |
| 117 | + uint32_t hw_submission, const char *name); | |
| 118 | +void amd_sched_fini(struct amd_gpu_scheduler *sched); | |
| 120 | 119 | |
| 121 | 120 | int amd_sched_entity_init(struct amd_gpu_scheduler *sched, |
| 122 | 121 | struct amd_sched_entity *entity, |
| @@ -36,7 +36,7 @@ struct amd_sched_fence *amd_sched_fence_create(struct amd_sched_entity *s_entity · 35 unmodified lines | ||
| 36 | 36 | if (fence == NULL) |
| 37 | 37 | return NULL; |
| 38 | 38 | fence->owner = owner; |
| 39 | − fence->scheduler = s_entity->scheduler; | |
| 39 | + fence->sched = s_entity->sched; | |
| 40 | 40 | spin_lock_init(&fence->lock); |
| 41 | 41 | |
| 42 | 42 | seq = atomic_inc_return(&s_entity->fence_seq); |
| @@ -63,7 +63,7 @@ static const char *amd_sched_fence_get_driver_name(struct fence *fence) · 20 unmodified lines | ||
| 63 | 63 | static const char *amd_sched_fence_get_timeline_name(struct fence *f) |
| 64 | 64 | { |
| 65 | 65 | struct amd_sched_fence *fence = to_amd_sched_fence(f); |
| 66 | − return (const char *)fence->scheduler->name; | |
| 66 | + return (const char *)fence->sched->name; | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | static bool amd_sched_fence_enable_signaling(struct fence *f) |
| @@ -53,8 +53,8 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr, · 52 unmodified lines | ||
| 53 | 53 | struct drm_dp_mst_port *port, |
| 54 | 54 | int offset, int size, u8 *bytes); |
| 55 | 55 | |
| 56 | −static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, | |
| 57 | − struct drm_dp_mst_branch *mstb); | |
| 56 | +static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, | |
| 57 | + struct drm_dp_mst_branch *mstb); | |
| 58 | 58 | static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, |
| 59 | 59 | struct drm_dp_mst_branch *mstb, |
| 60 | 60 | struct drm_dp_mst_port *port); |
| @@ -804,8 +804,6 @@ static void drm_dp_destroy_mst_branch_device(struct kref *kref) · 743 unmodified lines | ||
| 804 | 804 | struct drm_dp_mst_port *port, *tmp; |
| 805 | 805 | bool wake_tx = false; |
| 806 | 806 | |
| 807 | − cancel_work_sync(&mstb->mgr->work); | |
| 808 | − | |
| 809 | 807 | /* |
| 810 | 808 | * destroy all ports - don't need lock |
| 811 | 809 | * as there are no more references to the mst branch |
| @@ -863,29 +861,33 @@ static void drm_dp_destroy_port(struct kref *kref) · 51 unmodified lines | ||
| 863 | 861 | { |
| 864 | 862 | struct drm_dp_mst_port *port = container_of(kref, struct drm_dp_mst_port, kref); |
| 865 | 863 | struct drm_dp_mst_topology_mgr *mgr = port->mgr; |
| 864 | + | |
| 866 | 865 | if (!port->input) { |
| 867 | 866 | port->vcpi.num_slots = 0; |
| 868 | 867 | |
| 869 | 868 | kfree(port->cached_edid); |
| 870 | 869 | |
| 871 | − /* we can't destroy the connector here, as | |
| 872 | − we might be holding the mode_config.mutex | |
| 873 | − from an EDID retrieval */ | |
| 870 | + /* | |
| 871 | + * The only time we don't have a connector | |
| 872 | + * on an output port is if the connector init | |
| 873 | + * fails. | |
| 874 | + */ | |
| 874 | 875 | if (port->connector) { |
| 876 | + /* we can't destroy the connector here, as | |
| 877 | + * we might be holding the mode_config.mutex | |
| 878 | + * from an EDID retrieval */ | |
| 879 | + | |
| 875 | 880 | mutex_lock(&mgr->destroy_connector_lock); |
| 876 | 881 | list_add(&port->next, &mgr->destroy_connector_list); |
| 877 | 882 | mutex_unlock(&mgr->destroy_connector_lock); |
| 878 | 883 | schedule_work(&mgr->destroy_connector_work); |
| 879 | 884 | return; |
| 880 | 885 | } |
| 886 | + /* no need to clean up vcpi | |
| 887 | + * as if we have no connector we never setup a vcpi */ | |
| 881 | 888 | drm_dp_port_teardown_pdt(port, port->pdt); |
| 882 | − | |
| 883 | − if (!port->input && port->vcpi.vcpi > 0) | |
| 884 | − drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); | |
| 885 | 889 | } |
| 886 | 890 | kfree(port); |
| 887 | − | |
| 888 | − (*mgr->cbs->hotplug)(mgr); | |
| 889 | 891 | } |
| 890 | 892 | |
| 891 | 893 | static void drm_dp_put_port(struct drm_dp_mst_port *port) |
| @@ -1027,8 +1029,8 @@ static void drm_dp_check_port_guid(struct drm_dp_mst_branch *mstb, · 135 unmodified lines | ||
| 1027 | 1029 | } |
| 1028 | 1030 | } |
| 1029 | 1031 | |
| 1030 | −static void build_mst_prop_path(struct drm_dp_mst_port *port, | |
| 1031 | − struct drm_dp_mst_branch *mstb, | |
| 1032 | +static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb, | |
| 1033 | + int pnum, | |
| 1032 | 1034 | char *proppath, |
| 1033 | 1035 | size_t proppath_size) |
| 1034 | 1036 | { |
| @@ -1041,7 +1043,7 @@ static void build_mst_prop_path(struct drm_dp_mst_port *port, · 6 unmodified lines | ||
| 1041 | 1043 | snprintf(temp, sizeof(temp), "-%d", port_num); |
| 1042 | 1044 | strlcat(proppath, temp, proppath_size); |
| 1043 | 1045 | } |
| 1044 | − snprintf(temp, sizeof(temp), "-%d", port->port_num); | |
| 1046 | + snprintf(temp, sizeof(temp), "-%d", pnum); | |
| 1045 | 1047 | strlcat(proppath, temp, proppath_size); |
| 1046 | 1048 | } |
| 1047 | 1049 | |
| @@ -1105,22 +1107,32 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, · 57 unmodified lines | ||
| 1105 | 1107 | drm_dp_port_teardown_pdt(port, old_pdt); |
| 1106 | 1108 | |
| 1107 | 1109 | ret = drm_dp_port_setup_pdt(port); |
| 1108 | − if (ret == true) { | |
| 1110 | + if (ret == true) | |
| 1109 | 1111 | drm_dp_send_link_address(mstb->mgr, port->mstb); |
| 1110 | − port->mstb->link_address_sent = true; | |
| 1111 | − } | |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | if (created && !port->input) { |
| 1115 | 1115 | char proppath[255]; |
| 1116 | − build_mst_prop_path(port, mstb, proppath, sizeof(proppath)); | |
| 1117 | − port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath); | |
| 1118 | 1116 | |
| 1119 | − if (port->port_num >= 8) { | |
| 1117 | + build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath)); | |
| 1118 | + port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath); | |
| 1119 | + if (!port->connector) { | |
| 1120 | + /* remove it from the port list */ | |
| 1121 | + mutex_lock(&mstb->mgr->lock); | |
| 1122 | + list_del(&port->next); | |
| 1123 | + mutex_unlock(&mstb->mgr->lock); | |
| 1124 | + /* drop port list reference */ | |
| 1125 | + drm_dp_put_port(port); | |
| 1126 | + goto out; | |
| 1127 | + } | |
| 1128 | + if (port->port_num >= DP_MST_LOGICAL_PORT_0) { | |
| 1120 | 1129 | port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); |
| 1130 | + drm_mode_connector_set_tile_property(port->connector); | |
| 1121 | 1131 | } |
| 1132 | + (*mstb->mgr->cbs->register_connector)(port->connector); | |
| 1122 | 1133 | } |
| 1123 | 1134 | |
| 1135 | +out: | |
| 1124 | 1136 | /* put reference to this port */ |
| 1125 | 1137 | drm_dp_put_port(port); |
| 1126 | 1138 | } |
| @@ -1202,10 +1214,9 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m · 75 unmodified lines | ||
| 1202 | 1214 | { |
| 1203 | 1215 | struct drm_dp_mst_port *port; |
| 1204 | 1216 | struct drm_dp_mst_branch *mstb_child; |
| 1205 | − if (!mstb->link_address_sent) { | |
| 1217 | + if (!mstb->link_address_sent) | |
| 1206 | 1218 | drm_dp_send_link_address(mgr, mstb); |
| 1207 | − mstb->link_address_sent = true; | |
| 1208 | − } | |
| 1219 | + | |
| 1209 | 1220 | list_for_each_entry(port, &mstb->ports, next) { |
| 1210 | 1221 | if (port->input) |
| 1211 | 1222 | continue; |
| @@ -1458,8 +1469,8 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, · 246 unmodified lines | ||
| 1458 | 1469 | mutex_unlock(&mgr->qlock); |
| 1459 | 1470 | } |
| 1460 | 1471 | |
| 1461 | −static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, | |
| 1462 | − struct drm_dp_mst_branch *mstb) | |
| 1472 | +static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, | |
| 1473 | + struct drm_dp_mst_branch *mstb) | |
| 1463 | 1474 | { |
| 1464 | 1475 | int len; |
| 1465 | 1476 | struct drm_dp_sideband_msg_tx *txmsg; |
| @@ -1467,11 +1478,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · 1 unmodified line | ||
| 1467 | 1478 | |
| 1468 | 1479 | txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); |
| 1469 | 1480 | if (!txmsg) |
| 1470 | − return -ENOMEM; | |
| 1481 | + return; | |
| 1471 | 1482 | |
| 1472 | 1483 | txmsg->dst = mstb; |
| 1473 | 1484 | len = build_link_address(txmsg); |
| 1474 | 1485 | |
| 1486 | + mstb->link_address_sent = true; | |
| 1475 | 1487 | drm_dp_queue_down_tx(mgr, txmsg); |
| 1476 | 1488 | |
| 1477 | 1489 | ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); |
| @@ -1499,11 +1511,12 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, · 21 unmodified lines | ||
| 1499 | 1511 | } |
| 1500 | 1512 | (*mgr->cbs->hotplug)(mgr); |
| 1501 | 1513 | } |
| 1502 | − } else | |
| 1514 | + } else { | |
| 1515 | + mstb->link_address_sent = false; | |
| 1503 | 1516 | DRM_DEBUG_KMS("link address failed %d\n", ret); |
| 1517 | + } | |
| 1504 | 1518 | |
| 1505 | 1519 | kfree(txmsg); |
| 1506 | − return 0; | |
| 1507 | 1520 | } |
| 1508 | 1521 | |
| 1509 | 1522 | static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, |
| @@ -1978,6 +1991,8 @@ void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr) · 468 unmodified lines | ||
| 1978 | 1991 | drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, |
| 1979 | 1992 | DP_MST_EN | DP_UPSTREAM_IS_SRC); |
| 1980 | 1993 | mutex_unlock(&mgr->lock); |
| 1994 | + flush_work(&mgr->work); | |
| 1995 | + flush_work(&mgr->destroy_connector_work); | |
| 1981 | 1996 | } |
| 1982 | 1997 | EXPORT_SYMBOL(drm_dp_mst_topology_mgr_suspend); |
| 1983 | 1998 | |
| @@ -2263,10 +2278,10 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_ · 279 unmodified lines | ||
| 2263 | 2278 | |
| 2264 | 2279 | if (port->cached_edid) |
| 2265 | 2280 | edid = drm_edid_duplicate(port->cached_edid); |
| 2266 | − else | |
| 2281 | + else { | |
| 2267 | 2282 | edid = drm_get_edid(connector, &port->aux.ddc); |
| 2268 | − | |
| 2269 | − drm_mode_connector_set_tile_property(connector); | |
| 2283 | + drm_mode_connector_set_tile_property(connector); | |
| 2284 | + } | |
| 2270 | 2285 | drm_dp_put_port(port); |
| 2271 | 2286 | return edid; |
| 2272 | 2287 | } |
| @@ -2671,7 +2686,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) · 398 unmodified lines | ||
| 2671 | 2686 | { |
| 2672 | 2687 | struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); |
| 2673 | 2688 | struct drm_dp_mst_port *port; |
| 2674 | − | |
| 2689 | + bool send_hotplug = false; | |
| 2675 | 2690 | /* |
| 2676 | 2691 | * Not a regular list traverse as we have to drop the destroy |
| 2677 | 2692 | * connector lock before destroying the connector, to avoid AB->BA |
| @@ -2694,7 +2709,10 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) · 16 unmodified lines | ||
| 2694 | 2709 | if (!port->input && port->vcpi.vcpi > 0) |
| 2695 | 2710 | drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); |
| 2696 | 2711 | kfree(port); |
| 2712 | + send_hotplug = true; | |
| 2697 | 2713 | } |
| 2714 | + if (send_hotplug) | |
| 2715 | + (*mgr->cbs->hotplug)(mgr); | |
| 2698 | 2716 | } |
| 2699 | 2717 | |
| 2700 | 2718 | /** |
| @@ -2747,6 +2765,7 @@ EXPORT_SYMBOL(drm_dp_mst_topology_mgr_init); · 46 unmodified lines | ||
| 2747 | 2765 | */ |
| 2748 | 2766 | void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr) |
| 2749 | 2767 | { |
| 2768 | + flush_work(&mgr->work); | |
| 2750 | 2769 | flush_work(&mgr->destroy_connector_work); |
| 2751 | 2770 | mutex_lock(&mgr->payload_lock); |
| 2752 | 2771 | kfree(mgr->payloads); |
| @@ -345,7 +345,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) · 344 unmodified lines | ||
| 345 | 345 | struct drm_crtc *crtc = mode_set->crtc; |
| 346 | 346 | int ret; |
| 347 | 347 | |
| 348 | − if (crtc->funcs->cursor_set) { | |
| 348 | + if (crtc->funcs->cursor_set2) { | |
| 349 | + ret = crtc->funcs->cursor_set2(crtc, NULL, 0, 0, 0, 0, 0); | |
| 350 | + if (ret) | |
| 351 | + error = true; | |
| 352 | + } else if (crtc->funcs->cursor_set) { | |
| 349 | 353 | ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0); |
| 350 | 354 | if (ret) |
| 351 | 355 | error = true; |
| @@ -520,7 +520,8 @@ EXPORT_SYMBOL(drm_ioctl_permit); · 519 unmodified lines | ||
| 520 | 520 | |
| 521 | 521 | /** Ioctl table */ |
| 522 | 522 | static const struct drm_ioctl_desc drm_ioctls[] = { |
| 523 | − DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED|DRM_RENDER_ALLOW), | |
| 523 | + DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, | |
| 524 | + DRM_UNLOCKED|DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW), | |
| 524 | 525 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), |
| 525 | 526 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), |
| 526 | 527 | DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), |
| @@ -94,7 +94,18 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector) · 93 unmodified lines | ||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | #define DRM_OUTPUT_POLL_PERIOD (10*HZ) |
| 97 | −static void __drm_kms_helper_poll_enable(struct drm_device *dev) | |
| 97 | +/** | |
| 98 | + * drm_kms_helper_poll_enable_locked - re-enable output polling. | |
| 99 | + * @dev: drm_device | |
| 100 | + * | |
| 101 | + * This function re-enables the output polling work without | |
| 102 | + * locking the mode_config mutex. | |
| 103 | + * | |
| 104 | + * This is like drm_kms_helper_poll_enable() however it is to be | |
| 105 | + * called from a context where the mode_config mutex is locked | |
| 106 | + * already. | |
| 107 | + */ | |
| 108 | +void drm_kms_helper_poll_enable_locked(struct drm_device *dev) | |
| 98 | 109 | { |
| 99 | 110 | bool poll = false; |
| 100 | 111 | struct drm_connector *connector; |
| @@ -113,6 +124,8 @@ static void __drm_kms_helper_poll_enable(struct drm_device *dev) · 12 unmodified lines | ||
| 113 | 124 | if (poll) |
| 114 | 125 | schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); |
| 115 | 126 | } |
| 127 | +EXPORT_SYMBOL(drm_kms_helper_poll_enable_locked); | |
| 128 | + | |
| 116 | 129 | |
| 117 | 130 | static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connector *connector, |
| 118 | 131 | uint32_t maxX, uint32_t maxY, bool merge_type_bits) |
| @@ -174,7 +187,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect · 55 unmodified lines | ||
| 174 | 187 | |
| 175 | 188 | /* Re-enable polling in case the global poll config changed. */ |
| 176 | 189 | if (drm_kms_helper_poll != dev->mode_config.poll_running) |
| 177 | − __drm_kms_helper_poll_enable(dev); | |
| 190 | + drm_kms_helper_poll_enable_locked(dev); | |
| 178 | 191 | |
| 179 | 192 | dev->mode_config.poll_running = drm_kms_helper_poll; |
| 180 | 193 | |
| @@ -428,7 +441,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_disable); · 247 unmodified lines | ||
| 428 | 441 | void drm_kms_helper_poll_enable(struct drm_device *dev) |
| 429 | 442 | { |
| 430 | 443 | mutex_lock(&dev->mode_config.mutex); |
| 431 | − __drm_kms_helper_poll_enable(dev); | |
| 444 | + drm_kms_helper_poll_enable_locked(dev); | |
| 432 | 445 | mutex_unlock(&dev->mode_config.mutex); |
| 433 | 446 | } |
| 434 | 447 | EXPORT_SYMBOL(drm_kms_helper_poll_enable); |
| @@ -37,7 +37,6 @@ · 36 unmodified lines | ||
| 37 | 37 | * DECON stands for Display and Enhancement controller. |
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | −#define DECON_DEFAULT_FRAMERATE 60 | |
| 41 | 40 | #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 |
| 42 | 41 | |
| 43 | 42 | #define WINDOWS_NR 2 |
| @@ -165,16 +164,6 @@ static u32 decon_calc_clkdiv(struct decon_context *ctx, · 121 unmodified lines | ||
| 165 | 164 | return (clkdiv < 0x100) ? clkdiv : 0xff; |
| 166 | 165 | } |
| 167 | 166 | |
| 168 | −static bool decon_mode_fixup(struct exynos_drm_crtc *crtc, | |
| 169 | − const struct drm_display_mode *mode, | |
| 170 | − struct drm_display_mode *adjusted_mode) | |
| 171 | −{ | |
| 172 | − if (adjusted_mode->vrefresh == 0) | |
| 173 | − adjusted_mode->vrefresh = DECON_DEFAULT_FRAMERATE; | |
| 174 | − | |
| 175 | − return true; | |
| 176 | −} | |
| 177 | − | |
| 178 | 167 | static void decon_commit(struct exynos_drm_crtc *crtc) |
| 179 | 168 | { |
| 180 | 169 | struct decon_context *ctx = crtc->ctx; |
| @@ -637,7 +626,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc) · 456 unmodified lines | ||
| 637 | 626 | static const struct exynos_drm_crtc_ops decon_crtc_ops = { |
| 638 | 627 | .enable = decon_enable, |
| 639 | 628 | .disable = decon_disable, |
| 640 | − .mode_fixup = decon_mode_fixup, | |
| 641 | 629 | .commit = decon_commit, |
| 642 | 630 | .enable_vblank = decon_enable_vblank, |
| 643 | 631 | .disable_vblank = decon_disable_vblank, |
| @@ -1383,28 +1383,6 @@ static int exynos_dp_remove(struct platform_device *pdev) · 1382 unmodified lines | ||
| 1383 | 1383 | return 0; |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | −#ifdef CONFIG_PM_SLEEP | |
| 1387 | −static int exynos_dp_suspend(struct device *dev) | |
| 1388 | −{ | |
| 1389 | − struct exynos_dp_device *dp = dev_get_drvdata(dev); | |
| 1390 | − | |
| 1391 | − exynos_dp_disable(&dp->encoder); | |
| 1392 | − return 0; | |
| 1393 | −} | |
| 1394 | − | |
| 1395 | −static int exynos_dp_resume(struct device *dev) | |
| 1396 | −{ | |
| 1397 | − struct exynos_dp_device *dp = dev_get_drvdata(dev); | |
| 1398 | − | |
| 1399 | − exynos_dp_enable(&dp->encoder); | |
| 1400 | − return 0; | |
| 1401 | −} | |
| 1402 | −#endif | |
| 1403 | − | |
| 1404 | −static const struct dev_pm_ops exynos_dp_pm_ops = { | |
| 1405 | − SET_SYSTEM_SLEEP_PM_OPS(exynos_dp_suspend, exynos_dp_resume) | |
| 1406 | −}; | |
| 1407 | − | |
| 1408 | 1386 | static const struct of_device_id exynos_dp_match[] = { |
| 1409 | 1387 | { .compatible = "samsung,exynos5-dp" }, |
| 1410 | 1388 | {}, |
| @@ -1417,7 +1395,6 @@ struct platform_driver dp_driver = { · 6 unmodified lines | ||
| 1417 | 1395 | .driver = { |
| 1418 | 1396 | .name = "exynos-dp", |
| 1419 | 1397 | .owner = THIS_MODULE, |
| 1420 | − .pm = &exynos_dp_pm_ops, | |
| 1421 | 1398 | .of_match_table = exynos_dp_match, |
| 1422 | 1399 | }, |
| 1423 | 1400 | }; |
| @@ -28,7 +28,6 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv) · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | return 0; |
| 30 | 30 | } |
| 31 | −EXPORT_SYMBOL_GPL(exynos_drm_subdrv_register); | |
| 32 | 31 | |
| 33 | 32 | int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv) |
| 34 | 33 | { |
| @@ -39,7 +38,6 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv) · 4 unmodified lines | ||
| 39 | 38 | |
| 40 | 39 | return 0; |
| 41 | 40 | } |
| 42 | −EXPORT_SYMBOL_GPL(exynos_drm_subdrv_unregister); | |
| 43 | 41 | |
| 44 | 42 | int exynos_drm_device_subdrv_probe(struct drm_device *dev) |
| 45 | 43 | { |
| @@ -69,7 +67,6 @@ int exynos_drm_device_subdrv_probe(struct drm_device *dev) · 23 unmodified lines | ||
| 69 | 67 | |
| 70 | 68 | return 0; |
| 71 | 69 | } |
| 72 | −EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_probe); | |
| 73 | 70 | |
| 74 | 71 | int exynos_drm_device_subdrv_remove(struct drm_device *dev) |
| 75 | 72 | { |
| @@ -87,7 +84,6 @@ int exynos_drm_device_subdrv_remove(struct drm_device *dev) · 11 unmodified lines | ||
| 87 | 84 | |
| 88 | 85 | return 0; |
| 89 | 86 | } |
| 90 | −EXPORT_SYMBOL_GPL(exynos_drm_device_subdrv_remove); | |
| 91 | 87 | |
| 92 | 88 | int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) |
| 93 | 89 | { |
| @@ -111,7 +107,6 @@ err: · 17 unmodified lines | ||
| 111 | 107 | } |
| 112 | 108 | return ret; |
| 113 | 109 | } |
| 114 | −EXPORT_SYMBOL_GPL(exynos_drm_subdrv_open); | |
| 115 | 110 | |
| 116 | 111 | void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) |
| 117 | 112 | { |
| @@ -122,4 +117,3 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) · 4 unmodified lines | ||
| 122 | 117 | subdrv->close(dev, subdrv->dev, file); |
| 123 | 118 | } |
| 124 | 119 | } |
| 125 | −EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | |
| @@ -41,20 +41,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) · 40 unmodified lines | ||
| 41 | 41 | exynos_crtc->ops->disable(exynos_crtc); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | −static bool | |
| 45 | −exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc, | |
| 46 | − const struct drm_display_mode *mode, | |
| 47 | − struct drm_display_mode *adjusted_mode) | |
| 48 | −{ | |
| 49 | − struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); | |
| 50 | − | |
| 51 | − if (exynos_crtc->ops->mode_fixup) | |
| 52 | − return exynos_crtc->ops->mode_fixup(exynos_crtc, mode, | |
| 53 | − adjusted_mode); | |
| 54 | − | |
| 55 | − return true; | |
| 56 | −} | |
| 57 | − | |
| 58 | 44 | static void |
| 59 | 45 | exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) |
| 60 | 46 | { |
| @@ -99,7 +85,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, · 38 unmodified lines | ||
| 99 | 85 | static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { |
| 100 | 86 | .enable = exynos_drm_crtc_enable, |
| 101 | 87 | .disable = exynos_drm_crtc_disable, |
| 102 | − .mode_fixup = exynos_drm_crtc_mode_fixup, | |
| 103 | 88 | .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, |
| 104 | 89 | .atomic_begin = exynos_crtc_atomic_begin, |
| 105 | 90 | .atomic_flush = exynos_crtc_atomic_flush, |
| @@ -304,6 +304,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, · 303 unmodified lines | ||
| 304 | 304 | return 0; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | +#ifdef CONFIG_PM_SLEEP | |
| 307 | 308 | static int exynos_drm_suspend(struct drm_device *dev, pm_message_t state) |
| 308 | 309 | { |
| 309 | 310 | struct drm_connector *connector; |
| @@ -340,6 +341,7 @@ static int exynos_drm_resume(struct drm_device *dev) · 30 unmodified lines | ||
| 340 | 341 | |
| 341 | 342 | return 0; |
| 342 | 343 | } |
| 344 | +#endif | |
| 343 | 345 | |
| 344 | 346 | static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) |
| 345 | 347 | { |
| @@ -82,7 +82,6 @@ struct exynos_drm_plane { · 81 unmodified lines | ||
| 82 | 82 | * |
| 83 | 83 | * @enable: enable the device |
| 84 | 84 | * @disable: disable the device |
| 85 | − * @mode_fixup: fix mode data before applying it | |
| 86 | 85 | * @commit: set current hw specific display mode to hw. |
| 87 | 86 | * @enable_vblank: specific driver callback for enabling vblank interrupt. |
| 88 | 87 | * @disable_vblank: specific driver callback for disabling vblank interrupt. |
| @@ -103,9 +102,6 @@ struct exynos_drm_crtc; · 14 unmodified lines | ||
| 103 | 102 | struct exynos_drm_crtc_ops { |
| 104 | 103 | void (*enable)(struct exynos_drm_crtc *crtc); |
| 105 | 104 | void (*disable)(struct exynos_drm_crtc *crtc); |
| 106 | − bool (*mode_fixup)(struct exynos_drm_crtc *crtc, | |
| 107 | − const struct drm_display_mode *mode, | |
| 108 | − struct drm_display_mode *adjusted_mode); | |
| 109 | 105 | void (*commit)(struct exynos_drm_crtc *crtc); |
| 110 | 106 | int (*enable_vblank)(struct exynos_drm_crtc *crtc); |
| 111 | 107 | void (*disable_vblank)(struct exynos_drm_crtc *crtc); |
| @@ -1206,23 +1206,6 @@ static struct exynos_drm_ipp_ops fimc_dst_ops = { · 1205 unmodified lines | ||
| 1206 | 1206 | .set_addr = fimc_dst_set_addr, |
| 1207 | 1207 | }; |
| 1208 | 1208 | |
| 1209 | −static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable) | |
| 1210 | −{ | |
| 1211 | − DRM_DEBUG_KMS("enable[%d]\n", enable); | |
| 1212 | − | |
| 1213 | − if (enable) { | |
| 1214 | − clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]); | |
| 1215 | − clk_prepare_enable(ctx->clocks[FIMC_CLK_WB_A]); | |
| 1216 | − ctx->suspended = false; | |
| 1217 | − } else { | |
| 1218 | − clk_disable_unprepare(ctx->clocks[FIMC_CLK_GATE]); | |
| 1219 | − clk_disable_unprepare(ctx->clocks[FIMC_CLK_WB_A]); | |
| 1220 | − ctx->suspended = true; | |
| 1221 | − } | |
| 1222 | − | |
| 1223 | − return 0; | |
| 1224 | −} | |
| 1225 | − | |
| 1226 | 1209 | static irqreturn_t fimc_irq_handler(int irq, void *dev_id) |
| 1227 | 1210 | { |
| 1228 | 1211 | struct fimc_context *ctx = dev_id; |
| @@ -1780,6 +1763,24 @@ static int fimc_remove(struct platform_device *pdev) · 551 unmodified lines | ||
| 1780 | 1763 | return 0; |
| 1781 | 1764 | } |
| 1782 | 1765 | |
| 1766 | +#ifdef CONFIG_PM | |
| 1767 | +static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable) | |
| 1768 | +{ | |
| 1769 | + DRM_DEBUG_KMS("enable[%d]\n", enable); | |
| 1770 | + | |
| 1771 | + if (enable) { | |
| 1772 | + clk_prepare_enable(ctx->clocks[FIMC_CLK_GATE]); | |
| 1773 | + clk_prepare_enable(ctx->clocks[FIMC_CLK_WB_A]); | |
| 1774 | + ctx->suspended = false; | |
| 1775 | + } else { | |
| 1776 | + clk_disable_unprepare(ctx->clocks[FIMC_CLK_GATE]); | |
| 1777 | + clk_disable_unprepare(ctx->clocks[FIMC_CLK_WB_A]); | |
| 1778 | + ctx->suspended = true; | |
| 1779 | + } | |
| 1780 | + | |
| 1781 | + return 0; | |
| 1782 | +} | |
| 1783 | + | |
| 1783 | 1784 | #ifdef CONFIG_PM_SLEEP |
| 1784 | 1785 | static int fimc_suspend(struct device *dev) |
| 1785 | 1786 | { |
| @@ -1806,7 +1807,6 @@ static int fimc_resume(struct device *dev) · 20 unmodified lines | ||
| 1806 | 1807 | } |
| 1807 | 1808 | #endif |
| 1808 | 1809 | |
| 1809 | −#ifdef CONFIG_PM | |
| 1810 | 1810 | static int fimc_runtime_suspend(struct device *dev) |
| 1811 | 1811 | { |
| 1812 | 1812 | struct fimc_context *ctx = get_fimc_context(dev); |
| @@ -41,7 +41,6 @@ · 40 unmodified lines | ||
| 41 | 41 | * CPU Interface. |
| 42 | 42 | */ |
| 43 | 43 | |
| 44 | −#define FIMD_DEFAULT_FRAMERATE 60 | |
| 45 | 44 | #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 |
| 46 | 45 | |
| 47 | 46 | /* position control register for hardware window 0, 2 ~ 4.*/ |
| @@ -377,16 +376,6 @@ static u32 fimd_calc_clkdiv(struct fimd_context *ctx, · 329 unmodified lines | ||
| 377 | 376 | return (clkdiv < 0x100) ? clkdiv : 0xff; |
| 378 | 377 | } |
| 379 | 378 | |
| 380 | −static bool fimd_mode_fixup(struct exynos_drm_crtc *crtc, | |
| 381 | − const struct drm_display_mode *mode, | |
| 382 | − struct drm_display_mode *adjusted_mode) | |
| 383 | −{ | |
| 384 | − if (adjusted_mode->vrefresh == 0) | |
| 385 | − adjusted_mode->vrefresh = FIMD_DEFAULT_FRAMERATE; | |
| 386 | − | |
| 387 | − return true; | |
| 388 | −} | |
| 389 | − | |
| 390 | 379 | static void fimd_commit(struct exynos_drm_crtc *crtc) |
| 391 | 380 | { |
| 392 | 381 | struct fimd_context *ctx = crtc->ctx; |
| @@ -882,13 +871,12 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) · 489 unmodified lines | ||
| 882 | 871 | return; |
| 883 | 872 | |
| 884 | 873 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; |
| 885 | − writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | |
| 874 | + writel(val, ctx->regs + DP_MIE_CLKCON); | |
| 886 | 875 | } |
| 887 | 876 | |
| 888 | 877 | static const struct exynos_drm_crtc_ops fimd_crtc_ops = { |
| 889 | 878 | .enable = fimd_enable, |
| 890 | 879 | .disable = fimd_disable, |
| 891 | − .mode_fixup = fimd_mode_fixup, | |
| 892 | 880 | .commit = fimd_commit, |
| 893 | 881 | .enable_vblank = fimd_enable_vblank, |
| 894 | 882 | .disable_vblank = fimd_disable_vblank, |
| @@ -1059,7 +1059,6 @@ int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data, · 1058 unmodified lines | ||
| 1059 | 1059 | |
| 1060 | 1060 | return 0; |
| 1061 | 1061 | } |
| 1062 | −EXPORT_SYMBOL_GPL(exynos_g2d_get_ver_ioctl); | |
| 1063 | 1062 | |
| 1064 | 1063 | int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, |
| 1065 | 1064 | struct drm_file *file) |
| @@ -1230,7 +1229,6 @@ err: · 164 unmodified lines | ||
| 1230 | 1229 | g2d_put_cmdlist(g2d, node); |
| 1231 | 1230 | return ret; |
| 1232 | 1231 | } |
| 1233 | −EXPORT_SYMBOL_GPL(exynos_g2d_set_cmdlist_ioctl); | |
| 1234 | 1232 | |
| 1235 | 1233 | int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, |
| 1236 | 1234 | struct drm_file *file) |
| @@ -1293,7 +1291,6 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, · 56 unmodified lines | ||
| 1293 | 1291 | out: |
| 1294 | 1292 | return 0; |
| 1295 | 1293 | } |
| 1296 | −EXPORT_SYMBOL_GPL(exynos_g2d_exec_ioctl); | |
| 1297 | 1294 | |
| 1298 | 1295 | static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev) |
| 1299 | 1296 | { |
| @@ -56,39 +56,35 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem_obj *obj) · 55 unmodified lines | ||
| 56 | 56 | nr_pages = obj->size >> PAGE_SHIFT; |
| 57 | 57 | |
| 58 | 58 | if (!is_drm_iommu_supported(dev)) { |
| 59 | − dma_addr_t start_addr; | |
| 60 | − unsigned int i = 0; | |
| 61 | − | |
| 62 | 59 | obj->pages = drm_calloc_large(nr_pages, sizeof(struct page *)); |
| 63 | 60 | if (!obj->pages) { |
| 64 | 61 | DRM_ERROR("failed to allocate pages.\n"); |
| 65 | 62 | return -ENOMEM; |
| 66 | 63 | } |
| 64 | + } | |
| 67 | 65 | |
| 68 | − obj->cookie = dma_alloc_attrs(dev->dev, | |
| 69 | − obj->size, | |
| 70 | − &obj->dma_addr, GFP_KERNEL, | |
| 71 | − &obj->dma_attrs); | |
| 72 | − if (!obj->cookie) { | |
| 73 | − DRM_ERROR("failed to allocate buffer.\n"); | |
| 66 | + obj->cookie = dma_alloc_attrs(dev->dev, obj->size, &obj->dma_addr, | |
| 67 | + GFP_KERNEL, &obj->dma_attrs); | |
| 68 | + if (!obj->cookie) { | |
| 69 | + DRM_ERROR("failed to allocate buffer.\n"); | |
| 70 | + if (obj->pages) | |
| 74 | 71 | drm_free_large(obj->pages); |
| 75 | − return -ENOMEM; | |
| 76 | − } | |
| 72 | + return -ENOMEM; | |
| 73 | + } | |
| 74 | + | |
| 75 | + if (obj->pages) { | |
| 76 | + dma_addr_t start_addr; | |
| 77 | + unsigned int i = 0; | |
| 77 | 78 | |
| 78 | 79 | start_addr = obj->dma_addr; |
| 79 | 80 | while (i < nr_pages) { |
| 80 | − obj->pages[i] = phys_to_page(start_addr); | |
| 81 | + obj->pages[i] = pfn_to_page(dma_to_pfn(dev->dev, | |
| 82 | + start_addr)); | |
| 81 | 83 | start_addr += PAGE_SIZE; |
| 82 | 84 | i++; |
| 83 | 85 | } |
| 84 | 86 | } else { |
| 85 | − obj->pages = dma_alloc_attrs(dev->dev, obj->size, | |
| 86 | − &obj->dma_addr, GFP_KERNEL, | |
| 87 | − &obj->dma_attrs); | |
| 88 | − if (!obj->pages) { | |
| 89 | − DRM_ERROR("failed to allocate buffer.\n"); | |
| 90 | − return -ENOMEM; | |
| 91 | − } | |
| 87 | + obj->pages = obj->cookie; | |
| 92 | 88 | } |
| 93 | 89 | |
| 94 | 90 | DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", |
| @@ -110,15 +106,11 @@ static void exynos_drm_free_buf(struct exynos_drm_gem_obj *obj) · 15 unmodified lines | ||
| 110 | 106 | DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", |
| 111 | 107 | (unsigned long)obj->dma_addr, obj->size); |
| 112 | 108 | |
| 113 | − if (!is_drm_iommu_supported(dev)) { | |
| 114 | − dma_free_attrs(dev->dev, obj->size, obj->cookie, | |
| 115 | − (dma_addr_t)obj->dma_addr, &obj->dma_attrs); | |
| 116 | − drm_free_large(obj->pages); | |
| 117 | − } else | |
| 118 | − dma_free_attrs(dev->dev, obj->size, obj->pages, | |
| 119 | − (dma_addr_t)obj->dma_addr, &obj->dma_attrs); | |
| 109 | + dma_free_attrs(dev->dev, obj->size, obj->cookie, | |
| 110 | + (dma_addr_t)obj->dma_addr, &obj->dma_attrs); | |
| 120 | 111 | |
| 121 | − obj->dma_addr = (dma_addr_t)NULL; | |
| 112 | + if (!is_drm_iommu_supported(dev)) | |
| 113 | + drm_free_large(obj->pages); | |
| 122 | 114 | } |
| 123 | 115 | |
| 124 | 116 | static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, |
| @@ -156,18 +148,14 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj) · 31 unmodified lines | ||
| 156 | 148 | * once dmabuf's refcount becomes 0. |
| 157 | 149 | */ |
| 158 | 150 | if (obj->import_attach) |
| 159 | − goto out; | |
| 160 | − | |
| 161 | − exynos_drm_free_buf(exynos_gem_obj); | |
| 162 | − | |
| 163 | −out: | |
| 164 | − drm_gem_free_mmap_offset(obj); | |
| 151 | + drm_prime_gem_destroy(obj, exynos_gem_obj->sgt); | |
| 152 | + else | |
| 153 | + exynos_drm_free_buf(exynos_gem_obj); | |
| 165 | 154 | |
| 166 | 155 | /* release file pointer to gem object. */ |
| 167 | 156 | drm_gem_object_release(obj); |
| 168 | 157 | |
| 169 | 158 | kfree(exynos_gem_obj); |
| 170 | − exynos_gem_obj = NULL; | |
| 171 | 159 | } |
| 172 | 160 | |
| 173 | 161 | unsigned long exynos_drm_gem_get_size(struct drm_device *dev, |
| @@ -190,8 +178,7 @@ unsigned long exynos_drm_gem_get_size(struct drm_device *dev, · 16 unmodified lines | ||
| 190 | 178 | return exynos_gem_obj->size; |
| 191 | 179 | } |
| 192 | 180 | |
| 193 | − | |
| 194 | −struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | |
| 181 | +static struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | |
| 195 | 182 | unsigned long size) |
| 196 | 183 | { |
| 197 | 184 | struct exynos_drm_gem_obj *exynos_gem_obj; |
| @@ -212,6 +199,13 @@ struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, · 14 unmodified lines | ||
| 212 | 199 | return ERR_PTR(ret); |
| 213 | 200 | } |
| 214 | 201 | |
| 202 | + ret = drm_gem_create_mmap_offset(obj); | |
| 203 | + if (ret < 0) { | |
| 204 | + drm_gem_object_release(obj); | |
| 205 | + kfree(exynos_gem_obj); | |
| 206 | + return ERR_PTR(ret); | |
| 207 | + } | |
| 208 | + | |
| 215 | 209 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); |
| 216 | 210 | |
| 217 | 211 | return exynos_gem_obj; |
| @@ -313,7 +307,7 @@ void exynos_drm_gem_put_dma_addr(struct drm_device *dev, · 95 unmodified lines | ||
| 313 | 307 | drm_gem_object_unreference_unlocked(obj); |
| 314 | 308 | } |
| 315 | 309 | |
| 316 | −int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj, | |
| 310 | +static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj, | |
| 317 | 311 | struct vm_area_struct *vma) |
| 318 | 312 | { |
| 319 | 313 | struct drm_device *drm_dev = exynos_gem_obj->base.dev; |
| @@ -342,7 +336,8 @@ int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem_obj *exynos_gem_obj, · 22 unmodified lines | ||
| 342 | 336 | |
| 343 | 337 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, |
| 344 | 338 | struct drm_file *file_priv) |
| 345 | −{ struct exynos_drm_gem_obj *exynos_gem_obj; | |
| 339 | +{ | |
| 340 | + struct exynos_drm_gem_obj *exynos_gem_obj; | |
| 346 | 341 | struct drm_exynos_gem_info *args = data; |
| 347 | 342 | struct drm_gem_object *obj; |
| 348 | 343 | |
| @@ -402,6 +397,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, · 53 unmodified lines | ||
| 402 | 397 | struct drm_mode_create_dumb *args) |
| 403 | 398 | { |
| 404 | 399 | struct exynos_drm_gem_obj *exynos_gem_obj; |
| 400 | + unsigned int flags; | |
| 405 | 401 | int ret; |
| 406 | 402 | |
| 407 | 403 | /* |
| @@ -413,16 +409,12 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, · 5 unmodified lines | ||
| 413 | 409 | args->pitch = args->width * ((args->bpp + 7) / 8); |
| 414 | 410 | args->size = args->pitch * args->height; |
| 415 | 411 | |
| 416 | − if (is_drm_iommu_supported(dev)) { | |
| 417 | − exynos_gem_obj = exynos_drm_gem_create(dev, | |
| 418 | − EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC, | |
| 419 | − args->size); | |
| 420 | − } else { | |
| 421 | − exynos_gem_obj = exynos_drm_gem_create(dev, | |
| 422 | − EXYNOS_BO_CONTIG | EXYNOS_BO_WC, | |
| 423 | − args->size); | |
| 424 | − } | |
| 412 | + if (is_drm_iommu_supported(dev)) | |
| 413 | + flags = EXYNOS_BO_NONCONTIG | EXYNOS_BO_WC; | |
| 414 | + else | |
| 415 | + flags = EXYNOS_BO_CONTIG | EXYNOS_BO_WC; | |
| 425 | 416 | |
| 417 | + exynos_gem_obj = exynos_drm_gem_create(dev, flags, args->size); | |
| 426 | 418 | if (IS_ERR(exynos_gem_obj)) { |
| 427 | 419 | dev_warn(dev->dev, "FB allocation failed.\n"); |
| 428 | 420 | return PTR_ERR(exynos_gem_obj); |
| @@ -460,14 +452,9 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv, · 31 unmodified lines | ||
| 460 | 452 | goto unlock; |
| 461 | 453 | } |
| 462 | 454 | |
| 463 | − ret = drm_gem_create_mmap_offset(obj); | |
| 464 | − if (ret) | |
| 465 | − goto out; | |
| 466 | − | |
| 467 | 455 | *offset = drm_vma_node_offset_addr(&obj->vma_node); |
| 468 | 456 | DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset); |
| 469 | 457 | |
| 470 | −out: | |
| 471 | 458 | drm_gem_object_unreference(obj); |
| 472 | 459 | unlock: |
| 473 | 460 | mutex_unlock(&dev->struct_mutex); |
| @@ -543,7 +530,6 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) · 69 unmodified lines | ||
| 543 | 530 | |
| 544 | 531 | err_close_vm: |
| 545 | 532 | drm_gem_vm_close(vma); |
| 546 | − drm_gem_free_mmap_offset(obj); | |
| 547 | 533 | |
| 548 | 534 | return ret; |
| 549 | 535 | } |
| @@ -588,6 +574,8 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, · 38 unmodified lines | ||
| 588 | 574 | if (ret < 0) |
| 589 | 575 | goto err_free_large; |
| 590 | 576 | |
| 577 | + exynos_gem_obj->sgt = sgt; | |
| 578 | + | |
| 591 | 579 | if (sgt->nents == 1) { |
| 592 | 580 | /* always physically continuous memory if sgt->nents is 1. */ |
| 593 | 581 | exynos_gem_obj->flags |= EXYNOS_BO_CONTIG; |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | * - this address could be physical address without IOMMU and |
| 40 | 40 | * device address with IOMMU. |
| 41 | 41 | * @pages: Array of backing pages. |
| 42 | + * @sgt: Imported sg_table. | |
| 42 | 43 | * |
| 43 | 44 | * P.S. this object would be transferred to user as kms_bo.handle so |
| 44 | 45 | * user can access the buffer through kms_bo.handle. |
| @@ -52,6 +53,7 @@ struct exynos_drm_gem_obj { · 7 unmodified lines | ||
| 52 | 53 | dma_addr_t dma_addr; |
| 53 | 54 | struct dma_attrs dma_attrs; |
| 54 | 55 | struct page **pages; |
| 56 | + struct sg_table *sgt; | |
| 55 | 57 | }; |
| 56 | 58 | |
| 57 | 59 | struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); |
| @@ -59,10 +61,6 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); · 1 unmodified line | ||
| 59 | 61 | /* destroy a buffer with gem object */ |
| 60 | 62 | void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj); |
| 61 | 63 | |
| 62 | −/* create a private gem object and initialize it. */ | |
| 63 | −struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, | |
| 64 | − unsigned long size); | |
| 65 | − | |
| 66 | 64 | /* create a new buffer with gem object */ |
| 67 | 65 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, |
| 68 | 66 | unsigned int flags, |
| @@ -786,6 +786,7 @@ static int rotator_remove(struct platform_device *pdev) · 785 unmodified lines | ||
| 786 | 786 | return 0; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | +#ifdef CONFIG_PM | |
| 789 | 790 | static int rotator_clk_crtl(struct rot_context *rot, bool enable) |
| 790 | 791 | { |
| 791 | 792 | if (enable) { |
| @@ -822,7 +823,6 @@ static int rotator_resume(struct device *dev) · 30 unmodified lines | ||
| 822 | 823 | } |
| 823 | 824 | #endif |
| 824 | 825 | |
| 825 | −#ifdef CONFIG_PM | |
| 826 | 826 | static int rotator_runtime_suspend(struct device *dev) |
| 827 | 827 | { |
| 828 | 828 | struct rot_context *rot = dev_get_drvdata(dev); |
| @@ -58,7 +58,8 @@ static void fsl_dcu_drm_plane_atomic_disable(struct drm_plane *plane, · 57 unmodified lines | ||
| 58 | 58 | struct drm_plane_state *old_state) |
| 59 | 59 | { |
| 60 | 60 | struct fsl_dcu_drm_device *fsl_dev = plane->dev->dev_private; |
| 61 | − unsigned int index, value, ret; | |
| 61 | + unsigned int value; | |
| 62 | + int index, ret; | |
| 62 | 63 | |
| 63 | 64 | index = fsl_dcu_drm_plane_index(plane); |
| 64 | 65 | if (index < 0) |
| @@ -639,6 +639,32 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) · 638 unmodified lines | ||
| 639 | 639 | else |
| 640 | 640 | position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; |
| 641 | 641 | |
| 642 | + /* | |
| 643 | + * On HSW, the DSL reg (0x70000) appears to return 0 if we | |
| 644 | + * read it just before the start of vblank. So try it again | |
| 645 | + * so we don't accidentally end up spanning a vblank frame | |
| 646 | + * increment, causing the pipe_update_end() code to squak at us. | |
| 647 | + * | |
| 648 | + * The nature of this problem means we can't simply check the ISR | |
| 649 | + * bit and return the vblank start value; nor can we use the scanline | |
| 650 | + * debug register in the transcoder as it appears to have the same | |
| 651 | + * problem. We may need to extend this to include other platforms, | |
| 652 | + * but so far testing only shows the problem on HSW. | |
| 653 | + */ | |
| 654 | + if (IS_HASWELL(dev) && !position) { | |
| 655 | + int i, temp; | |
| 656 | + | |
| 657 | + for (i = 0; i < 100; i++) { | |
| 658 | + udelay(1); | |
| 659 | + temp = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & | |
| 660 | + DSL_LINEMASK_GEN3; | |
| 661 | + if (temp != position) { | |
| 662 | + position = temp; | |
| 663 | + break; | |
| 664 | + } | |
| 665 | + } | |
| 666 | + } | |
| 667 | + | |
| 642 | 668 | /* |
| 643 | 669 | * See update_scanline_offset() for the details on the |
| 644 | 670 | * scanline_offset adjustment. |
| @@ -430,7 +430,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · 429 unmodified lines | ||
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * intel_audio_codec_disable - Disable the audio codec for HD audio |
| 433 | − * @encoder: encoder on which to disable audio | |
| 433 | + * @intel_encoder: encoder on which to disable audio | |
| 434 | 434 | * |
| 435 | 435 | * The disable sequences must be performed before disabling the transcoder or |
| 436 | 436 | * port. |
| @@ -42,7 +42,7 @@ find_section(const void *_bdb, int section_id) · 41 unmodified lines | ||
| 42 | 42 | const struct bdb_header *bdb = _bdb; |
| 43 | 43 | const u8 *base = _bdb; |
| 44 | 44 | int index = 0; |
| 45 | − u16 total, current_size; | |
| 45 | + u32 total, current_size; | |
| 46 | 46 | u8 current_id; |
| 47 | 47 | |
| 48 | 48 | /* skip to first section */ |
| @@ -57,6 +57,10 @@ find_section(const void *_bdb, int section_id) · 8 unmodified lines | ||
| 57 | 57 | current_size = *((const u16 *)(base + index)); |
| 58 | 58 | index += 2; |
| 59 | 59 | |
| 60 | + /* The MIPI Sequence Block v3+ has a separate size field. */ | |
| 61 | + if (current_id == BDB_MIPI_SEQUENCE && *(base + index) >= 3) | |
| 62 | + current_size = *((const u32 *)(base + index + 1)); | |
| 63 | + | |
| 60 | 64 | if (index + current_size > total) |
| 61 | 65 | return NULL; |
| 62 | 66 | |
| @@ -799,6 +803,12 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb) · 736 unmodified lines | ||
| 799 | 803 | return; |
| 800 | 804 | } |
| 801 | 805 | |
| 806 | + /* Fail gracefully for forward incompatible sequence block. */ | |
| 807 | + if (sequence->version >= 3) { | |
| 808 | + DRM_ERROR("Unable to parse MIPI Sequence Block v3+\n"); | |
| 809 | + return; | |
| 810 | + } | |
| 811 | + | |
| 802 | 812 | DRM_DEBUG_DRIVER("Found MIPI sequence block\n"); |
| 803 | 813 | |
| 804 | 814 | block_size = get_blocksize(sequence); |
| @@ -15087,9 +15087,12 @@ static void readout_plane_state(struct intel_crtc *crtc, · 15086 unmodified lines | ||
| 15087 | 15087 | |
| 15088 | 15088 | plane_state = to_intel_plane_state(p->base.state); |
| 15089 | 15089 | |
| 15090 | − if (p->base.type == DRM_PLANE_TYPE_PRIMARY) | |
| 15090 | + if (p->base.type == DRM_PLANE_TYPE_PRIMARY) { | |
| 15091 | 15091 | plane_state->visible = primary_get_hw_state(crtc); |
| 15092 | − else { | |
| 15092 | + if (plane_state->visible) | |
| 15093 | + crtc->base.state->plane_mask |= | |
| 15094 | + 1 << drm_plane_index(&p->base); | |
| 15095 | + } else { | |
| 15093 | 15096 | if (active) |
| 15094 | 15097 | p->disable_plane(&p->base, &crtc->base); |
| 15095 | 15098 | |
| @@ -462,11 +462,17 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo · 461 unmodified lines | ||
| 462 | 462 | drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0); |
| 463 | 463 | |
| 464 | 464 | drm_mode_connector_set_path_property(connector, pathprop); |
| 465 | + return connector; | |
| 466 | +} | |
| 467 | + | |
| 468 | +static void intel_dp_register_mst_connector(struct drm_connector *connector) | |
| 469 | +{ | |
| 470 | + struct intel_connector *intel_connector = to_intel_connector(connector); | |
| 471 | + struct drm_device *dev = connector->dev; | |
| 465 | 472 | drm_modeset_lock_all(dev); |
| 466 | 473 | intel_connector_add_to_fbdev(intel_connector); |
| 467 | 474 | drm_modeset_unlock_all(dev); |
| 468 | 475 | drm_connector_register(&intel_connector->base); |
| 469 | − return connector; | |
| 470 | 476 | } |
| 471 | 477 | |
| 472 | 478 | static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
| @@ -512,6 +518,7 @@ static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) · 39 unmodified lines | ||
| 512 | 518 | |
| 513 | 519 | static struct drm_dp_mst_topology_cbs mst_cbs = { |
| 514 | 520 | .add_connector = intel_dp_add_mst_connector, |
| 521 | + .register_connector = intel_dp_register_mst_connector, | |
| 515 | 522 | .destroy_connector = intel_dp_destroy_mst_connector, |
| 516 | 523 | .hotplug = intel_dp_mst_hotplug, |
| 517 | 524 | }; |
| @@ -180,7 +180,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv) · 179 unmodified lines | ||
| 180 | 180 | |
| 181 | 181 | /* Enable polling and queue hotplug re-enabling. */ |
| 182 | 182 | if (hpd_disabled) { |
| 183 | − drm_kms_helper_poll_enable(dev); | |
| 183 | + drm_kms_helper_poll_enable_locked(dev); | |
| 184 | 184 | mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work, |
| 185 | 185 | msecs_to_jiffies(HPD_STORM_REENABLE_DELAY)); |
| 186 | 186 | } |
| @@ -484,18 +484,18 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring) · 483 unmodified lines | ||
| 484 | 484 | status_pointer = I915_READ(RING_CONTEXT_STATUS_PTR(ring)); |
| 485 | 485 | |
| 486 | 486 | read_pointer = ring->next_context_status_buffer; |
| 487 | − write_pointer = status_pointer & 0x07; | |
| 487 | + write_pointer = status_pointer & GEN8_CSB_PTR_MASK; | |
| 488 | 488 | if (read_pointer > write_pointer) |
| 489 | − write_pointer += 6; | |
| 489 | + write_pointer += GEN8_CSB_ENTRIES; | |
| 490 | 490 | |
| 491 | 491 | spin_lock(&ring->execlist_lock); |
| 492 | 492 | |
| 493 | 493 | while (read_pointer < write_pointer) { |
| 494 | 494 | read_pointer++; |
| 495 | 495 | status = I915_READ(RING_CONTEXT_STATUS_BUF(ring) + |
| 496 | − (read_pointer % 6) * 8); | |
| 496 | + (read_pointer % GEN8_CSB_ENTRIES) * 8); | |
| 497 | 497 | status_id = I915_READ(RING_CONTEXT_STATUS_BUF(ring) + |
| 498 | − (read_pointer % 6) * 8 + 4); | |
| 498 | + (read_pointer % GEN8_CSB_ENTRIES) * 8 + 4); | |
| 499 | 499 | |
| 500 | 500 | if (status & GEN8_CTX_STATUS_IDLE_ACTIVE) |
| 501 | 501 | continue; |
| @@ -521,10 +521,12 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring) · 19 unmodified lines | ||
| 521 | 521 | spin_unlock(&ring->execlist_lock); |
| 522 | 522 | |
| 523 | 523 | WARN(submit_contexts > 2, "More than two context complete events?\n"); |
| 524 | − ring->next_context_status_buffer = write_pointer % 6; | |
| 524 | + ring->next_context_status_buffer = write_pointer % GEN8_CSB_ENTRIES; | |
| 525 | 525 | |
| 526 | 526 | I915_WRITE(RING_CONTEXT_STATUS_PTR(ring), |
| 527 | − _MASKED_FIELD(0x07 << 8, ((u32)ring->next_context_status_buffer & 0x07) << 8)); | |
| 527 | + _MASKED_FIELD(GEN8_CSB_PTR_MASK << 8, | |
| 528 | + ((u32)ring->next_context_status_buffer & | |
| 529 | + GEN8_CSB_PTR_MASK) << 8)); | |
| 528 | 530 | } |
| 529 | 531 | |
| 530 | 532 | static int execlists_context_queue(struct drm_i915_gem_request *request) |
| @@ -1422,6 +1424,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring) · 891 unmodified lines | ||
| 1422 | 1424 | { |
| 1423 | 1425 | struct drm_device *dev = ring->dev; |
| 1424 | 1426 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1427 | + u8 next_context_status_buffer_hw; | |
| 1425 | 1428 | |
| 1426 | 1429 | I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask)); |
| 1427 | 1430 | I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff); |
| @@ -1436,7 +1439,29 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring) · 8 unmodified lines | ||
| 1436 | 1439 | _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) | |
| 1437 | 1440 | _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)); |
| 1438 | 1441 | POSTING_READ(RING_MODE_GEN7(ring)); |
| 1439 | − ring->next_context_status_buffer = 0; | |
| 1442 | + | |
| 1443 | + /* | |
| 1444 | + * Instead of resetting the Context Status Buffer (CSB) read pointer to | |
| 1445 | + * zero, we need to read the write pointer from hardware and use its | |
| 1446 | + * value because "this register is power context save restored". | |
| 1447 | + * Effectively, these states have been observed: | |
| 1448 | + * | |
| 1449 | + * | Suspend-to-idle (freeze) | Suspend-to-RAM (mem) | | |
| 1450 | + * BDW | CSB regs not reset | CSB regs reset | | |
| 1451 | + * CHT | CSB regs not reset | CSB regs not reset | | |
| 1452 | + */ | |
| 1453 | + next_context_status_buffer_hw = (I915_READ(RING_CONTEXT_STATUS_PTR(ring)) | |
| 1454 | + & GEN8_CSB_PTR_MASK); | |
| 1455 | + | |
| 1456 | + /* | |
| 1457 | + * When the CSB registers are reset (also after power-up / gpu reset), | |
| 1458 | + * CSB write pointer is set to all 1's, which is not valid, use '5' in | |
| 1459 | + * this special case, so the first element read is CSB[0]. | |
| 1460 | + */ | |
| 1461 | + if (next_context_status_buffer_hw == GEN8_CSB_PTR_MASK) | |
| 1462 | + next_context_status_buffer_hw = (GEN8_CSB_ENTRIES - 1); | |
| 1463 | + | |
| 1464 | + ring->next_context_status_buffer = next_context_status_buffer_hw; | |
| 1440 | 1465 | DRM_DEBUG_DRIVER("Execlists enabled for %s\n", ring->name); |
| 1441 | 1466 | |
| 1442 | 1467 | memset(&ring->hangcheck, 0, sizeof(ring->hangcheck)); |
| @@ -25,6 +25,8 @@ · 24 unmodified lines | ||
| 25 | 25 | #define _INTEL_LRC_H_ |
| 26 | 26 | |
| 27 | 27 | #define GEN8_LR_CONTEXT_ALIGN 4096 |
| 28 | +#define GEN8_CSB_ENTRIES 6 | |
| 29 | +#define GEN8_CSB_PTR_MASK 0x07 | |
| 28 | 30 | |
| 29 | 31 | /* Execlists regs */ |
| 30 | 32 | #define RING_ELSP(ring) ((ring)->mmio_base+0x230) |
| @@ -246,7 +246,8 @@ static void skl_power_well_post_enable(struct drm_i915_private *dev_priv, · 245 unmodified lines | ||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if (power_well->data == SKL_DISP_PW_1) { |
| 249 | − intel_prepare_ddi(dev); | |
| 249 | + if (!dev_priv->power_domains.initializing) | |
| 250 | + intel_prepare_ddi(dev); | |
| 250 | 251 | gen8_irq_power_well_post_enable(dev_priv, 1 << PIPE_A); |
| 251 | 252 | } |
| 252 | 253 | } |
| @@ -186,17 +186,19 @@ static int mgag200fb_create(struct drm_fb_helper *helper, · 185 unmodified lines | ||
| 186 | 186 | |
| 187 | 187 | sysram = vmalloc(size); |
| 188 | 188 | if (!sysram) |
| 189 | − return -ENOMEM; | |
| 189 | + goto err_sysram; | |
| 190 | 190 | |
| 191 | 191 | info = drm_fb_helper_alloc_fbi(helper); |
| 192 | − if (IS_ERR(info)) | |
| 193 | − return PTR_ERR(info); | |
| 192 | + if (IS_ERR(info)) { | |
| 193 | + ret = PTR_ERR(info); | |
| 194 | + goto err_alloc_fbi; | |
| 195 | + } | |
| 194 | 196 | |
| 195 | 197 | info->par = mfbdev; |
| 196 | 198 | |
| 197 | 199 | ret = mgag200_framebuffer_init(dev, &mfbdev->mfb, &mode_cmd, gobj); |
| 198 | 200 | if (ret) |
| 199 | − return ret; | |
| 201 | + goto err_framebuffer_init; | |
| 200 | 202 | |
| 201 | 203 | mfbdev->sysram = sysram; |
| 202 | 204 | mfbdev->size = size; |
| @@ -225,7 +227,17 @@ static int mgag200fb_create(struct drm_fb_helper *helper, · 22 unmodified lines | ||
| 225 | 227 | |
| 226 | 228 | DRM_DEBUG_KMS("allocated %dx%d\n", |
| 227 | 229 | fb->width, fb->height); |
| 230 | + | |
| 228 | 231 | return 0; |
| 232 | + | |
| 233 | +err_framebuffer_init: | |
| 234 | + drm_fb_helper_release_fbi(helper); | |
| 235 | +err_alloc_fbi: | |
| 236 | + vfree(sysram); | |
| 237 | +err_sysram: | |
| 238 | + drm_gem_object_unreference_unlocked(gobj); | |
| 239 | + | |
| 240 | + return ret; | |
| 229 | 241 | } |
| 230 | 242 | |
| 231 | 243 | static int mga_fbdev_destroy(struct drm_device *dev, |
| @@ -276,23 +288,26 @@ int mgag200_fbdev_init(struct mga_device *mdev) · 44 unmodified lines | ||
| 276 | 288 | ret = drm_fb_helper_init(mdev->dev, &mfbdev->helper, |
| 277 | 289 | mdev->num_crtc, MGAG200FB_CONN_LIMIT); |
| 278 | 290 | if (ret) |
| 279 | − return ret; | |
| 291 | + goto err_fb_helper; | |
| 280 | 292 | |
| 281 | 293 | ret = drm_fb_helper_single_add_all_connectors(&mfbdev->helper); |
| 282 | 294 | if (ret) |
| 283 | − goto fini; | |
| 295 | + goto err_fb_setup; | |
| 284 | 296 | |
| 285 | 297 | /* disable all the possible outputs/crtcs before entering KMS mode */ |
| 286 | 298 | drm_helper_disable_unused_functions(mdev->dev); |
| 287 | 299 | |
| 288 | 300 | ret = drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel); |
| 289 | 301 | if (ret) |
| 290 | − goto fini; | |
| 302 | + goto err_fb_setup; | |
| 291 | 303 | |
| 292 | 304 | return 0; |
| 293 | 305 | |
| 294 | −fini: | |
| 306 | +err_fb_setup: | |
| 295 | 307 | drm_fb_helper_fini(&mfbdev->helper); |
| 308 | +err_fb_helper: | |
| 309 | + mdev->mfbdev = NULL; | |
| 310 | + | |
| 296 | 311 | return ret; |
| 297 | 312 | } |
| 298 | 313 | |
| @@ -220,7 +220,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) · 219 unmodified lines | ||
| 220 | 220 | } |
| 221 | 221 | r = mgag200_mm_init(mdev); |
| 222 | 222 | if (r) |
| 223 | − goto out; | |
| 223 | + goto err_mm; | |
| 224 | 224 | |
| 225 | 225 | drm_mode_config_init(dev); |
| 226 | 226 | dev->mode_config.funcs = (void *)&mga_mode_funcs; |
| @@ -233,7 +233,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) · 6 unmodified lines | ||
| 233 | 233 | r = mgag200_modeset_init(mdev); |
| 234 | 234 | if (r) { |
| 235 | 235 | dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r); |
| 236 | − goto out; | |
| 236 | + goto err_modeset; | |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /* Make small buffers to store a hardware cursor (double buffered icon updates) */ |
| @@ -241,20 +241,24 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) · 1 unmodified line | ||
| 241 | 241 | &mdev->cursor.pixels_1); |
| 242 | 242 | mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0, |
| 243 | 243 | &mdev->cursor.pixels_2); |
| 244 | − if (!mdev->cursor.pixels_2 || !mdev->cursor.pixels_1) | |
| 245 | − goto cursor_nospace; | |
| 246 | − mdev->cursor.pixels_current = mdev->cursor.pixels_1; | |
| 247 | − mdev->cursor.pixels_prev = mdev->cursor.pixels_2; | |
| 248 | − goto cursor_done; | |
| 249 | − cursor_nospace: | |
| 250 | − mdev->cursor.pixels_1 = NULL; | |
| 251 | − mdev->cursor.pixels_2 = NULL; | |
| 252 | − dev_warn(&dev->pdev->dev, "Could not allocate space for cursors. Not doing hardware cursors.\n"); | |
| 253 | − cursor_done: | |
| 254 | − | |
| 255 | −out: | |
| 256 | − if (r) | |
| 257 | − mgag200_driver_unload(dev); | |
| 244 | + if (!mdev->cursor.pixels_2 || !mdev->cursor.pixels_1) { | |
| 245 | + mdev->cursor.pixels_1 = NULL; | |
| 246 | + mdev->cursor.pixels_2 = NULL; | |
| 247 | + dev_warn(&dev->pdev->dev, | |
| 248 | + "Could not allocate space for cursors. Not doing hardware cursors.\n"); | |
| 249 | + } else { | |
| 250 | + mdev->cursor.pixels_current = mdev->cursor.pixels_1; | |
| 251 | + mdev->cursor.pixels_prev = mdev->cursor.pixels_2; | |
| 252 | + } | |
| 253 | + | |
| 254 | + return 0; | |
| 255 | + | |
| 256 | +err_modeset: | |
| 257 | + drm_mode_config_cleanup(dev); | |
| 258 | + mgag200_mm_fini(mdev); | |
| 259 | +err_mm: | |
| 260 | + dev->dev_private = NULL; | |
| 261 | + | |
| 258 | 262 | return r; |
| 259 | 263 | } |
| 260 | 264 | |
| @@ -618,7 +618,7 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, · 617 unmodified lines | ||
| 618 | 618 | adjusted_mode->hdisplay, |
| 619 | 619 | adjusted_mode->vdisplay); |
| 620 | 620 | |
| 621 | − if (qcrtc->index == 0) | |
| 621 | + if (bo->is_primary == false) | |
| 622 | 622 | recreate_primary = true; |
| 623 | 623 | |
| 624 | 624 | if (bo->surf.stride * bo->surf.height > qdev->vram_size) { |
| @@ -886,13 +886,15 @@ static enum drm_connector_status qxl_conn_detect( · 261 unmodified lines | ||
| 886 | 886 | drm_connector_to_qxl_output(connector); |
| 887 | 887 | struct drm_device *ddev = connector->dev; |
| 888 | 888 | struct qxl_device *qdev = ddev->dev_private; |
| 889 | − int connected; | |
| 889 | + bool connected = false; | |
| 890 | 890 | |
| 891 | 891 | /* The first monitor is always connected */ |
| 892 | − connected = (output->index == 0) || | |
| 893 | − (qdev->client_monitors_config && | |
| 894 | − qdev->client_monitors_config->count > output->index && | |
| 895 | − qxl_head_enabled(&qdev->client_monitors_config->heads[output->index])); | |
| 892 | + if (!qdev->client_monitors_config) { | |
| 893 | + if (output->index == 0) | |
| 894 | + connected = true; | |
| 895 | + } else | |
| 896 | + connected = qdev->client_monitors_config->count > output->index && | |
| 897 | + qxl_head_enabled(&qdev->client_monitors_config->heads[output->index]); | |
| 896 | 898 | |
| 897 | 899 | DRM_DEBUG("#%d connected: %d\n", output->index, connected); |
| 898 | 900 | if (!connected) |
| @@ -1624,8 +1624,9 @@ radeon_atom_encoder_dpms_avivo(struct drm_encoder *encoder, int mode) · 1623 unmodified lines | ||
| 1624 | 1624 | } else |
| 1625 | 1625 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 1626 | 1626 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
| 1627 | − args.ucAction = ATOM_LCD_BLON; | |
| 1628 | − atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | |
| 1627 | + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | |
| 1628 | + | |
| 1629 | + atombios_set_backlight_level(radeon_encoder, dig->backlight_level); | |
| 1629 | 1630 | } |
| 1630 | 1631 | break; |
| 1631 | 1632 | case DRM_MODE_DPMS_STANDBY: |
| @@ -1706,8 +1707,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) · 74 unmodified lines | ||
| 1706 | 1707 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); |
| 1707 | 1708 | } |
| 1708 | 1709 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
| 1709 | − atombios_dig_transmitter_setup(encoder, | |
| 1710 | − ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0); | |
| 1710 | + atombios_set_backlight_level(radeon_encoder, dig->backlight_level); | |
| 1711 | 1711 | if (ext_encoder) |
| 1712 | 1712 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); |
| 1713 | 1713 | break; |
| @@ -1573,10 +1573,12 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) · 1572 unmodified lines | ||
| 1573 | 1573 | |
| 1574 | 1574 | drm_kms_helper_poll_disable(dev); |
| 1575 | 1575 | |
| 1576 | + drm_modeset_lock_all(dev); | |
| 1576 | 1577 | /* turn off display hw */ |
| 1577 | 1578 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1578 | 1579 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
| 1579 | 1580 | } |
| 1581 | + drm_modeset_unlock_all(dev); | |
| 1580 | 1582 | |
| 1581 | 1583 | /* unpin the front buffers and cursors */ |
| 1582 | 1584 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| @@ -1734,9 +1736,11 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) · 151 unmodified lines | ||
| 1734 | 1736 | if (fbcon) { |
| 1735 | 1737 | drm_helper_resume_force_mode(dev); |
| 1736 | 1738 | /* turn on display hw */ |
| 1739 | + drm_modeset_lock_all(dev); | |
| 1737 | 1740 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1738 | 1741 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
| 1739 | 1742 | } |
| 1743 | + drm_modeset_unlock_all(dev); | |
| 1740 | 1744 | } |
| 1741 | 1745 | |
| 1742 | 1746 | drm_kms_helper_poll_enable(dev); |
| @@ -265,7 +265,6 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol · 264 unmodified lines | ||
| 265 | 265 | { |
| 266 | 266 | struct radeon_connector *master = container_of(mgr, struct radeon_connector, mst_mgr); |
| 267 | 267 | struct drm_device *dev = master->base.dev; |
| 268 | − struct radeon_device *rdev = dev->dev_private; | |
| 269 | 268 | struct radeon_connector *radeon_connector; |
| 270 | 269 | struct drm_connector *connector; |
| 271 | 270 | |
| @@ -286,12 +285,19 @@ static struct drm_connector *radeon_dp_add_mst_connector(struct drm_dp_mst_topol · 14 unmodified lines | ||
| 286 | 285 | drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); |
| 287 | 286 | drm_mode_connector_set_path_property(connector, pathprop); |
| 288 | 287 | |
| 288 | + return connector; | |
| 289 | +} | |
| 290 | + | |
| 291 | +static void radeon_dp_register_mst_connector(struct drm_connector *connector) | |
| 292 | +{ | |
| 293 | + struct drm_device *dev = connector->dev; | |
| 294 | + struct radeon_device *rdev = dev->dev_private; | |
| 295 | + | |
| 289 | 296 | drm_modeset_lock_all(dev); |
| 290 | 297 | radeon_fb_add_connector(rdev, connector); |
| 291 | 298 | drm_modeset_unlock_all(dev); |
| 292 | 299 | |
| 293 | 300 | drm_connector_register(connector); |
| 294 | − return connector; | |
| 295 | 301 | } |
| 296 | 302 | |
| 297 | 303 | static void radeon_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
| @@ -324,6 +330,7 @@ static void radeon_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) · 26 unmodified lines | ||
| 324 | 330 | |
| 325 | 331 | struct drm_dp_mst_topology_cbs mst_cbs = { |
| 326 | 332 | .add_connector = radeon_dp_add_mst_connector, |
| 333 | + .register_connector = radeon_dp_register_mst_connector, | |
| 327 | 334 | .destroy_connector = radeon_dp_destroy_mst_connector, |
| 328 | 335 | .hotplug = radeon_dp_mst_hotplug, |
| 329 | 336 | }; |
| @@ -48,40 +48,10 @@ struct radeon_fbdev { · 47 unmodified lines | ||
| 48 | 48 | struct radeon_device *rdev; |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | −/** | |
| 52 | − * radeon_fb_helper_set_par - Hide cursor on CRTCs used by fbdev. | |
| 53 | − * | |
| 54 | − * @info: fbdev info | |
| 55 | − * | |
| 56 | − * This function hides the cursor on all CRTCs used by fbdev. | |
| 57 | − */ | |
| 58 | −static int radeon_fb_helper_set_par(struct fb_info *info) | |
| 59 | −{ | |
| 60 | − int ret; | |
| 61 | − | |
| 62 | − ret = drm_fb_helper_set_par(info); | |
| 63 | − | |
| 64 | − /* XXX: with universal plane support fbdev will automatically disable | |
| 65 | − * all non-primary planes (including the cursor) | |
| 66 | − */ | |
| 67 | − if (ret == 0) { | |
| 68 | − struct drm_fb_helper *fb_helper = info->par; | |
| 69 | − int i; | |
| 70 | − | |
| 71 | − for (i = 0; i < fb_helper->crtc_count; i++) { | |
| 72 | − struct drm_crtc *crtc = fb_helper->crtc_info[i].mode_set.crtc; | |
| 73 | − | |
| 74 | − radeon_crtc_cursor_set2(crtc, NULL, 0, 0, 0, 0, 0); | |
| 75 | − } | |
| 76 | − } | |
| 77 | − | |
| 78 | − return ret; | |
| 79 | −} | |
| 80 | − | |
| 81 | 51 | static struct fb_ops radeonfb_ops = { |
| 82 | 52 | .owner = THIS_MODULE, |
| 83 | 53 | .fb_check_var = drm_fb_helper_check_var, |
| 84 | − .fb_set_par = radeon_fb_helper_set_par, | |
| 54 | + .fb_set_par = drm_fb_helper_set_par, | |
| 85 | 55 | .fb_fillrect = drm_fb_helper_cfb_fillrect, |
| 86 | 56 | .fb_copyarea = drm_fb_helper_cfb_copyarea, |
| 87 | 57 | .fb_imageblit = drm_fb_helper_cfb_imageblit, |
| @@ -2927,6 +2927,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = { · 2926 unmodified lines | ||
| 2927 | 2927 | { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, |
| 2928 | 2928 | { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, |
| 2929 | 2929 | { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 }, |
| 2930 | + { PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 }, | |
| 2930 | 2931 | { 0, 0, 0, 0 }, |
| 2931 | 2932 | }; |
| 2932 | 2933 | |
| @@ -882,6 +882,8 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 881 unmodified lines | ||
| 882 | 882 | if (ret) |
| 883 | 883 | return ret; |
| 884 | 884 | man = &bdev->man[mem_type]; |
| 885 | + if (!man->has_type || !man->use_type) | |
| 886 | + continue; | |
| 885 | 887 | |
| 886 | 888 | type_ok = ttm_bo_mt_compatible(man, mem_type, place, |
| 887 | 889 | &cur_flags); |
| @@ -889,6 +891,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 1 unmodified line | ||
| 889 | 891 | if (!type_ok) |
| 890 | 892 | continue; |
| 891 | 893 | |
| 894 | + type_found = true; | |
| 892 | 895 | cur_flags = ttm_bo_select_caching(man, bo->mem.placement, |
| 893 | 896 | cur_flags); |
| 894 | 897 | /* |
| @@ -901,12 +904,10 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 6 unmodified lines | ||
| 901 | 904 | if (mem_type == TTM_PL_SYSTEM) |
| 902 | 905 | break; |
| 903 | 906 | |
| 904 | − if (man->has_type && man->use_type) { | |
| 905 | − type_found = true; | |
| 906 | − ret = (*man->func->get_node)(man, bo, place, mem); | |
| 907 | − if (unlikely(ret)) | |
| 908 | − return ret; | |
| 909 | − } | |
| 907 | + ret = (*man->func->get_node)(man, bo, place, mem); | |
| 908 | + if (unlikely(ret)) | |
| 909 | + return ret; | |
| 910 | + | |
| 910 | 911 | if (mem->mm_node) |
| 911 | 912 | break; |
| 912 | 913 | } |
| @@ -917,9 +918,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 4 unmodified lines | ||
| 917 | 918 | return 0; |
| 918 | 919 | } |
| 919 | 920 | |
| 920 | − if (!type_found) | |
| 921 | − return -EINVAL; | |
| 922 | − | |
| 923 | 921 | for (i = 0; i < placement->num_busy_placement; ++i) { |
| 924 | 922 | const struct ttm_place *place = &placement->busy_placement[i]; |
| 925 | 923 | |
| @@ -927,11 +925,12 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 1 unmodified line | ||
| 927 | 925 | if (ret) |
| 928 | 926 | return ret; |
| 929 | 927 | man = &bdev->man[mem_type]; |
| 930 | − if (!man->has_type) | |
| 928 | + if (!man->has_type || !man->use_type) | |
| 931 | 929 | continue; |
| 932 | 930 | if (!ttm_bo_mt_compatible(man, mem_type, place, &cur_flags)) |
| 933 | 931 | continue; |
| 934 | 932 | |
| 933 | + type_found = true; | |
| 935 | 934 | cur_flags = ttm_bo_select_caching(man, bo->mem.placement, |
| 936 | 935 | cur_flags); |
| 937 | 936 | /* |
| @@ -957,8 +956,13 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, · 19 unmodified lines | ||
| 957 | 956 | if (ret == -ERESTARTSYS) |
| 958 | 957 | has_erestartsys = true; |
| 959 | 958 | } |
| 960 | − ret = (has_erestartsys) ? -ERESTARTSYS : -ENOMEM; | |
| 961 | − return ret; | |
| 959 | + | |
| 960 | + if (!type_found) { | |
| 961 | + printk(KERN_ERR TTM_PFX "No compatible memory type found.\n"); | |
| 962 | + return -EINVAL; | |
| 963 | + } | |
| 964 | + | |
| 965 | + return (has_erestartsys) ? -ERESTARTSYS : -ENOMEM; | |
| 962 | 966 | } |
| 963 | 967 | EXPORT_SYMBOL(ttm_bo_mem_space); |
| 964 | 968 | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | config DRM_VMWGFX |
| 2 | 2 | tristate "DRM driver for VMware Virtual GPU" |
| 3 | − depends on DRM && PCI | |
| 3 | + depends on DRM && PCI && X86 | |
| 4 | 4 | select FB_DEFERRED_IO |
| 5 | 5 | select FB_CFB_FILLRECT |
| 6 | 6 | select FB_CFB_COPYAREA |
| @@ -681,6 +681,14 @@ static bool vmw_cmdbuf_try_alloc(struct vmw_cmdbuf_man *man, · 680 unmodified lines | ||
| 681 | 681 | 0, 0, |
| 682 | 682 | DRM_MM_SEARCH_DEFAULT, |
| 683 | 683 | DRM_MM_CREATE_DEFAULT); |
| 684 | + if (ret) { | |
| 685 | + (void) vmw_cmdbuf_man_process(man); | |
| 686 | + ret = drm_mm_insert_node_generic(&man->mm, info->node, | |
| 687 | + info->page_size, 0, 0, | |
| 688 | + DRM_MM_SEARCH_DEFAULT, | |
| 689 | + DRM_MM_CREATE_DEFAULT); | |
| 690 | + } | |
| 691 | + | |
| 684 | 692 | spin_unlock_bh(&man->lock); |
| 685 | 693 | info->done = !ret; |
| 686 | 694 | |
| @@ -311,7 +311,6 @@ static int vmw_cotable_unbind(struct vmw_resource *res, · 310 unmodified lines | ||
| 311 | 311 | struct vmw_private *dev_priv = res->dev_priv; |
| 312 | 312 | struct ttm_buffer_object *bo = val_buf->bo; |
| 313 | 313 | struct vmw_fence_obj *fence; |
| 314 | − int ret; | |
| 315 | 314 | |
| 316 | 315 | if (list_empty(&res->mob_head)) |
| 317 | 316 | return 0; |
| @@ -328,7 +327,7 @@ static int vmw_cotable_unbind(struct vmw_resource *res, · 10 unmodified lines | ||
| 328 | 327 | if (likely(fence != NULL)) |
| 329 | 328 | vmw_fence_obj_unreference(&fence); |
| 330 | 329 | |
| 331 | − return ret; | |
| 330 | + return 0; | |
| 332 | 331 | } |
| 333 | 332 | |
| 334 | 333 | /** |
| @@ -752,12 +752,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) · 751 unmodified lines | ||
| 752 | 752 | ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); |
| 753 | 753 | dev_priv->active_master = &dev_priv->fbdev_master; |
| 754 | 754 | |
| 755 | − | |
| 756 | − dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start, | |
| 757 | − dev_priv->mmio_size); | |
| 758 | − | |
| 759 | − dev_priv->mmio_virt = ioremap_wc(dev_priv->mmio_start, | |
| 760 | − dev_priv->mmio_size); | |
| 755 | + dev_priv->mmio_virt = ioremap_cache(dev_priv->mmio_start, | |
| 756 | + dev_priv->mmio_size); | |
| 761 | 757 | |
| 762 | 758 | if (unlikely(dev_priv->mmio_virt == NULL)) { |
| 763 | 759 | ret = -ENOMEM; |
| @@ -913,7 +909,6 @@ out_no_device: · 149 unmodified lines | ||
| 913 | 909 | out_err4: |
| 914 | 910 | iounmap(dev_priv->mmio_virt); |
| 915 | 911 | out_err3: |
| 916 | − arch_phys_wc_del(dev_priv->mmio_mtrr); | |
| 917 | 912 | vmw_ttm_global_release(dev_priv); |
| 918 | 913 | out_err0: |
| 919 | 914 | for (i = vmw_res_context; i < vmw_res_max; ++i) |
| @@ -964,7 +959,6 @@ static int vmw_driver_unload(struct drm_device *dev) · 44 unmodified lines | ||
| 964 | 959 | |
| 965 | 960 | ttm_object_device_release(&dev_priv->tdev); |
| 966 | 961 | iounmap(dev_priv->mmio_virt); |
| 967 | − arch_phys_wc_del(dev_priv->mmio_mtrr); | |
| 968 | 962 | if (dev_priv->ctx.staged_bindings) |
| 969 | 963 | vmw_binding_state_free(dev_priv->ctx.staged_bindings); |
| 970 | 964 | vmw_ttm_global_release(dev_priv); |
| @@ -376,7 +376,6 @@ struct vmw_private { · 375 unmodified lines | ||
| 376 | 376 | uint32_t initial_width; |
| 377 | 377 | uint32_t initial_height; |
| 378 | 378 | u32 __iomem *mmio_virt; |
| 379 | − int mmio_mtrr; | |
| 380 | 379 | uint32_t capabilities; |
| 381 | 380 | uint32_t max_gmr_ids; |
| 382 | 381 | uint32_t max_gmr_pages; |
| @@ -631,7 +630,8 @@ extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, · 248 unmodified lines | ||
| 631 | 630 | uint32_t size, |
| 632 | 631 | bool shareable, |
| 633 | 632 | uint32_t *handle, |
| 634 | − struct vmw_dma_buffer **p_dma_buf); | |
| 633 | + struct vmw_dma_buffer **p_dma_buf, | |
| 634 | + struct ttm_base_object **p_base); | |
| 635 | 635 | extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile, |
| 636 | 636 | struct vmw_dma_buffer *dma_buf, |
| 637 | 637 | uint32_t *handle); |
| @@ -645,7 +645,8 @@ extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo, · 7 unmodified lines | ||
| 645 | 645 | uint32_t cur_validate_node); |
| 646 | 646 | extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo); |
| 647 | 647 | extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, |
| 648 | − uint32_t id, struct vmw_dma_buffer **out); | |
| 648 | + uint32_t id, struct vmw_dma_buffer **out, | |
| 649 | + struct ttm_base_object **base); | |
| 649 | 650 | extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data, |
| 650 | 651 | struct drm_file *file_priv); |
| 651 | 652 | extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data, |
| @@ -1236,7 +1236,8 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, · 1235 unmodified lines | ||
| 1236 | 1236 | struct vmw_relocation *reloc; |
| 1237 | 1237 | int ret; |
| 1238 | 1238 | |
| 1239 | − ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); | |
| 1239 | + ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo, | |
| 1240 | + NULL); | |
| 1240 | 1241 | if (unlikely(ret != 0)) { |
| 1241 | 1242 | DRM_ERROR("Could not find or use MOB buffer.\n"); |
| 1242 | 1243 | ret = -EINVAL; |
| @@ -1296,7 +1297,8 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv, · 53 unmodified lines | ||
| 1296 | 1297 | struct vmw_relocation *reloc; |
| 1297 | 1298 | int ret; |
| 1298 | 1299 | |
| 1299 | − ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo); | |
| 1300 | + ret = vmw_user_dmabuf_lookup(sw_context->fp->tfile, handle, &vmw_bo, | |
| 1301 | + NULL); | |
| 1300 | 1302 | if (unlikely(ret != 0)) { |
| 1301 | 1303 | DRM_ERROR("Could not find or use GMR region.\n"); |
| 1302 | 1304 | ret = -EINVAL; |
| @@ -1685,7 +1685,6 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, · 1684 unmodified lines | ||
| 1685 | 1685 | struct drm_crtc *crtc; |
| 1686 | 1686 | u32 num_units = 0; |
| 1687 | 1687 | u32 i, k; |
| 1688 | − int ret; | |
| 1689 | 1688 | |
| 1690 | 1689 | dirty->dev_priv = dev_priv; |
| 1691 | 1690 | |
| @@ -1711,7 +1710,7 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, · 19 unmodified lines | ||
| 1711 | 1710 | if (!dirty->cmd) { |
| 1712 | 1711 | DRM_ERROR("Couldn't reserve fifo space " |
| 1713 | 1712 | "for dirty blits.\n"); |
| 1714 | − return ret; | |
| 1713 | + return -ENOMEM; | |
| 1715 | 1714 | } |
| 1716 | 1715 | memset(dirty->cmd, 0, dirty->fifo_reserve_size); |
| 1717 | 1716 | } |
| @@ -484,7 +484,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, · 483 unmodified lines | ||
| 484 | 484 | goto out_unlock; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | − ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &buf); | |
| 487 | + ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &buf, NULL); | |
| 488 | 488 | if (ret) |
| 489 | 489 | goto out_unlock; |
| 490 | 490 | |
| @@ -354,7 +354,7 @@ int vmw_user_lookup_handle(struct vmw_private *dev_priv, · 353 unmodified lines | ||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | *out_surf = NULL; |
| 357 | − ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf); | |
| 357 | + ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf, NULL); | |
| 358 | 358 | return ret; |
| 359 | 359 | } |
| 360 | 360 | |
| @@ -481,7 +481,8 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, · 120 unmodified lines | ||
| 481 | 481 | uint32_t size, |
| 482 | 482 | bool shareable, |
| 483 | 483 | uint32_t *handle, |
| 484 | − struct vmw_dma_buffer **p_dma_buf) | |
| 484 | + struct vmw_dma_buffer **p_dma_buf, | |
| 485 | + struct ttm_base_object **p_base) | |
| 485 | 486 | { |
| 486 | 487 | struct vmw_user_dma_buffer *user_bo; |
| 487 | 488 | struct ttm_buffer_object *tmp; |
| @@ -515,6 +516,10 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv, · 27 unmodified lines | ||
| 515 | 516 | } |
| 516 | 517 | |
| 517 | 518 | *p_dma_buf = &user_bo->dma; |
| 519 | + if (p_base) { | |
| 520 | + *p_base = &user_bo->prime.base; | |
| 521 | + kref_get(&(*p_base)->refcount); | |
| 522 | + } | |
| 518 | 523 | *handle = user_bo->prime.base.hash.key; |
| 519 | 524 | |
| 520 | 525 | out_no_base_object: |
| @@ -631,6 +636,7 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data, · 110 unmodified lines | ||
| 631 | 636 | struct vmw_dma_buffer *dma_buf; |
| 632 | 637 | struct vmw_user_dma_buffer *user_bo; |
| 633 | 638 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; |
| 639 | + struct ttm_base_object *buffer_base; | |
| 634 | 640 | int ret; |
| 635 | 641 | |
| 636 | 642 | if ((arg->flags & (drm_vmw_synccpu_read | drm_vmw_synccpu_write)) == 0 |
| @@ -643,7 +649,8 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 643 | 649 | |
| 644 | 650 | switch (arg->op) { |
| 645 | 651 | case drm_vmw_synccpu_grab: |
| 646 | − ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &dma_buf); | |
| 652 | + ret = vmw_user_dmabuf_lookup(tfile, arg->handle, &dma_buf, | |
| 653 | + &buffer_base); | |
| 647 | 654 | if (unlikely(ret != 0)) |
| 648 | 655 | return ret; |
| 649 | 656 | |
| @@ -651,6 +658,7 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data, · 1 unmodified line | ||
| 651 | 658 | dma); |
| 652 | 659 | ret = vmw_user_dmabuf_synccpu_grab(user_bo, tfile, arg->flags); |
| 653 | 660 | vmw_dmabuf_unreference(&dma_buf); |
| 661 | + ttm_base_object_unref(&buffer_base); | |
| 654 | 662 | if (unlikely(ret != 0 && ret != -ERESTARTSYS && |
| 655 | 663 | ret != -EBUSY)) { |
| 656 | 664 | DRM_ERROR("Failed synccpu grab on handle 0x%08x.\n", |
| @@ -692,7 +700,8 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, · 35 unmodified lines | ||
| 692 | 700 | return ret; |
| 693 | 701 | |
| 694 | 702 | ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile, |
| 695 | − req->size, false, &handle, &dma_buf); | |
| 703 | + req->size, false, &handle, &dma_buf, | |
| 704 | + NULL); | |
| 696 | 705 | if (unlikely(ret != 0)) |
| 697 | 706 | goto out_no_dmabuf; |
| 698 | 707 | |
| @@ -721,7 +730,8 @@ int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, · 22 unmodified lines | ||
| 721 | 730 | } |
| 722 | 731 | |
| 723 | 732 | int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, |
| 724 | − uint32_t handle, struct vmw_dma_buffer **out) | |
| 733 | + uint32_t handle, struct vmw_dma_buffer **out, | |
| 734 | + struct ttm_base_object **p_base) | |
| 725 | 735 | { |
| 726 | 736 | struct vmw_user_dma_buffer *vmw_user_bo; |
| 727 | 737 | struct ttm_base_object *base; |
| @@ -743,7 +753,10 @@ int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile, · 15 unmodified lines | ||
| 743 | 753 | vmw_user_bo = container_of(base, struct vmw_user_dma_buffer, |
| 744 | 754 | prime.base); |
| 745 | 755 | (void)ttm_bo_reference(&vmw_user_bo->dma.base); |
| 746 | − ttm_base_object_unref(&base); | |
| 756 | + if (p_base) | |
| 757 | + *p_base = base; | |
| 758 | + else | |
| 759 | + ttm_base_object_unref(&base); | |
| 747 | 760 | *out = &vmw_user_bo->dma; |
| 748 | 761 | |
| 749 | 762 | return 0; |
| @@ -1004,7 +1017,7 @@ int vmw_dumb_create(struct drm_file *file_priv, · 254 unmodified lines | ||
| 1004 | 1017 | |
| 1005 | 1018 | ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile, |
| 1006 | 1019 | args->size, false, &args->handle, |
| 1007 | − &dma_buf); | |
| 1020 | + &dma_buf, NULL); | |
| 1008 | 1021 | if (unlikely(ret != 0)) |
| 1009 | 1022 | goto out_no_dmabuf; |
| 1010 | 1023 | |
| @@ -1032,7 +1045,7 @@ int vmw_dumb_map_offset(struct drm_file *file_priv, · 21 unmodified lines | ||
| 1032 | 1045 | struct vmw_dma_buffer *out_buf; |
| 1033 | 1046 | int ret; |
| 1034 | 1047 | |
| 1035 | − ret = vmw_user_dmabuf_lookup(tfile, handle, &out_buf); | |
| 1048 | + ret = vmw_user_dmabuf_lookup(tfile, handle, &out_buf, NULL); | |
| 1036 | 1049 | if (ret != 0) |
| 1037 | 1050 | return -EINVAL; |
| 1038 | 1051 | |
| @@ -855,7 +855,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv, · 854 unmodified lines | ||
| 855 | 855 | |
| 856 | 856 | if (buffer_handle != SVGA3D_INVALID_ID) { |
| 857 | 857 | ret = vmw_user_dmabuf_lookup(tfile, buffer_handle, |
| 858 | − &buffer); | |
| 858 | + &buffer, NULL); | |
| 859 | 859 | if (unlikely(ret != 0)) { |
| 860 | 860 | DRM_ERROR("Could not find buffer for shader " |
| 861 | 861 | "creation.\n"); |
| @@ -46,6 +46,7 @@ struct vmw_user_surface { · 45 unmodified lines | ||
| 46 | 46 | struct vmw_surface srf; |
| 47 | 47 | uint32_t size; |
| 48 | 48 | struct drm_master *master; |
| 49 | + struct ttm_base_object *backup_base; | |
| 49 | 50 | }; |
| 50 | 51 | |
| 51 | 52 | /** |
| @@ -656,6 +657,7 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base) · 604 unmodified lines | ||
| 656 | 657 | struct vmw_resource *res = &user_srf->srf.res; |
| 657 | 658 | |
| 658 | 659 | *p_base = NULL; |
| 660 | + ttm_base_object_unref(&user_srf->backup_base); | |
| 659 | 661 | vmw_resource_unreference(&res); |
| 660 | 662 | } |
| 661 | 663 | |
| @@ -851,7 +853,8 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, · 189 unmodified lines | ||
| 851 | 853 | res->backup_size, |
| 852 | 854 | true, |
| 853 | 855 | &backup_handle, |
| 854 | − &res->backup); | |
| 856 | + &res->backup, | |
| 857 | + &user_srf->backup_base); | |
| 855 | 858 | if (unlikely(ret != 0)) { |
| 856 | 859 | vmw_resource_unreference(&res); |
| 857 | 860 | goto out_unlock; |
| @@ -1321,7 +1324,8 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 463 unmodified lines | ||
| 1321 | 1324 | |
| 1322 | 1325 | if (req->buffer_handle != SVGA3D_INVALID_ID) { |
| 1323 | 1326 | ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle, |
| 1324 | − &res->backup); | |
| 1327 | + &res->backup, | |
| 1328 | + &user_srf->backup_base); | |
| 1325 | 1329 | if (ret == 0 && res->backup->base.num_pages * PAGE_SIZE < |
| 1326 | 1330 | res->backup_size) { |
| 1327 | 1331 | DRM_ERROR("Surface backup buffer is too small.\n"); |
| @@ -1335,7 +1339,8 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 7 unmodified lines | ||
| 1335 | 1339 | req->drm_surface_flags & |
| 1336 | 1340 | drm_vmw_surface_flag_shareable, |
| 1337 | 1341 | &backup_handle, |
| 1338 | − &res->backup); | |
| 1342 | + &res->backup, | |
| 1343 | + &user_srf->backup_base); | |
| 1339 | 1344 | |
| 1340 | 1345 | if (unlikely(ret != 0)) { |
| 1341 | 1346 | vmw_resource_unreference(&res); |
| @@ -204,6 +204,8 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 203 unmodified lines | ||
| 204 | 204 | spin_lock_irqsave(&vmbus_connection.channel_lock, flags); |
| 205 | 205 | list_del(&channel->listentry); |
| 206 | 206 | spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); |
| 207 | + | |
| 208 | + primary_channel = channel; | |
| 207 | 209 | } else { |
| 208 | 210 | primary_channel = channel->primary_channel; |
| 209 | 211 | spin_lock_irqsave(&primary_channel->lock, flags); |
| @@ -211,6 +213,14 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 1 unmodified line | ||
| 211 | 213 | primary_channel->num_sc--; |
| 212 | 214 | spin_unlock_irqrestore(&primary_channel->lock, flags); |
| 213 | 215 | } |
| 216 | + | |
| 217 | + /* | |
| 218 | + * We need to free the bit for init_vp_index() to work in the case | |
| 219 | + * of sub-channel, when we reload drivers like hv_netvsc. | |
| 220 | + */ | |
| 221 | + cpumask_clear_cpu(channel->target_cpu, | |
| 222 | + &primary_channel->alloced_cpus_in_node); | |
| 223 | + | |
| 214 | 224 | free_channel(channel); |
| 215 | 225 | } |
| 216 | 226 | |
| @@ -458,6 +468,13 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui · 241 unmodified lines | ||
| 458 | 468 | continue; |
| 459 | 469 | } |
| 460 | 470 | |
| 471 | + /* | |
| 472 | + * NOTE: in the case of sub-channel, we clear the sub-channel | |
| 473 | + * related bit(s) in primary->alloced_cpus_in_node in | |
| 474 | + * hv_process_channel_removal(), so when we reload drivers | |
| 475 | + * like hv_netvsc in SMP guest, here we're able to re-allocate | |
| 476 | + * bit from primary->alloced_cpus_in_node. | |
| 477 | + */ | |
| 461 | 478 | if (!cpumask_test_cpu(cur_cpu, |
| 462 | 479 | &primary->alloced_cpus_in_node)) { |
| 463 | 480 | cpumask_set_cpu(cur_cpu, |
| @@ -470,6 +470,7 @@ static const struct of_device_id abx500_temp_match[] = { · 469 unmodified lines | ||
| 470 | 470 | { .compatible = "stericsson,abx500-temp" }, |
| 471 | 471 | {}, |
| 472 | 472 | }; |
| 473 | +MODULE_DEVICE_TABLE(of, abx500_temp_match); | |
| 473 | 474 | #endif |
| 474 | 475 | |
| 475 | 476 | static struct platform_driver abx500_temp_driver = { |
| @@ -539,6 +539,7 @@ static const struct of_device_id of_gpio_fan_match[] = { · 538 unmodified lines | ||
| 539 | 539 | { .compatible = "gpio-fan", }, |
| 540 | 540 | {}, |
| 541 | 541 | }; |
| 542 | +MODULE_DEVICE_TABLE(of, of_gpio_fan_match); | |
| 542 | 543 | #endif /* CONFIG_OF_GPIO */ |
| 543 | 544 | |
| 544 | 545 | static int gpio_fan_probe(struct platform_device *pdev) |
| @@ -323,6 +323,7 @@ static const struct of_device_id of_pwm_fan_match[] = { · 322 unmodified lines | ||
| 323 | 323 | { .compatible = "pwm-fan", }, |
| 324 | 324 | {}, |
| 325 | 325 | }; |
| 326 | +MODULE_DEVICE_TABLE(of, of_pwm_fan_match); | |
| 326 | 327 | |
| 327 | 328 | static struct platform_driver pwm_fan_driver = { |
| 328 | 329 | .probe = pwm_fan_probe, |
| @@ -620,7 +620,7 @@ static struct cpuidle_state skl_cstates[] = { · 619 unmodified lines | ||
| 620 | 620 | .name = "C6-SKL", |
| 621 | 621 | .desc = "MWAIT 0x20", |
| 622 | 622 | .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 623 | − .exit_latency = 75, | |
| 623 | + .exit_latency = 85, | |
| 624 | 624 | .target_residency = 200, |
| 625 | 625 | .enter = &intel_idle, |
| 626 | 626 | .enter_freeze = intel_idle_freeze, }, |
| @@ -636,10 +636,18 @@ static struct cpuidle_state skl_cstates[] = { · 9 unmodified lines | ||
| 636 | 636 | .name = "C8-SKL", |
| 637 | 637 | .desc = "MWAIT 0x40", |
| 638 | 638 | .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, |
| 639 | − .exit_latency = 174, | |
| 639 | + .exit_latency = 200, | |
| 640 | 640 | .target_residency = 800, |
| 641 | 641 | .enter = &intel_idle, |
| 642 | 642 | .enter_freeze = intel_idle_freeze, }, |
| 643 | + { | |
| 644 | + .name = "C9-SKL", | |
| 645 | + .desc = "MWAIT 0x50", | |
| 646 | + .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, | |
| 647 | + .exit_latency = 480, | |
| 648 | + .target_residency = 5000, | |
| 649 | + .enter = &intel_idle, | |
| 650 | + .enter_freeze = intel_idle_freeze, }, | |
| 643 | 651 | { |
| 644 | 652 | .name = "C10-SKL", |
| 645 | 653 | .desc = "MWAIT 0x60", |
| @@ -245,7 +245,6 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, · 244 unmodified lines | ||
| 245 | 245 | props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; |
| 246 | 246 | if (MLX5_CAP_GEN(mdev, apm)) |
| 247 | 247 | props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; |
| 248 | − props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY; | |
| 249 | 248 | if (MLX5_CAP_GEN(mdev, xrc)) |
| 250 | 249 | props->device_cap_flags |= IB_DEVICE_XRC; |
| 251 | 250 | props->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS; |
| @@ -795,53 +794,6 @@ static int mlx5_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vm · 543 unmodified lines | ||
| 795 | 794 | return 0; |
| 796 | 795 | } |
| 797 | 796 | |
| 798 | −static int alloc_pa_mkey(struct mlx5_ib_dev *dev, u32 *key, u32 pdn) | |
| 799 | −{ | |
| 800 | − struct mlx5_create_mkey_mbox_in *in; | |
| 801 | − struct mlx5_mkey_seg *seg; | |
| 802 | − struct mlx5_core_mr mr; | |
| 803 | − int err; | |
| 804 | − | |
| 805 | − in = kzalloc(sizeof(*in), GFP_KERNEL); | |
| 806 | − if (!in) | |
| 807 | − return -ENOMEM; | |
| 808 | − | |
| 809 | − seg = &in->seg; | |
| 810 | − seg->flags = MLX5_PERM_LOCAL_READ | MLX5_ACCESS_MODE_PA; | |
| 811 | − seg->flags_pd = cpu_to_be32(pdn | MLX5_MKEY_LEN64); | |
| 812 | − seg->qpn_mkey7_0 = cpu_to_be32(0xffffff << 8); | |
| 813 | − seg->start_addr = 0; | |
| 814 | − | |
| 815 | − err = mlx5_core_create_mkey(dev->mdev, &mr, in, sizeof(*in), | |
| 816 | − NULL, NULL, NULL); | |
| 817 | − if (err) { | |
| 818 | − mlx5_ib_warn(dev, "failed to create mkey, %d\n", err); | |
| 819 | − goto err_in; | |
| 820 | − } | |
| 821 | − | |
| 822 | − kfree(in); | |
| 823 | − *key = mr.key; | |
| 824 | − | |
| 825 | − return 0; | |
| 826 | − | |
| 827 | −err_in: | |
| 828 | − kfree(in); | |
| 829 | − | |
| 830 | − return err; | |
| 831 | −} | |
| 832 | − | |
| 833 | −static void free_pa_mkey(struct mlx5_ib_dev *dev, u32 key) | |
| 834 | −{ | |
| 835 | − struct mlx5_core_mr mr; | |
| 836 | − int err; | |
| 837 | − | |
| 838 | − memset(&mr, 0, sizeof(mr)); | |
| 839 | − mr.key = key; | |
| 840 | − err = mlx5_core_destroy_mkey(dev->mdev, &mr); | |
| 841 | − if (err) | |
| 842 | − mlx5_ib_warn(dev, "failed to destroy mkey 0x%x\n", key); | |
| 843 | −} | |
| 844 | − | |
| 845 | 797 | static struct ib_pd *mlx5_ib_alloc_pd(struct ib_device *ibdev, |
| 846 | 798 | struct ib_ucontext *context, |
| 847 | 799 | struct ib_udata *udata) |
| @@ -867,13 +819,6 @@ static struct ib_pd *mlx5_ib_alloc_pd(struct ib_device *ibdev, · 19 unmodified lines | ||
| 867 | 819 | kfree(pd); |
| 868 | 820 | return ERR_PTR(-EFAULT); |
| 869 | 821 | } |
| 870 | − } else { | |
| 871 | − err = alloc_pa_mkey(to_mdev(ibdev), &pd->pa_lkey, pd->pdn); | |
| 872 | − if (err) { | |
| 873 | − mlx5_core_dealloc_pd(to_mdev(ibdev)->mdev, pd->pdn); | |
| 874 | − kfree(pd); | |
| 875 | − return ERR_PTR(err); | |
| 876 | − } | |
| 877 | 822 | } |
| 878 | 823 | |
| 879 | 824 | return &pd->ibpd; |
| @@ -884,9 +829,6 @@ static int mlx5_ib_dealloc_pd(struct ib_pd *pd) · 4 unmodified lines | ||
| 884 | 829 | struct mlx5_ib_dev *mdev = to_mdev(pd->device); |
| 885 | 830 | struct mlx5_ib_pd *mpd = to_mpd(pd); |
| 886 | 831 | |
| 887 | − if (!pd->uobject) | |
| 888 | − free_pa_mkey(mdev, mpd->pa_lkey); | |
| 889 | − | |
| 890 | 832 | mlx5_core_dealloc_pd(mdev->mdev, mpd->pdn); |
| 891 | 833 | kfree(mpd); |
| 892 | 834 | |
| @@ -1245,18 +1187,10 @@ static int create_dev_resources(struct mlx5_ib_resources *devr) · 352 unmodified lines | ||
| 1245 | 1187 | struct ib_srq_init_attr attr; |
| 1246 | 1188 | struct mlx5_ib_dev *dev; |
| 1247 | 1189 | struct ib_cq_init_attr cq_attr = {.cqe = 1}; |
| 1248 | − u32 rsvd_lkey; | |
| 1249 | 1190 | int ret = 0; |
| 1250 | 1191 | |
| 1251 | 1192 | dev = container_of(devr, struct mlx5_ib_dev, devr); |
| 1252 | 1193 | |
| 1253 | − ret = mlx5_core_query_special_context(dev->mdev, &rsvd_lkey); | |
| 1254 | − if (ret) { | |
| 1255 | − pr_err("Failed to query special context %d\n", ret); | |
| 1256 | − return ret; | |
| 1257 | − } | |
| 1258 | − dev->ib_dev.local_dma_lkey = rsvd_lkey; | |
| 1259 | − | |
| 1260 | 1194 | devr->p0 = mlx5_ib_alloc_pd(&dev->ib_dev, NULL, NULL); |
| 1261 | 1195 | if (IS_ERR(devr->p0)) { |
| 1262 | 1196 | ret = PTR_ERR(devr->p0); |
| @@ -1418,6 +1352,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) · 155 unmodified lines | ||
| 1418 | 1352 | strlcpy(dev->ib_dev.name, "mlx5_%d", IB_DEVICE_NAME_MAX); |
| 1419 | 1353 | dev->ib_dev.owner = THIS_MODULE; |
| 1420 | 1354 | dev->ib_dev.node_type = RDMA_NODE_IB_CA; |
| 1355 | + dev->ib_dev.local_dma_lkey = 0 /* not supported for now */; | |
| 1421 | 1356 | dev->num_ports = MLX5_CAP_GEN(mdev, num_ports); |
| 1422 | 1357 | dev->ib_dev.phys_port_cnt = dev->num_ports; |
| 1423 | 1358 | dev->ib_dev.num_comp_vectors = |
| @@ -103,7 +103,6 @@ static inline struct mlx5_ib_ucontext *to_mucontext(struct ib_ucontext *ibuconte · 102 unmodified lines | ||
| 103 | 103 | struct mlx5_ib_pd { |
| 104 | 104 | struct ib_pd ibpd; |
| 105 | 105 | u32 pdn; |
| 106 | − u32 pa_lkey; | |
| 107 | 106 | }; |
| 108 | 107 | |
| 109 | 108 | /* Use macros here so that don't have to duplicate |
| @@ -213,7 +212,6 @@ struct mlx5_ib_qp { · 103 unmodified lines | ||
| 213 | 212 | int uuarn; |
| 214 | 213 | |
| 215 | 214 | int create_type; |
| 216 | − u32 pa_lkey; | |
| 217 | 215 | |
| 218 | 216 | /* Store signature errors */ |
| 219 | 217 | bool signature_en; |
| @@ -925,8 +925,6 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 924 unmodified lines | ||
| 925 | 925 | err = create_kernel_qp(dev, init_attr, qp, &in, &inlen); |
| 926 | 926 | if (err) |
| 927 | 927 | mlx5_ib_dbg(dev, "err %d\n", err); |
| 928 | − else | |
| 929 | − qp->pa_lkey = to_mpd(pd)->pa_lkey; | |
| 930 | 928 | } |
| 931 | 929 | |
| 932 | 930 | if (err) |
| @@ -2045,7 +2043,7 @@ static void set_frwr_pages(struct mlx5_wqe_data_seg *dseg, · 1112 unmodified lines | ||
| 2045 | 2043 | mfrpl->mapped_page_list[i] = cpu_to_be64(page_list[i] | perm); |
| 2046 | 2044 | dseg->addr = cpu_to_be64(mfrpl->map); |
| 2047 | 2045 | dseg->byte_count = cpu_to_be32(ALIGN(sizeof(u64) * wr->wr.fast_reg.page_list_len, 64)); |
| 2048 | − dseg->lkey = cpu_to_be32(pd->pa_lkey); | |
| 2046 | + dseg->lkey = cpu_to_be32(pd->ibpd.local_dma_lkey); | |
| 2049 | 2047 | } |
| 2050 | 2048 | |
| 2051 | 2049 | static __be32 send_ieth(struct ib_send_wr *wr) |
| @@ -80,7 +80,7 @@ enum { · 79 unmodified lines | ||
| 80 | 80 | IPOIB_NUM_WC = 4, |
| 81 | 81 | |
| 82 | 82 | IPOIB_MAX_PATH_REC_QUEUE = 3, |
| 83 | − IPOIB_MAX_MCAST_QUEUE = 3, | |
| 83 | + IPOIB_MAX_MCAST_QUEUE = 64, | |
| 84 | 84 | |
| 85 | 85 | IPOIB_FLAG_OPER_UP = 0, |
| 86 | 86 | IPOIB_FLAG_INITIALIZED = 1, |
| @@ -548,6 +548,8 @@ void ipoib_path_iter_read(struct ipoib_path_iter *iter, · 461 unmodified lines | ||
| 548 | 548 | |
| 549 | 549 | int ipoib_mcast_attach(struct net_device *dev, u16 mlid, |
| 550 | 550 | union ib_gid *mgid, int set_qkey); |
| 551 | +int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast); | |
| 552 | +struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid); | |
| 551 | 553 | |
| 552 | 554 | int ipoib_init_qp(struct net_device *dev); |
| 553 | 555 | int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca); |
| @@ -1149,6 +1149,9 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) · 1148 unmodified lines | ||
| 1149 | 1149 | unsigned long dt; |
| 1150 | 1150 | unsigned long flags; |
| 1151 | 1151 | int i; |
| 1152 | + LIST_HEAD(remove_list); | |
| 1153 | + struct ipoib_mcast *mcast, *tmcast; | |
| 1154 | + struct net_device *dev = priv->dev; | |
| 1152 | 1155 | |
| 1153 | 1156 | if (test_bit(IPOIB_STOP_NEIGH_GC, &priv->flags)) |
| 1154 | 1157 | return; |
| @@ -1176,6 +1179,19 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) · 21 unmodified lines | ||
| 1176 | 1179 | lockdep_is_held(&priv->lock))) != NULL) { |
| 1177 | 1180 | /* was the neigh idle for two GC periods */ |
| 1178 | 1181 | if (time_after(neigh_obsolete, neigh->alive)) { |
| 1182 | + u8 *mgid = neigh->daddr + 4; | |
| 1183 | + | |
| 1184 | + /* Is this multicast ? */ | |
| 1185 | + if (*mgid == 0xff) { | |
| 1186 | + mcast = __ipoib_mcast_find(dev, mgid); | |
| 1187 | + | |
| 1188 | + if (mcast && test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) { | |
| 1189 | + list_del(&mcast->list); | |
| 1190 | + rb_erase(&mcast->rb_node, &priv->multicast_tree); | |
| 1191 | + list_add_tail(&mcast->list, &remove_list); | |
| 1192 | + } | |
| 1193 | + } | |
| 1194 | + | |
| 1179 | 1195 | rcu_assign_pointer(*np, |
| 1180 | 1196 | rcu_dereference_protected(neigh->hnext, |
| 1181 | 1197 | lockdep_is_held(&priv->lock))); |
| @@ -1191,6 +1207,8 @@ static void __ipoib_reap_neigh(struct ipoib_dev_priv *priv) · 9 unmodified lines | ||
| 1191 | 1207 | |
| 1192 | 1208 | out_unlock: |
| 1193 | 1209 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1210 | + list_for_each_entry_safe(mcast, tmcast, &remove_list, list) | |
| 1211 | + ipoib_mcast_leave(dev, mcast); | |
| 1194 | 1212 | } |
| 1195 | 1213 | |
| 1196 | 1214 | static void ipoib_reap_neigh(struct work_struct *work) |
| @@ -153,7 +153,7 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev, · 152 unmodified lines | ||
| 153 | 153 | return mcast; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | −static struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid) | |
| 156 | +struct ipoib_mcast *__ipoib_mcast_find(struct net_device *dev, void *mgid) | |
| 157 | 157 | { |
| 158 | 158 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 159 | 159 | struct rb_node *n = priv->multicast_tree.rb_node; |
| @@ -508,17 +508,19 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) · 348 unmodified lines | ||
| 508 | 508 | rec.hop_limit = priv->broadcast->mcmember.hop_limit; |
| 509 | 509 | |
| 510 | 510 | /* |
| 511 | − * Historically Linux IPoIB has never properly supported SEND | |
| 512 | − * ONLY join. It emulated it by not providing all the required | |
| 513 | − * attributes, which is enough to prevent group creation and | |
| 514 | − * detect if there are full members or not. A major problem | |
| 515 | − * with supporting SEND ONLY is detecting when the group is | |
| 516 | − * auto-destroyed as IPoIB will cache the MLID.. | |
| 511 | + * Send-only IB Multicast joins do not work at the core | |
| 512 | + * IB layer yet, so we can't use them here. However, | |
| 513 | + * we are emulating an Ethernet multicast send, which | |
| 514 | + * does not require a multicast subscription and will | |
| 515 | + * still send properly. The most appropriate thing to | |
| 516 | + * do is to create the group if it doesn't exist as that | |
| 517 | + * most closely emulates the behavior, from a user space | |
| 518 | + * application perspecitive, of Ethernet multicast | |
| 519 | + * operation. For now, we do a full join, maybe later | |
| 520 | + * when the core IB layers support send only joins we | |
| 521 | + * will use them. | |
| 517 | 522 | */ |
| 518 | −#if 1 | |
| 519 | − if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) | |
| 520 | − comp_mask &= ~IB_SA_MCMEMBER_REC_TRAFFIC_CLASS; | |
| 521 | −#else | |
| 523 | +#if 0 | |
| 522 | 524 | if (test_bit(IPOIB_MCAST_FLAG_SENDONLY, &mcast->flags)) |
| 523 | 525 | rec.join_state = 4; |
| 524 | 526 | #endif |
| @@ -675,7 +677,7 @@ int ipoib_mcast_stop_thread(struct net_device *dev) · 150 unmodified lines | ||
| 675 | 677 | return 0; |
| 676 | 678 | } |
| 677 | 679 | |
| 678 | −static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |
| 680 | +int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |
| 679 | 681 | { |
| 680 | 682 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 681 | 683 | int ret = 0; |
| @@ -97,6 +97,11 @@ unsigned int iser_max_sectors = ISER_DEF_MAX_SECTORS; · 96 unmodified lines | ||
| 97 | 97 | module_param_named(max_sectors, iser_max_sectors, uint, S_IRUGO | S_IWUSR); |
| 98 | 98 | MODULE_PARM_DESC(max_sectors, "Max number of sectors in a single scsi command (default:1024"); |
| 99 | 99 | |
| 100 | +bool iser_always_reg = true; | |
| 101 | +module_param_named(always_register, iser_always_reg, bool, S_IRUGO); | |
| 102 | +MODULE_PARM_DESC(always_register, | |
| 103 | + "Always register memory, even for continuous memory regions (default:true)"); | |
| 104 | + | |
| 100 | 105 | bool iser_pi_enable = false; |
| 101 | 106 | module_param_named(pi_enable, iser_pi_enable, bool, S_IRUGO); |
| 102 | 107 | MODULE_PARM_DESC(pi_enable, "Enable T10-PI offload support (default:disabled)"); |
| @@ -611,6 +611,7 @@ extern int iser_debug_level; · 610 unmodified lines | ||
| 611 | 611 | extern bool iser_pi_enable; |
| 612 | 612 | extern int iser_pi_guard; |
| 613 | 613 | extern unsigned int iser_max_sectors; |
| 614 | +extern bool iser_always_reg; | |
| 614 | 615 | |
| 615 | 616 | int iser_assign_reg_ops(struct iser_device *device); |
| 616 | 617 | |
| @@ -803,11 +803,12 @@ static int · 802 unmodified lines | ||
| 803 | 803 | iser_reg_prot_sg(struct iscsi_iser_task *task, |
| 804 | 804 | struct iser_data_buf *mem, |
| 805 | 805 | struct iser_fr_desc *desc, |
| 806 | + bool use_dma_key, | |
| 806 | 807 | struct iser_mem_reg *reg) |
| 807 | 808 | { |
| 808 | 809 | struct iser_device *device = task->iser_conn->ib_conn.device; |
| 809 | 810 | |
| 810 | − if (mem->dma_nents == 1) | |
| 811 | + if (use_dma_key) | |
| 811 | 812 | return iser_reg_dma(device, mem, reg); |
| 812 | 813 | |
| 813 | 814 | return device->reg_ops->reg_mem(task, mem, &desc->pi_ctx->rsc, reg); |
| @@ -817,11 +818,12 @@ static int · 3 unmodified lines | ||
| 817 | 818 | iser_reg_data_sg(struct iscsi_iser_task *task, |
| 818 | 819 | struct iser_data_buf *mem, |
| 819 | 820 | struct iser_fr_desc *desc, |
| 821 | + bool use_dma_key, | |
| 820 | 822 | struct iser_mem_reg *reg) |
| 821 | 823 | { |
| 822 | 824 | struct iser_device *device = task->iser_conn->ib_conn.device; |
| 823 | 825 | |
| 824 | − if (mem->dma_nents == 1) | |
| 826 | + if (use_dma_key) | |
| 825 | 827 | return iser_reg_dma(device, mem, reg); |
| 826 | 828 | |
| 827 | 829 | return device->reg_ops->reg_mem(task, mem, &desc->rsc, reg); |
| @@ -836,14 +838,17 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *task, · 8 unmodified lines | ||
| 836 | 838 | struct iser_mem_reg *reg = &task->rdma_reg[dir]; |
| 837 | 839 | struct iser_mem_reg *data_reg; |
| 838 | 840 | struct iser_fr_desc *desc = NULL; |
| 841 | + bool use_dma_key; | |
| 839 | 842 | int err; |
| 840 | 843 | |
| 841 | 844 | err = iser_handle_unaligned_buf(task, mem, dir); |
| 842 | 845 | if (unlikely(err)) |
| 843 | 846 | return err; |
| 844 | 847 | |
| 845 | − if (mem->dma_nents != 1 || | |
| 846 | − scsi_get_prot_op(task->sc) != SCSI_PROT_NORMAL) { | |
| 848 | + use_dma_key = (mem->dma_nents == 1 && !iser_always_reg && | |
| 849 | + scsi_get_prot_op(task->sc) == SCSI_PROT_NORMAL); | |
| 850 | + | |
| 851 | + if (!use_dma_key) { | |
| 847 | 852 | desc = device->reg_ops->reg_desc_get(ib_conn); |
| 848 | 853 | reg->mem_h = desc; |
| 849 | 854 | } |
| @@ -853,7 +858,7 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *task, · 3 unmodified lines | ||
| 853 | 858 | else |
| 854 | 859 | data_reg = &task->desc.data_reg; |
| 855 | 860 | |
| 856 | − err = iser_reg_data_sg(task, mem, desc, data_reg); | |
| 861 | + err = iser_reg_data_sg(task, mem, desc, use_dma_key, data_reg); | |
| 857 | 862 | if (unlikely(err)) |
| 858 | 863 | goto err_reg; |
| 859 | 864 | |
| @@ -866,7 +871,8 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *task, · 6 unmodified lines | ||
| 866 | 871 | if (unlikely(err)) |
| 867 | 872 | goto err_reg; |
| 868 | 873 | |
| 869 | − err = iser_reg_prot_sg(task, mem, desc, prot_reg); | |
| 874 | + err = iser_reg_prot_sg(task, mem, desc, | |
| 875 | + use_dma_key, prot_reg); | |
| 870 | 876 | if (unlikely(err)) |
| 871 | 877 | goto err_reg; |
| 872 | 878 | } |
| @@ -133,11 +133,15 @@ static int iser_create_device_ib_res(struct iser_device *device) · 132 unmodified lines | ||
| 133 | 133 | (unsigned long)comp); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | − device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE | | |
| 137 | − IB_ACCESS_REMOTE_WRITE | | |
| 138 | − IB_ACCESS_REMOTE_READ); | |
| 139 | − if (IS_ERR(device->mr)) | |
| 140 | − goto dma_mr_err; | |
| 136 | + if (!iser_always_reg) { | |
| 137 | + int access = IB_ACCESS_LOCAL_WRITE | | |
| 138 | + IB_ACCESS_REMOTE_WRITE | | |
| 139 | + IB_ACCESS_REMOTE_READ; | |
| 140 | + | |
| 141 | + device->mr = ib_get_dma_mr(device->pd, access); | |
| 142 | + if (IS_ERR(device->mr)) | |
| 143 | + goto dma_mr_err; | |
| 144 | + } | |
| 141 | 145 | |
| 142 | 146 | INIT_IB_EVENT_HANDLER(&device->event_handler, device->ib_device, |
| 143 | 147 | iser_event_handler); |
| @@ -147,7 +151,8 @@ static int iser_create_device_ib_res(struct iser_device *device) · 3 unmodified lines | ||
| 147 | 151 | return 0; |
| 148 | 152 | |
| 149 | 153 | handler_err: |
| 150 | − ib_dereg_mr(device->mr); | |
| 154 | + if (device->mr) | |
| 155 | + ib_dereg_mr(device->mr); | |
| 151 | 156 | dma_mr_err: |
| 152 | 157 | for (i = 0; i < device->comps_used; i++) |
| 153 | 158 | tasklet_kill(&device->comps[i].tasklet); |
| @@ -173,7 +178,6 @@ comps_err: · 19 unmodified lines | ||
| 173 | 178 | static void iser_free_device_ib_res(struct iser_device *device) |
| 174 | 179 | { |
| 175 | 180 | int i; |
| 176 | − BUG_ON(device->mr == NULL); | |
| 177 | 181 | |
| 178 | 182 | for (i = 0; i < device->comps_used; i++) { |
| 179 | 183 | struct iser_comp *comp = &device->comps[i]; |
| @@ -184,7 +188,8 @@ static void iser_free_device_ib_res(struct iser_device *device) · 4 unmodified lines | ||
| 184 | 188 | } |
| 185 | 189 | |
| 186 | 190 | (void)ib_unregister_event_handler(&device->event_handler); |
| 187 | − (void)ib_dereg_mr(device->mr); | |
| 191 | + if (device->mr) | |
| 192 | + (void)ib_dereg_mr(device->mr); | |
| 188 | 193 | ib_dealloc_pd(device->pd); |
| 189 | 194 | |
| 190 | 195 | kfree(device->comps); |
| @@ -238,8 +238,6 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) · 237 unmodified lines | ||
| 238 | 238 | rx_sg->lkey = device->pd->local_dma_lkey; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | − isert_conn->rx_desc_head = 0; | |
| 242 | − | |
| 243 | 241 | return 0; |
| 244 | 242 | |
| 245 | 243 | dma_map_fail: |
| @@ -634,7 +632,7 @@ static void · 388 unmodified lines | ||
| 634 | 632 | isert_init_conn(struct isert_conn *isert_conn) |
| 635 | 633 | { |
| 636 | 634 | isert_conn->state = ISER_CONN_INIT; |
| 637 | − INIT_LIST_HEAD(&isert_conn->accept_node); | |
| 635 | + INIT_LIST_HEAD(&isert_conn->node); | |
| 638 | 636 | init_completion(&isert_conn->login_comp); |
| 639 | 637 | init_completion(&isert_conn->login_req_comp); |
| 640 | 638 | init_completion(&isert_conn->wait); |
| @@ -762,28 +760,15 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) · 121 unmodified lines | ||
| 762 | 760 | ret = isert_rdma_post_recvl(isert_conn); |
| 763 | 761 | if (ret) |
| 764 | 762 | goto out_conn_dev; |
| 765 | − /* | |
| 766 | − * Obtain the second reference now before isert_rdma_accept() to | |
| 767 | − * ensure that any initiator generated REJECT CM event that occurs | |
| 768 | − * asynchronously won't drop the last reference until the error path | |
| 769 | − * in iscsi_target_login_sess_out() does it's ->iscsit_free_conn() -> | |
| 770 | − * isert_free_conn() -> isert_put_conn() -> kref_put(). | |
| 771 | − */ | |
| 772 | − if (!kref_get_unless_zero(&isert_conn->kref)) { | |
| 773 | − isert_warn("conn %p connect_release is running\n", isert_conn); | |
| 774 | − goto out_conn_dev; | |
| 775 | − } | |
| 776 | 763 | |
| 777 | 764 | ret = isert_rdma_accept(isert_conn); |
| 778 | 765 | if (ret) |
| 779 | 766 | goto out_conn_dev; |
| 780 | 767 | |
| 781 | − mutex_lock(&isert_np->np_accept_mutex); | |
| 782 | − list_add_tail(&isert_conn->accept_node, &isert_np->np_accept_list); | |
| 783 | − mutex_unlock(&isert_np->np_accept_mutex); | |
| 768 | + mutex_lock(&isert_np->mutex); | |
| 769 | + list_add_tail(&isert_conn->node, &isert_np->accepted); | |
| 770 | + mutex_unlock(&isert_np->mutex); | |
| 784 | 771 | |
| 785 | − isert_info("np %p: Allow accept_np to continue\n", np); | |
| 786 | − up(&isert_np->np_sem); | |
| 787 | 772 | return 0; |
| 788 | 773 | |
| 789 | 774 | out_conn_dev: |
| @@ -831,13 +816,21 @@ static void · 41 unmodified lines | ||
| 831 | 816 | isert_connected_handler(struct rdma_cm_id *cma_id) |
| 832 | 817 | { |
| 833 | 818 | struct isert_conn *isert_conn = cma_id->qp->qp_context; |
| 819 | + struct isert_np *isert_np = cma_id->context; | |
| 834 | 820 | |
| 835 | 821 | isert_info("conn %p\n", isert_conn); |
| 836 | 822 | |
| 837 | 823 | mutex_lock(&isert_conn->mutex); |
| 838 | − if (isert_conn->state != ISER_CONN_FULL_FEATURE) | |
| 839 | − isert_conn->state = ISER_CONN_UP; | |
| 824 | + isert_conn->state = ISER_CONN_UP; | |
| 825 | + kref_get(&isert_conn->kref); | |
| 840 | 826 | mutex_unlock(&isert_conn->mutex); |
| 827 | + | |
| 828 | + mutex_lock(&isert_np->mutex); | |
| 829 | + list_move_tail(&isert_conn->node, &isert_np->pending); | |
| 830 | + mutex_unlock(&isert_np->mutex); | |
| 831 | + | |
| 832 | + isert_info("np %p: Allow accept_np to continue\n", isert_np); | |
| 833 | + up(&isert_np->sem); | |
| 841 | 834 | } |
| 842 | 835 | |
| 843 | 836 | static void |
| @@ -903,14 +896,14 @@ isert_np_cma_handler(struct isert_np *isert_np, · 59 unmodified lines | ||
| 903 | 896 | |
| 904 | 897 | switch (event) { |
| 905 | 898 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
| 906 | − isert_np->np_cm_id = NULL; | |
| 899 | + isert_np->cm_id = NULL; | |
| 907 | 900 | break; |
| 908 | 901 | case RDMA_CM_EVENT_ADDR_CHANGE: |
| 909 | − isert_np->np_cm_id = isert_setup_id(isert_np); | |
| 910 | − if (IS_ERR(isert_np->np_cm_id)) { | |
| 902 | + isert_np->cm_id = isert_setup_id(isert_np); | |
| 903 | + if (IS_ERR(isert_np->cm_id)) { | |
| 911 | 904 | isert_err("isert np %p setup id failed: %ld\n", |
| 912 | − isert_np, PTR_ERR(isert_np->np_cm_id)); | |
| 913 | − isert_np->np_cm_id = NULL; | |
| 905 | + isert_np, PTR_ERR(isert_np->cm_id)); | |
| 906 | + isert_np->cm_id = NULL; | |
| 914 | 907 | } |
| 915 | 908 | break; |
| 916 | 909 | default: |
| @@ -929,7 +922,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, · 12 unmodified lines | ||
| 929 | 922 | struct isert_conn *isert_conn; |
| 930 | 923 | bool terminating = false; |
| 931 | 924 | |
| 932 | − if (isert_np->np_cm_id == cma_id) | |
| 925 | + if (isert_np->cm_id == cma_id) | |
| 933 | 926 | return isert_np_cma_handler(cma_id->context, event); |
| 934 | 927 | |
| 935 | 928 | isert_conn = cma_id->qp->qp_context; |
| @@ -945,13 +938,13 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, · 9 unmodified lines | ||
| 945 | 938 | if (terminating) |
| 946 | 939 | goto out; |
| 947 | 940 | |
| 948 | − mutex_lock(&isert_np->np_accept_mutex); | |
| 949 | − if (!list_empty(&isert_conn->accept_node)) { | |
| 950 | − list_del_init(&isert_conn->accept_node); | |
| 941 | + mutex_lock(&isert_np->mutex); | |
| 942 | + if (!list_empty(&isert_conn->node)) { | |
| 943 | + list_del_init(&isert_conn->node); | |
| 951 | 944 | isert_put_conn(isert_conn); |
| 952 | 945 | queue_work(isert_release_wq, &isert_conn->release_work); |
| 953 | 946 | } |
| 954 | − mutex_unlock(&isert_np->np_accept_mutex); | |
| 947 | + mutex_unlock(&isert_np->mutex); | |
| 955 | 948 | |
| 956 | 949 | out: |
| 957 | 950 | return 0; |
| @@ -962,6 +955,7 @@ isert_connect_error(struct rdma_cm_id *cma_id) · 4 unmodified lines | ||
| 962 | 955 | { |
| 963 | 956 | struct isert_conn *isert_conn = cma_id->qp->qp_context; |
| 964 | 957 | |
| 958 | + list_del_init(&isert_conn->node); | |
| 965 | 959 | isert_conn->cm_id = NULL; |
| 966 | 960 | isert_put_conn(isert_conn); |
| 967 | 961 | |
| @@ -1006,35 +1000,51 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) · 38 unmodified lines | ||
| 1006 | 1000 | } |
| 1007 | 1001 | |
| 1008 | 1002 | static int |
| 1009 | −isert_post_recv(struct isert_conn *isert_conn, u32 count) | |
| 1003 | +isert_post_recvm(struct isert_conn *isert_conn, u32 count) | |
| 1010 | 1004 | { |
| 1011 | 1005 | struct ib_recv_wr *rx_wr, *rx_wr_failed; |
| 1012 | 1006 | int i, ret; |
| 1013 | − unsigned int rx_head = isert_conn->rx_desc_head; | |
| 1014 | 1007 | struct iser_rx_desc *rx_desc; |
| 1015 | 1008 | |
| 1016 | 1009 | for (rx_wr = isert_conn->rx_wr, i = 0; i < count; i++, rx_wr++) { |
| 1017 | − rx_desc = &isert_conn->rx_descs[rx_head]; | |
| 1018 | − rx_wr->wr_id = (uintptr_t)rx_desc; | |
| 1019 | − rx_wr->sg_list = &rx_desc->rx_sg; | |
| 1020 | − rx_wr->num_sge = 1; | |
| 1021 | − rx_wr->next = rx_wr + 1; | |
| 1022 | − rx_head = (rx_head + 1) & (ISERT_QP_MAX_RECV_DTOS - 1); | |
| 1010 | + rx_desc = &isert_conn->rx_descs[i]; | |
| 1011 | + rx_wr->wr_id = (uintptr_t)rx_desc; | |
| 1012 | + rx_wr->sg_list = &rx_desc->rx_sg; | |
| 1013 | + rx_wr->num_sge = 1; | |
| 1014 | + rx_wr->next = rx_wr + 1; | |
| 1023 | 1015 | } |
| 1024 | − | |
| 1025 | 1016 | rx_wr--; |
| 1026 | 1017 | rx_wr->next = NULL; /* mark end of work requests list */ |
| 1027 | 1018 | |
| 1028 | 1019 | isert_conn->post_recv_buf_count += count; |
| 1029 | 1020 | ret = ib_post_recv(isert_conn->qp, isert_conn->rx_wr, |
| 1030 | − &rx_wr_failed); | |
| 1021 | + &rx_wr_failed); | |
| 1031 | 1022 | if (ret) { |
| 1032 | 1023 | isert_err("ib_post_recv() failed with ret: %d\n", ret); |
| 1033 | 1024 | isert_conn->post_recv_buf_count -= count; |
| 1034 | − } else { | |
| 1035 | − isert_dbg("Posted %d RX buffers\n", count); | |
| 1036 | − isert_conn->rx_desc_head = rx_head; | |
| 1037 | 1025 | } |
| 1026 | + | |
| 1027 | + return ret; | |
| 1028 | +} | |
| 1029 | + | |
| 1030 | +static int | |
| 1031 | +isert_post_recv(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc) | |
| 1032 | +{ | |
| 1033 | + struct ib_recv_wr *rx_wr_failed, rx_wr; | |
| 1034 | + int ret; | |
| 1035 | + | |
| 1036 | + rx_wr.wr_id = (uintptr_t)rx_desc; | |
| 1037 | + rx_wr.sg_list = &rx_desc->rx_sg; | |
| 1038 | + rx_wr.num_sge = 1; | |
| 1039 | + rx_wr.next = NULL; | |
| 1040 | + | |
| 1041 | + isert_conn->post_recv_buf_count++; | |
| 1042 | + ret = ib_post_recv(isert_conn->qp, &rx_wr, &rx_wr_failed); | |
| 1043 | + if (ret) { | |
| 1044 | + isert_err("ib_post_recv() failed with ret: %d\n", ret); | |
| 1045 | + isert_conn->post_recv_buf_count--; | |
| 1046 | + } | |
| 1047 | + | |
| 1038 | 1048 | return ret; |
| 1039 | 1049 | } |
| 1040 | 1050 | |
| @@ -1205,7 +1215,8 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, · 164 unmodified lines | ||
| 1205 | 1215 | if (ret) |
| 1206 | 1216 | return ret; |
| 1207 | 1217 | |
| 1208 | − ret = isert_post_recv(isert_conn, ISERT_MIN_POSTED_RX); | |
| 1218 | + ret = isert_post_recvm(isert_conn, | |
| 1219 | + ISERT_QP_MAX_RECV_DTOS); | |
| 1209 | 1220 | if (ret) |
| 1210 | 1221 | return ret; |
| 1211 | 1222 | |
| @@ -1278,7 +1289,7 @@ isert_rx_login_req(struct isert_conn *isert_conn) · 66 unmodified lines | ||
| 1278 | 1289 | } |
| 1279 | 1290 | |
| 1280 | 1291 | static struct iscsi_cmd |
| 1281 | −*isert_allocate_cmd(struct iscsi_conn *conn) | |
| 1292 | +*isert_allocate_cmd(struct iscsi_conn *conn, struct iser_rx_desc *rx_desc) | |
| 1282 | 1293 | { |
| 1283 | 1294 | struct isert_conn *isert_conn = conn->context; |
| 1284 | 1295 | struct isert_cmd *isert_cmd; |
| @@ -1292,6 +1303,7 @@ static struct iscsi_cmd · 7 unmodified lines | ||
| 1292 | 1303 | isert_cmd = iscsit_priv_cmd(cmd); |
| 1293 | 1304 | isert_cmd->conn = isert_conn; |
| 1294 | 1305 | isert_cmd->iscsi_cmd = cmd; |
| 1306 | + isert_cmd->rx_desc = rx_desc; | |
| 1295 | 1307 | |
| 1296 | 1308 | return cmd; |
| 1297 | 1309 | } |
| @@ -1303,9 +1315,9 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, · 5 unmodified lines | ||
| 1303 | 1315 | { |
| 1304 | 1316 | struct iscsi_conn *conn = isert_conn->conn; |
| 1305 | 1317 | struct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)buf; |
| 1306 | − struct scatterlist *sg; | |
| 1307 | 1318 | int imm_data, imm_data_len, unsol_data, sg_nents, rc; |
| 1308 | 1319 | bool dump_payload = false; |
| 1320 | + unsigned int data_len; | |
| 1309 | 1321 | |
| 1310 | 1322 | rc = iscsit_setup_scsi_cmd(conn, cmd, buf); |
| 1311 | 1323 | if (rc < 0) |
| @@ -1314,7 +1326,10 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, · 2 unmodified lines | ||
| 1314 | 1326 | imm_data = cmd->immediate_data; |
| 1315 | 1327 | imm_data_len = cmd->first_burst_len; |
| 1316 | 1328 | unsol_data = cmd->unsolicited_data; |
| 1329 | + data_len = cmd->se_cmd.data_length; | |
| 1317 | 1330 | |
| 1331 | + if (imm_data && imm_data_len == data_len) | |
| 1332 | + cmd->se_cmd.se_cmd_flags |= SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC; | |
| 1318 | 1333 | rc = iscsit_process_scsi_cmd(conn, cmd, hdr); |
| 1319 | 1334 | if (rc < 0) { |
| 1320 | 1335 | return 0; |
| @@ -1326,13 +1341,20 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, · 5 unmodified lines | ||
| 1326 | 1341 | if (!imm_data) |
| 1327 | 1342 | return 0; |
| 1328 | 1343 | |
| 1329 | − sg = &cmd->se_cmd.t_data_sg[0]; | |
| 1330 | − sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); | |
| 1331 | − | |
| 1332 | − isert_dbg("Copying Immediate SG: %p sg_nents: %u from %p imm_data_len: %d\n", | |
| 1333 | − sg, sg_nents, &rx_desc->data[0], imm_data_len); | |
| 1334 | − | |
| 1335 | − sg_copy_from_buffer(sg, sg_nents, &rx_desc->data[0], imm_data_len); | |
| 1344 | + if (imm_data_len != data_len) { | |
| 1345 | + sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); | |
| 1346 | + sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, | |
| 1347 | + &rx_desc->data[0], imm_data_len); | |
| 1348 | + isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", | |
| 1349 | + sg_nents, imm_data_len); | |
| 1350 | + } else { | |
| 1351 | + sg_init_table(&isert_cmd->sg, 1); | |
| 1352 | + cmd->se_cmd.t_data_sg = &isert_cmd->sg; | |
| 1353 | + cmd->se_cmd.t_data_nents = 1; | |
| 1354 | + sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len); | |
| 1355 | + isert_dbg("Transfer Immediate imm_data_len: %d\n", | |
| 1356 | + imm_data_len); | |
| 1357 | + } | |
| 1336 | 1358 | |
| 1337 | 1359 | cmd->write_data_done += imm_data_len; |
| 1338 | 1360 | |
| @@ -1407,6 +1429,15 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn, · 68 unmodified lines | ||
| 1407 | 1429 | if (rc < 0) |
| 1408 | 1430 | return rc; |
| 1409 | 1431 | |
| 1432 | + /* | |
| 1433 | + * multiple data-outs on the same command can arrive - | |
| 1434 | + * so post the buffer before hand | |
| 1435 | + */ | |
| 1436 | + rc = isert_post_recv(isert_conn, rx_desc); | |
| 1437 | + if (rc) { | |
| 1438 | + isert_err("ib_post_recv failed with %d\n", rc); | |
| 1439 | + return rc; | |
| 1440 | + } | |
| 1410 | 1441 | return 0; |
| 1411 | 1442 | } |
| 1412 | 1443 | |
| @@ -1479,7 +1510,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 66 unmodified lines | ||
| 1479 | 1510 | |
| 1480 | 1511 | switch (opcode) { |
| 1481 | 1512 | case ISCSI_OP_SCSI_CMD: |
| 1482 | − cmd = isert_allocate_cmd(conn); | |
| 1513 | + cmd = isert_allocate_cmd(conn, rx_desc); | |
| 1483 | 1514 | if (!cmd) |
| 1484 | 1515 | break; |
| 1485 | 1516 | |
| @@ -1493,7 +1524,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 7 unmodified lines | ||
| 1493 | 1524 | rx_desc, (unsigned char *)hdr); |
| 1494 | 1525 | break; |
| 1495 | 1526 | case ISCSI_OP_NOOP_OUT: |
| 1496 | − cmd = isert_allocate_cmd(conn); | |
| 1527 | + cmd = isert_allocate_cmd(conn, rx_desc); | |
| 1497 | 1528 | if (!cmd) |
| 1498 | 1529 | break; |
| 1499 | 1530 | |
| @@ -1506,7 +1537,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 6 unmodified lines | ||
| 1506 | 1537 | (unsigned char *)hdr); |
| 1507 | 1538 | break; |
| 1508 | 1539 | case ISCSI_OP_SCSI_TMFUNC: |
| 1509 | − cmd = isert_allocate_cmd(conn); | |
| 1540 | + cmd = isert_allocate_cmd(conn, rx_desc); | |
| 1510 | 1541 | if (!cmd) |
| 1511 | 1542 | break; |
| 1512 | 1543 | |
| @@ -1514,22 +1545,20 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 1 unmodified line | ||
| 1514 | 1545 | (unsigned char *)hdr); |
| 1515 | 1546 | break; |
| 1516 | 1547 | case ISCSI_OP_LOGOUT: |
| 1517 | − cmd = isert_allocate_cmd(conn); | |
| 1548 | + cmd = isert_allocate_cmd(conn, rx_desc); | |
| 1518 | 1549 | if (!cmd) |
| 1519 | 1550 | break; |
| 1520 | 1551 | |
| 1521 | 1552 | ret = iscsit_handle_logout_cmd(conn, cmd, (unsigned char *)hdr); |
| 1522 | 1553 | break; |
| 1523 | 1554 | case ISCSI_OP_TEXT: |
| 1524 | − if (be32_to_cpu(hdr->ttt) != 0xFFFFFFFF) { | |
| 1555 | + if (be32_to_cpu(hdr->ttt) != 0xFFFFFFFF) | |
| 1525 | 1556 | cmd = iscsit_find_cmd_from_itt(conn, hdr->itt); |
| 1526 | − if (!cmd) | |
| 1527 | − break; | |
| 1528 | − } else { | |
| 1529 | − cmd = isert_allocate_cmd(conn); | |
| 1530 | − if (!cmd) | |
| 1531 | − break; | |
| 1532 | − } | |
| 1557 | + else | |
| 1558 | + cmd = isert_allocate_cmd(conn, rx_desc); | |
| 1559 | + | |
| 1560 | + if (!cmd) | |
| 1561 | + break; | |
| 1533 | 1562 | |
| 1534 | 1563 | isert_cmd = iscsit_priv_cmd(cmd); |
| 1535 | 1564 | ret = isert_handle_text_cmd(isert_conn, isert_cmd, cmd, |
| @@ -1589,7 +1618,7 @@ isert_rcv_completion(struct iser_rx_desc *desc, · 53 unmodified lines | ||
| 1589 | 1618 | struct ib_device *ib_dev = isert_conn->cm_id->device; |
| 1590 | 1619 | struct iscsi_hdr *hdr; |
| 1591 | 1620 | u64 rx_dma; |
| 1592 | − int rx_buflen, outstanding; | |
| 1621 | + int rx_buflen; | |
| 1593 | 1622 | |
| 1594 | 1623 | if ((char *)desc == isert_conn->login_req_buf) { |
| 1595 | 1624 | rx_dma = isert_conn->login_req_dma; |
| @@ -1629,22 +1658,6 @@ isert_rcv_completion(struct iser_rx_desc *desc, · 33 unmodified lines | ||
| 1629 | 1658 | DMA_FROM_DEVICE); |
| 1630 | 1659 | |
| 1631 | 1660 | isert_conn->post_recv_buf_count--; |
| 1632 | − isert_dbg("Decremented post_recv_buf_count: %d\n", | |
| 1633 | − isert_conn->post_recv_buf_count); | |
| 1634 | − | |
| 1635 | − if ((char *)desc == isert_conn->login_req_buf) | |
| 1636 | − return; | |
| 1637 | − | |
| 1638 | − outstanding = isert_conn->post_recv_buf_count; | |
| 1639 | − if (outstanding + ISERT_MIN_POSTED_RX <= ISERT_QP_MAX_RECV_DTOS) { | |
| 1640 | − int err, count = min(ISERT_QP_MAX_RECV_DTOS - outstanding, | |
| 1641 | − ISERT_MIN_POSTED_RX); | |
| 1642 | − err = isert_post_recv(isert_conn, count); | |
| 1643 | − if (err) { | |
| 1644 | − isert_err("isert_post_recv() count: %d failed, %d\n", | |
| 1645 | − count, err); | |
| 1646 | − } | |
| 1647 | − } | |
| 1648 | 1661 | } |
| 1649 | 1662 | |
| 1650 | 1663 | static int |
| @@ -2156,6 +2169,12 @@ isert_post_response(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd) · 505 unmodified lines | ||
| 2156 | 2169 | struct ib_send_wr *wr_failed; |
| 2157 | 2170 | int ret; |
| 2158 | 2171 | |
| 2172 | + ret = isert_post_recv(isert_conn, isert_cmd->rx_desc); | |
| 2173 | + if (ret) { | |
| 2174 | + isert_err("ib_post_recv failed with %d\n", ret); | |
| 2175 | + return ret; | |
| 2176 | + } | |
| 2177 | + | |
| 2159 | 2178 | ret = ib_post_send(isert_conn->qp, &isert_cmd->tx_desc.send_wr, |
| 2160 | 2179 | &wr_failed); |
| 2161 | 2180 | if (ret) { |
| @@ -2950,6 +2969,12 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) · 788 unmodified lines | ||
| 2950 | 2969 | &isert_cmd->tx_desc.send_wr); |
| 2951 | 2970 | isert_cmd->rdma_wr.s_send_wr.next = &isert_cmd->tx_desc.send_wr; |
| 2952 | 2971 | wr->send_wr_num += 1; |
| 2972 | + | |
| 2973 | + rc = isert_post_recv(isert_conn, isert_cmd->rx_desc); | |
| 2974 | + if (rc) { | |
| 2975 | + isert_err("ib_post_recv failed with %d\n", rc); | |
| 2976 | + return rc; | |
| 2977 | + } | |
| 2953 | 2978 | } |
| 2954 | 2979 | |
| 2955 | 2980 | rc = ib_post_send(isert_conn->qp, wr->send_wr, &wr_failed); |
| @@ -2999,9 +3024,16 @@ isert_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, bool recovery) · 43 unmodified lines | ||
| 2999 | 3024 | static int |
| 3000 | 3025 | isert_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) |
| 3001 | 3026 | { |
| 3002 | − int ret; | |
| 3027 | + struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd); | |
| 3028 | + int ret = 0; | |
| 3003 | 3029 | |
| 3004 | 3030 | switch (state) { |
| 3031 | + case ISTATE_REMOVE: | |
| 3032 | + spin_lock_bh(&conn->cmd_lock); | |
| 3033 | + list_del_init(&cmd->i_conn_node); | |
| 3034 | + spin_unlock_bh(&conn->cmd_lock); | |
| 3035 | + isert_put_cmd(isert_cmd, true); | |
| 3036 | + break; | |
| 3005 | 3037 | case ISTATE_SEND_NOPIN_WANT_RESPONSE: |
| 3006 | 3038 | ret = isert_put_nopin(cmd, conn, false); |
| 3007 | 3039 | break; |
| @@ -3106,10 +3138,10 @@ isert_setup_np(struct iscsi_np *np, · 98 unmodified lines | ||
| 3106 | 3138 | isert_err("Unable to allocate struct isert_np\n"); |
| 3107 | 3139 | return -ENOMEM; |
| 3108 | 3140 | } |
| 3109 | − sema_init(&isert_np->np_sem, 0); | |
| 3110 | − mutex_init(&isert_np->np_accept_mutex); | |
| 3111 | − INIT_LIST_HEAD(&isert_np->np_accept_list); | |
| 3112 | − init_completion(&isert_np->np_login_comp); | |
| 3141 | + sema_init(&isert_np->sem, 0); | |
| 3142 | + mutex_init(&isert_np->mutex); | |
| 3143 | + INIT_LIST_HEAD(&isert_np->accepted); | |
| 3144 | + INIT_LIST_HEAD(&isert_np->pending); | |
| 3113 | 3145 | isert_np->np = np; |
| 3114 | 3146 | |
| 3115 | 3147 | /* |
| @@ -3125,7 +3157,7 @@ isert_setup_np(struct iscsi_np *np, · 9 unmodified lines | ||
| 3125 | 3157 | goto out; |
| 3126 | 3158 | } |
| 3127 | 3159 | |
| 3128 | − isert_np->np_cm_id = isert_lid; | |
| 3160 | + isert_np->cm_id = isert_lid; | |
| 3129 | 3161 | np->np_context = isert_np; |
| 3130 | 3162 | |
| 3131 | 3163 | return 0; |
| @@ -3214,7 +3246,7 @@ isert_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) · 82 unmodified lines | ||
| 3214 | 3246 | int ret; |
| 3215 | 3247 | |
| 3216 | 3248 | accept_wait: |
| 3217 | − ret = down_interruptible(&isert_np->np_sem); | |
| 3249 | + ret = down_interruptible(&isert_np->sem); | |
| 3218 | 3250 | if (ret) |
| 3219 | 3251 | return -ENODEV; |
| 3220 | 3252 | |
| @@ -3231,15 +3263,15 @@ accept_wait: · 10 unmodified lines | ||
| 3231 | 3263 | } |
| 3232 | 3264 | spin_unlock_bh(&np->np_thread_lock); |
| 3233 | 3265 | |
| 3234 | − mutex_lock(&isert_np->np_accept_mutex); | |
| 3235 | − if (list_empty(&isert_np->np_accept_list)) { | |
| 3236 | − mutex_unlock(&isert_np->np_accept_mutex); | |
| 3266 | + mutex_lock(&isert_np->mutex); | |
| 3267 | + if (list_empty(&isert_np->pending)) { | |
| 3268 | + mutex_unlock(&isert_np->mutex); | |
| 3237 | 3269 | goto accept_wait; |
| 3238 | 3270 | } |
| 3239 | − isert_conn = list_first_entry(&isert_np->np_accept_list, | |
| 3240 | − struct isert_conn, accept_node); | |
| 3241 | − list_del_init(&isert_conn->accept_node); | |
| 3242 | − mutex_unlock(&isert_np->np_accept_mutex); | |
| 3271 | + isert_conn = list_first_entry(&isert_np->pending, | |
| 3272 | + struct isert_conn, node); | |
| 3273 | + list_del_init(&isert_conn->node); | |
| 3274 | + mutex_unlock(&isert_np->mutex); | |
| 3243 | 3275 | |
| 3244 | 3276 | conn->context = isert_conn; |
| 3245 | 3277 | isert_conn->conn = conn; |
| @@ -3257,28 +3289,39 @@ isert_free_np(struct iscsi_np *np) · 11 unmodified lines | ||
| 3257 | 3289 | struct isert_np *isert_np = np->np_context; |
| 3258 | 3290 | struct isert_conn *isert_conn, *n; |
| 3259 | 3291 | |
| 3260 | − if (isert_np->np_cm_id) | |
| 3261 | − rdma_destroy_id(isert_np->np_cm_id); | |
| 3292 | + if (isert_np->cm_id) | |
| 3293 | + rdma_destroy_id(isert_np->cm_id); | |
| 3262 | 3294 | |
| 3263 | 3295 | /* |
| 3264 | 3296 | * FIXME: At this point we don't have a good way to insure |
| 3265 | 3297 | * that at this point we don't have hanging connections that |
| 3266 | 3298 | * completed RDMA establishment but didn't start iscsi login |
| 3267 | 3299 | * process. So work-around this by cleaning up what ever piled |
| 3268 | − * up in np_accept_list. | |
| 3300 | + * up in accepted and pending lists. | |
| 3269 | 3301 | */ |
| 3270 | − mutex_lock(&isert_np->np_accept_mutex); | |
| 3271 | − if (!list_empty(&isert_np->np_accept_list)) { | |
| 3272 | − isert_info("Still have isert connections, cleaning up...\n"); | |
| 3302 | + mutex_lock(&isert_np->mutex); | |
| 3303 | + if (!list_empty(&isert_np->pending)) { | |
| 3304 | + isert_info("Still have isert pending connections\n"); | |
| 3305 | + list_for_each_entry_safe(isert_conn, n, | |
| 3306 | + &isert_np->pending, | |
| 3307 | + node) { | |
| 3308 | + isert_info("cleaning isert_conn %p state (%d)\n", | |
| 3309 | + isert_conn, isert_conn->state); | |
| 3310 | + isert_connect_release(isert_conn); | |
| 3311 | + } | |
| 3312 | + } | |
| 3313 | + | |
| 3314 | + if (!list_empty(&isert_np->accepted)) { | |
| 3315 | + isert_info("Still have isert accepted connections\n"); | |
| 3273 | 3316 | list_for_each_entry_safe(isert_conn, n, |
| 3274 | − &isert_np->np_accept_list, | |
| 3275 | − accept_node) { | |
| 3317 | + &isert_np->accepted, | |
| 3318 | + node) { | |
| 3276 | 3319 | isert_info("cleaning isert_conn %p state (%d)\n", |
| 3277 | 3320 | isert_conn, isert_conn->state); |
| 3278 | 3321 | isert_connect_release(isert_conn); |
| 3279 | 3322 | } |
| 3280 | 3323 | } |
| 3281 | − mutex_unlock(&isert_np->np_accept_mutex); | |
| 3324 | + mutex_unlock(&isert_np->mutex); | |
| 3282 | 3325 | |
| 3283 | 3326 | np->np_context = NULL; |
| 3284 | 3327 | kfree(isert_np); |
| @@ -3345,6 +3388,41 @@ isert_wait4flush(struct isert_conn *isert_conn) · 60 unmodified lines | ||
| 3345 | 3388 | wait_for_completion(&isert_conn->wait_comp_err); |
| 3346 | 3389 | } |
| 3347 | 3390 | |
| 3391 | +/** | |
| 3392 | + * isert_put_unsol_pending_cmds() - Drop commands waiting for | |
| 3393 | + * unsolicitate dataout | |
| 3394 | + * @conn: iscsi connection | |
| 3395 | + * | |
| 3396 | + * We might still have commands that are waiting for unsolicited | |
| 3397 | + * dataouts messages. We must put the extra reference on those | |
| 3398 | + * before blocking on the target_wait_for_session_cmds | |
| 3399 | + */ | |
| 3400 | +static void | |
| 3401 | +isert_put_unsol_pending_cmds(struct iscsi_conn *conn) | |
| 3402 | +{ | |
| 3403 | + struct iscsi_cmd *cmd, *tmp; | |
| 3404 | + static LIST_HEAD(drop_cmd_list); | |
| 3405 | + | |
| 3406 | + spin_lock_bh(&conn->cmd_lock); | |
| 3407 | + list_for_each_entry_safe(cmd, tmp, &conn->conn_cmd_list, i_conn_node) { | |
| 3408 | + if ((cmd->cmd_flags & ICF_NON_IMMEDIATE_UNSOLICITED_DATA) && | |
| 3409 | + (cmd->write_data_done < conn->sess->sess_ops->FirstBurstLength) && | |
| 3410 | + (cmd->write_data_done < cmd->se_cmd.data_length)) | |
| 3411 | + list_move_tail(&cmd->i_conn_node, &drop_cmd_list); | |
| 3412 | + } | |
| 3413 | + spin_unlock_bh(&conn->cmd_lock); | |
| 3414 | + | |
| 3415 | + list_for_each_entry_safe(cmd, tmp, &drop_cmd_list, i_conn_node) { | |
| 3416 | + list_del_init(&cmd->i_conn_node); | |
| 3417 | + if (cmd->i_state != ISTATE_REMOVE) { | |
| 3418 | + struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd); | |
| 3419 | + | |
| 3420 | + isert_info("conn %p dropping cmd %p\n", conn, cmd); | |
| 3421 | + isert_put_cmd(isert_cmd, true); | |
| 3422 | + } | |
| 3423 | + } | |
| 3424 | +} | |
| 3425 | + | |
| 3348 | 3426 | static void isert_wait_conn(struct iscsi_conn *conn) |
| 3349 | 3427 | { |
| 3350 | 3428 | struct isert_conn *isert_conn = conn->context; |
| @@ -3363,8 +3441,9 @@ static void isert_wait_conn(struct iscsi_conn *conn) · 12 unmodified lines | ||
| 3363 | 3441 | isert_conn_terminate(isert_conn); |
| 3364 | 3442 | mutex_unlock(&isert_conn->mutex); |
| 3365 | 3443 | |
| 3366 | − isert_wait4cmds(conn); | |
| 3367 | 3444 | isert_wait4flush(isert_conn); |
| 3445 | + isert_put_unsol_pending_cmds(conn); | |
| 3446 | + isert_wait4cmds(conn); | |
| 3368 | 3447 | isert_wait4logout(isert_conn); |
| 3369 | 3448 | |
| 3370 | 3449 | queue_work(isert_release_wq, &isert_conn->release_work); |
| @@ -113,7 +113,6 @@ enum { · 112 unmodified lines | ||
| 113 | 113 | }; |
| 114 | 114 | |
| 115 | 115 | struct isert_rdma_wr { |
| 116 | − struct list_head wr_list; | |
| 117 | 116 | struct isert_cmd *isert_cmd; |
| 118 | 117 | enum iser_ib_op_code iser_ib_op; |
| 119 | 118 | struct ib_sge *ib_sge; |
| @@ -134,14 +133,13 @@ struct isert_cmd { · 14 unmodified lines | ||
| 134 | 133 | uint64_t write_va; |
| 135 | 134 | u64 pdu_buf_dma; |
| 136 | 135 | u32 pdu_buf_len; |
| 137 | − u32 read_va_off; | |
| 138 | − u32 write_va_off; | |
| 139 | − u32 rdma_wr_num; | |
| 140 | 136 | struct isert_conn *conn; |
| 141 | 137 | struct iscsi_cmd *iscsi_cmd; |
| 142 | 138 | struct iser_tx_desc tx_desc; |
| 139 | + struct iser_rx_desc *rx_desc; | |
| 143 | 140 | struct isert_rdma_wr rdma_wr; |
| 144 | 141 | struct work_struct comp_work; |
| 142 | + struct scatterlist sg; | |
| 145 | 143 | }; |
| 146 | 144 | |
| 147 | 145 | struct isert_device; |
| @@ -159,11 +157,10 @@ struct isert_conn { · 11 unmodified lines | ||
| 159 | 157 | u64 login_req_dma; |
| 160 | 158 | int login_req_len; |
| 161 | 159 | u64 login_rsp_dma; |
| 162 | − unsigned int rx_desc_head; | |
| 163 | 160 | struct iser_rx_desc *rx_descs; |
| 164 | − struct ib_recv_wr rx_wr[ISERT_MIN_POSTED_RX]; | |
| 161 | + struct ib_recv_wr rx_wr[ISERT_QP_MAX_RECV_DTOS]; | |
| 165 | 162 | struct iscsi_conn *conn; |
| 166 | − struct list_head accept_node; | |
| 163 | + struct list_head node; | |
| 167 | 164 | struct completion login_comp; |
| 168 | 165 | struct completion login_req_comp; |
| 169 | 166 | struct iser_tx_desc login_tx_desc; |
| @@ -222,9 +219,9 @@ struct isert_device { · 52 unmodified lines | ||
| 222 | 219 | |
| 223 | 220 | struct isert_np { |
| 224 | 221 | struct iscsi_np *np; |
| 225 | − struct semaphore np_sem; | |
| 226 | − struct rdma_cm_id *np_cm_id; | |
| 227 | − struct mutex np_accept_mutex; | |
| 228 | − struct list_head np_accept_list; | |
| 229 | − struct completion np_login_comp; | |
| 222 | + struct semaphore sem; | |
| 223 | + struct rdma_cm_id *cm_id; | |
| 224 | + struct mutex mutex; | |
| 225 | + struct list_head accepted; | |
| 226 | + struct list_head pending; | |
| 230 | 227 | }; |
| @@ -196,6 +196,7 @@ config JOYSTICK_TWIDJOY · 195 unmodified lines | ||
| 196 | 196 | config JOYSTICK_ZHENHUA |
| 197 | 197 | tristate "5-byte Zhenhua RC transmitter" |
| 198 | 198 | select SERIO |
| 199 | + select BITREVERSE | |
| 199 | 200 | help |
| 200 | 201 | Say Y here if you have a Zhen Hua PPM-4CH transmitter which is |
| 201 | 202 | supplied with a ready to fly micro electric indoor helicopters |
| @@ -150,7 +150,7 @@ static void walkera0701_irq_handler(void *handler_data) · 149 unmodified lines | ||
| 150 | 150 | if (w->counter == 24) { /* full frame */ |
| 151 | 151 | walkera0701_parse_frame(w); |
| 152 | 152 | w->counter = NO_SYNC; |
| 153 | − if (abs(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ | |
| 153 | + if (abs64(pulse_time - SYNC_PULSE) < RESERVE) /* new frame sync */ | |
| 154 | 154 | w->counter = 0; |
| 155 | 155 | } else { |
| 156 | 156 | if ((pulse_time > (ANALOG_MIN_PULSE - RESERVE) |
| @@ -161,7 +161,7 @@ static void walkera0701_irq_handler(void *handler_data) · 4 unmodified lines | ||
| 161 | 161 | } else |
| 162 | 162 | w->counter = NO_SYNC; |
| 163 | 163 | } |
| 164 | − } else if (abs(pulse_time - SYNC_PULSE - BIN0_PULSE) < | |
| 164 | + } else if (abs64(pulse_time - SYNC_PULSE - BIN0_PULSE) < | |
| 165 | 165 | RESERVE + BIN1_PULSE - BIN0_PULSE) /* frame sync .. */ |
| 166 | 166 | w->counter = 0; |
| 167 | 167 | |
| @@ -266,7 +266,7 @@ static int omap4_keypad_probe(struct platform_device *pdev) · 265 unmodified lines | ||
| 266 | 266 | |
| 267 | 267 | error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); |
| 268 | 268 | if (error) |
| 269 | − return error; | |
| 269 | + goto err_free_keypad; | |
| 270 | 270 | |
| 271 | 271 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
| 272 | 272 | if (!res) { |
| @@ -93,7 +93,7 @@ static int pm8941_reboot_notify(struct notifier_block *nb, · 92 unmodified lines | ||
| 93 | 93 | default: |
| 94 | 94 | reset_type = PON_PS_HOLD_TYPE_HARD_RESET; |
| 95 | 95 | break; |
| 96 | − }; | |
| 96 | + } | |
| 97 | 97 | |
| 98 | 98 | error = regmap_update_bits(pwrkey->regmap, |
| 99 | 99 | pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, |
| @@ -414,7 +414,7 @@ static int uinput_setup_device(struct uinput_device *udev, · 413 unmodified lines | ||
| 414 | 414 | dev->id.product = user_dev->id.product; |
| 415 | 415 | dev->id.version = user_dev->id.version; |
| 416 | 416 | |
| 417 | − for_each_set_bit(i, dev->absbit, ABS_CNT) { | |
| 417 | + for (i = 0; i < ABS_CNT; i++) { | |
| 418 | 418 | input_abs_set_max(dev, i, user_dev->absmax[i]); |
| 419 | 419 | input_abs_set_min(dev, i, user_dev->absmin[i]); |
| 420 | 420 | input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]); |
| @@ -60,7 +60,7 @@ struct elan_transport_ops { · 59 unmodified lines | ||
| 60 | 60 | int (*get_sm_version)(struct i2c_client *client, |
| 61 | 61 | u8* ic_type, u8 *version); |
| 62 | 62 | int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); |
| 63 | − int (*get_product_id)(struct i2c_client *client, u8 *id); | |
| 63 | + int (*get_product_id)(struct i2c_client *client, u16 *id); | |
| 64 | 64 | |
| 65 | 65 | int (*get_max)(struct i2c_client *client, |
| 66 | 66 | unsigned int *max_x, unsigned int *max_y); |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #include "elan_i2c.h" |
| 41 | 41 | |
| 42 | 42 | #define DRIVER_NAME "elan_i2c" |
| 43 | −#define ELAN_DRIVER_VERSION "1.6.0" | |
| 43 | +#define ELAN_DRIVER_VERSION "1.6.1" | |
| 44 | 44 | #define ETP_MAX_PRESSURE 255 |
| 45 | 45 | #define ETP_FWIDTH_REDUCE 90 |
| 46 | 46 | #define ETP_FINGER_WIDTH 15 |
| @@ -76,7 +76,7 @@ struct elan_tp_data { · 29 unmodified lines | ||
| 76 | 76 | unsigned int x_res; |
| 77 | 77 | unsigned int y_res; |
| 78 | 78 | |
| 79 | − u8 product_id; | |
| 79 | + u16 product_id; | |
| 80 | 80 | u8 fw_version; |
| 81 | 81 | u8 sm_version; |
| 82 | 82 | u8 iap_version; |
| @@ -98,15 +98,25 @@ static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, · 15 unmodified lines | ||
| 98 | 98 | u16 *signature_address) |
| 99 | 99 | { |
| 100 | 100 | switch (iap_version) { |
| 101 | + case 0x00: | |
| 102 | + case 0x06: | |
| 101 | 103 | case 0x08: |
| 102 | 104 | *validpage_count = 512; |
| 103 | 105 | break; |
| 106 | + case 0x03: | |
| 107 | + case 0x07: | |
| 104 | 108 | case 0x09: |
| 109 | + case 0x0A: | |
| 110 | + case 0x0B: | |
| 111 | + case 0x0C: | |
| 105 | 112 | *validpage_count = 768; |
| 106 | 113 | break; |
| 107 | 114 | case 0x0D: |
| 108 | 115 | *validpage_count = 896; |
| 109 | 116 | break; |
| 117 | + case 0x0E: | |
| 118 | + *validpage_count = 640; | |
| 119 | + break; | |
| 110 | 120 | default: |
| 111 | 121 | /* unknown ic type clear value */ |
| 112 | 122 | *validpage_count = 0; |
| @@ -266,11 +276,10 @@ static int elan_query_device_info(struct elan_tp_data *data) · 153 unmodified lines | ||
| 266 | 276 | |
| 267 | 277 | error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, |
| 268 | 278 | &data->fw_signature_address); |
| 269 | − if (error) { | |
| 270 | − dev_err(&data->client->dev, | |
| 271 | − "unknown iap version %d\n", data->iap_version); | |
| 272 | − return error; | |
| 273 | − } | |
| 279 | + if (error) | |
| 280 | + dev_warn(&data->client->dev, | |
| 281 | + "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n", | |
| 282 | + data->iap_version, data->ic_type); | |
| 274 | 283 | |
| 275 | 284 | return 0; |
| 276 | 285 | } |
| @@ -486,6 +495,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev, · 209 unmodified lines | ||
| 486 | 495 | const u8 *fw_signature; |
| 487 | 496 | static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; |
| 488 | 497 | |
| 498 | + if (data->fw_validpage_count == 0) | |
| 499 | + return -EINVAL; | |
| 500 | + | |
| 489 | 501 | /* Look for a firmware with the product id appended. */ |
| 490 | 502 | fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); |
| 491 | 503 | if (!fw_name) { |
| @@ -276,7 +276,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, · 275 unmodified lines | ||
| 276 | 276 | return 0; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | −static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) | |
| 279 | +static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id) | |
| 280 | 280 | { |
| 281 | 281 | int error; |
| 282 | 282 | u8 val[3]; |
| @@ -287,7 +287,7 @@ static int elan_i2c_get_product_id(struct i2c_client *client, u8 *id) · 4 unmodified lines | ||
| 287 | 287 | return error; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | − *id = val[0]; | |
| 290 | + *id = le16_to_cpup((__le16 *)val); | |
| 291 | 291 | return 0; |
| 292 | 292 | } |
| 293 | 293 | |
| @@ -183,7 +183,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client, · 182 unmodified lines | ||
| 183 | 183 | return 0; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | −static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) | |
| 186 | +static int elan_smbus_get_product_id(struct i2c_client *client, u16 *id) | |
| 187 | 187 | { |
| 188 | 188 | int error; |
| 189 | 189 | u8 val[3]; |
| @@ -195,7 +195,7 @@ static int elan_smbus_get_product_id(struct i2c_client *client, u8 *id) · 5 unmodified lines | ||
| 195 | 195 | return error; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | − *id = val[1]; | |
| 198 | + *id = be16_to_cpup((__be16 *)val); | |
| 199 | 199 | return 0; |
| 200 | 200 | } |
| 201 | 201 | |
| @@ -519,18 +519,14 @@ static int synaptics_set_mode(struct psmouse *psmouse) · 518 unmodified lines | ||
| 519 | 519 | struct synaptics_data *priv = psmouse->private; |
| 520 | 520 | |
| 521 | 521 | priv->mode = 0; |
| 522 | − | |
| 523 | − if (priv->absolute_mode) { | |
| 522 | + if (priv->absolute_mode) | |
| 524 | 523 | priv->mode |= SYN_BIT_ABSOLUTE_MODE; |
| 525 | − if (SYN_CAP_EXTENDED(priv->capabilities)) | |
| 526 | − priv->mode |= SYN_BIT_W_MODE; | |
| 527 | − } | |
| 528 | − | |
| 529 | − if (!SYN_MODE_WMODE(priv->mode) && priv->disable_gesture) | |
| 524 | + if (priv->disable_gesture) | |
| 530 | 525 | priv->mode |= SYN_BIT_DISABLE_GESTURE; |
| 531 | − | |
| 532 | 526 | if (psmouse->rate >= 80) |
| 533 | 527 | priv->mode |= SYN_BIT_HIGH_RATE; |
| 528 | + if (SYN_CAP_EXTENDED(priv->capabilities)) | |
| 529 | + priv->mode |= SYN_BIT_W_MODE; | |
| 534 | 530 | |
| 535 | 531 | if (synaptics_mode_cmd(psmouse, priv->mode)) |
| 536 | 532 | return -1; |
| @@ -212,12 +212,17 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) · 211 unmodified lines | ||
| 212 | 212 | * time before the ACK arrives. |
| 213 | 213 | */ |
| 214 | 214 | if (ps2_sendbyte(ps2dev, command & 0xff, |
| 215 | − command == PS2_CMD_RESET_BAT ? 1000 : 200)) | |
| 216 | − goto out; | |
| 215 | + command == PS2_CMD_RESET_BAT ? 1000 : 200)) { | |
| 216 | + serio_pause_rx(ps2dev->serio); | |
| 217 | + goto out_reset_flags; | |
| 218 | + } | |
| 217 | 219 | |
| 218 | − for (i = 0; i < send; i++) | |
| 219 | − if (ps2_sendbyte(ps2dev, param[i], 200)) | |
| 220 | − goto out; | |
| 220 | + for (i = 0; i < send; i++) { | |
| 221 | + if (ps2_sendbyte(ps2dev, param[i], 200)) { | |
| 222 | + serio_pause_rx(ps2dev->serio); | |
| 223 | + goto out_reset_flags; | |
| 224 | + } | |
| 225 | + } | |
| 221 | 226 | |
| 222 | 227 | /* |
| 223 | 228 | * The reset command takes a long time to execute. |
| @@ -234,17 +239,18 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) · 10 unmodified lines | ||
| 234 | 239 | !(ps2dev->flags & PS2_FLAG_CMD), timeout); |
| 235 | 240 | } |
| 236 | 241 | |
| 242 | + serio_pause_rx(ps2dev->serio); | |
| 243 | + | |
| 237 | 244 | if (param) |
| 238 | 245 | for (i = 0; i < receive; i++) |
| 239 | 246 | param[i] = ps2dev->cmdbuf[(receive - 1) - i]; |
| 240 | 247 | |
| 241 | 248 | if (ps2dev->cmdcnt && (command != PS2_CMD_RESET_BAT || ps2dev->cmdcnt != 1)) |
| 242 | − goto out; | |
| 249 | + goto out_reset_flags; | |
| 243 | 250 | |
| 244 | 251 | rc = 0; |
| 245 | 252 | |
| 246 | − out: | |
| 247 | − serio_pause_rx(ps2dev->serio); | |
| 253 | + out_reset_flags: | |
| 248 | 254 | ps2dev->flags = 0; |
| 249 | 255 | serio_continue_rx(ps2dev->serio); |
| 250 | 256 | |
| @@ -194,6 +194,7 @@ static int __init parkbd_init(void) · 193 unmodified lines | ||
| 194 | 194 | parkbd_port = parkbd_allocate_serio(); |
| 195 | 195 | if (!parkbd_port) { |
| 196 | 196 | parport_release(parkbd_dev); |
| 197 | + parport_unregister_device(parkbd_dev); | |
| 197 | 198 | return -ENOMEM; |
| 198 | 199 | } |
| 199 | 200 | |
| @@ -94,7 +94,7 @@ struct imx6ul_tsc { · 93 unmodified lines | ||
| 94 | 94 | * TSC module need ADC to get the measure value. So |
| 95 | 95 | * before config TSC, we should initialize ADC module. |
| 96 | 96 | */ |
| 97 | −static void imx6ul_adc_init(struct imx6ul_tsc *tsc) | |
| 97 | +static int imx6ul_adc_init(struct imx6ul_tsc *tsc) | |
| 98 | 98 | { |
| 99 | 99 | int adc_hc = 0; |
| 100 | 100 | int adc_gc; |
| @@ -122,17 +122,23 @@ static void imx6ul_adc_init(struct imx6ul_tsc *tsc) · 21 unmodified lines | ||
| 122 | 122 | |
| 123 | 123 | timeout = wait_for_completion_timeout |
| 124 | 124 | (&tsc->completion, ADC_TIMEOUT); |
| 125 | − if (timeout == 0) | |
| 125 | + if (timeout == 0) { | |
| 126 | 126 | dev_err(tsc->dev, "Timeout for adc calibration\n"); |
| 127 | + return -ETIMEDOUT; | |
| 128 | + } | |
| 127 | 129 | |
| 128 | 130 | adc_gs = readl(tsc->adc_regs + REG_ADC_GS); |
| 129 | − if (adc_gs & ADC_CALF) | |
| 131 | + if (adc_gs & ADC_CALF) { | |
| 130 | 132 | dev_err(tsc->dev, "ADC calibration failed\n"); |
| 133 | + return -EINVAL; | |
| 134 | + } | |
| 131 | 135 | |
| 132 | 136 | /* TSC need the ADC work in hardware trigger */ |
| 133 | 137 | adc_cfg = readl(tsc->adc_regs + REG_ADC_CFG); |
| 134 | 138 | adc_cfg |= ADC_HARDWARE_TRIGGER; |
| 135 | 139 | writel(adc_cfg, tsc->adc_regs + REG_ADC_CFG); |
| 140 | + | |
| 141 | + return 0; | |
| 136 | 142 | } |
| 137 | 143 | |
| 138 | 144 | /* |
| @@ -188,11 +194,17 @@ static void imx6ul_tsc_set(struct imx6ul_tsc *tsc) · 49 unmodified lines | ||
| 188 | 194 | writel(start, tsc->tsc_regs + REG_TSC_FLOW_CONTROL); |
| 189 | 195 | } |
| 190 | 196 | |
| 191 | −static void imx6ul_tsc_init(struct imx6ul_tsc *tsc) | |
| 197 | +static int imx6ul_tsc_init(struct imx6ul_tsc *tsc) | |
| 192 | 198 | { |
| 193 | − imx6ul_adc_init(tsc); | |
| 199 | + int err; | |
| 200 | + | |
| 201 | + err = imx6ul_adc_init(tsc); | |
| 202 | + if (err) | |
| 203 | + return err; | |
| 194 | 204 | imx6ul_tsc_channel_config(tsc); |
| 195 | 205 | imx6ul_tsc_set(tsc); |
| 206 | + | |
| 207 | + return 0; | |
| 196 | 208 | } |
| 197 | 209 | |
| 198 | 210 | static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc) |
| @@ -311,9 +323,7 @@ static int imx6ul_tsc_open(struct input_dev *input_dev) · 112 unmodified lines | ||
| 311 | 323 | return err; |
| 312 | 324 | } |
| 313 | 325 | |
| 314 | − imx6ul_tsc_init(tsc); | |
| 315 | − | |
| 316 | − return 0; | |
| 326 | + return imx6ul_tsc_init(tsc); | |
| 317 | 327 | } |
| 318 | 328 | |
| 319 | 329 | static void imx6ul_tsc_close(struct input_dev *input_dev) |
| @@ -337,7 +347,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) · 17 unmodified lines | ||
| 337 | 347 | int tsc_irq; |
| 338 | 348 | int adc_irq; |
| 339 | 349 | |
| 340 | − tsc = devm_kzalloc(&pdev->dev, sizeof(struct imx6ul_tsc), GFP_KERNEL); | |
| 350 | + tsc = devm_kzalloc(&pdev->dev, sizeof(*tsc), GFP_KERNEL); | |
| 341 | 351 | if (!tsc) |
| 342 | 352 | return -ENOMEM; |
| 343 | 353 | |
| @@ -345,7 +355,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 345 | 355 | if (!input_dev) |
| 346 | 356 | return -ENOMEM; |
| 347 | 357 | |
| 348 | − input_dev->name = "iMX6UL TouchScreen Controller"; | |
| 358 | + input_dev->name = "iMX6UL Touchscreen Controller"; | |
| 349 | 359 | input_dev->id.bustype = BUS_HOST; |
| 350 | 360 | |
| 351 | 361 | input_dev->open = imx6ul_tsc_open; |
| @@ -406,7 +416,7 @@ static int imx6ul_tsc_probe(struct platform_device *pdev) · 54 unmodified lines | ||
| 406 | 416 | } |
| 407 | 417 | |
| 408 | 418 | adc_irq = platform_get_irq(pdev, 1); |
| 409 | − if (adc_irq <= 0) { | |
| 419 | + if (adc_irq < 0) { | |
| 410 | 420 | dev_err(&pdev->dev, "no adc irq resource?\n"); |
| 411 | 421 | return adc_irq; |
| 412 | 422 | } |
| @@ -491,7 +501,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) · 78 unmodified lines | ||
| 491 | 501 | goto out; |
| 492 | 502 | } |
| 493 | 503 | |
| 494 | − imx6ul_tsc_init(tsc); | |
| 504 | + retval = imx6ul_tsc_init(tsc); | |
| 495 | 505 | } |
| 496 | 506 | |
| 497 | 507 | out: |
| @@ -394,12 +394,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev) · 393 unmodified lines | ||
| 394 | 394 | if (of_property_read_u32(np, "x-size", &pdata->x_size)) { |
| 395 | 395 | dev_err(dev, "failed to get x-size property\n"); |
| 396 | 396 | return NULL; |
| 397 | − }; | |
| 397 | + } | |
| 398 | 398 | |
| 399 | 399 | if (of_property_read_u32(np, "y-size", &pdata->y_size)) { |
| 400 | 400 | dev_err(dev, "failed to get y-size property\n"); |
| 401 | 401 | return NULL; |
| 402 | − }; | |
| 402 | + } | |
| 403 | 403 | |
| 404 | 404 | of_property_read_u32(np, "contact-threshold", |
| 405 | 405 | &pdata->contact_threshold); |
| @@ -43,7 +43,7 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST · 42 unmodified lines | ||
| 43 | 43 | endmenu |
| 44 | 44 | |
| 45 | 45 | config IOMMU_IOVA |
| 46 | − bool | |
| 46 | + tristate | |
| 47 | 47 | |
| 48 | 48 | config OF_IOMMU |
| 49 | 49 | def_bool y |
| @@ -3215,6 +3215,8 @@ static struct iova *intel_alloc_iova(struct device *dev, · 3214 unmodified lines | ||
| 3215 | 3215 | |
| 3216 | 3216 | /* Restrict dma_mask to the width that the iommu can handle */ |
| 3217 | 3217 | dma_mask = min_t(uint64_t, DOMAIN_MAX_ADDR(domain->gaw), dma_mask); |
| 3218 | + /* Ensure we reserve the whole size-aligned region */ | |
| 3219 | + nrpages = __roundup_pow_of_two(nrpages); | |
| 3218 | 3220 | |
| 3219 | 3221 | if (!dmar_forcedac && dma_mask > DMA_BIT_MASK(32)) { |
| 3220 | 3222 | /* |
| @@ -3711,7 +3713,7 @@ static inline int iommu_devinfo_cache_init(void) · 490 unmodified lines | ||
| 3711 | 3713 | static int __init iommu_init_mempool(void) |
| 3712 | 3714 | { |
| 3713 | 3715 | int ret; |
| 3714 | − ret = iommu_iova_cache_init(); | |
| 3716 | + ret = iova_cache_get(); | |
| 3715 | 3717 | if (ret) |
| 3716 | 3718 | return ret; |
| 3717 | 3719 | |
| @@ -3725,7 +3727,7 @@ static int __init iommu_init_mempool(void) · 7 unmodified lines | ||
| 3725 | 3727 | |
| 3726 | 3728 | kmem_cache_destroy(iommu_domain_cache); |
| 3727 | 3729 | domain_error: |
| 3728 | − iommu_iova_cache_destroy(); | |
| 3730 | + iova_cache_put(); | |
| 3729 | 3731 | |
| 3730 | 3732 | return -ENOMEM; |
| 3731 | 3733 | } |
| @@ -3734,7 +3736,7 @@ static void __init iommu_exit_mempool(void) · 2 unmodified lines | ||
| 3734 | 3736 | { |
| 3735 | 3737 | kmem_cache_destroy(iommu_devinfo_cache); |
| 3736 | 3738 | kmem_cache_destroy(iommu_domain_cache); |
| 3737 | − iommu_iova_cache_destroy(); | |
| 3739 | + iova_cache_put(); | |
| 3738 | 3740 | } |
| 3739 | 3741 | |
| 3740 | 3742 | static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev) |
| @@ -18,42 +18,9 @@ · 17 unmodified lines | ||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | #include <linux/iova.h> |
| 21 | +#include <linux/module.h> | |
| 21 | 22 | #include <linux/slab.h> |
| 22 | 23 | |
| 23 | −static struct kmem_cache *iommu_iova_cache; | |
| 24 | − | |
| 25 | −int iommu_iova_cache_init(void) | |
| 26 | −{ | |
| 27 | − int ret = 0; | |
| 28 | − | |
| 29 | − iommu_iova_cache = kmem_cache_create("iommu_iova", | |
| 30 | − sizeof(struct iova), | |
| 31 | − 0, | |
| 32 | − SLAB_HWCACHE_ALIGN, | |
| 33 | − NULL); | |
| 34 | − if (!iommu_iova_cache) { | |
| 35 | − pr_err("Couldn't create iova cache\n"); | |
| 36 | − ret = -ENOMEM; | |
| 37 | − } | |
| 38 | − | |
| 39 | − return ret; | |
| 40 | −} | |
| 41 | − | |
| 42 | −void iommu_iova_cache_destroy(void) | |
| 43 | −{ | |
| 44 | − kmem_cache_destroy(iommu_iova_cache); | |
| 45 | −} | |
| 46 | − | |
| 47 | −struct iova *alloc_iova_mem(void) | |
| 48 | −{ | |
| 49 | − return kmem_cache_alloc(iommu_iova_cache, GFP_ATOMIC); | |
| 50 | −} | |
| 51 | − | |
| 52 | −void free_iova_mem(struct iova *iova) | |
| 53 | −{ | |
| 54 | − kmem_cache_free(iommu_iova_cache, iova); | |
| 55 | −} | |
| 56 | − | |
| 57 | 24 | void |
| 58 | 25 | init_iova_domain(struct iova_domain *iovad, unsigned long granule, |
| 59 | 26 | unsigned long start_pfn, unsigned long pfn_32bit) |
| @@ -72,6 +39,7 @@ init_iova_domain(struct iova_domain *iovad, unsigned long granule, · 12 unmodified lines | ||
| 72 | 39 | iovad->start_pfn = start_pfn; |
| 73 | 40 | iovad->dma_32bit_pfn = pfn_32bit; |
| 74 | 41 | } |
| 42 | +EXPORT_SYMBOL_GPL(init_iova_domain); | |
| 75 | 43 | |
| 76 | 44 | static struct rb_node * |
| 77 | 45 | __get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn) |
| @@ -120,19 +88,14 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) · 42 unmodified lines | ||
| 120 | 88 | } |
| 121 | 89 | } |
| 122 | 90 | |
| 123 | −/* Computes the padding size required, to make the | |
| 124 | − * the start address naturally aligned on its size | |
| 91 | +/* | |
| 92 | + * Computes the padding size required, to make the start address | |
| 93 | + * naturally aligned on the power-of-two order of its size | |
| 125 | 94 | */ |
| 126 | −static int | |
| 127 | −iova_get_pad_size(int size, unsigned int limit_pfn) | |
| 95 | +static unsigned int | |
| 96 | +iova_get_pad_size(unsigned int size, unsigned int limit_pfn) | |
| 128 | 97 | { |
| 129 | − unsigned int pad_size = 0; | |
| 130 | − unsigned int order = ilog2(size); | |
| 131 | − | |
| 132 | − if (order) | |
| 133 | − pad_size = (limit_pfn + 1) % (1 << order); | |
| 134 | − | |
| 135 | − return pad_size; | |
| 98 | + return (limit_pfn + 1 - size) & (__roundup_pow_of_two(size) - 1); | |
| 136 | 99 | } |
| 137 | 100 | |
| 138 | 101 | static int __alloc_and_insert_iova_range(struct iova_domain *iovad, |
| @@ -242,6 +205,57 @@ iova_insert_rbtree(struct rb_root *root, struct iova *iova) · 103 unmodified lines | ||
| 242 | 205 | rb_insert_color(&iova->node, root); |
| 243 | 206 | } |
| 244 | 207 | |
| 208 | +static struct kmem_cache *iova_cache; | |
| 209 | +static unsigned int iova_cache_users; | |
| 210 | +static DEFINE_MUTEX(iova_cache_mutex); | |
| 211 | + | |
| 212 | +struct iova *alloc_iova_mem(void) | |
| 213 | +{ | |
| 214 | + return kmem_cache_alloc(iova_cache, GFP_ATOMIC); | |
| 215 | +} | |
| 216 | +EXPORT_SYMBOL(alloc_iova_mem); | |
| 217 | + | |
| 218 | +void free_iova_mem(struct iova *iova) | |
| 219 | +{ | |
| 220 | + kmem_cache_free(iova_cache, iova); | |
| 221 | +} | |
| 222 | +EXPORT_SYMBOL(free_iova_mem); | |
| 223 | + | |
| 224 | +int iova_cache_get(void) | |
| 225 | +{ | |
| 226 | + mutex_lock(&iova_cache_mutex); | |
| 227 | + if (!iova_cache_users) { | |
| 228 | + iova_cache = kmem_cache_create( | |
| 229 | + "iommu_iova", sizeof(struct iova), 0, | |
| 230 | + SLAB_HWCACHE_ALIGN, NULL); | |
| 231 | + if (!iova_cache) { | |
| 232 | + mutex_unlock(&iova_cache_mutex); | |
| 233 | + printk(KERN_ERR "Couldn't create iova cache\n"); | |
| 234 | + return -ENOMEM; | |
| 235 | + } | |
| 236 | + } | |
| 237 | + | |
| 238 | + iova_cache_users++; | |
| 239 | + mutex_unlock(&iova_cache_mutex); | |
| 240 | + | |
| 241 | + return 0; | |
| 242 | +} | |
| 243 | +EXPORT_SYMBOL_GPL(iova_cache_get); | |
| 244 | + | |
| 245 | +void iova_cache_put(void) | |
| 246 | +{ | |
| 247 | + mutex_lock(&iova_cache_mutex); | |
| 248 | + if (WARN_ON(!iova_cache_users)) { | |
| 249 | + mutex_unlock(&iova_cache_mutex); | |
| 250 | + return; | |
| 251 | + } | |
| 252 | + iova_cache_users--; | |
| 253 | + if (!iova_cache_users) | |
| 254 | + kmem_cache_destroy(iova_cache); | |
| 255 | + mutex_unlock(&iova_cache_mutex); | |
| 256 | +} | |
| 257 | +EXPORT_SYMBOL_GPL(iova_cache_put); | |
| 258 | + | |
| 245 | 259 | /** |
| 246 | 260 | * alloc_iova - allocates an iova |
| 247 | 261 | * @iovad: - iova domain in question |
| @@ -265,12 +279,6 @@ alloc_iova(struct iova_domain *iovad, unsigned long size, · 17 unmodified lines | ||
| 265 | 279 | if (!new_iova) |
| 266 | 280 | return NULL; |
| 267 | 281 | |
| 268 | − /* If size aligned is set then round the size to | |
| 269 | − * to next power of two. | |
| 270 | − */ | |
| 271 | − if (size_aligned) | |
| 272 | − size = __roundup_pow_of_two(size); | |
| 273 | − | |
| 274 | 282 | ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn, |
| 275 | 283 | new_iova, size_aligned); |
| 276 | 284 | |
| @@ -281,6 +289,7 @@ alloc_iova(struct iova_domain *iovad, unsigned long size, · 4 unmodified lines | ||
| 281 | 289 | |
| 282 | 290 | return new_iova; |
| 283 | 291 | } |
| 292 | +EXPORT_SYMBOL_GPL(alloc_iova); | |
| 284 | 293 | |
| 285 | 294 | /** |
| 286 | 295 | * find_iova - find's an iova for a given pfn |
| @@ -321,6 +330,7 @@ struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn) · 34 unmodified lines | ||
| 321 | 330 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); |
| 322 | 331 | return NULL; |
| 323 | 332 | } |
| 333 | +EXPORT_SYMBOL_GPL(find_iova); | |
| 324 | 334 | |
| 325 | 335 | /** |
| 326 | 336 | * __free_iova - frees the given iova |
| @@ -339,6 +349,7 @@ __free_iova(struct iova_domain *iovad, struct iova *iova) · 12 unmodified lines | ||
| 339 | 349 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); |
| 340 | 350 | free_iova_mem(iova); |
| 341 | 351 | } |
| 352 | +EXPORT_SYMBOL_GPL(__free_iova); | |
| 342 | 353 | |
| 343 | 354 | /** |
| 344 | 355 | * free_iova - finds and frees the iova for a given pfn |
| @@ -356,6 +367,7 @@ free_iova(struct iova_domain *iovad, unsigned long pfn) · 11 unmodified lines | ||
| 356 | 367 | __free_iova(iovad, iova); |
| 357 | 368 | |
| 358 | 369 | } |
| 370 | +EXPORT_SYMBOL_GPL(free_iova); | |
| 359 | 371 | |
| 360 | 372 | /** |
| 361 | 373 | * put_iova_domain - destroys the iova doamin |
| @@ -378,6 +390,7 @@ void put_iova_domain(struct iova_domain *iovad) · 16 unmodified lines | ||
| 378 | 390 | } |
| 379 | 391 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); |
| 380 | 392 | } |
| 393 | +EXPORT_SYMBOL_GPL(put_iova_domain); | |
| 381 | 394 | |
| 382 | 395 | static int |
| 383 | 396 | __is_range_overlap(struct rb_node *node, |
| @@ -467,6 +480,7 @@ finish: · 83 unmodified lines | ||
| 467 | 480 | spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); |
| 468 | 481 | return iova; |
| 469 | 482 | } |
| 483 | +EXPORT_SYMBOL_GPL(reserve_iova); | |
| 470 | 484 | |
| 471 | 485 | /** |
| 472 | 486 | * copy_reserved_iova - copies the reserved between domains |
| @@ -493,6 +507,7 @@ copy_reserved_iova(struct iova_domain *from, struct iova_domain *to) · 20 unmodified lines | ||
| 493 | 507 | } |
| 494 | 508 | spin_unlock_irqrestore(&from->iova_rbtree_lock, flags); |
| 495 | 509 | } |
| 510 | +EXPORT_SYMBOL_GPL(copy_reserved_iova); | |
| 496 | 511 | |
| 497 | 512 | struct iova * |
| 498 | 513 | split_and_remove_iova(struct iova_domain *iovad, struct iova *iova, |
| @@ -534,3 +549,6 @@ error: · 35 unmodified lines | ||
| 534 | 549 | free_iova_mem(prev); |
| 535 | 550 | return NULL; |
| 536 | 551 | } |
| 552 | + | |
| 553 | +MODULE_AUTHOR("Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>"); | |
| 554 | +MODULE_LICENSE("GPL"); | |
| @@ -88,28 +88,36 @@ static void aic5_mask(struct irq_data *d) · 87 unmodified lines | ||
| 88 | 88 | { |
| 89 | 89 | struct irq_domain *domain = d->domain; |
| 90 | 90 | struct irq_domain_chip_generic *dgc = domain->gc; |
| 91 | − struct irq_chip_generic *gc = dgc->gc[0]; | |
| 91 | + struct irq_chip_generic *bgc = dgc->gc[0]; | |
| 92 | + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | |
| 92 | 93 | |
| 93 | − /* Disable interrupt on AIC5 */ | |
| 94 | − irq_gc_lock(gc); | |
| 94 | + /* | |
| 95 | + * Disable interrupt on AIC5. We always take the lock of the | |
| 96 | + * first irq chip as all chips share the same registers. | |
| 97 | + */ | |
| 98 | + irq_gc_lock(bgc); | |
| 95 | 99 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
| 96 | 100 | irq_reg_writel(gc, 1, AT91_AIC5_IDCR); |
| 97 | 101 | gc->mask_cache &= ~d->mask; |
| 98 | − irq_gc_unlock(gc); | |
| 102 | + irq_gc_unlock(bgc); | |
| 99 | 103 | } |
| 100 | 104 | |
| 101 | 105 | static void aic5_unmask(struct irq_data *d) |
| 102 | 106 | { |
| 103 | 107 | struct irq_domain *domain = d->domain; |
| 104 | 108 | struct irq_domain_chip_generic *dgc = domain->gc; |
| 105 | − struct irq_chip_generic *gc = dgc->gc[0]; | |
| 109 | + struct irq_chip_generic *bgc = dgc->gc[0]; | |
| 110 | + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | |
| 106 | 111 | |
| 107 | − /* Enable interrupt on AIC5 */ | |
| 108 | − irq_gc_lock(gc); | |
| 112 | + /* | |
| 113 | + * Enable interrupt on AIC5. We always take the lock of the | |
| 114 | + * first irq chip as all chips share the same registers. | |
| 115 | + */ | |
| 116 | + irq_gc_lock(bgc); | |
| 109 | 117 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
| 110 | 118 | irq_reg_writel(gc, 1, AT91_AIC5_IECR); |
| 111 | 119 | gc->mask_cache |= d->mask; |
| 112 | − irq_gc_unlock(gc); | |
| 120 | + irq_gc_unlock(bgc); | |
| 113 | 121 | } |
| 114 | 122 | |
| 115 | 123 | static int aic5_retrigger(struct irq_data *d) |
| @@ -62,7 +62,7 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data) · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | dev_alias->dev_id = alias; |
| 64 | 64 | if (pdev != dev_alias->pdev) |
| 65 | − dev_alias->count += its_pci_msi_vec_count(dev_alias->pdev); | |
| 65 | + dev_alias->count += its_pci_msi_vec_count(pdev); | |
| 66 | 66 | |
| 67 | 67 | return 0; |
| 68 | 68 | } |
| @@ -719,6 +719,9 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids) · 718 unmodified lines | ||
| 719 | 719 | out: |
| 720 | 720 | spin_unlock(&lpi_lock); |
| 721 | 721 | |
| 722 | + if (!bitmap) | |
| 723 | + *base = *nr_ids = 0; | |
| 724 | + | |
| 722 | 725 | return bitmap; |
| 723 | 726 | } |
| 724 | 727 | |
| @@ -320,6 +320,14 @@ static void gic_handle_shared_int(bool chained) · 319 unmodified lines | ||
| 320 | 320 | intrmask[i] = gic_read(intrmask_reg); |
| 321 | 321 | pending_reg += gic_reg_step; |
| 322 | 322 | intrmask_reg += gic_reg_step; |
| 323 | + | |
| 324 | + if (!config_enabled(CONFIG_64BIT) || mips_cm_is64) | |
| 325 | + continue; | |
| 326 | + | |
| 327 | + pending[i] |= (u64)gic_read(pending_reg) << 32; | |
| 328 | + intrmask[i] |= (u64)gic_read(intrmask_reg) << 32; | |
| 329 | + pending_reg += gic_reg_step; | |
| 330 | + intrmask_reg += gic_reg_step; | |
| 323 | 331 | } |
| 324 | 332 | |
| 325 | 333 | bitmap_and(pending, pending, intrmask, gic_shared_intrs); |
| @@ -426,7 +434,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, · 100 unmodified lines | ||
| 426 | 434 | spin_lock_irqsave(&gic_lock, flags); |
| 427 | 435 | |
| 428 | 436 | /* Re-route this IRQ */ |
| 429 | − gic_map_to_vpe(irq, cpumask_first(&tmp)); | |
| 437 | + gic_map_to_vpe(irq, mips_cm_vp_id(cpumask_first(&tmp))); | |
| 430 | 438 | |
| 431 | 439 | /* Update the pcpu_masks */ |
| 432 | 440 | for (i = 0; i < NR_CPUS; i++) |
| @@ -599,7 +607,7 @@ static __init void gic_ipi_init_one(unsigned int intr, int cpu, · 166 unmodified lines | ||
| 599 | 607 | GIC_SHARED_TO_HWIRQ(intr)); |
| 600 | 608 | int i; |
| 601 | 609 | |
| 602 | − gic_map_to_vpe(intr, cpu); | |
| 610 | + gic_map_to_vpe(intr, mips_cm_vp_id(cpu)); | |
| 603 | 611 | for (i = 0; i < NR_CPUS; i++) |
| 604 | 612 | clear_bit(intr, pcpu_masks[i].pcpu_mask); |
| 605 | 613 | set_bit(intr, pcpu_masks[cpu].pcpu_mask); |
| @@ -1997,7 +1997,8 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks, · 1996 unmodified lines | ||
| 1997 | 1997 | if (bitmap->mddev->bitmap_info.offset || bitmap->mddev->bitmap_info.file) |
| 1998 | 1998 | ret = bitmap_storage_alloc(&store, chunks, |
| 1999 | 1999 | !bitmap->mddev->bitmap_info.external, |
| 2000 | − bitmap->cluster_slot); | |
| 2000 | + mddev_is_clustered(bitmap->mddev) | |
| 2001 | + ? bitmap->cluster_slot : 0); | |
| 2001 | 2002 | if (ret) |
| 2002 | 2003 | goto err; |
| 2003 | 2004 | |
| @@ -968,7 +968,8 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone); · 967 unmodified lines | ||
| 968 | 968 | |
| 969 | 969 | /* |
| 970 | 970 | * Generate a new unfragmented bio with the given size |
| 971 | − * This should never violate the device limitations | |
| 971 | + * This should never violate the device limitations (but only because | |
| 972 | + * max_segment_size is being constrained to PAGE_SIZE). | |
| 972 | 973 | * |
| 973 | 974 | * This function may be called concurrently. If we allocate from the mempool |
| 974 | 975 | * concurrently, there is a possibility of deadlock. For example, if we have |
| @@ -2045,9 +2046,20 @@ static int crypt_iterate_devices(struct dm_target *ti, · 1070 unmodified lines | ||
| 2045 | 2046 | return fn(ti, cc->dev, cc->start, ti->len, data); |
| 2046 | 2047 | } |
| 2047 | 2048 | |
| 2049 | +static void crypt_io_hints(struct dm_target *ti, struct queue_limits *limits) | |
| 2050 | +{ | |
| 2051 | + /* | |
| 2052 | + * Unfortunate constraint that is required to avoid the potential | |
| 2053 | + * for exceeding underlying device's max_segments limits -- due to | |
| 2054 | + * crypt_alloc_buffer() possibly allocating pages for the encryption | |
| 2055 | + * bio that are not as physically contiguous as the original bio. | |
| 2056 | + */ | |
| 2057 | + limits->max_segment_size = PAGE_SIZE; | |
| 2058 | +} | |
| 2059 | + | |
| 2048 | 2060 | static struct target_type crypt_target = { |
| 2049 | 2061 | .name = "crypt", |
| 2050 | − .version = {1, 14, 0}, | |
| 2062 | + .version = {1, 14, 1}, | |
| 2051 | 2063 | .module = THIS_MODULE, |
| 2052 | 2064 | .ctr = crypt_ctr, |
| 2053 | 2065 | .dtr = crypt_dtr, |
| @@ -2058,6 +2070,7 @@ static struct target_type crypt_target = { · 4 unmodified lines | ||
| 2058 | 2070 | .resume = crypt_resume, |
| 2059 | 2071 | .message = crypt_message, |
| 2060 | 2072 | .iterate_devices = crypt_iterate_devices, |
| 2073 | + .io_hints = crypt_io_hints, | |
| 2061 | 2074 | }; |
| 2062 | 2075 | |
| 2063 | 2076 | static int __init dm_crypt_init(void) |
| @@ -4249,6 +4249,10 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) · 4248 unmodified lines | ||
| 4249 | 4249 | { |
| 4250 | 4250 | struct thin_c *tc = ti->private; |
| 4251 | 4251 | struct pool *pool = tc->pool; |
| 4252 | + struct queue_limits *pool_limits = dm_get_queue_limits(pool->pool_md); | |
| 4253 | + | |
| 4254 | + if (!pool_limits->discard_granularity) | |
| 4255 | + return; /* pool's discard support is disabled */ | |
| 4252 | 4256 | |
| 4253 | 4257 | limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; |
| 4254 | 4258 | limits->max_discard_sectors = 2048 * 1024 * 16; /* 16G */ |
| @@ -5409,9 +5409,13 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) · 5408 unmodified lines | ||
| 5409 | 5409 | * which will now never happen */ |
| 5410 | 5410 | wake_up_process(mddev->sync_thread->tsk); |
| 5411 | 5411 | |
| 5412 | + if (mddev->external && test_bit(MD_CHANGE_PENDING, &mddev->flags)) | |
| 5413 | + return -EBUSY; | |
| 5412 | 5414 | mddev_unlock(mddev); |
| 5413 | 5415 | wait_event(resync_wait, !test_bit(MD_RECOVERY_RUNNING, |
| 5414 | 5416 | &mddev->recovery)); |
| 5417 | + wait_event(mddev->sb_wait, | |
| 5418 | + !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | |
| 5415 | 5419 | mddev_lock_nointr(mddev); |
| 5416 | 5420 | |
| 5417 | 5421 | mutex_lock(&mddev->open_mutex); |
| @@ -8160,6 +8164,7 @@ void md_check_recovery(struct mddev *mddev) · 2742 unmodified lines | ||
| 8160 | 8164 | md_reap_sync_thread(mddev); |
| 8161 | 8165 | clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
| 8162 | 8166 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
| 8167 | + clear_bit(MD_CHANGE_PENDING, &mddev->flags); | |
| 8163 | 8168 | goto unlock; |
| 8164 | 8169 | } |
| 8165 | 8170 | |
| @@ -470,8 +470,7 @@ static int multipath_run (struct mddev *mddev) · 469 unmodified lines | ||
| 470 | 470 | return 0; |
| 471 | 471 | |
| 472 | 472 | out_free_conf: |
| 473 | − if (conf->pool) | |
| 474 | − mempool_destroy(conf->pool); | |
| 473 | + mempool_destroy(conf->pool); | |
| 475 | 474 | kfree(conf->multipaths); |
| 476 | 475 | kfree(conf); |
| 477 | 476 | mddev->private = NULL; |
| @@ -376,12 +376,6 @@ static int raid0_run(struct mddev *mddev) · 375 unmodified lines | ||
| 376 | 376 | struct md_rdev *rdev; |
| 377 | 377 | bool discard_supported = false; |
| 378 | 378 | |
| 379 | − rdev_for_each(rdev, mddev) { | |
| 380 | − disk_stack_limits(mddev->gendisk, rdev->bdev, | |
| 381 | − rdev->data_offset << 9); | |
| 382 | − if (blk_queue_discard(bdev_get_queue(rdev->bdev))) | |
| 383 | − discard_supported = true; | |
| 384 | − } | |
| 385 | 379 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
| 386 | 380 | blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors); |
| 387 | 381 | blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors); |
| @@ -390,6 +384,12 @@ static int raid0_run(struct mddev *mddev) · 2 unmodified lines | ||
| 390 | 384 | blk_queue_io_opt(mddev->queue, |
| 391 | 385 | (mddev->chunk_sectors << 9) * mddev->raid_disks); |
| 392 | 386 | |
| 387 | + rdev_for_each(rdev, mddev) { | |
| 388 | + disk_stack_limits(mddev->gendisk, rdev->bdev, | |
| 389 | + rdev->data_offset << 9); | |
| 390 | + if (blk_queue_discard(bdev_get_queue(rdev->bdev))) | |
| 391 | + discard_supported = true; | |
| 392 | + } | |
| 393 | 393 | if (!discard_supported) |
| 394 | 394 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); |
| 395 | 395 | else |
| @@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) · 880 unmodified lines | ||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if (bio && bio_data_dir(bio) == WRITE) { |
| 884 | − if (bio->bi_iter.bi_sector >= | |
| 885 | − conf->mddev->curr_resync_completed) { | |
| 884 | + if (bio->bi_iter.bi_sector >= conf->next_resync) { | |
| 886 | 885 | if (conf->start_next_window == MaxSector) |
| 887 | 886 | conf->start_next_window = |
| 888 | 887 | conf->next_resync + |
| @@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf) · 627 unmodified lines | ||
| 1516 | 1515 | conf->r1buf_pool = NULL; |
| 1517 | 1516 | |
| 1518 | 1517 | spin_lock_irq(&conf->resync_lock); |
| 1519 | − conf->next_resync = 0; | |
| 1518 | + conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE; | |
| 1520 | 1519 | conf->start_next_window = MaxSector; |
| 1521 | 1520 | conf->current_window_requests += |
| 1522 | 1521 | conf->next_window_requests; |
| @@ -2843,8 +2842,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) · 1320 unmodified lines | ||
| 2843 | 2842 | |
| 2844 | 2843 | abort: |
| 2845 | 2844 | if (conf) { |
| 2846 | − if (conf->r1bio_pool) | |
| 2847 | − mempool_destroy(conf->r1bio_pool); | |
| 2845 | + mempool_destroy(conf->r1bio_pool); | |
| 2848 | 2846 | kfree(conf->mirrors); |
| 2849 | 2847 | safe_put_page(conf->tmppage); |
| 2850 | 2848 | kfree(conf->poolinfo); |
| @@ -2946,8 +2944,7 @@ static void raid1_free(struct mddev *mddev, void *priv) · 95 unmodified lines | ||
| 2946 | 2944 | { |
| 2947 | 2945 | struct r1conf *conf = priv; |
| 2948 | 2946 | |
| 2949 | − if (conf->r1bio_pool) | |
| 2950 | − mempool_destroy(conf->r1bio_pool); | |
| 2947 | + mempool_destroy(conf->r1bio_pool); | |
| 2951 | 2948 | kfree(conf->mirrors); |
| 2952 | 2949 | safe_put_page(conf->tmppage); |
| 2953 | 2950 | kfree(conf->poolinfo); |
| @@ -3486,8 +3486,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) · 3485 unmodified lines | ||
| 3486 | 3486 | printk(KERN_ERR "md/raid10:%s: couldn't allocate memory.\n", |
| 3487 | 3487 | mdname(mddev)); |
| 3488 | 3488 | if (conf) { |
| 3489 | − if (conf->r10bio_pool) | |
| 3490 | − mempool_destroy(conf->r10bio_pool); | |
| 3489 | + mempool_destroy(conf->r10bio_pool); | |
| 3491 | 3490 | kfree(conf->mirrors); |
| 3492 | 3491 | safe_put_page(conf->tmppage); |
| 3493 | 3492 | kfree(conf); |
| @@ -3682,8 +3681,7 @@ static int run(struct mddev *mddev) · 188 unmodified lines | ||
| 3682 | 3681 | |
| 3683 | 3682 | out_free_conf: |
| 3684 | 3683 | md_unregister_thread(&mddev->thread); |
| 3685 | − if (conf->r10bio_pool) | |
| 3686 | − mempool_destroy(conf->r10bio_pool); | |
| 3684 | + mempool_destroy(conf->r10bio_pool); | |
| 3687 | 3685 | safe_put_page(conf->tmppage); |
| 3688 | 3686 | kfree(conf->mirrors); |
| 3689 | 3687 | kfree(conf); |
| @@ -3696,8 +3694,7 @@ static void raid10_free(struct mddev *mddev, void *priv) · 6 unmodified lines | ||
| 3696 | 3694 | { |
| 3697 | 3695 | struct r10conf *conf = priv; |
| 3698 | 3696 | |
| 3699 | − if (conf->r10bio_pool) | |
| 3700 | − mempool_destroy(conf->r10bio_pool); | |
| 3697 | + mempool_destroy(conf->r10bio_pool); | |
| 3701 | 3698 | safe_put_page(conf->tmppage); |
| 3702 | 3699 | kfree(conf->mirrors); |
| 3703 | 3700 | kfree(conf->mirrors_old); |
| @@ -2271,8 +2271,7 @@ static void shrink_stripes(struct r5conf *conf) · 2270 unmodified lines | ||
| 2271 | 2271 | drop_one_stripe(conf)) |
| 2272 | 2272 | ; |
| 2273 | 2273 | |
| 2274 | − if (conf->slab_cache) | |
| 2275 | − kmem_cache_destroy(conf->slab_cache); | |
| 2274 | + kmem_cache_destroy(conf->slab_cache); | |
| 2276 | 2275 | conf->slab_cache = NULL; |
| 2277 | 2276 | } |
| 2278 | 2277 | |
| @@ -3150,6 +3149,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, · 871 unmodified lines | ||
| 3150 | 3149 | spin_unlock_irq(&sh->stripe_lock); |
| 3151 | 3150 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) |
| 3152 | 3151 | wake_up(&conf->wait_for_overlap); |
| 3152 | + if (bi) | |
| 3153 | + s->to_read--; | |
| 3153 | 3154 | while (bi && bi->bi_iter.bi_sector < |
| 3154 | 3155 | sh->dev[i].sector + STRIPE_SECTORS) { |
| 3155 | 3156 | struct bio *nextbi = |
| @@ -3169,6 +3170,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, · 13 unmodified lines | ||
| 3169 | 3170 | */ |
| 3170 | 3171 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
| 3171 | 3172 | } |
| 3173 | + s->to_write = 0; | |
| 3174 | + s->written = 0; | |
| 3172 | 3175 | |
| 3173 | 3176 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) |
| 3174 | 3177 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
| @@ -3300,7 +3303,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s, · 125 unmodified lines | ||
| 3300 | 3303 | */ |
| 3301 | 3304 | return 0; |
| 3302 | 3305 | |
| 3303 | − for (i = 0; i < s->failed; i++) { | |
| 3306 | + for (i = 0; i < s->failed && i < 2; i++) { | |
| 3304 | 3307 | if (fdev[i]->towrite && |
| 3305 | 3308 | !test_bit(R5_UPTODATE, &fdev[i]->flags) && |
| 3306 | 3309 | !test_bit(R5_OVERWRITE, &fdev[i]->flags)) |
| @@ -3324,7 +3327,7 @@ static int need_this_block(struct stripe_head *sh, struct stripe_head_state *s, · 17 unmodified lines | ||
| 3324 | 3327 | sh->sector < sh->raid_conf->mddev->recovery_cp) |
| 3325 | 3328 | /* reconstruct-write isn't being forced */ |
| 3326 | 3329 | return 0; |
| 3327 | − for (i = 0; i < s->failed; i++) { | |
| 3330 | + for (i = 0; i < s->failed && i < 2; i++) { | |
| 3328 | 3331 | if (s->failed_num[i] != sh->pd_idx && |
| 3329 | 3332 | s->failed_num[i] != sh->qd_idx && |
| 3330 | 3333 | !test_bit(R5_UPTODATE, &fdev[i]->flags) && |
| @@ -592,6 +592,8 @@ int cxl_sysfs_afu_add(struct cxl_afu *afu) · 591 unmodified lines | ||
| 592 | 592 | |
| 593 | 593 | /* conditionally create the add the binary file for error info buffer */ |
| 594 | 594 | if (afu->eb_len) { |
| 595 | + sysfs_attr_init(&afu->attr_eb.attr); | |
| 596 | + | |
| 595 | 597 | afu->attr_eb.attr.name = "afu_err_buff"; |
| 596 | 598 | afu->attr_eb.attr.mode = S_IRUGO; |
| 597 | 599 | afu->attr_eb.size = afu->eb_len; |
| @@ -204,6 +204,8 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name) · 203 unmodified lines | ||
| 204 | 204 | if (!dir) |
| 205 | 205 | return -ENOMEM; |
| 206 | 206 | |
| 207 | + dev->dbgfs_dir = dir; | |
| 208 | + | |
| 207 | 209 | f = debugfs_create_file("meclients", S_IRUSR, dir, |
| 208 | 210 | dev, &mei_dbgfs_fops_meclients); |
| 209 | 211 | if (!f) { |
| @@ -228,7 +230,6 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name) · 18 unmodified lines | ||
| 228 | 230 | dev_err(dev->dev, "allow_fixed_address: registration failed\n"); |
| 229 | 231 | goto err; |
| 230 | 232 | } |
| 231 | − dev->dbgfs_dir = dir; | |
| 232 | 233 | return 0; |
| 233 | 234 | err: |
| 234 | 235 | mei_dbgfs_deregister(dev); |
| @@ -134,9 +134,11 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) · 133 unmodified lines | ||
| 134 | 134 | int err = cmd->error; |
| 135 | 135 | |
| 136 | 136 | /* Flag re-tuning needed on CRC errors */ |
| 137 | − if (err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) || | |
| 137 | + if ((cmd->opcode != MMC_SEND_TUNING_BLOCK && | |
| 138 | + cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200) && | |
| 139 | + (err == -EILSEQ || (mrq->sbc && mrq->sbc->error == -EILSEQ) || | |
| 138 | 140 | (mrq->data && mrq->data->error == -EILSEQ) || |
| 139 | − (mrq->stop && mrq->stop->error == -EILSEQ)) | |
| 141 | + (mrq->stop && mrq->stop->error == -EILSEQ))) | |
| 140 | 142 | mmc_retune_needed(host); |
| 141 | 143 | |
| 142 | 144 | if (err && cmd->retries && mmc_host_is_spi(host)) { |
| @@ -457,7 +457,7 @@ int mmc_of_parse(struct mmc_host *host) · 456 unmodified lines | ||
| 457 | 457 | 0, &cd_gpio_invert); |
| 458 | 458 | if (!ret) |
| 459 | 459 | dev_info(host->parent, "Got CD GPIO\n"); |
| 460 | − else if (ret != -ENOENT) | |
| 460 | + else if (ret != -ENOENT && ret != -ENOSYS) | |
| 461 | 461 | return ret; |
| 462 | 462 | |
| 463 | 463 | /* |
| @@ -481,7 +481,7 @@ int mmc_of_parse(struct mmc_host *host) · 17 unmodified lines | ||
| 481 | 481 | ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); |
| 482 | 482 | if (!ret) |
| 483 | 483 | dev_info(host->parent, "Got WP GPIO\n"); |
| 484 | − else if (ret != -ENOENT) | |
| 484 | + else if (ret != -ENOENT && ret != -ENOSYS) | |
| 485 | 485 | return ret; |
| 486 | 486 | |
| 487 | 487 | if (of_property_read_bool(np, "disable-wp")) |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <linux/clk.h> |
| 29 | 29 | #include <linux/err.h> |
| 30 | 30 | #include <linux/mmc/host.h> |
| 31 | +#include <linux/mmc/slot-gpio.h> | |
| 31 | 32 | #include <linux/io.h> |
| 32 | 33 | #include <linux/regulator/consumer.h> |
| 33 | 34 | #include <linux/gpio.h> |
| @@ -454,12 +455,8 @@ static int pxamci_get_ro(struct mmc_host *mmc) · 420 unmodified lines | ||
| 454 | 455 | { |
| 455 | 456 | struct pxamci_host *host = mmc_priv(mmc); |
| 456 | 457 | |
| 457 | − if (host->pdata && gpio_is_valid(host->pdata->gpio_card_ro)) { | |
| 458 | − if (host->pdata->gpio_card_ro_invert) | |
| 459 | − return !gpio_get_value(host->pdata->gpio_card_ro); | |
| 460 | − else | |
| 461 | − return gpio_get_value(host->pdata->gpio_card_ro); | |
| 462 | − } | |
| 458 | + if (host->pdata && gpio_is_valid(host->pdata->gpio_card_ro)) | |
| 459 | + return mmc_gpio_get_ro(mmc); | |
| 463 | 460 | if (host->pdata && host->pdata->get_ro) |
| 464 | 461 | return !!host->pdata->get_ro(mmc_dev(mmc)); |
| 465 | 462 | /* |
| @@ -551,6 +548,7 @@ static void pxamci_enable_sdio_irq(struct mmc_host *host, int enable) · 85 unmodified lines | ||
| 551 | 548 | |
| 552 | 549 | static const struct mmc_host_ops pxamci_ops = { |
| 553 | 550 | .request = pxamci_request, |
| 551 | + .get_cd = mmc_gpio_get_cd, | |
| 554 | 552 | .get_ro = pxamci_get_ro, |
| 555 | 553 | .set_ios = pxamci_set_ios, |
| 556 | 554 | .enable_sdio_irq = pxamci_enable_sdio_irq, |
| @@ -790,37 +788,31 @@ static int pxamci_probe(struct platform_device *pdev) · 233 unmodified lines | ||
| 790 | 788 | gpio_power = host->pdata->gpio_power; |
| 791 | 789 | } |
| 792 | 790 | if (gpio_is_valid(gpio_power)) { |
| 793 | − ret = gpio_request(gpio_power, "mmc card power"); | |
| 791 | + ret = devm_gpio_request(&pdev->dev, gpio_power, | |
| 792 | + "mmc card power"); | |
| 794 | 793 | if (ret) { |
| 795 | − dev_err(&pdev->dev, "Failed requesting gpio_power %d\n", gpio_power); | |
| 794 | + dev_err(&pdev->dev, "Failed requesting gpio_power %d\n", | |
| 795 | + gpio_power); | |
| 796 | 796 | goto out; |
| 797 | 797 | } |
| 798 | 798 | gpio_direction_output(gpio_power, |
| 799 | 799 | host->pdata->gpio_power_invert); |
| 800 | 800 | } |
| 801 | − if (gpio_is_valid(gpio_ro)) { | |
| 802 | − ret = gpio_request(gpio_ro, "mmc card read only"); | |
| 803 | − if (ret) { | |
| 804 | − dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); | |
| 805 | − goto err_gpio_ro; | |
| 806 | − } | |
| 807 | − gpio_direction_input(gpio_ro); | |
| 801 | + if (gpio_is_valid(gpio_ro)) | |
| 802 | + ret = mmc_gpio_request_ro(mmc, gpio_ro); | |
| 803 | + if (ret) { | |
| 804 | + dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); | |
| 805 | + goto out; | |
| 806 | + } else { | |
| 807 | + mmc->caps |= host->pdata->gpio_card_ro_invert ? | |
| 808 | + MMC_CAP2_RO_ACTIVE_HIGH : 0; | |
| 808 | 809 | } |
| 809 | − if (gpio_is_valid(gpio_cd)) { | |
| 810 | − ret = gpio_request(gpio_cd, "mmc card detect"); | |
| 811 | − if (ret) { | |
| 812 | − dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd); | |
| 813 | − goto err_gpio_cd; | |
| 814 | − } | |
| 815 | − gpio_direction_input(gpio_cd); | |
| 816 | 810 | |
| 817 | − ret = request_irq(gpio_to_irq(gpio_cd), pxamci_detect_irq, | |
| 818 | − IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | |
| 819 | − "mmc card detect", mmc); | |
| 820 | − if (ret) { | |
| 821 | − dev_err(&pdev->dev, "failed to request card detect IRQ\n"); | |
| 822 | − goto err_request_irq; | |
| 823 | − } | |
| 811 | + if (gpio_is_valid(gpio_cd)) | |
| 812 | + ret = mmc_gpio_request_cd(mmc, gpio_cd, 0); | |
| 813 | + if (ret) { | |
| 814 | + dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd); | |
| 815 | + goto out; | |
| 824 | 816 | } |
| 825 | 817 | |
| 826 | 818 | if (host->pdata && host->pdata->init) |
| @@ -835,13 +827,7 @@ static int pxamci_probe(struct platform_device *pdev) · 8 unmodified lines | ||
| 835 | 827 | |
| 836 | 828 | return 0; |
| 837 | 829 | |
| 838 | −err_request_irq: | |
| 839 | − gpio_free(gpio_cd); | |
| 840 | −err_gpio_cd: | |
| 841 | − gpio_free(gpio_ro); | |
| 842 | −err_gpio_ro: | |
| 843 | − gpio_free(gpio_power); | |
| 844 | − out: | |
| 830 | +out: | |
| 845 | 831 | if (host) { |
| 846 | 832 | if (host->dma_chan_rx) |
| 847 | 833 | dma_release_channel(host->dma_chan_rx); |
| @@ -873,14 +859,6 @@ static int pxamci_remove(struct platform_device *pdev) · 25 unmodified lines | ||
| 873 | 859 | gpio_ro = host->pdata->gpio_card_ro; |
| 874 | 860 | gpio_power = host->pdata->gpio_power; |
| 875 | 861 | } |
| 876 | − if (gpio_is_valid(gpio_cd)) { | |
| 877 | − free_irq(gpio_to_irq(gpio_cd), mmc); | |
| 878 | − gpio_free(gpio_cd); | |
| 879 | − } | |
| 880 | − if (gpio_is_valid(gpio_ro)) | |
| 881 | − gpio_free(gpio_ro); | |
| 882 | − if (gpio_is_valid(gpio_power)) | |
| 883 | − gpio_free(gpio_power); | |
| 884 | 862 | if (host->vcc) |
| 885 | 863 | regulator_put(host->vcc); |
| 886 | 864 | |
| @@ -210,6 +210,16 @@ · 209 unmodified lines | ||
| 210 | 210 | #define SDXC_IDMAC_DES0_CES BIT(30) /* card error summary */ |
| 211 | 211 | #define SDXC_IDMAC_DES0_OWN BIT(31) /* 1-idma owns it, 0-host owns it */ |
| 212 | 212 | |
| 213 | +#define SDXC_CLK_400K 0 | |
| 214 | +#define SDXC_CLK_25M 1 | |
| 215 | +#define SDXC_CLK_50M 2 | |
| 216 | +#define SDXC_CLK_50M_DDR 3 | |
| 217 | + | |
| 218 | +struct sunxi_mmc_clk_delay { | |
| 219 | + u32 output; | |
| 220 | + u32 sample; | |
| 221 | +}; | |
| 222 | + | |
| 213 | 223 | struct sunxi_idma_des { |
| 214 | 224 | u32 config; |
| 215 | 225 | u32 buf_size; |
| @@ -229,6 +239,7 @@ struct sunxi_mmc_host { · 13 unmodified lines | ||
| 229 | 239 | struct clk *clk_mmc; |
| 230 | 240 | struct clk *clk_sample; |
| 231 | 241 | struct clk *clk_output; |
| 242 | + const struct sunxi_mmc_clk_delay *clk_delays; | |
| 232 | 243 | |
| 233 | 244 | /* irq */ |
| 234 | 245 | spinlock_t lock; |
| @@ -654,25 +665,19 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host, · 419 unmodified lines | ||
| 654 | 665 | |
| 655 | 666 | /* determine delays */ |
| 656 | 667 | if (rate <= 400000) { |
| 657 | − oclk_dly = 180; | |
| 658 | − sclk_dly = 42; | |
| 668 | + oclk_dly = host->clk_delays[SDXC_CLK_400K].output; | |
| 669 | + sclk_dly = host->clk_delays[SDXC_CLK_400K].sample; | |
| 659 | 670 | } else if (rate <= 25000000) { |
| 660 | − oclk_dly = 180; | |
| 661 | − sclk_dly = 75; | |
| 671 | + oclk_dly = host->clk_delays[SDXC_CLK_25M].output; | |
| 672 | + sclk_dly = host->clk_delays[SDXC_CLK_25M].sample; | |
| 662 | 673 | } else if (rate <= 50000000) { |
| 663 | 674 | if (ios->timing == MMC_TIMING_UHS_DDR50) { |
| 664 | − oclk_dly = 60; | |
| 665 | − sclk_dly = 120; | |
| 675 | + oclk_dly = host->clk_delays[SDXC_CLK_50M_DDR].output; | |
| 676 | + sclk_dly = host->clk_delays[SDXC_CLK_50M_DDR].sample; | |
| 666 | 677 | } else { |
| 667 | − oclk_dly = 90; | |
| 668 | − sclk_dly = 150; | |
| 678 | + oclk_dly = host->clk_delays[SDXC_CLK_50M].output; | |
| 679 | + sclk_dly = host->clk_delays[SDXC_CLK_50M].sample; | |
| 669 | 680 | } |
| 670 | − } else if (rate <= 100000000) { | |
| 671 | − oclk_dly = 6; | |
| 672 | − sclk_dly = 24; | |
| 673 | − } else if (rate <= 200000000) { | |
| 674 | − oclk_dly = 3; | |
| 675 | − sclk_dly = 12; | |
| 676 | 681 | } else { |
| 677 | 682 | return -EINVAL; |
| 678 | 683 | } |
| @@ -871,6 +876,7 @@ static void sunxi_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) · 192 unmodified lines | ||
| 871 | 876 | static const struct of_device_id sunxi_mmc_of_match[] = { |
| 872 | 877 | { .compatible = "allwinner,sun4i-a10-mmc", }, |
| 873 | 878 | { .compatible = "allwinner,sun5i-a13-mmc", }, |
| 879 | + { .compatible = "allwinner,sun9i-a80-mmc", }, | |
| 874 | 880 | { /* sentinel */ } |
| 875 | 881 | }; |
| 876 | 882 | MODULE_DEVICE_TABLE(of, sunxi_mmc_of_match); |
| @@ -884,6 +890,20 @@ static struct mmc_host_ops sunxi_mmc_ops = { · 7 unmodified lines | ||
| 884 | 890 | .hw_reset = sunxi_mmc_hw_reset, |
| 885 | 891 | }; |
| 886 | 892 | |
| 893 | +static const struct sunxi_mmc_clk_delay sunxi_mmc_clk_delays[] = { | |
| 894 | + [SDXC_CLK_400K] = { .output = 180, .sample = 180 }, | |
| 895 | + [SDXC_CLK_25M] = { .output = 180, .sample = 75 }, | |
| 896 | + [SDXC_CLK_50M] = { .output = 90, .sample = 120 }, | |
| 897 | + [SDXC_CLK_50M_DDR] = { .output = 60, .sample = 120 }, | |
| 898 | +}; | |
| 899 | + | |
| 900 | +static const struct sunxi_mmc_clk_delay sun9i_mmc_clk_delays[] = { | |
| 901 | + [SDXC_CLK_400K] = { .output = 180, .sample = 180 }, | |
| 902 | + [SDXC_CLK_25M] = { .output = 180, .sample = 75 }, | |
| 903 | + [SDXC_CLK_50M] = { .output = 150, .sample = 120 }, | |
| 904 | + [SDXC_CLK_50M_DDR] = { .output = 90, .sample = 120 }, | |
| 905 | +}; | |
| 906 | + | |
| 887 | 907 | static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, |
| 888 | 908 | struct platform_device *pdev) |
| 889 | 909 | { |
| @@ -895,6 +915,11 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, · 5 unmodified lines | ||
| 895 | 915 | else |
| 896 | 916 | host->idma_des_size_bits = 16; |
| 897 | 917 | |
| 918 | + if (of_device_is_compatible(np, "allwinner,sun9i-a80-mmc")) | |
| 919 | + host->clk_delays = sun9i_mmc_clk_delays; | |
| 920 | + else | |
| 921 | + host->clk_delays = sunxi_mmc_clk_delays; | |
| 922 | + | |
| 898 | 923 | ret = mmc_regulator_get_supply(host->mmc); |
| 899 | 924 | if (ret) { |
| 900 | 925 | if (ret != -EPROBE_DEFER) |
| @@ -926,6 +926,11 @@ static int validate_vid_hdr(const struct ubi_device *ubi, · 925 unmodified lines | ||
| 926 | 926 | goto bad; |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | + if (data_size > ubi->leb_size) { | |
| 930 | + ubi_err(ubi, "bad data_size"); | |
| 931 | + goto bad; | |
| 932 | + } | |
| 933 | + | |
| 929 | 934 | if (vol_type == UBI_VID_STATIC) { |
| 930 | 935 | /* |
| 931 | 936 | * Although from high-level point of view static volumes may |
| @@ -649,6 +649,7 @@ static int init_volumes(struct ubi_device *ubi, · 648 unmodified lines | ||
| 649 | 649 | if (ubi->corr_peb_count) |
| 650 | 650 | ubi_err(ubi, "%d PEBs are corrupted and not used", |
| 651 | 651 | ubi->corr_peb_count); |
| 652 | + return -ENOSPC; | |
| 652 | 653 | } |
| 653 | 654 | ubi->rsvd_pebs += reserved_pebs; |
| 654 | 655 | ubi->avail_pebs -= reserved_pebs; |
| @@ -1601,6 +1601,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) · 1600 unmodified lines | ||
| 1601 | 1601 | if (ubi->corr_peb_count) |
| 1602 | 1602 | ubi_err(ubi, "%d PEBs are corrupted and not used", |
| 1603 | 1603 | ubi->corr_peb_count); |
| 1604 | + err = -ENOSPC; | |
| 1604 | 1605 | goto out_free; |
| 1605 | 1606 | } |
| 1606 | 1607 | ubi->avail_pebs -= reserved_pebs; |
| @@ -326,7 +326,7 @@ static void arcdev_setup(struct net_device *dev) · 325 unmodified lines | ||
| 326 | 326 | dev->type = ARPHRD_ARCNET; |
| 327 | 327 | dev->netdev_ops = &arcnet_netdev_ops; |
| 328 | 328 | dev->header_ops = &arcnet_header_ops; |
| 329 | − dev->hard_header_len = sizeof(struct archdr); | |
| 329 | + dev->hard_header_len = sizeof(struct arc_hardware); | |
| 330 | 330 | dev->mtu = choose_mtu(); |
| 331 | 331 | |
| 332 | 332 | dev->addr_len = ARCNET_ALEN; |
| @@ -2000,6 +2000,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) · 1999 unmodified lines | ||
| 2000 | 2000 | */ |
| 2001 | 2001 | reg = _mv88e6xxx_reg_read(ds, REG_PORT(port), PORT_PCS_CTRL); |
| 2002 | 2002 | if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) { |
| 2003 | + reg &= ~PORT_PCS_CTRL_UNFORCED; | |
| 2003 | 2004 | reg |= PORT_PCS_CTRL_FORCE_LINK | |
| 2004 | 2005 | PORT_PCS_CTRL_LINK_UP | |
| 2005 | 2006 | PORT_PCS_CTRL_DUPLEX_FULL | |
| @@ -2050,6 +2051,8 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) · 44 unmodified lines | ||
| 2050 | 2051 | reg |= PORT_CONTROL_FRAME_ETHER_TYPE_DSA; |
| 2051 | 2052 | else |
| 2052 | 2053 | reg |= PORT_CONTROL_FRAME_MODE_DSA; |
| 2054 | + reg |= PORT_CONTROL_FORWARD_UNKNOWN | | |
| 2055 | + PORT_CONTROL_FORWARD_UNKNOWN_MC; | |
| 2053 | 2056 | } |
| 2054 | 2057 | |
| 2055 | 2058 | if (mv88e6xxx_6352_family(ds) || mv88e6xxx_6351_family(ds) || |
| @@ -689,16 +689,24 @@ static int xgene_enet_phy_connect(struct net_device *ndev) · 688 unmodified lines | ||
| 689 | 689 | netdev_dbg(ndev, "No phy-handle found in DT\n"); |
| 690 | 690 | return -ENODEV; |
| 691 | 691 | } |
| 692 | − pdata->phy_dev = of_phy_find_device(phy_np); | |
| 693 | − } | |
| 694 | 692 | |
| 695 | − phy_dev = pdata->phy_dev; | |
| 693 | + phy_dev = of_phy_connect(ndev, phy_np, &xgene_enet_adjust_link, | |
| 694 | + 0, pdata->phy_mode); | |
| 695 | + if (!phy_dev) { | |
| 696 | + netdev_err(ndev, "Could not connect to PHY\n"); | |
| 697 | + return -ENODEV; | |
| 698 | + } | |
| 699 | + | |
| 700 | + pdata->phy_dev = phy_dev; | |
| 701 | + } else { | |
| 702 | + phy_dev = pdata->phy_dev; | |
| 696 | 703 | |
| 697 | − if (!phy_dev || | |
| 698 | − phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link, | |
| 699 | − pdata->phy_mode)) { | |
| 700 | − netdev_err(ndev, "Could not connect to PHY\n"); | |
| 701 | − return -ENODEV; | |
| 704 | + if (!phy_dev || | |
| 705 | + phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link, | |
| 706 | + pdata->phy_mode)) { | |
| 707 | + netdev_err(ndev, "Could not connect to PHY\n"); | |
| 708 | + return -ENODEV; | |
| 709 | + } | |
| 702 | 710 | } |
| 703 | 711 | |
| 704 | 712 | pdata->phy_speed = SPEED_UNKNOWN; |
| @@ -78,6 +78,7 @@ static const struct of_device_id emac_arc_dt_ids[] = { · 77 unmodified lines | ||
| 78 | 78 | { .compatible = "snps,arc-emac" }, |
| 79 | 79 | { /* Sentinel */ } |
| 80 | 80 | }; |
| 81 | +MODULE_DEVICE_TABLE(of, emac_arc_dt_ids); | |
| 81 | 82 | |
| 82 | 83 | static struct platform_driver emac_arc_driver = { |
| 83 | 84 | .probe = emac_arc_probe, |
| @@ -2079,6 +2079,7 @@ static const struct of_device_id bcm_sysport_of_match[] = { · 2078 unmodified lines | ||
| 2079 | 2079 | { .compatible = "brcm,systemport" }, |
| 2080 | 2080 | { /* sentinel */ } |
| 2081 | 2081 | }; |
| 2082 | +MODULE_DEVICE_TABLE(of, bcm_sysport_of_match); | |
| 2082 | 2083 | |
| 2083 | 2084 | static struct platform_driver bcm_sysport_driver = { |
| 2084 | 2085 | .probe = bcm_sysport_probe, |
| @@ -1946,6 +1946,7 @@ struct bnx2x { · 1945 unmodified lines | ||
| 1946 | 1946 | u16 vlan_cnt; |
| 1947 | 1947 | u16 vlan_credit; |
| 1948 | 1948 | u16 vxlan_dst_port; |
| 1949 | + u8 vxlan_dst_port_count; | |
| 1949 | 1950 | bool accept_any_vlan; |
| 1950 | 1951 | }; |
| 1951 | 1952 | |
| @@ -3705,16 +3705,14 @@ out: · 3704 unmodified lines | ||
| 3705 | 3705 | |
| 3706 | 3706 | void bnx2x_update_mfw_dump(struct bnx2x *bp) |
| 3707 | 3707 | { |
| 3708 | − struct timeval epoc; | |
| 3709 | 3708 | u32 drv_ver; |
| 3710 | 3709 | u32 valid_dump; |
| 3711 | 3710 | |
| 3712 | 3711 | if (!SHMEM2_HAS(bp, drv_info)) |
| 3713 | 3712 | return; |
| 3714 | 3713 | |
| 3715 | − /* Update Driver load time */ | |
| 3716 | − do_gettimeofday(&epoc); | |
| 3717 | − SHMEM2_WR(bp, drv_info.epoc, epoc.tv_sec); | |
| 3714 | + /* Update Driver load time, possibly broken in y2038 */ | |
| 3715 | + SHMEM2_WR(bp, drv_info.epoc, (u32)ktime_get_real_seconds()); | |
| 3718 | 3716 | |
| 3719 | 3717 | drv_ver = bnx2x_update_mng_version_utility(DRV_MODULE_VERSION, true); |
| 3720 | 3718 | SHMEM2_WR(bp, drv_info.drv_ver, drv_ver); |
| @@ -10110,12 +10108,18 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port) · 6389 unmodified lines | ||
| 10110 | 10108 | if (!netif_running(bp->dev)) |
| 10111 | 10109 | return; |
| 10112 | 10110 | |
| 10113 | − if (bp->vxlan_dst_port || !IS_PF(bp)) { | |
| 10111 | + if (bp->vxlan_dst_port_count && bp->vxlan_dst_port == port) { | |
| 10112 | + bp->vxlan_dst_port_count++; | |
| 10113 | + return; | |
| 10114 | + } | |
| 10115 | + | |
| 10116 | + if (bp->vxlan_dst_port_count || !IS_PF(bp)) { | |
| 10114 | 10117 | DP(BNX2X_MSG_SP, "Vxlan destination port limit reached\n"); |
| 10115 | 10118 | return; |
| 10116 | 10119 | } |
| 10117 | 10120 | |
| 10118 | 10121 | bp->vxlan_dst_port = port; |
| 10122 | + bp->vxlan_dst_port_count = 1; | |
| 10119 | 10123 | bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_ADD_VXLAN_PORT, 0); |
| 10120 | 10124 | } |
| 10121 | 10125 | |
| @@ -10130,10 +10134,14 @@ static void bnx2x_add_vxlan_port(struct net_device *netdev, · 8 unmodified lines | ||
| 10130 | 10134 | |
| 10131 | 10135 | static void __bnx2x_del_vxlan_port(struct bnx2x *bp, u16 port) |
| 10132 | 10136 | { |
| 10133 | − if (!bp->vxlan_dst_port || bp->vxlan_dst_port != port || !IS_PF(bp)) { | |
| 10137 | + if (!bp->vxlan_dst_port_count || bp->vxlan_dst_port != port || | |
| 10138 | + !IS_PF(bp)) { | |
| 10134 | 10139 | DP(BNX2X_MSG_SP, "Invalid vxlan port\n"); |
| 10135 | 10140 | return; |
| 10136 | 10141 | } |
| 10142 | + bp->vxlan_dst_port--; | |
| 10143 | + if (bp->vxlan_dst_port) | |
| 10144 | + return; | |
| 10137 | 10145 | |
| 10138 | 10146 | if (netif_running(bp->dev)) { |
| 10139 | 10147 | bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_DEL_VXLAN_PORT, 0); |
| @@ -4319,8 +4319,16 @@ static int bnx2x_setup_rss(struct bnx2x *bp, · 4318 unmodified lines | ||
| 4319 | 4319 | |
| 4320 | 4320 | /* RSS keys */ |
| 4321 | 4321 | if (test_bit(BNX2X_RSS_SET_SRCH, &p->rss_flags)) { |
| 4322 | − memcpy(&data->rss_key[0], &p->rss_key[0], | |
| 4323 | − sizeof(data->rss_key)); | |
| 4322 | + u8 *dst = (u8 *)(data->rss_key) + sizeof(data->rss_key); | |
| 4323 | + const u8 *src = (const u8 *)p->rss_key; | |
| 4324 | + int i; | |
| 4325 | + | |
| 4326 | + /* Apparently, bnx2x reads this array in reverse order | |
| 4327 | + * We need to byte swap rss_key to comply with Toeplitz specs. | |
| 4328 | + */ | |
| 4329 | + for (i = 0; i < sizeof(data->rss_key); i++) | |
| 4330 | + *--dst = *src++; | |
| 4331 | + | |
| 4324 | 4332 | caps |= ETH_RSS_UPDATE_RAMROD_DATA_UPDATE_RSS_KEY; |
| 4325 | 4333 | } |
| 4326 | 4334 | |
| @@ -3155,6 +3155,7 @@ static const struct of_device_id bcmgenet_match[] = { · 3154 unmodified lines | ||
| 3155 | 3155 | { .compatible = "brcm,genet-v4", .data = (void *)GENET_V4 }, |
| 3156 | 3156 | { }, |
| 3157 | 3157 | }; |
| 3158 | +MODULE_DEVICE_TABLE(of, bcmgenet_match); | |
| 3158 | 3159 | |
| 3159 | 3160 | static int bcmgenet_probe(struct platform_device *pdev) |
| 3160 | 3161 | { |
| @@ -1543,7 +1543,7 @@ bfa_flash_cmd_act_check(void __iomem *pci_bar) · 1542 unmodified lines | ||
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | 1545 | /* Flush FLI data fifo. */ |
| 1546 | −static u32 | |
| 1546 | +static int | |
| 1547 | 1547 | bfa_flash_fifo_flush(void __iomem *pci_bar) |
| 1548 | 1548 | { |
| 1549 | 1549 | u32 i; |
| @@ -1573,11 +1573,11 @@ bfa_flash_fifo_flush(void __iomem *pci_bar) · 23 unmodified lines | ||
| 1573 | 1573 | } |
| 1574 | 1574 | |
| 1575 | 1575 | /* Read flash status. */ |
| 1576 | −static u32 | |
| 1576 | +static int | |
| 1577 | 1577 | bfa_flash_status_read(void __iomem *pci_bar) |
| 1578 | 1578 | { |
| 1579 | 1579 | union bfa_flash_dev_status_reg dev_status; |
| 1580 | − u32 status; | |
| 1580 | + int status; | |
| 1581 | 1581 | u32 ret_status; |
| 1582 | 1582 | int i; |
| 1583 | 1583 | |
| @@ -1611,11 +1611,11 @@ bfa_flash_status_read(void __iomem *pci_bar) · 27 unmodified lines | ||
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | /* Start flash read operation. */ |
| 1614 | −static u32 | |
| 1614 | +static int | |
| 1615 | 1615 | bfa_flash_read_start(void __iomem *pci_bar, u32 offset, u32 len, |
| 1616 | 1616 | char *buf) |
| 1617 | 1617 | { |
| 1618 | − u32 status; | |
| 1618 | + int status; | |
| 1619 | 1619 | |
| 1620 | 1620 | /* len must be mutiple of 4 and not exceeding fifo size */ |
| 1621 | 1621 | if (len == 0 || len > BFA_FLASH_FIFO_SIZE || (len & 0x03) != 0) |
| @@ -1703,7 +1703,8 @@ static enum bfa_status · 81 unmodified lines | ||
| 1703 | 1703 | bfa_flash_raw_read(void __iomem *pci_bar, u32 offset, char *buf, |
| 1704 | 1704 | u32 len) |
| 1705 | 1705 | { |
| 1706 | − u32 n, status; | |
| 1706 | + u32 n; | |
| 1707 | + int status; | |
| 1707 | 1708 | u32 off, l, s, residue, fifo_sz; |
| 1708 | 1709 | |
| 1709 | 1710 | residue = len; |
| @@ -2400,6 +2400,7 @@ bna_rx_create(struct bna *bna, struct bnad *bnad, · 2399 unmodified lines | ||
| 2400 | 2400 | q0->rcb->id = 0; |
| 2401 | 2401 | q0->rx_packets = q0->rx_bytes = 0; |
| 2402 | 2402 | q0->rx_packets_with_error = q0->rxbuf_alloc_failed = 0; |
| 2403 | + q0->rxbuf_map_failed = 0; | |
| 2403 | 2404 | |
| 2404 | 2405 | bna_rxq_qpt_setup(q0, rxp, dpage_count, PAGE_SIZE, |
| 2405 | 2406 | &dqpt_mem[i], &dsqpt_mem[i], &dpage_mem[i]); |
| @@ -2428,6 +2429,7 @@ bna_rx_create(struct bna *bna, struct bnad *bnad, · 22 unmodified lines | ||
| 2428 | 2429 | : rx_cfg->q1_buf_size; |
| 2429 | 2430 | q1->rx_packets = q1->rx_bytes = 0; |
| 2430 | 2431 | q1->rx_packets_with_error = q1->rxbuf_alloc_failed = 0; |
| 2432 | + q1->rxbuf_map_failed = 0; | |
| 2431 | 2433 | |
| 2432 | 2434 | bna_rxq_qpt_setup(q1, rxp, hpage_count, PAGE_SIZE, |
| 2433 | 2435 | &hqpt_mem[i], &hsqpt_mem[i], |
| @@ -587,6 +587,7 @@ struct bna_rxq { · 586 unmodified lines | ||
| 587 | 587 | u64 rx_bytes; |
| 588 | 588 | u64 rx_packets_with_error; |
| 589 | 589 | u64 rxbuf_alloc_failed; |
| 590 | + u64 rxbuf_map_failed; | |
| 590 | 591 | }; |
| 591 | 592 | |
| 592 | 593 | /* RxQ pair */ |
| @@ -399,7 +399,13 @@ bnad_rxq_refill_page(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) · 398 unmodified lines | ||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | dma_addr = dma_map_page(&bnad->pcidev->dev, page, page_offset, |
| 402 | − unmap_q->map_size, DMA_FROM_DEVICE); | |
| 402 | + unmap_q->map_size, DMA_FROM_DEVICE); | |
| 403 | + if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { | |
| 404 | + put_page(page); | |
| 405 | + BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); | |
| 406 | + rcb->rxq->rxbuf_map_failed++; | |
| 407 | + goto finishing; | |
| 408 | + } | |
| 403 | 409 | |
| 404 | 410 | unmap->page = page; |
| 405 | 411 | unmap->page_offset = page_offset; |
| @@ -454,8 +460,15 @@ bnad_rxq_refill_skb(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) · 48 unmodified lines | ||
| 454 | 460 | rcb->rxq->rxbuf_alloc_failed++; |
| 455 | 461 | goto finishing; |
| 456 | 462 | } |
| 463 | + | |
| 457 | 464 | dma_addr = dma_map_single(&bnad->pcidev->dev, skb->data, |
| 458 | 465 | buff_sz, DMA_FROM_DEVICE); |
| 466 | + if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { | |
| 467 | + dev_kfree_skb_any(skb); | |
| 468 | + BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); | |
| 469 | + rcb->rxq->rxbuf_map_failed++; | |
| 470 | + goto finishing; | |
| 471 | + } | |
| 459 | 472 | |
| 460 | 473 | unmap->skb = skb; |
| 461 | 474 | dma_unmap_addr_set(&unmap->vector, dma_addr, dma_addr); |
| @@ -3025,6 +3038,11 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) · 2563 unmodified lines | ||
| 3025 | 3038 | unmap = head_unmap; |
| 3026 | 3039 | dma_addr = dma_map_single(&bnad->pcidev->dev, skb->data, |
| 3027 | 3040 | len, DMA_TO_DEVICE); |
| 3041 | + if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { | |
| 3042 | + dev_kfree_skb_any(skb); | |
| 3043 | + BNAD_UPDATE_CTR(bnad, tx_skb_map_failed); | |
| 3044 | + return NETDEV_TX_OK; | |
| 3045 | + } | |
| 3028 | 3046 | BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[0].host_addr); |
| 3029 | 3047 | txqent->vector[0].length = htons(len); |
| 3030 | 3048 | dma_unmap_addr_set(&unmap->vectors[0], dma_addr, dma_addr); |
| @@ -3056,6 +3074,15 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev) · 25 unmodified lines | ||
| 3056 | 3074 | |
| 3057 | 3075 | dma_addr = skb_frag_dma_map(&bnad->pcidev->dev, frag, |
| 3058 | 3076 | 0, size, DMA_TO_DEVICE); |
| 3077 | + if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { | |
| 3078 | + /* Undo the changes starting at tcb->producer_index */ | |
| 3079 | + bnad_tx_buff_unmap(bnad, unmap_q, q_depth, | |
| 3080 | + tcb->producer_index); | |
| 3081 | + dev_kfree_skb_any(skb); | |
| 3082 | + BNAD_UPDATE_CTR(bnad, tx_skb_map_failed); | |
| 3083 | + return NETDEV_TX_OK; | |
| 3084 | + } | |
| 3085 | + | |
| 3059 | 3086 | dma_unmap_len_set(&unmap->vectors[vect_id], dma_len, size); |
| 3060 | 3087 | BNA_SET_DMA_ADDR(dma_addr, &txqent->vector[vect_id].host_addr); |
| 3061 | 3088 | txqent->vector[vect_id].length = htons(size); |
| @@ -175,6 +175,7 @@ struct bnad_drv_stats { · 174 unmodified lines | ||
| 175 | 175 | u64 tx_skb_headlen_zero; |
| 176 | 176 | u64 tx_skb_frag_zero; |
| 177 | 177 | u64 tx_skb_len_mismatch; |
| 178 | + u64 tx_skb_map_failed; | |
| 178 | 179 | |
| 179 | 180 | u64 hw_stats_updates; |
| 180 | 181 | u64 netif_rx_dropped; |
| @@ -189,6 +190,7 @@ struct bnad_drv_stats { · 8 unmodified lines | ||
| 189 | 190 | u64 rx_unmap_q_alloc_failed; |
| 190 | 191 | |
| 191 | 192 | u64 rxbuf_alloc_failed; |
| 193 | + u64 rxbuf_map_failed; | |
| 192 | 194 | }; |
| 193 | 195 | |
| 194 | 196 | /* Complete driver stats */ |
| @@ -90,6 +90,7 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { · 89 unmodified lines | ||
| 90 | 90 | "tx_skb_headlen_zero", |
| 91 | 91 | "tx_skb_frag_zero", |
| 92 | 92 | "tx_skb_len_mismatch", |
| 93 | + "tx_skb_map_failed", | |
| 93 | 94 | "hw_stats_updates", |
| 94 | 95 | "netif_rx_dropped", |
| 95 | 96 | |
| @@ -102,6 +103,7 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { · 6 unmodified lines | ||
| 102 | 103 | "tx_unmap_q_alloc_failed", |
| 103 | 104 | "rx_unmap_q_alloc_failed", |
| 104 | 105 | "rxbuf_alloc_failed", |
| 106 | + "rxbuf_map_failed", | |
| 105 | 107 | |
| 106 | 108 | "mac_stats_clr_cnt", |
| 107 | 109 | "mac_frame_64", |
| @@ -807,6 +809,7 @@ bnad_per_q_stats_fill(struct bnad *bnad, u64 *buf, int bi) · 699 unmodified lines | ||
| 807 | 809 | rx_packets_with_error; |
| 808 | 810 | buf[bi++] = rcb->rxq-> |
| 809 | 811 | rxbuf_alloc_failed; |
| 812 | + buf[bi++] = rcb->rxq->rxbuf_map_failed; | |
| 810 | 813 | buf[bi++] = rcb->producer_index; |
| 811 | 814 | buf[bi++] = rcb->consumer_index; |
| 812 | 815 | } |
| @@ -821,6 +824,7 @@ bnad_per_q_stats_fill(struct bnad *bnad, u64 *buf, int bi) · 8 unmodified lines | ||
| 821 | 824 | rx_packets_with_error; |
| 822 | 825 | buf[bi++] = rcb->rxq-> |
| 823 | 826 | rxbuf_alloc_failed; |
| 827 | + buf[bi++] = rcb->rxq->rxbuf_map_failed; | |
| 824 | 828 | buf[bi++] = rcb->producer_index; |
| 825 | 829 | buf[bi++] = rcb->consumer_index; |
| 826 | 830 | } |
| @@ -157,6 +157,11 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN · 156 unmodified lines | ||
| 157 | 157 | CH_PCI_ID_TABLE_FENTRY(0x5090), /* Custom T540-CR */ |
| 158 | 158 | CH_PCI_ID_TABLE_FENTRY(0x5091), /* Custom T522-CR */ |
| 159 | 159 | CH_PCI_ID_TABLE_FENTRY(0x5092), /* Custom T520-CR */ |
| 160 | + CH_PCI_ID_TABLE_FENTRY(0x5093), /* Custom T580-LP-CR */ | |
| 161 | + CH_PCI_ID_TABLE_FENTRY(0x5094), /* Custom T540-CR */ | |
| 162 | + CH_PCI_ID_TABLE_FENTRY(0x5095), /* Custom T540-CR-SO */ | |
| 163 | + CH_PCI_ID_TABLE_FENTRY(0x5096), /* Custom T580-CR */ | |
| 164 | + CH_PCI_ID_TABLE_FENTRY(0x5097), /* Custom T520-KR */ | |
| 160 | 165 | |
| 161 | 166 | /* T6 adapters: |
| 162 | 167 | */ |
| @@ -582,6 +582,7 @@ struct be_adapter { · 581 unmodified lines | ||
| 582 | 582 | u16 pvid; |
| 583 | 583 | __be16 vxlan_port; |
| 584 | 584 | int vxlan_port_count; |
| 585 | + int vxlan_port_aliases; | |
| 585 | 586 | struct phy_info phy; |
| 586 | 587 | u8 wol_cap; |
| 587 | 588 | bool wol_en; |
| @@ -5176,6 +5176,11 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, · 5175 unmodified lines | ||
| 5176 | 5176 | if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) |
| 5177 | 5177 | return; |
| 5178 | 5178 | |
| 5179 | + if (adapter->vxlan_port == port && adapter->vxlan_port_count) { | |
| 5180 | + adapter->vxlan_port_aliases++; | |
| 5181 | + return; | |
| 5182 | + } | |
| 5183 | + | |
| 5179 | 5184 | if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) { |
| 5180 | 5185 | dev_info(dev, |
| 5181 | 5186 | "Only one UDP port supported for VxLAN offloads\n"); |
| @@ -5226,6 +5231,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, · 44 unmodified lines | ||
| 5226 | 5231 | if (adapter->vxlan_port != port) |
| 5227 | 5232 | goto done; |
| 5228 | 5233 | |
| 5234 | + if (adapter->vxlan_port_aliases) { | |
| 5235 | + adapter->vxlan_port_aliases--; | |
| 5236 | + return; | |
| 5237 | + } | |
| 5238 | + | |
| 5229 | 5239 | be_disable_vxlan_offloads(adapter); |
| 5230 | 5240 | |
| 5231 | 5241 | dev_info(&adapter->pdev->dev, |
| @@ -1710,8 +1710,10 @@ static void gfar_configure_serdes(struct net_device *dev) · 1709 unmodified lines | ||
| 1710 | 1710 | * everything for us? Resetting it takes the link down and requires |
| 1711 | 1711 | * several seconds for it to come back. |
| 1712 | 1712 | */ |
| 1713 | − if (phy_read(tbiphy, MII_BMSR) & BMSR_LSTATUS) | |
| 1713 | + if (phy_read(tbiphy, MII_BMSR) & BMSR_LSTATUS) { | |
| 1714 | + put_device(&tbiphy->dev); | |
| 1714 | 1715 | return; |
| 1716 | + } | |
| 1715 | 1717 | |
| 1716 | 1718 | /* Single clk mode, mii mode off(for serdes communication) */ |
| 1717 | 1719 | phy_write(tbiphy, MII_TBICON, TBICON_CLK_SELECT); |
| @@ -1723,6 +1725,8 @@ static void gfar_configure_serdes(struct net_device *dev) · 5 unmodified lines | ||
| 1723 | 1725 | phy_write(tbiphy, MII_BMCR, |
| 1724 | 1726 | BMCR_ANENABLE | BMCR_ANRESTART | BMCR_FULLDPLX | |
| 1725 | 1727 | BMCR_SPEED1000); |
| 1728 | + | |
| 1729 | + put_device(&tbiphy->dev); | |
| 1726 | 1730 | } |
| 1727 | 1731 | |
| 1728 | 1732 | static int __gfar_is_rx_idle(struct gfar_private *priv) |
| @@ -1970,8 +1974,7 @@ static int register_grp_irqs(struct gfar_priv_grp *grp) · 241 unmodified lines | ||
| 1970 | 1974 | /* Install our interrupt handlers for Error, |
| 1971 | 1975 | * Transmit, and Receive |
| 1972 | 1976 | */ |
| 1973 | − err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, | |
| 1974 | − IRQF_NO_SUSPEND, | |
| 1977 | + err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, 0, | |
| 1975 | 1978 | gfar_irq(grp, ER)->name, grp); |
| 1976 | 1979 | if (err < 0) { |
| 1977 | 1980 | netif_err(priv, intr, dev, "Can't get IRQ %d\n", |
| @@ -1979,6 +1982,8 @@ static int register_grp_irqs(struct gfar_priv_grp *grp) · 1 unmodified line | ||
| 1979 | 1982 | |
| 1980 | 1983 | goto err_irq_fail; |
| 1981 | 1984 | } |
| 1985 | + enable_irq_wake(gfar_irq(grp, ER)->irq); | |
| 1986 | + | |
| 1982 | 1987 | err = request_irq(gfar_irq(grp, TX)->irq, gfar_transmit, 0, |
| 1983 | 1988 | gfar_irq(grp, TX)->name, grp); |
| 1984 | 1989 | if (err < 0) { |
| @@ -1994,14 +1999,14 @@ static int register_grp_irqs(struct gfar_priv_grp *grp) · 9 unmodified lines | ||
| 1994 | 1999 | goto rx_irq_fail; |
| 1995 | 2000 | } |
| 1996 | 2001 | } else { |
| 1997 | − err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt, | |
| 1998 | − IRQF_NO_SUSPEND, | |
| 2002 | + err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt, 0, | |
| 1999 | 2003 | gfar_irq(grp, TX)->name, grp); |
| 2000 | 2004 | if (err < 0) { |
| 2001 | 2005 | netif_err(priv, intr, dev, "Can't get IRQ %d\n", |
| 2002 | 2006 | gfar_irq(grp, TX)->irq); |
| 2003 | 2007 | goto err_irq_fail; |
| 2004 | 2008 | } |
| 2009 | + enable_irq_wake(gfar_irq(grp, TX)->irq); | |
| 2005 | 2010 | } |
| 2006 | 2011 | |
| 2007 | 2012 | return 0; |
| @@ -557,6 +557,7 @@ static const struct of_device_id match_table[] = { · 556 unmodified lines | ||
| 557 | 557 | { .compatible = "fsl,etsec-ptp" }, |
| 558 | 558 | {}, |
| 559 | 559 | }; |
| 560 | +MODULE_DEVICE_TABLE(of, match_table); | |
| 560 | 561 | |
| 561 | 562 | static struct platform_driver gianfar_ptp_driver = { |
| 562 | 563 | .driver = { |
| @@ -1384,6 +1384,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) · 1383 unmodified lines | ||
| 1384 | 1384 | value = phy_read(tbiphy, ENET_TBI_MII_CR); |
| 1385 | 1385 | value &= ~0x1000; /* Turn off autonegotiation */ |
| 1386 | 1386 | phy_write(tbiphy, ENET_TBI_MII_CR, value); |
| 1387 | + | |
| 1388 | + put_device(&tbiphy->dev); | |
| 1387 | 1389 | } |
| 1388 | 1390 | |
| 1389 | 1391 | init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2); |
| @@ -1702,8 +1704,10 @@ static void uec_configure_serdes(struct net_device *dev) · 312 unmodified lines | ||
| 1702 | 1704 | * everything for us? Resetting it takes the link down and requires |
| 1703 | 1705 | * several seconds for it to come back. |
| 1704 | 1706 | */ |
| 1705 | − if (phy_read(tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS) | |
| 1707 | + if (phy_read(tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS) { | |
| 1708 | + put_device(&tbiphy->dev); | |
| 1706 | 1709 | return; |
| 1710 | + } | |
| 1707 | 1711 | |
| 1708 | 1712 | /* Single clk mode, mii mode off(for serdes communication) */ |
| 1709 | 1713 | phy_write(tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS); |
| @@ -1711,6 +1715,8 @@ static void uec_configure_serdes(struct net_device *dev) · 1 unmodified line | ||
| 1711 | 1715 | phy_write(tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT); |
| 1712 | 1716 | |
| 1713 | 1717 | phy_write(tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS); |
| 1718 | + | |
| 1719 | + put_device(&tbiphy->dev); | |
| 1714 | 1720 | } |
| 1715 | 1721 | |
| 1716 | 1722 | /* Configure the PHY for dev. |
| @@ -816,7 +816,7 @@ static int hip04_mac_probe(struct platform_device *pdev) · 815 unmodified lines | ||
| 816 | 816 | struct net_device *ndev; |
| 817 | 817 | struct hip04_priv *priv; |
| 818 | 818 | struct resource *res; |
| 819 | − unsigned int irq; | |
| 819 | + int irq; | |
| 820 | 820 | int ret; |
| 821 | 821 | |
| 822 | 822 | ndev = alloc_etherdev(sizeof(struct hip04_priv)); |
| @@ -460,8 +460,8 @@ struct emac_ethtool_regs_subhdr { · 459 unmodified lines | ||
| 460 | 460 | u32 index; |
| 461 | 461 | }; |
| 462 | 462 | |
| 463 | −#define EMAC_ETHTOOL_REGS_VER 0 | |
| 464 | −#define EMAC4_ETHTOOL_REGS_VER 1 | |
| 465 | −#define EMAC4SYNC_ETHTOOL_REGS_VER 2 | |
| 463 | +#define EMAC_ETHTOOL_REGS_VER 3 | |
| 464 | +#define EMAC4_ETHTOOL_REGS_VER 4 | |
| 465 | +#define EMAC4SYNC_ETHTOOL_REGS_VER 5 | |
| 466 | 466 | |
| 467 | 467 | #endif /* __IBM_NEWEMAC_CORE_H */ |
| @@ -946,6 +946,13 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw, · 945 unmodified lines | ||
| 946 | 946 | /* take the lock before we start messing with the ring */ |
| 947 | 947 | mutex_lock(&hw->aq.arq_mutex); |
| 948 | 948 | |
| 949 | + if (hw->aq.arq.count == 0) { | |
| 950 | + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, | |
| 951 | + "AQRX: Admin queue not initialized.\n"); | |
| 952 | + ret_code = I40E_ERR_QUEUE_EMPTY; | |
| 953 | + goto clean_arq_element_err; | |
| 954 | + } | |
| 955 | + | |
| 949 | 956 | /* set next_to_use to head */ |
| 950 | 957 | ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK); |
| 951 | 958 | if (ntu == ntc) { |
| @@ -1007,6 +1014,8 @@ clean_arq_element_out: · 55 unmodified lines | ||
| 1007 | 1014 | /* Set pending if needed, unlock and return */ |
| 1008 | 1015 | if (pending != NULL) |
| 1009 | 1016 | *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); |
| 1017 | + | |
| 1018 | +clean_arq_element_err: | |
| 1010 | 1019 | mutex_unlock(&hw->aq.arq_mutex); |
| 1011 | 1020 | |
| 1012 | 1021 | if (i40e_is_nvm_update_op(&e->desc)) { |
| @@ -2672,7 +2672,8 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) · 2671 unmodified lines | ||
| 2672 | 2672 | rx_ctx.lrxqthresh = 2; |
| 2673 | 2673 | rx_ctx.crcstrip = 1; |
| 2674 | 2674 | rx_ctx.l2tsel = 1; |
| 2675 | − rx_ctx.showiv = 1; | |
| 2675 | + /* this controls whether VLAN is stripped from inner headers */ | |
| 2676 | + rx_ctx.showiv = 0; | |
| 2676 | 2677 | #ifdef I40E_FCOE |
| 2677 | 2678 | rx_ctx.fc_ena = (vsi->type == I40E_VSI_FCOE); |
| 2678 | 2679 | #endif |
| @@ -887,6 +887,13 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw, · 886 unmodified lines | ||
| 887 | 887 | /* take the lock before we start messing with the ring */ |
| 888 | 888 | mutex_lock(&hw->aq.arq_mutex); |
| 889 | 889 | |
| 890 | + if (hw->aq.arq.count == 0) { | |
| 891 | + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, | |
| 892 | + "AQRX: Admin queue not initialized.\n"); | |
| 893 | + ret_code = I40E_ERR_QUEUE_EMPTY; | |
| 894 | + goto clean_arq_element_err; | |
| 895 | + } | |
| 896 | + | |
| 890 | 897 | /* set next_to_use to head */ |
| 891 | 898 | ntu = (rd32(hw, hw->aq.arq.head) & I40E_VF_ARQH1_ARQH_MASK); |
| 892 | 899 | if (ntu == ntc) { |
| @@ -948,6 +955,8 @@ clean_arq_element_out: · 55 unmodified lines | ||
| 948 | 955 | /* Set pending if needed, unlock and return */ |
| 949 | 956 | if (pending != NULL) |
| 950 | 957 | *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); |
| 958 | + | |
| 959 | +clean_arq_element_err: | |
| 951 | 960 | mutex_unlock(&hw->aq.arq_mutex); |
| 952 | 961 | |
| 953 | 962 | return ret_code; |
| @@ -1479,6 +1479,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 1478 unmodified lines | ||
| 1479 | 1479 | struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq); |
| 1480 | 1480 | struct sk_buff *skb; |
| 1481 | 1481 | unsigned char *data; |
| 1482 | + dma_addr_t phys_addr; | |
| 1482 | 1483 | u32 rx_status; |
| 1483 | 1484 | int rx_bytes, err; |
| 1484 | 1485 | |
| @@ -1486,6 +1487,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 1 unmodified line | ||
| 1486 | 1487 | rx_status = rx_desc->status; |
| 1487 | 1488 | rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE); |
| 1488 | 1489 | data = (unsigned char *)rx_desc->buf_cookie; |
| 1490 | + phys_addr = rx_desc->buf_phys_addr; | |
| 1489 | 1491 | |
| 1490 | 1492 | if (!mvneta_rxq_desc_is_first_last(rx_status) || |
| 1491 | 1493 | (rx_status & MVNETA_RXD_ERR_SUMMARY)) { |
| @@ -1534,7 +1536,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, · 42 unmodified lines | ||
| 1534 | 1536 | if (!skb) |
| 1535 | 1537 | goto err_drop_frame; |
| 1536 | 1538 | |
| 1537 | − dma_unmap_single(dev->dev.parent, rx_desc->buf_phys_addr, | |
| 1539 | + dma_unmap_single(dev->dev.parent, phys_addr, | |
| 1538 | 1540 | MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); |
| 1539 | 1541 | |
| 1540 | 1542 | rcvd_pkts++; |
| @@ -3173,6 +3175,8 @@ static int mvneta_probe(struct platform_device *pdev) · 1632 unmodified lines | ||
| 3173 | 3175 | struct phy_device *phy = of_phy_find_device(dn); |
| 3174 | 3176 | |
| 3175 | 3177 | mvneta_fixed_link_update(pp, phy); |
| 3178 | + | |
| 3179 | + put_device(&phy->dev); | |
| 3176 | 3180 | } |
| 3177 | 3181 | |
| 3178 | 3182 | return 0; |
| @@ -1270,8 +1270,6 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv) · 1269 unmodified lines | ||
| 1270 | 1270 | rss_context->hash_fn = MLX4_RSS_HASH_TOP; |
| 1271 | 1271 | memcpy(rss_context->rss_key, priv->rss_key, |
| 1272 | 1272 | MLX4_EN_RSS_KEY_SIZE); |
| 1273 | − netdev_rss_key_fill(rss_context->rss_key, | |
| 1274 | − MLX4_EN_RSS_KEY_SIZE); | |
| 1275 | 1273 | } else { |
| 1276 | 1274 | en_err(priv, "Unknown RSS hash function requested\n"); |
| 1277 | 1275 | err = -EINVAL; |
| @@ -1184,10 +1184,11 @@ out: · 1183 unmodified lines | ||
| 1184 | 1184 | if (prot == MLX4_PROT_ETH) { |
| 1185 | 1185 | /* manage the steering entry for promisc mode */ |
| 1186 | 1186 | if (new_entry) |
| 1187 | − new_steering_entry(dev, port, steer, index, qp->qpn); | |
| 1187 | + err = new_steering_entry(dev, port, steer, | |
| 1188 | + index, qp->qpn); | |
| 1188 | 1189 | else |
| 1189 | − existing_steering_entry(dev, port, steer, | |
| 1190 | − index, qp->qpn); | |
| 1190 | + err = existing_steering_entry(dev, port, steer, | |
| 1191 | + index, qp->qpn); | |
| 1191 | 1192 | } |
| 1192 | 1193 | if (err && link && index != -1) { |
| 1193 | 1194 | if (index < dev->caps.num_mgms) |
| @@ -200,25 +200,3 @@ int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev) · 199 unmodified lines | ||
| 200 | 200 | |
| 201 | 201 | return err; |
| 202 | 202 | } |
| 203 | − | |
| 204 | −int mlx5_core_query_special_context(struct mlx5_core_dev *dev, u32 *rsvd_lkey) | |
| 205 | −{ | |
| 206 | − struct mlx5_cmd_query_special_contexts_mbox_in in; | |
| 207 | − struct mlx5_cmd_query_special_contexts_mbox_out out; | |
| 208 | − int err; | |
| 209 | − | |
| 210 | − memset(&in, 0, sizeof(in)); | |
| 211 | − memset(&out, 0, sizeof(out)); | |
| 212 | − in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); | |
| 213 | − err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | |
| 214 | − if (err) | |
| 215 | − return err; | |
| 216 | − | |
| 217 | − if (out.hdr.status) | |
| 218 | − err = mlx5_cmd_status_to_err(&out.hdr); | |
| 219 | − | |
| 220 | − *rsvd_lkey = be32_to_cpu(out.resd_lkey); | |
| 221 | − | |
| 222 | − return err; | |
| 223 | −} | |
| 224 | −EXPORT_SYMBOL(mlx5_core_query_special_context); | |
| @@ -1601,6 +1601,7 @@ static const struct of_device_id ks8851_match_table[] = { · 1600 unmodified lines | ||
| 1601 | 1601 | { .compatible = "micrel,ks8851" }, |
| 1602 | 1602 | { } |
| 1603 | 1603 | }; |
| 1604 | +MODULE_DEVICE_TABLE(of, ks8851_match_table); | |
| 1604 | 1605 | |
| 1605 | 1606 | static struct spi_driver ks8851_driver = { |
| 1606 | 1607 | .driver = { |
| @@ -552,6 +552,7 @@ static const struct of_device_id moxart_mac_match[] = { · 551 unmodified lines | ||
| 552 | 552 | { .compatible = "moxa,moxart-mac" }, |
| 553 | 553 | { } |
| 554 | 554 | }; |
| 555 | +MODULE_DEVICE_TABLE(of, moxart_mac_match); | |
| 555 | 556 | |
| 556 | 557 | static struct platform_driver moxart_mac_driver = { |
| 557 | 558 | .probe = moxart_mac_probe, |
| @@ -536,6 +536,7 @@ struct qlcnic_hardware_context { · 535 unmodified lines | ||
| 536 | 536 | u8 extend_lb_time; |
| 537 | 537 | u8 phys_port_id[ETH_ALEN]; |
| 538 | 538 | u8 lb_mode; |
| 539 | + u8 vxlan_port_count; | |
| 539 | 540 | u16 vxlan_port; |
| 540 | 541 | struct device *hwmon_dev; |
| 541 | 542 | u32 post_mode; |
| @@ -483,11 +483,17 @@ static void qlcnic_add_vxlan_port(struct net_device *netdev, · 482 unmodified lines | ||
| 483 | 483 | /* Adapter supports only one VXLAN port. Use very first port |
| 484 | 484 | * for enabling offload |
| 485 | 485 | */ |
| 486 | − if (!qlcnic_encap_rx_offload(adapter) || ahw->vxlan_port) | |
| 486 | + if (!qlcnic_encap_rx_offload(adapter)) | |
| 487 | 487 | return; |
| 488 | + if (!ahw->vxlan_port_count) { | |
| 489 | + ahw->vxlan_port_count = 1; | |
| 490 | + ahw->vxlan_port = ntohs(port); | |
| 491 | + adapter->flags |= QLCNIC_ADD_VXLAN_PORT; | |
| 492 | + return; | |
| 493 | + } | |
| 494 | + if (ahw->vxlan_port == ntohs(port)) | |
| 495 | + ahw->vxlan_port_count++; | |
| 488 | 496 | |
| 489 | − ahw->vxlan_port = ntohs(port); | |
| 490 | − adapter->flags |= QLCNIC_ADD_VXLAN_PORT; | |
| 491 | 497 | } |
| 492 | 498 | |
| 493 | 499 | static void qlcnic_del_vxlan_port(struct net_device *netdev, |
| @@ -496,11 +502,13 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev, · 2 unmodified lines | ||
| 496 | 502 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
| 497 | 503 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
| 498 | 504 | |
| 499 | − if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port || | |
| 505 | + if (!qlcnic_encap_rx_offload(adapter) || !ahw->vxlan_port_count || | |
| 500 | 506 | (ahw->vxlan_port != ntohs(port))) |
| 501 | 507 | return; |
| 502 | 508 | |
| 503 | − adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | |
| 509 | + ahw->vxlan_port_count--; | |
| 510 | + if (!ahw->vxlan_port_count) | |
| 511 | + adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | |
| 504 | 512 | } |
| 505 | 513 | |
| 506 | 514 | static netdev_features_t qlcnic_features_check(struct sk_buff *skb, |
| @@ -157,6 +157,7 @@ enum { · 156 unmodified lines | ||
| 157 | 157 | NWayAdvert = 0x66, /* MII ADVERTISE */ |
| 158 | 158 | NWayLPAR = 0x68, /* MII LPA */ |
| 159 | 159 | NWayExpansion = 0x6A, /* MII Expansion */ |
| 160 | + TxDmaOkLowDesc = 0x82, /* Low 16 bit address of a Tx descriptor. */ | |
| 160 | 161 | Config5 = 0xD8, /* Config5 */ |
| 161 | 162 | TxPoll = 0xD9, /* Tell chip to check Tx descriptors for work */ |
| 162 | 163 | RxMaxSize = 0xDA, /* Max size of an Rx packet (8169 only) */ |
| @@ -341,6 +342,7 @@ struct cp_private { · 178 unmodified lines | ||
| 341 | 342 | unsigned tx_tail; |
| 342 | 343 | struct cp_desc *tx_ring; |
| 343 | 344 | struct sk_buff *tx_skb[CP_TX_RING_SIZE]; |
| 345 | + u32 tx_opts[CP_TX_RING_SIZE]; | |
| 344 | 346 | |
| 345 | 347 | unsigned rx_buf_sz; |
| 346 | 348 | unsigned wol_enabled : 1; /* Is Wake-on-LAN enabled? */ |
| @@ -665,7 +667,7 @@ static void cp_tx (struct cp_private *cp) · 318 unmodified lines | ||
| 665 | 667 | BUG_ON(!skb); |
| 666 | 668 | |
| 667 | 669 | dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), |
| 668 | − le32_to_cpu(txd->opts1) & 0xffff, | |
| 670 | + cp->tx_opts[tx_tail] & 0xffff, | |
| 669 | 671 | PCI_DMA_TODEVICE); |
| 670 | 672 | |
| 671 | 673 | if (status & LastFrag) { |
| @@ -733,7 +735,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 61 unmodified lines | ||
| 733 | 735 | { |
| 734 | 736 | struct cp_private *cp = netdev_priv(dev); |
| 735 | 737 | unsigned entry; |
| 736 | − u32 eor, flags; | |
| 738 | + u32 eor, opts1; | |
| 737 | 739 | unsigned long intr_flags; |
| 738 | 740 | __le32 opts2; |
| 739 | 741 | int mss = 0; |
| @@ -753,6 +755,21 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 13 unmodified lines | ||
| 753 | 755 | mss = skb_shinfo(skb)->gso_size; |
| 754 | 756 | |
| 755 | 757 | opts2 = cpu_to_le32(cp_tx_vlan_tag(skb)); |
| 758 | + opts1 = DescOwn; | |
| 759 | + if (mss) | |
| 760 | + opts1 |= LargeSend | ((mss & MSSMask) << MSSShift); | |
| 761 | + else if (skb->ip_summed == CHECKSUM_PARTIAL) { | |
| 762 | + const struct iphdr *ip = ip_hdr(skb); | |
| 763 | + if (ip->protocol == IPPROTO_TCP) | |
| 764 | + opts1 |= IPCS | TCPCS; | |
| 765 | + else if (ip->protocol == IPPROTO_UDP) | |
| 766 | + opts1 |= IPCS | UDPCS; | |
| 767 | + else { | |
| 768 | + WARN_ONCE(1, | |
| 769 | + "Net bug: asked to checksum invalid Legacy IP packet\n"); | |
| 770 | + goto out_dma_error; | |
| 771 | + } | |
| 772 | + } | |
| 756 | 773 | |
| 757 | 774 | if (skb_shinfo(skb)->nr_frags == 0) { |
| 758 | 775 | struct cp_desc *txd = &cp->tx_ring[entry]; |
| @@ -768,31 +785,20 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 9 unmodified lines | ||
| 768 | 785 | txd->addr = cpu_to_le64(mapping); |
| 769 | 786 | wmb(); |
| 770 | 787 | |
| 771 | − flags = eor | len | DescOwn | FirstFrag | LastFrag; | |
| 772 | − | |
| 773 | − if (mss) | |
| 774 | − flags |= LargeSend | ((mss & MSSMask) << MSSShift); | |
| 775 | − else if (skb->ip_summed == CHECKSUM_PARTIAL) { | |
| 776 | − const struct iphdr *ip = ip_hdr(skb); | |
| 777 | − if (ip->protocol == IPPROTO_TCP) | |
| 778 | − flags |= IPCS | TCPCS; | |
| 779 | − else if (ip->protocol == IPPROTO_UDP) | |
| 780 | − flags |= IPCS | UDPCS; | |
| 781 | − else | |
| 782 | − WARN_ON(1); /* we need a WARN() */ | |
| 783 | − } | |
| 788 | + opts1 |= eor | len | FirstFrag | LastFrag; | |
| 784 | 789 | |
| 785 | − txd->opts1 = cpu_to_le32(flags); | |
| 790 | + txd->opts1 = cpu_to_le32(opts1); | |
| 786 | 791 | wmb(); |
| 787 | 792 | |
| 788 | 793 | cp->tx_skb[entry] = skb; |
| 789 | − entry = NEXT_TX(entry); | |
| 794 | + cp->tx_opts[entry] = opts1; | |
| 795 | + netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", | |
| 796 | + entry, skb->len); | |
| 790 | 797 | } else { |
| 791 | 798 | struct cp_desc *txd; |
| 792 | − u32 first_len, first_eor; | |
| 799 | + u32 first_len, first_eor, ctrl; | |
| 793 | 800 | dma_addr_t first_mapping; |
| 794 | 801 | int frag, first_entry = entry; |
| 795 | − const struct iphdr *ip = ip_hdr(skb); | |
| 796 | 802 | |
| 797 | 803 | /* We must give this initial chunk to the device last. |
| 798 | 804 | * Otherwise we could race with the device. |
| @@ -805,14 +811,14 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 6 unmodified lines | ||
| 805 | 811 | goto out_dma_error; |
| 806 | 812 | |
| 807 | 813 | cp->tx_skb[entry] = skb; |
| 808 | − entry = NEXT_TX(entry); | |
| 809 | 814 | |
| 810 | 815 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { |
| 811 | 816 | const skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag]; |
| 812 | 817 | u32 len; |
| 813 | − u32 ctrl; | |
| 814 | 818 | dma_addr_t mapping; |
| 815 | 819 | |
| 820 | + entry = NEXT_TX(entry); | |
| 821 | + | |
| 816 | 822 | len = skb_frag_size(this_frag); |
| 817 | 823 | mapping = dma_map_single(&cp->pdev->dev, |
| 818 | 824 | skb_frag_address(this_frag), |
| @@ -824,19 +830,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 5 unmodified lines | ||
| 824 | 830 | |
| 825 | 831 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; |
| 826 | 832 | |
| 827 | − ctrl = eor | len | DescOwn; | |
| 828 | − | |
| 829 | − if (mss) | |
| 830 | − ctrl |= LargeSend | | |
| 831 | − ((mss & MSSMask) << MSSShift); | |
| 832 | − else if (skb->ip_summed == CHECKSUM_PARTIAL) { | |
| 833 | − if (ip->protocol == IPPROTO_TCP) | |
| 834 | − ctrl |= IPCS | TCPCS; | |
| 835 | − else if (ip->protocol == IPPROTO_UDP) | |
| 836 | − ctrl |= IPCS | UDPCS; | |
| 837 | − else | |
| 838 | − BUG(); | |
| 839 | − } | |
| 833 | + ctrl = opts1 | eor | len; | |
| 840 | 834 | |
| 841 | 835 | if (frag == skb_shinfo(skb)->nr_frags - 1) |
| 842 | 836 | ctrl |= LastFrag; |
| @@ -849,8 +843,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 6 unmodified lines | ||
| 849 | 843 | txd->opts1 = cpu_to_le32(ctrl); |
| 850 | 844 | wmb(); |
| 851 | 845 | |
| 846 | + cp->tx_opts[entry] = ctrl; | |
| 852 | 847 | cp->tx_skb[entry] = skb; |
| 853 | − entry = NEXT_TX(entry); | |
| 854 | 848 | } |
| 855 | 849 | |
| 856 | 850 | txd = &cp->tx_ring[first_entry]; |
| @@ -858,27 +852,17 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, · 1 unmodified line | ||
| 858 | 852 | txd->addr = cpu_to_le64(first_mapping); |
| 859 | 853 | wmb(); |
| 860 | 854 | |
| 861 | − if (skb->ip_summed == CHECKSUM_PARTIAL) { | |
| 862 | − if (ip->protocol == IPPROTO_TCP) | |
| 863 | − txd->opts1 = cpu_to_le32(first_eor | first_len | | |
| 864 | − FirstFrag | DescOwn | | |
| 865 | − IPCS | TCPCS); | |
| 866 | − else if (ip->protocol == IPPROTO_UDP) | |
| 867 | − txd->opts1 = cpu_to_le32(first_eor | first_len | | |
| 868 | − FirstFrag | DescOwn | | |
| 869 | − IPCS | UDPCS); | |
| 870 | − else | |
| 871 | − BUG(); | |
| 872 | − } else | |
| 873 | − txd->opts1 = cpu_to_le32(first_eor | first_len | | |
| 874 | − FirstFrag | DescOwn); | |
| 855 | + ctrl = opts1 | first_eor | first_len | FirstFrag; | |
| 856 | + txd->opts1 = cpu_to_le32(ctrl); | |
| 875 | 857 | wmb(); |
| 858 | + | |
| 859 | + cp->tx_opts[first_entry] = ctrl; | |
| 860 | + netif_dbg(cp, tx_queued, cp->dev, "tx queued, slots %d-%d, skblen %d\n", | |
| 861 | + first_entry, entry, skb->len); | |
| 876 | 862 | } |
| 877 | − cp->tx_head = entry; | |
| 863 | + cp->tx_head = NEXT_TX(entry); | |
| 878 | 864 | |
| 879 | 865 | netdev_sent_queue(dev, skb->len); |
| 880 | − netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n", | |
| 881 | − entry, skb->len); | |
| 882 | 866 | if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) |
| 883 | 867 | netif_stop_queue(dev); |
| 884 | 868 | |
| @@ -1115,6 +1099,7 @@ static int cp_init_rings (struct cp_private *cp) · 230 unmodified lines | ||
| 1115 | 1099 | { |
| 1116 | 1100 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); |
| 1117 | 1101 | cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd); |
| 1102 | + memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); | |
| 1118 | 1103 | |
| 1119 | 1104 | cp_init_rings_index(cp); |
| 1120 | 1105 | |
| @@ -1151,7 +1136,7 @@ static void cp_clean_rings (struct cp_private *cp) · 30 unmodified lines | ||
| 1151 | 1136 | desc = cp->rx_ring + i; |
| 1152 | 1137 | dma_unmap_single(&cp->pdev->dev,le64_to_cpu(desc->addr), |
| 1153 | 1138 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
| 1154 | − dev_kfree_skb(cp->rx_skb[i]); | |
| 1139 | + dev_kfree_skb_any(cp->rx_skb[i]); | |
| 1155 | 1140 | } |
| 1156 | 1141 | } |
| 1157 | 1142 | |
| @@ -1164,7 +1149,7 @@ static void cp_clean_rings (struct cp_private *cp) · 6 unmodified lines | ||
| 1164 | 1149 | le32_to_cpu(desc->opts1) & 0xffff, |
| 1165 | 1150 | PCI_DMA_TODEVICE); |
| 1166 | 1151 | if (le32_to_cpu(desc->opts1) & LastFrag) |
| 1167 | − dev_kfree_skb(skb); | |
| 1152 | + dev_kfree_skb_any(skb); | |
| 1168 | 1153 | cp->dev->stats.tx_dropped++; |
| 1169 | 1154 | } |
| 1170 | 1155 | } |
| @@ -1172,6 +1157,7 @@ static void cp_clean_rings (struct cp_private *cp) · 1 unmodified line | ||
| 1172 | 1157 | |
| 1173 | 1158 | memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); |
| 1174 | 1159 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); |
| 1160 | + memset(cp->tx_opts, 0, sizeof(cp->tx_opts)); | |
| 1175 | 1161 | |
| 1176 | 1162 | memset(cp->rx_skb, 0, sizeof(struct sk_buff *) * CP_RX_RING_SIZE); |
| 1177 | 1163 | memset(cp->tx_skb, 0, sizeof(struct sk_buff *) * CP_TX_RING_SIZE); |
| @@ -1249,7 +1235,7 @@ static void cp_tx_timeout(struct net_device *dev) · 71 unmodified lines | ||
| 1249 | 1235 | { |
| 1250 | 1236 | struct cp_private *cp = netdev_priv(dev); |
| 1251 | 1237 | unsigned long flags; |
| 1252 | − int rc; | |
| 1238 | + int rc, i; | |
| 1253 | 1239 | |
| 1254 | 1240 | netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n", |
| 1255 | 1241 | cpr8(Cmd), cpr16(CpCmd), |
| @@ -1257,13 +1243,26 @@ static void cp_tx_timeout(struct net_device *dev) · 1 unmodified line | ||
| 1257 | 1243 | |
| 1258 | 1244 | spin_lock_irqsave(&cp->lock, flags); |
| 1259 | 1245 | |
| 1246 | + netif_dbg(cp, tx_err, cp->dev, "TX ring head %d tail %d desc %x\n", | |
| 1247 | + cp->tx_head, cp->tx_tail, cpr16(TxDmaOkLowDesc)); | |
| 1248 | + for (i = 0; i < CP_TX_RING_SIZE; i++) { | |
| 1249 | + netif_dbg(cp, tx_err, cp->dev, | |
| 1250 | + "TX slot %d @%p: %08x (%08x) %08x %llx %p\n", | |
| 1251 | + i, &cp->tx_ring[i], le32_to_cpu(cp->tx_ring[i].opts1), | |
| 1252 | + cp->tx_opts[i], le32_to_cpu(cp->tx_ring[i].opts2), | |
| 1253 | + le64_to_cpu(cp->tx_ring[i].addr), | |
| 1254 | + cp->tx_skb[i]); | |
| 1255 | + } | |
| 1256 | + | |
| 1260 | 1257 | cp_stop_hw(cp); |
| 1261 | 1258 | cp_clean_rings(cp); |
| 1262 | 1259 | rc = cp_init_rings(cp); |
| 1263 | 1260 | cp_start_hw(cp); |
| 1264 | − cp_enable_irq(cp); | |
| 1261 | + __cp_set_rx_mode(dev); | |
| 1262 | + cpw16_f(IntrMask, cp_norx_intr_mask); | |
| 1265 | 1263 | |
| 1266 | 1264 | netif_wake_queue(dev); |
| 1265 | + napi_schedule_irqoff(&cp->napi); | |
| 1267 | 1266 | |
| 1268 | 1267 | spin_unlock_irqrestore(&cp->lock, flags); |
| 1269 | 1268 | } |
| @@ -6081,7 +6081,7 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp) · 6080 unmodified lines | ||
| 6081 | 6081 | { |
| 6082 | 6082 | void __iomem *ioaddr = tp->mmio_addr; |
| 6083 | 6083 | struct pci_dev *pdev = tp->pci_dev; |
| 6084 | − u16 rg_saw_cnt; | |
| 6084 | + int rg_saw_cnt; | |
| 6085 | 6085 | u32 data; |
| 6086 | 6086 | static const struct ephy_info e_info_8168h_1[] = { |
| 6087 | 6087 | { 0x1e, 0x0800, 0x0001 }, |
| @@ -161,11 +161,16 @@ int stmmac_mdio_reset(struct mii_bus *bus) · 160 unmodified lines | ||
| 161 | 161 | |
| 162 | 162 | if (!gpio_request(reset_gpio, "mdio-reset")) { |
| 163 | 163 | gpio_direction_output(reset_gpio, active_low ? 1 : 0); |
| 164 | − udelay(data->delays[0]); | |
| 164 | + if (data->delays[0]) | |
| 165 | + msleep(DIV_ROUND_UP(data->delays[0], 1000)); | |
| 166 | + | |
| 165 | 167 | gpio_set_value(reset_gpio, active_low ? 0 : 1); |
| 166 | − udelay(data->delays[1]); | |
| 168 | + if (data->delays[1]) | |
| 169 | + msleep(DIV_ROUND_UP(data->delays[1], 1000)); | |
| 170 | + | |
| 167 | 171 | gpio_set_value(reset_gpio, active_low ? 1 : 0); |
| 168 | − udelay(data->delays[2]); | |
| 172 | + if (data->delays[2]) | |
| 173 | + msleep(DIV_ROUND_UP(data->delays[2], 1000)); | |
| 169 | 174 | } |
| 170 | 175 | } |
| 171 | 176 | #endif |
| @@ -1756,7 +1756,8 @@ static const struct net_device_ops vnet_ops = { · 1755 unmodified lines | ||
| 1756 | 1756 | #endif |
| 1757 | 1757 | }; |
| 1758 | 1758 | |
| 1759 | −static struct vnet *vnet_new(const u64 *local_mac) | |
| 1759 | +static struct vnet *vnet_new(const u64 *local_mac, | |
| 1760 | + struct vio_dev *vdev) | |
| 1760 | 1761 | { |
| 1761 | 1762 | struct net_device *dev; |
| 1762 | 1763 | struct vnet *vp; |
| @@ -1790,6 +1791,8 @@ static struct vnet *vnet_new(const u64 *local_mac) · 27 unmodified lines | ||
| 1790 | 1791 | NETIF_F_HW_CSUM | NETIF_F_SG; |
| 1791 | 1792 | dev->features = dev->hw_features; |
| 1792 | 1793 | |
| 1794 | + SET_NETDEV_DEV(dev, &vdev->dev); | |
| 1795 | + | |
| 1793 | 1796 | err = register_netdev(dev); |
| 1794 | 1797 | if (err) { |
| 1795 | 1798 | pr_err("Cannot register net device, aborting\n"); |
| @@ -1808,7 +1811,8 @@ err_out_free_dev: · 12 unmodified lines | ||
| 1808 | 1811 | return ERR_PTR(err); |
| 1809 | 1812 | } |
| 1810 | 1813 | |
| 1811 | −static struct vnet *vnet_find_or_create(const u64 *local_mac) | |
| 1814 | +static struct vnet *vnet_find_or_create(const u64 *local_mac, | |
| 1815 | + struct vio_dev *vdev) | |
| 1812 | 1816 | { |
| 1813 | 1817 | struct vnet *iter, *vp; |
| 1814 | 1818 | |
| @@ -1821,7 +1825,7 @@ static struct vnet *vnet_find_or_create(const u64 *local_mac) · 6 unmodified lines | ||
| 1821 | 1825 | } |
| 1822 | 1826 | } |
| 1823 | 1827 | if (!vp) |
| 1824 | − vp = vnet_new(local_mac); | |
| 1828 | + vp = vnet_new(local_mac, vdev); | |
| 1825 | 1829 | mutex_unlock(&vnet_list_mutex); |
| 1826 | 1830 | |
| 1827 | 1831 | return vp; |
| @@ -1848,7 +1852,8 @@ static void vnet_cleanup(void) · 20 unmodified lines | ||
| 1848 | 1852 | static const char *local_mac_prop = "local-mac-address"; |
| 1849 | 1853 | |
| 1850 | 1854 | static struct vnet *vnet_find_parent(struct mdesc_handle *hp, |
| 1851 | − u64 port_node) | |
| 1855 | + u64 port_node, | |
| 1856 | + struct vio_dev *vdev) | |
| 1852 | 1857 | { |
| 1853 | 1858 | const u64 *local_mac = NULL; |
| 1854 | 1859 | u64 a; |
| @@ -1869,7 +1874,7 @@ static struct vnet *vnet_find_parent(struct mdesc_handle *hp, · 14 unmodified lines | ||
| 1869 | 1874 | if (!local_mac) |
| 1870 | 1875 | return ERR_PTR(-ENODEV); |
| 1871 | 1876 | |
| 1872 | − return vnet_find_or_create(local_mac); | |
| 1877 | + return vnet_find_or_create(local_mac, vdev); | |
| 1873 | 1878 | } |
| 1874 | 1879 | |
| 1875 | 1880 | static struct ldc_channel_config vnet_ldc_cfg = { |
| @@ -1923,7 +1928,7 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 47 unmodified lines | ||
| 1923 | 1928 | |
| 1924 | 1929 | hp = mdesc_grab(); |
| 1925 | 1930 | |
| 1926 | − vp = vnet_find_parent(hp, vdev->mp); | |
| 1931 | + vp = vnet_find_parent(hp, vdev->mp, vdev); | |
| 1927 | 1932 | if (IS_ERR(vp)) { |
| 1928 | 1933 | pr_err("Cannot find port parent vnet\n"); |
| 1929 | 1934 | err = PTR_ERR(vp); |
| @@ -291,13 +291,6 @@ static int netcp_module_probe(struct netcp_device *netcp_device, · 290 unmodified lines | ||
| 291 | 291 | interface_list) { |
| 292 | 292 | struct netcp_intf_modpriv *intf_modpriv; |
| 293 | 293 | |
| 294 | − /* If interface not registered then register now */ | |
| 295 | − if (!netcp_intf->netdev_registered) | |
| 296 | − ret = netcp_register_interface(netcp_intf); | |
| 297 | − | |
| 298 | − if (ret) | |
| 299 | − return -ENODEV; | |
| 300 | − | |
| 301 | 294 | intf_modpriv = devm_kzalloc(dev, sizeof(*intf_modpriv), |
| 302 | 295 | GFP_KERNEL); |
| 303 | 296 | if (!intf_modpriv) |
| @@ -306,6 +299,11 @@ static int netcp_module_probe(struct netcp_device *netcp_device, · 2 unmodified lines | ||
| 306 | 299 | interface = of_parse_phandle(netcp_intf->node_interface, |
| 307 | 300 | module->name, 0); |
| 308 | 301 | |
| 302 | + if (!interface) { | |
| 303 | + devm_kfree(dev, intf_modpriv); | |
| 304 | + continue; | |
| 305 | + } | |
| 306 | + | |
| 309 | 307 | intf_modpriv->netcp_priv = netcp_intf; |
| 310 | 308 | intf_modpriv->netcp_module = module; |
| 311 | 309 | list_add_tail(&intf_modpriv->intf_list, |
| @@ -323,6 +321,18 @@ static int netcp_module_probe(struct netcp_device *netcp_device, · 11 unmodified lines | ||
| 323 | 321 | continue; |
| 324 | 322 | } |
| 325 | 323 | } |
| 324 | + | |
| 325 | + /* Now register the interface with netdev */ | |
| 326 | + list_for_each_entry(netcp_intf, | |
| 327 | + &netcp_device->interface_head, | |
| 328 | + interface_list) { | |
| 329 | + /* If interface not registered then register now */ | |
| 330 | + if (!netcp_intf->netdev_registered) { | |
| 331 | + ret = netcp_register_interface(netcp_intf); | |
| 332 | + if (ret) | |
| 333 | + return -ENODEV; | |
| 334 | + } | |
| 335 | + } | |
| 326 | 336 | return 0; |
| 327 | 337 | } |
| 328 | 338 | |
| @@ -357,7 +367,6 @@ int netcp_register_module(struct netcp_module *module) · 28 unmodified lines | ||
| 357 | 367 | if (ret < 0) |
| 358 | 368 | goto fail; |
| 359 | 369 | } |
| 360 | − | |
| 361 | 370 | mutex_unlock(&netcp_modules_lock); |
| 362 | 371 | return 0; |
| 363 | 372 | |
| @@ -796,7 +805,7 @@ static void netcp_rxpool_free(struct netcp_intf *netcp) · 432 unmodified lines | ||
| 796 | 805 | netcp->rx_pool = NULL; |
| 797 | 806 | } |
| 798 | 807 | |
| 799 | −static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) | |
| 808 | +static int netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) | |
| 800 | 809 | { |
| 801 | 810 | struct knav_dma_desc *hwdesc; |
| 802 | 811 | unsigned int buf_len, dma_sz; |
| @@ -810,7 +819,7 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) · 7 unmodified lines | ||
| 810 | 819 | hwdesc = knav_pool_desc_get(netcp->rx_pool); |
| 811 | 820 | if (IS_ERR_OR_NULL(hwdesc)) { |
| 812 | 821 | dev_dbg(netcp->ndev_dev, "out of rx pool desc\n"); |
| 813 | − return; | |
| 822 | + return -ENOMEM; | |
| 814 | 823 | } |
| 815 | 824 | |
| 816 | 825 | if (likely(fdq == 0)) { |
| @@ -862,25 +871,26 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) · 45 unmodified lines | ||
| 862 | 871 | knav_pool_desc_map(netcp->rx_pool, hwdesc, sizeof(*hwdesc), &dma, |
| 863 | 872 | &dma_sz); |
| 864 | 873 | knav_queue_push(netcp->rx_fdq[fdq], dma, sizeof(*hwdesc), 0); |
| 865 | − return; | |
| 874 | + return 0; | |
| 866 | 875 | |
| 867 | 876 | fail: |
| 868 | 877 | knav_pool_desc_put(netcp->rx_pool, hwdesc); |
| 878 | + return -ENOMEM; | |
| 869 | 879 | } |
| 870 | 880 | |
| 871 | 881 | /* Refill Rx FDQ with descriptors & attached buffers */ |
| 872 | 882 | static void netcp_rxpool_refill(struct netcp_intf *netcp) |
| 873 | 883 | { |
| 874 | 884 | u32 fdq_deficit[KNAV_DMA_FDQ_PER_CHAN] = {0}; |
| 875 | − int i; | |
| 885 | + int i, ret = 0; | |
| 876 | 886 | |
| 877 | 887 | /* Calculate the FDQ deficit and refill */ |
| 878 | 888 | for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && netcp->rx_fdq[i]; i++) { |
| 879 | 889 | fdq_deficit[i] = netcp->rx_queue_depths[i] - |
| 880 | 890 | knav_queue_get_count(netcp->rx_fdq[i]); |
| 881 | 891 | |
| 882 | − while (fdq_deficit[i]--) | |
| 883 | − netcp_allocate_rx_buf(netcp, i); | |
| 892 | + while (fdq_deficit[i]-- && !ret) | |
| 893 | + ret = netcp_allocate_rx_buf(netcp, i); | |
| 884 | 894 | } /* end for fdqs */ |
| 885 | 895 | } |
| 886 | 896 | |
| @@ -893,12 +903,12 @@ static int netcp_rx_poll(struct napi_struct *napi, int budget) · 6 unmodified lines | ||
| 893 | 903 | |
| 894 | 904 | packets = netcp_process_rx_packets(netcp, budget); |
| 895 | 905 | |
| 906 | + netcp_rxpool_refill(netcp); | |
| 896 | 907 | if (packets < budget) { |
| 897 | 908 | napi_complete(&netcp->rx_napi); |
| 898 | 909 | knav_queue_enable_notify(netcp->rx_queue); |
| 899 | 910 | } |
| 900 | 911 | |
| 901 | − netcp_rxpool_refill(netcp); | |
| 902 | 912 | return packets; |
| 903 | 913 | } |
| 904 | 914 | |
| @@ -1384,7 +1394,6 @@ static void netcp_addr_sweep_del(struct netcp_intf *netcp) · 479 unmodified lines | ||
| 1384 | 1394 | continue; |
| 1385 | 1395 | dev_dbg(netcp->ndev_dev, "deleting address %pM, type %x\n", |
| 1386 | 1396 | naddr->addr, naddr->type); |
| 1387 | − mutex_lock(&netcp_modules_lock); | |
| 1388 | 1397 | for_each_module(netcp, priv) { |
| 1389 | 1398 | module = priv->netcp_module; |
| 1390 | 1399 | if (!module->del_addr) |
| @@ -1393,7 +1402,6 @@ static void netcp_addr_sweep_del(struct netcp_intf *netcp) · 2 unmodified lines | ||
| 1393 | 1402 | naddr); |
| 1394 | 1403 | WARN_ON(error); |
| 1395 | 1404 | } |
| 1396 | − mutex_unlock(&netcp_modules_lock); | |
| 1397 | 1405 | netcp_addr_del(netcp, naddr); |
| 1398 | 1406 | } |
| 1399 | 1407 | } |
| @@ -1410,7 +1418,7 @@ static void netcp_addr_sweep_add(struct netcp_intf *netcp) · 10 unmodified lines | ||
| 1410 | 1418 | continue; |
| 1411 | 1419 | dev_dbg(netcp->ndev_dev, "adding address %pM, type %x\n", |
| 1412 | 1420 | naddr->addr, naddr->type); |
| 1413 | − mutex_lock(&netcp_modules_lock); | |
| 1421 | + | |
| 1414 | 1422 | for_each_module(netcp, priv) { |
| 1415 | 1423 | module = priv->netcp_module; |
| 1416 | 1424 | if (!module->add_addr) |
| @@ -1418,7 +1426,6 @@ static void netcp_addr_sweep_add(struct netcp_intf *netcp) · 1 unmodified line | ||
| 1418 | 1426 | error = module->add_addr(priv->module_priv, naddr); |
| 1419 | 1427 | WARN_ON(error); |
| 1420 | 1428 | } |
| 1421 | − mutex_unlock(&netcp_modules_lock); | |
| 1422 | 1429 | } |
| 1423 | 1430 | } |
| 1424 | 1431 | |
| @@ -1432,6 +1439,7 @@ static void netcp_set_rx_mode(struct net_device *ndev) · 7 unmodified lines | ||
| 1432 | 1439 | ndev->flags & IFF_ALLMULTI || |
| 1433 | 1440 | netdev_mc_count(ndev) > NETCP_MAX_MCAST_ADDR); |
| 1434 | 1441 | |
| 1442 | + spin_lock(&netcp->lock); | |
| 1435 | 1443 | /* first clear all marks */ |
| 1436 | 1444 | netcp_addr_clear_mark(netcp); |
| 1437 | 1445 | |
| @@ -1450,6 +1458,7 @@ static void netcp_set_rx_mode(struct net_device *ndev) · 12 unmodified lines | ||
| 1450 | 1458 | /* finally sweep and callout into modules */ |
| 1451 | 1459 | netcp_addr_sweep_del(netcp); |
| 1452 | 1460 | netcp_addr_sweep_add(netcp); |
| 1461 | + spin_unlock(&netcp->lock); | |
| 1453 | 1462 | } |
| 1454 | 1463 | |
| 1455 | 1464 | static void netcp_free_navigator_resources(struct netcp_intf *netcp) |
| @@ -1614,7 +1623,6 @@ static int netcp_ndo_open(struct net_device *ndev) · 158 unmodified lines | ||
| 1614 | 1623 | goto fail; |
| 1615 | 1624 | } |
| 1616 | 1625 | |
| 1617 | − mutex_lock(&netcp_modules_lock); | |
| 1618 | 1626 | for_each_module(netcp, intf_modpriv) { |
| 1619 | 1627 | module = intf_modpriv->netcp_module; |
| 1620 | 1628 | if (module->open) { |
| @@ -1625,7 +1633,6 @@ static int netcp_ndo_open(struct net_device *ndev) · 4 unmodified lines | ||
| 1625 | 1633 | } |
| 1626 | 1634 | } |
| 1627 | 1635 | } |
| 1628 | − mutex_unlock(&netcp_modules_lock); | |
| 1629 | 1636 | |
| 1630 | 1637 | napi_enable(&netcp->rx_napi); |
| 1631 | 1638 | napi_enable(&netcp->tx_napi); |
| @@ -1642,7 +1649,6 @@ fail_open: · 10 unmodified lines | ||
| 1642 | 1649 | if (module->close) |
| 1643 | 1650 | module->close(intf_modpriv->module_priv, ndev); |
| 1644 | 1651 | } |
| 1645 | − mutex_unlock(&netcp_modules_lock); | |
| 1646 | 1652 | |
| 1647 | 1653 | fail: |
| 1648 | 1654 | netcp_free_navigator_resources(netcp); |
| @@ -1666,7 +1672,6 @@ static int netcp_ndo_stop(struct net_device *ndev) · 17 unmodified lines | ||
| 1666 | 1672 | napi_disable(&netcp->rx_napi); |
| 1667 | 1673 | napi_disable(&netcp->tx_napi); |
| 1668 | 1674 | |
| 1669 | − mutex_lock(&netcp_modules_lock); | |
| 1670 | 1675 | for_each_module(netcp, intf_modpriv) { |
| 1671 | 1676 | module = intf_modpriv->netcp_module; |
| 1672 | 1677 | if (module->close) { |
| @@ -1675,7 +1680,6 @@ static int netcp_ndo_stop(struct net_device *ndev) · 2 unmodified lines | ||
| 1675 | 1680 | dev_err(netcp->ndev_dev, "Close failed\n"); |
| 1676 | 1681 | } |
| 1677 | 1682 | } |
| 1678 | − mutex_unlock(&netcp_modules_lock); | |
| 1679 | 1683 | |
| 1680 | 1684 | /* Recycle Rx descriptors from completion queue */ |
| 1681 | 1685 | netcp_empty_rx_queue(netcp); |
| @@ -1703,7 +1707,6 @@ static int netcp_ndo_ioctl(struct net_device *ndev, · 21 unmodified lines | ||
| 1703 | 1707 | if (!netif_running(ndev)) |
| 1704 | 1708 | return -EINVAL; |
| 1705 | 1709 | |
| 1706 | − mutex_lock(&netcp_modules_lock); | |
| 1707 | 1710 | for_each_module(netcp, intf_modpriv) { |
| 1708 | 1711 | module = intf_modpriv->netcp_module; |
| 1709 | 1712 | if (!module->ioctl) |
| @@ -1719,7 +1722,6 @@ static int netcp_ndo_ioctl(struct net_device *ndev, · 9 unmodified lines | ||
| 1719 | 1722 | } |
| 1720 | 1723 | |
| 1721 | 1724 | out: |
| 1722 | − mutex_unlock(&netcp_modules_lock); | |
| 1723 | 1725 | return (ret == 0) ? 0 : err; |
| 1724 | 1726 | } |
| 1725 | 1727 | |
| @@ -1754,11 +1756,12 @@ static int netcp_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) · 28 unmodified lines | ||
| 1754 | 1756 | struct netcp_intf *netcp = netdev_priv(ndev); |
| 1755 | 1757 | struct netcp_intf_modpriv *intf_modpriv; |
| 1756 | 1758 | struct netcp_module *module; |
| 1759 | + unsigned long flags; | |
| 1757 | 1760 | int err = 0; |
| 1758 | 1761 | |
| 1759 | 1762 | dev_dbg(netcp->ndev_dev, "adding rx vlan id: %d\n", vid); |
| 1760 | 1763 | |
| 1761 | − mutex_lock(&netcp_modules_lock); | |
| 1764 | + spin_lock_irqsave(&netcp->lock, flags); | |
| 1762 | 1765 | for_each_module(netcp, intf_modpriv) { |
| 1763 | 1766 | module = intf_modpriv->netcp_module; |
| 1764 | 1767 | if ((module->add_vid) && (vid != 0)) { |
| @@ -1770,7 +1773,8 @@ static int netcp_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) · 5 unmodified lines | ||
| 1770 | 1773 | } |
| 1771 | 1774 | } |
| 1772 | 1775 | } |
| 1773 | − mutex_unlock(&netcp_modules_lock); | |
| 1776 | + spin_unlock_irqrestore(&netcp->lock, flags); | |
| 1777 | + | |
| 1774 | 1778 | return err; |
| 1775 | 1779 | } |
| 1776 | 1780 | |
| @@ -1779,11 +1783,12 @@ static int netcp_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) · 2 unmodified lines | ||
| 1779 | 1783 | struct netcp_intf *netcp = netdev_priv(ndev); |
| 1780 | 1784 | struct netcp_intf_modpriv *intf_modpriv; |
| 1781 | 1785 | struct netcp_module *module; |
| 1786 | + unsigned long flags; | |
| 1782 | 1787 | int err = 0; |
| 1783 | 1788 | |
| 1784 | 1789 | dev_dbg(netcp->ndev_dev, "removing rx vlan id: %d\n", vid); |
| 1785 | 1790 | |
| 1786 | − mutex_lock(&netcp_modules_lock); | |
| 1791 | + spin_lock_irqsave(&netcp->lock, flags); | |
| 1787 | 1792 | for_each_module(netcp, intf_modpriv) { |
| 1788 | 1793 | module = intf_modpriv->netcp_module; |
| 1789 | 1794 | if (module->del_vid) { |
| @@ -1795,7 +1800,7 @@ static int netcp_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) · 5 unmodified lines | ||
| 1795 | 1800 | } |
| 1796 | 1801 | } |
| 1797 | 1802 | } |
| 1798 | − mutex_unlock(&netcp_modules_lock); | |
| 1803 | + spin_unlock_irqrestore(&netcp->lock, flags); | |
| 1799 | 1804 | return err; |
| 1800 | 1805 | } |
| 1801 | 1806 | |
| @@ -2040,7 +2045,6 @@ static int netcp_probe(struct platform_device *pdev) · 238 unmodified lines | ||
| 2040 | 2045 | struct device_node *child, *interfaces; |
| 2041 | 2046 | struct netcp_device *netcp_device; |
| 2042 | 2047 | struct device *dev = &pdev->dev; |
| 2043 | − struct netcp_module *module; | |
| 2044 | 2048 | int ret; |
| 2045 | 2049 | |
| 2046 | 2050 | if (!node) { |
| @@ -2087,14 +2091,6 @@ static int netcp_probe(struct platform_device *pdev) · 40 unmodified lines | ||
| 2087 | 2091 | /* Add the device instance to the list */ |
| 2088 | 2092 | list_add_tail(&netcp_device->device_list, &netcp_devices); |
| 2089 | 2093 | |
| 2090 | − /* Probe & attach any modules already registered */ | |
| 2091 | − mutex_lock(&netcp_modules_lock); | |
| 2092 | − for_each_netcp_module(module) { | |
| 2093 | − ret = netcp_module_probe(netcp_device, module); | |
| 2094 | − if (ret < 0) | |
| 2095 | − dev_err(dev, "module(%s) probe failed\n", module->name); | |
| 2096 | − } | |
| 2097 | − mutex_unlock(&netcp_modules_lock); | |
| 2098 | 2094 | return 0; |
| 2099 | 2095 | |
| 2100 | 2096 | probe_quit_interface: |
| @@ -77,6 +77,7 @@ · 76 unmodified lines | ||
| 77 | 77 | #define GBENU_ALE_OFFSET 0x1e000 |
| 78 | 78 | #define GBENU_HOST_PORT_NUM 0 |
| 79 | 79 | #define GBENU_NUM_ALE_ENTRIES 1024 |
| 80 | +#define GBENU_SGMII_MODULE_SIZE 0x100 | |
| 80 | 81 | |
| 81 | 82 | /* 10G Ethernet SS defines */ |
| 82 | 83 | #define XGBE_MODULE_NAME "netcp-xgbe" |
| @@ -149,8 +150,8 @@ · 66 unmodified lines | ||
| 149 | 150 | #define XGBE_STATS2_MODULE 2 |
| 150 | 151 | |
| 151 | 152 | /* s: 0-based slave_port */ |
| 152 | −#define SGMII_BASE(s) \ | |
| 153 | − (((s) < 2) ? gbe_dev->sgmii_port_regs : gbe_dev->sgmii_port34_regs) | |
| 153 | +#define SGMII_BASE(d, s) \ | |
| 154 | + (((s) < 2) ? (d)->sgmii_port_regs : (d)->sgmii_port34_regs) | |
| 154 | 155 | |
| 155 | 156 | #define GBE_TX_QUEUE 648 |
| 156 | 157 | #define GBE_TXHOOK_ORDER 0 |
| @@ -1997,13 +1998,8 @@ static void netcp_ethss_update_link_state(struct gbe_priv *gbe_dev, · 1840 unmodified lines | ||
| 1997 | 1998 | return; |
| 1998 | 1999 | |
| 1999 | 2000 | if (!SLAVE_LINK_IS_XGMII(slave)) { |
| 2000 | − if (gbe_dev->ss_version == GBE_SS_VERSION_14) | |
| 2001 | − sgmii_link_state = | |
| 2002 | − netcp_sgmii_get_port_link(SGMII_BASE(sp), sp); | |
| 2003 | − else | |
| 2004 | − sgmii_link_state = | |
| 2005 | − netcp_sgmii_get_port_link( | |
| 2006 | − gbe_dev->sgmii_port_regs, sp); | |
| 2001 | + sgmii_link_state = | |
| 2002 | + netcp_sgmii_get_port_link(SGMII_BASE(gbe_dev, sp), sp); | |
| 2007 | 2003 | } |
| 2008 | 2004 | |
| 2009 | 2005 | phy_link_state = gbe_phy_link_status(slave); |
| @@ -2100,17 +2096,11 @@ static void gbe_port_config(struct gbe_priv *gbe_dev, struct gbe_slave *slave, · 90 unmodified lines | ||
| 2100 | 2096 | static void gbe_sgmii_rtreset(struct gbe_priv *priv, |
| 2101 | 2097 | struct gbe_slave *slave, bool set) |
| 2102 | 2098 | { |
| 2103 | − void __iomem *sgmii_port_regs; | |
| 2104 | − | |
| 2105 | 2099 | if (SLAVE_LINK_IS_XGMII(slave)) |
| 2106 | 2100 | return; |
| 2107 | 2101 | |
| 2108 | − if ((priv->ss_version == GBE_SS_VERSION_14) && (slave->slave_num >= 2)) | |
| 2109 | − sgmii_port_regs = priv->sgmii_port34_regs; | |
| 2110 | − else | |
| 2111 | − sgmii_port_regs = priv->sgmii_port_regs; | |
| 2112 | − | |
| 2113 | − netcp_sgmii_rtreset(sgmii_port_regs, slave->slave_num, set); | |
| 2102 | + netcp_sgmii_rtreset(SGMII_BASE(priv, slave->slave_num), | |
| 2103 | + slave->slave_num, set); | |
| 2114 | 2104 | } |
| 2115 | 2105 | |
| 2116 | 2106 | static void gbe_slave_stop(struct gbe_intf *intf) |
| @@ -2136,17 +2126,12 @@ static void gbe_slave_stop(struct gbe_intf *intf) · 19 unmodified lines | ||
| 2136 | 2126 | |
| 2137 | 2127 | static void gbe_sgmii_config(struct gbe_priv *priv, struct gbe_slave *slave) |
| 2138 | 2128 | { |
| 2139 | − void __iomem *sgmii_port_regs; | |
| 2140 | − | |
| 2141 | − sgmii_port_regs = priv->sgmii_port_regs; | |
| 2142 | − if ((priv->ss_version == GBE_SS_VERSION_14) && (slave->slave_num >= 2)) | |
| 2143 | − sgmii_port_regs = priv->sgmii_port34_regs; | |
| 2129 | + if (SLAVE_LINK_IS_XGMII(slave)) | |
| 2130 | + return; | |
| 2144 | 2131 | |
| 2145 | − if (!SLAVE_LINK_IS_XGMII(slave)) { | |
| 2146 | − netcp_sgmii_reset(sgmii_port_regs, slave->slave_num); | |
| 2147 | − netcp_sgmii_config(sgmii_port_regs, slave->slave_num, | |
| 2148 | − slave->link_interface); | |
| 2149 | − } | |
| 2132 | + netcp_sgmii_reset(SGMII_BASE(priv, slave->slave_num), slave->slave_num); | |
| 2133 | + netcp_sgmii_config(SGMII_BASE(priv, slave->slave_num), slave->slave_num, | |
| 2134 | + slave->link_interface); | |
| 2150 | 2135 | } |
| 2151 | 2136 | |
| 2152 | 2137 | static int gbe_slave_open(struct gbe_intf *gbe_intf) |
| @@ -2997,6 +2982,14 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev, · 844 unmodified lines | ||
| 2997 | 2982 | gbe_dev->switch_regs = regs; |
| 2998 | 2983 | |
| 2999 | 2984 | gbe_dev->sgmii_port_regs = gbe_dev->ss_regs + GBENU_SGMII_MODULE_OFFSET; |
| 2985 | + | |
| 2986 | + /* Although sgmii modules are mem mapped to one contiguous | |
| 2987 | + * region on GBENU devices, setting sgmii_port34_regs allows | |
| 2988 | + * consistent code when accessing sgmii api | |
| 2989 | + */ | |
| 2990 | + gbe_dev->sgmii_port34_regs = gbe_dev->sgmii_port_regs + | |
| 2991 | + (2 * GBENU_SGMII_MODULE_SIZE); | |
| 2992 | + | |
| 3000 | 2993 | gbe_dev->host_port_regs = gbe_dev->switch_regs + GBENU_HOST_PORT_OFFSET; |
| 3001 | 2994 | |
| 3002 | 2995 | for (i = 0; i < (gbe_dev->max_num_ports); i++) |
| @@ -17,7 +17,7 @@ if NET_VENDOR_VIA · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | config VIA_RHINE |
| 19 | 19 | tristate "VIA Rhine support" |
| 20 | − depends on (PCI || OF_IRQ) | |
| 20 | + depends on PCI || (OF_IRQ && GENERIC_PCI_IOMAP) | |
| 21 | 21 | depends on HAS_DMA |
| 22 | 22 | select CRC32 |
| 23 | 23 | select MII |
| @@ -828,6 +828,8 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev) · 827 unmodified lines | ||
| 828 | 828 | if (!phydev) |
| 829 | 829 | dev_info(dev, |
| 830 | 830 | "MDIO of the phy is not registered yet\n"); |
| 831 | + else | |
| 832 | + put_device(&phydev->dev); | |
| 831 | 833 | return 0; |
| 832 | 834 | } |
| 833 | 835 | |
| @@ -1011,11 +1011,11 @@ static void fjes_hw_update_zone_task(struct work_struct *work) · 1010 unmodified lines | ||
| 1011 | 1011 | set_bit(epidx, &irq_bit); |
| 1012 | 1012 | break; |
| 1013 | 1013 | } |
| 1014 | − } | |
| 1015 | − | |
| 1016 | − hw->ep_shm_info[epidx].es_status = info[epidx].es_status; | |
| 1017 | − hw->ep_shm_info[epidx].zone = info[epidx].zone; | |
| 1018 | 1014 | |
| 1015 | + hw->ep_shm_info[epidx].es_status = | |
| 1016 | + info[epidx].es_status; | |
| 1017 | + hw->ep_shm_info[epidx].zone = info[epidx].zone; | |
| 1018 | + } | |
| 1019 | 1019 | break; |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| @@ -126,6 +126,8 @@ static void geneve_rx(struct geneve_sock *gs, struct sk_buff *skb) · 125 unmodified lines | ||
| 126 | 126 | __be32 addr; |
| 127 | 127 | int err; |
| 128 | 128 | |
| 129 | + iph = ip_hdr(skb); /* outer IP header... */ | |
| 130 | + | |
| 129 | 131 | if (gs->collect_md) { |
| 130 | 132 | static u8 zero_vni[3]; |
| 131 | 133 | |
| @@ -133,7 +135,6 @@ static void geneve_rx(struct geneve_sock *gs, struct sk_buff *skb) · 1 unmodified line | ||
| 133 | 135 | addr = 0; |
| 134 | 136 | } else { |
| 135 | 137 | vni = gnvh->vni; |
| 136 | − iph = ip_hdr(skb); /* Still outer IP header... */ | |
| 137 | 138 | addr = iph->saddr; |
| 138 | 139 | } |
| 139 | 140 | |
| @@ -178,7 +179,6 @@ static void geneve_rx(struct geneve_sock *gs, struct sk_buff *skb) · 38 unmodified lines | ||
| 178 | 179 | |
| 179 | 180 | skb_reset_network_header(skb); |
| 180 | 181 | |
| 181 | − iph = ip_hdr(skb); /* Now inner IP header... */ | |
| 182 | 182 | err = IP_ECN_decapsulate(iph, skb); |
| 183 | 183 | |
| 184 | 184 | if (unlikely(err)) { |
| @@ -626,6 +626,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) · 441 unmodified lines | ||
| 626 | 626 | struct geneve_sock *gs = geneve->sock; |
| 627 | 627 | struct ip_tunnel_info *info = NULL; |
| 628 | 628 | struct rtable *rt = NULL; |
| 629 | + const struct iphdr *iip; /* interior IP header */ | |
| 629 | 630 | struct flowi4 fl4; |
| 630 | 631 | __u8 tos, ttl; |
| 631 | 632 | __be16 sport; |
| @@ -653,6 +654,8 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) · 21 unmodified lines | ||
| 653 | 654 | sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); |
| 654 | 655 | skb_reset_mac_header(skb); |
| 655 | 656 | |
| 657 | + iip = ip_hdr(skb); | |
| 658 | + | |
| 656 | 659 | if (info) { |
| 657 | 660 | const struct ip_tunnel_key *key = &info->key; |
| 658 | 661 | u8 *opts = NULL; |
| @@ -668,19 +671,16 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) · 9 unmodified lines | ||
| 668 | 671 | if (unlikely(err)) |
| 669 | 672 | goto err; |
| 670 | 673 | |
| 671 | − tos = key->tos; | |
| 674 | + tos = ip_tunnel_ecn_encap(key->tos, iip, skb); | |
| 672 | 675 | ttl = key->ttl; |
| 673 | 676 | df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; |
| 674 | 677 | } else { |
| 675 | − const struct iphdr *iip; /* interior IP header */ | |
| 676 | − | |
| 677 | 678 | udp_csum = false; |
| 678 | 679 | err = geneve_build_skb(rt, skb, 0, geneve->vni, |
| 679 | 680 | 0, NULL, udp_csum); |
| 680 | 681 | if (unlikely(err)) |
| 681 | 682 | goto err; |
| 682 | 683 | |
| 683 | − iip = ip_hdr(skb); | |
| 684 | 684 | tos = ip_tunnel_ecn_encap(fl4.flowi4_tos, iip, skb); |
| 685 | 685 | ttl = geneve->ttl; |
| 686 | 686 | if (!ttl && IN_MULTICAST(ntohl(fl4.daddr))) |
| @@ -748,12 +748,8 @@ static void geneve_setup(struct net_device *dev) · 61 unmodified lines | ||
| 748 | 748 | dev->features |= NETIF_F_RXCSUM; |
| 749 | 749 | dev->features |= NETIF_F_GSO_SOFTWARE; |
| 750 | 750 | |
| 751 | − dev->vlan_features = dev->features; | |
| 752 | − dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; | |
| 753 | − | |
| 754 | 751 | dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; |
| 755 | 752 | dev->hw_features |= NETIF_F_GSO_SOFTWARE; |
| 756 | − dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; | |
| 757 | 753 | |
| 758 | 754 | netif_keep_dst(dev); |
| 759 | 755 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; |
| @@ -819,7 +815,7 @@ static struct geneve_dev *geneve_find_dev(struct geneve_net *gn, · 59 unmodified lines | ||
| 819 | 815 | |
| 820 | 816 | static int geneve_configure(struct net *net, struct net_device *dev, |
| 821 | 817 | __be32 rem_addr, __u32 vni, __u8 ttl, __u8 tos, |
| 822 | − __u16 dst_port, bool metadata) | |
| 818 | + __be16 dst_port, bool metadata) | |
| 823 | 819 | { |
| 824 | 820 | struct geneve_net *gn = net_generic(net, geneve_net_id); |
| 825 | 821 | struct geneve_dev *t, *geneve = netdev_priv(dev); |
| @@ -844,10 +840,10 @@ static int geneve_configure(struct net *net, struct net_device *dev, · 18 unmodified lines | ||
| 844 | 840 | |
| 845 | 841 | geneve->ttl = ttl; |
| 846 | 842 | geneve->tos = tos; |
| 847 | − geneve->dst_port = htons(dst_port); | |
| 843 | + geneve->dst_port = dst_port; | |
| 848 | 844 | geneve->collect_md = metadata; |
| 849 | 845 | |
| 850 | − t = geneve_find_dev(gn, htons(dst_port), rem_addr, geneve->vni, | |
| 846 | + t = geneve_find_dev(gn, dst_port, rem_addr, geneve->vni, | |
| 851 | 847 | &tun_on_same_port, &tun_collect_md); |
| 852 | 848 | if (t) |
| 853 | 849 | return -EBUSY; |
| @@ -871,7 +867,7 @@ static int geneve_configure(struct net *net, struct net_device *dev, · 17 unmodified lines | ||
| 871 | 867 | static int geneve_newlink(struct net *net, struct net_device *dev, |
| 872 | 868 | struct nlattr *tb[], struct nlattr *data[]) |
| 873 | 869 | { |
| 874 | − __u16 dst_port = GENEVE_UDP_PORT; | |
| 870 | + __be16 dst_port = htons(GENEVE_UDP_PORT); | |
| 875 | 871 | __u8 ttl = 0, tos = 0; |
| 876 | 872 | bool metadata = false; |
| 877 | 873 | __be32 rem_addr; |
| @@ -890,7 +886,7 @@ static int geneve_newlink(struct net *net, struct net_device *dev, · 12 unmodified lines | ||
| 890 | 886 | tos = nla_get_u8(data[IFLA_GENEVE_TOS]); |
| 891 | 887 | |
| 892 | 888 | if (data[IFLA_GENEVE_PORT]) |
| 893 | − dst_port = nla_get_u16(data[IFLA_GENEVE_PORT]); | |
| 889 | + dst_port = nla_get_be16(data[IFLA_GENEVE_PORT]); | |
| 894 | 890 | |
| 895 | 891 | if (data[IFLA_GENEVE_COLLECT_METADATA]) |
| 896 | 892 | metadata = true; |
| @@ -913,7 +909,7 @@ static size_t geneve_get_size(const struct net_device *dev) · 16 unmodified lines | ||
| 913 | 909 | nla_total_size(sizeof(struct in_addr)) + /* IFLA_GENEVE_REMOTE */ |
| 914 | 910 | nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TTL */ |
| 915 | 911 | nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TOS */ |
| 916 | − nla_total_size(sizeof(__u16)) + /* IFLA_GENEVE_PORT */ | |
| 912 | + nla_total_size(sizeof(__be16)) + /* IFLA_GENEVE_PORT */ | |
| 917 | 913 | nla_total_size(0) + /* IFLA_GENEVE_COLLECT_METADATA */ |
| 918 | 914 | 0; |
| 919 | 915 | } |
| @@ -935,7 +931,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev) · 15 unmodified lines | ||
| 935 | 931 | nla_put_u8(skb, IFLA_GENEVE_TOS, geneve->tos)) |
| 936 | 932 | goto nla_put_failure; |
| 937 | 933 | |
| 938 | − if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port))) | |
| 934 | + if (nla_put_be16(skb, IFLA_GENEVE_PORT, geneve->dst_port)) | |
| 939 | 935 | goto nla_put_failure; |
| 940 | 936 | |
| 941 | 937 | if (geneve->collect_md) { |
| @@ -975,7 +971,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, · 33 unmodified lines | ||
| 975 | 971 | if (IS_ERR(dev)) |
| 976 | 972 | return dev; |
| 977 | 973 | |
| 978 | − err = geneve_configure(net, dev, 0, 0, 0, 0, dst_port, true); | |
| 974 | + err = geneve_configure(net, dev, 0, 0, 0, 0, htons(dst_port), true); | |
| 979 | 975 | if (err) { |
| 980 | 976 | free_netdev(dev); |
| 981 | 977 | return ERR_PTR(err); |
| @@ -1031,7 +1031,6 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud) · 1030 unmodified lines | ||
| 1031 | 1031 | static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed) |
| 1032 | 1032 | { |
| 1033 | 1033 | struct ali_ircc_cb *self = priv; |
| 1034 | − unsigned long flags; | |
| 1035 | 1034 | int iobase; |
| 1036 | 1035 | int fcr; /* FIFO control reg */ |
| 1037 | 1036 | int lcr; /* Line control reg */ |
| @@ -1061,8 +1060,6 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed) · 23 unmodified lines | ||
| 1061 | 1060 | /* Update accounting for new speed */ |
| 1062 | 1061 | self->io.speed = speed; |
| 1063 | 1062 | |
| 1064 | − spin_lock_irqsave(&self->lock, flags); | |
| 1065 | − | |
| 1066 | 1063 | divisor = 115200/speed; |
| 1067 | 1064 | |
| 1068 | 1065 | fcr = UART_FCR_ENABLE_FIFO; |
| @@ -1089,9 +1086,6 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed) · 20 unmodified lines | ||
| 1089 | 1086 | /* without this, the connection will be broken after come back from FIR speed, |
| 1090 | 1087 | but with this, the SIR connection is harder to established */ |
| 1091 | 1088 | outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR); |
| 1092 | − | |
| 1093 | − spin_unlock_irqrestore(&self->lock, flags); | |
| 1094 | − | |
| 1095 | 1089 | } |
| 1096 | 1090 | |
| 1097 | 1091 | static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed) |
| @@ -1111,10 +1111,10 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, · 1110 unmodified lines | ||
| 1111 | 1111 | return 0; |
| 1112 | 1112 | |
| 1113 | 1113 | case TUNSETSNDBUF: |
| 1114 | − if (get_user(u, up)) | |
| 1114 | + if (get_user(s, sp)) | |
| 1115 | 1115 | return -EFAULT; |
| 1116 | 1116 | |
| 1117 | − q->sk.sk_sndbuf = u; | |
| 1117 | + q->sk.sk_sndbuf = s; | |
| 1118 | 1118 | return 0; |
| 1119 | 1119 | |
| 1120 | 1120 | case TUNGETVNETHDRSZ: |
| @@ -220,7 +220,7 @@ int fixed_phy_update_state(struct phy_device *phydev, · 219 unmodified lines | ||
| 220 | 220 | struct fixed_mdio_bus *fmb = &platform_fmb; |
| 221 | 221 | struct fixed_phy *fp; |
| 222 | 222 | |
| 223 | − if (!phydev || !phydev->bus) | |
| 223 | + if (!phydev || phydev->bus != fmb->mii_bus) | |
| 224 | 224 | return -EINVAL; |
| 225 | 225 | |
| 226 | 226 | list_for_each_entry(fp, &fmb->phys, node) { |
| @@ -785,6 +785,7 @@ static int marvell_read_status(struct phy_device *phydev) · 784 unmodified lines | ||
| 785 | 785 | int adv; |
| 786 | 786 | int err; |
| 787 | 787 | int lpa; |
| 788 | + int lpagb; | |
| 788 | 789 | int status = 0; |
| 789 | 790 | |
| 790 | 791 | /* Update the link, but return if there |
| @@ -802,10 +803,17 @@ static int marvell_read_status(struct phy_device *phydev) · 11 unmodified lines | ||
| 802 | 803 | if (lpa < 0) |
| 803 | 804 | return lpa; |
| 804 | 805 | |
| 806 | + lpagb = phy_read(phydev, MII_STAT1000); | |
| 807 | + if (lpagb < 0) | |
| 808 | + return lpagb; | |
| 809 | + | |
| 805 | 810 | adv = phy_read(phydev, MII_ADVERTISE); |
| 806 | 811 | if (adv < 0) |
| 807 | 812 | return adv; |
| 808 | 813 | |
| 814 | + phydev->lp_advertising = mii_stat1000_to_ethtool_lpa_t(lpagb) | | |
| 815 | + mii_lpa_to_ethtool_lpa_t(lpa); | |
| 816 | + | |
| 809 | 817 | lpa &= adv; |
| 810 | 818 | |
| 811 | 819 | if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) |
| @@ -853,6 +861,7 @@ static int marvell_read_status(struct phy_device *phydev) · 41 unmodified lines | ||
| 853 | 861 | phydev->speed = SPEED_10; |
| 854 | 862 | |
| 855 | 863 | phydev->pause = phydev->asym_pause = 0; |
| 864 | + phydev->lp_advertising = 0; | |
| 856 | 865 | } |
| 857 | 866 | |
| 858 | 867 | return 0; |
| @@ -244,6 +244,7 @@ static const struct of_device_id unimac_mdio_ids[] = { · 243 unmodified lines | ||
| 244 | 244 | { .compatible = "brcm,unimac-mdio", }, |
| 245 | 245 | { /* sentinel */ }, |
| 246 | 246 | }; |
| 247 | +MODULE_DEVICE_TABLE(of, unimac_mdio_ids); | |
| 247 | 248 | |
| 248 | 249 | static struct platform_driver unimac_mdio_driver = { |
| 249 | 250 | .driver = { |
| @@ -261,6 +261,7 @@ static const struct of_device_id mdio_gpio_of_match[] = { · 260 unmodified lines | ||
| 261 | 261 | { .compatible = "virtual,mdio-gpio", }, |
| 262 | 262 | { /* sentinel */ } |
| 263 | 263 | }; |
| 264 | +MODULE_DEVICE_TABLE(of, mdio_gpio_of_match); | |
| 264 | 265 | |
| 265 | 266 | static struct platform_driver mdio_gpio_driver = { |
| 266 | 267 | .probe = mdio_gpio_probe, |
| @@ -113,18 +113,18 @@ int mdio_mux_init(struct device *dev, · 112 unmodified lines | ||
| 113 | 113 | if (!parent_bus_node) |
| 114 | 114 | return -ENODEV; |
| 115 | 115 | |
| 116 | − parent_bus = of_mdio_find_bus(parent_bus_node); | |
| 117 | − if (parent_bus == NULL) { | |
| 118 | − ret_val = -EPROBE_DEFER; | |
| 119 | − goto err_parent_bus; | |
| 120 | − } | |
| 121 | − | |
| 122 | 116 | pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); |
| 123 | 117 | if (pb == NULL) { |
| 124 | 118 | ret_val = -ENOMEM; |
| 125 | 119 | goto err_parent_bus; |
| 126 | 120 | } |
| 127 | 121 | |
| 122 | + parent_bus = of_mdio_find_bus(parent_bus_node); | |
| 123 | + if (parent_bus == NULL) { | |
| 124 | + ret_val = -EPROBE_DEFER; | |
| 125 | + goto err_parent_bus; | |
| 126 | + } | |
| 127 | + | |
| 128 | 128 | pb->switch_data = data; |
| 129 | 129 | pb->switch_fn = switch_fn; |
| 130 | 130 | pb->current_child = -1; |
| @@ -173,6 +173,10 @@ int mdio_mux_init(struct device *dev, · 42 unmodified lines | ||
| 173 | 173 | dev_info(dev, "Version " DRV_VERSION "\n"); |
| 174 | 174 | return 0; |
| 175 | 175 | } |
| 176 | + | |
| 177 | + /* balance the reference of_mdio_find_bus() took */ | |
| 178 | + put_device(&pb->mii_bus->dev); | |
| 179 | + | |
| 176 | 180 | err_parent_bus: |
| 177 | 181 | of_node_put(parent_bus_node); |
| 178 | 182 | return ret_val; |
| @@ -189,6 +193,9 @@ void mdio_mux_uninit(void *mux_handle) · 10 unmodified lines | ||
| 189 | 193 | mdiobus_free(cb->mii_bus); |
| 190 | 194 | cb = cb->next; |
| 191 | 195 | } |
| 196 | + | |
| 197 | + /* balance the reference of_mdio_find_bus() in mdio_mux_init() took */ | |
| 198 | + put_device(&pb->mii_bus->dev); | |
| 192 | 199 | } |
| 193 | 200 | EXPORT_SYMBOL_GPL(mdio_mux_uninit); |
| 194 | 201 | |
| @@ -167,7 +167,9 @@ static int of_mdio_bus_match(struct device *dev, const void *mdio_bus_np) · 166 unmodified lines | ||
| 167 | 167 | * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. |
| 168 | 168 | * @mdio_bus_np: Pointer to the mii_bus. |
| 169 | 169 | * |
| 170 | − * Returns a pointer to the mii_bus, or NULL if none found. | |
| 170 | + * Returns a reference to the mii_bus, or NULL if none found. The | |
| 171 | + * embedded struct device will have its reference count incremented, | |
| 172 | + * and this must be put once the bus is finished with. | |
| 171 | 173 | * |
| 172 | 174 | * Because the association of a device_node and mii_bus is made via |
| 173 | 175 | * of_mdiobus_register(), the mii_bus cannot be found before it is |
| @@ -234,15 +236,18 @@ static inline void of_mdiobus_link_phydev(struct mii_bus *mdio, · 60 unmodified lines | ||
| 234 | 236 | #endif |
| 235 | 237 | |
| 236 | 238 | /** |
| 237 | − * mdiobus_register - bring up all the PHYs on a given bus and attach them to bus | |
| 239 | + * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus | |
| 238 | 240 | * @bus: target mii_bus |
| 241 | + * @owner: module containing bus accessor functions | |
| 239 | 242 | * |
| 240 | 243 | * Description: Called by a bus driver to bring up all the PHYs |
| 241 | − * on a given bus, and attach them to the bus. | |
| 244 | + * on a given bus, and attach them to the bus. Drivers should use | |
| 245 | + * mdiobus_register() rather than __mdiobus_register() unless they | |
| 246 | + * need to pass a specific owner module. | |
| 242 | 247 | * |
| 243 | 248 | * Returns 0 on success or < 0 on error. |
| 244 | 249 | */ |
| 245 | −int mdiobus_register(struct mii_bus *bus) | |
| 250 | +int __mdiobus_register(struct mii_bus *bus, struct module *owner) | |
| 246 | 251 | { |
| 247 | 252 | int i, err; |
| 248 | 253 | |
| @@ -253,6 +258,7 @@ int mdiobus_register(struct mii_bus *bus) · 4 unmodified lines | ||
| 253 | 258 | BUG_ON(bus->state != MDIOBUS_ALLOCATED && |
| 254 | 259 | bus->state != MDIOBUS_UNREGISTERED); |
| 255 | 260 | |
| 261 | + bus->owner = owner; | |
| 256 | 262 | bus->dev.parent = bus->parent; |
| 257 | 263 | bus->dev.class = &mdio_bus_class; |
| 258 | 264 | bus->dev.groups = NULL; |
| @@ -288,13 +294,16 @@ int mdiobus_register(struct mii_bus *bus) · 29 unmodified lines | ||
| 288 | 294 | |
| 289 | 295 | error: |
| 290 | 296 | while (--i >= 0) { |
| 291 | − if (bus->phy_map[i]) | |
| 292 | − device_unregister(&bus->phy_map[i]->dev); | |
| 297 | + struct phy_device *phydev = bus->phy_map[i]; | |
| 298 | + if (phydev) { | |
| 299 | + phy_device_remove(phydev); | |
| 300 | + phy_device_free(phydev); | |
| 301 | + } | |
| 293 | 302 | } |
| 294 | 303 | device_del(&bus->dev); |
| 295 | 304 | return err; |
| 296 | 305 | } |
| 297 | −EXPORT_SYMBOL(mdiobus_register); | |
| 306 | +EXPORT_SYMBOL(__mdiobus_register); | |
| 298 | 307 | |
| 299 | 308 | void mdiobus_unregister(struct mii_bus *bus) |
| 300 | 309 | { |
| @@ -304,9 +313,11 @@ void mdiobus_unregister(struct mii_bus *bus) · 3 unmodified lines | ||
| 304 | 313 | bus->state = MDIOBUS_UNREGISTERED; |
| 305 | 314 | |
| 306 | 315 | for (i = 0; i < PHY_MAX_ADDR; i++) { |
| 307 | − if (bus->phy_map[i]) | |
| 308 | − device_unregister(&bus->phy_map[i]->dev); | |
| 309 | − bus->phy_map[i] = NULL; | |
| 316 | + struct phy_device *phydev = bus->phy_map[i]; | |
| 317 | + if (phydev) { | |
| 318 | + phy_device_remove(phydev); | |
| 319 | + phy_device_free(phydev); | |
| 320 | + } | |
| 310 | 321 | } |
| 311 | 322 | device_del(&bus->dev); |
| 312 | 323 | } |
| @@ -383,6 +383,24 @@ int phy_device_register(struct phy_device *phydev) · 382 unmodified lines | ||
| 383 | 383 | } |
| 384 | 384 | EXPORT_SYMBOL(phy_device_register); |
| 385 | 385 | |
| 386 | +/** | |
| 387 | + * phy_device_remove - Remove a previously registered phy device from the MDIO bus | |
| 388 | + * @phydev: phy_device structure to remove | |
| 389 | + * | |
| 390 | + * This doesn't free the phy_device itself, it merely reverses the effects | |
| 391 | + * of phy_device_register(). Use phy_device_free() to free the device | |
| 392 | + * after calling this function. | |
| 393 | + */ | |
| 394 | +void phy_device_remove(struct phy_device *phydev) | |
| 395 | +{ | |
| 396 | + struct mii_bus *bus = phydev->bus; | |
| 397 | + int addr = phydev->addr; | |
| 398 | + | |
| 399 | + device_del(&phydev->dev); | |
| 400 | + bus->phy_map[addr] = NULL; | |
| 401 | +} | |
| 402 | +EXPORT_SYMBOL(phy_device_remove); | |
| 403 | + | |
| 386 | 404 | /** |
| 387 | 405 | * phy_find_first - finds the first PHY device on the bus |
| 388 | 406 | * @bus: the target MII bus |
| @@ -578,14 +596,22 @@ EXPORT_SYMBOL(phy_init_hw); · 189 unmodified lines | ||
| 578 | 596 | * generic driver is used. The phy_device is given a ptr to |
| 579 | 597 | * the attaching device, and given a callback for link status |
| 580 | 598 | * change. The phy_device is returned to the attaching driver. |
| 599 | + * This function takes a reference on the phy device. | |
| 581 | 600 | */ |
| 582 | 601 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
| 583 | 602 | u32 flags, phy_interface_t interface) |
| 584 | 603 | { |
| 604 | + struct mii_bus *bus = phydev->bus; | |
| 585 | 605 | struct device *d = &phydev->dev; |
| 586 | − struct module *bus_module; | |
| 587 | 606 | int err; |
| 588 | 607 | |
| 608 | + if (!try_module_get(bus->owner)) { | |
| 609 | + dev_err(&dev->dev, "failed to get the bus module\n"); | |
| 610 | + return -EIO; | |
| 611 | + } | |
| 612 | + | |
| 613 | + get_device(d); | |
| 614 | + | |
| 589 | 615 | /* Assume that if there is no driver, that it doesn't |
| 590 | 616 | * exist, and we should use the genphy driver. |
| 591 | 617 | */ |
| @@ -600,20 +626,13 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 8 unmodified lines | ||
| 600 | 626 | err = device_bind_driver(d); |
| 601 | 627 | |
| 602 | 628 | if (err) |
| 603 | − return err; | |
| 629 | + goto error; | |
| 604 | 630 | } |
| 605 | 631 | |
| 606 | 632 | if (phydev->attached_dev) { |
| 607 | 633 | dev_err(&dev->dev, "PHY already attached\n"); |
| 608 | − return -EBUSY; | |
| 609 | − } | |
| 610 | − | |
| 611 | − /* Increment the bus module reference count */ | |
| 612 | − bus_module = phydev->bus->dev.driver ? | |
| 613 | − phydev->bus->dev.driver->owner : NULL; | |
| 614 | − if (!try_module_get(bus_module)) { | |
| 615 | − dev_err(&dev->dev, "failed to get the bus module\n"); | |
| 616 | − return -EIO; | |
| 634 | + err = -EBUSY; | |
| 635 | + goto error; | |
| 617 | 636 | } |
| 618 | 637 | |
| 619 | 638 | phydev->attached_dev = dev; |
| @@ -636,6 +655,11 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, · 16 unmodified lines | ||
| 636 | 655 | phy_resume(phydev); |
| 637 | 656 | |
| 638 | 657 | return err; |
| 658 | + | |
| 659 | +error: | |
| 660 | + put_device(d); | |
| 661 | + module_put(bus->owner); | |
| 662 | + return err; | |
| 639 | 663 | } |
| 640 | 664 | EXPORT_SYMBOL(phy_attach_direct); |
| 641 | 665 | |
| @@ -677,14 +701,15 @@ EXPORT_SYMBOL(phy_attach); · 35 unmodified lines | ||
| 677 | 701 | /** |
| 678 | 702 | * phy_detach - detach a PHY device from its network device |
| 679 | 703 | * @phydev: target phy_device struct |
| 704 | + * | |
| 705 | + * This detaches the phy device from its network device and the phy | |
| 706 | + * driver, and drops the reference count taken in phy_attach_direct(). | |
| 680 | 707 | */ |
| 681 | 708 | void phy_detach(struct phy_device *phydev) |
| 682 | 709 | { |
| 710 | + struct mii_bus *bus; | |
| 683 | 711 | int i; |
| 684 | 712 | |
| 685 | − if (phydev->bus->dev.driver) | |
| 686 | − module_put(phydev->bus->dev.driver->owner); | |
| 687 | − | |
| 688 | 713 | phydev->attached_dev->phydev = NULL; |
| 689 | 714 | phydev->attached_dev = NULL; |
| 690 | 715 | phy_suspend(phydev); |
| @@ -700,6 +725,15 @@ void phy_detach(struct phy_device *phydev) · 9 unmodified lines | ||
| 700 | 725 | break; |
| 701 | 726 | } |
| 702 | 727 | } |
| 728 | + | |
| 729 | + /* | |
| 730 | + * The phydev might go away on the put_device() below, so avoid | |
| 731 | + * a use-after-free bug by reading the underlying bus first. | |
| 732 | + */ | |
| 733 | + bus = phydev->bus; | |
| 734 | + | |
| 735 | + put_device(&phydev->dev); | |
| 736 | + module_put(bus->owner); | |
| 703 | 737 | } |
| 704 | 738 | EXPORT_SYMBOL(phy_detach); |
| 705 | 739 | |
| @@ -66,7 +66,6 @@ · 65 unmodified lines | ||
| 66 | 66 | #define PHY_ID_VSC8244 0x000fc6c0 |
| 67 | 67 | #define PHY_ID_VSC8514 0x00070670 |
| 68 | 68 | #define PHY_ID_VSC8574 0x000704a0 |
| 69 | −#define PHY_ID_VSC8641 0x00070431 | |
| 70 | 69 | #define PHY_ID_VSC8662 0x00070660 |
| 71 | 70 | #define PHY_ID_VSC8221 0x000fc550 |
| 72 | 71 | #define PHY_ID_VSC8211 0x000fc4b0 |
| @@ -272,18 +271,6 @@ static struct phy_driver vsc82xx_driver[] = { · 199 unmodified lines | ||
| 272 | 271 | .ack_interrupt = &vsc824x_ack_interrupt, |
| 273 | 272 | .config_intr = &vsc82xx_config_intr, |
| 274 | 273 | .driver = { .owner = THIS_MODULE,}, |
| 275 | −}, { | |
| 276 | − .phy_id = PHY_ID_VSC8641, | |
| 277 | − .name = "Vitesse VSC8641", | |
| 278 | − .phy_id_mask = 0x000ffff0, | |
| 279 | − .features = PHY_GBIT_FEATURES, | |
| 280 | − .flags = PHY_HAS_INTERRUPT, | |
| 281 | − .config_init = &vsc824x_config_init, | |
| 282 | − .config_aneg = &vsc82x4_config_aneg, | |
| 283 | − .read_status = &genphy_read_status, | |
| 284 | − .ack_interrupt = &vsc824x_ack_interrupt, | |
| 285 | − .config_intr = &vsc82xx_config_intr, | |
| 286 | − .driver = { .owner = THIS_MODULE,}, | |
| 287 | 274 | }, { |
| 288 | 275 | .phy_id = PHY_ID_VSC8662, |
| 289 | 276 | .name = "Vitesse VSC8662", |
| @@ -331,7 +318,6 @@ static struct mdio_device_id __maybe_unused vitesse_tbl[] = { · 41 unmodified lines | ||
| 331 | 318 | { PHY_ID_VSC8244, 0x000fffc0 }, |
| 332 | 319 | { PHY_ID_VSC8514, 0x000ffff0 }, |
| 333 | 320 | { PHY_ID_VSC8574, 0x000ffff0 }, |
| 334 | − { PHY_ID_VSC8641, 0x000ffff0 }, | |
| 335 | 321 | { PHY_ID_VSC8662, 0x000ffff0 }, |
| 336 | 322 | { PHY_ID_VSC8221, 0x000ffff0 }, |
| 337 | 323 | { PHY_ID_VSC8211, 0x000ffff0 }, |
| @@ -2755,6 +2755,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, · 2754 unmodified lines | ||
| 2755 | 2755 | */ |
| 2756 | 2756 | dev_net_set(dev, net); |
| 2757 | 2757 | |
| 2758 | + rtnl_lock(); | |
| 2758 | 2759 | mutex_lock(&pn->all_ppp_mutex); |
| 2759 | 2760 | |
| 2760 | 2761 | if (unit < 0) { |
| @@ -2785,7 +2786,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, · 24 unmodified lines | ||
| 2785 | 2786 | ppp->file.index = unit; |
| 2786 | 2787 | sprintf(dev->name, "ppp%d", unit); |
| 2787 | 2788 | |
| 2788 | − ret = register_netdev(dev); | |
| 2789 | + ret = register_netdevice(dev); | |
| 2789 | 2790 | if (ret != 0) { |
| 2790 | 2791 | unit_put(&pn->units_idr, unit); |
| 2791 | 2792 | netdev_err(ppp->dev, "PPP: couldn't register device %s (%d)\n", |
| @@ -2797,6 +2798,7 @@ static struct ppp *ppp_create_interface(struct net *net, int unit, · 5 unmodified lines | ||
| 2797 | 2798 | |
| 2798 | 2799 | atomic_inc(&ppp_unit_count); |
| 2799 | 2800 | mutex_unlock(&pn->all_ppp_mutex); |
| 2801 | + rtnl_unlock(); | |
| 2800 | 2802 | |
| 2801 | 2803 | *retp = 0; |
| 2802 | 2804 | return ppp; |
| @@ -583,4 +583,15 @@ config USB_VL600 · 582 unmodified lines | ||
| 583 | 583 | |
| 584 | 584 | http://ubuntuforums.org/showpost.php?p=10589647&postcount=17 |
| 585 | 585 | |
| 586 | +config USB_NET_CH9200 | |
| 587 | + tristate "QingHeng CH9200 USB ethernet support" | |
| 588 | + depends on USB_USBNET | |
| 589 | + select MII | |
| 590 | + help | |
| 591 | + Choose this option if you have a USB ethernet adapter with a QinHeng | |
| 592 | + CH9200 chipset. | |
| 593 | + | |
| 594 | + To compile this driver as a module, choose M here: the | |
| 595 | + module will be called ch9200. | |
| 596 | + | |
| 586 | 597 | endif # USB_NET_DRIVERS |
| @@ -38,4 +38,4 @@ obj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.o · 37 unmodified lines | ||
| 38 | 38 | obj-$(CONFIG_USB_VL600) += lg-vl600.o |
| 39 | 39 | obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o |
| 40 | 40 | obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o |
| 41 | − | |
| 41 | +obj-$(CONFIG_USB_NET_CH9200) += ch9200.o | |
| @@ -0,0 +1,432 @@ | ||
| 1 | +/* | |
| 2 | + * USB 10M/100M ethernet adapter | |
| 3 | + * | |
| 4 | + * This file is licensed under the terms of the GNU General Public License | |
| 5 | + * version 2. This program is licensed "as is" without any warranty of any | |
| 6 | + * kind, whether express or implied | |
| 7 | + * | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#include <linux/kernel.h> | |
| 11 | +#include <linux/module.h> | |
| 12 | +#include <linux/sched.h> | |
| 13 | +#include <linux/stddef.h> | |
| 14 | +#include <linux/init.h> | |
| 15 | +#include <linux/netdevice.h> | |
| 16 | +#include <linux/etherdevice.h> | |
| 17 | +#include <linux/ethtool.h> | |
| 18 | +#include <linux/mii.h> | |
| 19 | +#include <linux/usb.h> | |
| 20 | +#include <linux/crc32.h> | |
| 21 | +#include <linux/usb/usbnet.h> | |
| 22 | +#include <linux/slab.h> | |
| 23 | + | |
| 24 | +#define CH9200_VID 0x1A86 | |
| 25 | +#define CH9200_PID_E092 0xE092 | |
| 26 | + | |
| 27 | +#define CTRL_TIMEOUT_MS 1000 | |
| 28 | + | |
| 29 | +#define CONTROL_TIMEOUT_MS 1000 | |
| 30 | + | |
| 31 | +#define REQUEST_READ 0x0E | |
| 32 | +#define REQUEST_WRITE 0x0F | |
| 33 | + | |
| 34 | +/* Address space: | |
| 35 | + * 00-63 : MII | |
| 36 | + * 64-128: MAC | |
| 37 | + * | |
| 38 | + * Note: all accesses must be 16-bit | |
| 39 | + */ | |
| 40 | + | |
| 41 | +#define MAC_REG_CTRL 64 | |
| 42 | +#define MAC_REG_STATUS 66 | |
| 43 | +#define MAC_REG_INTERRUPT_MASK 68 | |
| 44 | +#define MAC_REG_PHY_COMMAND 70 | |
| 45 | +#define MAC_REG_PHY_DATA 72 | |
| 46 | +#define MAC_REG_STATION_L 74 | |
| 47 | +#define MAC_REG_STATION_M 76 | |
| 48 | +#define MAC_REG_STATION_H 78 | |
| 49 | +#define MAC_REG_HASH_L 80 | |
| 50 | +#define MAC_REG_HASH_M1 82 | |
| 51 | +#define MAC_REG_HASH_M2 84 | |
| 52 | +#define MAC_REG_HASH_H 86 | |
| 53 | +#define MAC_REG_THRESHOLD 88 | |
| 54 | +#define MAC_REG_FIFO_DEPTH 90 | |
| 55 | +#define MAC_REG_PAUSE 92 | |
| 56 | +#define MAC_REG_FLOW_CONTROL 94 | |
| 57 | + | |
| 58 | +/* Control register bits | |
| 59 | + * | |
| 60 | + * Note: bits 13 and 15 are reserved | |
| 61 | + */ | |
| 62 | +#define LOOPBACK (0x01 << 14) | |
| 63 | +#define BASE100X (0x01 << 12) | |
| 64 | +#define MBPS_10 (0x01 << 11) | |
| 65 | +#define DUPLEX_MODE (0x01 << 10) | |
| 66 | +#define PAUSE_FRAME (0x01 << 9) | |
| 67 | +#define PROMISCUOUS (0x01 << 8) | |
| 68 | +#define MULTICAST (0x01 << 7) | |
| 69 | +#define BROADCAST (0x01 << 6) | |
| 70 | +#define HASH (0x01 << 5) | |
| 71 | +#define APPEND_PAD (0x01 << 4) | |
| 72 | +#define APPEND_CRC (0x01 << 3) | |
| 73 | +#define TRANSMITTER_ACTION (0x01 << 2) | |
| 74 | +#define RECEIVER_ACTION (0x01 << 1) | |
| 75 | +#define DMA_ACTION (0x01 << 0) | |
| 76 | + | |
| 77 | +/* Status register bits | |
| 78 | + * | |
| 79 | + * Note: bits 7-15 are reserved | |
| 80 | + */ | |
| 81 | +#define ALIGNMENT (0x01 << 6) | |
| 82 | +#define FIFO_OVER_RUN (0x01 << 5) | |
| 83 | +#define FIFO_UNDER_RUN (0x01 << 4) | |
| 84 | +#define RX_ERROR (0x01 << 3) | |
| 85 | +#define RX_COMPLETE (0x01 << 2) | |
| 86 | +#define TX_ERROR (0x01 << 1) | |
| 87 | +#define TX_COMPLETE (0x01 << 0) | |
| 88 | + | |
| 89 | +/* FIFO depth register bits | |
| 90 | + * | |
| 91 | + * Note: bits 6 and 14 are reserved | |
| 92 | + */ | |
| 93 | + | |
| 94 | +#define ETH_TXBD (0x01 << 15) | |
| 95 | +#define ETN_TX_FIFO_DEPTH (0x01 << 8) | |
| 96 | +#define ETH_RXBD (0x01 << 7) | |
| 97 | +#define ETH_RX_FIFO_DEPTH (0x01 << 0) | |
| 98 | + | |
| 99 | +static int control_read(struct usbnet *dev, | |
| 100 | + unsigned char request, unsigned short value, | |
| 101 | + unsigned short index, void *data, unsigned short size, | |
| 102 | + int timeout) | |
| 103 | +{ | |
| 104 | + unsigned char *buf = NULL; | |
| 105 | + unsigned char request_type; | |
| 106 | + int err = 0; | |
| 107 | + | |
| 108 | + if (request == REQUEST_READ) | |
| 109 | + request_type = (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER); | |
| 110 | + else | |
| 111 | + request_type = (USB_DIR_IN | USB_TYPE_VENDOR | | |
| 112 | + USB_RECIP_DEVICE); | |
| 113 | + | |
| 114 | + netdev_dbg(dev->net, "Control_read() index=0x%02x size=%d\n", | |
| 115 | + index, size); | |
| 116 | + | |
| 117 | + buf = kmalloc(size, GFP_KERNEL); | |
| 118 | + if (!buf) { | |
| 119 | + err = -ENOMEM; | |
| 120 | + goto err_out; | |
| 121 | + } | |
| 122 | + | |
| 123 | + err = usb_control_msg(dev->udev, | |
| 124 | + usb_rcvctrlpipe(dev->udev, 0), | |
| 125 | + request, request_type, value, index, buf, size, | |
| 126 | + timeout); | |
| 127 | + if (err == size) | |
| 128 | + memcpy(data, buf, size); | |
| 129 | + else if (err >= 0) | |
| 130 | + err = -EINVAL; | |
| 131 | + kfree(buf); | |
| 132 | + | |
| 133 | + return err; | |
| 134 | + | |
| 135 | +err_out: | |
| 136 | + return err; | |
| 137 | +} | |
| 138 | + | |
| 139 | +static int control_write(struct usbnet *dev, unsigned char request, | |
| 140 | + unsigned short value, unsigned short index, | |
| 141 | + void *data, unsigned short size, int timeout) | |
| 142 | +{ | |
| 143 | + unsigned char *buf = NULL; | |
| 144 | + unsigned char request_type; | |
| 145 | + int err = 0; | |
| 146 | + | |
| 147 | + if (request == REQUEST_WRITE) | |
| 148 | + request_type = (USB_DIR_OUT | USB_TYPE_VENDOR | | |
| 149 | + USB_RECIP_OTHER); | |
| 150 | + else | |
| 151 | + request_type = (USB_DIR_OUT | USB_TYPE_VENDOR | | |
| 152 | + USB_RECIP_DEVICE); | |
| 153 | + | |
| 154 | + netdev_dbg(dev->net, "Control_write() index=0x%02x size=%d\n", | |
| 155 | + index, size); | |
| 156 | + | |
| 157 | + if (data) { | |
| 158 | + buf = kmalloc(size, GFP_KERNEL); | |
| 159 | + if (!buf) { | |
| 160 | + err = -ENOMEM; | |
| 161 | + goto err_out; | |
| 162 | + } | |
| 163 | + memcpy(buf, data, size); | |
| 164 | + } | |
| 165 | + | |
| 166 | + err = usb_control_msg(dev->udev, | |
| 167 | + usb_sndctrlpipe(dev->udev, 0), | |
| 168 | + request, request_type, value, index, buf, size, | |
| 169 | + timeout); | |
| 170 | + if (err >= 0 && err < size) | |
| 171 | + err = -EINVAL; | |
| 172 | + kfree(buf); | |
| 173 | + | |
| 174 | + return 0; | |
| 175 | + | |
| 176 | +err_out: | |
| 177 | + return err; | |
| 178 | +} | |
| 179 | + | |
| 180 | +static int ch9200_mdio_read(struct net_device *netdev, int phy_id, int loc) | |
| 181 | +{ | |
| 182 | + struct usbnet *dev = netdev_priv(netdev); | |
| 183 | + unsigned char buff[2]; | |
| 184 | + | |
| 185 | + netdev_dbg(netdev, "ch9200_mdio_read phy_id:%02x loc:%02x\n", | |
| 186 | + phy_id, loc); | |
| 187 | + | |
| 188 | + if (phy_id != 0) | |
| 189 | + return -ENODEV; | |
| 190 | + | |
| 191 | + control_read(dev, REQUEST_READ, 0, loc * 2, buff, 0x02, | |
| 192 | + CONTROL_TIMEOUT_MS); | |
| 193 | + | |
| 194 | + return (buff[0] | buff[1] << 8); | |
| 195 | +} | |
| 196 | + | |
| 197 | +static void ch9200_mdio_write(struct net_device *netdev, | |
| 198 | + int phy_id, int loc, int val) | |
| 199 | +{ | |
| 200 | + struct usbnet *dev = netdev_priv(netdev); | |
| 201 | + unsigned char buff[2]; | |
| 202 | + | |
| 203 | + netdev_dbg(netdev, "ch9200_mdio_write() phy_id=%02x loc:%02x\n", | |
| 204 | + phy_id, loc); | |
| 205 | + | |
| 206 | + if (phy_id != 0) | |
| 207 | + return; | |
| 208 | + | |
| 209 | + buff[0] = (unsigned char)val; | |
| 210 | + buff[1] = (unsigned char)(val >> 8); | |
| 211 | + | |
| 212 | + control_write(dev, REQUEST_WRITE, 0, loc * 2, buff, 0x02, | |
| 213 | + CONTROL_TIMEOUT_MS); | |
| 214 | +} | |
| 215 | + | |
| 216 | +static int ch9200_link_reset(struct usbnet *dev) | |
| 217 | +{ | |
| 218 | + struct ethtool_cmd ecmd; | |
| 219 | + | |
| 220 | + mii_check_media(&dev->mii, 1, 1); | |
| 221 | + mii_ethtool_gset(&dev->mii, &ecmd); | |
| 222 | + | |
| 223 | + netdev_dbg(dev->net, "link_reset() speed:%d duplex:%d\n", | |
| 224 | + ecmd.speed, ecmd.duplex); | |
| 225 | + | |
| 226 | + return 0; | |
| 227 | +} | |
| 228 | + | |
| 229 | +static void ch9200_status(struct usbnet *dev, struct urb *urb) | |
| 230 | +{ | |
| 231 | + int link; | |
| 232 | + unsigned char *buf; | |
| 233 | + | |
| 234 | + if (urb->actual_length < 16) | |
| 235 | + return; | |
| 236 | + | |
| 237 | + buf = urb->transfer_buffer; | |
| 238 | + link = !!(buf[0] & 0x01); | |
| 239 | + | |
| 240 | + if (link) { | |
| 241 | + netif_carrier_on(dev->net); | |
| 242 | + usbnet_defer_kevent(dev, EVENT_LINK_RESET); | |
| 243 | + } else { | |
| 244 | + netif_carrier_off(dev->net); | |
| 245 | + } | |
| 246 | +} | |
| 247 | + | |
| 248 | +static struct sk_buff *ch9200_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |
| 249 | + gfp_t flags) | |
| 250 | +{ | |
| 251 | + int i = 0; | |
| 252 | + int len = 0; | |
| 253 | + int tx_overhead = 0; | |
| 254 | + | |
| 255 | + tx_overhead = 0x40; | |
| 256 | + | |
| 257 | + len = skb->len; | |
| 258 | + if (skb_headroom(skb) < tx_overhead) { | |
| 259 | + struct sk_buff *skb2; | |
| 260 | + | |
| 261 | + skb2 = skb_copy_expand(skb, tx_overhead, 0, flags); | |
| 262 | + dev_kfree_skb_any(skb); | |
| 263 | + skb = skb2; | |
| 264 | + if (!skb) | |
| 265 | + return NULL; | |
| 266 | + } | |
| 267 | + | |
| 268 | + __skb_push(skb, tx_overhead); | |
| 269 | + /* usbnet adds padding if length is a multiple of packet size | |
| 270 | + * if so, adjust length value in header | |
| 271 | + */ | |
| 272 | + if ((skb->len % dev->maxpacket) == 0) | |
| 273 | + len++; | |
| 274 | + | |
| 275 | + skb->data[0] = len; | |
| 276 | + skb->data[1] = len >> 8; | |
| 277 | + skb->data[2] = 0x00; | |
| 278 | + skb->data[3] = 0x80; | |
| 279 | + | |
| 280 | + for (i = 4; i < 48; i++) | |
| 281 | + skb->data[i] = 0x00; | |
| 282 | + | |
| 283 | + skb->data[48] = len; | |
| 284 | + skb->data[49] = len >> 8; | |
| 285 | + skb->data[50] = 0x00; | |
| 286 | + skb->data[51] = 0x80; | |
| 287 | + | |
| 288 | + for (i = 52; i < 64; i++) | |
| 289 | + skb->data[i] = 0x00; | |
| 290 | + | |
| 291 | + return skb; | |
| 292 | +} | |
| 293 | + | |
| 294 | +static int ch9200_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |
| 295 | +{ | |
| 296 | + int len = 0; | |
| 297 | + int rx_overhead = 0; | |
| 298 | + | |
| 299 | + rx_overhead = 64; | |
| 300 | + | |
| 301 | + if (unlikely(skb->len < rx_overhead)) { | |
| 302 | + dev_err(&dev->udev->dev, "unexpected tiny rx frame\n"); | |
| 303 | + return 0; | |
| 304 | + } | |
| 305 | + | |
| 306 | + len = (skb->data[skb->len - 16] | skb->data[skb->len - 15] << 8); | |
| 307 | + skb_trim(skb, len); | |
| 308 | + | |
| 309 | + return 1; | |
| 310 | +} | |
| 311 | + | |
| 312 | +static int get_mac_address(struct usbnet *dev, unsigned char *data) | |
| 313 | +{ | |
| 314 | + int err = 0; | |
| 315 | + unsigned char mac_addr[0x06]; | |
| 316 | + int rd_mac_len = 0; | |
| 317 | + | |
| 318 | + netdev_dbg(dev->net, "get_mac_address:\n\tusbnet VID:%0x PID:%0x\n", | |
| 319 | + dev->udev->descriptor.idVendor, | |
| 320 | + dev->udev->descriptor.idProduct); | |
| 321 | + | |
| 322 | + memset(mac_addr, 0, sizeof(mac_addr)); | |
| 323 | + rd_mac_len = control_read(dev, REQUEST_READ, 0, | |
| 324 | + MAC_REG_STATION_L, mac_addr, 0x02, | |
| 325 | + CONTROL_TIMEOUT_MS); | |
| 326 | + rd_mac_len += control_read(dev, REQUEST_READ, 0, MAC_REG_STATION_M, | |
| 327 | + mac_addr + 2, 0x02, CONTROL_TIMEOUT_MS); | |
| 328 | + rd_mac_len += control_read(dev, REQUEST_READ, 0, MAC_REG_STATION_H, | |
| 329 | + mac_addr + 4, 0x02, CONTROL_TIMEOUT_MS); | |
| 330 | + if (rd_mac_len != ETH_ALEN) | |
| 331 | + err = -EINVAL; | |
| 332 | + | |
| 333 | + data[0] = mac_addr[5]; | |
| 334 | + data[1] = mac_addr[4]; | |
| 335 | + data[2] = mac_addr[3]; | |
| 336 | + data[3] = mac_addr[2]; | |
| 337 | + data[4] = mac_addr[1]; | |
| 338 | + data[5] = mac_addr[0]; | |
| 339 | + | |
| 340 | + return err; | |
| 341 | +} | |
| 342 | + | |
| 343 | +static int ch9200_bind(struct usbnet *dev, struct usb_interface *intf) | |
| 344 | +{ | |
| 345 | + int retval = 0; | |
| 346 | + unsigned char data[2]; | |
| 347 | + | |
| 348 | + retval = usbnet_get_endpoints(dev, intf); | |
| 349 | + if (retval) | |
| 350 | + return retval; | |
| 351 | + | |
| 352 | + dev->mii.dev = dev->net; | |
| 353 | + dev->mii.mdio_read = ch9200_mdio_read; | |
| 354 | + dev->mii.mdio_write = ch9200_mdio_write; | |
| 355 | + dev->mii.reg_num_mask = 0x1f; | |
| 356 | + | |
| 357 | + dev->mii.phy_id_mask = 0x1f; | |
| 358 | + | |
| 359 | + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | |
| 360 | + dev->rx_urb_size = 24 * 64 + 16; | |
| 361 | + mii_nway_restart(&dev->mii); | |
| 362 | + | |
| 363 | + data[0] = 0x01; | |
| 364 | + data[1] = 0x0F; | |
| 365 | + retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_THRESHOLD, data, | |
| 366 | + 0x02, CONTROL_TIMEOUT_MS); | |
| 367 | + | |
| 368 | + data[0] = 0xA0; | |
| 369 | + data[1] = 0x90; | |
| 370 | + retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_FIFO_DEPTH, data, | |
| 371 | + 0x02, CONTROL_TIMEOUT_MS); | |
| 372 | + | |
| 373 | + data[0] = 0x30; | |
| 374 | + data[1] = 0x00; | |
| 375 | + retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_PAUSE, data, | |
| 376 | + 0x02, CONTROL_TIMEOUT_MS); | |
| 377 | + | |
| 378 | + data[0] = 0x17; | |
| 379 | + data[1] = 0xD8; | |
| 380 | + retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_FLOW_CONTROL, | |
| 381 | + data, 0x02, CONTROL_TIMEOUT_MS); | |
| 382 | + | |
| 383 | + /* Undocumented register */ | |
| 384 | + data[0] = 0x01; | |
| 385 | + data[1] = 0x00; | |
| 386 | + retval = control_write(dev, REQUEST_WRITE, 0, 254, data, 0x02, | |
| 387 | + CONTROL_TIMEOUT_MS); | |
| 388 | + | |
| 389 | + data[0] = 0x5F; | |
| 390 | + data[1] = 0x0D; | |
| 391 | + retval = control_write(dev, REQUEST_WRITE, 0, MAC_REG_CTRL, data, 0x02, | |
| 392 | + CONTROL_TIMEOUT_MS); | |
| 393 | + | |
| 394 | + retval = get_mac_address(dev, dev->net->dev_addr); | |
| 395 | + | |
| 396 | + return retval; | |
| 397 | +} | |
| 398 | + | |
| 399 | +static const struct driver_info ch9200_info = { | |
| 400 | + .description = "CH9200 USB to Network Adaptor", | |
| 401 | + .flags = FLAG_ETHER, | |
| 402 | + .bind = ch9200_bind, | |
| 403 | + .rx_fixup = ch9200_rx_fixup, | |
| 404 | + .tx_fixup = ch9200_tx_fixup, | |
| 405 | + .status = ch9200_status, | |
| 406 | + .link_reset = ch9200_link_reset, | |
| 407 | + .reset = ch9200_link_reset, | |
| 408 | +}; | |
| 409 | + | |
| 410 | +static const struct usb_device_id ch9200_products[] = { | |
| 411 | + { | |
| 412 | + USB_DEVICE(0x1A86, 0xE092), | |
| 413 | + .driver_info = (unsigned long)&ch9200_info, | |
| 414 | + }, | |
| 415 | + {}, | |
| 416 | +}; | |
| 417 | + | |
| 418 | +MODULE_DEVICE_TABLE(usb, ch9200_products); | |
| 419 | + | |
| 420 | +static struct usb_driver ch9200_driver = { | |
| 421 | + .name = "ch9200", | |
| 422 | + .id_table = ch9200_products, | |
| 423 | + .probe = usbnet_probe, | |
| 424 | + .disconnect = usbnet_disconnect, | |
| 425 | + .suspend = usbnet_suspend, | |
| 426 | + .resume = usbnet_resume, | |
| 427 | +}; | |
| 428 | + | |
| 429 | +module_usb_driver(ch9200_driver); | |
| 430 | + | |
| 431 | +MODULE_DESCRIPTION("QinHeng CH9200 USB Network device"); | |
| 432 | +MODULE_LICENSE("GPL"); | |
| @@ -193,7 +193,8 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb, · 192 unmodified lines | ||
| 193 | 193 | .flowi4_oif = vrf_dev->ifindex, |
| 194 | 194 | .flowi4_iif = LOOPBACK_IFINDEX, |
| 195 | 195 | .flowi4_tos = RT_TOS(ip4h->tos), |
| 196 | − .flowi4_flags = FLOWI_FLAG_ANYSRC | FLOWI_FLAG_VRFSRC, | |
| 196 | + .flowi4_flags = FLOWI_FLAG_ANYSRC | FLOWI_FLAG_VRFSRC | | |
| 197 | + FLOWI_FLAG_SKIP_NH_OIF, | |
| 197 | 198 | .daddr = ip4h->daddr, |
| 198 | 199 | }; |
| 199 | 200 | |
| @@ -2392,10 +2392,6 @@ static void vxlan_setup(struct net_device *dev) · 2391 unmodified lines | ||
| 2392 | 2392 | |
| 2393 | 2393 | eth_hw_addr_random(dev); |
| 2394 | 2394 | ether_setup(dev); |
| 2395 | − if (vxlan->default_dst.remote_ip.sa.sa_family == AF_INET6) | |
| 2396 | − dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM; | |
| 2397 | − else | |
| 2398 | − dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM; | |
| 2399 | 2395 | |
| 2400 | 2396 | dev->netdev_ops = &vxlan_netdev_ops; |
| 2401 | 2397 | dev->destructor = free_netdev; |
| @@ -2640,8 +2636,11 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, · 238 unmodified lines | ||
| 2640 | 2636 | dst->remote_ip.sa.sa_family = AF_INET; |
| 2641 | 2637 | |
| 2642 | 2638 | if (dst->remote_ip.sa.sa_family == AF_INET6 || |
| 2643 | − vxlan->cfg.saddr.sa.sa_family == AF_INET6) | |
| 2639 | + vxlan->cfg.saddr.sa.sa_family == AF_INET6) { | |
| 2640 | + if (!IS_ENABLED(CONFIG_IPV6)) | |
| 2641 | + return -EPFNOSUPPORT; | |
| 2644 | 2642 | use_ipv6 = true; |
| 2643 | + } | |
| 2645 | 2644 | |
| 2646 | 2645 | if (conf->remote_ifindex) { |
| 2647 | 2646 | struct net_device *lowerdev |
| @@ -2670,8 +2669,12 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, · 22 unmodified lines | ||
| 2670 | 2669 | |
| 2671 | 2670 | dev->needed_headroom = lowerdev->hard_header_len + |
| 2672 | 2671 | (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); |
| 2673 | − } else if (use_ipv6) | |
| 2672 | + } else if (use_ipv6) { | |
| 2674 | 2673 | vxlan->flags |= VXLAN_F_IPV6; |
| 2674 | + dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM; | |
| 2675 | + } else { | |
| 2676 | + dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM; | |
| 2677 | + } | |
| 2675 | 2678 | |
| 2676 | 2679 | memcpy(&vxlan->cfg, conf, sizeof(*conf)); |
| 2677 | 2680 | if (!vxlan->cfg.dst_port) |
| @@ -197,7 +197,8 @@ static int of_phy_match(struct device *dev, void *phy_np) · 196 unmodified lines | ||
| 197 | 197 | * of_phy_find_device - Give a PHY node, find the phy_device |
| 198 | 198 | * @phy_np: Pointer to the phy's device tree node |
| 199 | 199 | * |
| 200 | − * Returns a pointer to the phy_device. | |
| 200 | + * If successful, returns a pointer to the phy_device with the embedded | |
| 201 | + * struct device refcount incremented by one, or NULL on failure. | |
| 201 | 202 | */ |
| 202 | 203 | struct phy_device *of_phy_find_device(struct device_node *phy_np) |
| 203 | 204 | { |
| @@ -217,7 +218,9 @@ EXPORT_SYMBOL(of_phy_find_device); · 13 unmodified lines | ||
| 217 | 218 | * @hndlr: Link state callback for the network device |
| 218 | 219 | * @iface: PHY data interface type |
| 219 | 220 | * |
| 220 | − * Returns a pointer to the phy_device if successful. NULL otherwise | |
| 221 | + * If successful, returns a pointer to the phy_device with the embedded | |
| 222 | + * struct device refcount incremented by one, or NULL on failure. The | |
| 223 | + * refcount must be dropped by calling phy_disconnect() or phy_detach(). | |
| 221 | 224 | */ |
| 222 | 225 | struct phy_device *of_phy_connect(struct net_device *dev, |
| 223 | 226 | struct device_node *phy_np, |
| @@ -225,13 +228,19 @@ struct phy_device *of_phy_connect(struct net_device *dev, · 1 unmodified line | ||
| 225 | 228 | phy_interface_t iface) |
| 226 | 229 | { |
| 227 | 230 | struct phy_device *phy = of_phy_find_device(phy_np); |
| 231 | + int ret; | |
| 228 | 232 | |
| 229 | 233 | if (!phy) |
| 230 | 234 | return NULL; |
| 231 | 235 | |
| 232 | 236 | phy->dev_flags = flags; |
| 233 | 237 | |
| 234 | − return phy_connect_direct(dev, phy, hndlr, iface) ? NULL : phy; | |
| 238 | + ret = phy_connect_direct(dev, phy, hndlr, iface); | |
| 239 | + | |
| 240 | + /* refcount is held by phy_connect_direct() on success */ | |
| 241 | + put_device(&phy->dev); | |
| 242 | + | |
| 243 | + return ret ? NULL : phy; | |
| 235 | 244 | } |
| 236 | 245 | EXPORT_SYMBOL(of_phy_connect); |
| 237 | 246 | |
| @@ -241,17 +250,27 @@ EXPORT_SYMBOL(of_phy_connect); · 3 unmodified lines | ||
| 241 | 250 | * @phy_np: Node pointer for the PHY |
| 242 | 251 | * @flags: flags to pass to the PHY |
| 243 | 252 | * @iface: PHY data interface type |
| 253 | + * | |
| 254 | + * If successful, returns a pointer to the phy_device with the embedded | |
| 255 | + * struct device refcount incremented by one, or NULL on failure. The | |
| 256 | + * refcount must be dropped by calling phy_disconnect() or phy_detach(). | |
| 244 | 257 | */ |
| 245 | 258 | struct phy_device *of_phy_attach(struct net_device *dev, |
| 246 | 259 | struct device_node *phy_np, u32 flags, |
| 247 | 260 | phy_interface_t iface) |
| 248 | 261 | { |
| 249 | 262 | struct phy_device *phy = of_phy_find_device(phy_np); |
| 263 | + int ret; | |
| 250 | 264 | |
| 251 | 265 | if (!phy) |
| 252 | 266 | return NULL; |
| 253 | 267 | |
| 254 | − return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy; | |
| 268 | + ret = phy_attach_direct(dev, phy, flags, iface); | |
| 269 | + | |
| 270 | + /* refcount is held by phy_attach_direct() on success */ | |
| 271 | + put_device(&phy->dev); | |
| 272 | + | |
| 273 | + return ret ? NULL : phy; | |
| 255 | 274 | } |
| 256 | 275 | EXPORT_SYMBOL(of_phy_attach); |
| 257 | 276 | |
| @@ -38,8 +38,8 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq · 37 unmodified lines | ||
| 38 | 38 | */ |
| 39 | 39 | rc = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); |
| 40 | 40 | if (rc != 0) |
| 41 | − return rc; | |
| 42 | − /* No pin, exit */ | |
| 41 | + goto err; | |
| 42 | + /* No pin, exit with no error message. */ | |
| 43 | 43 | if (pin == 0) |
| 44 | 44 | return -ENODEV; |
| 45 | 45 | |
| @@ -53,8 +53,10 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq · 7 unmodified lines | ||
| 53 | 53 | ppnode = pci_bus_to_OF_node(pdev->bus); |
| 54 | 54 | |
| 55 | 55 | /* No node for host bridge ? give up */ |
| 56 | − if (ppnode == NULL) | |
| 57 | − return -EINVAL; | |
| 56 | + if (ppnode == NULL) { | |
| 57 | + rc = -EINVAL; | |
| 58 | + goto err; | |
| 59 | + } | |
| 58 | 60 | } else { |
| 59 | 61 | /* We found a P2P bridge, check if it has a node */ |
| 60 | 62 | ppnode = pci_device_to_OF_node(ppdev); |
| @@ -86,7 +88,13 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq · 25 unmodified lines | ||
| 86 | 88 | out_irq->args[0] = pin; |
| 87 | 89 | laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); |
| 88 | 90 | laddr[1] = laddr[2] = cpu_to_be32(0); |
| 89 | − return of_irq_parse_raw(laddr, out_irq); | |
| 91 | + rc = of_irq_parse_raw(laddr, out_irq); | |
| 92 | + if (rc) | |
| 93 | + goto err; | |
| 94 | + return 0; | |
| 95 | +err: | |
| 96 | + dev_err(&pdev->dev, "of_irq_parse_pci() failed with rc=%d\n", rc); | |
| 97 | + return rc; | |
| 90 | 98 | } |
| 91 | 99 | EXPORT_SYMBOL_GPL(of_irq_parse_pci); |
| 92 | 100 | |
| @@ -105,10 +113,8 @@ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) · 12 unmodified lines | ||
| 105 | 113 | int ret; |
| 106 | 114 | |
| 107 | 115 | ret = of_irq_parse_pci(dev, &oirq); |
| 108 | − if (ret) { | |
| 109 | − dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret); | |
| 116 | + if (ret) | |
| 110 | 117 | return 0; /* Proper return code 0 == NO_IRQ */ |
| 111 | − } | |
| 112 | 118 | |
| 113 | 119 | return irq_create_of_mapping(&oirq); |
| 114 | 120 | } |
| @@ -560,6 +560,9 @@ dino_fixup_bus(struct pci_bus *bus) · 559 unmodified lines | ||
| 560 | 560 | } else if (bus->parent) { |
| 561 | 561 | int i; |
| 562 | 562 | |
| 563 | + pci_read_bridge_bases(bus); | |
| 564 | + | |
| 565 | + | |
| 563 | 566 | for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { |
| 564 | 567 | if((bus->self->resource[i].flags & |
| 565 | 568 | (IORESOURCE_IO | IORESOURCE_MEM)) == 0) |
| @@ -693,6 +693,7 @@ lba_fixup_bus(struct pci_bus *bus) · 692 unmodified lines | ||
| 693 | 693 | if (bus->parent) { |
| 694 | 694 | int i; |
| 695 | 695 | /* PCI-PCI Bridge */ |
| 696 | + pci_read_bridge_bases(bus); | |
| 696 | 697 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) |
| 697 | 698 | pci_claim_bridge_resource(bus->self, i); |
| 698 | 699 | } else { |
| @@ -442,7 +442,8 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = { · 441 unmodified lines | ||
| 442 | 442 | static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count, |
| 443 | 443 | void *arg) |
| 444 | 444 | { |
| 445 | − struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | |
| 445 | + struct pci_dev *tdev = pci_get_slot(dev->bus, | |
| 446 | + PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | |
| 446 | 447 | ssize_t ret; |
| 447 | 448 | |
| 448 | 449 | if (!tdev) |
| @@ -456,7 +457,8 @@ static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count, · 7 unmodified lines | ||
| 456 | 457 | static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count, |
| 457 | 458 | const void *arg) |
| 458 | 459 | { |
| 459 | − struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | |
| 460 | + struct pci_dev *tdev = pci_get_slot(dev->bus, | |
| 461 | + PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | |
| 460 | 462 | ssize_t ret; |
| 461 | 463 | |
| 462 | 464 | if (!tdev) |
| @@ -473,22 +475,6 @@ static const struct pci_vpd_ops pci_vpd_f0_ops = { · 10 unmodified lines | ||
| 473 | 475 | .release = pci_vpd_pci22_release, |
| 474 | 476 | }; |
| 475 | 477 | |
| 476 | −static int pci_vpd_f0_dev_check(struct pci_dev *dev) | |
| 477 | −{ | |
| 478 | − struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn)); | |
| 479 | − int ret = 0; | |
| 480 | − | |
| 481 | − if (!tdev) | |
| 482 | − return -ENODEV; | |
| 483 | − if (!tdev->vpd || !tdev->multifunction || | |
| 484 | − dev->class != tdev->class || dev->vendor != tdev->vendor || | |
| 485 | − dev->device != tdev->device) | |
| 486 | − ret = -ENODEV; | |
| 487 | − | |
| 488 | − pci_dev_put(tdev); | |
| 489 | − return ret; | |
| 490 | −} | |
| 491 | − | |
| 492 | 478 | int pci_vpd_pci22_init(struct pci_dev *dev) |
| 493 | 479 | { |
| 494 | 480 | struct pci_vpd_pci22 *vpd; |
| @@ -497,12 +483,7 @@ int pci_vpd_pci22_init(struct pci_dev *dev) · 2 unmodified lines | ||
| 497 | 483 | cap = pci_find_capability(dev, PCI_CAP_ID_VPD); |
| 498 | 484 | if (!cap) |
| 499 | 485 | return -ENODEV; |
| 500 | − if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) { | |
| 501 | − int ret = pci_vpd_f0_dev_check(dev); | |
| 502 | 486 | |
| 503 | − if (ret) | |
| 504 | − return ret; | |
| 505 | − } | |
| 506 | 487 | vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC); |
| 507 | 488 | if (!vpd) |
| 508 | 489 | return -ENOMEM; |
| @@ -256,6 +256,8 @@ bool pci_bus_clip_resource(struct pci_dev *dev, int idx) · 255 unmodified lines | ||
| 256 | 256 | |
| 257 | 257 | res->start = start; |
| 258 | 258 | res->end = end; |
| 259 | + res->flags &= ~IORESOURCE_UNSET; | |
| 260 | + orig_res.flags &= ~IORESOURCE_UNSET; | |
| 259 | 261 | dev_printk(KERN_DEBUG, &dev->dev, "%pR clipped to %pR\n", |
| 260 | 262 | &orig_res, res); |
| 261 | 263 | |
| @@ -362,6 +362,7 @@ static int rcar_pci_probe(struct platform_device *pdev) · 361 unmodified lines | ||
| 362 | 362 | static struct of_device_id rcar_pci_of_match[] = { |
| 363 | 363 | { .compatible = "renesas,pci-r8a7790", }, |
| 364 | 364 | { .compatible = "renesas,pci-r8a7791", }, |
| 365 | + { .compatible = "renesas,pci-r8a7794", }, | |
| 365 | 366 | { }, |
| 366 | 367 | }; |
| 367 | 368 | |
| @@ -299,9 +299,10 @@ static long local_pci_probe(void *_ddi) · 298 unmodified lines | ||
| 299 | 299 | * Unbound PCI devices are always put in D0, regardless of |
| 300 | 300 | * runtime PM status. During probe, the device is set to |
| 301 | 301 | * active and the usage count is incremented. If the driver |
| 302 | − * supports runtime PM, it should call pm_runtime_put_noidle() | |
| 303 | − * in its probe routine and pm_runtime_get_noresume() in its | |
| 304 | − * remove routine. | |
| 302 | + * supports runtime PM, it should call pm_runtime_put_noidle(), | |
| 303 | + * or any other runtime PM helper function decrementing the usage | |
| 304 | + * count, in its probe routine and pm_runtime_get_noresume() in | |
| 305 | + * its remove routine. | |
| 305 | 306 | */ |
| 306 | 307 | pm_runtime_get_sync(dev); |
| 307 | 308 | pci_dev->driver = pci_drv; |
| @@ -676,15 +676,20 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) · 675 unmodified lines | ||
| 676 | 676 | static void pci_set_bus_msi_domain(struct pci_bus *bus) |
| 677 | 677 | { |
| 678 | 678 | struct irq_domain *d; |
| 679 | + struct pci_bus *b; | |
| 679 | 680 | |
| 680 | 681 | /* |
| 681 | − * Either bus is the root, and we must obtain it from the | |
| 682 | − * firmware, or we inherit it from the bridge device. | |
| 682 | + * The bus can be a root bus, a subordinate bus, or a virtual bus | |
| 683 | + * created by an SR-IOV device. Walk up to the first bridge device | |
| 684 | + * found or derive the domain from the host bridge. | |
| 683 | 685 | */ |
| 684 | − if (pci_is_root_bus(bus)) | |
| 685 | − d = pci_host_bridge_msi_domain(bus); | |
| 686 | − else | |
| 687 | − d = dev_get_msi_domain(&bus->self->dev); | |
| 686 | + for (b = bus, d = NULL; !d && !pci_is_root_bus(b); b = b->parent) { | |
| 687 | + if (b->self) | |
| 688 | + d = dev_get_msi_domain(&b->self->dev); | |
| 689 | + } | |
| 690 | + | |
| 691 | + if (!d) | |
| 692 | + d = pci_host_bridge_msi_domain(b); | |
| 688 | 693 | |
| 689 | 694 | dev_set_msi_domain(&bus->dev, d); |
| 690 | 695 | } |
| @@ -855,9 +860,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) · 164 unmodified lines | ||
| 855 | 860 | child->bridge_ctl = bctl; |
| 856 | 861 | } |
| 857 | 862 | |
| 858 | − /* Read and initialize bridge resources */ | |
| 859 | − pci_read_bridge_bases(child); | |
| 860 | − | |
| 861 | 863 | cmax = pci_scan_child_bus(child); |
| 862 | 864 | if (cmax > subordinate) |
| 863 | 865 | dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n", |
| @@ -918,9 +920,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) · 54 unmodified lines | ||
| 918 | 920 | |
| 919 | 921 | if (!is_cardbus) { |
| 920 | 922 | child->bridge_ctl = bctl; |
| 921 | − | |
| 922 | − /* Read and initialize bridge resources */ | |
| 923 | − pci_read_bridge_bases(child); | |
| 924 | 923 | max = pci_scan_child_bus(child); |
| 925 | 924 | } else { |
| 926 | 925 | /* |
| @@ -1907,11 +1907,27 @@ static void quirk_netmos(struct pci_dev *dev) · 1906 unmodified lines | ||
| 1907 | 1907 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, |
| 1908 | 1908 | PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos); |
| 1909 | 1909 | |
| 1910 | +/* | |
| 1911 | + * Quirk non-zero PCI functions to route VPD access through function 0 for | |
| 1912 | + * devices that share VPD resources between functions. The functions are | |
| 1913 | + * expected to be identical devices. | |
| 1914 | + */ | |
| 1910 | 1915 | static void quirk_f0_vpd_link(struct pci_dev *dev) |
| 1911 | 1916 | { |
| 1912 | − if (!dev->multifunction || !PCI_FUNC(dev->devfn)) | |
| 1917 | + struct pci_dev *f0; | |
| 1918 | + | |
| 1919 | + if (!PCI_FUNC(dev->devfn)) | |
| 1913 | 1920 | return; |
| 1914 | − dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0; | |
| 1921 | + | |
| 1922 | + f0 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | |
| 1923 | + if (!f0) | |
| 1924 | + return; | |
| 1925 | + | |
| 1926 | + if (f0->vpd && dev->class == f0->class && | |
| 1927 | + dev->vendor == f0->vendor && dev->device == f0->device) | |
| 1928 | + dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0; | |
| 1929 | + | |
| 1930 | + pci_dev_put(f0); | |
| 1915 | 1931 | } |
| 1916 | 1932 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, |
| 1917 | 1933 | PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link); |
| @@ -318,6 +318,7 @@ static const struct of_device_id of_anatop_regulator_match_tbl[] = { · 317 unmodified lines | ||
| 318 | 318 | { .compatible = "fsl,anatop-regulator", }, |
| 319 | 319 | { /* end */ } |
| 320 | 320 | }; |
| 321 | +MODULE_DEVICE_TABLE(of, of_anatop_regulator_match_tbl); | |
| 321 | 322 | |
| 322 | 323 | static struct platform_driver anatop_regulator_driver = { |
| 323 | 324 | .driver = { |
| @@ -1394,15 +1394,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) · 1393 unmodified lines | ||
| 1394 | 1394 | return 0; |
| 1395 | 1395 | |
| 1396 | 1396 | r = regulator_dev_lookup(dev, rdev->supply_name, &ret); |
| 1397 | − if (ret == -ENODEV) { | |
| 1398 | − /* | |
| 1399 | − * No supply was specified for this regulator and | |
| 1400 | − * there will never be one. | |
| 1401 | − */ | |
| 1402 | − return 0; | |
| 1403 | − } | |
| 1404 | − | |
| 1405 | 1397 | if (!r) { |
| 1398 | + if (ret == -ENODEV) { | |
| 1399 | + /* | |
| 1400 | + * No supply was specified for this regulator and | |
| 1401 | + * there will never be one. | |
| 1402 | + */ | |
| 1403 | + return 0; | |
| 1404 | + } | |
| 1405 | + | |
| 1406 | 1406 | if (have_full_constraints()) { |
| 1407 | 1407 | r = dummy_regulator_rdev; |
| 1408 | 1408 | } else { |
| @@ -1422,11 +1422,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) · 13 unmodified lines | ||
| 1422 | 1422 | return ret; |
| 1423 | 1423 | |
| 1424 | 1424 | /* Cascade always-on state to supply */ |
| 1425 | − if (_regulator_is_enabled(rdev)) { | |
| 1425 | + if (_regulator_is_enabled(rdev) && rdev->supply) { | |
| 1426 | 1426 | ret = regulator_enable(rdev->supply); |
| 1427 | 1427 | if (ret < 0) { |
| 1428 | − if (rdev->supply) | |
| 1429 | − _regulator_put(rdev->supply); | |
| 1428 | + _regulator_put(rdev->supply); | |
| 1430 | 1429 | return ret; |
| 1431 | 1430 | } |
| 1432 | 1431 | } |
| @@ -394,6 +394,7 @@ static const struct of_device_id regulator_gpio_of_match[] = { · 393 unmodified lines | ||
| 394 | 394 | { .compatible = "regulator-gpio", }, |
| 395 | 395 | {}, |
| 396 | 396 | }; |
| 397 | +MODULE_DEVICE_TABLE(of, regulator_gpio_of_match); | |
| 397 | 398 | #endif |
| 398 | 399 | |
| 399 | 400 | static struct platform_driver gpio_regulator_driver = { |
| @@ -45,6 +45,10 @@ struct pbias_regulator_data { · 44 unmodified lines | ||
| 45 | 45 | int voltage; |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | +struct pbias_of_data { | |
| 49 | + unsigned int offset; | |
| 50 | +}; | |
| 51 | + | |
| 48 | 52 | static const unsigned int pbias_volt_table[] = { |
| 49 | 53 | 1800000, |
| 50 | 54 | 3000000 |
| @@ -102,8 +106,35 @@ static struct of_regulator_match pbias_matches[] = { · 51 unmodified lines | ||
| 102 | 106 | }; |
| 103 | 107 | #define PBIAS_NUM_REGS ARRAY_SIZE(pbias_matches) |
| 104 | 108 | |
| 109 | +/* Offset from SCM general area (and syscon) base */ | |
| 110 | + | |
| 111 | +static const struct pbias_of_data pbias_of_data_omap2 = { | |
| 112 | + .offset = 0x230, | |
| 113 | +}; | |
| 114 | + | |
| 115 | +static const struct pbias_of_data pbias_of_data_omap3 = { | |
| 116 | + .offset = 0x2b0, | |
| 117 | +}; | |
| 118 | + | |
| 119 | +static const struct pbias_of_data pbias_of_data_omap4 = { | |
| 120 | + .offset = 0x60, | |
| 121 | +}; | |
| 122 | + | |
| 123 | +static const struct pbias_of_data pbias_of_data_omap5 = { | |
| 124 | + .offset = 0x60, | |
| 125 | +}; | |
| 126 | + | |
| 127 | +static const struct pbias_of_data pbias_of_data_dra7 = { | |
| 128 | + .offset = 0xe00, | |
| 129 | +}; | |
| 130 | + | |
| 105 | 131 | static const struct of_device_id pbias_of_match[] = { |
| 106 | 132 | { .compatible = "ti,pbias-omap", }, |
| 133 | + { .compatible = "ti,pbias-omap2", .data = &pbias_of_data_omap2, }, | |
| 134 | + { .compatible = "ti,pbias-omap3", .data = &pbias_of_data_omap3, }, | |
| 135 | + { .compatible = "ti,pbias-omap4", .data = &pbias_of_data_omap4, }, | |
| 136 | + { .compatible = "ti,pbias-omap5", .data = &pbias_of_data_omap5, }, | |
| 137 | + { .compatible = "ti,pbias-dra7", .data = &pbias_of_data_dra7, }, | |
| 107 | 138 | {}, |
| 108 | 139 | }; |
| 109 | 140 | MODULE_DEVICE_TABLE(of, pbias_of_match); |
| @@ -118,6 +149,9 @@ static int pbias_regulator_probe(struct platform_device *pdev) · 8 unmodified lines | ||
| 118 | 149 | const struct pbias_reg_info *info; |
| 119 | 150 | int ret = 0; |
| 120 | 151 | int count, idx, data_idx = 0; |
| 152 | + const struct of_device_id *match; | |
| 153 | + const struct pbias_of_data *data; | |
| 154 | + unsigned int offset; | |
| 121 | 155 | |
| 122 | 156 | count = of_regulator_match(&pdev->dev, np, pbias_matches, |
| 123 | 157 | PBIAS_NUM_REGS); |
| @@ -133,6 +167,20 @@ static int pbias_regulator_probe(struct platform_device *pdev) · 9 unmodified lines | ||
| 133 | 167 | if (IS_ERR(syscon)) |
| 134 | 168 | return PTR_ERR(syscon); |
| 135 | 169 | |
| 170 | + match = of_match_device(of_match_ptr(pbias_of_match), &pdev->dev); | |
| 171 | + if (match && match->data) { | |
| 172 | + data = match->data; | |
| 173 | + offset = data->offset; | |
| 174 | + } else { | |
| 175 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 176 | + if (!res) | |
| 177 | + return -EINVAL; | |
| 178 | + | |
| 179 | + offset = res->start; | |
| 180 | + dev_WARN(&pdev->dev, | |
| 181 | + "using legacy dt data for pbias offset\n"); | |
| 182 | + } | |
| 183 | + | |
| 136 | 184 | cfg.regmap = syscon; |
| 137 | 185 | cfg.dev = &pdev->dev; |
| 138 | 186 | |
| @@ -145,10 +193,6 @@ static int pbias_regulator_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 145 | 193 | if (!info) |
| 146 | 194 | return -ENODEV; |
| 147 | 195 | |
| 148 | − res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 149 | − if (!res) | |
| 150 | − return -EINVAL; | |
| 151 | − | |
| 152 | 196 | drvdata[data_idx].syscon = syscon; |
| 153 | 197 | drvdata[data_idx].info = info; |
| 154 | 198 | drvdata[data_idx].desc.name = info->name; |
| @@ -158,9 +202,9 @@ static int pbias_regulator_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 158 | 202 | drvdata[data_idx].desc.volt_table = pbias_volt_table; |
| 159 | 203 | drvdata[data_idx].desc.n_voltages = 2; |
| 160 | 204 | drvdata[data_idx].desc.enable_time = info->enable_time; |
| 161 | − drvdata[data_idx].desc.vsel_reg = res->start; | |
| 205 | + drvdata[data_idx].desc.vsel_reg = offset; | |
| 162 | 206 | drvdata[data_idx].desc.vsel_mask = info->vmode; |
| 163 | − drvdata[data_idx].desc.enable_reg = res->start; | |
| 207 | + drvdata[data_idx].desc.enable_reg = offset; | |
| 164 | 208 | drvdata[data_idx].desc.enable_mask = info->enable_mask; |
| 165 | 209 | drvdata[data_idx].desc.enable_val = info->enable; |
| 166 | 210 | drvdata[data_idx].desc.disable_val = info->disable_val; |
| @@ -73,7 +73,7 @@ static const struct regulator_linear_range dcdc4_ranges[] = { · 72 unmodified lines | ||
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | static struct tps_info tps65218_pmic_regs[] = { |
| 76 | − TPS65218_INFO(DCDC1, "DCDC1", 850000, 167500), | |
| 76 | + TPS65218_INFO(DCDC1, "DCDC1", 850000, 1675000), | |
| 77 | 77 | TPS65218_INFO(DCDC2, "DCDC2", 850000, 1675000), |
| 78 | 78 | TPS65218_INFO(DCDC3, "DCDC3", 900000, 3400000), |
| 79 | 79 | TPS65218_INFO(DCDC4, "DCDC4", 1175000, 3400000), |
| @@ -103,6 +103,7 @@ static const struct of_device_id vexpress_regulator_of_match[] = { · 102 unmodified lines | ||
| 103 | 103 | { .compatible = "arm,vexpress-volt", }, |
| 104 | 104 | { } |
| 105 | 105 | }; |
| 106 | +MODULE_DEVICE_TABLE(of, vexpress_regulator_of_match); | |
| 106 | 107 | |
| 107 | 108 | static struct platform_driver vexpress_regulator_driver = { |
| 108 | 109 | .probe = vexpress_regulator_probe, |
| @@ -1957,7 +1957,7 @@ static int scsi_mq_prep_fn(struct request *req) · 1956 unmodified lines | ||
| 1957 | 1957 | static void scsi_mq_done(struct scsi_cmnd *cmd) |
| 1958 | 1958 | { |
| 1959 | 1959 | trace_scsi_dispatch_cmd_done(cmd); |
| 1960 | − blk_mq_complete_request(cmd->request); | |
| 1960 | + blk_mq_complete_request(cmd->request, cmd->request->errors); | |
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, |
| @@ -1720,6 +1720,7 @@ static int atmel_spi_runtime_resume(struct device *dev) · 1719 unmodified lines | ||
| 1720 | 1720 | return clk_prepare_enable(as->clk); |
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | +#ifdef CONFIG_PM_SLEEP | |
| 1723 | 1724 | static int atmel_spi_suspend(struct device *dev) |
| 1724 | 1725 | { |
| 1725 | 1726 | struct spi_master *master = dev_get_drvdata(dev); |
| @@ -1756,6 +1757,7 @@ static int atmel_spi_resume(struct device *dev) · 30 unmodified lines | ||
| 1756 | 1757 | |
| 1757 | 1758 | return ret; |
| 1758 | 1759 | } |
| 1760 | +#endif | |
| 1759 | 1761 | |
| 1760 | 1762 | static const struct dev_pm_ops atmel_spi_pm_ops = { |
| 1761 | 1763 | SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume) |
| @@ -386,14 +386,14 @@ static bool bcm2835_spi_can_dma(struct spi_master *master, · 385 unmodified lines | ||
| 386 | 386 | /* otherwise we only allow transfers within the same page |
| 387 | 387 | * to avoid wasting time on dma_mapping when it is not practical |
| 388 | 388 | */ |
| 389 | − if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { | |
| 389 | + if (((size_t)tfr->tx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { | |
| 390 | 390 | dev_warn_once(&spi->dev, |
| 391 | 391 | "Unaligned spi tx-transfer bridging page\n"); |
| 392 | 392 | return false; |
| 393 | 393 | } |
| 394 | − if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { | |
| 394 | + if (((size_t)tfr->rx_buf & (PAGE_SIZE - 1)) + tfr->len > PAGE_SIZE) { | |
| 395 | 395 | dev_warn_once(&spi->dev, |
| 396 | − "Unaligned spi tx-transfer bridging page\n"); | |
| 396 | + "Unaligned spi rx-transfer bridging page\n"); | |
| 397 | 397 | return false; |
| 398 | 398 | } |
| 399 | 399 | |
| @@ -444,6 +444,7 @@ static const struct of_device_id meson_spifc_dt_match[] = { · 443 unmodified lines | ||
| 444 | 444 | { .compatible = "amlogic,meson6-spifc", }, |
| 445 | 445 | { }, |
| 446 | 446 | }; |
| 447 | +MODULE_DEVICE_TABLE(of, meson_spifc_dt_match); | |
| 447 | 448 | |
| 448 | 449 | static struct platform_driver meson_spifc_driver = { |
| 449 | 450 | .probe = meson_spifc_probe, |
| @@ -85,7 +85,7 @@ struct mtk_spi { · 84 unmodified lines | ||
| 85 | 85 | void __iomem *base; |
| 86 | 86 | u32 state; |
| 87 | 87 | u32 pad_sel; |
| 88 | − struct clk *spi_clk, *parent_clk; | |
| 88 | + struct clk *parent_clk, *sel_clk, *spi_clk; | |
| 89 | 89 | struct spi_transfer *cur_transfer; |
| 90 | 90 | u32 xfer_len; |
| 91 | 91 | struct scatterlist *tx_sgl, *rx_sgl; |
| @@ -173,22 +173,6 @@ static void mtk_spi_config(struct mtk_spi *mdata, · 81 unmodified lines | ||
| 173 | 173 | writel(mdata->pad_sel, mdata->base + SPI_PAD_SEL_REG); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | −static int mtk_spi_prepare_hardware(struct spi_master *master) | |
| 177 | −{ | |
| 178 | − struct spi_transfer *trans; | |
| 179 | − struct mtk_spi *mdata = spi_master_get_devdata(master); | |
| 180 | − struct spi_message *msg = master->cur_msg; | |
| 181 | − | |
| 182 | − trans = list_first_entry(&msg->transfers, struct spi_transfer, | |
| 183 | − transfer_list); | |
| 184 | − if (!trans->cs_change) { | |
| 185 | − mdata->state = MTK_SPI_IDLE; | |
| 186 | − mtk_spi_reset(mdata); | |
| 187 | − } | |
| 188 | − | |
| 189 | − return 0; | |
| 190 | −} | |
| 191 | − | |
| 192 | 176 | static int mtk_spi_prepare_message(struct spi_master *master, |
| 193 | 177 | struct spi_message *msg) |
| 194 | 178 | { |
| @@ -228,11 +212,15 @@ static void mtk_spi_set_cs(struct spi_device *spi, bool enable) · 33 unmodified lines | ||
| 228 | 212 | struct mtk_spi *mdata = spi_master_get_devdata(spi->master); |
| 229 | 213 | |
| 230 | 214 | reg_val = readl(mdata->base + SPI_CMD_REG); |
| 231 | − if (!enable) | |
| 215 | + if (!enable) { | |
| 232 | 216 | reg_val |= SPI_CMD_PAUSE_EN; |
| 233 | − else | |
| 217 | + writel(reg_val, mdata->base + SPI_CMD_REG); | |
| 218 | + } else { | |
| 234 | 219 | reg_val &= ~SPI_CMD_PAUSE_EN; |
| 235 | − writel(reg_val, mdata->base + SPI_CMD_REG); | |
| 220 | + writel(reg_val, mdata->base + SPI_CMD_REG); | |
| 221 | + mdata->state = MTK_SPI_IDLE; | |
| 222 | + mtk_spi_reset(mdata); | |
| 223 | + } | |
| 236 | 224 | } |
| 237 | 225 | |
| 238 | 226 | static void mtk_spi_prepare_transfer(struct spi_master *master, |
| @@ -509,7 +497,6 @@ static int mtk_spi_probe(struct platform_device *pdev) · 270 unmodified lines | ||
| 509 | 497 | master->mode_bits = SPI_CPOL | SPI_CPHA; |
| 510 | 498 | |
| 511 | 499 | master->set_cs = mtk_spi_set_cs; |
| 512 | − master->prepare_transfer_hardware = mtk_spi_prepare_hardware; | |
| 513 | 500 | master->prepare_message = mtk_spi_prepare_message; |
| 514 | 501 | master->transfer_one = mtk_spi_transfer_one; |
| 515 | 502 | master->can_dma = mtk_spi_can_dma; |
| @@ -576,13 +563,6 @@ static int mtk_spi_probe(struct platform_device *pdev) · 60 unmodified lines | ||
| 576 | 563 | goto err_put_master; |
| 577 | 564 | } |
| 578 | 565 | |
| 579 | − mdata->spi_clk = devm_clk_get(&pdev->dev, "spi-clk"); | |
| 580 | − if (IS_ERR(mdata->spi_clk)) { | |
| 581 | − ret = PTR_ERR(mdata->spi_clk); | |
| 582 | − dev_err(&pdev->dev, "failed to get spi-clk: %d\n", ret); | |
| 583 | − goto err_put_master; | |
| 584 | − } | |
| 585 | − | |
| 586 | 566 | mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk"); |
| 587 | 567 | if (IS_ERR(mdata->parent_clk)) { |
| 588 | 568 | ret = PTR_ERR(mdata->parent_clk); |
| @@ -590,13 +570,27 @@ static int mtk_spi_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 590 | 570 | goto err_put_master; |
| 591 | 571 | } |
| 592 | 572 | |
| 573 | + mdata->sel_clk = devm_clk_get(&pdev->dev, "sel-clk"); | |
| 574 | + if (IS_ERR(mdata->sel_clk)) { | |
| 575 | + ret = PTR_ERR(mdata->sel_clk); | |
| 576 | + dev_err(&pdev->dev, "failed to get sel-clk: %d\n", ret); | |
| 577 | + goto err_put_master; | |
| 578 | + } | |
| 579 | + | |
| 580 | + mdata->spi_clk = devm_clk_get(&pdev->dev, "spi-clk"); | |
| 581 | + if (IS_ERR(mdata->spi_clk)) { | |
| 582 | + ret = PTR_ERR(mdata->spi_clk); | |
| 583 | + dev_err(&pdev->dev, "failed to get spi-clk: %d\n", ret); | |
| 584 | + goto err_put_master; | |
| 585 | + } | |
| 586 | + | |
| 593 | 587 | ret = clk_prepare_enable(mdata->spi_clk); |
| 594 | 588 | if (ret < 0) { |
| 595 | 589 | dev_err(&pdev->dev, "failed to enable spi_clk (%d)\n", ret); |
| 596 | 590 | goto err_put_master; |
| 597 | 591 | } |
| 598 | 592 | |
| 599 | − ret = clk_set_parent(mdata->spi_clk, mdata->parent_clk); | |
| 593 | + ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk); | |
| 600 | 594 | if (ret < 0) { |
| 601 | 595 | dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret); |
| 602 | 596 | goto err_disable_clk; |
| @@ -630,7 +624,6 @@ static int mtk_spi_remove(struct platform_device *pdev) · 27 unmodified lines | ||
| 630 | 624 | pm_runtime_disable(&pdev->dev); |
| 631 | 625 | |
| 632 | 626 | mtk_spi_reset(mdata); |
| 633 | − clk_disable_unprepare(mdata->spi_clk); | |
| 634 | 627 | spi_master_put(master); |
| 635 | 628 | |
| 636 | 629 | return 0; |
| @@ -654,6 +654,10 @@ static irqreturn_t ssp_int(int irq, void *dev_id) · 653 unmodified lines | ||
| 654 | 654 | if (!(sccr1_reg & SSCR1_TIE)) |
| 655 | 655 | mask &= ~SSSR_TFS; |
| 656 | 656 | |
| 657 | + /* Ignore RX timeout interrupt if it is disabled */ | |
| 658 | + if (!(sccr1_reg & SSCR1_TINTE)) | |
| 659 | + mask &= ~SSSR_TINT; | |
| 660 | + | |
| 657 | 661 | if (!(status & mask)) |
| 658 | 662 | return IRQ_NONE; |
| 659 | 663 | |
| @@ -34,13 +34,13 @@ struct xtfpga_spi { · 33 unmodified lines | ||
| 34 | 34 | static inline void xtfpga_spi_write32(const struct xtfpga_spi *spi, |
| 35 | 35 | unsigned addr, u32 val) |
| 36 | 36 | { |
| 37 | − iowrite32(val, spi->regs + addr); | |
| 37 | + __raw_writel(val, spi->regs + addr); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | static inline unsigned int xtfpga_spi_read32(const struct xtfpga_spi *spi, |
| 41 | 41 | unsigned addr) |
| 42 | 42 | { |
| 43 | − return ioread32(spi->regs + addr); | |
| 43 | + return __raw_readl(spi->regs + addr); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static inline void xtfpga_spi_wait_busy(struct xtfpga_spi *xspi) |
| @@ -1610,8 +1610,7 @@ static struct class spi_master_class = { · 1609 unmodified lines | ||
| 1610 | 1610 | * |
| 1611 | 1611 | * The caller is responsible for assigning the bus number and initializing |
| 1612 | 1612 | * the master's methods before calling spi_register_master(); and (after errors |
| 1613 | − * adding the device) calling spi_master_put() and kfree() to prevent a memory | |
| 1614 | − * leak. | |
| 1613 | + * adding the device) calling spi_master_put() to prevent a memory leak. | |
| 1615 | 1614 | */ |
| 1616 | 1615 | struct spi_master *spi_alloc_master(struct device *dev, unsigned size) |
| 1617 | 1616 | { |
| @@ -651,7 +651,8 @@ static int spidev_release(struct inode *inode, struct file *filp) · 650 unmodified lines | ||
| 651 | 651 | kfree(spidev->rx_buffer); |
| 652 | 652 | spidev->rx_buffer = NULL; |
| 653 | 653 | |
| 654 | − spidev->speed_hz = spidev->spi->max_speed_hz; | |
| 654 | + if (spidev->spi) | |
| 655 | + spidev->speed_hz = spidev->spi->max_speed_hz; | |
| 655 | 656 | |
| 656 | 657 | /* ... after we unbound from the underlying device? */ |
| 657 | 658 | spin_lock_irq(&spidev->spi_lock); |
| @@ -5,5 +5,25 @@ TODO: · 4 unmodified lines | ||
| 5 | 5 | - add proper arch dependencies as needed |
| 6 | 6 | - audit userspace interfaces to make sure they are sane |
| 7 | 7 | |
| 8 | + | |
| 9 | +ion/ | |
| 10 | + - Remove ION_IOC_SYNC: Flushing for devices should be purely a kernel internal | |
| 11 | + interface on top of dma-buf. flush_for_device needs to be added to dma-buf | |
| 12 | + first. | |
| 13 | + - Remove ION_IOC_CUSTOM: Atm used for cache flushing for cpu access in some | |
| 14 | + vendor trees. Should be replaced with an ioctl on the dma-buf to expose the | |
| 15 | + begin/end_cpu_access hooks to userspace. | |
| 16 | + - Clarify the tricks ion plays with explicitly managing coherency behind the | |
| 17 | + dma api's back (this is absolutely needed for high-perf gpu drivers): Add an | |
| 18 | + explicit coherency management mode to flush_for_device to be used by drivers | |
| 19 | + which want to manage caches themselves and which indicates whether cpu caches | |
| 20 | + need flushing. | |
| 21 | + - With those removed there's probably no use for ION_IOC_IMPORT anymore either | |
| 22 | + since ion would just be the central allocator for shared buffers. | |
| 23 | + - Add dt-binding to expose cma regions as ion heaps, with the rule that any | |
| 24 | + such cma regions must already be used by some device for dma. I.e. ion only | |
| 25 | + exposes existing cma regions and doesn't reserve unecessarily memory when | |
| 26 | + booting a system which doesn't use ion. | |
| 27 | + | |
| 8 | 28 | Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc: |
| 9 | 29 | Arve Hjønnevåg <arve@android.com> and Riley Andrews <riandrews@android.com> |
| @@ -1179,13 +1179,13 @@ struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd) · 1178 unmodified lines | ||
| 1179 | 1179 | mutex_unlock(&client->lock); |
| 1180 | 1180 | goto end; |
| 1181 | 1181 | } |
| 1182 | − mutex_unlock(&client->lock); | |
| 1183 | 1182 | |
| 1184 | 1183 | handle = ion_handle_create(client, buffer); |
| 1185 | − if (IS_ERR(handle)) | |
| 1184 | + if (IS_ERR(handle)) { | |
| 1185 | + mutex_unlock(&client->lock); | |
| 1186 | 1186 | goto end; |
| 1187 | + } | |
| 1187 | 1188 | |
| 1188 | − mutex_lock(&client->lock); | |
| 1189 | 1189 | ret = ion_handle_add(client, handle); |
| 1190 | 1190 | mutex_unlock(&client->lock); |
| 1191 | 1191 | if (ret) { |
| @@ -76,7 +76,7 @@ static int init_display(struct fbtft_par *par) · 75 unmodified lines | ||
| 76 | 76 | |
| 77 | 77 | /* Set CS active high */ |
| 78 | 78 | par->spi->mode |= SPI_CS_HIGH; |
| 79 | − ret = par->spi->master->setup(par->spi); | |
| 79 | + ret = spi_setup(par->spi); | |
| 80 | 80 | if (ret) { |
| 81 | 81 | dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); |
| 82 | 82 | return ret; |
| @@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par) · 168 unmodified lines | ||
| 169 | 169 | /* enable SPI interface by having CS and MOSI low during reset */ |
| 170 | 170 | save_mode = par->spi->mode; |
| 171 | 171 | par->spi->mode |= SPI_CS_HIGH; |
| 172 | − ret = par->spi->master->setup(par->spi); /* set CS inactive low */ | |
| 172 | + ret = spi_setup(par->spi); /* set CS inactive low */ | |
| 173 | 173 | if (ret) { |
| 174 | 174 | dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); |
| 175 | 175 | return ret; |
| @@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par) · 4 unmodified lines | ||
| 180 | 180 | par->fbtftops.reset(par); |
| 181 | 181 | mdelay(1000); |
| 182 | 182 | par->spi->mode = save_mode; |
| 183 | − ret = par->spi->master->setup(par->spi); | |
| 183 | + ret = spi_setup(par->spi); | |
| 184 | 184 | if (ret) { |
| 185 | 185 | dev_err(par->info->device, "Could not restore SPI mode\n"); |
| 186 | 186 | return ret; |
| @@ -1436,15 +1436,11 @@ int fbtft_probe_common(struct fbtft_display *display, · 1435 unmodified lines | ||
| 1436 | 1436 | |
| 1437 | 1437 | /* 9-bit SPI setup */ |
| 1438 | 1438 | if (par->spi && display->buswidth == 9) { |
| 1439 | − par->spi->bits_per_word = 9; | |
| 1440 | − ret = par->spi->master->setup(par->spi); | |
| 1441 | − if (ret) { | |
| 1439 | + if (par->spi->master->bits_per_word_mask & SPI_BPW_MASK(9)) { | |
| 1440 | + par->spi->bits_per_word = 9; | |
| 1441 | + } else { | |
| 1442 | 1442 | dev_warn(&par->spi->dev, |
| 1443 | 1443 | "9-bit SPI not available, emulating using 8-bit.\n"); |
| 1444 | − par->spi->bits_per_word = 8; | |
| 1445 | − ret = par->spi->master->setup(par->spi); | |
| 1446 | − if (ret) | |
| 1447 | − goto out_release; | |
| 1448 | 1444 | /* allocate buffer with room for dc bits */ |
| 1449 | 1445 | par->extra = devm_kzalloc(par->info->device, |
| 1450 | 1446 | par->txbuf.len + (par->txbuf.len / 8) + 8, |
| @@ -463,15 +463,12 @@ static int flexfb_probe_common(struct spi_device *sdev, · 462 unmodified lines | ||
| 463 | 463 | } |
| 464 | 464 | par->fbtftops.write_register = fbtft_write_reg8_bus9; |
| 465 | 465 | par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; |
| 466 | − sdev->bits_per_word = 9; | |
| 467 | − ret = sdev->master->setup(sdev); | |
| 468 | − if (ret) { | |
| 466 | + if (par->spi->master->bits_per_word_mask | |
| 467 | + & SPI_BPW_MASK(9)) { | |
| 468 | + par->spi->bits_per_word = 9; | |
| 469 | + } else { | |
| 469 | 470 | dev_warn(dev, |
| 470 | 471 | "9-bit SPI not available, emulating using 8-bit.\n"); |
| 471 | − sdev->bits_per_word = 8; | |
| 472 | − ret = sdev->master->setup(sdev); | |
| 473 | − if (ret) | |
| 474 | − goto out_release; | |
| 475 | 472 | /* allocate buffer with room for dc bits */ |
| 476 | 473 | par->extra = devm_kzalloc(par->info->device, |
| 477 | 474 | par->txbuf.len + (par->txbuf.len / 8) + 8, |
| @@ -14,10 +14,8 @@ Unlike shared disk storage cluster filesystems (e.g. OCFS2, GFS, GPFS), · 13 unmodified lines | ||
| 14 | 14 | Lustre has independent Metadata and Data servers that clients can access |
| 15 | 15 | in parallel to maximize performance. |
| 16 | 16 | |
| 17 | −In order to use Lustre client you will need to download lustre client | |
| 18 | −tools from | |
| 19 | −https://downloads.hpdd.intel.com/public/lustre/latest-feature-release/ | |
| 20 | −the package name is lustre-client. | |
| 17 | +In order to use Lustre client you will need to download the "lustre-client" | |
| 18 | +package that contains the userspace tools from http://lustre.org/download/ | |
| 21 | 19 | |
| 22 | 20 | You will need to install and configure your Lustre servers separately. |
| 23 | 21 | |
| @@ -76,12 +74,10 @@ Mount Options · 52 unmodified lines | ||
| 76 | 74 | |
| 77 | 75 | More Information |
| 78 | 76 | ================ |
| 79 | −You can get more information at | |
| 80 | −OpenSFS website: http://lustre.opensfs.org/about/ | |
| 81 | −Intel HPDD wiki: https://wiki.hpdd.intel.com | |
| 77 | +You can get more information at the Lustre website: http://wiki.lustre.org/ | |
| 82 | 78 | |
| 83 | −Out of tree Lustre client and server code is available at: | |
| 84 | −http://git.whamcloud.com/fs/lustre-release.git | |
| 79 | +Source for the userspace tools and out-of-tree client and server code | |
| 80 | +is available at: http://git.hpdd.intel.com/fs/lustre-release.git | |
| 85 | 81 | |
| 86 | 82 | Latest binary packages: |
| 87 | −http://lustre.opensfs.org/download-lustre/ | |
| 83 | +http://lustre.org/download/ | |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | menuconfig MOST |
| 2 | 2 | tristate "MOST driver" |
| 3 | + depends on HAS_DMA | |
| 3 | 4 | select MOSTCORE |
| 4 | 5 | default n |
| 5 | 6 | ---help--- |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | config HDM_DIM2 |
| 6 | 6 | tristate "DIM2 HDM" |
| 7 | 7 | depends on AIM_NETWORK |
| 8 | + depends on HAS_IOMEM | |
| 8 | 9 | |
| 9 | 10 | ---help--- |
| 10 | 11 | Say Y here if you want to connect via MediaLB to network transceiver. |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | config HDM_USB |
| 6 | 6 | tristate "USB HDM" |
| 7 | − depends on USB | |
| 7 | + depends on USB && NET | |
| 8 | 8 | select AIM_NETWORK |
| 9 | 9 | ---help--- |
| 10 | 10 | Say Y here if you want to connect via USB to network tranceiver. |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | config MOSTCORE |
| 6 | 6 | tristate "MOST Core" |
| 7 | + depends on HAS_DMA | |
| 7 | 8 | |
| 8 | 9 | ---help--- |
| 9 | 10 | Say Y here if you want to enable MOST support. |
| @@ -10,4 +10,3 @@ visorbus-y += visorchipset.o · 9 unmodified lines | ||
| 10 | 10 | visorbus-y += periodic_work.o |
| 11 | 11 | |
| 12 | 12 | ccflags-y += -Idrivers/staging/unisys/include |
| 13 | −ccflags-y += -Idrivers/staging/unisys/visorutil | |
| @@ -37,6 +37,8 @@ static int visorbus_debugref; · 36 unmodified lines | ||
| 37 | 37 | #define POLLJIFFIES_TESTWORK 100 |
| 38 | 38 | #define POLLJIFFIES_NORMALCHANNEL 10 |
| 39 | 39 | |
| 40 | +static int busreg_rc = -ENODEV; /* stores the result from bus registration */ | |
| 41 | + | |
| 40 | 42 | static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env); |
| 41 | 43 | static int visorbus_match(struct device *xdev, struct device_driver *xdrv); |
| 42 | 44 | static void fix_vbus_dev_info(struct visor_device *visordev); |
| @@ -863,6 +865,9 @@ int visorbus_register_visor_driver(struct visor_driver *drv) · 820 unmodified lines | ||
| 863 | 865 | { |
| 864 | 866 | int rc = 0; |
| 865 | 867 | |
| 868 | + if (busreg_rc < 0) | |
| 869 | + return -ENODEV; /*can't register on a nonexistent bus*/ | |
| 870 | + | |
| 866 | 871 | drv->driver.name = drv->name; |
| 867 | 872 | drv->driver.bus = &visorbus_type; |
| 868 | 873 | drv->driver.probe = visordriver_probe_device; |
| @@ -885,6 +890,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) · 16 unmodified lines | ||
| 885 | 890 | if (rc < 0) |
| 886 | 891 | return rc; |
| 887 | 892 | rc = register_driver_attributes(drv); |
| 893 | + if (rc < 0) | |
| 894 | + driver_unregister(&drv->driver); | |
| 888 | 895 | return rc; |
| 889 | 896 | } |
| 890 | 897 | EXPORT_SYMBOL_GPL(visorbus_register_visor_driver); |
| @@ -1260,10 +1267,8 @@ remove_bus_instance(struct visor_device *dev) · 369 unmodified lines | ||
| 1260 | 1267 | static int |
| 1261 | 1268 | create_bus_type(void) |
| 1262 | 1269 | { |
| 1263 | − int rc = 0; | |
| 1264 | − | |
| 1265 | − rc = bus_register(&visorbus_type); | |
| 1266 | − return rc; | |
| 1270 | + busreg_rc = bus_register(&visorbus_type); | |
| 1271 | + return busreg_rc; | |
| 1267 | 1272 | } |
| 1268 | 1273 | |
| 1269 | 1274 | /** Remove the one-and-only one instance of the visor bus type (visorbus_type). |
| @@ -1189,16 +1189,16 @@ visornic_rx(struct uiscmdrsp *cmdrsp) · 1188 unmodified lines | ||
| 1189 | 1189 | spin_lock_irqsave(&devdata->priv_lock, flags); |
| 1190 | 1190 | atomic_dec(&devdata->num_rcvbuf_in_iovm); |
| 1191 | 1191 | |
| 1192 | − /* update rcv stats - call it with priv_lock held */ | |
| 1193 | − devdata->net_stats.rx_packets++; | |
| 1194 | − devdata->net_stats.rx_bytes = skb->len; | |
| 1195 | − | |
| 1196 | 1192 | /* set length to how much was ACTUALLY received - |
| 1197 | 1193 | * NOTE: rcv_done_len includes actual length of data rcvd |
| 1198 | 1194 | * including ethhdr |
| 1199 | 1195 | */ |
| 1200 | 1196 | skb->len = cmdrsp->net.rcv.rcv_done_len; |
| 1201 | 1197 | |
| 1198 | + /* update rcv stats - call it with priv_lock held */ | |
| 1199 | + devdata->net_stats.rx_packets++; | |
| 1200 | + devdata->net_stats.rx_bytes += skb->len; | |
| 1201 | + | |
| 1202 | 1202 | /* test enabled while holding lock */ |
| 1203 | 1203 | if (!(devdata->enabled && devdata->enab_dis_acked)) { |
| 1204 | 1204 | /* don't process it unless we're in enable mode and until |
| @@ -1924,13 +1924,16 @@ static int visornic_probe(struct visor_device *dev) · 719 unmodified lines | ||
| 1924 | 1924 | "%s debugfs_create_dir %s failed\n", |
| 1925 | 1925 | __func__, netdev->name); |
| 1926 | 1926 | err = -ENOMEM; |
| 1927 | − goto cleanup_xmit_cmdrsp; | |
| 1927 | + goto cleanup_register_netdev; | |
| 1928 | 1928 | } |
| 1929 | 1929 | |
| 1930 | 1930 | dev_info(&dev->device, "%s success netdev=%s\n", |
| 1931 | 1931 | __func__, netdev->name); |
| 1932 | 1932 | return 0; |
| 1933 | 1933 | |
| 1934 | +cleanup_register_netdev: | |
| 1935 | + unregister_netdev(netdev); | |
| 1936 | + | |
| 1934 | 1937 | cleanup_napi_add: |
| 1935 | 1938 | del_timer_sync(&devdata->irq_poll_timer); |
| 1936 | 1939 | netif_napi_del(&devdata->napi); |
| @@ -2128,8 +2131,9 @@ static int visornic_init(void) · 191 unmodified lines | ||
| 2128 | 2131 | if (!dev_num_pool) |
| 2129 | 2132 | goto cleanup_workqueue; |
| 2130 | 2133 | |
| 2131 | − visorbus_register_visor_driver(&visornic_driver); | |
| 2132 | − return 0; | |
| 2134 | + err = visorbus_register_visor_driver(&visornic_driver); | |
| 2135 | + if (!err) | |
| 2136 | + return 0; | |
| 2133 | 2137 | |
| 2134 | 2138 | cleanup_workqueue: |
| 2135 | 2139 | if (visornic_timeout_reset_workqueue) { |
| @@ -407,6 +407,7 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) · 406 unmodified lines | ||
| 407 | 407 | TYPERANGE_UTF8, USE_INITIAL_ONLY); |
| 408 | 408 | if (!param) |
| 409 | 409 | goto out; |
| 410 | + | |
| 410 | 411 | /* |
| 411 | 412 | * Extra parameters for ISER from RFC-5046 |
| 412 | 413 | */ |
| @@ -496,9 +497,9 @@ int iscsi_set_keys_to_negotiate( · 83 unmodified lines | ||
| 496 | 497 | } else if (!strcmp(param->name, SESSIONTYPE)) { |
| 497 | 498 | SET_PSTATE_NEGOTIATE(param); |
| 498 | 499 | } else if (!strcmp(param->name, IFMARKER)) { |
| 499 | − SET_PSTATE_NEGOTIATE(param); | |
| 500 | + SET_PSTATE_REJECT(param); | |
| 500 | 501 | } else if (!strcmp(param->name, OFMARKER)) { |
| 501 | − SET_PSTATE_NEGOTIATE(param); | |
| 502 | + SET_PSTATE_REJECT(param); | |
| 502 | 503 | } else if (!strcmp(param->name, IFMARKINT)) { |
| 503 | 504 | SET_PSTATE_REJECT(param); |
| 504 | 505 | } else if (!strcmp(param->name, OFMARKINT)) { |
| @@ -62,22 +62,13 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 61 unmodified lines | ||
| 62 | 62 | struct se_session *se_sess = se_cmd->se_sess; |
| 63 | 63 | struct se_node_acl *nacl = se_sess->se_node_acl; |
| 64 | 64 | struct se_dev_entry *deve; |
| 65 | + sense_reason_t ret = TCM_NO_SENSE; | |
| 65 | 66 | |
| 66 | 67 | rcu_read_lock(); |
| 67 | 68 | deve = target_nacl_find_deve(nacl, unpacked_lun); |
| 68 | 69 | if (deve) { |
| 69 | 70 | atomic_long_inc(&deve->total_cmds); |
| 70 | 71 | |
| 71 | − if ((se_cmd->data_direction == DMA_TO_DEVICE) && | |
| 72 | − (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY)) { | |
| 73 | − pr_err("TARGET_CORE[%s]: Detected WRITE_PROTECTED LUN" | |
| 74 | − " Access for 0x%08llx\n", | |
| 75 | − se_cmd->se_tfo->get_fabric_name(), | |
| 76 | − unpacked_lun); | |
| 77 | − rcu_read_unlock(); | |
| 78 | − return TCM_WRITE_PROTECTED; | |
| 79 | − } | |
| 80 | − | |
| 81 | 72 | if (se_cmd->data_direction == DMA_TO_DEVICE) |
| 82 | 73 | atomic_long_add(se_cmd->data_length, |
| 83 | 74 | &deve->write_bytes); |
| @@ -93,6 +84,17 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 9 unmodified lines | ||
| 93 | 84 | |
| 94 | 85 | percpu_ref_get(&se_lun->lun_ref); |
| 95 | 86 | se_cmd->lun_ref_active = true; |
| 87 | + | |
| 88 | + if ((se_cmd->data_direction == DMA_TO_DEVICE) && | |
| 89 | + (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY)) { | |
| 90 | + pr_err("TARGET_CORE[%s]: Detected WRITE_PROTECTED LUN" | |
| 91 | + " Access for 0x%08llx\n", | |
| 92 | + se_cmd->se_tfo->get_fabric_name(), | |
| 93 | + unpacked_lun); | |
| 94 | + rcu_read_unlock(); | |
| 95 | + ret = TCM_WRITE_PROTECTED; | |
| 96 | + goto ref_dev; | |
| 97 | + } | |
| 96 | 98 | } |
| 97 | 99 | rcu_read_unlock(); |
| 98 | 100 | |
| @@ -109,12 +111,6 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 10 unmodified lines | ||
| 109 | 111 | unpacked_lun); |
| 110 | 112 | return TCM_NON_EXISTENT_LUN; |
| 111 | 113 | } |
| 112 | − /* | |
| 113 | − * Force WRITE PROTECT for virtual LUN 0 | |
| 114 | − */ | |
| 115 | − if ((se_cmd->data_direction != DMA_FROM_DEVICE) && | |
| 116 | − (se_cmd->data_direction != DMA_NONE)) | |
| 117 | − return TCM_WRITE_PROTECTED; | |
| 118 | 114 | |
| 119 | 115 | se_lun = se_sess->se_tpg->tpg_virt_lun0; |
| 120 | 116 | se_cmd->se_lun = se_sess->se_tpg->tpg_virt_lun0; |
| @@ -123,6 +119,15 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 2 unmodified lines | ||
| 123 | 119 | |
| 124 | 120 | percpu_ref_get(&se_lun->lun_ref); |
| 125 | 121 | se_cmd->lun_ref_active = true; |
| 122 | + | |
| 123 | + /* | |
| 124 | + * Force WRITE PROTECT for virtual LUN 0 | |
| 125 | + */ | |
| 126 | + if ((se_cmd->data_direction != DMA_FROM_DEVICE) && | |
| 127 | + (se_cmd->data_direction != DMA_NONE)) { | |
| 128 | + ret = TCM_WRITE_PROTECTED; | |
| 129 | + goto ref_dev; | |
| 130 | + } | |
| 126 | 131 | } |
| 127 | 132 | /* |
| 128 | 133 | * RCU reference protected by percpu se_lun->lun_ref taken above that |
| @@ -130,6 +135,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 1 unmodified line | ||
| 130 | 135 | * pointer can be kfree_rcu() by the final se_lun->lun_group put via |
| 131 | 136 | * target_core_fabric_configfs.c:target_fabric_port_release |
| 132 | 137 | */ |
| 138 | +ref_dev: | |
| 133 | 139 | se_cmd->se_dev = rcu_dereference_raw(se_lun->lun_se_dev); |
| 134 | 140 | atomic_long_inc(&se_cmd->se_dev->num_cmds); |
| 135 | 141 | |
| @@ -140,7 +146,7 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) · 4 unmodified lines | ||
| 140 | 146 | atomic_long_add(se_cmd->data_length, |
| 141 | 147 | &se_cmd->se_dev->read_bytes); |
| 142 | 148 | |
| 143 | − return 0; | |
| 149 | + return ret; | |
| 144 | 150 | } |
| 145 | 151 | EXPORT_SYMBOL(transport_lookup_cmd_lun); |
| 146 | 152 | |
| @@ -427,8 +433,6 @@ void core_disable_device_list_for_node( · 280 unmodified lines | ||
| 427 | 433 | |
| 428 | 434 | hlist_del_rcu(&orig->link); |
| 429 | 435 | clear_bit(DEF_PR_REG_ACTIVE, &orig->deve_flags); |
| 430 | − rcu_assign_pointer(orig->se_lun, NULL); | |
| 431 | − rcu_assign_pointer(orig->se_lun_acl, NULL); | |
| 432 | 436 | orig->lun_flags = 0; |
| 433 | 437 | orig->creation_time = 0; |
| 434 | 438 | orig->attach_count--; |
| @@ -439,6 +443,9 @@ void core_disable_device_list_for_node( · 4 unmodified lines | ||
| 439 | 443 | kref_put(&orig->pr_kref, target_pr_kref_release); |
| 440 | 444 | wait_for_completion(&orig->pr_comp); |
| 441 | 445 | |
| 446 | + rcu_assign_pointer(orig->se_lun, NULL); | |
| 447 | + rcu_assign_pointer(orig->se_lun_acl, NULL); | |
| 448 | + | |
| 442 | 449 | kfree_rcu(orig, rcu_head); |
| 443 | 450 | |
| 444 | 451 | core_scsi3_free_pr_reg_from_nacl(dev, nacl); |
| @@ -187,5 +187,5 @@ core_delete_hba(struct se_hba *hba) · 186 unmodified lines | ||
| 187 | 187 | |
| 188 | 188 | bool target_sense_desc_format(struct se_device *dev) |
| 189 | 189 | { |
| 190 | − return dev->transport->get_blocks(dev) > U32_MAX; | |
| 190 | + return (dev) ? dev->transport->get_blocks(dev) > U32_MAX : false; | |
| 191 | 191 | } |
| @@ -105,6 +105,8 @@ static int iblock_configure_device(struct se_device *dev) · 104 unmodified lines | ||
| 105 | 105 | mode = FMODE_READ|FMODE_EXCL; |
| 106 | 106 | if (!ib_dev->ibd_readonly) |
| 107 | 107 | mode |= FMODE_WRITE; |
| 108 | + else | |
| 109 | + dev->dev_flags |= DF_READ_ONLY; | |
| 108 | 110 | |
| 109 | 111 | bd = blkdev_get_by_path(ib_dev->ibd_udev_path, mode, ib_dev); |
| 110 | 112 | if (IS_ERR(bd)) { |
| @@ -618,7 +618,7 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration( · 617 unmodified lines | ||
| 618 | 618 | struct se_device *dev, |
| 619 | 619 | struct se_node_acl *nacl, |
| 620 | 620 | struct se_lun *lun, |
| 621 | − struct se_dev_entry *deve, | |
| 621 | + struct se_dev_entry *dest_deve, | |
| 622 | 622 | u64 mapped_lun, |
| 623 | 623 | unsigned char *isid, |
| 624 | 624 | u64 sa_res_key, |
| @@ -640,7 +640,29 @@ static struct t10_pr_registration *__core_scsi3_do_alloc_registration( · 15 unmodified lines | ||
| 640 | 640 | INIT_LIST_HEAD(&pr_reg->pr_reg_atp_mem_list); |
| 641 | 641 | atomic_set(&pr_reg->pr_res_holders, 0); |
| 642 | 642 | pr_reg->pr_reg_nacl = nacl; |
| 643 | − pr_reg->pr_reg_deve = deve; | |
| 643 | + /* | |
| 644 | + * For destination registrations for ALL_TG_PT=1 and SPEC_I_PT=1, | |
| 645 | + * the se_dev_entry->pr_ref will have been already obtained by | |
| 646 | + * core_get_se_deve_from_rtpi() or __core_scsi3_alloc_registration(). | |
| 647 | + * | |
| 648 | + * Otherwise, locate se_dev_entry now and obtain a reference until | |
| 649 | + * registration completes in __core_scsi3_add_registration(). | |
| 650 | + */ | |
| 651 | + if (dest_deve) { | |
| 652 | + pr_reg->pr_reg_deve = dest_deve; | |
| 653 | + } else { | |
| 654 | + rcu_read_lock(); | |
| 655 | + pr_reg->pr_reg_deve = target_nacl_find_deve(nacl, mapped_lun); | |
| 656 | + if (!pr_reg->pr_reg_deve) { | |
| 657 | + rcu_read_unlock(); | |
| 658 | + pr_err("Unable to locate PR deve %s mapped_lun: %llu\n", | |
| 659 | + nacl->initiatorname, mapped_lun); | |
| 660 | + kmem_cache_free(t10_pr_reg_cache, pr_reg); | |
| 661 | + return NULL; | |
| 662 | + } | |
| 663 | + kref_get(&pr_reg->pr_reg_deve->pr_kref); | |
| 664 | + rcu_read_unlock(); | |
| 665 | + } | |
| 644 | 666 | pr_reg->pr_res_mapped_lun = mapped_lun; |
| 645 | 667 | pr_reg->pr_aptpl_target_lun = lun->unpacked_lun; |
| 646 | 668 | pr_reg->tg_pt_sep_rtpi = lun->lun_rtpi; |
| @@ -936,17 +958,29 @@ static int __core_scsi3_check_aptpl_registration( · 289 unmodified lines | ||
| 936 | 958 | !(strcmp(pr_reg->pr_tport, t_port)) && |
| 937 | 959 | (pr_reg->pr_reg_tpgt == tpgt) && |
| 938 | 960 | (pr_reg->pr_aptpl_target_lun == target_lun)) { |
| 961 | + /* | |
| 962 | + * Obtain the ->pr_reg_deve pointer + reference, that | |
| 963 | + * is released by __core_scsi3_add_registration() below. | |
| 964 | + */ | |
| 965 | + rcu_read_lock(); | |
| 966 | + pr_reg->pr_reg_deve = target_nacl_find_deve(nacl, mapped_lun); | |
| 967 | + if (!pr_reg->pr_reg_deve) { | |
| 968 | + pr_err("Unable to locate PR APTPL %s mapped_lun:" | |
| 969 | + " %llu\n", nacl->initiatorname, mapped_lun); | |
| 970 | + rcu_read_unlock(); | |
| 971 | + continue; | |
| 972 | + } | |
| 973 | + kref_get(&pr_reg->pr_reg_deve->pr_kref); | |
| 974 | + rcu_read_unlock(); | |
| 939 | 975 | |
| 940 | 976 | pr_reg->pr_reg_nacl = nacl; |
| 941 | 977 | pr_reg->tg_pt_sep_rtpi = lun->lun_rtpi; |
| 942 | − | |
| 943 | 978 | list_del(&pr_reg->pr_reg_aptpl_list); |
| 944 | 979 | spin_unlock(&pr_tmpl->aptpl_reg_lock); |
| 945 | 980 | /* |
| 946 | 981 | * At this point all of the pointers in *pr_reg will |
| 947 | 982 | * be setup, so go ahead and add the registration. |
| 948 | 983 | */ |
| 949 | − | |
| 950 | 984 | __core_scsi3_add_registration(dev, nacl, pr_reg, 0, 0); |
| 951 | 985 | /* |
| 952 | 986 | * If this registration is the reservation holder, |
| @@ -1044,18 +1078,11 @@ static void __core_scsi3_add_registration( · 91 unmodified lines | ||
| 1044 | 1078 | |
| 1045 | 1079 | __core_scsi3_dump_registration(tfo, dev, nacl, pr_reg, register_type); |
| 1046 | 1080 | spin_unlock(&pr_tmpl->registration_lock); |
| 1047 | − | |
| 1048 | − rcu_read_lock(); | |
| 1049 | − deve = pr_reg->pr_reg_deve; | |
| 1050 | − if (deve) | |
| 1051 | − set_bit(DEF_PR_REG_ACTIVE, &deve->deve_flags); | |
| 1052 | − rcu_read_unlock(); | |
| 1053 | − | |
| 1054 | 1081 | /* |
| 1055 | 1082 | * Skip extra processing for ALL_TG_PT=0 or REGISTER_AND_MOVE. |
| 1056 | 1083 | */ |
| 1057 | 1084 | if (!pr_reg->pr_reg_all_tg_pt || register_move) |
| 1058 | − return; | |
| 1085 | + goto out; | |
| 1059 | 1086 | /* |
| 1060 | 1087 | * Walk pr_reg->pr_reg_atp_list and add registrations for ALL_TG_PT=1 |
| 1061 | 1088 | * allocated in __core_scsi3_alloc_registration() |
| @@ -1075,19 +1102,31 @@ static void __core_scsi3_add_registration( · 13 unmodified lines | ||
| 1075 | 1102 | __core_scsi3_dump_registration(tfo, dev, nacl_tmp, pr_reg_tmp, |
| 1076 | 1103 | register_type); |
| 1077 | 1104 | spin_unlock(&pr_tmpl->registration_lock); |
| 1078 | − | |
| 1105 | + /* | |
| 1106 | + * Drop configfs group dependency reference and deve->pr_kref | |
| 1107 | + * obtained from __core_scsi3_alloc_registration() code. | |
| 1108 | + */ | |
| 1079 | 1109 | rcu_read_lock(); |
| 1080 | 1110 | deve = pr_reg_tmp->pr_reg_deve; |
| 1081 | − if (deve) | |
| 1111 | + if (deve) { | |
| 1082 | 1112 | set_bit(DEF_PR_REG_ACTIVE, &deve->deve_flags); |
| 1113 | + core_scsi3_lunacl_undepend_item(deve); | |
| 1114 | + pr_reg_tmp->pr_reg_deve = NULL; | |
| 1115 | + } | |
| 1083 | 1116 | rcu_read_unlock(); |
| 1084 | − | |
| 1085 | − /* | |
| 1086 | − * Drop configfs group dependency reference from | |
| 1087 | − * __core_scsi3_alloc_registration() | |
| 1088 | − */ | |
| 1089 | − core_scsi3_lunacl_undepend_item(pr_reg_tmp->pr_reg_deve); | |
| 1090 | 1117 | } |
| 1118 | +out: | |
| 1119 | + /* | |
| 1120 | + * Drop deve->pr_kref obtained in __core_scsi3_do_alloc_registration() | |
| 1121 | + */ | |
| 1122 | + rcu_read_lock(); | |
| 1123 | + deve = pr_reg->pr_reg_deve; | |
| 1124 | + if (deve) { | |
| 1125 | + set_bit(DEF_PR_REG_ACTIVE, &deve->deve_flags); | |
| 1126 | + kref_put(&deve->pr_kref, target_pr_kref_release); | |
| 1127 | + pr_reg->pr_reg_deve = NULL; | |
| 1128 | + } | |
| 1129 | + rcu_read_unlock(); | |
| 1091 | 1130 | } |
| 1092 | 1131 | |
| 1093 | 1132 | static int core_scsi3_alloc_registration( |
| @@ -1785,9 +1824,11 @@ core_scsi3_decode_spec_i_port( · 691 unmodified lines | ||
| 1785 | 1824 | dest_node_acl->initiatorname, i_buf, (dest_se_deve) ? |
| 1786 | 1825 | dest_se_deve->mapped_lun : 0); |
| 1787 | 1826 | |
| 1788 | − if (!dest_se_deve) | |
| 1827 | + if (!dest_se_deve) { | |
| 1828 | + kref_put(&local_pr_reg->pr_reg_deve->pr_kref, | |
| 1829 | + target_pr_kref_release); | |
| 1789 | 1830 | continue; |
| 1790 | − | |
| 1831 | + } | |
| 1791 | 1832 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
| 1792 | 1833 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1793 | 1834 | core_scsi3_tpg_undepend_item(dest_tpg); |
| @@ -1823,9 +1864,11 @@ out: · 29 unmodified lines | ||
| 1823 | 1864 | |
| 1824 | 1865 | kmem_cache_free(t10_pr_reg_cache, dest_pr_reg); |
| 1825 | 1866 | |
| 1826 | − if (!dest_se_deve) | |
| 1867 | + if (!dest_se_deve) { | |
| 1868 | + kref_put(&local_pr_reg->pr_reg_deve->pr_kref, | |
| 1869 | + target_pr_kref_release); | |
| 1827 | 1870 | continue; |
| 1828 | − | |
| 1871 | + } | |
| 1829 | 1872 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
| 1830 | 1873 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1831 | 1874 | core_scsi3_tpg_undepend_item(dest_tpg); |
| @@ -668,7 +668,10 @@ int core_tpg_add_lun( · 667 unmodified lines | ||
| 668 | 668 | list_add_tail(&lun->lun_dev_link, &dev->dev_sep_list); |
| 669 | 669 | spin_unlock(&dev->se_port_lock); |
| 670 | 670 | |
| 671 | − lun->lun_access = lun_access; | |
| 671 | + if (dev->dev_flags & DF_READ_ONLY) | |
| 672 | + lun->lun_access = TRANSPORT_LUNFLAGS_READ_ONLY; | |
| 673 | + else | |
| 674 | + lun->lun_access = lun_access; | |
| 672 | 675 | if (!(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) |
| 673 | 676 | hlist_add_head_rcu(&lun->link, &tpg->tpg_lun_hlist); |
| 674 | 677 | mutex_unlock(&tpg->tpg_lun_mutex); |
| @@ -163,7 +163,7 @@ config THERMAL_EMULATION · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | config HISI_THERMAL |
| 165 | 165 | tristate "Hisilicon thermal driver" |
| 166 | − depends on ARCH_HISI && CPU_THERMAL && OF | |
| 166 | + depends on (ARCH_HISI && CPU_THERMAL && OF) || COMPILE_TEST | |
| 167 | 167 | help |
| 168 | 168 | Enable this to plug hisilicon's thermal sensor driver into the Linux |
| 169 | 169 | thermal framework. cpufreq is used as the cooling device to throttle |
| @@ -182,7 +182,7 @@ config IMX_THERMAL · 12 unmodified lines | ||
| 182 | 182 | |
| 183 | 183 | config SPEAR_THERMAL |
| 184 | 184 | bool "SPEAr thermal sensor driver" |
| 185 | − depends on PLAT_SPEAR | |
| 185 | + depends on PLAT_SPEAR || COMPILE_TEST | |
| 186 | 186 | depends on OF |
| 187 | 187 | help |
| 188 | 188 | Enable this to plug the SPEAr thermal sensor driver into the Linux |
| @@ -190,7 +190,7 @@ config SPEAR_THERMAL · 1 unmodified line | ||
| 190 | 190 | |
| 191 | 191 | config ROCKCHIP_THERMAL |
| 192 | 192 | tristate "Rockchip thermal driver" |
| 193 | − depends on ARCH_ROCKCHIP | |
| 193 | + depends on ARCH_ROCKCHIP || COMPILE_TEST | |
| 194 | 194 | depends on RESET_CONTROLLER |
| 195 | 195 | help |
| 196 | 196 | Rockchip thermal driver provides support for Temperature sensor |
| @@ -208,7 +208,7 @@ config RCAR_THERMAL · 11 unmodified lines | ||
| 208 | 208 | |
| 209 | 209 | config KIRKWOOD_THERMAL |
| 210 | 210 | tristate "Temperature sensor on Marvell Kirkwood SoCs" |
| 211 | − depends on MACH_KIRKWOOD | |
| 211 | + depends on MACH_KIRKWOOD || COMPILE_TEST | |
| 212 | 212 | depends on OF |
| 213 | 213 | help |
| 214 | 214 | Support for the Kirkwood thermal sensor driver into the Linux thermal |
| @@ -216,7 +216,7 @@ config KIRKWOOD_THERMAL · 1 unmodified line | ||
| 216 | 216 | |
| 217 | 217 | config DOVE_THERMAL |
| 218 | 218 | tristate "Temperature sensor on Marvell Dove SoCs" |
| 219 | − depends on ARCH_DOVE || MACH_DOVE | |
| 219 | + depends on ARCH_DOVE || MACH_DOVE || COMPILE_TEST | |
| 220 | 220 | depends on OF |
| 221 | 221 | help |
| 222 | 222 | Support for the Dove thermal sensor driver in the Linux thermal |
| @@ -234,7 +234,7 @@ config DB8500_THERMAL · 11 unmodified lines | ||
| 234 | 234 | |
| 235 | 235 | config ARMADA_THERMAL |
| 236 | 236 | tristate "Armada 370/XP thermal management" |
| 237 | − depends on ARCH_MVEBU | |
| 237 | + depends on ARCH_MVEBU || COMPILE_TEST | |
| 238 | 238 | depends on OF |
| 239 | 239 | help |
| 240 | 240 | Enable this option if you want to have support for thermal management |
| @@ -349,11 +349,12 @@ config INTEL_PCH_THERMAL · 108 unmodified lines | ||
| 349 | 349 | programmable trip points and other information. |
| 350 | 350 | |
| 351 | 351 | menu "Texas Instruments thermal drivers" |
| 352 | +depends on ARCH_HAS_BANDGAP || COMPILE_TEST | |
| 352 | 353 | source "drivers/thermal/ti-soc-thermal/Kconfig" |
| 353 | 354 | endmenu |
| 354 | 355 | |
| 355 | 356 | menu "Samsung thermal drivers" |
| 356 | −depends on ARCH_EXYNOS | |
| 357 | +depends on ARCH_EXYNOS || COMPILE_TEST | |
| 357 | 358 | source "drivers/thermal/samsung/Kconfig" |
| 358 | 359 | endmenu |
| 359 | 360 | |
| @@ -364,7 +365,7 @@ endmenu · 4 unmodified lines | ||
| 364 | 365 | |
| 365 | 366 | config QCOM_SPMI_TEMP_ALARM |
| 366 | 367 | tristate "Qualcomm SPMI PMIC Temperature Alarm" |
| 367 | − depends on OF && SPMI && IIO | |
| 368 | + depends on OF && (SPMI || COMPILE_TEST) && IIO | |
| 368 | 369 | select REGMAP_SPMI |
| 369 | 370 | help |
| 370 | 371 | This enables a thermal sysfs driver for Qualcomm plug-and-play (QPNP) |
| @@ -262,7 +262,9 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, · 261 unmodified lines | ||
| 262 | 262 | * efficiently. Power is stored in mW, frequency in KHz. The |
| 263 | 263 | * resulting table is in ascending order. |
| 264 | 264 | * |
| 265 | − * Return: 0 on success, -E* on error. | |
| 265 | + * Return: 0 on success, -EINVAL if there are no OPPs for any CPUs, | |
| 266 | + * -ENOMEM if we run out of memory or -EAGAIN if an OPP was | |
| 267 | + * added/enabled while the function was executing. | |
| 266 | 268 | */ |
| 267 | 269 | static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, |
| 268 | 270 | u32 capacitance) |
| @@ -273,8 +275,6 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, · 4 unmodified lines | ||
| 273 | 275 | int num_opps = 0, cpu, i, ret = 0; |
| 274 | 276 | unsigned long freq; |
| 275 | 277 | |
| 276 | − rcu_read_lock(); | |
| 277 | − | |
| 278 | 278 | for_each_cpu(cpu, &cpufreq_device->allowed_cpus) { |
| 279 | 279 | dev = get_cpu_device(cpu); |
| 280 | 280 | if (!dev) { |
| @@ -284,24 +284,20 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, · 3 unmodified lines | ||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | num_opps = dev_pm_opp_get_opp_count(dev); |
| 287 | − if (num_opps > 0) { | |
| 287 | + if (num_opps > 0) | |
| 288 | 288 | break; |
| 289 | − } else if (num_opps < 0) { | |
| 290 | − ret = num_opps; | |
| 291 | − goto unlock; | |
| 292 | − } | |
| 289 | + else if (num_opps < 0) | |
| 290 | + return num_opps; | |
| 293 | 291 | } |
| 294 | 292 | |
| 295 | − if (num_opps == 0) { | |
| 296 | − ret = -EINVAL; | |
| 297 | − goto unlock; | |
| 298 | − } | |
| 293 | + if (num_opps == 0) | |
| 294 | + return -EINVAL; | |
| 299 | 295 | |
| 300 | 296 | power_table = kcalloc(num_opps, sizeof(*power_table), GFP_KERNEL); |
| 301 | − if (!power_table) { | |
| 302 | − ret = -ENOMEM; | |
| 303 | − goto unlock; | |
| 304 | − } | |
| 297 | + if (!power_table) | |
| 298 | + return -ENOMEM; | |
| 299 | + | |
| 300 | + rcu_read_lock(); | |
| 305 | 301 | |
| 306 | 302 | for (freq = 0, i = 0; |
| 307 | 303 | opp = dev_pm_opp_find_freq_ceil(dev, &freq), !IS_ERR(opp); |
| @@ -309,6 +305,12 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, · 1 unmodified line | ||
| 309 | 305 | u32 freq_mhz, voltage_mv; |
| 310 | 306 | u64 power; |
| 311 | 307 | |
| 308 | + if (i >= num_opps) { | |
| 309 | + rcu_read_unlock(); | |
| 310 | + ret = -EAGAIN; | |
| 311 | + goto free_power_table; | |
| 312 | + } | |
| 313 | + | |
| 312 | 314 | freq_mhz = freq / 1000000; |
| 313 | 315 | voltage_mv = dev_pm_opp_get_voltage(opp) / 1000; |
| 314 | 316 | |
| @@ -326,17 +328,22 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, · 11 unmodified lines | ||
| 326 | 328 | power_table[i].power = power; |
| 327 | 329 | } |
| 328 | 330 | |
| 329 | − if (i == 0) { | |
| 331 | + rcu_read_unlock(); | |
| 332 | + | |
| 333 | + if (i != num_opps) { | |
| 330 | 334 | ret = PTR_ERR(opp); |
| 331 | − goto unlock; | |
| 335 | + goto free_power_table; | |
| 332 | 336 | } |
| 333 | 337 | |
| 334 | 338 | cpufreq_device->cpu_dev = dev; |
| 335 | 339 | cpufreq_device->dyn_power_table = power_table; |
| 336 | 340 | cpufreq_device->dyn_power_table_entries = i; |
| 337 | 341 | |
| 338 | −unlock: | |
| 339 | − rcu_read_unlock(); | |
| 342 | + return 0; | |
| 343 | + | |
| 344 | +free_power_table: | |
| 345 | + kfree(power_table); | |
| 346 | + | |
| 340 | 347 | return ret; |
| 341 | 348 | } |
| 342 | 349 | |
| @@ -847,7 +854,7 @@ __cpufreq_cooling_register(struct device_node *np, · 504 unmodified lines | ||
| 847 | 854 | ret = get_idr(&cpufreq_idr, &cpufreq_dev->id); |
| 848 | 855 | if (ret) { |
| 849 | 856 | cool_dev = ERR_PTR(ret); |
| 850 | − goto free_table; | |
| 857 | + goto free_power_table; | |
| 851 | 858 | } |
| 852 | 859 | |
| 853 | 860 | snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d", |
| @@ -889,6 +896,8 @@ __cpufreq_cooling_register(struct device_node *np, · 35 unmodified lines | ||
| 889 | 896 | |
| 890 | 897 | remove_idr: |
| 891 | 898 | release_idr(&cpufreq_idr, cpufreq_dev->id); |
| 899 | +free_power_table: | |
| 900 | + kfree(cpufreq_dev->dyn_power_table); | |
| 892 | 901 | free_table: |
| 893 | 902 | kfree(cpufreq_dev->freq_table); |
| 894 | 903 | free_time_in_idle_timestamp: |
| @@ -1039,6 +1048,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) · 144 unmodified lines | ||
| 1039 | 1048 | |
| 1040 | 1049 | thermal_cooling_device_unregister(cpufreq_dev->cool_dev); |
| 1041 | 1050 | release_idr(&cpufreq_idr, cpufreq_dev->id); |
| 1051 | + kfree(cpufreq_dev->dyn_power_table); | |
| 1042 | 1052 | kfree(cpufreq_dev->time_in_idle_timestamp); |
| 1043 | 1053 | kfree(cpufreq_dev->time_in_idle); |
| 1044 | 1054 | kfree(cpufreq_dev->freq_table); |
| @@ -72,6 +72,7 @@ static const struct of_device_id db8500_cpufreq_cooling_match[] = { · 71 unmodified lines | ||
| 72 | 72 | { .compatible = "stericsson,db8500-cpufreq-cooling" }, |
| 73 | 73 | {}, |
| 74 | 74 | }; |
| 75 | +MODULE_DEVICE_TABLE(of, db8500_cpufreq_cooling_match); | |
| 75 | 76 | #endif |
| 76 | 77 | |
| 77 | 78 | static struct platform_driver db8500_cpufreq_cooling_driver = { |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #include "thermal_core.h" |
| 26 | 26 | |
| 27 | +#define INVALID_TRIP -1 | |
| 28 | + | |
| 27 | 29 | #define FRAC_BITS 10 |
| 28 | 30 | #define int_to_frac(x) ((x) << FRAC_BITS) |
| 29 | 31 | #define frac_to_int(x) ((x) >> FRAC_BITS) |
| @@ -56,22 +58,119 @@ static inline s64 div_frac(s64 x, s64 y) · 26 unmodified lines | ||
| 56 | 58 | |
| 57 | 59 | /** |
| 58 | 60 | * struct power_allocator_params - parameters for the power allocator governor |
| 61 | + * @allocated_tzp: whether we have allocated tzp for this thermal zone and | |
| 62 | + * it needs to be freed on unbind | |
| 59 | 63 | * @err_integral: accumulated error in the PID controller. |
| 60 | 64 | * @prev_err: error in the previous iteration of the PID controller. |
| 61 | 65 | * Used to calculate the derivative term. |
| 62 | 66 | * @trip_switch_on: first passive trip point of the thermal zone. The |
| 63 | 67 | * governor switches on when this trip point is crossed. |
| 68 | + * If the thermal zone only has one passive trip point, | |
| 69 | + * @trip_switch_on should be INVALID_TRIP. | |
| 64 | 70 | * @trip_max_desired_temperature: last passive trip point of the thermal |
| 65 | 71 | * zone. The temperature we are |
| 66 | 72 | * controlling for. |
| 67 | 73 | */ |
| 68 | 74 | struct power_allocator_params { |
| 75 | + bool allocated_tzp; | |
| 69 | 76 | s64 err_integral; |
| 70 | 77 | s32 prev_err; |
| 71 | 78 | int trip_switch_on; |
| 72 | 79 | int trip_max_desired_temperature; |
| 73 | 80 | }; |
| 74 | 81 | |
| 82 | +/** | |
| 83 | + * estimate_sustainable_power() - Estimate the sustainable power of a thermal zone | |
| 84 | + * @tz: thermal zone we are operating in | |
| 85 | + * | |
| 86 | + * For thermal zones that don't provide a sustainable_power in their | |
| 87 | + * thermal_zone_params, estimate one. Calculate it using the minimum | |
| 88 | + * power of all the cooling devices as that gives a valid value that | |
| 89 | + * can give some degree of functionality. For optimal performance of | |
| 90 | + * this governor, provide a sustainable_power in the thermal zone's | |
| 91 | + * thermal_zone_params. | |
| 92 | + */ | |
| 93 | +static u32 estimate_sustainable_power(struct thermal_zone_device *tz) | |
| 94 | +{ | |
| 95 | + u32 sustainable_power = 0; | |
| 96 | + struct thermal_instance *instance; | |
| 97 | + struct power_allocator_params *params = tz->governor_data; | |
| 98 | + | |
| 99 | + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { | |
| 100 | + struct thermal_cooling_device *cdev = instance->cdev; | |
| 101 | + u32 min_power; | |
| 102 | + | |
| 103 | + if (instance->trip != params->trip_max_desired_temperature) | |
| 104 | + continue; | |
| 105 | + | |
| 106 | + if (power_actor_get_min_power(cdev, tz, &min_power)) | |
| 107 | + continue; | |
| 108 | + | |
| 109 | + sustainable_power += min_power; | |
| 110 | + } | |
| 111 | + | |
| 112 | + return sustainable_power; | |
| 113 | +} | |
| 114 | + | |
| 115 | +/** | |
| 116 | + * estimate_pid_constants() - Estimate the constants for the PID controller | |
| 117 | + * @tz: thermal zone for which to estimate the constants | |
| 118 | + * @sustainable_power: sustainable power for the thermal zone | |
| 119 | + * @trip_switch_on: trip point number for the switch on temperature | |
| 120 | + * @control_temp: target temperature for the power allocator governor | |
| 121 | + * @force: whether to force the update of the constants | |
| 122 | + * | |
| 123 | + * This function is used to update the estimation of the PID | |
| 124 | + * controller constants in struct thermal_zone_parameters. | |
| 125 | + * Sustainable power is provided in case it was estimated. The | |
| 126 | + * estimated sustainable_power should not be stored in the | |
| 127 | + * thermal_zone_parameters so it has to be passed explicitly to this | |
| 128 | + * function. | |
| 129 | + * | |
| 130 | + * If @force is not set, the values in the thermal zone's parameters | |
| 131 | + * are preserved if they are not zero. If @force is set, the values | |
| 132 | + * in thermal zone's parameters are overwritten. | |
| 133 | + */ | |
| 134 | +static void estimate_pid_constants(struct thermal_zone_device *tz, | |
| 135 | + u32 sustainable_power, int trip_switch_on, | |
| 136 | + int control_temp, bool force) | |
| 137 | +{ | |
| 138 | + int ret; | |
| 139 | + int switch_on_temp; | |
| 140 | + u32 temperature_threshold; | |
| 141 | + | |
| 142 | + ret = tz->ops->get_trip_temp(tz, trip_switch_on, &switch_on_temp); | |
| 143 | + if (ret) | |
| 144 | + switch_on_temp = 0; | |
| 145 | + | |
| 146 | + temperature_threshold = control_temp - switch_on_temp; | |
| 147 | + /* | |
| 148 | + * estimate_pid_constants() tries to find appropriate default | |
| 149 | + * values for thermal zones that don't provide them. If a | |
| 150 | + * system integrator has configured a thermal zone with two | |
| 151 | + * passive trip points at the same temperature, that person | |
| 152 | + * hasn't put any effort to set up the thermal zone properly | |
| 153 | + * so just give up. | |
| 154 | + */ | |
| 155 | + if (!temperature_threshold) | |
| 156 | + return; | |
| 157 | + | |
| 158 | + if (!tz->tzp->k_po || force) | |
| 159 | + tz->tzp->k_po = int_to_frac(sustainable_power) / | |
| 160 | + temperature_threshold; | |
| 161 | + | |
| 162 | + if (!tz->tzp->k_pu || force) | |
| 163 | + tz->tzp->k_pu = int_to_frac(2 * sustainable_power) / | |
| 164 | + temperature_threshold; | |
| 165 | + | |
| 166 | + if (!tz->tzp->k_i || force) | |
| 167 | + tz->tzp->k_i = int_to_frac(10) / 1000; | |
| 168 | + /* | |
| 169 | + * The default for k_d and integral_cutoff is 0, so we can | |
| 170 | + * leave them as they are. | |
| 171 | + */ | |
| 172 | +} | |
| 173 | + | |
| 75 | 174 | /** |
| 76 | 175 | * pid_controller() - PID controller |
| 77 | 176 | * @tz: thermal zone we are operating in |
| @@ -98,10 +197,20 @@ static u32 pid_controller(struct thermal_zone_device *tz, · 20 unmodified lines | ||
| 98 | 197 | { |
| 99 | 198 | s64 p, i, d, power_range; |
| 100 | 199 | s32 err, max_power_frac; |
| 200 | + u32 sustainable_power; | |
| 101 | 201 | struct power_allocator_params *params = tz->governor_data; |
| 102 | 202 | |
| 103 | 203 | max_power_frac = int_to_frac(max_allocatable_power); |
| 104 | 204 | |
| 205 | + if (tz->tzp->sustainable_power) { | |
| 206 | + sustainable_power = tz->tzp->sustainable_power; | |
| 207 | + } else { | |
| 208 | + sustainable_power = estimate_sustainable_power(tz); | |
| 209 | + estimate_pid_constants(tz, sustainable_power, | |
| 210 | + params->trip_switch_on, control_temp, | |
| 211 | + true); | |
| 212 | + } | |
| 213 | + | |
| 105 | 214 | err = control_temp - current_temp; |
| 106 | 215 | err = int_to_frac(err); |
| 107 | 216 | |
| @@ -139,7 +248,7 @@ static u32 pid_controller(struct thermal_zone_device *tz, · 31 unmodified lines | ||
| 139 | 248 | power_range = p + i + d; |
| 140 | 249 | |
| 141 | 250 | /* feed-forward the known sustainable dissipatable power */ |
| 142 | − power_range = tz->tzp->sustainable_power + frac_to_int(power_range); | |
| 251 | + power_range = sustainable_power + frac_to_int(power_range); | |
| 143 | 252 | |
| 144 | 253 | power_range = clamp(power_range, (s64)0, (s64)max_allocatable_power); |
| 145 | 254 | |
| @@ -247,6 +356,11 @@ static int allocate_power(struct thermal_zone_device *tz, · 101 unmodified lines | ||
| 247 | 356 | } |
| 248 | 357 | } |
| 249 | 358 | |
| 359 | + if (!num_actors) { | |
| 360 | + ret = -ENODEV; | |
| 361 | + goto unlock; | |
| 362 | + } | |
| 363 | + | |
| 250 | 364 | /* |
| 251 | 365 | * We need to allocate five arrays of the same size: |
| 252 | 366 | * req_power, max_power, granted_power, extra_actor_power and |
| @@ -340,43 +454,66 @@ unlock: · 87 unmodified lines | ||
| 340 | 454 | return ret; |
| 341 | 455 | } |
| 342 | 456 | |
| 343 | −static int get_governor_trips(struct thermal_zone_device *tz, | |
| 344 | − struct power_allocator_params *params) | |
| 457 | +/** | |
| 458 | + * get_governor_trips() - get the number of the two trip points that are key for this governor | |
| 459 | + * @tz: thermal zone to operate on | |
| 460 | + * @params: pointer to private data for this governor | |
| 461 | + * | |
| 462 | + * The power allocator governor works optimally with two trips points: | |
| 463 | + * a "switch on" trip point and a "maximum desired temperature". These | |
| 464 | + * are defined as the first and last passive trip points. | |
| 465 | + * | |
| 466 | + * If there is only one trip point, then that's considered to be the | |
| 467 | + * "maximum desired temperature" trip point and the governor is always | |
| 468 | + * on. If there are no passive or active trip points, then the | |
| 469 | + * governor won't do anything. In fact, its throttle function | |
| 470 | + * won't be called at all. | |
| 471 | + */ | |
| 472 | +static void get_governor_trips(struct thermal_zone_device *tz, | |
| 473 | + struct power_allocator_params *params) | |
| 345 | 474 | { |
| 346 | − int i, ret, last_passive; | |
| 475 | + int i, last_active, last_passive; | |
| 347 | 476 | bool found_first_passive; |
| 348 | 477 | |
| 349 | 478 | found_first_passive = false; |
| 350 | − last_passive = -1; | |
| 351 | − ret = -EINVAL; | |
| 479 | + last_active = INVALID_TRIP; | |
| 480 | + last_passive = INVALID_TRIP; | |
| 352 | 481 | |
| 353 | 482 | for (i = 0; i < tz->trips; i++) { |
| 354 | 483 | enum thermal_trip_type type; |
| 484 | + int ret; | |
| 355 | 485 | |
| 356 | 486 | ret = tz->ops->get_trip_type(tz, i, &type); |
| 357 | − if (ret) | |
| 358 | − return ret; | |
| 487 | + if (ret) { | |
| 488 | + dev_warn(&tz->device, | |
| 489 | + "Failed to get trip point %d type: %d\n", i, | |
| 490 | + ret); | |
| 491 | + continue; | |
| 492 | + } | |
| 359 | 493 | |
| 360 | − if (!found_first_passive) { | |
| 361 | − if (type == THERMAL_TRIP_PASSIVE) { | |
| 494 | + if (type == THERMAL_TRIP_PASSIVE) { | |
| 495 | + if (!found_first_passive) { | |
| 362 | 496 | params->trip_switch_on = i; |
| 363 | 497 | found_first_passive = true; |
| 498 | + } else { | |
| 499 | + last_passive = i; | |
| 364 | 500 | } |
| 365 | − } else if (type == THERMAL_TRIP_PASSIVE) { | |
| 366 | − last_passive = i; | |
| 501 | + } else if (type == THERMAL_TRIP_ACTIVE) { | |
| 502 | + last_active = i; | |
| 367 | 503 | } else { |
| 368 | 504 | break; |
| 369 | 505 | } |
| 370 | 506 | } |
| 371 | 507 | |
| 372 | − if (last_passive != -1) { | |
| 508 | + if (last_passive != INVALID_TRIP) { | |
| 373 | 509 | params->trip_max_desired_temperature = last_passive; |
| 374 | − ret = 0; | |
| 510 | + } else if (found_first_passive) { | |
| 511 | + params->trip_max_desired_temperature = params->trip_switch_on; | |
| 512 | + params->trip_switch_on = INVALID_TRIP; | |
| 375 | 513 | } else { |
| 376 | − ret = -EINVAL; | |
| 514 | + params->trip_switch_on = INVALID_TRIP; | |
| 515 | + params->trip_max_desired_temperature = last_active; | |
| 377 | 516 | } |
| 378 | − | |
| 379 | − return ret; | |
| 380 | 517 | } |
| 381 | 518 | |
| 382 | 519 | static void reset_pid_controller(struct power_allocator_params *params) |
| @@ -405,60 +542,45 @@ static void allow_maximum_power(struct thermal_zone_device *tz) · 22 unmodified lines | ||
| 405 | 542 | * power_allocator_bind() - bind the power_allocator governor to a thermal zone |
| 406 | 543 | * @tz: thermal zone to bind it to |
| 407 | 544 | * |
| 408 | − * Check that the thermal zone is valid for this governor, that is, it | |
| 409 | − * has two thermal trips. If so, initialize the PID controller | |
| 410 | − * parameters and bind it to the thermal zone. | |
| 545 | + * Initialize the PID controller parameters and bind it to the thermal | |
| 546 | + * zone. | |
| 411 | 547 | * |
| 412 | − * Return: 0 on success, -EINVAL if the trips were invalid or -ENOMEM | |
| 413 | − * if we ran out of memory. | |
| 548 | + * Return: 0 on success, or -ENOMEM if we ran out of memory. | |
| 414 | 549 | */ |
| 415 | 550 | static int power_allocator_bind(struct thermal_zone_device *tz) |
| 416 | 551 | { |
| 417 | 552 | int ret; |
| 418 | 553 | struct power_allocator_params *params; |
| 419 | − int switch_on_temp, control_temp; | |
| 420 | − u32 temperature_threshold; | |
| 421 | − | |
| 422 | − if (!tz->tzp || !tz->tzp->sustainable_power) { | |
| 423 | − dev_err(&tz->device, | |
| 424 | − "power_allocator: missing sustainable_power\n"); | |
| 425 | − return -EINVAL; | |
| 426 | − } | |
| 554 | + int control_temp; | |
| 427 | 555 | |
| 428 | 556 | params = kzalloc(sizeof(*params), GFP_KERNEL); |
| 429 | 557 | if (!params) |
| 430 | 558 | return -ENOMEM; |
| 431 | 559 | |
| 432 | − ret = get_governor_trips(tz, params); | |
| 433 | − if (ret) { | |
| 434 | − dev_err(&tz->device, | |
| 435 | − "thermal zone %s has wrong trip setup for power allocator\n", | |
| 436 | − tz->type); | |
| 437 | − goto free; | |
| 438 | − } | |
| 560 | + if (!tz->tzp) { | |
| 561 | + tz->tzp = kzalloc(sizeof(*tz->tzp), GFP_KERNEL); | |
| 562 | + if (!tz->tzp) { | |
| 563 | + ret = -ENOMEM; | |
| 564 | + goto free_params; | |
| 565 | + } | |
| 439 | 566 | |
| 440 | − ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, | |
| 441 | − &switch_on_temp); | |
| 442 | − if (ret) | |
| 443 | − goto free; | |
| 567 | + params->allocated_tzp = true; | |
| 568 | + } | |
| 444 | 569 | |
| 445 | − ret = tz->ops->get_trip_temp(tz, params->trip_max_desired_temperature, | |
| 446 | − &control_temp); | |
| 447 | − if (ret) | |
| 448 | − goto free; | |
| 570 | + if (!tz->tzp->sustainable_power) | |
| 571 | + dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n"); | |
| 449 | 572 | |
| 450 | − temperature_threshold = control_temp - switch_on_temp; | |
| 573 | + get_governor_trips(tz, params); | |
| 451 | 574 | |
| 452 | − tz->tzp->k_po = tz->tzp->k_po ?: | |
| 453 | − int_to_frac(tz->tzp->sustainable_power) / temperature_threshold; | |
| 454 | − tz->tzp->k_pu = tz->tzp->k_pu ?: | |
| 455 | − int_to_frac(2 * tz->tzp->sustainable_power) / | |
| 456 | − temperature_threshold; | |
| 457 | − tz->tzp->k_i = tz->tzp->k_i ?: int_to_frac(10) / 1000; | |
| 458 | − /* | |
| 459 | − * The default for k_d and integral_cutoff is 0, so we can | |
| 460 | − * leave them as they are. | |
| 461 | − */ | |
| 575 | + if (tz->trips > 0) { | |
| 576 | + ret = tz->ops->get_trip_temp(tz, | |
| 577 | + params->trip_max_desired_temperature, | |
| 578 | + &control_temp); | |
| 579 | + if (!ret) | |
| 580 | + estimate_pid_constants(tz, tz->tzp->sustainable_power, | |
| 581 | + params->trip_switch_on, | |
| 582 | + control_temp, false); | |
| 583 | + } | |
| 462 | 584 | |
| 463 | 585 | reset_pid_controller(params); |
| 464 | 586 | |
| @@ -466,14 +588,23 @@ static int power_allocator_bind(struct thermal_zone_device *tz) · 1 unmodified line | ||
| 466 | 588 | |
| 467 | 589 | return 0; |
| 468 | 590 | |
| 469 | −free: | |
| 591 | +free_params: | |
| 470 | 592 | kfree(params); |
| 593 | + | |
| 471 | 594 | return ret; |
| 472 | 595 | } |
| 473 | 596 | |
| 474 | 597 | static void power_allocator_unbind(struct thermal_zone_device *tz) |
| 475 | 598 | { |
| 599 | + struct power_allocator_params *params = tz->governor_data; | |
| 600 | + | |
| 476 | 601 | dev_dbg(&tz->device, "Unbinding from thermal zone %d\n", tz->id); |
| 602 | + | |
| 603 | + if (params->allocated_tzp) { | |
| 604 | + kfree(tz->tzp); | |
| 605 | + tz->tzp = NULL; | |
| 606 | + } | |
| 607 | + | |
| 477 | 608 | kfree(tz->governor_data); |
| 478 | 609 | tz->governor_data = NULL; |
| 479 | 610 | } |
| @@ -499,13 +630,7 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) · 19 unmodified lines | ||
| 499 | 630 | |
| 500 | 631 | ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, |
| 501 | 632 | &switch_on_temp); |
| 502 | − if (ret) { | |
| 503 | − dev_warn(&tz->device, | |
| 504 | − "Failed to get switch on temperature: %d\n", ret); | |
| 505 | − return ret; | |
| 506 | − } | |
| 507 | − | |
| 508 | − if (current_temp < switch_on_temp) { | |
| 633 | + if (!ret && (current_temp < switch_on_temp)) { | |
| 509 | 634 | tz->passive = 0; |
| 510 | 635 | reset_pid_controller(params); |
| 511 | 636 | allow_maximum_power(tz); |
| @@ -1012,6 +1012,34 @@ int power_actor_get_max_power(struct thermal_cooling_device *cdev, · 1011 unmodified lines | ||
| 1012 | 1012 | return cdev->ops->state2power(cdev, tz, 0, max_power); |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | +/** | |
| 1016 | + * power_actor_get_min_power() - get the mainimum power that a cdev can consume | |
| 1017 | + * @cdev: pointer to &thermal_cooling_device | |
| 1018 | + * @tz: a valid thermal zone device pointer | |
| 1019 | + * @min_power: pointer in which to store the minimum power | |
| 1020 | + * | |
| 1021 | + * Calculate the minimum power consumption in milliwatts that the | |
| 1022 | + * cooling device can currently consume and store it in @min_power. | |
| 1023 | + * | |
| 1024 | + * Return: 0 on success, -EINVAL if @cdev doesn't support the | |
| 1025 | + * power_actor API or -E* on other error. | |
| 1026 | + */ | |
| 1027 | +int power_actor_get_min_power(struct thermal_cooling_device *cdev, | |
| 1028 | + struct thermal_zone_device *tz, u32 *min_power) | |
| 1029 | +{ | |
| 1030 | + unsigned long max_state; | |
| 1031 | + int ret; | |
| 1032 | + | |
| 1033 | + if (!cdev_is_power_actor(cdev)) | |
| 1034 | + return -EINVAL; | |
| 1035 | + | |
| 1036 | + ret = cdev->ops->get_max_state(cdev, &max_state); | |
| 1037 | + if (ret) | |
| 1038 | + return ret; | |
| 1039 | + | |
| 1040 | + return cdev->ops->state2power(cdev, tz, max_state, min_power); | |
| 1041 | +} | |
| 1042 | + | |
| 1015 | 1043 | /** |
| 1016 | 1044 | * power_actor_set_power() - limit the maximum power that a cooling device can consume |
| 1017 | 1045 | * @cdev: pointer to &thermal_cooling_device |
| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | config TI_SOC_THERMAL |
| 2 | 2 | tristate "Texas Instruments SoCs temperature sensor driver" |
| 3 | − depends on THERMAL | |
| 4 | − depends on ARCH_HAS_BANDGAP | |
| 5 | 3 | help |
| 6 | 4 | If you say yes here you get support for the Texas Instruments |
| 7 | 5 | OMAP4460+ on die bandgap temperature sensor support. The register |
| @@ -24,7 +22,7 @@ config TI_THERMAL · 16 unmodified lines | ||
| 24 | 22 | config OMAP4_THERMAL |
| 25 | 23 | bool "Texas Instruments OMAP4 thermal support" |
| 26 | 24 | depends on TI_SOC_THERMAL |
| 27 | − depends on ARCH_OMAP4 | |
| 25 | + depends on ARCH_OMAP4 || COMPILE_TEST | |
| 28 | 26 | help |
| 29 | 27 | If you say yes here you get thermal support for the Texas Instruments |
| 30 | 28 | OMAP4 SoC family. The current chip supported are: |
| @@ -38,7 +36,7 @@ config OMAP4_THERMAL · 7 unmodified lines | ||
| 38 | 36 | config OMAP5_THERMAL |
| 39 | 37 | bool "Texas Instruments OMAP5 thermal support" |
| 40 | 38 | depends on TI_SOC_THERMAL |
| 41 | − depends on SOC_OMAP5 | |
| 39 | + depends on SOC_OMAP5 || COMPILE_TEST | |
| 42 | 40 | help |
| 43 | 41 | If you say yes here you get thermal support for the Texas Instruments |
| 44 | 42 | OMAP5 SoC family. The current chip supported are: |
| @@ -50,7 +48,7 @@ config OMAP5_THERMAL · 5 unmodified lines | ||
| 50 | 48 | config DRA752_THERMAL |
| 51 | 49 | bool "Texas Instruments DRA752 thermal support" |
| 52 | 50 | depends on TI_SOC_THERMAL |
| 53 | − depends on SOC_DRA7XX | |
| 51 | + depends on SOC_DRA7XX || COMPILE_TEST | |
| 54 | 52 | help |
| 55 | 53 | If you say yes here you get thermal support for the Texas Instruments |
| 56 | 54 | DRA752 SoC family. The current chip supported are: |
| @@ -643,7 +643,7 @@ static struct pci_device_id nhi_ids[] = { · 642 unmodified lines | ||
| 643 | 643 | { |
| 644 | 644 | .class = PCI_CLASS_SYSTEM_OTHER << 8, .class_mask = ~0, |
| 645 | 645 | .vendor = PCI_VENDOR_ID_INTEL, .device = 0x156c, |
| 646 | − .subvendor = 0x2222, .subdevice = 0x1111, | |
| 646 | + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, | |
| 647 | 647 | }, |
| 648 | 648 | { 0,} |
| 649 | 649 | }; |
| @@ -2910,3 +2910,5 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe) · 2909 unmodified lines | ||
| 2910 | 2910 | } |
| 2911 | 2911 | |
| 2912 | 2912 | #endif /* CONFIG_SERIAL_8250_CONSOLE */ |
| 2913 | + | |
| 2914 | +MODULE_LICENSE("GPL"); | |
| @@ -61,7 +61,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = { · 60 unmodified lines | ||
| 61 | 61 | { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data}, |
| 62 | 62 | { .compatible = "fsl,imx6q-usb", .data = &imx6q_usb_data}, |
| 63 | 63 | { .compatible = "fsl,imx6sl-usb", .data = &imx6sl_usb_data}, |
| 64 | − { .compatible = "fsl,imx6sx-usb", .data = &imx6sl_usb_data}, | |
| 64 | + { .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data}, | |
| 65 | 65 | { /* sentinel */ } |
| 66 | 66 | }; |
| 67 | 67 | MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids); |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/dma-mapping.h> |
| 13 | 13 | #include <linux/module.h> |
| 14 | 14 | #include <linux/of.h> |
| 15 | +#include <linux/of_platform.h> | |
| 15 | 16 | #include <linux/phy/phy.h> |
| 16 | 17 | #include <linux/platform_device.h> |
| 17 | 18 | #include <linux/usb/chipidea.h> |
| @@ -30,18 +31,36 @@ static const struct ci_hdrc_platform_data ci_default_pdata = { · 12 unmodified lines | ||
| 30 | 31 | .flags = CI_HDRC_DISABLE_STREAMING, |
| 31 | 32 | }; |
| 32 | 33 | |
| 34 | +static struct ci_hdrc_platform_data ci_zynq_pdata = { | |
| 35 | + .capoffset = DEF_CAPOFFSET, | |
| 36 | +}; | |
| 37 | + | |
| 38 | +static const struct of_device_id ci_hdrc_usb2_of_match[] = { | |
| 39 | + { .compatible = "chipidea,usb2"}, | |
| 40 | + { .compatible = "xlnx,zynq-usb-2.20a", .data = &ci_zynq_pdata}, | |
| 41 | + { } | |
| 42 | +}; | |
| 43 | +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match); | |
| 44 | + | |
| 33 | 45 | static int ci_hdrc_usb2_probe(struct platform_device *pdev) |
| 34 | 46 | { |
| 35 | 47 | struct device *dev = &pdev->dev; |
| 36 | 48 | struct ci_hdrc_usb2_priv *priv; |
| 37 | 49 | struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); |
| 38 | 50 | int ret; |
| 51 | + const struct of_device_id *match; | |
| 39 | 52 | |
| 40 | 53 | if (!ci_pdata) { |
| 41 | 54 | ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); |
| 42 | 55 | *ci_pdata = ci_default_pdata; /* struct copy */ |
| 43 | 56 | } |
| 44 | 57 | |
| 58 | + match = of_match_device(ci_hdrc_usb2_of_match, &pdev->dev); | |
| 59 | + if (match && match->data) { | |
| 60 | + /* struct copy */ | |
| 61 | + *ci_pdata = *(struct ci_hdrc_platform_data *)match->data; | |
| 62 | + } | |
| 63 | + | |
| 45 | 64 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
| 46 | 65 | if (!priv) |
| 47 | 66 | return -ENOMEM; |
| @@ -96,12 +115,6 @@ static int ci_hdrc_usb2_remove(struct platform_device *pdev) · 48 unmodified lines | ||
| 96 | 115 | return 0; |
| 97 | 116 | } |
| 98 | 117 | |
| 99 | −static const struct of_device_id ci_hdrc_usb2_of_match[] = { | |
| 100 | − { .compatible = "chipidea,usb2" }, | |
| 101 | − { } | |
| 102 | −}; | |
| 103 | −MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match); | |
| 104 | − | |
| 105 | 118 | static struct platform_driver ci_hdrc_usb2_driver = { |
| 106 | 119 | .probe = ci_hdrc_usb2_probe, |
| 107 | 120 | .remove = ci_hdrc_usb2_remove, |
| @@ -656,6 +656,44 @@ __acquires(hwep->lock) · 655 unmodified lines | ||
| 656 | 656 | return 0; |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | +static int _ep_set_halt(struct usb_ep *ep, int value, bool check_transfer) | |
| 660 | +{ | |
| 661 | + struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | |
| 662 | + int direction, retval = 0; | |
| 663 | + unsigned long flags; | |
| 664 | + | |
| 665 | + if (ep == NULL || hwep->ep.desc == NULL) | |
| 666 | + return -EINVAL; | |
| 667 | + | |
| 668 | + if (usb_endpoint_xfer_isoc(hwep->ep.desc)) | |
| 669 | + return -EOPNOTSUPP; | |
| 670 | + | |
| 671 | + spin_lock_irqsave(hwep->lock, flags); | |
| 672 | + | |
| 673 | + if (value && hwep->dir == TX && check_transfer && | |
| 674 | + !list_empty(&hwep->qh.queue) && | |
| 675 | + !usb_endpoint_xfer_control(hwep->ep.desc)) { | |
| 676 | + spin_unlock_irqrestore(hwep->lock, flags); | |
| 677 | + return -EAGAIN; | |
| 678 | + } | |
| 679 | + | |
| 680 | + direction = hwep->dir; | |
| 681 | + do { | |
| 682 | + retval |= hw_ep_set_halt(hwep->ci, hwep->num, hwep->dir, value); | |
| 683 | + | |
| 684 | + if (!value) | |
| 685 | + hwep->wedge = 0; | |
| 686 | + | |
| 687 | + if (hwep->type == USB_ENDPOINT_XFER_CONTROL) | |
| 688 | + hwep->dir = (hwep->dir == TX) ? RX : TX; | |
| 689 | + | |
| 690 | + } while (hwep->dir != direction); | |
| 691 | + | |
| 692 | + spin_unlock_irqrestore(hwep->lock, flags); | |
| 693 | + return retval; | |
| 694 | +} | |
| 695 | + | |
| 696 | + | |
| 659 | 697 | /** |
| 660 | 698 | * _gadget_stop_activity: stops all USB activity, flushes & disables all endpts |
| 661 | 699 | * @gadget: gadget |
| @@ -1051,7 +1089,7 @@ __acquires(ci->lock) · 389 unmodified lines | ||
| 1051 | 1089 | num += ci->hw_ep_max / 2; |
| 1052 | 1090 | |
| 1053 | 1091 | spin_unlock(&ci->lock); |
| 1054 | − err = usb_ep_set_halt(&ci->ci_hw_ep[num].ep); | |
| 1092 | + err = _ep_set_halt(&ci->ci_hw_ep[num].ep, 1, false); | |
| 1055 | 1093 | spin_lock(&ci->lock); |
| 1056 | 1094 | if (!err) |
| 1057 | 1095 | isr_setup_status_phase(ci); |
| @@ -1117,8 +1155,8 @@ delegate: · 59 unmodified lines | ||
| 1117 | 1155 | |
| 1118 | 1156 | if (err < 0) { |
| 1119 | 1157 | spin_unlock(&ci->lock); |
| 1120 | − if (usb_ep_set_halt(&hwep->ep)) | |
| 1121 | − dev_err(ci->dev, "error: ep_set_halt\n"); | |
| 1158 | + if (_ep_set_halt(&hwep->ep, 1, false)) | |
| 1159 | + dev_err(ci->dev, "error: _ep_set_halt\n"); | |
| 1122 | 1160 | spin_lock(&ci->lock); |
| 1123 | 1161 | } |
| 1124 | 1162 | } |
| @@ -1149,9 +1187,9 @@ __acquires(ci->lock) · 24 unmodified lines | ||
| 1149 | 1187 | err = isr_setup_status_phase(ci); |
| 1150 | 1188 | if (err < 0) { |
| 1151 | 1189 | spin_unlock(&ci->lock); |
| 1152 | − if (usb_ep_set_halt(&hwep->ep)) | |
| 1190 | + if (_ep_set_halt(&hwep->ep, 1, false)) | |
| 1153 | 1191 | dev_err(ci->dev, |
| 1154 | − "error: ep_set_halt\n"); | |
| 1192 | + "error: _ep_set_halt\n"); | |
| 1155 | 1193 | spin_lock(&ci->lock); |
| 1156 | 1194 | } |
| 1157 | 1195 | } |
| @@ -1397,41 +1435,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) · 239 unmodified lines | ||
| 1397 | 1435 | */ |
| 1398 | 1436 | static int ep_set_halt(struct usb_ep *ep, int value) |
| 1399 | 1437 | { |
| 1400 | − struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | |
| 1401 | − int direction, retval = 0; | |
| 1402 | − unsigned long flags; | |
| 1403 | − | |
| 1404 | − if (ep == NULL || hwep->ep.desc == NULL) | |
| 1405 | − return -EINVAL; | |
| 1406 | − | |
| 1407 | − if (usb_endpoint_xfer_isoc(hwep->ep.desc)) | |
| 1408 | − return -EOPNOTSUPP; | |
| 1409 | − | |
| 1410 | − spin_lock_irqsave(hwep->lock, flags); | |
| 1411 | − | |
| 1412 | −#ifndef STALL_IN | |
| 1413 | − /* g_file_storage MS compliant but g_zero fails chapter 9 compliance */ | |
| 1414 | − if (value && hwep->type == USB_ENDPOINT_XFER_BULK && hwep->dir == TX && | |
| 1415 | − !list_empty(&hwep->qh.queue)) { | |
| 1416 | − spin_unlock_irqrestore(hwep->lock, flags); | |
| 1417 | − return -EAGAIN; | |
| 1418 | − } | |
| 1419 | −#endif | |
| 1420 | − | |
| 1421 | − direction = hwep->dir; | |
| 1422 | − do { | |
| 1423 | − retval |= hw_ep_set_halt(hwep->ci, hwep->num, hwep->dir, value); | |
| 1424 | − | |
| 1425 | − if (!value) | |
| 1426 | − hwep->wedge = 0; | |
| 1427 | − | |
| 1428 | − if (hwep->type == USB_ENDPOINT_XFER_CONTROL) | |
| 1429 | − hwep->dir = (hwep->dir == TX) ? RX : TX; | |
| 1430 | − | |
| 1431 | − } while (hwep->dir != direction); | |
| 1432 | − | |
| 1433 | − spin_unlock_irqrestore(hwep->lock, flags); | |
| 1434 | − return retval; | |
| 1438 | + return _ep_set_halt(ep, value, true); | |
| 1435 | 1439 | } |
| 1436 | 1440 | |
| 1437 | 1441 | /** |
| @@ -112,7 +112,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, · 111 unmodified lines | ||
| 112 | 112 | cfgno, inum, asnum, ep->desc.bEndpointAddress); |
| 113 | 113 | ep->ss_ep_comp.bmAttributes = 16; |
| 114 | 114 | } else if (usb_endpoint_xfer_isoc(&ep->desc) && |
| 115 | − desc->bmAttributes > 2) { | |
| 115 | + USB_SS_MULT(desc->bmAttributes) > 3) { | |
| 116 | 116 | dev_warn(ddev, "Isoc endpoint has Mult of %d in " |
| 117 | 117 | "config %d interface %d altsetting %d ep %d: " |
| 118 | 118 | "setting to 3\n", desc->bmAttributes + 1, |
| @@ -121,7 +121,8 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, · 2 unmodified lines | ||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if (usb_endpoint_xfer_isoc(&ep->desc)) |
| 124 | − max_tx = (desc->bMaxBurst + 1) * (desc->bmAttributes + 1) * | |
| 124 | + max_tx = (desc->bMaxBurst + 1) * | |
| 125 | + (USB_SS_MULT(desc->bmAttributes)) * | |
| 125 | 126 | usb_endpoint_maxp(&ep->desc); |
| 126 | 127 | else if (usb_endpoint_xfer_int(&ep->desc)) |
| 127 | 128 | max_tx = usb_endpoint_maxp(&ep->desc) * |
| @@ -514,8 +514,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) · 513 unmodified lines | ||
| 514 | 514 | goto err1; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | − dwc3_omap_enable_irqs(omap); | |
| 518 | − | |
| 519 | 517 | ret = dwc3_omap_extcon_register(omap); |
| 520 | 518 | if (ret < 0) |
| 521 | 519 | goto err2; |
| @@ -526,6 +524,8 @@ static int dwc3_omap_probe(struct platform_device *pdev) · 4 unmodified lines | ||
| 526 | 524 | goto err3; |
| 527 | 525 | } |
| 528 | 526 | |
| 527 | + dwc3_omap_enable_irqs(omap); | |
| 528 | + | |
| 529 | 529 | return 0; |
| 530 | 530 | |
| 531 | 531 | err3: |
| @@ -2665,8 +2665,6 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc) · 2664 unmodified lines | ||
| 2665 | 2665 | int i; |
| 2666 | 2666 | irqreturn_t ret = IRQ_NONE; |
| 2667 | 2667 | |
| 2668 | − spin_lock(&dwc->lock); | |
| 2669 | − | |
| 2670 | 2668 | for (i = 0; i < dwc->num_event_buffers; i++) { |
| 2671 | 2669 | irqreturn_t status; |
| 2672 | 2670 | |
| @@ -2675,8 +2673,6 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc) · 2 unmodified lines | ||
| 2675 | 2673 | ret = status; |
| 2676 | 2674 | } |
| 2677 | 2675 | |
| 2678 | − spin_unlock(&dwc->lock); | |
| 2679 | − | |
| 2680 | 2676 | return ret; |
| 2681 | 2677 | } |
| 2682 | 2678 | |
| @@ -186,6 +186,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) · 185 unmodified lines | ||
| 186 | 186 | |
| 187 | 187 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { |
| 188 | 188 | ep->claimed = false; |
| 189 | + ep->driver_data = NULL; | |
| 189 | 190 | } |
| 190 | 191 | gadget->in_epnum = 0; |
| 191 | 192 | gadget->out_epnum = 0; |
| @@ -3138,8 +3138,8 @@ static void udc_pci_remove(struct pci_dev *pdev) · 3137 unmodified lines | ||
| 3138 | 3138 | writel(AMD_BIT(UDC_DEVCFG_SOFTRESET), &dev->regs->cfg); |
| 3139 | 3139 | if (dev->irq_registered) |
| 3140 | 3140 | free_irq(pdev->irq, dev); |
| 3141 | − if (dev->regs) | |
| 3142 | − iounmap(dev->regs); | |
| 3141 | + if (dev->virt_addr) | |
| 3142 | + iounmap(dev->virt_addr); | |
| 3143 | 3143 | if (dev->mem_region) |
| 3144 | 3144 | release_mem_region(pci_resource_start(pdev, 0), |
| 3145 | 3145 | pci_resource_len(pdev, 0)); |
| @@ -3226,17 +3226,13 @@ static int udc_pci_probe( · 80 unmodified lines | ||
| 3226 | 3226 | |
| 3227 | 3227 | /* init */ |
| 3228 | 3228 | dev = kzalloc(sizeof(struct udc), GFP_KERNEL); |
| 3229 | − if (!dev) { | |
| 3230 | − retval = -ENOMEM; | |
| 3231 | − goto finished; | |
| 3232 | − } | |
| 3229 | + if (!dev) | |
| 3230 | + return -ENOMEM; | |
| 3233 | 3231 | |
| 3234 | 3232 | /* pci setup */ |
| 3235 | 3233 | if (pci_enable_device(pdev) < 0) { |
| 3236 | − kfree(dev); | |
| 3237 | − dev = NULL; | |
| 3238 | 3234 | retval = -ENODEV; |
| 3239 | − goto finished; | |
| 3235 | + goto err_pcidev; | |
| 3240 | 3236 | } |
| 3241 | 3237 | dev->active = 1; |
| 3242 | 3238 | |
| @@ -3246,28 +3242,22 @@ static int udc_pci_probe( · 3 unmodified lines | ||
| 3246 | 3242 | |
| 3247 | 3243 | if (!request_mem_region(resource, len, name)) { |
| 3248 | 3244 | dev_dbg(&pdev->dev, "pci device used already\n"); |
| 3249 | − kfree(dev); | |
| 3250 | − dev = NULL; | |
| 3251 | 3245 | retval = -EBUSY; |
| 3252 | − goto finished; | |
| 3246 | + goto err_memreg; | |
| 3253 | 3247 | } |
| 3254 | 3248 | dev->mem_region = 1; |
| 3255 | 3249 | |
| 3256 | 3250 | dev->virt_addr = ioremap_nocache(resource, len); |
| 3257 | 3251 | if (dev->virt_addr == NULL) { |
| 3258 | 3252 | dev_dbg(&pdev->dev, "start address cannot be mapped\n"); |
| 3259 | − kfree(dev); | |
| 3260 | − dev = NULL; | |
| 3261 | 3253 | retval = -EFAULT; |
| 3262 | − goto finished; | |
| 3254 | + goto err_ioremap; | |
| 3263 | 3255 | } |
| 3264 | 3256 | |
| 3265 | 3257 | if (!pdev->irq) { |
| 3266 | 3258 | dev_err(&pdev->dev, "irq not set\n"); |
| 3267 | − kfree(dev); | |
| 3268 | − dev = NULL; | |
| 3269 | 3259 | retval = -ENODEV; |
| 3270 | − goto finished; | |
| 3260 | + goto err_irq; | |
| 3271 | 3261 | } |
| 3272 | 3262 | |
| 3273 | 3263 | spin_lock_init(&dev->lock); |
| @@ -3283,10 +3273,8 @@ static int udc_pci_probe( · 9 unmodified lines | ||
| 3283 | 3273 | |
| 3284 | 3274 | if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { |
| 3285 | 3275 | dev_dbg(&pdev->dev, "request_irq(%d) fail\n", pdev->irq); |
| 3286 | − kfree(dev); | |
| 3287 | − dev = NULL; | |
| 3288 | 3276 | retval = -EBUSY; |
| 3289 | − goto finished; | |
| 3277 | + goto err_irq; | |
| 3290 | 3278 | } |
| 3291 | 3279 | dev->irq_registered = 1; |
| 3292 | 3280 | |
| @@ -3314,8 +3302,17 @@ static int udc_pci_probe( · 21 unmodified lines | ||
| 3314 | 3302 | return 0; |
| 3315 | 3303 | |
| 3316 | 3304 | finished: |
| 3317 | − if (dev) | |
| 3318 | − udc_pci_remove(pdev); | |
| 3305 | + udc_pci_remove(pdev); | |
| 3306 | + return retval; | |
| 3307 | + | |
| 3308 | +err_irq: | |
| 3309 | + iounmap(dev->virt_addr); | |
| 3310 | +err_ioremap: | |
| 3311 | + release_mem_region(resource, len); | |
| 3312 | +err_memreg: | |
| 3313 | + pci_disable_device(pdev); | |
| 3314 | +err_pcidev: | |
| 3315 | + kfree(dev); | |
| 3319 | 3316 | return retval; |
| 3320 | 3317 | } |
| 3321 | 3318 | |
| @@ -2002,6 +2002,17 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, · 2001 unmodified lines | ||
| 2002 | 2002 | ep->udc = udc; |
| 2003 | 2003 | INIT_LIST_HEAD(&ep->queue); |
| 2004 | 2004 | |
| 2005 | + if (ep->index == 0) { | |
| 2006 | + ep->ep.caps.type_control = true; | |
| 2007 | + } else { | |
| 2008 | + ep->ep.caps.type_iso = ep->can_isoc; | |
| 2009 | + ep->ep.caps.type_bulk = true; | |
| 2010 | + ep->ep.caps.type_int = true; | |
| 2011 | + } | |
| 2012 | + | |
| 2013 | + ep->ep.caps.dir_in = true; | |
| 2014 | + ep->ep.caps.dir_out = true; | |
| 2015 | + | |
| 2005 | 2016 | if (i) |
| 2006 | 2017 | list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); |
| 2007 | 2018 | |
| @@ -324,8 +324,7 @@ static void bdc_mem_free(struct bdc *bdc) · 323 unmodified lines | ||
| 324 | 324 | bdc->scratchpad.buff, bdc->scratchpad.sp_dma); |
| 325 | 325 | |
| 326 | 326 | /* Destroy the dma pools */ |
| 327 | − if (bdc->bd_table_pool) | |
| 328 | − dma_pool_destroy(bdc->bd_table_pool); | |
| 327 | + dma_pool_destroy(bdc->bd_table_pool); | |
| 329 | 328 | |
| 330 | 329 | /* Free the bdc_ep array */ |
| 331 | 330 | kfree(bdc->bdc_ep_array); |
| @@ -1348,6 +1348,7 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb, · 1347 unmodified lines | ||
| 1348 | 1348 | { |
| 1349 | 1349 | struct dummy *dum = dum_hcd->dum; |
| 1350 | 1350 | struct dummy_request *req; |
| 1351 | + int sent = 0; | |
| 1351 | 1352 | |
| 1352 | 1353 | top: |
| 1353 | 1354 | /* if there's no request queued, the device is NAKing; return */ |
| @@ -1385,12 +1386,15 @@ top: · 31 unmodified lines | ||
| 1385 | 1386 | if (len == 0) |
| 1386 | 1387 | break; |
| 1387 | 1388 | |
| 1388 | − /* use an extra pass for the final short packet */ | |
| 1389 | − if (len > ep->ep.maxpacket) { | |
| 1390 | − rescan = 1; | |
| 1391 | − len -= (len % ep->ep.maxpacket); | |
| 1389 | + /* send multiple of maxpacket first, then remainder */ | |
| 1390 | + if (len >= ep->ep.maxpacket) { | |
| 1391 | + is_short = 0; | |
| 1392 | + if (len % ep->ep.maxpacket) | |
| 1393 | + rescan = 1; | |
| 1394 | + len -= len % ep->ep.maxpacket; | |
| 1395 | + } else { | |
| 1396 | + is_short = 1; | |
| 1392 | 1397 | } |
| 1393 | − is_short = (len % ep->ep.maxpacket) != 0; | |
| 1394 | 1398 | |
| 1395 | 1399 | len = dummy_perform_transfer(urb, req, len); |
| 1396 | 1400 | |
| @@ -1399,6 +1403,7 @@ top: · 2 unmodified lines | ||
| 1399 | 1403 | req->req.status = len; |
| 1400 | 1404 | } else { |
| 1401 | 1405 | limit -= len; |
| 1406 | + sent += len; | |
| 1402 | 1407 | urb->actual_length += len; |
| 1403 | 1408 | req->req.actual += len; |
| 1404 | 1409 | } |
| @@ -1421,7 +1426,7 @@ top: · 16 unmodified lines | ||
| 1421 | 1426 | *status = -EOVERFLOW; |
| 1422 | 1427 | else |
| 1423 | 1428 | *status = 0; |
| 1424 | − } else if (!to_host) { | |
| 1429 | + } else { | |
| 1425 | 1430 | *status = 0; |
| 1426 | 1431 | if (host_len > dev_len) |
| 1427 | 1432 | req->req.status = -EOVERFLOW; |
| @@ -1429,15 +1434,24 @@ top: · 1 unmodified line | ||
| 1429 | 1434 | req->req.status = 0; |
| 1430 | 1435 | } |
| 1431 | 1436 | |
| 1432 | − /* many requests terminate without a short packet */ | |
| 1437 | + /* | |
| 1438 | + * many requests terminate without a short packet. | |
| 1439 | + * send a zlp if demanded by flags. | |
| 1440 | + */ | |
| 1433 | 1441 | } else { |
| 1434 | − if (req->req.length == req->req.actual | |
| 1435 | − && !req->req.zero) | |
| 1436 | − req->req.status = 0; | |
| 1437 | − if (urb->transfer_buffer_length == urb->actual_length | |
| 1438 | − && !(urb->transfer_flags | |
| 1439 | − & URB_ZERO_PACKET)) | |
| 1440 | − *status = 0; | |
| 1442 | + if (req->req.length == req->req.actual) { | |
| 1443 | + if (req->req.zero && to_host) | |
| 1444 | + rescan = 1; | |
| 1445 | + else | |
| 1446 | + req->req.status = 0; | |
| 1447 | + } | |
| 1448 | + if (urb->transfer_buffer_length == urb->actual_length) { | |
| 1449 | + if (urb->transfer_flags & URB_ZERO_PACKET && | |
| 1450 | + !to_host) | |
| 1451 | + rescan = 1; | |
| 1452 | + else | |
| 1453 | + *status = 0; | |
| 1454 | + } | |
| 1441 | 1455 | } |
| 1442 | 1456 | |
| 1443 | 1457 | /* device side completion --> continuable */ |
| @@ -1460,7 +1474,7 @@ top: · 16 unmodified lines | ||
| 1460 | 1474 | if (rescan) |
| 1461 | 1475 | goto top; |
| 1462 | 1476 | } |
| 1463 | − return limit; | |
| 1477 | + return sent; | |
| 1464 | 1478 | } |
| 1465 | 1479 | |
| 1466 | 1480 | static int periodic_bytes(struct dummy *dum, struct dummy_ep *ep) |
| @@ -1890,7 +1904,7 @@ restart: · 423 unmodified lines | ||
| 1890 | 1904 | default: |
| 1891 | 1905 | treat_control_like_bulk: |
| 1892 | 1906 | ep->last_io = jiffies; |
| 1893 | − total = transfer(dum_hcd, urb, ep, limit, &status); | |
| 1907 | + total -= transfer(dum_hcd, urb, ep, limit, &status); | |
| 1894 | 1908 | break; |
| 1895 | 1909 | } |
| 1896 | 1910 | |
| @@ -2117,8 +2117,7 @@ static int gr_remove(struct platform_device *pdev) · 2116 unmodified lines | ||
| 2117 | 2117 | return -EBUSY; |
| 2118 | 2118 | |
| 2119 | 2119 | gr_dfs_delete(dev); |
| 2120 | − if (dev->desc_pool) | |
| 2121 | − dma_pool_destroy(dev->desc_pool); | |
| 2120 | + dma_pool_destroy(dev->desc_pool); | |
| 2122 | 2121 | platform_set_drvdata(pdev, NULL); |
| 2123 | 2122 | |
| 2124 | 2123 | gr_free_request(&dev->epi[0].ep, &dev->ep0reqi->req); |
| @@ -1767,8 +1767,7 @@ static int mv_u3d_remove(struct platform_device *dev) · 1766 unmodified lines | ||
| 1767 | 1767 | usb_del_gadget_udc(&u3d->gadget); |
| 1768 | 1768 | |
| 1769 | 1769 | /* free memory allocated in probe */ |
| 1770 | − if (u3d->trb_pool) | |
| 1771 | − dma_pool_destroy(u3d->trb_pool); | |
| 1770 | + dma_pool_destroy(u3d->trb_pool); | |
| 1772 | 1771 | |
| 1773 | 1772 | if (u3d->ep_context) |
| 1774 | 1773 | dma_free_coherent(&dev->dev, u3d->ep_context_size, |
| @@ -2100,8 +2100,7 @@ static int mv_udc_remove(struct platform_device *pdev) · 2099 unmodified lines | ||
| 2100 | 2100 | } |
| 2101 | 2101 | |
| 2102 | 2102 | /* free memory allocated in probe */ |
| 2103 | − if (udc->dtd_pool) | |
| 2104 | − dma_pool_destroy(udc->dtd_pool); | |
| 2103 | + dma_pool_destroy(udc->dtd_pool); | |
| 2105 | 2104 | |
| 2106 | 2105 | if (udc->ep_dqh) |
| 2107 | 2106 | dma_free_coherent(&pdev->dev, udc->ep_dqh_size, |
| @@ -1498,10 +1498,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, · 1497 unmodified lines | ||
| 1498 | 1498 | * use Event Data TRBs, and we don't chain in a link TRB on short |
| 1499 | 1499 | * transfers, we're basically dividing by 1. |
| 1500 | 1500 | * |
| 1501 | − * xHCI 1.0 specification indicates that the Average TRB Length should | |
| 1502 | − * be set to 8 for control endpoints. | |
| 1501 | + * xHCI 1.0 and 1.1 specification indicates that the Average TRB Length | |
| 1502 | + * should be set to 8 for control endpoints. | |
| 1503 | 1503 | */ |
| 1504 | − if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version == 0x100) | |
| 1504 | + if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version >= 0x100) | |
| 1505 | 1505 | ep_ctx->tx_info |= cpu_to_le32(AVG_TRB_LENGTH_FOR_EP(8)); |
| 1506 | 1506 | else |
| 1507 | 1507 | ep_ctx->tx_info |= |
| @@ -1792,8 +1792,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) · 284 unmodified lines | ||
| 1792 | 1792 | int size; |
| 1793 | 1793 | int i, j, num_ports; |
| 1794 | 1794 | |
| 1795 | − if (timer_pending(&xhci->cmd_timer)) | |
| 1796 | − del_timer_sync(&xhci->cmd_timer); | |
| 1795 | + del_timer_sync(&xhci->cmd_timer); | |
| 1797 | 1796 | |
| 1798 | 1797 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
| 1799 | 1798 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
| @@ -2321,6 +2320,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) · 521 unmodified lines | ||
| 2321 | 2320 | |
| 2322 | 2321 | INIT_LIST_HEAD(&xhci->cmd_list); |
| 2323 | 2322 | |
| 2323 | + /* init command timeout timer */ | |
| 2324 | + setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout, | |
| 2325 | + (unsigned long)xhci); | |
| 2326 | + | |
| 2324 | 2327 | page_size = readl(&xhci->op_regs->page_size); |
| 2325 | 2328 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
| 2326 | 2329 | "Supported page size register = 0x%x", page_size); |
| @@ -2505,10 +2508,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) · 178 unmodified lines | ||
| 2505 | 2508 | "Wrote ERST address to ir_set 0."); |
| 2506 | 2509 | xhci_print_ir_set(xhci, 0); |
| 2507 | 2510 | |
| 2508 | − /* init command timeout timer */ | |
| 2509 | − setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout, | |
| 2510 | − (unsigned long)xhci); | |
| 2511 | − | |
| 2512 | 2511 | /* |
| 2513 | 2512 | * XXX: Might need to set the Interrupter Moderation Register to |
| 2514 | 2513 | * something other than the default (~1ms minimum between interrupts). |
| @@ -180,51 +180,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 179 unmodified lines | ||
| 180 | 180 | "QUIRK: Resetting on resume"); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | −/* | |
| 184 | − * In some Intel xHCI controllers, in order to get D3 working, | |
| 185 | − * through a vendor specific SSIC CONFIG register at offset 0x883c, | |
| 186 | − * SSIC PORT need to be marked as "unused" before putting xHCI | |
| 187 | − * into D3. After D3 exit, the SSIC port need to be marked as "used". | |
| 188 | − * Without this change, xHCI might not enter D3 state. | |
| 189 | − * Make sure PME works on some Intel xHCI controllers by writing 1 to clear | |
| 190 | − * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 | |
| 191 | − */ | |
| 192 | −static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend) | |
| 193 | −{ | |
| 194 | − struct xhci_hcd *xhci = hcd_to_xhci(hcd); | |
| 195 | − struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | |
| 196 | − u32 val; | |
| 197 | − void __iomem *reg; | |
| 198 | − | |
| 199 | − if (pdev->vendor == PCI_VENDOR_ID_INTEL && | |
| 200 | − pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { | |
| 201 | − | |
| 202 | − reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2; | |
| 203 | − | |
| 204 | − /* Notify SSIC that SSIC profile programming is not done */ | |
| 205 | − val = readl(reg) & ~PROG_DONE; | |
| 206 | − writel(val, reg); | |
| 207 | − | |
| 208 | − /* Mark SSIC port as unused(suspend) or used(resume) */ | |
| 209 | − val = readl(reg); | |
| 210 | − if (suspend) | |
| 211 | − val |= SSIC_PORT_UNUSED; | |
| 212 | − else | |
| 213 | − val &= ~SSIC_PORT_UNUSED; | |
| 214 | − writel(val, reg); | |
| 215 | − | |
| 216 | − /* Notify SSIC that SSIC profile programming is done */ | |
| 217 | − val = readl(reg) | PROG_DONE; | |
| 218 | − writel(val, reg); | |
| 219 | − readl(reg); | |
| 220 | − } | |
| 221 | − | |
| 222 | − reg = (void __iomem *) xhci->cap_regs + 0x80a4; | |
| 223 | − val = readl(reg); | |
| 224 | − writel(val | BIT(28), reg); | |
| 225 | − readl(reg); | |
| 226 | −} | |
| 227 | − | |
| 228 | 183 | #ifdef CONFIG_ACPI |
| 229 | 184 | static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) |
| 230 | 185 | { |
| @@ -345,6 +300,51 @@ static void xhci_pci_remove(struct pci_dev *dev) · 114 unmodified lines | ||
| 345 | 300 | } |
| 346 | 301 | |
| 347 | 302 | #ifdef CONFIG_PM |
| 303 | +/* | |
| 304 | + * In some Intel xHCI controllers, in order to get D3 working, | |
| 305 | + * through a vendor specific SSIC CONFIG register at offset 0x883c, | |
| 306 | + * SSIC PORT need to be marked as "unused" before putting xHCI | |
| 307 | + * into D3. After D3 exit, the SSIC port need to be marked as "used". | |
| 308 | + * Without this change, xHCI might not enter D3 state. | |
| 309 | + * Make sure PME works on some Intel xHCI controllers by writing 1 to clear | |
| 310 | + * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 | |
| 311 | + */ | |
| 312 | +static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend) | |
| 313 | +{ | |
| 314 | + struct xhci_hcd *xhci = hcd_to_xhci(hcd); | |
| 315 | + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | |
| 316 | + u32 val; | |
| 317 | + void __iomem *reg; | |
| 318 | + | |
| 319 | + if (pdev->vendor == PCI_VENDOR_ID_INTEL && | |
| 320 | + pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { | |
| 321 | + | |
| 322 | + reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2; | |
| 323 | + | |
| 324 | + /* Notify SSIC that SSIC profile programming is not done */ | |
| 325 | + val = readl(reg) & ~PROG_DONE; | |
| 326 | + writel(val, reg); | |
| 327 | + | |
| 328 | + /* Mark SSIC port as unused(suspend) or used(resume) */ | |
| 329 | + val = readl(reg); | |
| 330 | + if (suspend) | |
| 331 | + val |= SSIC_PORT_UNUSED; | |
| 332 | + else | |
| 333 | + val &= ~SSIC_PORT_UNUSED; | |
| 334 | + writel(val, reg); | |
| 335 | + | |
| 336 | + /* Notify SSIC that SSIC profile programming is done */ | |
| 337 | + val = readl(reg) | PROG_DONE; | |
| 338 | + writel(val, reg); | |
| 339 | + readl(reg); | |
| 340 | + } | |
| 341 | + | |
| 342 | + reg = (void __iomem *) xhci->cap_regs + 0x80a4; | |
| 343 | + val = readl(reg); | |
| 344 | + writel(val | BIT(28), reg); | |
| 345 | + readl(reg); | |
| 346 | +} | |
| 347 | + | |
| 348 | 348 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) |
| 349 | 349 | { |
| 350 | 350 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| @@ -302,6 +302,15 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) · 301 unmodified lines | ||
| 302 | 302 | ret = xhci_handshake(&xhci->op_regs->cmd_ring, |
| 303 | 303 | CMD_RING_RUNNING, 0, 5 * 1000 * 1000); |
| 304 | 304 | if (ret < 0) { |
| 305 | + /* we are about to kill xhci, give it one more chance */ | |
| 306 | + xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | |
| 307 | + &xhci->op_regs->cmd_ring); | |
| 308 | + udelay(1000); | |
| 309 | + ret = xhci_handshake(&xhci->op_regs->cmd_ring, | |
| 310 | + CMD_RING_RUNNING, 0, 3 * 1000 * 1000); | |
| 311 | + if (ret == 0) | |
| 312 | + return 0; | |
| 313 | + | |
| 305 | 314 | xhci_err(xhci, "Stopped the command ring failed, " |
| 306 | 315 | "maybe the host is dead\n"); |
| 307 | 316 | xhci->xhc_state |= XHCI_STATE_DYING; |
| @@ -3461,8 +3470,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, · 3153 unmodified lines | ||
| 3461 | 3470 | if (start_cycle == 0) |
| 3462 | 3471 | field |= 0x1; |
| 3463 | 3472 | |
| 3464 | − /* xHCI 1.0 6.4.1.2.1: Transfer Type field */ | |
| 3465 | − if (xhci->hci_version == 0x100) { | |
| 3473 | + /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ | |
| 3474 | + if (xhci->hci_version >= 0x100) { | |
| 3466 | 3475 | if (urb->transfer_buffer_length > 0) { |
| 3467 | 3476 | if (setup->bRequestType & USB_DIR_IN) |
| 3468 | 3477 | field |= TRB_TX_TYPE(TRB_DATA_IN); |
| @@ -146,7 +146,8 @@ static int xhci_start(struct xhci_hcd *xhci) · 145 unmodified lines | ||
| 146 | 146 | "waited %u microseconds.\n", |
| 147 | 147 | XHCI_MAX_HALT_USEC); |
| 148 | 148 | if (!ret) |
| 149 | − xhci->xhc_state &= ~XHCI_STATE_HALTED; | |
| 149 | + xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING); | |
| 150 | + | |
| 150 | 151 | return ret; |
| 151 | 152 | } |
| 152 | 153 | |
| @@ -654,15 +655,6 @@ int xhci_run(struct usb_hcd *hcd) · 501 unmodified lines | ||
| 654 | 655 | } |
| 655 | 656 | EXPORT_SYMBOL_GPL(xhci_run); |
| 656 | 657 | |
| 657 | −static void xhci_only_stop_hcd(struct usb_hcd *hcd) | |
| 658 | −{ | |
| 659 | − struct xhci_hcd *xhci = hcd_to_xhci(hcd); | |
| 660 | − | |
| 661 | − spin_lock_irq(&xhci->lock); | |
| 662 | − xhci_halt(xhci); | |
| 663 | − spin_unlock_irq(&xhci->lock); | |
| 664 | −} | |
| 665 | − | |
| 666 | 658 | /* |
| 667 | 659 | * Stop xHCI driver. |
| 668 | 660 | * |
| @@ -677,12 +669,14 @@ void xhci_stop(struct usb_hcd *hcd) · 8 unmodified lines | ||
| 677 | 669 | u32 temp; |
| 678 | 670 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 679 | 671 | |
| 680 | − if (!usb_hcd_is_primary_hcd(hcd)) { | |
| 681 | − xhci_only_stop_hcd(xhci->shared_hcd); | |
| 672 | + if (xhci->xhc_state & XHCI_STATE_HALTED) | |
| 682 | 673 | return; |
| 683 | − } | |
| 684 | 674 | |
| 675 | + mutex_lock(&xhci->mutex); | |
| 685 | 676 | spin_lock_irq(&xhci->lock); |
| 677 | + xhci->xhc_state |= XHCI_STATE_HALTED; | |
| 678 | + xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | |
| 679 | + | |
| 686 | 680 | /* Make sure the xHC is halted for a USB3 roothub |
| 687 | 681 | * (xhci_stop() could be called as part of failed init). |
| 688 | 682 | */ |
| @@ -717,6 +711,7 @@ void xhci_stop(struct usb_hcd *hcd) · 28 unmodified lines | ||
| 717 | 711 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
| 718 | 712 | "xhci_stop completed - status = %x", |
| 719 | 713 | readl(&xhci->op_regs->status)); |
| 714 | + mutex_unlock(&xhci->mutex); | |
| 720 | 715 | } |
| 721 | 716 | |
| 722 | 717 | /* |
| @@ -3793,6 +3788,9 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, · 3070 unmodified lines | ||
| 3793 | 3788 | |
| 3794 | 3789 | mutex_lock(&xhci->mutex); |
| 3795 | 3790 | |
| 3791 | + if (xhci->xhc_state) /* dying or halted */ | |
| 3792 | + goto out; | |
| 3793 | + | |
| 3796 | 3794 | if (!udev->slot_id) { |
| 3797 | 3795 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
| 3798 | 3796 | "Bad Slot ID %d", udev->slot_id); |
| @@ -1051,6 +1051,7 @@ void musb_start(struct musb *musb) · 1050 unmodified lines | ||
| 1051 | 1051 | * (c) peripheral initiates, using SRP |
| 1052 | 1052 | */ |
| 1053 | 1053 | if (musb->port_mode != MUSB_PORT_MODE_HOST && |
| 1054 | + musb->xceiv->otg->state != OTG_STATE_A_WAIT_BCON && | |
| 1054 | 1055 | (devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) { |
| 1055 | 1056 | musb->is_active = 1; |
| 1056 | 1057 | } else { |
| @@ -2448,6 +2449,9 @@ static int musb_suspend(struct device *dev) · 1391 unmodified lines | ||
| 2448 | 2449 | struct musb *musb = dev_to_musb(dev); |
| 2449 | 2450 | unsigned long flags; |
| 2450 | 2451 | |
| 2452 | + musb_platform_disable(musb); | |
| 2453 | + musb_generic_disable(musb); | |
| 2454 | + | |
| 2451 | 2455 | spin_lock_irqsave(&musb->lock, flags); |
| 2452 | 2456 | |
| 2453 | 2457 | if (is_peripheral_active(musb)) { |
| @@ -2501,6 +2505,9 @@ static int musb_resume(struct device *dev) · 47 unmodified lines | ||
| 2501 | 2505 | pm_runtime_disable(dev); |
| 2502 | 2506 | pm_runtime_set_active(dev); |
| 2503 | 2507 | pm_runtime_enable(dev); |
| 2508 | + | |
| 2509 | + musb_start(musb); | |
| 2510 | + | |
| 2504 | 2511 | return 0; |
| 2505 | 2512 | } |
| 2506 | 2513 | |
| @@ -551,6 +551,9 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) · 550 unmodified lines | ||
| 551 | 551 | } else { |
| 552 | 552 | cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE); |
| 553 | 553 | |
| 554 | + /* delay to drain to cppi dma pipeline for isoch */ | |
| 555 | + udelay(250); | |
| 556 | + | |
| 554 | 557 | csr = musb_readw(epio, MUSB_RXCSR); |
| 555 | 558 | csr &= ~(MUSB_RXCSR_H_REQPKT | MUSB_RXCSR_DMAENAB); |
| 556 | 559 | musb_writew(epio, MUSB_RXCSR, csr); |
| @@ -225,8 +225,11 @@ static void dsps_musb_enable(struct musb *musb) · 224 unmodified lines | ||
| 225 | 225 | |
| 226 | 226 | dsps_writel(reg_base, wrp->epintr_set, epmask); |
| 227 | 227 | dsps_writel(reg_base, wrp->coreintr_set, coremask); |
| 228 | − /* start polling for ID change. */ | |
| 229 | − mod_timer(&glue->timer, jiffies + msecs_to_jiffies(wrp->poll_timeout)); | |
| 228 | + /* start polling for ID change in dual-role idle mode */ | |
| 229 | + if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && | |
| 230 | + musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | |
| 231 | + mod_timer(&glue->timer, jiffies + | |
| 232 | + msecs_to_jiffies(wrp->poll_timeout)); | |
| 230 | 233 | dsps_musb_try_idle(musb, 0); |
| 231 | 234 | } |
| 232 | 235 | |
| @@ -379,6 +379,8 @@ static const struct of_device_id ux500_match[] = { · 378 unmodified lines | ||
| 379 | 379 | {} |
| 380 | 380 | }; |
| 381 | 381 | |
| 382 | +MODULE_DEVICE_TABLE(of, ux500_match); | |
| 383 | + | |
| 382 | 384 | static struct platform_driver ux500_driver = { |
| 383 | 385 | .probe = ux500_probe, |
| 384 | 386 | .remove = ux500_remove, |
| @@ -155,7 +155,7 @@ config USB_MSM_OTG · 154 unmodified lines | ||
| 155 | 155 | config USB_QCOM_8X16_PHY |
| 156 | 156 | tristate "Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support" |
| 157 | 157 | depends on ARCH_QCOM || COMPILE_TEST |
| 158 | − depends on RESET_CONTROLLER | |
| 158 | + depends on RESET_CONTROLLER && EXTCON | |
| 159 | 159 | select USB_PHY |
| 160 | 160 | select USB_ULPI_VIEWPORT |
| 161 | 161 | help |
| @@ -232,7 +232,8 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, · 231 unmodified lines | ||
| 232 | 232 | clk_rate = pdata->clk_rate; |
| 233 | 233 | needs_vcc = pdata->needs_vcc; |
| 234 | 234 | if (gpio_is_valid(pdata->gpio_reset)) { |
| 235 | − err = devm_gpio_request_one(dev, pdata->gpio_reset, 0, | |
| 235 | + err = devm_gpio_request_one(dev, pdata->gpio_reset, | |
| 236 | + GPIOF_ACTIVE_LOW, | |
| 236 | 237 | dev_name(dev)); |
| 237 | 238 | if (!err) |
| 238 | 239 | nop->gpiod_reset = |
| @@ -31,6 +31,7 @@ static const struct i2c_device_id isp1301_id[] = { · 30 unmodified lines | ||
| 31 | 31 | { "isp1301", 0 }, |
| 32 | 32 | { } |
| 33 | 33 | }; |
| 34 | +MODULE_DEVICE_TABLE(i2c, isp1301_id); | |
| 34 | 35 | |
| 35 | 36 | static struct i2c_client *isp1301_i2c_client; |
| 36 | 37 | |
| @@ -278,6 +278,10 @@ static void option_instat_callback(struct urb *urb); · 277 unmodified lines | ||
| 278 | 278 | #define ZTE_PRODUCT_MF622 0x0001 |
| 279 | 279 | #define ZTE_PRODUCT_MF628 0x0015 |
| 280 | 280 | #define ZTE_PRODUCT_MF626 0x0031 |
| 281 | +#define ZTE_PRODUCT_ZM8620_X 0x0396 | |
| 282 | +#define ZTE_PRODUCT_ME3620_MBIM 0x0426 | |
| 283 | +#define ZTE_PRODUCT_ME3620_X 0x1432 | |
| 284 | +#define ZTE_PRODUCT_ME3620_L 0x1433 | |
| 281 | 285 | #define ZTE_PRODUCT_AC2726 0xfff1 |
| 282 | 286 | #define ZTE_PRODUCT_MG880 0xfffd |
| 283 | 287 | #define ZTE_PRODUCT_CDMA_TECH 0xfffe |
| @@ -544,6 +548,18 @@ static const struct option_blacklist_info zte_mc2716_z_blacklist = { · 260 unmodified lines | ||
| 544 | 548 | .sendsetup = BIT(1) | BIT(2) | BIT(3), |
| 545 | 549 | }; |
| 546 | 550 | |
| 551 | +static const struct option_blacklist_info zte_me3620_mbim_blacklist = { | |
| 552 | + .reserved = BIT(2) | BIT(3) | BIT(4), | |
| 553 | +}; | |
| 554 | + | |
| 555 | +static const struct option_blacklist_info zte_me3620_xl_blacklist = { | |
| 556 | + .reserved = BIT(3) | BIT(4) | BIT(5), | |
| 557 | +}; | |
| 558 | + | |
| 559 | +static const struct option_blacklist_info zte_zm8620_x_blacklist = { | |
| 560 | + .reserved = BIT(3) | BIT(4) | BIT(5), | |
| 561 | +}; | |
| 562 | + | |
| 547 | 563 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
| 548 | 564 | .reserved = BIT(1) | BIT(2), |
| 549 | 565 | }; |
| @@ -1591,6 +1607,14 @@ static const struct usb_device_id option_ids[] = { · 1041 unmodified lines | ||
| 1591 | 1607 | .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, |
| 1592 | 1608 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), |
| 1593 | 1609 | .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, |
| 1610 | + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_L), | |
| 1611 | + .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, | |
| 1612 | + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_MBIM), | |
| 1613 | + .driver_info = (kernel_ulong_t)&zte_me3620_mbim_blacklist }, | |
| 1614 | + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_X), | |
| 1615 | + .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, | |
| 1616 | + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ZM8620_X), | |
| 1617 | + .driver_info = (kernel_ulong_t)&zte_zm8620_x_blacklist }, | |
| 1594 | 1618 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, |
| 1595 | 1619 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, |
| 1596 | 1620 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, |
| @@ -80,6 +80,8 @@ static int whiteheat_firmware_download(struct usb_serial *serial, · 79 unmodified lines | ||
| 80 | 80 | static int whiteheat_firmware_attach(struct usb_serial *serial); |
| 81 | 81 | |
| 82 | 82 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ |
| 83 | +static int whiteheat_probe(struct usb_serial *serial, | |
| 84 | + const struct usb_device_id *id); | |
| 83 | 85 | static int whiteheat_attach(struct usb_serial *serial); |
| 84 | 86 | static void whiteheat_release(struct usb_serial *serial); |
| 85 | 87 | static int whiteheat_port_probe(struct usb_serial_port *port); |
| @@ -116,6 +118,7 @@ static struct usb_serial_driver whiteheat_device = { · 30 unmodified lines | ||
| 116 | 118 | .description = "Connect Tech - WhiteHEAT", |
| 117 | 119 | .id_table = id_table_std, |
| 118 | 120 | .num_ports = 4, |
| 121 | + .probe = whiteheat_probe, | |
| 119 | 122 | .attach = whiteheat_attach, |
| 120 | 123 | .release = whiteheat_release, |
| 121 | 124 | .port_probe = whiteheat_port_probe, |
| @@ -217,6 +220,34 @@ static int whiteheat_firmware_attach(struct usb_serial *serial) · 95 unmodified lines | ||
| 217 | 220 | /***************************************************************************** |
| 218 | 221 | * Connect Tech's White Heat serial driver functions |
| 219 | 222 | *****************************************************************************/ |
| 223 | + | |
| 224 | +static int whiteheat_probe(struct usb_serial *serial, | |
| 225 | + const struct usb_device_id *id) | |
| 226 | +{ | |
| 227 | + struct usb_host_interface *iface_desc; | |
| 228 | + struct usb_endpoint_descriptor *endpoint; | |
| 229 | + size_t num_bulk_in = 0; | |
| 230 | + size_t num_bulk_out = 0; | |
| 231 | + size_t min_num_bulk; | |
| 232 | + unsigned int i; | |
| 233 | + | |
| 234 | + iface_desc = serial->interface->cur_altsetting; | |
| 235 | + | |
| 236 | + for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { | |
| 237 | + endpoint = &iface_desc->endpoint[i].desc; | |
| 238 | + if (usb_endpoint_is_bulk_in(endpoint)) | |
| 239 | + ++num_bulk_in; | |
| 240 | + if (usb_endpoint_is_bulk_out(endpoint)) | |
| 241 | + ++num_bulk_out; | |
| 242 | + } | |
| 243 | + | |
| 244 | + min_num_bulk = COMMAND_PORT + 1; | |
| 245 | + if (num_bulk_in < min_num_bulk || num_bulk_out < min_num_bulk) | |
| 246 | + return -ENODEV; | |
| 247 | + | |
| 248 | + return 0; | |
| 249 | +} | |
| 250 | + | |
| 220 | 251 | static int whiteheat_attach(struct usb_serial *serial) |
| 221 | 252 | { |
| 222 | 253 | struct usb_serial_port *command_port; |
| @@ -817,8 +817,9 @@ config ITCO_WDT · 816 unmodified lines | ||
| 817 | 817 | tristate "Intel TCO Timer/Watchdog" |
| 818 | 818 | depends on (X86 || IA64) && PCI |
| 819 | 819 | select WATCHDOG_CORE |
| 820 | + depends on I2C || I2C=n | |
| 820 | 821 | select LPC_ICH if !EXPERT |
| 821 | − select I2C_I801 if !EXPERT | |
| 822 | + select I2C_I801 if !EXPERT && I2C | |
| 822 | 823 | ---help--- |
| 823 | 824 | Hardware driver for the intel TCO timer based watchdog devices. |
| 824 | 825 | These drivers are included in the Intel 82801 I/O Controller |
| @@ -36,6 +36,13 @@ · 35 unmodified lines | ||
| 36 | 36 | #define PM_RSTC_WRCFG_FULL_RESET 0x00000020 |
| 37 | 37 | #define PM_RSTC_RESET 0x00000102 |
| 38 | 38 | |
| 39 | +/* | |
| 40 | + * The Raspberry Pi firmware uses the RSTS register to know which partiton | |
| 41 | + * to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10. | |
| 42 | + * Partiton 63 is a special partition used by the firmware to indicate halt. | |
| 43 | + */ | |
| 44 | +#define PM_RSTS_RASPBERRYPI_HALT 0x555 | |
| 45 | + | |
| 39 | 46 | #define SECS_TO_WDOG_TICKS(x) ((x) << 16) |
| 40 | 47 | #define WDOG_TICKS_TO_SECS(x) ((x) >> 16) |
| 41 | 48 | |
| @@ -151,8 +158,7 @@ static void bcm2835_power_off(void) · 109 unmodified lines | ||
| 151 | 158 | * hard reset. |
| 152 | 159 | */ |
| 153 | 160 | val = readl_relaxed(wdt->base + PM_RSTS); |
| 154 | − val &= PM_RSTC_WRCFG_CLR; | |
| 155 | − val |= PM_PASSWORD | PM_RSTS_HADWRH_SET; | |
| 161 | + val |= PM_PASSWORD | PM_RSTS_RASPBERRYPI_HALT; | |
| 156 | 162 | writel_relaxed(val, wdt->base + PM_RSTS); |
| 157 | 163 | |
| 158 | 164 | /* Continue with normal reset mechanism */ |
| @@ -303,6 +303,7 @@ static const struct of_device_id gef_wdt_ids[] = { · 302 unmodified lines | ||
| 303 | 303 | }, |
| 304 | 304 | {}, |
| 305 | 305 | }; |
| 306 | +MODULE_DEVICE_TABLE(of, gef_wdt_ids); | |
| 306 | 307 | |
| 307 | 308 | static struct platform_driver gef_wdt_driver = { |
| 308 | 309 | .driver = { |
| @@ -253,6 +253,7 @@ static const struct of_device_id a21_wdt_ids[] = { · 252 unmodified lines | ||
| 253 | 253 | { .compatible = "men,a021-wdt" }, |
| 254 | 254 | { }, |
| 255 | 255 | }; |
| 256 | +MODULE_DEVICE_TABLE(of, a21_wdt_ids); | |
| 256 | 257 | |
| 257 | 258 | static struct platform_driver a21_wdt_driver = { |
| 258 | 259 | .probe = a21_wdt_probe, |
| @@ -168,6 +168,7 @@ static const struct of_device_id moxart_watchdog_match[] = { · 167 unmodified lines | ||
| 168 | 168 | { .compatible = "moxa,moxart-watchdog" }, |
| 169 | 169 | { }, |
| 170 | 170 | }; |
| 171 | +MODULE_DEVICE_TABLE(of, moxart_watchdog_match); | |
| 171 | 172 | |
| 172 | 173 | static struct platform_driver moxart_wdt_driver = { |
| 173 | 174 | .probe = moxart_wdt_probe, |
| @@ -44,8 +44,6 @@ · 43 unmodified lines | ||
| 44 | 44 | #define BTRFS_INODE_IN_DELALLOC_LIST 9 |
| 45 | 45 | #define BTRFS_INODE_READDIO_NEED_LOCK 10 |
| 46 | 46 | #define BTRFS_INODE_HAS_PROPS 11 |
| 47 | −/* DIO is ready to submit */ | |
| 48 | −#define BTRFS_INODE_DIO_READY 12 | |
| 49 | 47 | /* |
| 50 | 48 | * The following 3 bits are meant only for the btree inode. |
| 51 | 49 | * When any of them is set, it means an error happened while writing an |
| @@ -3765,9 +3765,7 @@ void close_ctree(struct btrfs_root *root) · 3764 unmodified lines | ||
| 3765 | 3765 | * block groups queued for removal, the deletion will be |
| 3766 | 3766 | * skipped when we quit the cleaner thread. |
| 3767 | 3767 | */ |
| 3768 | − mutex_lock(&root->fs_info->cleaner_mutex); | |
| 3769 | 3768 | btrfs_delete_unused_bgs(root->fs_info); |
| 3770 | − mutex_unlock(&root->fs_info->cleaner_mutex); | |
| 3771 | 3769 | |
| 3772 | 3770 | ret = btrfs_commit_super(root); |
| 3773 | 3771 | if (ret) |
| @@ -3742,10 +3742,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, · 3741 unmodified lines | ||
| 3742 | 3742 | found->bytes_reserved = 0; |
| 3743 | 3743 | found->bytes_readonly = 0; |
| 3744 | 3744 | found->bytes_may_use = 0; |
| 3745 | − if (total_bytes > 0) | |
| 3746 | − found->full = 0; | |
| 3747 | − else | |
| 3748 | − found->full = 1; | |
| 3745 | + found->full = 0; | |
| 3749 | 3746 | found->force_alloc = CHUNK_ALLOC_NO_FORCE; |
| 3750 | 3747 | found->chunk_alloc = 0; |
| 3751 | 3748 | found->flush = 0; |
| @@ -8668,7 +8665,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, · 4916 unmodified lines | ||
| 8668 | 8665 | } |
| 8669 | 8666 | |
| 8670 | 8667 | if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state)) { |
| 8671 | − btrfs_drop_and_free_fs_root(tree_root->fs_info, root); | |
| 8668 | + btrfs_add_dropped_root(trans, root); | |
| 8672 | 8669 | } else { |
| 8673 | 8670 | free_extent_buffer(root->node); |
| 8674 | 8671 | free_extent_buffer(root->commit_root); |
| @@ -2798,7 +2798,8 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, · 2797 unmodified lines | ||
| 2798 | 2798 | bio_end_io_t end_io_func, |
| 2799 | 2799 | int mirror_num, |
| 2800 | 2800 | unsigned long prev_bio_flags, |
| 2801 | − unsigned long bio_flags) | |
| 2801 | + unsigned long bio_flags, | |
| 2802 | + bool force_bio_submit) | |
| 2802 | 2803 | { |
| 2803 | 2804 | int ret = 0; |
| 2804 | 2805 | struct bio *bio; |
| @@ -2814,6 +2815,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree, · 9 unmodified lines | ||
| 2814 | 2815 | contig = bio_end_sector(bio) == sector; |
| 2815 | 2816 | |
| 2816 | 2817 | if (prev_bio_flags != bio_flags || !contig || |
| 2818 | + force_bio_submit || | |
| 2817 | 2819 | merge_bio(rw, tree, page, offset, page_size, bio, bio_flags) || |
| 2818 | 2820 | bio_add_page(bio, page, page_size, offset) < page_size) { |
| 2819 | 2821 | ret = submit_one_bio(rw, bio, mirror_num, |
| @@ -2910,7 +2912,8 @@ static int __do_readpage(struct extent_io_tree *tree, · 90 unmodified lines | ||
| 2910 | 2912 | get_extent_t *get_extent, |
| 2911 | 2913 | struct extent_map **em_cached, |
| 2912 | 2914 | struct bio **bio, int mirror_num, |
| 2913 | − unsigned long *bio_flags, int rw) | |
| 2915 | + unsigned long *bio_flags, int rw, | |
| 2916 | + u64 *prev_em_start) | |
| 2914 | 2917 | { |
| 2915 | 2918 | struct inode *inode = page->mapping->host; |
| 2916 | 2919 | u64 start = page_offset(page); |
| @@ -2958,6 +2961,7 @@ static int __do_readpage(struct extent_io_tree *tree, · 41 unmodified lines | ||
| 2958 | 2961 | } |
| 2959 | 2962 | while (cur <= end) { |
| 2960 | 2963 | unsigned long pnr = (last_byte >> PAGE_CACHE_SHIFT) + 1; |
| 2964 | + bool force_bio_submit = false; | |
| 2961 | 2965 | |
| 2962 | 2966 | if (cur >= last_byte) { |
| 2963 | 2967 | char *userpage; |
| @@ -3008,6 +3012,49 @@ static int __do_readpage(struct extent_io_tree *tree, · 44 unmodified lines | ||
| 3008 | 3012 | block_start = em->block_start; |
| 3009 | 3013 | if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) |
| 3010 | 3014 | block_start = EXTENT_MAP_HOLE; |
| 3015 | + | |
| 3016 | + /* | |
| 3017 | + * If we have a file range that points to a compressed extent | |
| 3018 | + * and it's followed by a consecutive file range that points to | |
| 3019 | + * to the same compressed extent (possibly with a different | |
| 3020 | + * offset and/or length, so it either points to the whole extent | |
| 3021 | + * or only part of it), we must make sure we do not submit a | |
| 3022 | + * single bio to populate the pages for the 2 ranges because | |
| 3023 | + * this makes the compressed extent read zero out the pages | |
| 3024 | + * belonging to the 2nd range. Imagine the following scenario: | |
| 3025 | + * | |
| 3026 | + * File layout | |
| 3027 | + * [0 - 8K] [8K - 24K] | |
| 3028 | + * | | | |
| 3029 | + * | | | |
| 3030 | + * points to extent X, points to extent X, | |
| 3031 | + * offset 4K, length of 8K offset 0, length 16K | |
| 3032 | + * | |
| 3033 | + * [extent X, compressed length = 4K uncompressed length = 16K] | |
| 3034 | + * | |
| 3035 | + * If the bio to read the compressed extent covers both ranges, | |
| 3036 | + * it will decompress extent X into the pages belonging to the | |
| 3037 | + * first range and then it will stop, zeroing out the remaining | |
| 3038 | + * pages that belong to the other range that points to extent X. | |
| 3039 | + * So here we make sure we submit 2 bios, one for the first | |
| 3040 | + * range and another one for the third range. Both will target | |
| 3041 | + * the same physical extent from disk, but we can't currently | |
| 3042 | + * make the compressed bio endio callback populate the pages | |
| 3043 | + * for both ranges because each compressed bio is tightly | |
| 3044 | + * coupled with a single extent map, and each range can have | |
| 3045 | + * an extent map with a different offset value relative to the | |
| 3046 | + * uncompressed data of our extent and different lengths. This | |
| 3047 | + * is a corner case so we prioritize correctness over | |
| 3048 | + * non-optimal behavior (submitting 2 bios for the same extent). | |
| 3049 | + */ | |
| 3050 | + if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) && | |
| 3051 | + prev_em_start && *prev_em_start != (u64)-1 && | |
| 3052 | + *prev_em_start != em->orig_start) | |
| 3053 | + force_bio_submit = true; | |
| 3054 | + | |
| 3055 | + if (prev_em_start) | |
| 3056 | + *prev_em_start = em->orig_start; | |
| 3057 | + | |
| 3011 | 3058 | free_extent_map(em); |
| 3012 | 3059 | em = NULL; |
| 3013 | 3060 | |
| @@ -3057,7 +3104,8 @@ static int __do_readpage(struct extent_io_tree *tree, · 43 unmodified lines | ||
| 3057 | 3104 | bdev, bio, pnr, |
| 3058 | 3105 | end_bio_extent_readpage, mirror_num, |
| 3059 | 3106 | *bio_flags, |
| 3060 | − this_bio_flag); | |
| 3107 | + this_bio_flag, | |
| 3108 | + force_bio_submit); | |
| 3061 | 3109 | if (!ret) { |
| 3062 | 3110 | nr++; |
| 3063 | 3111 | *bio_flags = this_bio_flag; |
| @@ -3089,6 +3137,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree, · 25 unmodified lines | ||
| 3089 | 3137 | struct inode *inode; |
| 3090 | 3138 | struct btrfs_ordered_extent *ordered; |
| 3091 | 3139 | int index; |
| 3140 | + u64 prev_em_start = (u64)-1; | |
| 3092 | 3141 | |
| 3093 | 3142 | inode = pages[0]->mapping->host; |
| 3094 | 3143 | while (1) { |
| @@ -3104,7 +3153,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree, · 9 unmodified lines | ||
| 3104 | 3153 | |
| 3105 | 3154 | for (index = 0; index < nr_pages; index++) { |
| 3106 | 3155 | __do_readpage(tree, pages[index], get_extent, em_cached, bio, |
| 3107 | − mirror_num, bio_flags, rw); | |
| 3156 | + mirror_num, bio_flags, rw, &prev_em_start); | |
| 3108 | 3157 | page_cache_release(pages[index]); |
| 3109 | 3158 | } |
| 3110 | 3159 | } |
| @@ -3172,7 +3221,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, · 61 unmodified lines | ||
| 3172 | 3221 | } |
| 3173 | 3222 | |
| 3174 | 3223 | ret = __do_readpage(tree, page, get_extent, NULL, bio, mirror_num, |
| 3175 | − bio_flags, rw); | |
| 3224 | + bio_flags, rw, NULL); | |
| 3176 | 3225 | return ret; |
| 3177 | 3226 | } |
| 3178 | 3227 | |
| @@ -3198,7 +3247,7 @@ int extent_read_full_page_nolock(struct extent_io_tree *tree, struct page *page, · 19 unmodified lines | ||
| 3198 | 3247 | int ret; |
| 3199 | 3248 | |
| 3200 | 3249 | ret = __do_readpage(tree, page, get_extent, NULL, &bio, mirror_num, |
| 3201 | − &bio_flags, READ); | |
| 3250 | + &bio_flags, READ, NULL); | |
| 3202 | 3251 | if (bio) |
| 3203 | 3252 | ret = submit_one_bio(READ, bio, mirror_num, bio_flags); |
| 3204 | 3253 | return ret; |
| @@ -3451,7 +3500,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, · 246 unmodified lines | ||
| 3451 | 3500 | sector, iosize, pg_offset, |
| 3452 | 3501 | bdev, &epd->bio, max_nr, |
| 3453 | 3502 | end_bio_extent_writepage, |
| 3454 | − 0, 0, 0); | |
| 3503 | + 0, 0, 0, false); | |
| 3455 | 3504 | if (ret) |
| 3456 | 3505 | SetPageError(page); |
| 3457 | 3506 | } |
| @@ -3754,7 +3803,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb, · 296 unmodified lines | ||
| 3754 | 3803 | ret = submit_extent_page(rw, tree, wbc, p, offset >> 9, |
| 3755 | 3804 | PAGE_CACHE_SIZE, 0, bdev, &epd->bio, |
| 3756 | 3805 | -1, end_bio_extent_buffer_writepage, |
| 3757 | − 0, epd->bio_flags, bio_flags); | |
| 3806 | + 0, epd->bio_flags, bio_flags, false); | |
| 3758 | 3807 | epd->bio_flags = bio_flags; |
| 3759 | 3808 | if (ret) { |
| 3760 | 3809 | set_btree_ioerr(p); |
| @@ -5084,7 +5084,8 @@ void btrfs_evict_inode(struct inode *inode) · 5083 unmodified lines | ||
| 5084 | 5084 | goto no_delete; |
| 5085 | 5085 | } |
| 5086 | 5086 | /* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */ |
| 5087 | − btrfs_wait_ordered_range(inode, 0, (u64)-1); | |
| 5087 | + if (!special_file(inode->i_mode)) | |
| 5088 | + btrfs_wait_ordered_range(inode, 0, (u64)-1); | |
| 5088 | 5089 | |
| 5089 | 5090 | btrfs_free_io_failure_record(inode, 0, (u64)-1); |
| 5090 | 5091 | |
| @@ -7408,6 +7409,10 @@ static struct extent_map *create_pinned_em(struct inode *inode, u64 start, · 2317 unmodified lines | ||
| 7408 | 7409 | return em; |
| 7409 | 7410 | } |
| 7410 | 7411 | |
| 7412 | +struct btrfs_dio_data { | |
| 7413 | + u64 outstanding_extents; | |
| 7414 | + u64 reserve; | |
| 7415 | +}; | |
| 7411 | 7416 | |
| 7412 | 7417 | static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, |
| 7413 | 7418 | struct buffer_head *bh_result, int create) |
| @@ -7415,10 +7420,10 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, · 1 unmodified line | ||
| 7415 | 7420 | struct extent_map *em; |
| 7416 | 7421 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 7417 | 7422 | struct extent_state *cached_state = NULL; |
| 7423 | + struct btrfs_dio_data *dio_data = NULL; | |
| 7418 | 7424 | u64 start = iblock << inode->i_blkbits; |
| 7419 | 7425 | u64 lockstart, lockend; |
| 7420 | 7426 | u64 len = bh_result->b_size; |
| 7421 | − u64 *outstanding_extents = NULL; | |
| 7422 | 7427 | int unlock_bits = EXTENT_LOCKED; |
| 7423 | 7428 | int ret = 0; |
| 7424 | 7429 | |
| @@ -7436,7 +7441,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, · 11 unmodified lines | ||
| 7436 | 7441 | * that anything that needs to check if there's a transction doesn't get |
| 7437 | 7442 | * confused. |
| 7438 | 7443 | */ |
| 7439 | − outstanding_extents = current->journal_info; | |
| 7444 | + dio_data = current->journal_info; | |
| 7440 | 7445 | current->journal_info = NULL; |
| 7441 | 7446 | } |
| 7442 | 7447 | |
| @@ -7568,17 +7573,18 @@ unlock: · 125 unmodified lines | ||
| 7568 | 7573 | * within our reservation, otherwise we need to adjust our inode |
| 7569 | 7574 | * counter appropriately. |
| 7570 | 7575 | */ |
| 7571 | − if (*outstanding_extents) { | |
| 7572 | − (*outstanding_extents)--; | |
| 7576 | + if (dio_data->outstanding_extents) { | |
| 7577 | + (dio_data->outstanding_extents)--; | |
| 7573 | 7578 | } else { |
| 7574 | 7579 | spin_lock(&BTRFS_I(inode)->lock); |
| 7575 | 7580 | BTRFS_I(inode)->outstanding_extents++; |
| 7576 | 7581 | spin_unlock(&BTRFS_I(inode)->lock); |
| 7577 | 7582 | } |
| 7578 | 7583 | |
| 7579 | − current->journal_info = outstanding_extents; | |
| 7580 | 7584 | btrfs_free_reserved_data_space(inode, len); |
| 7581 | − set_bit(BTRFS_INODE_DIO_READY, &BTRFS_I(inode)->runtime_flags); | |
| 7585 | + WARN_ON(dio_data->reserve < len); | |
| 7586 | + dio_data->reserve -= len; | |
| 7587 | + current->journal_info = dio_data; | |
| 7582 | 7588 | } |
| 7583 | 7589 | |
| 7584 | 7590 | /* |
| @@ -7601,8 +7607,8 @@ unlock: · 16 unmodified lines | ||
| 7601 | 7607 | unlock_err: |
| 7602 | 7608 | clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend, |
| 7603 | 7609 | unlock_bits, 1, 0, &cached_state, GFP_NOFS); |
| 7604 | − if (outstanding_extents) | |
| 7605 | − current->journal_info = outstanding_extents; | |
| 7610 | + if (dio_data) | |
| 7611 | + current->journal_info = dio_data; | |
| 7606 | 7612 | return ret; |
| 7607 | 7613 | } |
| 7608 | 7614 | |
| @@ -8329,7 +8335,8 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 720 unmodified lines | ||
| 8329 | 8335 | { |
| 8330 | 8336 | struct file *file = iocb->ki_filp; |
| 8331 | 8337 | struct inode *inode = file->f_mapping->host; |
| 8332 | − u64 outstanding_extents = 0; | |
| 8338 | + struct btrfs_root *root = BTRFS_I(inode)->root; | |
| 8339 | + struct btrfs_dio_data dio_data = { 0 }; | |
| 8333 | 8340 | size_t count = 0; |
| 8334 | 8341 | int flags = 0; |
| 8335 | 8342 | bool wakeup = true; |
| @@ -8367,7 +8374,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 31 unmodified lines | ||
| 8367 | 8374 | ret = btrfs_delalloc_reserve_space(inode, count); |
| 8368 | 8375 | if (ret) |
| 8369 | 8376 | goto out; |
| 8370 | − outstanding_extents = div64_u64(count + | |
| 8377 | + dio_data.outstanding_extents = div64_u64(count + | |
| 8371 | 8378 | BTRFS_MAX_EXTENT_SIZE - 1, |
| 8372 | 8379 | BTRFS_MAX_EXTENT_SIZE); |
| 8373 | 8380 | |
| @@ -8376,7 +8383,8 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 2 unmodified lines | ||
| 8376 | 8383 | * do the accounting properly if we go over the number we |
| 8377 | 8384 | * originally calculated. Abuse current->journal_info for this. |
| 8378 | 8385 | */ |
| 8379 | − current->journal_info = &outstanding_extents; | |
| 8386 | + dio_data.reserve = round_up(count, root->sectorsize); | |
| 8387 | + current->journal_info = &dio_data; | |
| 8380 | 8388 | } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, |
| 8381 | 8389 | &BTRFS_I(inode)->runtime_flags)) { |
| 8382 | 8390 | inode_dio_end(inode); |
| @@ -8391,16 +8399,9 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 8 unmodified lines | ||
| 8391 | 8399 | if (iov_iter_rw(iter) == WRITE) { |
| 8392 | 8400 | current->journal_info = NULL; |
| 8393 | 8401 | if (ret < 0 && ret != -EIOCBQUEUED) { |
| 8394 | − /* | |
| 8395 | − * If the error comes from submitting stage, | |
| 8396 | − * btrfs_get_blocsk_direct() has free'd data space, | |
| 8397 | − * and metadata space will be handled by | |
| 8398 | − * finish_ordered_fn, don't do that again to make | |
| 8399 | − * sure bytes_may_use is correct. | |
| 8400 | − */ | |
| 8401 | − if (!test_and_clear_bit(BTRFS_INODE_DIO_READY, | |
| 8402 | − &BTRFS_I(inode)->runtime_flags)) | |
| 8403 | − btrfs_delalloc_release_space(inode, count); | |
| 8402 | + if (dio_data.reserve) | |
| 8403 | + btrfs_delalloc_release_space(inode, | |
| 8404 | + dio_data.reserve); | |
| 8404 | 8405 | } else if (ret >= 0 && (size_t)ret < count) |
| 8405 | 8406 | btrfs_delalloc_release_space(inode, |
| 8406 | 8407 | count - (size_t)ret); |
| @@ -1658,9 +1658,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) · 1657 unmodified lines | ||
| 1658 | 1658 | * groups on disk until we're mounted read-write again |
| 1659 | 1659 | * unless we clean them up here. |
| 1660 | 1660 | */ |
| 1661 | − mutex_lock(&root->fs_info->cleaner_mutex); | |
| 1662 | 1661 | btrfs_delete_unused_bgs(fs_info); |
| 1663 | − mutex_unlock(&root->fs_info->cleaner_mutex); | |
| 1664 | 1662 | |
| 1665 | 1663 | btrfs_dev_replace_suspend_for_unmount(fs_info); |
| 1666 | 1664 | btrfs_scrub_cancel(fs_info); |
| @@ -117,6 +117,18 @@ static noinline void switch_commit_roots(struct btrfs_transaction *trans, · 116 unmodified lines | ||
| 117 | 117 | btrfs_unpin_free_ino(root); |
| 118 | 118 | clear_btree_io_tree(&root->dirty_log_pages); |
| 119 | 119 | } |
| 120 | + | |
| 121 | + /* We can free old roots now. */ | |
| 122 | + spin_lock(&trans->dropped_roots_lock); | |
| 123 | + while (!list_empty(&trans->dropped_roots)) { | |
| 124 | + root = list_first_entry(&trans->dropped_roots, | |
| 125 | + struct btrfs_root, root_list); | |
| 126 | + list_del_init(&root->root_list); | |
| 127 | + spin_unlock(&trans->dropped_roots_lock); | |
| 128 | + btrfs_drop_and_free_fs_root(fs_info, root); | |
| 129 | + spin_lock(&trans->dropped_roots_lock); | |
| 130 | + } | |
| 131 | + spin_unlock(&trans->dropped_roots_lock); | |
| 120 | 132 | up_write(&fs_info->commit_root_sem); |
| 121 | 133 | } |
| 122 | 134 | |
| @@ -255,11 +267,13 @@ loop: · 132 unmodified lines | ||
| 255 | 267 | INIT_LIST_HEAD(&cur_trans->pending_ordered); |
| 256 | 268 | INIT_LIST_HEAD(&cur_trans->dirty_bgs); |
| 257 | 269 | INIT_LIST_HEAD(&cur_trans->io_bgs); |
| 270 | + INIT_LIST_HEAD(&cur_trans->dropped_roots); | |
| 258 | 271 | mutex_init(&cur_trans->cache_write_mutex); |
| 259 | 272 | cur_trans->num_dirty_bgs = 0; |
| 260 | 273 | spin_lock_init(&cur_trans->dirty_bgs_lock); |
| 261 | 274 | INIT_LIST_HEAD(&cur_trans->deleted_bgs); |
| 262 | 275 | spin_lock_init(&cur_trans->deleted_bgs_lock); |
| 276 | + spin_lock_init(&cur_trans->dropped_roots_lock); | |
| 263 | 277 | list_add_tail(&cur_trans->list, &fs_info->trans_list); |
| 264 | 278 | extent_io_tree_init(&cur_trans->dirty_pages, |
| 265 | 279 | fs_info->btree_inode->i_mapping); |
| @@ -336,6 +350,24 @@ static int record_root_in_trans(struct btrfs_trans_handle *trans, · 70 unmodified lines | ||
| 336 | 350 | } |
| 337 | 351 | |
| 338 | 352 | |
| 353 | +void btrfs_add_dropped_root(struct btrfs_trans_handle *trans, | |
| 354 | + struct btrfs_root *root) | |
| 355 | +{ | |
| 356 | + struct btrfs_transaction *cur_trans = trans->transaction; | |
| 357 | + | |
| 358 | + /* Add ourselves to the transaction dropped list */ | |
| 359 | + spin_lock(&cur_trans->dropped_roots_lock); | |
| 360 | + list_add_tail(&root->root_list, &cur_trans->dropped_roots); | |
| 361 | + spin_unlock(&cur_trans->dropped_roots_lock); | |
| 362 | + | |
| 363 | + /* Make sure we don't try to update the root at commit time */ | |
| 364 | + spin_lock(&root->fs_info->fs_roots_radix_lock); | |
| 365 | + radix_tree_tag_clear(&root->fs_info->fs_roots_radix, | |
| 366 | + (unsigned long)root->root_key.objectid, | |
| 367 | + BTRFS_ROOT_TRANS_TAG); | |
| 368 | + spin_unlock(&root->fs_info->fs_roots_radix_lock); | |
| 369 | +} | |
| 370 | + | |
| 339 | 371 | int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, |
| 340 | 372 | struct btrfs_root *root) |
| 341 | 373 | { |
| @@ -65,6 +65,7 @@ struct btrfs_transaction { · 64 unmodified lines | ||
| 65 | 65 | struct list_head switch_commits; |
| 66 | 66 | struct list_head dirty_bgs; |
| 67 | 67 | struct list_head io_bgs; |
| 68 | + struct list_head dropped_roots; | |
| 68 | 69 | u64 num_dirty_bgs; |
| 69 | 70 | |
| 70 | 71 | /* |
| @@ -76,6 +77,7 @@ struct btrfs_transaction { · 5 unmodified lines | ||
| 76 | 77 | spinlock_t dirty_bgs_lock; |
| 77 | 78 | struct list_head deleted_bgs; |
| 78 | 79 | spinlock_t deleted_bgs_lock; |
| 80 | + spinlock_t dropped_roots_lock; | |
| 79 | 81 | struct btrfs_delayed_ref_root delayed_refs; |
| 80 | 82 | int aborted; |
| 81 | 83 | int dirty_bg_run; |
| @@ -216,5 +218,6 @@ int btrfs_transaction_blocked(struct btrfs_fs_info *info); · 134 unmodified lines | ||
| 216 | 218 | int btrfs_transaction_in_commit(struct btrfs_fs_info *info); |
| 217 | 219 | void btrfs_put_transaction(struct btrfs_transaction *transaction); |
| 218 | 220 | void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info); |
| 219 | − | |
| 221 | +void btrfs_add_dropped_root(struct btrfs_trans_handle *trans, | |
| 222 | + struct btrfs_root *root); | |
| 220 | 223 | #endif |
| @@ -444,6 +444,48 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp) · 443 unmodified lines | ||
| 444 | 444 | return 0; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | +/* Server has provided av pairs/target info in the type 2 challenge | |
| 448 | + * packet and we have plucked it and stored within smb session. | |
| 449 | + * We parse that blob here to find the server given timestamp | |
| 450 | + * as part of ntlmv2 authentication (or local current time as | |
| 451 | + * default in case of failure) | |
| 452 | + */ | |
| 453 | +static __le64 | |
| 454 | +find_timestamp(struct cifs_ses *ses) | |
| 455 | +{ | |
| 456 | + unsigned int attrsize; | |
| 457 | + unsigned int type; | |
| 458 | + unsigned int onesize = sizeof(struct ntlmssp2_name); | |
| 459 | + unsigned char *blobptr; | |
| 460 | + unsigned char *blobend; | |
| 461 | + struct ntlmssp2_name *attrptr; | |
| 462 | + | |
| 463 | + if (!ses->auth_key.len || !ses->auth_key.response) | |
| 464 | + return 0; | |
| 465 | + | |
| 466 | + blobptr = ses->auth_key.response; | |
| 467 | + blobend = blobptr + ses->auth_key.len; | |
| 468 | + | |
| 469 | + while (blobptr + onesize < blobend) { | |
| 470 | + attrptr = (struct ntlmssp2_name *) blobptr; | |
| 471 | + type = le16_to_cpu(attrptr->type); | |
| 472 | + if (type == NTLMSSP_AV_EOL) | |
| 473 | + break; | |
| 474 | + blobptr += 2; /* advance attr type */ | |
| 475 | + attrsize = le16_to_cpu(attrptr->length); | |
| 476 | + blobptr += 2; /* advance attr size */ | |
| 477 | + if (blobptr + attrsize > blobend) | |
| 478 | + break; | |
| 479 | + if (type == NTLMSSP_AV_TIMESTAMP) { | |
| 480 | + if (attrsize == sizeof(u64)) | |
| 481 | + return *((__le64 *)blobptr); | |
| 482 | + } | |
| 483 | + blobptr += attrsize; /* advance attr value */ | |
| 484 | + } | |
| 485 | + | |
| 486 | + return cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | |
| 487 | +} | |
| 488 | + | |
| 447 | 489 | static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, |
| 448 | 490 | const struct nls_table *nls_cp) |
| 449 | 491 | { |
| @@ -641,6 +683,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) · 191 unmodified lines | ||
| 641 | 683 | struct ntlmv2_resp *ntlmv2; |
| 642 | 684 | char ntlmv2_hash[16]; |
| 643 | 685 | unsigned char *tiblob = NULL; /* target info blob */ |
| 686 | + __le64 rsp_timestamp; | |
| 644 | 687 | |
| 645 | 688 | if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) { |
| 646 | 689 | if (!ses->domainName) { |
| @@ -659,6 +702,12 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) · 12 unmodified lines | ||
| 659 | 702 | } |
| 660 | 703 | } |
| 661 | 704 | |
| 705 | + /* Must be within 5 minutes of the server (or in range +/-2h | |
| 706 | + * in case of Mac OS X), so simply carry over server timestamp | |
| 707 | + * (as Windows 7 does) | |
| 708 | + */ | |
| 709 | + rsp_timestamp = find_timestamp(ses); | |
| 710 | + | |
| 662 | 711 | baselen = CIFS_SESS_KEY_SIZE + sizeof(struct ntlmv2_resp); |
| 663 | 712 | tilen = ses->auth_key.len; |
| 664 | 713 | tiblob = ses->auth_key.response; |
| @@ -675,8 +724,8 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) · 10 unmodified lines | ||
| 675 | 724 | (ses->auth_key.response + CIFS_SESS_KEY_SIZE); |
| 676 | 725 | ntlmv2->blob_signature = cpu_to_le32(0x00000101); |
| 677 | 726 | ntlmv2->reserved = 0; |
| 678 | − /* Must be within 5 minutes of the server */ | |
| 679 | − ntlmv2->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | |
| 727 | + ntlmv2->time = rsp_timestamp; | |
| 728 | + | |
| 680 | 729 | get_random_bytes(&ntlmv2->client_chal, sizeof(ntlmv2->client_chal)); |
| 681 | 730 | ntlmv2->reserved2 = 0; |
| 682 | 731 | |
| @@ -50,9 +50,13 @@ change_conf(struct TCP_Server_Info *server) · 49 unmodified lines | ||
| 50 | 50 | break; |
| 51 | 51 | default: |
| 52 | 52 | server->echoes = true; |
| 53 | − server->oplocks = true; | |
| 53 | + if (enable_oplocks) { | |
| 54 | + server->oplocks = true; | |
| 55 | + server->oplock_credits = 1; | |
| 56 | + } else | |
| 57 | + server->oplocks = false; | |
| 58 | + | |
| 54 | 59 | server->echo_credits = 1; |
| 55 | − server->oplock_credits = 1; | |
| 56 | 60 | } |
| 57 | 61 | server->credits -= server->echo_credits + server->oplock_credits; |
| 58 | 62 | return 0; |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | #include "smb2status.h" |
| 47 | 47 | #include "smb2glob.h" |
| 48 | 48 | #include "cifspdu.h" |
| 49 | +#include "cifs_spnego.h" | |
| 49 | 50 | |
| 50 | 51 | /* |
| 51 | 52 | * The following table defines the expected "StructureSize" of SMB2 requests |
| @@ -486,19 +487,15 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) · 434 unmodified lines | ||
| 486 | 487 | cifs_dbg(FYI, "missing security blob on negprot\n"); |
| 487 | 488 | |
| 488 | 489 | rc = cifs_enable_signing(server, ses->sign); |
| 489 | −#ifdef CONFIG_SMB2_ASN1 /* BB REMOVEME when updated asn1.c ready */ | |
| 490 | 490 | if (rc) |
| 491 | 491 | goto neg_exit; |
| 492 | − if (blob_length) | |
| 492 | + if (blob_length) { | |
| 493 | 493 | rc = decode_negTokenInit(security_blob, blob_length, server); |
| 494 | − if (rc == 1) | |
| 495 | − rc = 0; | |
| 496 | − else if (rc == 0) { | |
| 497 | − rc = -EIO; | |
| 498 | − goto neg_exit; | |
| 494 | + if (rc == 1) | |
| 495 | + rc = 0; | |
| 496 | + else if (rc == 0) | |
| 497 | + rc = -EIO; | |
| 499 | 498 | } |
| 500 | −#endif | |
| 501 | − | |
| 502 | 499 | neg_exit: |
| 503 | 500 | free_rsp_buf(resp_buftype, rsp); |
| 504 | 501 | return rc; |
| @@ -592,7 +589,8 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, · 87 unmodified lines | ||
| 592 | 589 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ |
| 593 | 590 | struct TCP_Server_Info *server = ses->server; |
| 594 | 591 | u16 blob_length = 0; |
| 595 | − char *security_blob; | |
| 592 | + struct key *spnego_key = NULL; | |
| 593 | + char *security_blob = NULL; | |
| 596 | 594 | char *ntlmssp_blob = NULL; |
| 597 | 595 | bool use_spnego = false; /* else use raw ntlmssp */ |
| 598 | 596 | |
| @@ -620,7 +618,8 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, · 21 unmodified lines | ||
| 620 | 618 | ses->ntlmssp->sesskey_per_smbsess = true; |
| 621 | 619 | |
| 622 | 620 | /* FIXME: allow for other auth types besides NTLMSSP (e.g. krb5) */ |
| 623 | − ses->sectype = RawNTLMSSP; | |
| 621 | + if (ses->sectype != Kerberos && ses->sectype != RawNTLMSSP) | |
| 622 | + ses->sectype = RawNTLMSSP; | |
| 624 | 623 | |
| 625 | 624 | ssetup_ntlmssp_authenticate: |
| 626 | 625 | if (phase == NtLmChallenge) |
| @@ -649,7 +648,48 @@ ssetup_ntlmssp_authenticate: · 22 unmodified lines | ||
| 649 | 648 | iov[0].iov_base = (char *)req; |
| 650 | 649 | /* 4 for rfc1002 length field and 1 for pad */ |
| 651 | 650 | iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; |
| 652 | − if (phase == NtLmNegotiate) { | |
| 651 | + | |
| 652 | + if (ses->sectype == Kerberos) { | |
| 653 | +#ifdef CONFIG_CIFS_UPCALL | |
| 654 | + struct cifs_spnego_msg *msg; | |
| 655 | + | |
| 656 | + spnego_key = cifs_get_spnego_key(ses); | |
| 657 | + if (IS_ERR(spnego_key)) { | |
| 658 | + rc = PTR_ERR(spnego_key); | |
| 659 | + spnego_key = NULL; | |
| 660 | + goto ssetup_exit; | |
| 661 | + } | |
| 662 | + | |
| 663 | + msg = spnego_key->payload.data; | |
| 664 | + /* | |
| 665 | + * check version field to make sure that cifs.upcall is | |
| 666 | + * sending us a response in an expected form | |
| 667 | + */ | |
| 668 | + if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { | |
| 669 | + cifs_dbg(VFS, | |
| 670 | + "bad cifs.upcall version. Expected %d got %d", | |
| 671 | + CIFS_SPNEGO_UPCALL_VERSION, msg->version); | |
| 672 | + rc = -EKEYREJECTED; | |
| 673 | + goto ssetup_exit; | |
| 674 | + } | |
| 675 | + ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len, | |
| 676 | + GFP_KERNEL); | |
| 677 | + if (!ses->auth_key.response) { | |
| 678 | + cifs_dbg(VFS, | |
| 679 | + "Kerberos can't allocate (%u bytes) memory", | |
| 680 | + msg->sesskey_len); | |
| 681 | + rc = -ENOMEM; | |
| 682 | + goto ssetup_exit; | |
| 683 | + } | |
| 684 | + ses->auth_key.len = msg->sesskey_len; | |
| 685 | + blob_length = msg->secblob_len; | |
| 686 | + iov[1].iov_base = msg->data + msg->sesskey_len; | |
| 687 | + iov[1].iov_len = blob_length; | |
| 688 | +#else | |
| 689 | + rc = -EOPNOTSUPP; | |
| 690 | + goto ssetup_exit; | |
| 691 | +#endif /* CONFIG_CIFS_UPCALL */ | |
| 692 | + } else if (phase == NtLmNegotiate) { /* if not krb5 must be ntlmssp */ | |
| 653 | 693 | ntlmssp_blob = kmalloc(sizeof(struct _NEGOTIATE_MESSAGE), |
| 654 | 694 | GFP_KERNEL); |
| 655 | 695 | if (ntlmssp_blob == NULL) { |
| @@ -672,6 +712,8 @@ ssetup_ntlmssp_authenticate: · 16 unmodified lines | ||
| 672 | 712 | /* with raw NTLMSSP we don't encapsulate in SPNEGO */ |
| 673 | 713 | security_blob = ntlmssp_blob; |
| 674 | 714 | } |
| 715 | + iov[1].iov_base = security_blob; | |
| 716 | + iov[1].iov_len = blob_length; | |
| 675 | 717 | } else if (phase == NtLmAuthenticate) { |
| 676 | 718 | req->hdr.SessionId = ses->Suid; |
| 677 | 719 | ntlmssp_blob = kzalloc(sizeof(struct _NEGOTIATE_MESSAGE) + 500, |
| @@ -699,6 +741,8 @@ ssetup_ntlmssp_authenticate: · 21 unmodified lines | ||
| 699 | 741 | } else { |
| 700 | 742 | security_blob = ntlmssp_blob; |
| 701 | 743 | } |
| 744 | + iov[1].iov_base = security_blob; | |
| 745 | + iov[1].iov_len = blob_length; | |
| 702 | 746 | } else { |
| 703 | 747 | cifs_dbg(VFS, "illegal ntlmssp phase\n"); |
| 704 | 748 | rc = -EIO; |
| @@ -710,8 +754,6 @@ ssetup_ntlmssp_authenticate: · 5 unmodified lines | ||
| 710 | 754 | cpu_to_le16(sizeof(struct smb2_sess_setup_req) - |
| 711 | 755 | 1 /* pad */ - 4 /* rfc1001 len */); |
| 712 | 756 | req->SecurityBufferLength = cpu_to_le16(blob_length); |
| 713 | − iov[1].iov_base = security_blob; | |
| 714 | − iov[1].iov_len = blob_length; | |
| 715 | 757 | |
| 716 | 758 | inc_rfc1001_len(req, blob_length - 1 /* pad */); |
| 717 | 759 | |
| @@ -722,6 +764,7 @@ ssetup_ntlmssp_authenticate: · 4 unmodified lines | ||
| 722 | 764 | |
| 723 | 765 | kfree(security_blob); |
| 724 | 766 | rsp = (struct smb2_sess_setup_rsp *)iov[0].iov_base; |
| 767 | + ses->Suid = rsp->hdr.SessionId; | |
| 725 | 768 | if (resp_buftype != CIFS_NO_BUFFER && |
| 726 | 769 | rsp->hdr.Status == STATUS_MORE_PROCESSING_REQUIRED) { |
| 727 | 770 | if (phase != NtLmNegotiate) { |
| @@ -739,7 +782,6 @@ ssetup_ntlmssp_authenticate: · 11 unmodified lines | ||
| 739 | 782 | /* NTLMSSP Negotiate sent now processing challenge (response) */ |
| 740 | 783 | phase = NtLmChallenge; /* process ntlmssp challenge */ |
| 741 | 784 | rc = 0; /* MORE_PROCESSING is not an error here but expected */ |
| 742 | − ses->Suid = rsp->hdr.SessionId; | |
| 743 | 785 | rc = decode_ntlmssp_challenge(rsp->Buffer, |
| 744 | 786 | le16_to_cpu(rsp->SecurityBufferLength), ses); |
| 745 | 787 | } |
| @@ -796,6 +838,10 @@ keygen_exit: · 50 unmodified lines | ||
| 796 | 838 | kfree(ses->auth_key.response); |
| 797 | 839 | ses->auth_key.response = NULL; |
| 798 | 840 | } |
| 841 | + if (spnego_key) { | |
| 842 | + key_invalidate(spnego_key); | |
| 843 | + key_put(spnego_key); | |
| 844 | + } | |
| 799 | 845 | kfree(ses->ntlmssp); |
| 800 | 846 | |
| 801 | 847 | return rc; |
| @@ -876,6 +922,12 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, · 74 unmodified lines | ||
| 876 | 922 | if (tcon && tcon->bad_network_name) |
| 877 | 923 | return -ENOENT; |
| 878 | 924 | |
| 925 | + if ((tcon->seal) && | |
| 926 | + ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) { | |
| 927 | + cifs_dbg(VFS, "encryption requested but no server support"); | |
| 928 | + return -EOPNOTSUPP; | |
| 929 | + } | |
| 930 | + | |
| 879 | 931 | unc_path = kmalloc(MAX_SHARENAME_LENGTH * 2, GFP_KERNEL); |
| 880 | 932 | if (unc_path == NULL) |
| 881 | 933 | return -ENOMEM; |
| @@ -955,6 +1007,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, · 73 unmodified lines | ||
| 955 | 1007 | ((tcon->share_flags & SHI1005_FLAGS_DFS) == 0)) |
| 956 | 1008 | cifs_dbg(VFS, "DFS capability contradicts DFS flag\n"); |
| 957 | 1009 | init_copy_chunk_defaults(tcon); |
| 1010 | + if (tcon->share_flags & SHI1005_FLAGS_ENCRYPT_DATA) | |
| 1011 | + cifs_dbg(VFS, "Encrypted shares not supported"); | |
| 958 | 1012 | if (tcon->ses->server->ops->validate_negotiate) |
| 959 | 1013 | rc = tcon->ses->server->ops->validate_negotiate(xid, tcon); |
| 960 | 1014 | tcon_exit: |
| @@ -569,8 +569,20 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, · 568 unmodified lines | ||
| 569 | 569 | if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) |
| 570 | 570 | goto fallback; |
| 571 | 571 | |
| 572 | + sector = bh.b_blocknr << (blkbits - 9); | |
| 573 | + | |
| 572 | 574 | if (buffer_unwritten(&bh) || buffer_new(&bh)) { |
| 573 | 575 | int i; |
| 576 | + | |
| 577 | + length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn, | |
| 578 | + bh.b_size); | |
| 579 | + if (length < 0) { | |
| 580 | + result = VM_FAULT_SIGBUS; | |
| 581 | + goto out; | |
| 582 | + } | |
| 583 | + if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR)) | |
| 584 | + goto fallback; | |
| 585 | + | |
| 574 | 586 | for (i = 0; i < PTRS_PER_PMD; i++) |
| 575 | 587 | clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE); |
| 576 | 588 | wmb_pmem(); |
| @@ -623,7 +635,6 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address, · 46 unmodified lines | ||
| 623 | 635 | result = VM_FAULT_NOPAGE; |
| 624 | 636 | spin_unlock(ptl); |
| 625 | 637 | } else { |
| 626 | − sector = bh.b_blocknr << (blkbits - 9); | |
| 627 | 638 | length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn, |
| 628 | 639 | bh.b_size); |
| 629 | 640 | if (length < 0) { |
| @@ -113,7 +113,8 @@ out: · 112 unmodified lines | ||
| 113 | 113 | return status; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | −static int nfs_delegation_claim_opens(struct inode *inode, const nfs4_stateid *stateid) | |
| 116 | +static int nfs_delegation_claim_opens(struct inode *inode, | |
| 117 | + const nfs4_stateid *stateid, fmode_t type) | |
| 117 | 118 | { |
| 118 | 119 | struct nfs_inode *nfsi = NFS_I(inode); |
| 119 | 120 | struct nfs_open_context *ctx; |
| @@ -140,7 +141,7 @@ again: · 20 unmodified lines | ||
| 140 | 141 | /* Block nfs4_proc_unlck */ |
| 141 | 142 | mutex_lock(&sp->so_delegreturn_mutex); |
| 142 | 143 | seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); |
| 143 | − err = nfs4_open_delegation_recall(ctx, state, stateid); | |
| 144 | + err = nfs4_open_delegation_recall(ctx, state, stateid, type); | |
| 144 | 145 | if (!err) |
| 145 | 146 | err = nfs_delegation_claim_locks(ctx, state, stateid); |
| 146 | 147 | if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) |
| @@ -411,7 +412,8 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation · 264 unmodified lines | ||
| 411 | 412 | do { |
| 412 | 413 | if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) |
| 413 | 414 | break; |
| 414 | − err = nfs_delegation_claim_opens(inode, &delegation->stateid); | |
| 415 | + err = nfs_delegation_claim_opens(inode, &delegation->stateid, | |
| 416 | + delegation->type); | |
| 415 | 417 | if (!issync || err != -EAGAIN) |
| 416 | 418 | break; |
| 417 | 419 | /* |
| @@ -54,7 +54,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp); · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | /* NFSv4 delegation-related procedures */ |
| 56 | 56 | int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync); |
| 57 | −int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid); | |
| 57 | +int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid, fmode_t type); | |
| 58 | 58 | int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid); |
| 59 | 59 | bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags); |
| 60 | 60 | |
| @@ -166,8 +166,11 @@ nfs_direct_select_verf(struct nfs_direct_req *dreq, · 165 unmodified lines | ||
| 166 | 166 | struct nfs_writeverf *verfp = &dreq->verf; |
| 167 | 167 | |
| 168 | 168 | #ifdef CONFIG_NFS_V4_1 |
| 169 | − if (ds_clp) { | |
| 170 | − /* pNFS is in use, use the DS verf */ | |
| 169 | + /* | |
| 170 | + * pNFS is in use, use the DS verf except commit_through_mds is set | |
| 171 | + * for layout segment where nbuckets is zero. | |
| 172 | + */ | |
| 173 | + if (ds_clp && dreq->ds_cinfo.nbuckets > 0) { | |
| 171 | 174 | if (commit_idx >= 0 && commit_idx < dreq->ds_cinfo.nbuckets) |
| 172 | 175 | verfp = &dreq->ds_cinfo.buckets[commit_idx].direct_verf; |
| 173 | 176 | else |
| @@ -629,23 +629,18 @@ out_put: · 628 unmodified lines | ||
| 629 | 629 | goto out; |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | −static void filelayout_free_fh_array(struct nfs4_filelayout_segment *fl) | |
| 632 | +static void _filelayout_free_lseg(struct nfs4_filelayout_segment *fl) | |
| 633 | 633 | { |
| 634 | 634 | int i; |
| 635 | 635 | |
| 636 | − for (i = 0; i < fl->num_fh; i++) { | |
| 637 | − if (!fl->fh_array[i]) | |
| 638 | − break; | |
| 639 | − kfree(fl->fh_array[i]); | |
| 636 | + if (fl->fh_array) { | |
| 637 | + for (i = 0; i < fl->num_fh; i++) { | |
| 638 | + if (!fl->fh_array[i]) | |
| 639 | + break; | |
| 640 | + kfree(fl->fh_array[i]); | |
| 641 | + } | |
| 642 | + kfree(fl->fh_array); | |
| 640 | 643 | } |
| 641 | − kfree(fl->fh_array); | |
| 642 | − fl->fh_array = NULL; | |
| 643 | −} | |
| 644 | − | |
| 645 | −static void | |
| 646 | −_filelayout_free_lseg(struct nfs4_filelayout_segment *fl) | |
| 647 | −{ | |
| 648 | − filelayout_free_fh_array(fl); | |
| 649 | 644 | kfree(fl); |
| 650 | 645 | } |
| 651 | 646 | |
| @@ -716,21 +711,21 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, · 64 unmodified lines | ||
| 716 | 711 | /* Do we want to use a mempool here? */ |
| 717 | 712 | fl->fh_array[i] = kmalloc(sizeof(struct nfs_fh), gfp_flags); |
| 718 | 713 | if (!fl->fh_array[i]) |
| 719 | − goto out_err_free; | |
| 714 | + goto out_err; | |
| 720 | 715 | |
| 721 | 716 | p = xdr_inline_decode(&stream, 4); |
| 722 | 717 | if (unlikely(!p)) |
| 723 | − goto out_err_free; | |
| 718 | + goto out_err; | |
| 724 | 719 | fl->fh_array[i]->size = be32_to_cpup(p++); |
| 725 | 720 | if (sizeof(struct nfs_fh) < fl->fh_array[i]->size) { |
| 726 | 721 | printk(KERN_ERR "NFS: Too big fh %d received %d\n", |
| 727 | 722 | i, fl->fh_array[i]->size); |
| 728 | − goto out_err_free; | |
| 723 | + goto out_err; | |
| 729 | 724 | } |
| 730 | 725 | |
| 731 | 726 | p = xdr_inline_decode(&stream, fl->fh_array[i]->size); |
| 732 | 727 | if (unlikely(!p)) |
| 733 | − goto out_err_free; | |
| 728 | + goto out_err; | |
| 734 | 729 | memcpy(fl->fh_array[i]->data, p, fl->fh_array[i]->size); |
| 735 | 730 | dprintk("DEBUG: %s: fh len %d\n", __func__, |
| 736 | 731 | fl->fh_array[i]->size); |
| @@ -739,8 +734,6 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, · 2 unmodified lines | ||
| 739 | 734 | __free_page(scratch); |
| 740 | 735 | return 0; |
| 741 | 736 | |
| 742 | −out_err_free: | |
| 743 | − filelayout_free_fh_array(fl); | |
| 744 | 737 | out_err: |
| 745 | 738 | __free_page(scratch); |
| 746 | 739 | return -EIO; |
| @@ -175,10 +175,12 @@ loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence) · 174 unmodified lines | ||
| 175 | 175 | { |
| 176 | 176 | struct nfs_server *server = NFS_SERVER(file_inode(filep)); |
| 177 | 177 | struct nfs4_exception exception = { }; |
| 178 | − int err; | |
| 178 | + loff_t err; | |
| 179 | 179 | |
| 180 | 180 | do { |
| 181 | 181 | err = _nfs42_proc_llseek(filep, offset, whence); |
| 182 | + if (err >= 0) | |
| 183 | + break; | |
| 182 | 184 | if (err == -ENOTSUPP) |
| 183 | 185 | return -EOPNOTSUPP; |
| 184 | 186 | err = nfs4_handle_exception(server, err, &exception); |
| @@ -1127,6 +1127,21 @@ static int nfs4_wait_for_completion_rpc_task(struct rpc_task *task) · 1126 unmodified lines | ||
| 1127 | 1127 | return ret; |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | +static bool nfs4_mode_match_open_stateid(struct nfs4_state *state, | |
| 1131 | + fmode_t fmode) | |
| 1132 | +{ | |
| 1133 | + switch(fmode & (FMODE_READ|FMODE_WRITE)) { | |
| 1134 | + case FMODE_READ|FMODE_WRITE: | |
| 1135 | + return state->n_rdwr != 0; | |
| 1136 | + case FMODE_WRITE: | |
| 1137 | + return state->n_wronly != 0; | |
| 1138 | + case FMODE_READ: | |
| 1139 | + return state->n_rdonly != 0; | |
| 1140 | + } | |
| 1141 | + WARN_ON_ONCE(1); | |
| 1142 | + return false; | |
| 1143 | +} | |
| 1144 | + | |
| 1130 | 1145 | static int can_open_cached(struct nfs4_state *state, fmode_t mode, int open_mode) |
| 1131 | 1146 | { |
| 1132 | 1147 | int ret = 0; |
| @@ -1571,17 +1586,13 @@ static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context · 438 unmodified lines | ||
| 1571 | 1586 | return opendata; |
| 1572 | 1587 | } |
| 1573 | 1588 | |
| 1574 | −static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, fmode_t fmode, struct nfs4_state **res) | |
| 1589 | +static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, | |
| 1590 | + fmode_t fmode) | |
| 1575 | 1591 | { |
| 1576 | 1592 | struct nfs4_state *newstate; |
| 1577 | 1593 | int ret; |
| 1578 | 1594 | |
| 1579 | − if ((opendata->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR || | |
| 1580 | − opendata->o_arg.claim == NFS4_OPEN_CLAIM_DELEG_CUR_FH) && | |
| 1581 | − (opendata->o_arg.u.delegation_type & fmode) != fmode) | |
| 1582 | − /* This mode can't have been delegated, so we must have | |
| 1583 | − * a valid open_stateid to cover it - not need to reclaim. | |
| 1584 | − */ | |
| 1595 | + if (!nfs4_mode_match_open_stateid(opendata->state, fmode)) | |
| 1585 | 1596 | return 0; |
| 1586 | 1597 | opendata->o_arg.open_flags = 0; |
| 1587 | 1598 | opendata->o_arg.fmode = fmode; |
| @@ -1597,14 +1608,14 @@ static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, fmode_t fmod · 9 unmodified lines | ||
| 1597 | 1608 | newstate = nfs4_opendata_to_nfs4_state(opendata); |
| 1598 | 1609 | if (IS_ERR(newstate)) |
| 1599 | 1610 | return PTR_ERR(newstate); |
| 1611 | + if (newstate != opendata->state) | |
| 1612 | + ret = -ESTALE; | |
| 1600 | 1613 | nfs4_close_state(newstate, fmode); |
| 1601 | − *res = newstate; | |
| 1602 | − return 0; | |
| 1614 | + return ret; | |
| 1603 | 1615 | } |
| 1604 | 1616 | |
| 1605 | 1617 | static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state *state) |
| 1606 | 1618 | { |
| 1607 | − struct nfs4_state *newstate; | |
| 1608 | 1619 | int ret; |
| 1609 | 1620 | |
| 1610 | 1621 | /* Don't trigger recovery in nfs_test_and_clear_all_open_stateid */ |
| @@ -1615,27 +1626,15 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * · 4 unmodified lines | ||
| 1615 | 1626 | clear_bit(NFS_DELEGATED_STATE, &state->flags); |
| 1616 | 1627 | clear_bit(NFS_OPEN_STATE, &state->flags); |
| 1617 | 1628 | smp_rmb(); |
| 1618 | − if (state->n_rdwr != 0) { | |
| 1619 | − ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); | |
| 1620 | − if (ret != 0) | |
| 1621 | − return ret; | |
| 1622 | − if (newstate != state) | |
| 1623 | − return -ESTALE; | |
| 1624 | − } | |
| 1625 | − if (state->n_wronly != 0) { | |
| 1626 | − ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); | |
| 1627 | − if (ret != 0) | |
| 1628 | − return ret; | |
| 1629 | − if (newstate != state) | |
| 1630 | − return -ESTALE; | |
| 1631 | − } | |
| 1632 | − if (state->n_rdonly != 0) { | |
| 1633 | − ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); | |
| 1634 | − if (ret != 0) | |
| 1635 | − return ret; | |
| 1636 | − if (newstate != state) | |
| 1637 | − return -ESTALE; | |
| 1638 | − } | |
| 1629 | + ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE); | |
| 1630 | + if (ret != 0) | |
| 1631 | + return ret; | |
| 1632 | + ret = nfs4_open_recover_helper(opendata, FMODE_WRITE); | |
| 1633 | + if (ret != 0) | |
| 1634 | + return ret; | |
| 1635 | + ret = nfs4_open_recover_helper(opendata, FMODE_READ); | |
| 1636 | + if (ret != 0) | |
| 1637 | + return ret; | |
| 1639 | 1638 | /* |
| 1640 | 1639 | * We may have performed cached opens for all three recoveries. |
| 1641 | 1640 | * Check if we need to update the current stateid. |
| @@ -1759,18 +1758,32 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct · 117 unmodified lines | ||
| 1759 | 1758 | return err; |
| 1760 | 1759 | } |
| 1761 | 1760 | |
| 1762 | −int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) | |
| 1761 | +int nfs4_open_delegation_recall(struct nfs_open_context *ctx, | |
| 1762 | + struct nfs4_state *state, const nfs4_stateid *stateid, | |
| 1763 | + fmode_t type) | |
| 1763 | 1764 | { |
| 1764 | 1765 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 1765 | 1766 | struct nfs4_opendata *opendata; |
| 1766 | − int err; | |
| 1767 | + int err = 0; | |
| 1767 | 1768 | |
| 1768 | 1769 | opendata = nfs4_open_recoverdata_alloc(ctx, state, |
| 1769 | 1770 | NFS4_OPEN_CLAIM_DELEG_CUR_FH); |
| 1770 | 1771 | if (IS_ERR(opendata)) |
| 1771 | 1772 | return PTR_ERR(opendata); |
| 1772 | 1773 | nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); |
| 1773 | − err = nfs4_open_recover(opendata, state); | |
| 1774 | + clear_bit(NFS_DELEGATED_STATE, &state->flags); | |
| 1775 | + switch (type & (FMODE_READ|FMODE_WRITE)) { | |
| 1776 | + case FMODE_READ|FMODE_WRITE: | |
| 1777 | + case FMODE_WRITE: | |
| 1778 | + err = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE); | |
| 1779 | + if (err) | |
| 1780 | + break; | |
| 1781 | + err = nfs4_open_recover_helper(opendata, FMODE_WRITE); | |
| 1782 | + if (err) | |
| 1783 | + break; | |
| 1784 | + case FMODE_READ: | |
| 1785 | + err = nfs4_open_recover_helper(opendata, FMODE_READ); | |
| 1786 | + } | |
| 1774 | 1787 | nfs4_opendata_put(opendata); |
| 1775 | 1788 | return nfs4_handle_delegation_recall_error(server, state, stateid, err); |
| 1776 | 1789 | } |
| @@ -2645,6 +2658,15 @@ out: · 868 unmodified lines | ||
| 2645 | 2658 | return err; |
| 2646 | 2659 | } |
| 2647 | 2660 | |
| 2661 | +static bool | |
| 2662 | +nfs4_wait_on_layoutreturn(struct inode *inode, struct rpc_task *task) | |
| 2663 | +{ | |
| 2664 | + if (inode == NULL || !nfs_have_layout(inode)) | |
| 2665 | + return false; | |
| 2666 | + | |
| 2667 | + return pnfs_wait_on_layoutreturn(inode, task); | |
| 2668 | +} | |
| 2669 | + | |
| 2648 | 2670 | struct nfs4_closedata { |
| 2649 | 2671 | struct inode *inode; |
| 2650 | 2672 | struct nfs4_state *state; |
| @@ -2763,6 +2785,11 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) · 112 unmodified lines | ||
| 2763 | 2785 | goto out_no_action; |
| 2764 | 2786 | } |
| 2765 | 2787 | |
| 2788 | + if (nfs4_wait_on_layoutreturn(inode, task)) { | |
| 2789 | + nfs_release_seqid(calldata->arg.seqid); | |
| 2790 | + goto out_wait; | |
| 2791 | + } | |
| 2792 | + | |
| 2766 | 2793 | if (calldata->arg.fmode == 0) |
| 2767 | 2794 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; |
| 2768 | 2795 | if (calldata->roc) |
| @@ -5308,6 +5335,9 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) · 2539 unmodified lines | ||
| 5308 | 5335 | |
| 5309 | 5336 | d_data = (struct nfs4_delegreturndata *)data; |
| 5310 | 5337 | |
| 5338 | + if (nfs4_wait_on_layoutreturn(d_data->inode, task)) | |
| 5339 | + return; | |
| 5340 | + | |
| 5311 | 5341 | if (d_data->roc) |
| 5312 | 5342 | pnfs_roc_get_barrier(d_data->inode, &d_data->roc_barrier); |
| 5313 | 5343 | |
| @@ -7800,39 +7830,46 @@ static void nfs4_layoutget_done(struct rpc_task *task, void *calldata) · 2486 unmodified lines | ||
| 7800 | 7830 | dprintk("%s: NFS4ERR_RECALLCONFLICT waiting %lu\n", |
| 7801 | 7831 | __func__, delay); |
| 7802 | 7832 | rpc_delay(task, delay); |
| 7803 | − task->tk_status = 0; | |
| 7804 | − rpc_restart_call_prepare(task); | |
| 7805 | − goto out; /* Do not call nfs4_async_handle_error() */ | |
| 7833 | + /* Do not call nfs4_async_handle_error() */ | |
| 7834 | + goto out_restart; | |
| 7806 | 7835 | } |
| 7807 | 7836 | break; |
| 7808 | 7837 | case -NFS4ERR_EXPIRED: |
| 7809 | 7838 | case -NFS4ERR_BAD_STATEID: |
| 7810 | 7839 | spin_lock(&inode->i_lock); |
| 7811 | − lo = NFS_I(inode)->layout; | |
| 7812 | − if (!lo || list_empty(&lo->plh_segs)) { | |
| 7840 | + if (nfs4_stateid_match(&lgp->args.stateid, | |
| 7841 | + &lgp->args.ctx->state->stateid)) { | |
| 7813 | 7842 | spin_unlock(&inode->i_lock); |
| 7814 | 7843 | /* If the open stateid was bad, then recover it. */ |
| 7815 | 7844 | state = lgp->args.ctx->state; |
| 7816 | − } else { | |
| 7845 | + break; | |
| 7846 | + } | |
| 7847 | + lo = NFS_I(inode)->layout; | |
| 7848 | + if (lo && nfs4_stateid_match(&lgp->args.stateid, | |
| 7849 | + &lo->plh_stateid)) { | |
| 7817 | 7850 | LIST_HEAD(head); |
| 7818 | 7851 | |
| 7819 | 7852 | /* |
| 7820 | 7853 | * Mark the bad layout state as invalid, then retry |
| 7821 | 7854 | * with the current stateid. |
| 7822 | 7855 | */ |
| 7856 | + set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | |
| 7823 | 7857 | pnfs_mark_matching_lsegs_invalid(lo, &head, NULL); |
| 7824 | 7858 | spin_unlock(&inode->i_lock); |
| 7825 | 7859 | pnfs_free_lseg_list(&head); |
| 7826 | − | |
| 7827 | − task->tk_status = 0; | |
| 7828 | − rpc_restart_call_prepare(task); | |
| 7829 | − } | |
| 7860 | + } else | |
| 7861 | + spin_unlock(&inode->i_lock); | |
| 7862 | + goto out_restart; | |
| 7830 | 7863 | } |
| 7831 | 7864 | if (nfs4_async_handle_error(task, server, state, NULL) == -EAGAIN) |
| 7832 | − rpc_restart_call_prepare(task); | |
| 7865 | + goto out_restart; | |
| 7833 | 7866 | out: |
| 7834 | 7867 | dprintk("<-- %s\n", __func__); |
| 7835 | 7868 | return; |
| 7869 | +out_restart: | |
| 7870 | + task->tk_status = 0; | |
| 7871 | + rpc_restart_call_prepare(task); | |
| 7872 | + return; | |
| 7836 | 7873 | out_overflow: |
| 7837 | 7874 | task->tk_status = -EOVERFLOW; |
| 7838 | 7875 | goto out; |
| @@ -1481,7 +1481,7 @@ restart: · 1480 unmodified lines | ||
| 1481 | 1481 | spin_unlock(&state->state_lock); |
| 1482 | 1482 | } |
| 1483 | 1483 | nfs4_put_open_state(state); |
| 1484 | − clear_bit(NFS4CLNT_RECLAIM_NOGRACE, | |
| 1484 | + clear_bit(NFS_STATE_RECLAIM_NOGRACE, | |
| 1485 | 1485 | &state->flags); |
| 1486 | 1486 | spin_lock(&sp->so_lock); |
| 1487 | 1487 | goto restart; |
| @@ -508,7 +508,7 @@ size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, · 507 unmodified lines | ||
| 508 | 508 | * for it without upsetting the slab allocator. |
| 509 | 509 | */ |
| 510 | 510 | if (((mirror->pg_count + req->wb_bytes) >> PAGE_SHIFT) * |
| 511 | − sizeof(struct page) > PAGE_SIZE) | |
| 511 | + sizeof(struct page *) > PAGE_SIZE) | |
| 512 | 512 | return 0; |
| 513 | 513 | |
| 514 | 514 | return min(mirror->pg_bsize - mirror->pg_count, (size_t)req->wb_bytes); |
| @@ -1104,20 +1104,15 @@ bool pnfs_roc(struct inode *ino) · 1103 unmodified lines | ||
| 1104 | 1104 | mark_lseg_invalid(lseg, &tmp_list); |
| 1105 | 1105 | found = true; |
| 1106 | 1106 | } |
| 1107 | − /* pnfs_prepare_layoutreturn() grabs lo ref and it will be put | |
| 1108 | − * in pnfs_roc_release(). We don't really send a layoutreturn but | |
| 1109 | − * still want others to view us like we are sending one! | |
| 1110 | − * | |
| 1111 | − * If pnfs_prepare_layoutreturn() fails, it means someone else is doing | |
| 1112 | − * LAYOUTRETURN, so we proceed like there are no layouts to return. | |
| 1113 | − * | |
| 1114 | − * ROC in three conditions: | |
| 1107 | + /* ROC in two conditions: | |
| 1115 | 1108 | * 1. there are ROC lsegs |
| 1116 | 1109 | * 2. we don't send layoutreturn |
| 1117 | − * 3. no others are sending layoutreturn | |
| 1118 | 1110 | */ |
| 1119 | − if (found && !layoutreturn && pnfs_prepare_layoutreturn(lo)) | |
| 1111 | + if (found && !layoutreturn) { | |
| 1112 | + /* lo ref dropped in pnfs_roc_release() */ | |
| 1113 | + pnfs_get_layout_hdr(lo); | |
| 1120 | 1114 | roc = true; |
| 1115 | + } | |
| 1121 | 1116 | |
| 1122 | 1117 | out_noroc: |
| 1123 | 1118 | spin_unlock(&ino->i_lock); |
| @@ -1172,6 +1167,26 @@ void pnfs_roc_get_barrier(struct inode *ino, u32 *barrier) · 48 unmodified lines | ||
| 1172 | 1167 | spin_unlock(&ino->i_lock); |
| 1173 | 1168 | } |
| 1174 | 1169 | |
| 1170 | +bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task) | |
| 1171 | +{ | |
| 1172 | + struct nfs_inode *nfsi = NFS_I(ino); | |
| 1173 | + struct pnfs_layout_hdr *lo; | |
| 1174 | + bool sleep = false; | |
| 1175 | + | |
| 1176 | + /* we might not have grabbed lo reference. so need to check under | |
| 1177 | + * i_lock */ | |
| 1178 | + spin_lock(&ino->i_lock); | |
| 1179 | + lo = nfsi->layout; | |
| 1180 | + if (lo && test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | |
| 1181 | + sleep = true; | |
| 1182 | + spin_unlock(&ino->i_lock); | |
| 1183 | + | |
| 1184 | + if (sleep) | |
| 1185 | + rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); | |
| 1186 | + | |
| 1187 | + return sleep; | |
| 1188 | +} | |
| 1189 | + | |
| 1175 | 1190 | /* |
| 1176 | 1191 | * Compare two layout segments for sorting into layout cache. |
| 1177 | 1192 | * We want to preferentially return RW over RO layouts, so ensure those |
| @@ -270,6 +270,7 @@ bool pnfs_roc(struct inode *ino); · 269 unmodified lines | ||
| 270 | 270 | void pnfs_roc_release(struct inode *ino); |
| 271 | 271 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); |
| 272 | 272 | void pnfs_roc_get_barrier(struct inode *ino, u32 *barrier); |
| 273 | +bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task); | |
| 273 | 274 | void pnfs_set_layoutcommit(struct inode *, struct pnfs_layout_segment *, loff_t); |
| 274 | 275 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); |
| 275 | 276 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); |
| @@ -639,6 +640,12 @@ pnfs_roc_get_barrier(struct inode *ino, u32 *barrier) · 363 unmodified lines | ||
| 639 | 640 | { |
| 640 | 641 | } |
| 641 | 642 | |
| 643 | +static inline bool | |
| 644 | +pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task) | |
| 645 | +{ | |
| 646 | + return false; | |
| 647 | +} | |
| 648 | + | |
| 642 | 649 | static inline void set_pnfs_layoutdriver(struct nfs_server *s, |
| 643 | 650 | const struct nfs_fh *mntfh, u32 id) |
| 644 | 651 | { |
| @@ -72,6 +72,9 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio) · 71 unmodified lines | ||
| 72 | 72 | { |
| 73 | 73 | struct nfs_pgio_mirror *mirror; |
| 74 | 74 | |
| 75 | + if (pgio->pg_ops && pgio->pg_ops->pg_cleanup) | |
| 76 | + pgio->pg_ops->pg_cleanup(pgio); | |
| 77 | + | |
| 75 | 78 | pgio->pg_ops = &nfs_pgio_rw_ops; |
| 76 | 79 | |
| 77 | 80 | /* read path should never have more than one mirror */ |
| @@ -1351,6 +1351,9 @@ void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio) · 1350 unmodified lines | ||
| 1351 | 1351 | { |
| 1352 | 1352 | struct nfs_pgio_mirror *mirror; |
| 1353 | 1353 | |
| 1354 | + if (pgio->pg_ops && pgio->pg_ops->pg_cleanup) | |
| 1355 | + pgio->pg_ops->pg_cleanup(pgio); | |
| 1356 | + | |
| 1354 | 1357 | pgio->pg_ops = &nfs_pgio_rw_ops; |
| 1355 | 1358 | |
| 1356 | 1359 | nfs_pageio_stop_mirroring(pgio); |
| @@ -1439,6 +1439,7 @@ int dlm_master_request_handler(struct o2net_msg *msg, u32 len, void *data, · 1438 unmodified lines | ||
| 1439 | 1439 | int found, ret; |
| 1440 | 1440 | int set_maybe; |
| 1441 | 1441 | int dispatch_assert = 0; |
| 1442 | + int dispatched = 0; | |
| 1442 | 1443 | |
| 1443 | 1444 | if (!dlm_grab(dlm)) |
| 1444 | 1445 | return DLM_MASTER_RESP_NO; |
| @@ -1658,15 +1659,18 @@ send_response: · 213 unmodified lines | ||
| 1658 | 1659 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); |
| 1659 | 1660 | response = DLM_MASTER_RESP_ERROR; |
| 1660 | 1661 | dlm_lockres_put(res); |
| 1661 | − } else | |
| 1662 | + } else { | |
| 1663 | + dispatched = 1; | |
| 1662 | 1664 | __dlm_lockres_grab_inflight_worker(dlm, res); |
| 1665 | + } | |
| 1663 | 1666 | spin_unlock(&res->spinlock); |
| 1664 | 1667 | } else { |
| 1665 | 1668 | if (res) |
| 1666 | 1669 | dlm_lockres_put(res); |
| 1667 | 1670 | } |
| 1668 | 1671 | |
| 1669 | − dlm_put(dlm); | |
| 1672 | + if (!dispatched) | |
| 1673 | + dlm_put(dlm); | |
| 1670 | 1674 | return response; |
| 1671 | 1675 | } |
| 1672 | 1676 | |
| @@ -2090,7 +2094,6 @@ int dlm_dispatch_assert_master(struct dlm_ctxt *dlm, · 417 unmodified lines | ||
| 2090 | 2094 | |
| 2091 | 2095 | |
| 2092 | 2096 | /* queue up work for dlm_assert_master_worker */ |
| 2093 | − dlm_grab(dlm); /* get an extra ref for the work item */ | |
| 2094 | 2097 | dlm_init_work_item(dlm, item, dlm_assert_master_worker, NULL); |
| 2095 | 2098 | item->u.am.lockres = res; /* already have a ref */ |
| 2096 | 2099 | /* can optionally ignore node numbers higher than this node */ |
| @@ -1694,6 +1694,7 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, · 1693 unmodified lines | ||
| 1694 | 1694 | unsigned int hash; |
| 1695 | 1695 | int master = DLM_LOCK_RES_OWNER_UNKNOWN; |
| 1696 | 1696 | u32 flags = DLM_ASSERT_MASTER_REQUERY; |
| 1697 | + int dispatched = 0; | |
| 1697 | 1698 | |
| 1698 | 1699 | if (!dlm_grab(dlm)) { |
| 1699 | 1700 | /* since the domain has gone away on this |
| @@ -1719,8 +1720,10 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, · 19 unmodified lines | ||
| 1719 | 1720 | dlm_put(dlm); |
| 1720 | 1721 | /* sender will take care of this and retry */ |
| 1721 | 1722 | return ret; |
| 1722 | − } else | |
| 1723 | + } else { | |
| 1724 | + dispatched = 1; | |
| 1723 | 1725 | __dlm_lockres_grab_inflight_worker(dlm, res); |
| 1726 | + } | |
| 1724 | 1727 | spin_unlock(&res->spinlock); |
| 1725 | 1728 | } else { |
| 1726 | 1729 | /* put.. incase we are not the master */ |
| @@ -1730,7 +1733,8 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, · 3 unmodified lines | ||
| 1730 | 1733 | } |
| 1731 | 1734 | spin_unlock(&dlm->spinlock); |
| 1732 | 1735 | |
| 1733 | − dlm_put(dlm); | |
| 1736 | + if (!dispatched) | |
| 1737 | + dlm_put(dlm); | |
| 1734 | 1738 | return master; |
| 1735 | 1739 | } |
| 1736 | 1740 | |
| @@ -652,11 +652,8 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, · 651 unmodified lines | ||
| 652 | 652 | { |
| 653 | 653 | int err; |
| 654 | 654 | |
| 655 | − mutex_lock(&inode->i_mutex); | |
| 656 | 655 | err = security_inode_init_security(inode, dentry, qstr, |
| 657 | 656 | &init_xattrs, 0); |
| 658 | − mutex_unlock(&inode->i_mutex); | |
| 659 | − | |
| 660 | 657 | if (err) { |
| 661 | 658 | struct ubifs_info *c = dentry->i_sb->s_fs_info; |
| 662 | 659 | ubifs_err(c, "cannot initialize security for inode %lu, error %d", |
| @@ -467,8 +467,8 @@ static int userfaultfd_release(struct inode *inode, struct file *file) · 466 unmodified lines | ||
| 467 | 467 | * the fault_*wqh. |
| 468 | 468 | */ |
| 469 | 469 | spin_lock(&ctx->fault_pending_wqh.lock); |
| 470 | − __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, 0, &range); | |
| 471 | − __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, 0, &range); | |
| 470 | + __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range); | |
| 471 | + __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, &range); | |
| 472 | 472 | spin_unlock(&ctx->fault_pending_wqh.lock); |
| 473 | 473 | |
| 474 | 474 | wake_up_poll(&ctx->fd_wqh, POLLHUP); |
| @@ -650,10 +650,10 @@ static void __wake_userfault(struct userfaultfd_ctx *ctx, · 175 unmodified lines | ||
| 650 | 650 | spin_lock(&ctx->fault_pending_wqh.lock); |
| 651 | 651 | /* wake all in the range and autoremove */ |
| 652 | 652 | if (waitqueue_active(&ctx->fault_pending_wqh)) |
| 653 | − __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, 0, | |
| 653 | + __wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, | |
| 654 | 654 | range); |
| 655 | 655 | if (waitqueue_active(&ctx->fault_wqh)) |
| 656 | − __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, 0, range); | |
| 656 | + __wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, range); | |
| 657 | 657 | spin_unlock(&ctx->fault_pending_wqh.lock); |
| 658 | 658 | } |
| 659 | 659 | |
| @@ -1,15 +1,10 @@ | ||
| 1 | 1 | #ifndef _ASM_WORD_AT_A_TIME_H |
| 2 | 2 | #define _ASM_WORD_AT_A_TIME_H |
| 3 | 3 | |
| 4 | −/* | |
| 5 | − * This says "generic", but it's actually big-endian only. | |
| 6 | − * Little-endian can use more efficient versions of these | |
| 7 | − * interfaces, see for example | |
| 8 | − * arch/x86/include/asm/word-at-a-time.h | |
| 9 | − * for those. | |
| 10 | − */ | |
| 11 | − | |
| 12 | 4 | #include <linux/kernel.h> |
| 5 | +#include <asm/byteorder.h> | |
| 6 | + | |
| 7 | +#ifdef __BIG_ENDIAN | |
| 13 | 8 | |
| 14 | 9 | struct word_at_a_time { |
| 15 | 10 | const unsigned long high_bits, low_bits; |
| @@ -53,4 +48,73 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct · 37 unmodified lines | ||
| 53 | 48 | #define zero_bytemask(mask) (~1ul << __fls(mask)) |
| 54 | 49 | #endif |
| 55 | 50 | |
| 51 | +#else | |
| 52 | + | |
| 53 | +/* | |
| 54 | + * The optimal byte mask counting is probably going to be something | |
| 55 | + * that is architecture-specific. If you have a reliably fast | |
| 56 | + * bit count instruction, that might be better than the multiply | |
| 57 | + * and shift, for example. | |
| 58 | + */ | |
| 59 | +struct word_at_a_time { | |
| 60 | + const unsigned long one_bits, high_bits; | |
| 61 | +}; | |
| 62 | + | |
| 63 | +#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) } | |
| 64 | + | |
| 65 | +#ifdef CONFIG_64BIT | |
| 66 | + | |
| 67 | +/* | |
| 68 | + * Jan Achrenius on G+: microoptimized version of | |
| 69 | + * the simpler "(mask & ONEBYTES) * ONEBYTES >> 56" | |
| 70 | + * that works for the bytemasks without having to | |
| 71 | + * mask them first. | |
| 72 | + */ | |
| 73 | +static inline long count_masked_bytes(unsigned long mask) | |
| 74 | +{ | |
| 75 | + return mask*0x0001020304050608ul >> 56; | |
| 76 | +} | |
| 77 | + | |
| 78 | +#else /* 32-bit case */ | |
| 79 | + | |
| 80 | +/* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | |
| 81 | +static inline long count_masked_bytes(long mask) | |
| 82 | +{ | |
| 83 | + /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | |
| 84 | + long a = (0x0ff0001+mask) >> 23; | |
| 85 | + /* Fix the 1 for 00 case */ | |
| 86 | + return a & mask; | |
| 87 | +} | |
| 88 | + | |
| 89 | +#endif | |
| 90 | + | |
| 91 | +/* Return nonzero if it has a zero */ | |
| 92 | +static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c) | |
| 93 | +{ | |
| 94 | + unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits; | |
| 95 | + *bits = mask; | |
| 96 | + return mask; | |
| 97 | +} | |
| 98 | + | |
| 99 | +static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c) | |
| 100 | +{ | |
| 101 | + return bits; | |
| 102 | +} | |
| 103 | + | |
| 104 | +static inline unsigned long create_zero_mask(unsigned long bits) | |
| 105 | +{ | |
| 106 | + bits = (bits - 1) & ~bits; | |
| 107 | + return bits >> 7; | |
| 108 | +} | |
| 109 | + | |
| 110 | +/* The mask we created is directly usable as a bytemask */ | |
| 111 | +#define zero_bytemask(mask) (mask) | |
| 112 | + | |
| 113 | +static inline unsigned long find_zero(unsigned long mask) | |
| 114 | +{ | |
| 115 | + return count_masked_bytes(mask); | |
| 116 | +} | |
| 117 | + | |
| 118 | +#endif /* __BIG_ENDIAN */ | |
| 119 | + | |
| 56 | 120 | #endif /* _ASM_WORD_AT_A_TIME_H */ |
| @@ -240,5 +240,6 @@ extern void drm_kms_helper_hotplug_event(struct drm_device *dev); · 239 unmodified lines | ||
| 240 | 240 | |
| 241 | 241 | extern void drm_kms_helper_poll_disable(struct drm_device *dev); |
| 242 | 242 | extern void drm_kms_helper_poll_enable(struct drm_device *dev); |
| 243 | +extern void drm_kms_helper_poll_enable_locked(struct drm_device *dev); | |
| 243 | 244 | |
| 244 | 245 | #endif |
| @@ -568,6 +568,10 @@ · 567 unmodified lines | ||
| 568 | 568 | #define MODE_I2C_READ 4 |
| 569 | 569 | #define MODE_I2C_STOP 8 |
| 570 | 570 | |
| 571 | +/* DP 1.2 MST PORTs - Section 2.5.1 v1.2a spec */ | |
| 572 | +#define DP_MST_PHYSICAL_PORT_0 0 | |
| 573 | +#define DP_MST_LOGICAL_PORT_0 8 | |
| 574 | + | |
| 571 | 575 | #define DP_LINK_STATUS_SIZE 6 |
| 572 | 576 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], |
| 573 | 577 | int lane_count); |
| @@ -374,6 +374,7 @@ struct drm_dp_mst_topology_mgr; · 373 unmodified lines | ||
| 374 | 374 | struct drm_dp_mst_topology_cbs { |
| 375 | 375 | /* create a connector for a port */ |
| 376 | 376 | struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path); |
| 377 | + void (*register_connector)(struct drm_connector *connector); | |
| 377 | 378 | void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, |
| 378 | 379 | struct drm_connector *connector); |
| 379 | 380 | void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); |
| @@ -217,6 +217,7 @@ struct pci_dev; · 216 unmodified lines | ||
| 217 | 217 | |
| 218 | 218 | int acpi_pci_irq_enable (struct pci_dev *dev); |
| 219 | 219 | void acpi_penalize_isa_irq(int irq, int active); |
| 220 | +bool acpi_isa_irq_available(int irq); | |
| 220 | 221 | void acpi_penalize_sci_irq(int irq, int trigger, int polarity); |
| 221 | 222 | void acpi_pci_irq_disable (struct pci_dev *dev); |
| 222 | 223 | |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/sched.h> |
| 14 | 14 | #include <linux/blkdev.h> |
| 15 | 15 | #include <linux/writeback.h> |
| 16 | +#include <linux/memcontrol.h> | |
| 16 | 17 | #include <linux/blk-cgroup.h> |
| 17 | 18 | #include <linux/backing-dev-defs.h> |
| 18 | 19 | #include <linux/slab.h> |
| @@ -252,13 +253,19 @@ int inode_congested(struct inode *inode, int cong_bits); · 233 unmodified lines | ||
| 252 | 253 | * @inode: inode of interest |
| 253 | 254 | * |
| 254 | 255 | * cgroup writeback requires support from both the bdi and filesystem. |
| 255 | − * Test whether @inode has both. | |
| 256 | + * Also, both memcg and iocg have to be on the default hierarchy. Test | |
| 257 | + * whether all conditions are met. | |
| 258 | + * | |
| 259 | + * Note that the test result may change dynamically on the same inode | |
| 260 | + * depending on how memcg and iocg are configured. | |
| 256 | 261 | */ |
| 257 | 262 | static inline bool inode_cgwb_enabled(struct inode *inode) |
| 258 | 263 | { |
| 259 | 264 | struct backing_dev_info *bdi = inode_to_bdi(inode); |
| 260 | 265 | |
| 261 | − return bdi_cap_account_dirty(bdi) && | |
| 266 | + return cgroup_on_dfl(mem_cgroup_root_css->cgroup) && | |
| 267 | + cgroup_on_dfl(blkcg_root_css->cgroup) && | |
| 268 | + bdi_cap_account_dirty(bdi) && | |
| 262 | 269 | (bdi->capabilities & BDI_CAP_CGROUP_WRITEBACK) && |
| 263 | 270 | (inode->i_sb->s_iflags & SB_I_CGROUPWB); |
| 264 | 271 | } |
| @@ -145,7 +145,6 @@ enum { · 144 unmodified lines | ||
| 145 | 145 | BLK_MQ_F_SHOULD_MERGE = 1 << 0, |
| 146 | 146 | BLK_MQ_F_TAG_SHARED = 1 << 1, |
| 147 | 147 | BLK_MQ_F_SG_MERGE = 1 << 2, |
| 148 | − BLK_MQ_F_SYSFS_UP = 1 << 3, | |
| 149 | 148 | BLK_MQ_F_DEFER_ISSUE = 1 << 4, |
| 150 | 149 | BLK_MQ_F_ALLOC_POLICY_START_BIT = 8, |
| 151 | 150 | BLK_MQ_F_ALLOC_POLICY_BITS = 1, |
| @@ -215,7 +214,7 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head); · 63 unmodified lines | ||
| 215 | 214 | void blk_mq_cancel_requeue_work(struct request_queue *q); |
| 216 | 215 | void blk_mq_kick_requeue_list(struct request_queue *q); |
| 217 | 216 | void blk_mq_abort_requeue_list(struct request_queue *q); |
| 218 | −void blk_mq_complete_request(struct request *rq); | |
| 217 | +void blk_mq_complete_request(struct request *rq, int error); | |
| 219 | 218 | |
| 220 | 219 | void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); |
| 221 | 220 | void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); |
| @@ -224,8 +223,6 @@ void blk_mq_start_hw_queues(struct request_queue *q); · 2 unmodified lines | ||
| 224 | 223 | void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); |
| 225 | 224 | void blk_mq_run_hw_queues(struct request_queue *q, bool async); |
| 226 | 225 | void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); |
| 227 | −void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, | |
| 228 | − void *priv); | |
| 229 | 226 | void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn, |
| 230 | 227 | void *priv); |
| 231 | 228 | void blk_mq_freeze_queue(struct request_queue *q); |
| @@ -456,6 +456,8 @@ struct request_queue { · 455 unmodified lines | ||
| 456 | 456 | struct blk_mq_tag_set *tag_set; |
| 457 | 457 | struct list_head tag_set_list; |
| 458 | 458 | struct bio_set *bio_split; |
| 459 | + | |
| 460 | + bool mq_sysfs_init_done; | |
| 459 | 461 | }; |
| 460 | 462 | |
| 461 | 463 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
| @@ -68,8 +68,8 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova) · 67 unmodified lines | ||
| 68 | 68 | return iova >> iova_shift(iovad); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | −int iommu_iova_cache_init(void); | |
| 72 | −void iommu_iova_cache_destroy(void); | |
| 71 | +int iova_cache_get(void); | |
| 72 | +void iova_cache_put(void); | |
| 73 | 73 | |
| 74 | 74 | struct iova *alloc_iova_mem(void); |
| 75 | 75 | void free_iova_mem(struct iova *iova); |
| @@ -242,7 +242,6 @@ struct mem_cgroup { · 241 unmodified lines | ||
| 242 | 242 | * percpu counter. |
| 243 | 243 | */ |
| 244 | 244 | struct mem_cgroup_stat_cpu __percpu *stat; |
| 245 | − spinlock_t pcp_counter_lock; | |
| 246 | 245 | |
| 247 | 246 | #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET) |
| 248 | 247 | struct cg_proto tcp_mem; |
| @@ -402,17 +402,6 @@ struct mlx5_cmd_teardown_hca_mbox_out { · 401 unmodified lines | ||
| 402 | 402 | u8 rsvd[8]; |
| 403 | 403 | }; |
| 404 | 404 | |
| 405 | −struct mlx5_cmd_query_special_contexts_mbox_in { | |
| 406 | − struct mlx5_inbox_hdr hdr; | |
| 407 | − u8 rsvd[8]; | |
| 408 | −}; | |
| 409 | − | |
| 410 | −struct mlx5_cmd_query_special_contexts_mbox_out { | |
| 411 | − struct mlx5_outbox_hdr hdr; | |
| 412 | − __be32 dump_fill_mkey; | |
| 413 | − __be32 resd_lkey; | |
| 414 | −}; | |
| 415 | − | |
| 416 | 405 | struct mlx5_cmd_layout { |
| 417 | 406 | u8 type; |
| 418 | 407 | u8 rsvd0[3]; |
| @@ -845,7 +845,6 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol); · 844 unmodified lines | ||
| 845 | 845 | int mlx5_register_interface(struct mlx5_interface *intf); |
| 846 | 846 | void mlx5_unregister_interface(struct mlx5_interface *intf); |
| 847 | 847 | int mlx5_core_query_vendor_id(struct mlx5_core_dev *mdev, u32 *vendor_id); |
| 848 | −int mlx5_core_query_special_context(struct mlx5_core_dev *dev, u32 *rsvd_lkey); | |
| 849 | 848 | |
| 850 | 849 | struct mlx5_profile { |
| 851 | 850 | u64 mask; |
| @@ -905,6 +905,27 @@ static inline void set_page_links(struct page *page, enum zone_type zone, · 904 unmodified lines | ||
| 905 | 905 | #endif |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | +#ifdef CONFIG_MEMCG | |
| 909 | +static inline struct mem_cgroup *page_memcg(struct page *page) | |
| 910 | +{ | |
| 911 | + return page->mem_cgroup; | |
| 912 | +} | |
| 913 | + | |
| 914 | +static inline void set_page_memcg(struct page *page, struct mem_cgroup *memcg) | |
| 915 | +{ | |
| 916 | + page->mem_cgroup = memcg; | |
| 917 | +} | |
| 918 | +#else | |
| 919 | +static inline struct mem_cgroup *page_memcg(struct page *page) | |
| 920 | +{ | |
| 921 | + return NULL; | |
| 922 | +} | |
| 923 | + | |
| 924 | +static inline void set_page_memcg(struct page *page, struct mem_cgroup *memcg) | |
| 925 | +{ | |
| 926 | +} | |
| 927 | +#endif | |
| 928 | + | |
| 908 | 929 | /* |
| 909 | 930 | * Some inline functions in vmstat.h depend on page_zone() |
| 910 | 931 | */ |
| @@ -507,6 +507,7 @@ static inline void napi_enable(struct napi_struct *n) · 506 unmodified lines | ||
| 507 | 507 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); |
| 508 | 508 | smp_mb__before_atomic(); |
| 509 | 509 | clear_bit(NAPI_STATE_SCHED, &n->state); |
| 510 | + clear_bit(NAPI_STATE_NPSVC, &n->state); | |
| 510 | 511 | } |
| 511 | 512 | |
| 512 | 513 | #ifdef CONFIG_SMP |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/spinlock.h> |
| 20 | 20 | #include <linux/ethtool.h> |
| 21 | 21 | #include <linux/mii.h> |
| 22 | +#include <linux/module.h> | |
| 22 | 23 | #include <linux/timer.h> |
| 23 | 24 | #include <linux/workqueue.h> |
| 24 | 25 | #include <linux/mod_devicetable.h> |
| @@ -153,6 +154,7 @@ struct sk_buff; · 128 unmodified lines | ||
| 153 | 154 | * PHYs should register using this structure |
| 154 | 155 | */ |
| 155 | 156 | struct mii_bus { |
| 157 | + struct module *owner; | |
| 156 | 158 | const char *name; |
| 157 | 159 | char id[MII_BUS_ID_SIZE]; |
| 158 | 160 | void *priv; |
| @@ -198,7 +200,8 @@ static inline struct mii_bus *mdiobus_alloc(void) · 39 unmodified lines | ||
| 198 | 200 | return mdiobus_alloc_size(0); |
| 199 | 201 | } |
| 200 | 202 | |
| 201 | −int mdiobus_register(struct mii_bus *bus); | |
| 203 | +int __mdiobus_register(struct mii_bus *bus, struct module *owner); | |
| 204 | +#define mdiobus_register(bus) __mdiobus_register(bus, THIS_MODULE) | |
| 202 | 205 | void mdiobus_unregister(struct mii_bus *bus); |
| 203 | 206 | void mdiobus_free(struct mii_bus *bus); |
| 204 | 207 | struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv); |
| @@ -742,6 +745,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, · 537 unmodified lines | ||
| 742 | 745 | struct phy_c45_device_ids *c45_ids); |
| 743 | 746 | struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); |
| 744 | 747 | int phy_device_register(struct phy_device *phy); |
| 748 | +void phy_device_remove(struct phy_device *phydev); | |
| 745 | 749 | int phy_init_hw(struct phy_device *phydev); |
| 746 | 750 | int phy_suspend(struct phy_device *phydev); |
| 747 | 751 | int phy_resume(struct phy_device *phydev); |
| @@ -230,12 +230,11 @@ void __wait_rcu_gp(bool checktiny, int n, call_rcu_func_t *crcu_array, · 229 unmodified lines | ||
| 230 | 230 | struct rcu_synchronize *rs_array); |
| 231 | 231 | |
| 232 | 232 | #define _wait_rcu_gp(checktiny, ...) \ |
| 233 | −do { \ | |
| 234 | − call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \ | |
| 235 | − const int __n = ARRAY_SIZE(__crcu_array); \ | |
| 236 | − struct rcu_synchronize __rs_array[__n]; \ | |
| 237 | − \ | |
| 238 | − __wait_rcu_gp(checktiny, __n, __crcu_array, __rs_array); \ | |
| 233 | +do { \ | |
| 234 | + call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \ | |
| 235 | + struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \ | |
| 236 | + __wait_rcu_gp(checktiny, ARRAY_SIZE(__crcu_array), \ | |
| 237 | + __crcu_array, __rs_array); \ | |
| 239 | 238 | } while (0) |
| 240 | 239 | |
| 241 | 240 | #define wait_rcu_gp(...) _wait_rcu_gp(false, __VA_ARGS__) |
| @@ -179,6 +179,9 @@ struct nf_bridge_info { · 178 unmodified lines | ||
| 179 | 179 | u8 bridged_dnat:1; |
| 180 | 180 | __u16 frag_max_size; |
| 181 | 181 | struct net_device *physindev; |
| 182 | + | |
| 183 | + /* always valid & non-NULL from FORWARD on, for physdev match */ | |
| 184 | + struct net_device *physoutdev; | |
| 182 | 185 | union { |
| 183 | 186 | /* prerouting: detect dnat in orig/reply direction */ |
| 184 | 187 | __be32 ipv4_daddr; |
| @@ -189,9 +192,6 @@ struct nf_bridge_info { · 4 unmodified lines | ||
| 189 | 192 | * skb is out in neigh layer. |
| 190 | 193 | */ |
| 191 | 194 | char neigh_header[8]; |
| 192 | − | |
| 193 | − /* always valid & non-NULL from FORWARD on, for physdev match */ | |
| 194 | − struct net_device *physoutdev; | |
| 195 | 195 | }; |
| 196 | 196 | }; |
| 197 | 197 | #endif |
| @@ -2707,6 +2707,9 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, · 2509 unmodified lines | ||
| 2707 | 2707 | { |
| 2708 | 2708 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
| 2709 | 2709 | skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); |
| 2710 | + else if (skb->ip_summed == CHECKSUM_PARTIAL && | |
| 2711 | + skb_checksum_start_offset(skb) < 0) | |
| 2712 | + skb->ip_summed = CHECKSUM_NONE; | |
| 2710 | 2713 | } |
| 2711 | 2714 | |
| 2712 | 2715 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); |
| @@ -34,7 +34,7 @@ extern struct bus_type spi_bus_type; · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * struct spi_statistics - statistics for spi transfers |
| 37 | − * @clock: lock protecting this structure | |
| 37 | + * @lock: lock protecting this structure | |
| 38 | 38 | * |
| 39 | 39 | * @messages: number of spi-messages handled |
| 40 | 40 | * @transfers: number of spi_transfers handled |
| @@ -25,6 +25,9 @@ extern char * strncpy(char *,const char *, __kernel_size_t); · 24 unmodified lines | ||
| 25 | 25 | #ifndef __HAVE_ARCH_STRLCPY |
| 26 | 26 | size_t strlcpy(char *, const char *, size_t); |
| 27 | 27 | #endif |
| 28 | +#ifndef __HAVE_ARCH_STRSCPY | |
| 29 | +ssize_t __must_check strscpy(char *, const char *, size_t); | |
| 30 | +#endif | |
| 28 | 31 | #ifndef __HAVE_ARCH_STRCAT |
| 29 | 32 | extern char * strcat(char *, const char *); |
| 30 | 33 | #endif |
| @@ -42,6 +42,7 @@ struct sock_xprt { · 41 unmodified lines | ||
| 42 | 42 | /* |
| 43 | 43 | * Connection of transports |
| 44 | 44 | */ |
| 45 | + unsigned long sock_state; | |
| 45 | 46 | struct delayed_work connect_worker; |
| 46 | 47 | struct sockaddr_storage srcaddr; |
| 47 | 48 | unsigned short srcport; |
| @@ -76,6 +77,8 @@ struct sock_xprt { · 28 unmodified lines | ||
| 76 | 77 | */ |
| 77 | 78 | #define TCP_RPC_REPLY (1UL << 6) |
| 78 | 79 | |
| 80 | +#define XPRT_SOCK_CONNECTING 1U | |
| 81 | + | |
| 79 | 82 | #endif /* __KERNEL__ */ |
| 80 | 83 | |
| 81 | 84 | #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ |
| @@ -360,7 +360,7 @@ static inline struct thermal_zone_device * · 359 unmodified lines | ||
| 360 | 360 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 361 | 361 | const struct thermal_zone_of_device_ops *ops) |
| 362 | 362 | { |
| 363 | − return NULL; | |
| 363 | + return ERR_PTR(-ENODEV); | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | static inline |
| @@ -380,6 +380,8 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) · 13 unmodified lines | ||
| 380 | 380 | |
| 381 | 381 | int power_actor_get_max_power(struct thermal_cooling_device *, |
| 382 | 382 | struct thermal_zone_device *tz, u32 *max_power); |
| 383 | +int power_actor_get_min_power(struct thermal_cooling_device *, | |
| 384 | + struct thermal_zone_device *tz, u32 *min_power); | |
| 383 | 385 | int power_actor_set_power(struct thermal_cooling_device *, |
| 384 | 386 | struct thermal_instance *, u32); |
| 385 | 387 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, |
| @@ -415,6 +417,10 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) · 29 unmodified lines | ||
| 415 | 417 | static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev, |
| 416 | 418 | struct thermal_zone_device *tz, u32 *max_power) |
| 417 | 419 | { return 0; } |
| 420 | +static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev, | |
| 421 | + struct thermal_zone_device *tz, | |
| 422 | + u32 *min_power) | |
| 423 | +{ return -ENODEV; } | |
| 418 | 424 | static inline int power_actor_set_power(struct thermal_cooling_device *cdev, |
| 419 | 425 | struct thermal_instance *tz, u32 power) |
| 420 | 426 | { return 0; } |
| @@ -147,8 +147,7 @@ __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) · 146 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | typedef int wait_bit_action_f(struct wait_bit_key *); |
| 149 | 149 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 150 | −void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, int nr, | |
| 151 | − void *key); | |
| 150 | +void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); | |
| 152 | 151 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 153 | 152 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); |
| 154 | 153 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); |
| @@ -180,7 +179,7 @@ wait_queue_head_t *bit_waitqueue(void *, int); · 25 unmodified lines | ||
| 180 | 179 | #define wake_up_poll(x, m) \ |
| 181 | 180 | __wake_up(x, TASK_NORMAL, 1, (void *) (m)) |
| 182 | 181 | #define wake_up_locked_poll(x, m) \ |
5 more 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 21 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 52 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 18 lines aren’t shown here.
This diff is large: its 9 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 22 lines aren’t shown here.
This diff is large: its 201 lines aren’t shown here.
This diff is large: its 50 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 35 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 20 lines aren’t shown here.
This diff is large: its 12 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 15 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 37 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 10 lines aren’t shown here.
This diff is large: its 26 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 41 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 26 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 18 lines aren’t shown here.
This diff is large: its 94 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 108 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 18 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 49 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 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 244 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 33 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 66 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 113 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 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 25 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 78 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 45 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 73 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 66 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 41 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 18 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 8 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.