diff options
356 files changed, 3307 insertions, 1742 deletions
diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt index e8d25e784214..ff49cf901148 100644 --- a/Documentation/cgroup-v2.txt +++ b/Documentation/cgroup-v2.txt | |||
| @@ -7,7 +7,7 @@ This is the authoritative documentation on the design, interface and | |||
| 7 | conventions of cgroup v2. It describes all userland-visible aspects | 7 | conventions of cgroup v2. It describes all userland-visible aspects |
| 8 | of cgroup including core and specific controller behaviors. All | 8 | of cgroup including core and specific controller behaviors. All |
| 9 | future changes must be reflected in this document. Documentation for | 9 | future changes must be reflected in this document. Documentation for |
| 10 | v1 is available under Documentation/cgroup-legacy/. | 10 | v1 is available under Documentation/cgroup-v1/. |
| 11 | 11 | ||
| 12 | CONTENTS | 12 | CONTENTS |
| 13 | 13 | ||
diff --git a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt index 4e8b90e43dd8..07a75094c5a8 100644 --- a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt +++ b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt | |||
| @@ -8,6 +8,7 @@ OHCI and EHCI controllers. | |||
| 8 | Required properties: | 8 | Required properties: |
| 9 | - compatible: "renesas,pci-r8a7790" for the R8A7790 SoC; | 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-r8a7793" for the R8A7793 SoC; | ||
| 11 | "renesas,pci-r8a7794" for the R8A7794 SoC; | 12 | "renesas,pci-r8a7794" for the R8A7794 SoC; |
| 12 | "renesas,pci-rcar-gen2" for a generic R-Car Gen2 compatible device | 13 | "renesas,pci-rcar-gen2" for a generic R-Car Gen2 compatible device |
| 13 | 14 | ||
diff --git a/Documentation/devicetree/bindings/pci/rcar-pci.txt b/Documentation/devicetree/bindings/pci/rcar-pci.txt index 558fe528ae19..6cf99690eef9 100644 --- a/Documentation/devicetree/bindings/pci/rcar-pci.txt +++ b/Documentation/devicetree/bindings/pci/rcar-pci.txt | |||
| @@ -4,6 +4,7 @@ Required properties: | |||
| 4 | compatible: "renesas,pcie-r8a7779" for the R8A7779 SoC; | 4 | compatible: "renesas,pcie-r8a7779" for the R8A7779 SoC; |
| 5 | "renesas,pcie-r8a7790" for the R8A7790 SoC; | 5 | "renesas,pcie-r8a7790" for the R8A7790 SoC; |
| 6 | "renesas,pcie-r8a7791" for the R8A7791 SoC; | 6 | "renesas,pcie-r8a7791" for the R8A7791 SoC; |
| 7 | "renesas,pcie-r8a7793" for the R8A7793 SoC; | ||
| 7 | "renesas,pcie-r8a7795" for the R8A7795 SoC; | 8 | "renesas,pcie-r8a7795" for the R8A7795 SoC; |
| 8 | "renesas,pcie-rcar-gen2" for a generic R-Car Gen2 compatible device. | 9 | "renesas,pcie-rcar-gen2" for a generic R-Car Gen2 compatible device. |
| 9 | 10 | ||
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index ce55c0a6f757..4da41bf1888e 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | |||
| @@ -30,6 +30,8 @@ The compatible list for this generic sound card currently: | |||
| 30 | "fsl,imx-audio-sgtl5000" | 30 | "fsl,imx-audio-sgtl5000" |
| 31 | (compatible with Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt) | 31 | (compatible with Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt) |
| 32 | 32 | ||
| 33 | "fsl,imx-audio-wm8960" | ||
| 34 | |||
| 33 | Required properties: | 35 | Required properties: |
| 34 | 36 | ||
| 35 | - compatible : Contains one of entries in the compatible list. | 37 | - compatible : Contains one of entries in the compatible list. |
diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt index 332e625f6ed0..e5ee3f159893 100644 --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | * Renesas R-Car Thermal | 1 | * Renesas R-Car Thermal |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "renesas,thermal-<soctype>", "renesas,rcar-thermal" | 4 | - compatible : "renesas,thermal-<soctype>", |
| 5 | as fallback. | 5 | "renesas,rcar-gen2-thermal" (with thermal-zone) or |
| 6 | "renesas,rcar-thermal" (without thermal-zone) as fallback. | ||
| 6 | Examples with soctypes are: | 7 | Examples with soctypes are: |
| 7 | - "renesas,thermal-r8a73a4" (R-Mobile APE6) | 8 | - "renesas,thermal-r8a73a4" (R-Mobile APE6) |
| 8 | - "renesas,thermal-r8a7779" (R-Car H1) | 9 | - "renesas,thermal-r8a7779" (R-Car H1) |
| @@ -36,3 +37,35 @@ thermal@e61f0000 { | |||
| 36 | 0xe61f0300 0x38>; | 37 | 0xe61f0300 0x38>; |
| 37 | interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; | 38 | interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; |
| 38 | }; | 39 | }; |
| 40 | |||
| 41 | Example (with thermal-zone): | ||
| 42 | |||
| 43 | thermal-zones { | ||
| 44 | cpu_thermal: cpu-thermal { | ||
| 45 | polling-delay-passive = <1000>; | ||
| 46 | polling-delay = <5000>; | ||
| 47 | |||
| 48 | thermal-sensors = <&thermal>; | ||
| 49 | |||
| 50 | trips { | ||
| 51 | cpu-crit { | ||
| 52 | temperature = <115000>; | ||
| 53 | hysteresis = <0>; | ||
| 54 | type = "critical"; | ||
| 55 | }; | ||
| 56 | }; | ||
| 57 | cooling-maps { | ||
| 58 | }; | ||
| 59 | }; | ||
| 60 | }; | ||
| 61 | |||
| 62 | thermal: thermal@e61f0000 { | ||
| 63 | compatible = "renesas,thermal-r8a7790", | ||
| 64 | "renesas,rcar-gen2-thermal", | ||
| 65 | "renesas,rcar-thermal"; | ||
| 66 | reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>; | ||
| 67 | interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>; | ||
| 68 | clocks = <&mstp5_clks R8A7790_CLK_THERMAL>; | ||
| 69 | power-domains = <&cpg_clocks>; | ||
| 70 | #thermal-sensor-cells = <0>; | ||
| 71 | }; | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 551ecf09c8dd..9a53c929f017 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -4235,6 +4235,17 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 4235 | The default value of this parameter is determined by | 4235 | The default value of this parameter is determined by |
| 4236 | the config option CONFIG_WQ_POWER_EFFICIENT_DEFAULT. | 4236 | the config option CONFIG_WQ_POWER_EFFICIENT_DEFAULT. |
| 4237 | 4237 | ||
| 4238 | workqueue.debug_force_rr_cpu | ||
| 4239 | Workqueue used to implicitly guarantee that work | ||
| 4240 | items queued without explicit CPU specified are put | ||
| 4241 | on the local CPU. This guarantee is no longer true | ||
| 4242 | and while local CPU is still preferred work items | ||
| 4243 | may be put on foreign CPUs. This debug option | ||
| 4244 | forces round-robin CPU selection to flush out | ||
| 4245 | usages which depend on the now broken guarantee. | ||
| 4246 | When enabled, memory and cache locality will be | ||
| 4247 | impacted. | ||
| 4248 | |||
| 4238 | x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of | 4249 | x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of |
| 4239 | default x2apic cluster mode on platforms | 4250 | default x2apic cluster mode on platforms |
| 4240 | supporting x2apic. | 4251 | supporting x2apic. |
diff --git a/MAINTAINERS b/MAINTAINERS index 7f1fa4ff300a..28eb61bbecf4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1442,8 +1442,8 @@ S: Maintained | |||
| 1442 | ARM/RENESAS ARM64 ARCHITECTURE | 1442 | ARM/RENESAS ARM64 ARCHITECTURE |
| 1443 | M: Simon Horman <horms@verge.net.au> | 1443 | M: Simon Horman <horms@verge.net.au> |
| 1444 | M: Magnus Damm <magnus.damm@gmail.com> | 1444 | M: Magnus Damm <magnus.damm@gmail.com> |
| 1445 | L: linux-sh@vger.kernel.org | 1445 | L: linux-renesas-soc@vger.kernel.org |
| 1446 | Q: http://patchwork.kernel.org/project/linux-sh/list/ | 1446 | Q: http://patchwork.kernel.org/project/linux-renesas-soc/list/ |
| 1447 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next | 1447 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git next |
| 1448 | S: Supported | 1448 | S: Supported |
| 1449 | F: arch/arm64/boot/dts/renesas/ | 1449 | F: arch/arm64/boot/dts/renesas/ |
| @@ -2362,14 +2362,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/rpi/linux-rpi.git | |||
| 2362 | S: Maintained | 2362 | S: Maintained |
| 2363 | N: bcm2835 | 2363 | N: bcm2835 |
| 2364 | 2364 | ||
| 2365 | BROADCOM BCM33XX MIPS ARCHITECTURE | ||
| 2366 | M: Kevin Cernekee <cernekee@gmail.com> | ||
| 2367 | L: linux-mips@linux-mips.org | ||
| 2368 | S: Maintained | ||
| 2369 | F: arch/mips/bcm3384/* | ||
| 2370 | F: arch/mips/include/asm/mach-bcm3384/* | ||
| 2371 | F: arch/mips/kernel/*bmips* | ||
| 2372 | |||
| 2373 | BROADCOM BCM47XX MIPS ARCHITECTURE | 2365 | BROADCOM BCM47XX MIPS ARCHITECTURE |
| 2374 | M: Hauke Mehrtens <hauke@hauke-m.de> | 2366 | M: Hauke Mehrtens <hauke@hauke-m.de> |
| 2375 | M: Rafał Miłecki <zajec5@gmail.com> | 2367 | M: Rafał Miłecki <zajec5@gmail.com> |
| @@ -9787,10 +9779,11 @@ S: Supported | |||
| 9787 | F: drivers/scsi/be2iscsi/ | 9779 | F: drivers/scsi/be2iscsi/ |
| 9788 | 9780 | ||
| 9789 | Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER | 9781 | Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER |
| 9790 | M: Sathya Perla <sathya.perla@avagotech.com> | 9782 | M: Sathya Perla <sathya.perla@broadcom.com> |
| 9791 | M: Ajit Khaparde <ajit.khaparde@avagotech.com> | 9783 | M: Ajit Khaparde <ajit.khaparde@broadcom.com> |
| 9792 | M: Padmanabh Ratnakar <padmanabh.ratnakar@avagotech.com> | 9784 | M: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com> |
| 9793 | M: Sriharsha Basavapatna <sriharsha.basavapatna@avagotech.com> | 9785 | M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> |
| 9786 | M: Somnath Kotur <somnath.kotur@broadcom.com> | ||
| 9794 | L: netdev@vger.kernel.org | 9787 | L: netdev@vger.kernel.org |
| 9795 | W: http://www.emulex.com | 9788 | W: http://www.emulex.com |
| 9796 | S: Supported | 9789 | S: Supported |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 5 | 2 | PATCHLEVEL = 5 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
| 5 | NAME = Blurry Fish Butt | 5 | NAME = Blurry Fish Butt |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 76dde9db7934..0655495470ad 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
| @@ -338,6 +338,19 @@ config ARC_PAGE_SIZE_4K | |||
| 338 | 338 | ||
| 339 | endchoice | 339 | endchoice |
| 340 | 340 | ||
| 341 | choice | ||
| 342 | prompt "MMU Super Page Size" | ||
| 343 | depends on ISA_ARCV2 && TRANSPARENT_HUGEPAGE | ||
| 344 | default ARC_HUGEPAGE_2M | ||
| 345 | |||
| 346 | config ARC_HUGEPAGE_2M | ||
| 347 | bool "2MB" | ||
| 348 | |||
| 349 | config ARC_HUGEPAGE_16M | ||
| 350 | bool "16MB" | ||
| 351 | |||
| 352 | endchoice | ||
| 353 | |||
| 341 | if ISA_ARCOMPACT | 354 | if ISA_ARCOMPACT |
| 342 | 355 | ||
| 343 | config ARC_COMPACT_IRQ_LEVELS | 356 | config ARC_COMPACT_IRQ_LEVELS |
| @@ -410,7 +423,7 @@ config ARC_HAS_RTC | |||
| 410 | default n | 423 | default n |
| 411 | depends on !SMP | 424 | depends on !SMP |
| 412 | 425 | ||
| 413 | config ARC_HAS_GRTC | 426 | config ARC_HAS_GFRC |
| 414 | bool "SMP synchronized 64-bit cycle counter" | 427 | bool "SMP synchronized 64-bit cycle counter" |
| 415 | default y | 428 | default y |
| 416 | depends on SMP | 429 | depends on SMP |
| @@ -566,6 +579,12 @@ endmenu | |||
| 566 | endmenu # "ARC Architecture Configuration" | 579 | endmenu # "ARC Architecture Configuration" |
| 567 | 580 | ||
| 568 | source "mm/Kconfig" | 581 | source "mm/Kconfig" |
| 582 | |||
| 583 | config FORCE_MAX_ZONEORDER | ||
| 584 | int "Maximum zone order" | ||
| 585 | default "12" if ARC_HUGEPAGE_16M | ||
| 586 | default "11" | ||
| 587 | |||
| 569 | source "net/Kconfig" | 588 | source "net/Kconfig" |
| 570 | source "drivers/Kconfig" | 589 | source "drivers/Kconfig" |
| 571 | source "fs/Kconfig" | 590 | source "fs/Kconfig" |
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig index f36c047b33ca..735985974a31 100644 --- a/arch/arc/configs/vdk_hs38_smp_defconfig +++ b/arch/arc/configs/vdk_hs38_smp_defconfig | |||
| @@ -16,7 +16,7 @@ CONFIG_ARC_PLAT_AXS10X=y | |||
| 16 | CONFIG_AXS103=y | 16 | CONFIG_AXS103=y |
| 17 | CONFIG_ISA_ARCV2=y | 17 | CONFIG_ISA_ARCV2=y |
| 18 | CONFIG_SMP=y | 18 | CONFIG_SMP=y |
| 19 | # CONFIG_ARC_HAS_GRTC is not set | 19 | # CONFIG_ARC_HAS_GFRC is not set |
| 20 | CONFIG_ARC_UBOOT_SUPPORT=y | 20 | CONFIG_ARC_UBOOT_SUPPORT=y |
| 21 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" | 21 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" |
| 22 | CONFIG_PREEMPT=y | 22 | CONFIG_PREEMPT=y |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 7fac7d85ed6a..fdc5be5b1029 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
| @@ -349,14 +349,13 @@ struct cpuinfo_arc { | |||
| 349 | struct cpuinfo_arc_bpu bpu; | 349 | struct cpuinfo_arc_bpu bpu; |
| 350 | struct bcr_identity core; | 350 | struct bcr_identity core; |
| 351 | struct bcr_isa isa; | 351 | struct bcr_isa isa; |
| 352 | struct bcr_timer timers; | ||
| 353 | unsigned int vec_base; | 352 | unsigned int vec_base; |
| 354 | struct cpuinfo_arc_ccm iccm, dccm; | 353 | struct cpuinfo_arc_ccm iccm, dccm; |
| 355 | struct { | 354 | struct { |
| 356 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, pad1:3, | 355 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, pad1:3, |
| 357 | fpu_sp:1, fpu_dp:1, pad2:6, | 356 | fpu_sp:1, fpu_dp:1, pad2:6, |
| 358 | debug:1, ap:1, smart:1, rtt:1, pad3:4, | 357 | debug:1, ap:1, smart:1, rtt:1, pad3:4, |
| 359 | pad4:8; | 358 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 360 | } extn; | 359 | } extn; |
| 361 | struct bcr_mpy extn_mpy; | 360 | struct bcr_mpy extn_mpy; |
| 362 | struct bcr_extn_xymem extn_xymem; | 361 | struct bcr_extn_xymem extn_xymem; |
diff --git a/arch/arc/include/asm/irqflags-arcv2.h b/arch/arc/include/asm/irqflags-arcv2.h index 258b0e5ad332..1fc18ee06cf2 100644 --- a/arch/arc/include/asm/irqflags-arcv2.h +++ b/arch/arc/include/asm/irqflags-arcv2.h | |||
| @@ -30,8 +30,11 @@ | |||
| 30 | /* Was Intr taken in User Mode */ | 30 | /* Was Intr taken in User Mode */ |
| 31 | #define AUX_IRQ_ACT_BIT_U 31 | 31 | #define AUX_IRQ_ACT_BIT_U 31 |
| 32 | 32 | ||
| 33 | /* 0 is highest level, but taken by FIRQs, if present in design */ | 33 | /* |
| 34 | #define ARCV2_IRQ_DEF_PRIO 0 | 34 | * User space should be interruptable even by lowest prio interrupt |
| 35 | * Safe even if actual interrupt priorities is fewer or even one | ||
| 36 | */ | ||
| 37 | #define ARCV2_IRQ_DEF_PRIO 15 | ||
| 35 | 38 | ||
| 36 | /* seed value for status register */ | 39 | /* seed value for status register */ |
| 37 | #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \ | 40 | #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \ |
diff --git a/arch/arc/include/asm/mcip.h b/arch/arc/include/asm/mcip.h index 46f4e5351b2a..847e3bbe387f 100644 --- a/arch/arc/include/asm/mcip.h +++ b/arch/arc/include/asm/mcip.h | |||
| @@ -39,8 +39,8 @@ struct mcip_cmd { | |||
| 39 | #define CMD_DEBUG_SET_MASK 0x34 | 39 | #define CMD_DEBUG_SET_MASK 0x34 |
| 40 | #define CMD_DEBUG_SET_SELECT 0x36 | 40 | #define CMD_DEBUG_SET_SELECT 0x36 |
| 41 | 41 | ||
| 42 | #define CMD_GRTC_READ_LO 0x42 | 42 | #define CMD_GFRC_READ_LO 0x42 |
| 43 | #define CMD_GRTC_READ_HI 0x43 | 43 | #define CMD_GFRC_READ_HI 0x43 |
| 44 | 44 | ||
| 45 | #define CMD_IDU_ENABLE 0x71 | 45 | #define CMD_IDU_ENABLE 0x71 |
| 46 | #define CMD_IDU_DISABLE 0x72 | 46 | #define CMD_IDU_DISABLE 0x72 |
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 57af2f05ae84..d426d4215513 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h | |||
| @@ -179,37 +179,44 @@ | |||
| 179 | #define __S111 PAGE_U_X_W_R | 179 | #define __S111 PAGE_U_X_W_R |
| 180 | 180 | ||
| 181 | /**************************************************************** | 181 | /**************************************************************** |
| 182 | * Page Table Lookup split | 182 | * 2 tier (PGD:PTE) software page walker |
| 183 | * | 183 | * |
| 184 | * We implement 2 tier paging and since this is all software, we are free | 184 | * [31] 32 bit virtual address [0] |
| 185 | * to customize the span of a PGD / PTE entry to suit us | ||
| 186 | * | ||
| 187 | * 32 bit virtual address | ||
| 188 | * ------------------------------------------------------- | 185 | * ------------------------------------------------------- |
| 189 | * | BITS_FOR_PGD | BITS_FOR_PTE | BITS_IN_PAGE | | 186 | * | | <------------ PGDIR_SHIFT ----------> | |
| 187 | * | | | | ||
| 188 | * | BITS_FOR_PGD | BITS_FOR_PTE | <-- PAGE_SHIFT --> | | ||
| 190 | * ------------------------------------------------------- | 189 | * ------------------------------------------------------- |
| 191 | * | | | | 190 | * | | | |
| 192 | * | | --> off in page frame | 191 | * | | --> off in page frame |
| 193 | * | | | ||
| 194 | * | ---> index into Page Table | 192 | * | ---> index into Page Table |
| 195 | * | | ||
| 196 | * ----> index into Page Directory | 193 | * ----> index into Page Directory |
| 194 | * | ||
| 195 | * In a single page size configuration, only PAGE_SHIFT is fixed | ||
| 196 | * So both PGD and PTE sizing can be tweaked | ||
| 197 | * e.g. 8K page (PAGE_SHIFT 13) can have | ||
| 198 | * - PGDIR_SHIFT 21 -> 11:8:13 address split | ||
| 199 | * - PGDIR_SHIFT 24 -> 8:11:13 address split | ||
| 200 | * | ||
| 201 | * If Super Page is configured, PGDIR_SHIFT becomes fixed too, | ||
| 202 | * so the sizing flexibility is gone. | ||
| 197 | */ | 203 | */ |
| 198 | 204 | ||
| 199 | #define BITS_IN_PAGE PAGE_SHIFT | 205 | #if defined(CONFIG_ARC_HUGEPAGE_16M) |
| 200 | 206 | #define PGDIR_SHIFT 24 | |
| 201 | /* Optimal Sizing of Pg Tbl - based on MMU page size */ | 207 | #elif defined(CONFIG_ARC_HUGEPAGE_2M) |
| 202 | #if defined(CONFIG_ARC_PAGE_SIZE_8K) | 208 | #define PGDIR_SHIFT 21 |
| 203 | #define BITS_FOR_PTE 8 /* 11:8:13 */ | 209 | #else |
| 204 | #elif defined(CONFIG_ARC_PAGE_SIZE_16K) | 210 | /* |
| 205 | #define BITS_FOR_PTE 8 /* 10:8:14 */ | 211 | * Only Normal page support so "hackable" (see comment above) |
| 206 | #elif defined(CONFIG_ARC_PAGE_SIZE_4K) | 212 | * Default value provides 11:8:13 (8K), 11:9:12 (4K) |
| 207 | #define BITS_FOR_PTE 9 /* 11:9:12 */ | 213 | */ |
| 214 | #define PGDIR_SHIFT 21 | ||
| 208 | #endif | 215 | #endif |
| 209 | 216 | ||
| 210 | #define BITS_FOR_PGD (32 - BITS_FOR_PTE - BITS_IN_PAGE) | 217 | #define BITS_FOR_PTE (PGDIR_SHIFT - PAGE_SHIFT) |
| 218 | #define BITS_FOR_PGD (32 - PGDIR_SHIFT) | ||
| 211 | 219 | ||
| 212 | #define PGDIR_SHIFT (32 - BITS_FOR_PGD) | ||
| 213 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* vaddr span, not PDG sz */ | 220 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) /* vaddr span, not PDG sz */ |
| 214 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 221 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
| 215 | 222 | ||
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S index cbfec79137bf..b17830294706 100644 --- a/arch/arc/kernel/entry-arcv2.S +++ b/arch/arc/kernel/entry-arcv2.S | |||
| @@ -211,7 +211,11 @@ debug_marker_syscall: | |||
| 211 | ; (since IRQ NOT allowed in DS in ARCv2, this can only happen if orig | 211 | ; (since IRQ NOT allowed in DS in ARCv2, this can only happen if orig |
| 212 | ; entry was via Exception in DS which got preempted in kernel). | 212 | ; entry was via Exception in DS which got preempted in kernel). |
| 213 | ; | 213 | ; |
| 214 | ; IRQ RTIE won't reliably restore DE bit and/or BTA, needs handling | 214 | ; IRQ RTIE won't reliably restore DE bit and/or BTA, needs workaround |
| 215 | ; | ||
| 216 | ; Solution is return from Intr w/o any delay slot quirks into a kernel trampoline | ||
| 217 | ; and from pure kernel mode return to delay slot which handles DS bit/BTA correctly | ||
| 218 | |||
| 215 | .Lintr_ret_to_delay_slot: | 219 | .Lintr_ret_to_delay_slot: |
| 216 | debug_marker_ds: | 220 | debug_marker_ds: |
| 217 | 221 | ||
| @@ -222,18 +226,23 @@ debug_marker_ds: | |||
| 222 | ld r2, [sp, PT_ret] | 226 | ld r2, [sp, PT_ret] |
| 223 | ld r3, [sp, PT_status32] | 227 | ld r3, [sp, PT_status32] |
| 224 | 228 | ||
| 229 | ; STAT32 for Int return created from scratch | ||
| 230 | ; (No delay dlot, disable Further intr in trampoline) | ||
| 231 | |||
| 225 | bic r0, r3, STATUS_U_MASK|STATUS_DE_MASK|STATUS_IE_MASK|STATUS_L_MASK | 232 | bic r0, r3, STATUS_U_MASK|STATUS_DE_MASK|STATUS_IE_MASK|STATUS_L_MASK |
| 226 | st r0, [sp, PT_status32] | 233 | st r0, [sp, PT_status32] |
| 227 | 234 | ||
| 228 | mov r1, .Lintr_ret_to_delay_slot_2 | 235 | mov r1, .Lintr_ret_to_delay_slot_2 |
| 229 | st r1, [sp, PT_ret] | 236 | st r1, [sp, PT_ret] |
| 230 | 237 | ||
| 238 | ; Orig exception PC/STAT32 safekept @orig_r0 and @event stack slots | ||
| 231 | st r2, [sp, 0] | 239 | st r2, [sp, 0] |
| 232 | st r3, [sp, 4] | 240 | st r3, [sp, 4] |
| 233 | 241 | ||
| 234 | b .Lisr_ret_fast_path | 242 | b .Lisr_ret_fast_path |
| 235 | 243 | ||
| 236 | .Lintr_ret_to_delay_slot_2: | 244 | .Lintr_ret_to_delay_slot_2: |
| 245 | ; Trampoline to restore orig exception PC/STAT32/BTA/AUX_USER_SP | ||
| 237 | sub sp, sp, SZ_PT_REGS | 246 | sub sp, sp, SZ_PT_REGS |
| 238 | st r9, [sp, -4] | 247 | st r9, [sp, -4] |
| 239 | 248 | ||
| @@ -243,11 +252,19 @@ debug_marker_ds: | |||
| 243 | ld r9, [sp, 4] | 252 | ld r9, [sp, 4] |
| 244 | sr r9, [erstatus] | 253 | sr r9, [erstatus] |
| 245 | 254 | ||
| 255 | ; restore AUX_USER_SP if returning to U mode | ||
| 256 | bbit0 r9, STATUS_U_BIT, 1f | ||
| 257 | ld r9, [sp, PT_sp] | ||
| 258 | sr r9, [AUX_USER_SP] | ||
| 259 | |||
| 260 | 1: | ||
| 246 | ld r9, [sp, 8] | 261 | ld r9, [sp, 8] |
| 247 | sr r9, [erbta] | 262 | sr r9, [erbta] |
| 248 | 263 | ||
| 249 | ld r9, [sp, -4] | 264 | ld r9, [sp, -4] |
| 250 | add sp, sp, SZ_PT_REGS | 265 | add sp, sp, SZ_PT_REGS |
| 266 | |||
| 267 | ; return from pure kernel mode to delay slot | ||
| 251 | rtie | 268 | rtie |
| 252 | 269 | ||
| 253 | END(ret_from_exception) | 270 | END(ret_from_exception) |
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index 0394f9f61b46..942526322ae7 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <linux/irqchip.h> | 14 | #include <linux/irqchip.h> |
| 15 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
| 16 | 16 | ||
| 17 | static int irq_prio; | ||
| 18 | |||
| 17 | /* | 19 | /* |
| 18 | * Early Hardware specific Interrupt setup | 20 | * Early Hardware specific Interrupt setup |
| 19 | * -Called very early (start_kernel -> setup_arch -> setup_processor) | 21 | * -Called very early (start_kernel -> setup_arch -> setup_processor) |
| @@ -24,6 +26,14 @@ void arc_init_IRQ(void) | |||
| 24 | { | 26 | { |
| 25 | unsigned int tmp; | 27 | unsigned int tmp; |
| 26 | 28 | ||
| 29 | struct irq_build { | ||
| 30 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
| 31 | unsigned int pad:3, firq:1, prio:4, exts:8, irqs:8, ver:8; | ||
| 32 | #else | ||
| 33 | unsigned int ver:8, irqs:8, exts:8, prio:4, firq:1, pad:3; | ||
| 34 | #endif | ||
| 35 | } irq_bcr; | ||
| 36 | |||
| 27 | struct aux_irq_ctrl { | 37 | struct aux_irq_ctrl { |
| 28 | #ifdef CONFIG_CPU_BIG_ENDIAN | 38 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 29 | unsigned int res3:18, save_idx_regs:1, res2:1, | 39 | unsigned int res3:18, save_idx_regs:1, res2:1, |
| @@ -46,28 +56,25 @@ void arc_init_IRQ(void) | |||
| 46 | 56 | ||
| 47 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); | 57 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); |
| 48 | 58 | ||
| 49 | /* setup status32, don't enable intr yet as kernel doesn't want */ | ||
| 50 | tmp = read_aux_reg(0xa); | ||
| 51 | tmp |= ISA_INIT_STATUS_BITS; | ||
| 52 | tmp &= ~STATUS_IE_MASK; | ||
| 53 | asm volatile("flag %0 \n"::"r"(tmp)); | ||
| 54 | |||
| 55 | /* | 59 | /* |
| 56 | * ARCv2 core intc provides multiple interrupt priorities (upto 16). | 60 | * ARCv2 core intc provides multiple interrupt priorities (upto 16). |
| 57 | * Typical builds though have only two levels (0-high, 1-low) | 61 | * Typical builds though have only two levels (0-high, 1-low) |
| 58 | * Linux by default uses lower prio 1 for most irqs, reserving 0 for | 62 | * Linux by default uses lower prio 1 for most irqs, reserving 0 for |
| 59 | * NMI style interrupts in future (say perf) | 63 | * NMI style interrupts in future (say perf) |
| 60 | * | ||
| 61 | * Read the intc BCR to confirm that Linux default priority is avail | ||
| 62 | * in h/w | ||
| 63 | * | ||
| 64 | * Note: | ||
| 65 | * IRQ_BCR[27..24] contains N-1 (for N priority levels) and prio level | ||
| 66 | * is 0 based. | ||
| 67 | */ | 64 | */ |
| 68 | tmp = (read_aux_reg(ARC_REG_IRQ_BCR) >> 24 ) & 0xF; | 65 | |
| 69 | if (ARCV2_IRQ_DEF_PRIO > tmp) | 66 | READ_BCR(ARC_REG_IRQ_BCR, irq_bcr); |
| 70 | panic("Linux default irq prio incorrect\n"); | 67 | |
| 68 | irq_prio = irq_bcr.prio; /* Encoded as N-1 for N levels */ | ||
| 69 | pr_info("archs-intc\t: %d priority levels (default %d)%s\n", | ||
| 70 | irq_prio + 1, irq_prio, | ||
| 71 | irq_bcr.firq ? " FIRQ (not used)":""); | ||
| 72 | |||
| 73 | /* setup status32, don't enable intr yet as kernel doesn't want */ | ||
| 74 | tmp = read_aux_reg(0xa); | ||
| 75 | tmp |= STATUS_AD_MASK | (irq_prio << 1); | ||
| 76 | tmp &= ~STATUS_IE_MASK; | ||
| 77 | asm volatile("flag %0 \n"::"r"(tmp)); | ||
| 71 | } | 78 | } |
| 72 | 79 | ||
| 73 | static void arcv2_irq_mask(struct irq_data *data) | 80 | static void arcv2_irq_mask(struct irq_data *data) |
| @@ -86,7 +93,7 @@ void arcv2_irq_enable(struct irq_data *data) | |||
| 86 | { | 93 | { |
| 87 | /* set default priority */ | 94 | /* set default priority */ |
| 88 | write_aux_reg(AUX_IRQ_SELECT, data->irq); | 95 | write_aux_reg(AUX_IRQ_SELECT, data->irq); |
| 89 | write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO); | 96 | write_aux_reg(AUX_IRQ_PRIORITY, irq_prio); |
| 90 | 97 | ||
| 91 | /* | 98 | /* |
| 92 | * hw auto enables (linux unmask) all by default | 99 | * hw auto enables (linux unmask) all by default |
diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c index bd237acdf4f2..bc771f58fefb 100644 --- a/arch/arc/kernel/mcip.c +++ b/arch/arc/kernel/mcip.c | |||
| @@ -96,13 +96,13 @@ static void mcip_probe_n_setup(void) | |||
| 96 | #ifdef CONFIG_CPU_BIG_ENDIAN | 96 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 97 | unsigned int pad3:8, | 97 | unsigned int pad3:8, |
| 98 | idu:1, llm:1, num_cores:6, | 98 | idu:1, llm:1, num_cores:6, |
| 99 | iocoh:1, grtc:1, dbg:1, pad2:1, | 99 | iocoh:1, gfrc:1, dbg:1, pad2:1, |
| 100 | msg:1, sem:1, ipi:1, pad:1, | 100 | msg:1, sem:1, ipi:1, pad:1, |
| 101 | ver:8; | 101 | ver:8; |
| 102 | #else | 102 | #else |
| 103 | unsigned int ver:8, | 103 | unsigned int ver:8, |
| 104 | pad:1, ipi:1, sem:1, msg:1, | 104 | pad:1, ipi:1, sem:1, msg:1, |
| 105 | pad2:1, dbg:1, grtc:1, iocoh:1, | 105 | pad2:1, dbg:1, gfrc:1, iocoh:1, |
| 106 | num_cores:6, llm:1, idu:1, | 106 | num_cores:6, llm:1, idu:1, |
| 107 | pad3:8; | 107 | pad3:8; |
| 108 | #endif | 108 | #endif |
| @@ -116,7 +116,7 @@ static void mcip_probe_n_setup(void) | |||
| 116 | IS_AVAIL1(mp.ipi, "IPI "), | 116 | IS_AVAIL1(mp.ipi, "IPI "), |
| 117 | IS_AVAIL1(mp.idu, "IDU "), | 117 | IS_AVAIL1(mp.idu, "IDU "), |
| 118 | IS_AVAIL1(mp.dbg, "DEBUG "), | 118 | IS_AVAIL1(mp.dbg, "DEBUG "), |
| 119 | IS_AVAIL1(mp.grtc, "GRTC")); | 119 | IS_AVAIL1(mp.gfrc, "GFRC")); |
| 120 | 120 | ||
| 121 | idu_detected = mp.idu; | 121 | idu_detected = mp.idu; |
| 122 | 122 | ||
| @@ -125,8 +125,8 @@ static void mcip_probe_n_setup(void) | |||
| 125 | __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf); | 125 | __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | if (IS_ENABLED(CONFIG_ARC_HAS_GRTC) && !mp.grtc) | 128 | if (IS_ENABLED(CONFIG_ARC_HAS_GFRC) && !mp.gfrc) |
| 129 | panic("kernel trying to use non-existent GRTC\n"); | 129 | panic("kernel trying to use non-existent GFRC\n"); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | struct plat_smp_ops plat_smp_ops = { | 132 | struct plat_smp_ops plat_smp_ops = { |
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index e1b87444ea9a..a7edceba5f84 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
| @@ -45,6 +45,7 @@ struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; | |||
| 45 | static void read_arc_build_cfg_regs(void) | 45 | static void read_arc_build_cfg_regs(void) |
| 46 | { | 46 | { |
| 47 | struct bcr_perip uncached_space; | 47 | struct bcr_perip uncached_space; |
| 48 | struct bcr_timer timer; | ||
| 48 | struct bcr_generic bcr; | 49 | struct bcr_generic bcr; |
| 49 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; | 50 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 50 | unsigned long perip_space; | 51 | unsigned long perip_space; |
| @@ -53,7 +54,11 @@ static void read_arc_build_cfg_regs(void) | |||
| 53 | READ_BCR(AUX_IDENTITY, cpu->core); | 54 | READ_BCR(AUX_IDENTITY, cpu->core); |
| 54 | READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); | 55 | READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); |
| 55 | 56 | ||
| 56 | READ_BCR(ARC_REG_TIMERS_BCR, cpu->timers); | 57 | READ_BCR(ARC_REG_TIMERS_BCR, timer); |
| 58 | cpu->extn.timer0 = timer.t0; | ||
| 59 | cpu->extn.timer1 = timer.t1; | ||
| 60 | cpu->extn.rtc = timer.rtc; | ||
| 61 | |||
| 57 | cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); | 62 | cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); |
| 58 | 63 | ||
| 59 | READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); | 64 | READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); |
| @@ -208,9 +213,9 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) | |||
| 208 | (unsigned int)(arc_get_core_freq() / 10000) % 100); | 213 | (unsigned int)(arc_get_core_freq() / 10000) % 100); |
| 209 | 214 | ||
| 210 | n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ", | 215 | n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ", |
| 211 | IS_AVAIL1(cpu->timers.t0, "Timer0 "), | 216 | IS_AVAIL1(cpu->extn.timer0, "Timer0 "), |
| 212 | IS_AVAIL1(cpu->timers.t1, "Timer1 "), | 217 | IS_AVAIL1(cpu->extn.timer1, "Timer1 "), |
| 213 | IS_AVAIL2(cpu->timers.rtc, "64-bit RTC ", | 218 | IS_AVAIL2(cpu->extn.rtc, "Local-64-bit-Ctr ", |
| 214 | CONFIG_ARC_HAS_RTC)); | 219 | CONFIG_ARC_HAS_RTC)); |
| 215 | 220 | ||
| 216 | n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s", | 221 | n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s", |
| @@ -293,13 +298,13 @@ static void arc_chk_core_config(void) | |||
| 293 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; | 298 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 294 | int fpu_enabled; | 299 | int fpu_enabled; |
| 295 | 300 | ||
| 296 | if (!cpu->timers.t0) | 301 | if (!cpu->extn.timer0) |
| 297 | panic("Timer0 is not present!\n"); | 302 | panic("Timer0 is not present!\n"); |
| 298 | 303 | ||
| 299 | if (!cpu->timers.t1) | 304 | if (!cpu->extn.timer1) |
| 300 | panic("Timer1 is not present!\n"); | 305 | panic("Timer1 is not present!\n"); |
| 301 | 306 | ||
| 302 | if (IS_ENABLED(CONFIG_ARC_HAS_RTC) && !cpu->timers.rtc) | 307 | if (IS_ENABLED(CONFIG_ARC_HAS_RTC) && !cpu->extn.rtc) |
| 303 | panic("RTC is not present\n"); | 308 | panic("RTC is not present\n"); |
| 304 | 309 | ||
| 305 | #ifdef CONFIG_ARC_HAS_DCCM | 310 | #ifdef CONFIG_ARC_HAS_DCCM |
| @@ -334,6 +339,7 @@ static void arc_chk_core_config(void) | |||
| 334 | panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); | 339 | panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); |
| 335 | 340 | ||
| 336 | if (is_isa_arcv2() && IS_ENABLED(CONFIG_SMP) && cpu->isa.atomic && | 341 | if (is_isa_arcv2() && IS_ENABLED(CONFIG_SMP) && cpu->isa.atomic && |
| 342 | IS_ENABLED(CONFIG_ARC_HAS_LLSC) && | ||
| 337 | !IS_ENABLED(CONFIG_ARC_STAR_9000923308)) | 343 | !IS_ENABLED(CONFIG_ARC_STAR_9000923308)) |
| 338 | panic("llock/scond livelock workaround missing\n"); | 344 | panic("llock/scond livelock workaround missing\n"); |
| 339 | } | 345 | } |
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index dfad287f1db1..156d9833ff84 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | /********** Clock Source Device *********/ | 63 | /********** Clock Source Device *********/ |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_ARC_HAS_GRTC | 65 | #ifdef CONFIG_ARC_HAS_GFRC |
| 66 | 66 | ||
| 67 | static int arc_counter_setup(void) | 67 | static int arc_counter_setup(void) |
| 68 | { | 68 | { |
| @@ -83,10 +83,10 @@ static cycle_t arc_counter_read(struct clocksource *cs) | |||
| 83 | 83 | ||
| 84 | local_irq_save(flags); | 84 | local_irq_save(flags); |
| 85 | 85 | ||
| 86 | __mcip_cmd(CMD_GRTC_READ_LO, 0); | 86 | __mcip_cmd(CMD_GFRC_READ_LO, 0); |
| 87 | stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); | 87 | stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); |
| 88 | 88 | ||
| 89 | __mcip_cmd(CMD_GRTC_READ_HI, 0); | 89 | __mcip_cmd(CMD_GFRC_READ_HI, 0); |
| 90 | stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); | 90 | stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); |
| 91 | 91 | ||
| 92 | local_irq_restore(flags); | 92 | local_irq_restore(flags); |
| @@ -95,7 +95,7 @@ static cycle_t arc_counter_read(struct clocksource *cs) | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static struct clocksource arc_counter = { | 97 | static struct clocksource arc_counter = { |
| 98 | .name = "ARConnect GRTC", | 98 | .name = "ARConnect GFRC", |
| 99 | .rating = 400, | 99 | .rating = 400, |
| 100 | .read = arc_counter_read, | 100 | .read = arc_counter_read, |
| 101 | .mask = CLOCKSOURCE_MASK(64), | 101 | .mask = CLOCKSOURCE_MASK(64), |
diff --git a/arch/arm/common/icst.c b/arch/arm/common/icst.c index 2dc6da70ae59..d7ed252708c5 100644 --- a/arch/arm/common/icst.c +++ b/arch/arm/common/icst.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | */ | 16 | */ |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | 19 | #include <asm/div64.h> | |
| 20 | #include <asm/hardware/icst.h> | 20 | #include <asm/hardware/icst.h> |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| @@ -29,7 +29,11 @@ EXPORT_SYMBOL(icst525_s2div); | |||
| 29 | 29 | ||
| 30 | unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco) | 30 | unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco) |
| 31 | { | 31 | { |
| 32 | return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]); | 32 | u64 dividend = p->ref * 2 * (u64)(vco.v + 8); |
| 33 | u32 divisor = (vco.r + 2) * p->s2div[vco.s]; | ||
| 34 | |||
| 35 | do_div(dividend, divisor); | ||
| 36 | return (unsigned long)dividend; | ||
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | EXPORT_SYMBOL(icst_hz); | 39 | EXPORT_SYMBOL(icst_hz); |
| @@ -58,6 +62,7 @@ icst_hz_to_vco(const struct icst_params *p, unsigned long freq) | |||
| 58 | 62 | ||
| 59 | if (f > p->vco_min && f <= p->vco_max) | 63 | if (f > p->vco_min && f <= p->vco_max) |
| 60 | break; | 64 | break; |
| 65 | i++; | ||
| 61 | } while (i < 8); | 66 | } while (i < 8); |
| 62 | 67 | ||
| 63 | if (i >= 8) | 68 | if (i >= 8) |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index a7151744b85c..d18d6b42fcf5 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
| @@ -292,24 +292,23 @@ CONFIG_FB=y | |||
| 292 | CONFIG_FIRMWARE_EDID=y | 292 | CONFIG_FIRMWARE_EDID=y |
| 293 | CONFIG_FB_MODE_HELPERS=y | 293 | CONFIG_FB_MODE_HELPERS=y |
| 294 | CONFIG_FB_TILEBLITTING=y | 294 | CONFIG_FB_TILEBLITTING=y |
| 295 | CONFIG_OMAP2_DSS=m | 295 | CONFIG_FB_OMAP5_DSS_HDMI=y |
| 296 | CONFIG_OMAP5_DSS_HDMI=y | 296 | CONFIG_FB_OMAP2_DSS_SDI=y |
| 297 | CONFIG_OMAP2_DSS_SDI=y | 297 | CONFIG_FB_OMAP2_DSS_DSI=y |
| 298 | CONFIG_OMAP2_DSS_DSI=y | ||
| 299 | CONFIG_FB_OMAP2=m | 298 | CONFIG_FB_OMAP2=m |
| 300 | CONFIG_DISPLAY_ENCODER_TFP410=m | 299 | CONFIG_FB_OMAP2_ENCODER_TFP410=m |
| 301 | CONFIG_DISPLAY_ENCODER_TPD12S015=m | 300 | CONFIG_FB_OMAP2_ENCODER_TPD12S015=m |
| 302 | CONFIG_DISPLAY_CONNECTOR_DVI=m | 301 | CONFIG_FB_OMAP2_CONNECTOR_DVI=m |
| 303 | CONFIG_DISPLAY_CONNECTOR_HDMI=m | 302 | CONFIG_FB_OMAP2_CONNECTOR_HDMI=m |
| 304 | CONFIG_DISPLAY_CONNECTOR_ANALOG_TV=m | 303 | CONFIG_FB_OMAP2_CONNECTOR_ANALOG_TV=m |
| 305 | CONFIG_DISPLAY_PANEL_DPI=m | 304 | CONFIG_FB_OMAP2_PANEL_DPI=m |
| 306 | CONFIG_DISPLAY_PANEL_DSI_CM=m | 305 | CONFIG_FB_OMAP2_PANEL_DSI_CM=m |
| 307 | CONFIG_DISPLAY_PANEL_SONY_ACX565AKM=m | 306 | CONFIG_FB_OMAP2_PANEL_SONY_ACX565AKM=m |
| 308 | CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02=m | 307 | CONFIG_FB_OMAP2_PANEL_LGPHILIPS_LB035Q02=m |
| 309 | CONFIG_DISPLAY_PANEL_SHARP_LS037V7DW01=m | 308 | CONFIG_FB_OMAP2_PANEL_SHARP_LS037V7DW01=m |
| 310 | CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1=m | 309 | CONFIG_FB_OMAP2_PANEL_TPO_TD028TTEC1=m |
| 311 | CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1=m | 310 | CONFIG_FB_OMAP2_PANEL_TPO_TD043MTEA1=m |
| 312 | CONFIG_DISPLAY_PANEL_NEC_NL8048HL11=m | 311 | CONFIG_FB_OMAP2_PANEL_NEC_NL8048HL11=m |
| 313 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 312 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
| 314 | CONFIG_LCD_CLASS_DEVICE=y | 313 | CONFIG_LCD_CLASS_DEVICE=y |
| 315 | CONFIG_LCD_PLATFORM=y | 314 | CONFIG_LCD_PLATFORM=y |
diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h index 2731d3b25ed2..8ec88e5b290f 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h | |||
| @@ -103,6 +103,7 @@ static inline u64 gic_read_iar_common(void) | |||
| 103 | u64 irqstat; | 103 | u64 irqstat; |
| 104 | 104 | ||
| 105 | asm volatile("mrs_s %0, " __stringify(ICC_IAR1_EL1) : "=r" (irqstat)); | 105 | asm volatile("mrs_s %0, " __stringify(ICC_IAR1_EL1) : "=r" (irqstat)); |
| 106 | dsb(sy); | ||
| 106 | return irqstat; | 107 | return irqstat; |
| 107 | } | 108 | } |
| 108 | 109 | ||
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 738a95f93e49..d201d4b396d1 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h | |||
| @@ -107,8 +107,6 @@ | |||
| 107 | #define TCR_EL2_MASK (TCR_EL2_TG0 | TCR_EL2_SH0 | \ | 107 | #define TCR_EL2_MASK (TCR_EL2_TG0 | TCR_EL2_SH0 | \ |
| 108 | TCR_EL2_ORGN0 | TCR_EL2_IRGN0 | TCR_EL2_T0SZ) | 108 | TCR_EL2_ORGN0 | TCR_EL2_IRGN0 | TCR_EL2_T0SZ) |
| 109 | 109 | ||
| 110 | #define TCR_EL2_FLAGS (TCR_EL2_RES1 | TCR_EL2_PS_40B) | ||
| 111 | |||
| 112 | /* VTCR_EL2 Registers bits */ | 110 | /* VTCR_EL2 Registers bits */ |
| 113 | #define VTCR_EL2_RES1 (1 << 31) | 111 | #define VTCR_EL2_RES1 (1 << 31) |
| 114 | #define VTCR_EL2_PS_MASK (7 << 16) | 112 | #define VTCR_EL2_PS_MASK (7 << 16) |
| @@ -182,6 +180,7 @@ | |||
| 182 | #define CPTR_EL2_TCPAC (1 << 31) | 180 | #define CPTR_EL2_TCPAC (1 << 31) |
| 183 | #define CPTR_EL2_TTA (1 << 20) | 181 | #define CPTR_EL2_TTA (1 << 20) |
| 184 | #define CPTR_EL2_TFP (1 << CPTR_EL2_TFP_SHIFT) | 182 | #define CPTR_EL2_TFP (1 << CPTR_EL2_TFP_SHIFT) |
| 183 | #define CPTR_EL2_DEFAULT 0x000033ff | ||
| 185 | 184 | ||
| 186 | /* Hyp Debug Configuration Register bits */ | 185 | /* Hyp Debug Configuration Register bits */ |
| 187 | #define MDCR_EL2_TDRA (1 << 11) | 186 | #define MDCR_EL2_TDRA (1 << 11) |
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 3066328cd86b..779a5872a2c5 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h | |||
| @@ -127,10 +127,14 @@ static inline unsigned long *vcpu_spsr(const struct kvm_vcpu *vcpu) | |||
| 127 | 127 | ||
| 128 | static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu) | 128 | static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu) |
| 129 | { | 129 | { |
| 130 | u32 mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK; | 130 | u32 mode; |
| 131 | 131 | ||
| 132 | if (vcpu_mode_is_32bit(vcpu)) | 132 | if (vcpu_mode_is_32bit(vcpu)) { |
| 133 | mode = *vcpu_cpsr(vcpu) & COMPAT_PSR_MODE_MASK; | ||
| 133 | return mode > COMPAT_PSR_MODE_USR; | 134 | return mode > COMPAT_PSR_MODE_USR; |
| 135 | } | ||
| 136 | |||
| 137 | mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK; | ||
| 134 | 138 | ||
| 135 | return mode != PSR_MODE_EL0t; | 139 | return mode != PSR_MODE_EL0t; |
| 136 | } | 140 | } |
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index 3e568dcd907b..d073b5a216f7 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S | |||
| @@ -64,7 +64,7 @@ __do_hyp_init: | |||
| 64 | mrs x4, tcr_el1 | 64 | mrs x4, tcr_el1 |
| 65 | ldr x5, =TCR_EL2_MASK | 65 | ldr x5, =TCR_EL2_MASK |
| 66 | and x4, x4, x5 | 66 | and x4, x4, x5 |
| 67 | ldr x5, =TCR_EL2_FLAGS | 67 | mov x5, #TCR_EL2_RES1 |
| 68 | orr x4, x4, x5 | 68 | orr x4, x4, x5 |
| 69 | 69 | ||
| 70 | #ifndef CONFIG_ARM64_VA_BITS_48 | 70 | #ifndef CONFIG_ARM64_VA_BITS_48 |
| @@ -85,15 +85,17 @@ __do_hyp_init: | |||
| 85 | ldr_l x5, idmap_t0sz | 85 | ldr_l x5, idmap_t0sz |
| 86 | bfi x4, x5, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH | 86 | bfi x4, x5, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH |
| 87 | #endif | 87 | #endif |
| 88 | msr tcr_el2, x4 | ||
| 89 | |||
| 90 | ldr x4, =VTCR_EL2_FLAGS | ||
| 91 | /* | 88 | /* |
| 92 | * Read the PARange bits from ID_AA64MMFR0_EL1 and set the PS bits in | 89 | * Read the PARange bits from ID_AA64MMFR0_EL1 and set the PS bits in |
| 93 | * VTCR_EL2. | 90 | * TCR_EL2 and VTCR_EL2. |
| 94 | */ | 91 | */ |
| 95 | mrs x5, ID_AA64MMFR0_EL1 | 92 | mrs x5, ID_AA64MMFR0_EL1 |
| 96 | bfi x4, x5, #16, #3 | 93 | bfi x4, x5, #16, #3 |
| 94 | |||
| 95 | msr tcr_el2, x4 | ||
| 96 | |||
| 97 | ldr x4, =VTCR_EL2_FLAGS | ||
| 98 | bfi x4, x5, #16, #3 | ||
| 97 | /* | 99 | /* |
| 98 | * Read the VMIDBits bits from ID_AA64MMFR1_EL1 and set the VS bit in | 100 | * Read the VMIDBits bits from ID_AA64MMFR1_EL1 and set the VS bit in |
| 99 | * VTCR_EL2. | 101 | * VTCR_EL2. |
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index ca8f5a5e2f96..f0e7bdfae134 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c | |||
| @@ -36,7 +36,11 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) | |||
| 36 | write_sysreg(val, hcr_el2); | 36 | write_sysreg(val, hcr_el2); |
| 37 | /* Trap on AArch32 cp15 c15 accesses (EL1 or EL0) */ | 37 | /* Trap on AArch32 cp15 c15 accesses (EL1 or EL0) */ |
| 38 | write_sysreg(1 << 15, hstr_el2); | 38 | write_sysreg(1 << 15, hstr_el2); |
| 39 | write_sysreg(CPTR_EL2_TTA | CPTR_EL2_TFP, cptr_el2); | 39 | |
| 40 | val = CPTR_EL2_DEFAULT; | ||
| 41 | val |= CPTR_EL2_TTA | CPTR_EL2_TFP; | ||
| 42 | write_sysreg(val, cptr_el2); | ||
| 43 | |||
| 40 | write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); | 44 | write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); |
| 41 | } | 45 | } |
| 42 | 46 | ||
| @@ -45,7 +49,7 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) | |||
| 45 | write_sysreg(HCR_RW, hcr_el2); | 49 | write_sysreg(HCR_RW, hcr_el2); |
| 46 | write_sysreg(0, hstr_el2); | 50 | write_sysreg(0, hstr_el2); |
| 47 | write_sysreg(read_sysreg(mdcr_el2) & MDCR_EL2_HPMN_MASK, mdcr_el2); | 51 | write_sysreg(read_sysreg(mdcr_el2) & MDCR_EL2_HPMN_MASK, mdcr_el2); |
| 48 | write_sysreg(0, cptr_el2); | 52 | write_sysreg(CPTR_EL2_DEFAULT, cptr_el2); |
| 49 | } | 53 | } |
| 50 | 54 | ||
| 51 | static void __hyp_text __activate_vm(struct kvm_vcpu *vcpu) | 55 | static void __hyp_text __activate_vm(struct kvm_vcpu *vcpu) |
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c index 648112e90ed5..4d1ac81870d2 100644 --- a/arch/arm64/kvm/inject_fault.c +++ b/arch/arm64/kvm/inject_fault.c | |||
| @@ -27,7 +27,11 @@ | |||
| 27 | 27 | ||
| 28 | #define PSTATE_FAULT_BITS_64 (PSR_MODE_EL1h | PSR_A_BIT | PSR_F_BIT | \ | 28 | #define PSTATE_FAULT_BITS_64 (PSR_MODE_EL1h | PSR_A_BIT | PSR_F_BIT | \ |
| 29 | PSR_I_BIT | PSR_D_BIT) | 29 | PSR_I_BIT | PSR_D_BIT) |
| 30 | #define EL1_EXCEPT_SYNC_OFFSET 0x200 | 30 | |
| 31 | #define CURRENT_EL_SP_EL0_VECTOR 0x0 | ||
| 32 | #define CURRENT_EL_SP_ELx_VECTOR 0x200 | ||
| 33 | #define LOWER_EL_AArch64_VECTOR 0x400 | ||
| 34 | #define LOWER_EL_AArch32_VECTOR 0x600 | ||
| 31 | 35 | ||
| 32 | static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) | 36 | static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) |
| 33 | { | 37 | { |
| @@ -97,6 +101,34 @@ static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, | |||
| 97 | *fsr = 0x14; | 101 | *fsr = 0x14; |
| 98 | } | 102 | } |
| 99 | 103 | ||
| 104 | enum exception_type { | ||
| 105 | except_type_sync = 0, | ||
| 106 | except_type_irq = 0x80, | ||
| 107 | except_type_fiq = 0x100, | ||
| 108 | except_type_serror = 0x180, | ||
| 109 | }; | ||
| 110 | |||
| 111 | static u64 get_except_vector(struct kvm_vcpu *vcpu, enum exception_type type) | ||
| 112 | { | ||
| 113 | u64 exc_offset; | ||
| 114 | |||
| 115 | switch (*vcpu_cpsr(vcpu) & (PSR_MODE_MASK | PSR_MODE32_BIT)) { | ||
| 116 | case PSR_MODE_EL1t: | ||
| 117 | exc_offset = CURRENT_EL_SP_EL0_VECTOR; | ||
| 118 | break; | ||
| 119 | case PSR_MODE_EL1h: | ||
| 120 | exc_offset = CURRENT_EL_SP_ELx_VECTOR; | ||
| 121 | break; | ||
| 122 | case PSR_MODE_EL0t: | ||
| 123 | exc_offset = LOWER_EL_AArch64_VECTOR; | ||
| 124 | break; | ||
| 125 | default: | ||
| 126 | exc_offset = LOWER_EL_AArch32_VECTOR; | ||
| 127 | } | ||
| 128 | |||
| 129 | return vcpu_sys_reg(vcpu, VBAR_EL1) + exc_offset + type; | ||
| 130 | } | ||
| 131 | |||
| 100 | static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addr) | 132 | static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addr) |
| 101 | { | 133 | { |
| 102 | unsigned long cpsr = *vcpu_cpsr(vcpu); | 134 | unsigned long cpsr = *vcpu_cpsr(vcpu); |
| @@ -108,8 +140,8 @@ static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addr | |||
| 108 | *vcpu_spsr(vcpu) = cpsr; | 140 | *vcpu_spsr(vcpu) = cpsr; |
| 109 | *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu); | 141 | *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu); |
| 110 | 142 | ||
| 143 | *vcpu_pc(vcpu) = get_except_vector(vcpu, except_type_sync); | ||
| 111 | *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64; | 144 | *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64; |
| 112 | *vcpu_pc(vcpu) = vcpu_sys_reg(vcpu, VBAR_EL1) + EL1_EXCEPT_SYNC_OFFSET; | ||
| 113 | 145 | ||
| 114 | vcpu_sys_reg(vcpu, FAR_EL1) = addr; | 146 | vcpu_sys_reg(vcpu, FAR_EL1) = addr; |
| 115 | 147 | ||
| @@ -143,8 +175,8 @@ static void inject_undef64(struct kvm_vcpu *vcpu) | |||
| 143 | *vcpu_spsr(vcpu) = cpsr; | 175 | *vcpu_spsr(vcpu) = cpsr; |
| 144 | *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu); | 176 | *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu); |
| 145 | 177 | ||
| 178 | *vcpu_pc(vcpu) = get_except_vector(vcpu, except_type_sync); | ||
| 146 | *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64; | 179 | *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64; |
| 147 | *vcpu_pc(vcpu) = vcpu_sys_reg(vcpu, VBAR_EL1) + EL1_EXCEPT_SYNC_OFFSET; | ||
| 148 | 180 | ||
| 149 | /* | 181 | /* |
| 150 | * Build an unknown exception, depending on the instruction | 182 | * Build an unknown exception, depending on the instruction |
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index eec3598b4184..2e90371cfb37 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
| @@ -1007,10 +1007,9 @@ static int emulate_cp(struct kvm_vcpu *vcpu, | |||
| 1007 | if (likely(r->access(vcpu, params, r))) { | 1007 | if (likely(r->access(vcpu, params, r))) { |
| 1008 | /* Skip instruction, since it was emulated */ | 1008 | /* Skip instruction, since it was emulated */ |
| 1009 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); | 1009 | kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); |
| 1010 | /* Handled */ | ||
| 1011 | return 0; | ||
| 1010 | } | 1012 | } |
| 1011 | |||
| 1012 | /* Handled */ | ||
| 1013 | return 0; | ||
| 1014 | } | 1013 | } |
| 1015 | 1014 | ||
| 1016 | /* Not handled */ | 1015 | /* Not handled */ |
| @@ -1043,7 +1042,7 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu, | |||
| 1043 | } | 1042 | } |
| 1044 | 1043 | ||
| 1045 | /** | 1044 | /** |
| 1046 | * kvm_handle_cp_64 -- handles a mrrc/mcrr trap on a guest CP15 access | 1045 | * kvm_handle_cp_64 -- handles a mrrc/mcrr trap on a guest CP14/CP15 access |
| 1047 | * @vcpu: The VCPU pointer | 1046 | * @vcpu: The VCPU pointer |
| 1048 | * @run: The kvm_run struct | 1047 | * @run: The kvm_run struct |
| 1049 | */ | 1048 | */ |
| @@ -1095,7 +1094,7 @@ out: | |||
| 1095 | } | 1094 | } |
| 1096 | 1095 | ||
| 1097 | /** | 1096 | /** |
| 1098 | * kvm_handle_cp15_32 -- handles a mrc/mcr trap on a guest CP15 access | 1097 | * kvm_handle_cp_32 -- handles a mrc/mcr trap on a guest CP14/CP15 access |
| 1099 | * @vcpu: The VCPU pointer | 1098 | * @vcpu: The VCPU pointer |
| 1100 | * @run: The kvm_run struct | 1099 | * @run: The kvm_run struct |
| 1101 | */ | 1100 | */ |
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig index fc96e814188e..d1fc4796025e 100644 --- a/arch/m68k/configs/amiga_defconfig +++ b/arch/m68k/configs/amiga_defconfig | |||
| @@ -108,6 +108,8 @@ CONFIG_NFT_NAT=m | |||
| 108 | CONFIG_NFT_QUEUE=m | 108 | CONFIG_NFT_QUEUE=m |
| 109 | CONFIG_NFT_REJECT=m | 109 | CONFIG_NFT_REJECT=m |
| 110 | CONFIG_NFT_COMPAT=m | 110 | CONFIG_NFT_COMPAT=m |
| 111 | CONFIG_NFT_DUP_NETDEV=m | ||
| 112 | CONFIG_NFT_FWD_NETDEV=m | ||
| 111 | CONFIG_NETFILTER_XT_SET=m | 113 | CONFIG_NETFILTER_XT_SET=m |
| 112 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 114 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 113 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 115 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -266,6 +268,12 @@ CONFIG_L2TP=m | |||
| 266 | CONFIG_BRIDGE=m | 268 | CONFIG_BRIDGE=m |
| 267 | CONFIG_ATALK=m | 269 | CONFIG_ATALK=m |
| 268 | CONFIG_6LOWPAN=m | 270 | CONFIG_6LOWPAN=m |
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 272 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 273 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 274 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 275 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 276 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 269 | CONFIG_DNS_RESOLVER=y | 277 | CONFIG_DNS_RESOLVER=y |
| 270 | CONFIG_BATMAN_ADV=m | 278 | CONFIG_BATMAN_ADV=m |
| 271 | CONFIG_BATMAN_ADV_DAT=y | 279 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -366,6 +374,7 @@ CONFIG_ARIADNE=y | |||
| 366 | # CONFIG_NET_VENDOR_INTEL is not set | 374 | # CONFIG_NET_VENDOR_INTEL is not set |
| 367 | # CONFIG_NET_VENDOR_MARVELL is not set | 375 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 368 | # CONFIG_NET_VENDOR_MICREL is not set | 376 | # CONFIG_NET_VENDOR_MICREL is not set |
| 377 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 369 | CONFIG_HYDRA=y | 378 | CONFIG_HYDRA=y |
| 370 | CONFIG_APNE=y | 379 | CONFIG_APNE=y |
| 371 | CONFIG_ZORRO8390=y | 380 | CONFIG_ZORRO8390=y |
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig index 05c904f08d9d..9bfe8be3658c 100644 --- a/arch/m68k/configs/apollo_defconfig +++ b/arch/m68k/configs/apollo_defconfig | |||
| @@ -106,6 +106,8 @@ CONFIG_NFT_NAT=m | |||
| 106 | CONFIG_NFT_QUEUE=m | 106 | CONFIG_NFT_QUEUE=m |
| 107 | CONFIG_NFT_REJECT=m | 107 | CONFIG_NFT_REJECT=m |
| 108 | CONFIG_NFT_COMPAT=m | 108 | CONFIG_NFT_COMPAT=m |
| 109 | CONFIG_NFT_DUP_NETDEV=m | ||
| 110 | CONFIG_NFT_FWD_NETDEV=m | ||
| 109 | CONFIG_NETFILTER_XT_SET=m | 111 | CONFIG_NETFILTER_XT_SET=m |
| 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 112 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 113 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -264,6 +266,12 @@ CONFIG_L2TP=m | |||
| 264 | CONFIG_BRIDGE=m | 266 | CONFIG_BRIDGE=m |
| 265 | CONFIG_ATALK=m | 267 | CONFIG_ATALK=m |
| 266 | CONFIG_6LOWPAN=m | 268 | CONFIG_6LOWPAN=m |
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 270 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 271 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 273 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 274 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 267 | CONFIG_DNS_RESOLVER=y | 275 | CONFIG_DNS_RESOLVER=y |
| 268 | CONFIG_BATMAN_ADV=m | 276 | CONFIG_BATMAN_ADV=m |
| 269 | CONFIG_BATMAN_ADV_DAT=y | 277 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -344,6 +352,7 @@ CONFIG_VETH=m | |||
| 344 | # CONFIG_NET_VENDOR_MARVELL is not set | 352 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 345 | # CONFIG_NET_VENDOR_MICREL is not set | 353 | # CONFIG_NET_VENDOR_MICREL is not set |
| 346 | # CONFIG_NET_VENDOR_NATSEMI is not set | 354 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 355 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 347 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 356 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 348 | # CONFIG_NET_VENDOR_RENESAS is not set | 357 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 349 | # CONFIG_NET_VENDOR_ROCKER is not set | 358 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig index d572b731c510..ebdcfae55580 100644 --- a/arch/m68k/configs/atari_defconfig +++ b/arch/m68k/configs/atari_defconfig | |||
| @@ -106,6 +106,8 @@ CONFIG_NFT_NAT=m | |||
| 106 | CONFIG_NFT_QUEUE=m | 106 | CONFIG_NFT_QUEUE=m |
| 107 | CONFIG_NFT_REJECT=m | 107 | CONFIG_NFT_REJECT=m |
| 108 | CONFIG_NFT_COMPAT=m | 108 | CONFIG_NFT_COMPAT=m |
| 109 | CONFIG_NFT_DUP_NETDEV=m | ||
| 110 | CONFIG_NFT_FWD_NETDEV=m | ||
| 109 | CONFIG_NETFILTER_XT_SET=m | 111 | CONFIG_NETFILTER_XT_SET=m |
| 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 112 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 113 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -264,6 +266,12 @@ CONFIG_L2TP=m | |||
| 264 | CONFIG_BRIDGE=m | 266 | CONFIG_BRIDGE=m |
| 265 | CONFIG_ATALK=m | 267 | CONFIG_ATALK=m |
| 266 | CONFIG_6LOWPAN=m | 268 | CONFIG_6LOWPAN=m |
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 270 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 271 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 273 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 274 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 267 | CONFIG_DNS_RESOLVER=y | 275 | CONFIG_DNS_RESOLVER=y |
| 268 | CONFIG_BATMAN_ADV=m | 276 | CONFIG_BATMAN_ADV=m |
| 269 | CONFIG_BATMAN_ADV_DAT=y | 277 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -353,6 +361,7 @@ CONFIG_ATARILANCE=y | |||
| 353 | # CONFIG_NET_VENDOR_INTEL is not set | 361 | # CONFIG_NET_VENDOR_INTEL is not set |
| 354 | # CONFIG_NET_VENDOR_MARVELL is not set | 362 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 355 | # CONFIG_NET_VENDOR_MICREL is not set | 363 | # CONFIG_NET_VENDOR_MICREL is not set |
| 364 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 356 | CONFIG_NE2000=y | 365 | CONFIG_NE2000=y |
| 357 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 366 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 358 | # CONFIG_NET_VENDOR_RENESAS is not set | 367 | # CONFIG_NET_VENDOR_RENESAS is not set |
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig index 11a30c65ad44..8acc65e54995 100644 --- a/arch/m68k/configs/bvme6000_defconfig +++ b/arch/m68k/configs/bvme6000_defconfig | |||
| @@ -104,6 +104,8 @@ CONFIG_NFT_NAT=m | |||
| 104 | CONFIG_NFT_QUEUE=m | 104 | CONFIG_NFT_QUEUE=m |
| 105 | CONFIG_NFT_REJECT=m | 105 | CONFIG_NFT_REJECT=m |
| 106 | CONFIG_NFT_COMPAT=m | 106 | CONFIG_NFT_COMPAT=m |
| 107 | CONFIG_NFT_DUP_NETDEV=m | ||
| 108 | CONFIG_NFT_FWD_NETDEV=m | ||
| 107 | CONFIG_NETFILTER_XT_SET=m | 109 | CONFIG_NETFILTER_XT_SET=m |
| 108 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 109 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -262,6 +264,12 @@ CONFIG_L2TP=m | |||
| 262 | CONFIG_BRIDGE=m | 264 | CONFIG_BRIDGE=m |
| 263 | CONFIG_ATALK=m | 265 | CONFIG_ATALK=m |
| 264 | CONFIG_6LOWPAN=m | 266 | CONFIG_6LOWPAN=m |
| 267 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 268 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 269 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 270 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 265 | CONFIG_DNS_RESOLVER=y | 273 | CONFIG_DNS_RESOLVER=y |
| 266 | CONFIG_BATMAN_ADV=m | 274 | CONFIG_BATMAN_ADV=m |
| 267 | CONFIG_BATMAN_ADV_DAT=y | 275 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -343,6 +351,7 @@ CONFIG_BVME6000_NET=y | |||
| 343 | # CONFIG_NET_VENDOR_MARVELL is not set | 351 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 344 | # CONFIG_NET_VENDOR_MICREL is not set | 352 | # CONFIG_NET_VENDOR_MICREL is not set |
| 345 | # CONFIG_NET_VENDOR_NATSEMI is not set | 353 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 354 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 346 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 355 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 347 | # CONFIG_NET_VENDOR_RENESAS is not set | 356 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 348 | # CONFIG_NET_VENDOR_ROCKER is not set | 357 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig index 6630a5154b9d..0c6a3d52b26e 100644 --- a/arch/m68k/configs/hp300_defconfig +++ b/arch/m68k/configs/hp300_defconfig | |||
| @@ -106,6 +106,8 @@ CONFIG_NFT_NAT=m | |||
| 106 | CONFIG_NFT_QUEUE=m | 106 | CONFIG_NFT_QUEUE=m |
| 107 | CONFIG_NFT_REJECT=m | 107 | CONFIG_NFT_REJECT=m |
| 108 | CONFIG_NFT_COMPAT=m | 108 | CONFIG_NFT_COMPAT=m |
| 109 | CONFIG_NFT_DUP_NETDEV=m | ||
| 110 | CONFIG_NFT_FWD_NETDEV=m | ||
| 109 | CONFIG_NETFILTER_XT_SET=m | 111 | CONFIG_NETFILTER_XT_SET=m |
| 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 112 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 113 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -264,6 +266,12 @@ CONFIG_L2TP=m | |||
| 264 | CONFIG_BRIDGE=m | 266 | CONFIG_BRIDGE=m |
| 265 | CONFIG_ATALK=m | 267 | CONFIG_ATALK=m |
| 266 | CONFIG_6LOWPAN=m | 268 | CONFIG_6LOWPAN=m |
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 270 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 271 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 273 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 274 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 267 | CONFIG_DNS_RESOLVER=y | 275 | CONFIG_DNS_RESOLVER=y |
| 268 | CONFIG_BATMAN_ADV=m | 276 | CONFIG_BATMAN_ADV=m |
| 269 | CONFIG_BATMAN_ADV_DAT=y | 277 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -345,6 +353,7 @@ CONFIG_HPLANCE=y | |||
| 345 | # CONFIG_NET_VENDOR_MARVELL is not set | 353 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 346 | # CONFIG_NET_VENDOR_MICREL is not set | 354 | # CONFIG_NET_VENDOR_MICREL is not set |
| 347 | # CONFIG_NET_VENDOR_NATSEMI is not set | 355 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 356 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 348 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 357 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 349 | # CONFIG_NET_VENDOR_RENESAS is not set | 358 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 350 | # CONFIG_NET_VENDOR_ROCKER is not set | 359 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig index 1d90b71d0903..12a8a6cb32f4 100644 --- a/arch/m68k/configs/mac_defconfig +++ b/arch/m68k/configs/mac_defconfig | |||
| @@ -105,6 +105,8 @@ CONFIG_NFT_NAT=m | |||
| 105 | CONFIG_NFT_QUEUE=m | 105 | CONFIG_NFT_QUEUE=m |
| 106 | CONFIG_NFT_REJECT=m | 106 | CONFIG_NFT_REJECT=m |
| 107 | CONFIG_NFT_COMPAT=m | 107 | CONFIG_NFT_COMPAT=m |
| 108 | CONFIG_NFT_DUP_NETDEV=m | ||
| 109 | CONFIG_NFT_FWD_NETDEV=m | ||
| 108 | CONFIG_NETFILTER_XT_SET=m | 110 | CONFIG_NETFILTER_XT_SET=m |
| 109 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 111 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 110 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 112 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -266,6 +268,12 @@ CONFIG_DEV_APPLETALK=m | |||
| 266 | CONFIG_IPDDP=m | 268 | CONFIG_IPDDP=m |
| 267 | CONFIG_IPDDP_ENCAP=y | 269 | CONFIG_IPDDP_ENCAP=y |
| 268 | CONFIG_6LOWPAN=m | 270 | CONFIG_6LOWPAN=m |
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 272 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 273 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 274 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 275 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 276 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 269 | CONFIG_DNS_RESOLVER=y | 277 | CONFIG_DNS_RESOLVER=y |
| 270 | CONFIG_BATMAN_ADV=m | 278 | CONFIG_BATMAN_ADV=m |
| 271 | CONFIG_BATMAN_ADV_DAT=y | 279 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -362,6 +370,7 @@ CONFIG_MAC89x0=y | |||
| 362 | # CONFIG_NET_VENDOR_MARVELL is not set | 370 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 363 | # CONFIG_NET_VENDOR_MICREL is not set | 371 | # CONFIG_NET_VENDOR_MICREL is not set |
| 364 | CONFIG_MACSONIC=y | 372 | CONFIG_MACSONIC=y |
| 373 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 365 | CONFIG_MAC8390=y | 374 | CONFIG_MAC8390=y |
| 366 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 375 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 367 | # CONFIG_NET_VENDOR_RENESAS is not set | 376 | # CONFIG_NET_VENDOR_RENESAS is not set |
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig index 1fd21c1ca87f..64ff2dcb34c8 100644 --- a/arch/m68k/configs/multi_defconfig +++ b/arch/m68k/configs/multi_defconfig | |||
| @@ -115,6 +115,8 @@ CONFIG_NFT_NAT=m | |||
| 115 | CONFIG_NFT_QUEUE=m | 115 | CONFIG_NFT_QUEUE=m |
| 116 | CONFIG_NFT_REJECT=m | 116 | CONFIG_NFT_REJECT=m |
| 117 | CONFIG_NFT_COMPAT=m | 117 | CONFIG_NFT_COMPAT=m |
| 118 | CONFIG_NFT_DUP_NETDEV=m | ||
| 119 | CONFIG_NFT_FWD_NETDEV=m | ||
| 118 | CONFIG_NETFILTER_XT_SET=m | 120 | CONFIG_NETFILTER_XT_SET=m |
| 119 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 121 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 120 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 122 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -276,6 +278,12 @@ CONFIG_DEV_APPLETALK=m | |||
| 276 | CONFIG_IPDDP=m | 278 | CONFIG_IPDDP=m |
| 277 | CONFIG_IPDDP_ENCAP=y | 279 | CONFIG_IPDDP_ENCAP=y |
| 278 | CONFIG_6LOWPAN=m | 280 | CONFIG_6LOWPAN=m |
| 281 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 282 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 283 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 284 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 285 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 286 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 279 | CONFIG_DNS_RESOLVER=y | 287 | CONFIG_DNS_RESOLVER=y |
| 280 | CONFIG_BATMAN_ADV=m | 288 | CONFIG_BATMAN_ADV=m |
| 281 | CONFIG_BATMAN_ADV_DAT=y | 289 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -404,6 +412,7 @@ CONFIG_MVME16x_NET=y | |||
| 404 | # CONFIG_NET_VENDOR_MARVELL is not set | 412 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 405 | # CONFIG_NET_VENDOR_MICREL is not set | 413 | # CONFIG_NET_VENDOR_MICREL is not set |
| 406 | CONFIG_MACSONIC=y | 414 | CONFIG_MACSONIC=y |
| 415 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 407 | CONFIG_HYDRA=y | 416 | CONFIG_HYDRA=y |
| 408 | CONFIG_MAC8390=y | 417 | CONFIG_MAC8390=y |
| 409 | CONFIG_NE2000=y | 418 | CONFIG_NE2000=y |
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig index 74e10f79d7b1..07fc6abcfe0c 100644 --- a/arch/m68k/configs/mvme147_defconfig +++ b/arch/m68k/configs/mvme147_defconfig | |||
| @@ -103,6 +103,8 @@ CONFIG_NFT_NAT=m | |||
| 103 | CONFIG_NFT_QUEUE=m | 103 | CONFIG_NFT_QUEUE=m |
| 104 | CONFIG_NFT_REJECT=m | 104 | CONFIG_NFT_REJECT=m |
| 105 | CONFIG_NFT_COMPAT=m | 105 | CONFIG_NFT_COMPAT=m |
| 106 | CONFIG_NFT_DUP_NETDEV=m | ||
| 107 | CONFIG_NFT_FWD_NETDEV=m | ||
| 106 | CONFIG_NETFILTER_XT_SET=m | 108 | CONFIG_NETFILTER_XT_SET=m |
| 107 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 109 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 108 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 110 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -261,6 +263,12 @@ CONFIG_L2TP=m | |||
| 261 | CONFIG_BRIDGE=m | 263 | CONFIG_BRIDGE=m |
| 262 | CONFIG_ATALK=m | 264 | CONFIG_ATALK=m |
| 263 | CONFIG_6LOWPAN=m | 265 | CONFIG_6LOWPAN=m |
| 266 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 267 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 268 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 270 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 264 | CONFIG_DNS_RESOLVER=y | 272 | CONFIG_DNS_RESOLVER=y |
| 265 | CONFIG_BATMAN_ADV=m | 273 | CONFIG_BATMAN_ADV=m |
| 266 | CONFIG_BATMAN_ADV_DAT=y | 274 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -343,6 +351,7 @@ CONFIG_MVME147_NET=y | |||
| 343 | # CONFIG_NET_VENDOR_MARVELL is not set | 351 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 344 | # CONFIG_NET_VENDOR_MICREL is not set | 352 | # CONFIG_NET_VENDOR_MICREL is not set |
| 345 | # CONFIG_NET_VENDOR_NATSEMI is not set | 353 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 354 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 346 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 355 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 347 | # CONFIG_NET_VENDOR_RENESAS is not set | 356 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 348 | # CONFIG_NET_VENDOR_ROCKER is not set | 357 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig index 7034e716f166..69903ded88f7 100644 --- a/arch/m68k/configs/mvme16x_defconfig +++ b/arch/m68k/configs/mvme16x_defconfig | |||
| @@ -104,6 +104,8 @@ CONFIG_NFT_NAT=m | |||
| 104 | CONFIG_NFT_QUEUE=m | 104 | CONFIG_NFT_QUEUE=m |
| 105 | CONFIG_NFT_REJECT=m | 105 | CONFIG_NFT_REJECT=m |
| 106 | CONFIG_NFT_COMPAT=m | 106 | CONFIG_NFT_COMPAT=m |
| 107 | CONFIG_NFT_DUP_NETDEV=m | ||
| 108 | CONFIG_NFT_FWD_NETDEV=m | ||
| 107 | CONFIG_NETFILTER_XT_SET=m | 109 | CONFIG_NETFILTER_XT_SET=m |
| 108 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 109 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -262,6 +264,12 @@ CONFIG_L2TP=m | |||
| 262 | CONFIG_BRIDGE=m | 264 | CONFIG_BRIDGE=m |
| 263 | CONFIG_ATALK=m | 265 | CONFIG_ATALK=m |
| 264 | CONFIG_6LOWPAN=m | 266 | CONFIG_6LOWPAN=m |
| 267 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 268 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 269 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 270 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 265 | CONFIG_DNS_RESOLVER=y | 273 | CONFIG_DNS_RESOLVER=y |
| 266 | CONFIG_BATMAN_ADV=m | 274 | CONFIG_BATMAN_ADV=m |
| 267 | CONFIG_BATMAN_ADV_DAT=y | 275 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -343,6 +351,7 @@ CONFIG_MVME16x_NET=y | |||
| 343 | # CONFIG_NET_VENDOR_MARVELL is not set | 351 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 344 | # CONFIG_NET_VENDOR_MICREL is not set | 352 | # CONFIG_NET_VENDOR_MICREL is not set |
| 345 | # CONFIG_NET_VENDOR_NATSEMI is not set | 353 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 354 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 346 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 355 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 347 | # CONFIG_NET_VENDOR_RENESAS is not set | 356 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 348 | # CONFIG_NET_VENDOR_ROCKER is not set | 357 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig index f7deb5f702a6..bd8401686dde 100644 --- a/arch/m68k/configs/q40_defconfig +++ b/arch/m68k/configs/q40_defconfig | |||
| @@ -104,6 +104,8 @@ CONFIG_NFT_NAT=m | |||
| 104 | CONFIG_NFT_QUEUE=m | 104 | CONFIG_NFT_QUEUE=m |
| 105 | CONFIG_NFT_REJECT=m | 105 | CONFIG_NFT_REJECT=m |
| 106 | CONFIG_NFT_COMPAT=m | 106 | CONFIG_NFT_COMPAT=m |
| 107 | CONFIG_NFT_DUP_NETDEV=m | ||
| 108 | CONFIG_NFT_FWD_NETDEV=m | ||
| 107 | CONFIG_NETFILTER_XT_SET=m | 109 | CONFIG_NETFILTER_XT_SET=m |
| 108 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 110 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 109 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 111 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -262,6 +264,12 @@ CONFIG_L2TP=m | |||
| 262 | CONFIG_BRIDGE=m | 264 | CONFIG_BRIDGE=m |
| 263 | CONFIG_ATALK=m | 265 | CONFIG_ATALK=m |
| 264 | CONFIG_6LOWPAN=m | 266 | CONFIG_6LOWPAN=m |
| 267 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 268 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 269 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 270 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 271 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 272 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 265 | CONFIG_DNS_RESOLVER=y | 273 | CONFIG_DNS_RESOLVER=y |
| 266 | CONFIG_BATMAN_ADV=m | 274 | CONFIG_BATMAN_ADV=m |
| 267 | CONFIG_BATMAN_ADV_DAT=y | 275 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -352,6 +360,7 @@ CONFIG_VETH=m | |||
| 352 | # CONFIG_NET_VENDOR_INTEL is not set | 360 | # CONFIG_NET_VENDOR_INTEL is not set |
| 353 | # CONFIG_NET_VENDOR_MARVELL is not set | 361 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 354 | # CONFIG_NET_VENDOR_MICREL is not set | 362 | # CONFIG_NET_VENDOR_MICREL is not set |
| 363 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 355 | CONFIG_NE2000=y | 364 | CONFIG_NE2000=y |
| 356 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 365 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 357 | # CONFIG_NET_VENDOR_RENESAS is not set | 366 | # CONFIG_NET_VENDOR_RENESAS is not set |
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig index 0ce79eb0d805..5f9fb3ab9636 100644 --- a/arch/m68k/configs/sun3_defconfig +++ b/arch/m68k/configs/sun3_defconfig | |||
| @@ -101,6 +101,8 @@ CONFIG_NFT_NAT=m | |||
| 101 | CONFIG_NFT_QUEUE=m | 101 | CONFIG_NFT_QUEUE=m |
| 102 | CONFIG_NFT_REJECT=m | 102 | CONFIG_NFT_REJECT=m |
| 103 | CONFIG_NFT_COMPAT=m | 103 | CONFIG_NFT_COMPAT=m |
| 104 | CONFIG_NFT_DUP_NETDEV=m | ||
| 105 | CONFIG_NFT_FWD_NETDEV=m | ||
| 104 | CONFIG_NETFILTER_XT_SET=m | 106 | CONFIG_NETFILTER_XT_SET=m |
| 105 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 107 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 106 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 108 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -259,6 +261,12 @@ CONFIG_L2TP=m | |||
| 259 | CONFIG_BRIDGE=m | 261 | CONFIG_BRIDGE=m |
| 260 | CONFIG_ATALK=m | 262 | CONFIG_ATALK=m |
| 261 | CONFIG_6LOWPAN=m | 263 | CONFIG_6LOWPAN=m |
| 264 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 265 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 266 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 267 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 268 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 262 | CONFIG_DNS_RESOLVER=y | 270 | CONFIG_DNS_RESOLVER=y |
| 263 | CONFIG_BATMAN_ADV=m | 271 | CONFIG_BATMAN_ADV=m |
| 264 | CONFIG_BATMAN_ADV_DAT=y | 272 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -340,6 +348,7 @@ CONFIG_SUN3_82586=y | |||
| 340 | # CONFIG_NET_VENDOR_MARVELL is not set | 348 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 341 | # CONFIG_NET_VENDOR_MICREL is not set | 349 | # CONFIG_NET_VENDOR_MICREL is not set |
| 342 | # CONFIG_NET_VENDOR_NATSEMI is not set | 350 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 351 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 343 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 352 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 344 | # CONFIG_NET_VENDOR_RENESAS is not set | 353 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 345 | # CONFIG_NET_VENDOR_ROCKER is not set | 354 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig index 4cb787e4991f..5d1c674530e2 100644 --- a/arch/m68k/configs/sun3x_defconfig +++ b/arch/m68k/configs/sun3x_defconfig | |||
| @@ -101,6 +101,8 @@ CONFIG_NFT_NAT=m | |||
| 101 | CONFIG_NFT_QUEUE=m | 101 | CONFIG_NFT_QUEUE=m |
| 102 | CONFIG_NFT_REJECT=m | 102 | CONFIG_NFT_REJECT=m |
| 103 | CONFIG_NFT_COMPAT=m | 103 | CONFIG_NFT_COMPAT=m |
| 104 | CONFIG_NFT_DUP_NETDEV=m | ||
| 105 | CONFIG_NFT_FWD_NETDEV=m | ||
| 104 | CONFIG_NETFILTER_XT_SET=m | 106 | CONFIG_NETFILTER_XT_SET=m |
| 105 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m | 107 | CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m |
| 106 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | 108 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m |
| @@ -259,6 +261,12 @@ CONFIG_L2TP=m | |||
| 259 | CONFIG_BRIDGE=m | 261 | CONFIG_BRIDGE=m |
| 260 | CONFIG_ATALK=m | 262 | CONFIG_ATALK=m |
| 261 | CONFIG_6LOWPAN=m | 263 | CONFIG_6LOWPAN=m |
| 264 | CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m | ||
| 265 | CONFIG_6LOWPAN_GHC_UDP=m | ||
| 266 | CONFIG_6LOWPAN_GHC_ICMPV6=m | ||
| 267 | CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m | ||
| 268 | CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m | ||
| 269 | CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m | ||
| 262 | CONFIG_DNS_RESOLVER=y | 270 | CONFIG_DNS_RESOLVER=y |
| 263 | CONFIG_BATMAN_ADV=m | 271 | CONFIG_BATMAN_ADV=m |
| 264 | CONFIG_BATMAN_ADV_DAT=y | 272 | CONFIG_BATMAN_ADV_DAT=y |
| @@ -341,6 +349,7 @@ CONFIG_SUN3LANCE=y | |||
| 341 | # CONFIG_NET_VENDOR_MARVELL is not set | 349 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 342 | # CONFIG_NET_VENDOR_MICREL is not set | 350 | # CONFIG_NET_VENDOR_MICREL is not set |
| 343 | # CONFIG_NET_VENDOR_NATSEMI is not set | 351 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 352 | # CONFIG_NET_VENDOR_NETRONOME is not set | ||
| 344 | # CONFIG_NET_VENDOR_QUALCOMM is not set | 353 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 345 | # CONFIG_NET_VENDOR_RENESAS is not set | 354 | # CONFIG_NET_VENDOR_RENESAS is not set |
| 346 | # CONFIG_NET_VENDOR_ROCKER is not set | 355 | # CONFIG_NET_VENDOR_ROCKER is not set |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index f9d96bf86910..bafaff6dcd7b 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | #define NR_syscalls 376 | 7 | #define NR_syscalls 377 |
| 8 | 8 | ||
| 9 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
| 10 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index 36cf129de663..0ca729665f29 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
| @@ -381,5 +381,6 @@ | |||
| 381 | #define __NR_userfaultfd 373 | 381 | #define __NR_userfaultfd 373 |
| 382 | #define __NR_membarrier 374 | 382 | #define __NR_membarrier 374 |
| 383 | #define __NR_mlock2 375 | 383 | #define __NR_mlock2 375 |
| 384 | #define __NR_copy_file_range 376 | ||
| 384 | 385 | ||
| 385 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 386 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 282cd903f4c4..8bb94261ff97 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
| @@ -396,3 +396,4 @@ ENTRY(sys_call_table) | |||
| 396 | .long sys_userfaultfd | 396 | .long sys_userfaultfd |
| 397 | .long sys_membarrier | 397 | .long sys_membarrier |
| 398 | .long sys_mlock2 /* 375 */ | 398 | .long sys_mlock2 /* 375 */ |
| 399 | .long sys_copy_file_range | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 57a945e832f4..74a3db92da1b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -2085,7 +2085,7 @@ config PAGE_SIZE_32KB | |||
| 2085 | 2085 | ||
| 2086 | config PAGE_SIZE_64KB | 2086 | config PAGE_SIZE_64KB |
| 2087 | bool "64kB" | 2087 | bool "64kB" |
| 2088 | depends on !CPU_R3000 && !CPU_TX39XX | 2088 | depends on !CPU_R3000 && !CPU_TX39XX && !CPU_R6000 |
| 2089 | help | 2089 | help |
| 2090 | Using 64kB page size will result in higher performance kernel at | 2090 | Using 64kB page size will result in higher performance kernel at |
| 2091 | the price of higher memory consumption. This option is available on | 2091 | the price of higher memory consumption. This option is available on |
diff --git a/arch/mips/boot/dts/brcm/bcm6328.dtsi b/arch/mips/boot/dts/brcm/bcm6328.dtsi index 459b9b252c3b..d61b1616b604 100644 --- a/arch/mips/boot/dts/brcm/bcm6328.dtsi +++ b/arch/mips/boot/dts/brcm/bcm6328.dtsi | |||
| @@ -74,6 +74,7 @@ | |||
| 74 | timer: timer@10000040 { | 74 | timer: timer@10000040 { |
| 75 | compatible = "syscon"; | 75 | compatible = "syscon"; |
| 76 | reg = <0x10000040 0x2c>; | 76 | reg = <0x10000040 0x2c>; |
| 77 | little-endian; | ||
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| 79 | reboot { | 80 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7125.dtsi b/arch/mips/boot/dts/brcm/bcm7125.dtsi index 4fc7ecee273c..1a7efa883c5e 100644 --- a/arch/mips/boot/dts/brcm/bcm7125.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7125.dtsi | |||
| @@ -98,6 +98,7 @@ | |||
| 98 | sun_top_ctrl: syscon@404000 { | 98 | sun_top_ctrl: syscon@404000 { |
| 99 | compatible = "brcm,bcm7125-sun-top-ctrl", "syscon"; | 99 | compatible = "brcm,bcm7125-sun-top-ctrl", "syscon"; |
| 100 | reg = <0x404000 0x60c>; | 100 | reg = <0x404000 0x60c>; |
| 101 | little-endian; | ||
| 101 | }; | 102 | }; |
| 102 | 103 | ||
| 103 | reboot { | 104 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7346.dtsi b/arch/mips/boot/dts/brcm/bcm7346.dtsi index a3039bb53477..d4bf52cfcf17 100644 --- a/arch/mips/boot/dts/brcm/bcm7346.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7346.dtsi | |||
| @@ -118,6 +118,7 @@ | |||
| 118 | sun_top_ctrl: syscon@404000 { | 118 | sun_top_ctrl: syscon@404000 { |
| 119 | compatible = "brcm,bcm7346-sun-top-ctrl", "syscon"; | 119 | compatible = "brcm,bcm7346-sun-top-ctrl", "syscon"; |
| 120 | reg = <0x404000 0x51c>; | 120 | reg = <0x404000 0x51c>; |
| 121 | little-endian; | ||
| 121 | }; | 122 | }; |
| 122 | 123 | ||
| 123 | reboot { | 124 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7358.dtsi b/arch/mips/boot/dts/brcm/bcm7358.dtsi index 4274ff41ec21..8e2501694d03 100644 --- a/arch/mips/boot/dts/brcm/bcm7358.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7358.dtsi | |||
| @@ -112,6 +112,7 @@ | |||
| 112 | sun_top_ctrl: syscon@404000 { | 112 | sun_top_ctrl: syscon@404000 { |
| 113 | compatible = "brcm,bcm7358-sun-top-ctrl", "syscon"; | 113 | compatible = "brcm,bcm7358-sun-top-ctrl", "syscon"; |
| 114 | reg = <0x404000 0x51c>; | 114 | reg = <0x404000 0x51c>; |
| 115 | little-endian; | ||
| 115 | }; | 116 | }; |
| 116 | 117 | ||
| 117 | reboot { | 118 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7360.dtsi b/arch/mips/boot/dts/brcm/bcm7360.dtsi index 0dcc9163c27b..7e5f76040fb8 100644 --- a/arch/mips/boot/dts/brcm/bcm7360.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7360.dtsi | |||
| @@ -112,6 +112,7 @@ | |||
| 112 | sun_top_ctrl: syscon@404000 { | 112 | sun_top_ctrl: syscon@404000 { |
| 113 | compatible = "brcm,bcm7360-sun-top-ctrl", "syscon"; | 113 | compatible = "brcm,bcm7360-sun-top-ctrl", "syscon"; |
| 114 | reg = <0x404000 0x51c>; | 114 | reg = <0x404000 0x51c>; |
| 115 | little-endian; | ||
| 115 | }; | 116 | }; |
| 116 | 117 | ||
| 117 | reboot { | 118 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7362.dtsi b/arch/mips/boot/dts/brcm/bcm7362.dtsi index 2f3f9fc2c478..c739ea77acb0 100644 --- a/arch/mips/boot/dts/brcm/bcm7362.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7362.dtsi | |||
| @@ -118,6 +118,7 @@ | |||
| 118 | sun_top_ctrl: syscon@404000 { | 118 | sun_top_ctrl: syscon@404000 { |
| 119 | compatible = "brcm,bcm7362-sun-top-ctrl", "syscon"; | 119 | compatible = "brcm,bcm7362-sun-top-ctrl", "syscon"; |
| 120 | reg = <0x404000 0x51c>; | 120 | reg = <0x404000 0x51c>; |
| 121 | little-endian; | ||
| 121 | }; | 122 | }; |
| 122 | 123 | ||
| 123 | reboot { | 124 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7420.dtsi b/arch/mips/boot/dts/brcm/bcm7420.dtsi index bee221b3b568..5f55d0a50a28 100644 --- a/arch/mips/boot/dts/brcm/bcm7420.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7420.dtsi | |||
| @@ -99,6 +99,7 @@ | |||
| 99 | sun_top_ctrl: syscon@404000 { | 99 | sun_top_ctrl: syscon@404000 { |
| 100 | compatible = "brcm,bcm7420-sun-top-ctrl", "syscon"; | 100 | compatible = "brcm,bcm7420-sun-top-ctrl", "syscon"; |
| 101 | reg = <0x404000 0x60c>; | 101 | reg = <0x404000 0x60c>; |
| 102 | little-endian; | ||
| 102 | }; | 103 | }; |
| 103 | 104 | ||
| 104 | reboot { | 105 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7425.dtsi b/arch/mips/boot/dts/brcm/bcm7425.dtsi index 571f30f52e3f..e24d41ab4e30 100644 --- a/arch/mips/boot/dts/brcm/bcm7425.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7425.dtsi | |||
| @@ -100,6 +100,7 @@ | |||
| 100 | sun_top_ctrl: syscon@404000 { | 100 | sun_top_ctrl: syscon@404000 { |
| 101 | compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; | 101 | compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; |
| 102 | reg = <0x404000 0x51c>; | 102 | reg = <0x404000 0x51c>; |
| 103 | little-endian; | ||
| 103 | }; | 104 | }; |
| 104 | 105 | ||
| 105 | reboot { | 106 | reboot { |
diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi b/arch/mips/boot/dts/brcm/bcm7435.dtsi index 614ee211f71a..8b9432cc062b 100644 --- a/arch/mips/boot/dts/brcm/bcm7435.dtsi +++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi | |||
| @@ -114,6 +114,7 @@ | |||
| 114 | sun_top_ctrl: syscon@404000 { | 114 | sun_top_ctrl: syscon@404000 { |
| 115 | compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; | 115 | compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; |
| 116 | reg = <0x404000 0x51c>; | 116 | reg = <0x404000 0x51c>; |
| 117 | little-endian; | ||
| 117 | }; | 118 | }; |
| 118 | 119 | ||
| 119 | reboot { | 120 | reboot { |
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h index cefb7a596878..e090fc388e02 100644 --- a/arch/mips/include/asm/elf.h +++ b/arch/mips/include/asm/elf.h | |||
| @@ -227,7 +227,7 @@ struct mips_elf_abiflags_v0 { | |||
| 227 | int __res = 1; \ | 227 | int __res = 1; \ |
| 228 | struct elfhdr *__h = (hdr); \ | 228 | struct elfhdr *__h = (hdr); \ |
| 229 | \ | 229 | \ |
| 230 | if (__h->e_machine != EM_MIPS) \ | 230 | if (!mips_elf_check_machine(__h)) \ |
| 231 | __res = 0; \ | 231 | __res = 0; \ |
| 232 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ | 232 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ |
| 233 | __res = 0; \ | 233 | __res = 0; \ |
| @@ -258,7 +258,7 @@ struct mips_elf_abiflags_v0 { | |||
| 258 | int __res = 1; \ | 258 | int __res = 1; \ |
| 259 | struct elfhdr *__h = (hdr); \ | 259 | struct elfhdr *__h = (hdr); \ |
| 260 | \ | 260 | \ |
| 261 | if (__h->e_machine != EM_MIPS) \ | 261 | if (!mips_elf_check_machine(__h)) \ |
| 262 | __res = 0; \ | 262 | __res = 0; \ |
| 263 | if (__h->e_ident[EI_CLASS] != ELFCLASS64) \ | 263 | if (__h->e_ident[EI_CLASS] != ELFCLASS64) \ |
| 264 | __res = 0; \ | 264 | __res = 0; \ |
| @@ -285,6 +285,11 @@ struct mips_elf_abiflags_v0 { | |||
| 285 | 285 | ||
| 286 | #endif /* !defined(ELF_ARCH) */ | 286 | #endif /* !defined(ELF_ARCH) */ |
| 287 | 287 | ||
| 288 | #define mips_elf_check_machine(x) ((x)->e_machine == EM_MIPS) | ||
| 289 | |||
| 290 | #define vmcore_elf32_check_arch mips_elf_check_machine | ||
| 291 | #define vmcore_elf64_check_arch mips_elf_check_machine | ||
| 292 | |||
| 288 | struct mips_abi; | 293 | struct mips_abi; |
| 289 | 294 | ||
| 290 | extern struct mips_abi mips_abi; | 295 | extern struct mips_abi mips_abi; |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 9cbf383b8834..f06f97bd62df 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
| @@ -179,6 +179,10 @@ static inline void lose_fpu_inatomic(int save, struct task_struct *tsk) | |||
| 179 | if (save) | 179 | if (save) |
| 180 | _save_fp(tsk); | 180 | _save_fp(tsk); |
| 181 | __disable_fpu(); | 181 | __disable_fpu(); |
| 182 | } else { | ||
| 183 | /* FPU should not have been left enabled with no owner */ | ||
| 184 | WARN(read_c0_status() & ST0_CU1, | ||
| 185 | "Orphaned FPU left enabled"); | ||
| 182 | } | 186 | } |
| 183 | KSTK_STATUS(tsk) &= ~ST0_CU1; | 187 | KSTK_STATUS(tsk) &= ~ST0_CU1; |
| 184 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); | 188 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); |
diff --git a/arch/mips/include/asm/octeon/octeon-feature.h b/arch/mips/include/asm/octeon/octeon-feature.h index 8ebd3f579b84..3ed10a8d7865 100644 --- a/arch/mips/include/asm/octeon/octeon-feature.h +++ b/arch/mips/include/asm/octeon/octeon-feature.h | |||
| @@ -128,7 +128,8 @@ static inline int octeon_has_feature(enum octeon_feature feature) | |||
| 128 | case OCTEON_FEATURE_PCIE: | 128 | case OCTEON_FEATURE_PCIE: |
| 129 | return OCTEON_IS_MODEL(OCTEON_CN56XX) | 129 | return OCTEON_IS_MODEL(OCTEON_CN56XX) |
| 130 | || OCTEON_IS_MODEL(OCTEON_CN52XX) | 130 | || OCTEON_IS_MODEL(OCTEON_CN52XX) |
| 131 | || OCTEON_IS_MODEL(OCTEON_CN6XXX); | 131 | || OCTEON_IS_MODEL(OCTEON_CN6XXX) |
| 132 | || OCTEON_IS_MODEL(OCTEON_CN7XXX); | ||
| 132 | 133 | ||
| 133 | case OCTEON_FEATURE_SRIO: | 134 | case OCTEON_FEATURE_SRIO: |
| 134 | return OCTEON_IS_MODEL(OCTEON_CN63XX) | 135 | return OCTEON_IS_MODEL(OCTEON_CN63XX) |
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h index 3f832c3dd8f5..041153f5cf93 100644 --- a/arch/mips/include/asm/processor.h +++ b/arch/mips/include/asm/processor.h | |||
| @@ -45,7 +45,7 @@ extern unsigned int vced_count, vcei_count; | |||
| 45 | * User space process size: 2GB. This is hardcoded into a few places, | 45 | * User space process size: 2GB. This is hardcoded into a few places, |
| 46 | * so don't change it unless you know what you are doing. | 46 | * so don't change it unless you know what you are doing. |
| 47 | */ | 47 | */ |
| 48 | #define TASK_SIZE 0x7fff8000UL | 48 | #define TASK_SIZE 0x80000000UL |
| 49 | #endif | 49 | #endif |
| 50 | 50 | ||
| 51 | #define STACK_TOP_MAX TASK_SIZE | 51 | #define STACK_TOP_MAX TASK_SIZE |
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index a71da576883c..eebf39549606 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h | |||
| @@ -289,7 +289,7 @@ | |||
| 289 | .set reorder | 289 | .set reorder |
| 290 | .set noat | 290 | .set noat |
| 291 | mfc0 a0, CP0_STATUS | 291 | mfc0 a0, CP0_STATUS |
| 292 | li v1, 0xff00 | 292 | li v1, ST0_CU1 | ST0_IM |
| 293 | ori a0, STATMASK | 293 | ori a0, STATMASK |
| 294 | xori a0, STATMASK | 294 | xori a0, STATMASK |
| 295 | mtc0 a0, CP0_STATUS | 295 | mtc0 a0, CP0_STATUS |
| @@ -330,7 +330,7 @@ | |||
| 330 | ori a0, STATMASK | 330 | ori a0, STATMASK |
| 331 | xori a0, STATMASK | 331 | xori a0, STATMASK |
| 332 | mtc0 a0, CP0_STATUS | 332 | mtc0 a0, CP0_STATUS |
| 333 | li v1, 0xff00 | 333 | li v1, ST0_CU1 | ST0_FR | ST0_IM |
| 334 | and a0, v1 | 334 | and a0, v1 |
| 335 | LONG_L v0, PT_STATUS(sp) | 335 | LONG_L v0, PT_STATUS(sp) |
| 336 | nor v1, $0, v1 | 336 | nor v1, $0, v1 |
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h index 6499d93ae68d..47bc45a67e9b 100644 --- a/arch/mips/include/asm/syscall.h +++ b/arch/mips/include/asm/syscall.h | |||
| @@ -101,10 +101,8 @@ static inline void syscall_get_arguments(struct task_struct *task, | |||
| 101 | /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ | 101 | /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ |
| 102 | if ((config_enabled(CONFIG_32BIT) || | 102 | if ((config_enabled(CONFIG_32BIT) || |
| 103 | test_tsk_thread_flag(task, TIF_32BIT_REGS)) && | 103 | test_tsk_thread_flag(task, TIF_32BIT_REGS)) && |
| 104 | (regs->regs[2] == __NR_syscall)) { | 104 | (regs->regs[2] == __NR_syscall)) |
| 105 | i++; | 105 | i++; |
| 106 | n++; | ||
| 107 | } | ||
| 108 | 106 | ||
| 109 | while (n--) | 107 | while (n--) |
| 110 | ret |= mips_get_syscall_arg(args++, task, regs, i++); | 108 | ret |= mips_get_syscall_arg(args++, task, regs, i++); |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 90f03a7da665..3129795de940 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
| @@ -380,16 +380,17 @@ | |||
| 380 | #define __NR_userfaultfd (__NR_Linux + 357) | 380 | #define __NR_userfaultfd (__NR_Linux + 357) |
| 381 | #define __NR_membarrier (__NR_Linux + 358) | 381 | #define __NR_membarrier (__NR_Linux + 358) |
| 382 | #define __NR_mlock2 (__NR_Linux + 359) | 382 | #define __NR_mlock2 (__NR_Linux + 359) |
| 383 | #define __NR_copy_file_range (__NR_Linux + 360) | ||
| 383 | 384 | ||
| 384 | /* | 385 | /* |
| 385 | * Offset of the last Linux o32 flavoured syscall | 386 | * Offset of the last Linux o32 flavoured syscall |
| 386 | */ | 387 | */ |
| 387 | #define __NR_Linux_syscalls 359 | 388 | #define __NR_Linux_syscalls 360 |
| 388 | 389 | ||
| 389 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 390 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
| 390 | 391 | ||
| 391 | #define __NR_O32_Linux 4000 | 392 | #define __NR_O32_Linux 4000 |
| 392 | #define __NR_O32_Linux_syscalls 359 | 393 | #define __NR_O32_Linux_syscalls 360 |
| 393 | 394 | ||
| 394 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 395 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
| 395 | 396 | ||
| @@ -717,16 +718,17 @@ | |||
| 717 | #define __NR_userfaultfd (__NR_Linux + 317) | 718 | #define __NR_userfaultfd (__NR_Linux + 317) |
| 718 | #define __NR_membarrier (__NR_Linux + 318) | 719 | #define __NR_membarrier (__NR_Linux + 318) |
| 719 | #define __NR_mlock2 (__NR_Linux + 319) | 720 | #define __NR_mlock2 (__NR_Linux + 319) |
| 721 | #define __NR_copy_file_range (__NR_Linux + 320) | ||
| 720 | 722 | ||
| 721 | /* | 723 | /* |
| 722 | * Offset of the last Linux 64-bit flavoured syscall | 724 | * Offset of the last Linux 64-bit flavoured syscall |
| 723 | */ | 725 | */ |
| 724 | #define __NR_Linux_syscalls 319 | 726 | #define __NR_Linux_syscalls 320 |
| 725 | 727 | ||
| 726 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 728 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
| 727 | 729 | ||
| 728 | #define __NR_64_Linux 5000 | 730 | #define __NR_64_Linux 5000 |
| 729 | #define __NR_64_Linux_syscalls 319 | 731 | #define __NR_64_Linux_syscalls 320 |
| 730 | 732 | ||
| 731 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 733 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
| 732 | 734 | ||
| @@ -1058,15 +1060,16 @@ | |||
| 1058 | #define __NR_userfaultfd (__NR_Linux + 321) | 1060 | #define __NR_userfaultfd (__NR_Linux + 321) |
| 1059 | #define __NR_membarrier (__NR_Linux + 322) | 1061 | #define __NR_membarrier (__NR_Linux + 322) |
| 1060 | #define __NR_mlock2 (__NR_Linux + 323) | 1062 | #define __NR_mlock2 (__NR_Linux + 323) |
| 1063 | #define __NR_copy_file_range (__NR_Linux + 324) | ||
| 1061 | 1064 | ||
| 1062 | /* | 1065 | /* |
| 1063 | * Offset of the last N32 flavoured syscall | 1066 | * Offset of the last N32 flavoured syscall |
| 1064 | */ | 1067 | */ |
| 1065 | #define __NR_Linux_syscalls 323 | 1068 | #define __NR_Linux_syscalls 324 |
| 1066 | 1069 | ||
| 1067 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1070 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
| 1068 | 1071 | ||
| 1069 | #define __NR_N32_Linux 6000 | 1072 | #define __NR_N32_Linux 6000 |
| 1070 | #define __NR_N32_Linux_syscalls 323 | 1073 | #define __NR_N32_Linux_syscalls 324 |
| 1071 | 1074 | ||
| 1072 | #endif /* _UAPI_ASM_UNISTD_H */ | 1075 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c index 1188e00bb120..1b992c6e3d8e 100644 --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c | |||
| @@ -35,7 +35,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 35 | int __res = 1; \ | 35 | int __res = 1; \ |
| 36 | struct elfhdr *__h = (hdr); \ | 36 | struct elfhdr *__h = (hdr); \ |
| 37 | \ | 37 | \ |
| 38 | if (__h->e_machine != EM_MIPS) \ | 38 | if (!mips_elf_check_machine(__h)) \ |
| 39 | __res = 0; \ | 39 | __res = 0; \ |
| 40 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ | 40 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ |
| 41 | __res = 0; \ | 41 | __res = 0; \ |
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index 928767858b86..abd3affe5fb3 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c | |||
| @@ -47,7 +47,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 47 | int __res = 1; \ | 47 | int __res = 1; \ |
| 48 | struct elfhdr *__h = (hdr); \ | 48 | struct elfhdr *__h = (hdr); \ |
| 49 | \ | 49 | \ |
| 50 | if (__h->e_machine != EM_MIPS) \ | 50 | if (!mips_elf_check_machine(__h)) \ |
| 51 | __res = 0; \ | 51 | __res = 0; \ |
| 52 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ | 52 | if (__h->e_ident[EI_CLASS] != ELFCLASS32) \ |
| 53 | __res = 0; \ | 53 | __res = 0; \ |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index f2975d4d1e44..eddd5fd6fdfa 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
| @@ -65,12 +65,10 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp) | |||
| 65 | status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|ST0_FR|KU_MASK); | 65 | status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|ST0_FR|KU_MASK); |
| 66 | status |= KU_USER; | 66 | status |= KU_USER; |
| 67 | regs->cp0_status = status; | 67 | regs->cp0_status = status; |
| 68 | lose_fpu(0); | ||
| 69 | clear_thread_flag(TIF_MSA_CTX_LIVE); | ||
| 68 | clear_used_math(); | 70 | clear_used_math(); |
| 69 | clear_fpu_owner(); | ||
| 70 | init_dsp(); | 71 | init_dsp(); |
| 71 | clear_thread_flag(TIF_USEDMSA); | ||
| 72 | clear_thread_flag(TIF_MSA_CTX_LIVE); | ||
| 73 | disable_msa(); | ||
| 74 | regs->cp0_epc = pc; | 72 | regs->cp0_epc = pc; |
| 75 | regs->regs[29] = sp; | 73 | regs->regs[29] = sp; |
| 76 | } | 74 | } |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 2d23c834ba96..a56317444bda 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
| @@ -595,3 +595,4 @@ EXPORT(sys_call_table) | |||
| 595 | PTR sys_userfaultfd | 595 | PTR sys_userfaultfd |
| 596 | PTR sys_membarrier | 596 | PTR sys_membarrier |
| 597 | PTR sys_mlock2 | 597 | PTR sys_mlock2 |
| 598 | PTR sys_copy_file_range /* 4360 */ | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index deac63315d0e..2b2dc14610d0 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
| @@ -433,4 +433,5 @@ EXPORT(sys_call_table) | |||
| 433 | PTR sys_userfaultfd | 433 | PTR sys_userfaultfd |
| 434 | PTR sys_membarrier | 434 | PTR sys_membarrier |
| 435 | PTR sys_mlock2 | 435 | PTR sys_mlock2 |
| 436 | PTR sys_copy_file_range /* 5320 */ | ||
| 436 | .size sys_call_table,.-sys_call_table | 437 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 5a69eb48d0a8..2bf5c8593d91 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
| @@ -423,4 +423,5 @@ EXPORT(sysn32_call_table) | |||
| 423 | PTR sys_userfaultfd | 423 | PTR sys_userfaultfd |
| 424 | PTR sys_membarrier | 424 | PTR sys_membarrier |
| 425 | PTR sys_mlock2 | 425 | PTR sys_mlock2 |
| 426 | PTR sys_copy_file_range | ||
| 426 | .size sysn32_call_table,.-sysn32_call_table | 427 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index e4b6d7c97822..c5b759e584c7 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
| @@ -578,4 +578,5 @@ EXPORT(sys32_call_table) | |||
| 578 | PTR sys_userfaultfd | 578 | PTR sys_userfaultfd |
| 579 | PTR sys_membarrier | 579 | PTR sys_membarrier |
| 580 | PTR sys_mlock2 | 580 | PTR sys_mlock2 |
| 581 | PTR sys_copy_file_range /* 4360 */ | ||
| 581 | .size sys32_call_table,.-sys32_call_table | 582 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 569a7d5242dd..5fdaf8bdcd2e 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
| @@ -782,6 +782,7 @@ static inline void prefill_possible_map(void) {} | |||
| 782 | void __init setup_arch(char **cmdline_p) | 782 | void __init setup_arch(char **cmdline_p) |
| 783 | { | 783 | { |
| 784 | cpu_probe(); | 784 | cpu_probe(); |
| 785 | mips_cm_probe(); | ||
| 785 | prom_init(); | 786 | prom_init(); |
| 786 | 787 | ||
| 787 | setup_early_fdc_console(); | 788 | setup_early_fdc_console(); |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index bafcb7ad5c85..ae790c575d4f 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
| @@ -663,7 +663,7 @@ static int simulate_rdhwr_normal(struct pt_regs *regs, unsigned int opcode) | |||
| 663 | return -1; | 663 | return -1; |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | static int simulate_rdhwr_mm(struct pt_regs *regs, unsigned short opcode) | 666 | static int simulate_rdhwr_mm(struct pt_regs *regs, unsigned int opcode) |
| 667 | { | 667 | { |
| 668 | if ((opcode & MM_POOL32A_FUNC) == MM_RDHWR) { | 668 | if ((opcode & MM_POOL32A_FUNC) == MM_RDHWR) { |
| 669 | int rd = (opcode & MM_RS) >> 16; | 669 | int rd = (opcode & MM_RS) >> 16; |
| @@ -1119,11 +1119,12 @@ no_r2_instr: | |||
| 1119 | if (get_isa16_mode(regs->cp0_epc)) { | 1119 | if (get_isa16_mode(regs->cp0_epc)) { |
| 1120 | unsigned short mmop[2] = { 0 }; | 1120 | unsigned short mmop[2] = { 0 }; |
| 1121 | 1121 | ||
| 1122 | if (unlikely(get_user(mmop[0], epc) < 0)) | 1122 | if (unlikely(get_user(mmop[0], (u16 __user *)epc + 0) < 0)) |
| 1123 | status = SIGSEGV; | 1123 | status = SIGSEGV; |
| 1124 | if (unlikely(get_user(mmop[1], epc) < 0)) | 1124 | if (unlikely(get_user(mmop[1], (u16 __user *)epc + 1) < 0)) |
| 1125 | status = SIGSEGV; | 1125 | status = SIGSEGV; |
| 1126 | opcode = (mmop[0] << 16) | mmop[1]; | 1126 | opcode = mmop[0]; |
| 1127 | opcode = (opcode << 16) | mmop[1]; | ||
| 1127 | 1128 | ||
| 1128 | if (status < 0) | 1129 | if (status < 0) |
| 1129 | status = simulate_rdhwr_mm(regs, opcode); | 1130 | status = simulate_rdhwr_mm(regs, opcode); |
| @@ -1369,26 +1370,12 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
| 1369 | if (unlikely(compute_return_epc(regs) < 0)) | 1370 | if (unlikely(compute_return_epc(regs) < 0)) |
| 1370 | break; | 1371 | break; |
| 1371 | 1372 | ||
| 1372 | if (get_isa16_mode(regs->cp0_epc)) { | 1373 | if (!get_isa16_mode(regs->cp0_epc)) { |
| 1373 | unsigned short mmop[2] = { 0 }; | ||
| 1374 | |||
| 1375 | if (unlikely(get_user(mmop[0], epc) < 0)) | ||
| 1376 | status = SIGSEGV; | ||
| 1377 | if (unlikely(get_user(mmop[1], epc) < 0)) | ||
| 1378 | status = SIGSEGV; | ||
| 1379 | opcode = (mmop[0] << 16) | mmop[1]; | ||
| 1380 | |||
| 1381 | if (status < 0) | ||
| 1382 | status = simulate_rdhwr_mm(regs, opcode); | ||
| 1383 | } else { | ||
| 1384 | if (unlikely(get_user(opcode, epc) < 0)) | 1374 | if (unlikely(get_user(opcode, epc) < 0)) |
| 1385 | status = SIGSEGV; | 1375 | status = SIGSEGV; |
| 1386 | 1376 | ||
| 1387 | if (!cpu_has_llsc && status < 0) | 1377 | if (!cpu_has_llsc && status < 0) |
| 1388 | status = simulate_llsc(regs, opcode); | 1378 | status = simulate_llsc(regs, opcode); |
| 1389 | |||
| 1390 | if (status < 0) | ||
| 1391 | status = simulate_rdhwr_normal(regs, opcode); | ||
| 1392 | } | 1379 | } |
| 1393 | 1380 | ||
| 1394 | if (status < 0) | 1381 | if (status < 0) |
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index 3bd0597d9c3d..249647578e58 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c | |||
| @@ -181,10 +181,6 @@ static int __init mips_sc_probe_cm3(void) | |||
| 181 | return 1; | 181 | return 1; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | void __weak platform_early_l2_init(void) | ||
| 185 | { | ||
| 186 | } | ||
| 187 | |||
| 188 | static inline int __init mips_sc_probe(void) | 184 | static inline int __init mips_sc_probe(void) |
| 189 | { | 185 | { |
| 190 | struct cpuinfo_mips *c = ¤t_cpu_data; | 186 | struct cpuinfo_mips *c = ¤t_cpu_data; |
| @@ -194,12 +190,6 @@ static inline int __init mips_sc_probe(void) | |||
| 194 | /* Mark as not present until probe completed */ | 190 | /* Mark as not present until probe completed */ |
| 195 | c->scache.flags |= MIPS_CACHE_NOT_PRESENT; | 191 | c->scache.flags |= MIPS_CACHE_NOT_PRESENT; |
| 196 | 192 | ||
| 197 | /* | ||
| 198 | * Do we need some platform specific probing before | ||
| 199 | * we configure L2? | ||
| 200 | */ | ||
| 201 | platform_early_l2_init(); | ||
| 202 | |||
| 203 | if (mips_cm_revision() >= CM_REV_CM3) | 193 | if (mips_cm_revision() >= CM_REV_CM3) |
| 204 | return mips_sc_probe_cm3(); | 194 | return mips_sc_probe_cm3(); |
| 205 | 195 | ||
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c index 571148c5fd0b..dc2c5214809d 100644 --- a/arch/mips/mti-malta/malta-init.c +++ b/arch/mips/mti-malta/malta-init.c | |||
| @@ -293,7 +293,6 @@ mips_pci_controller: | |||
| 293 | console_config(); | 293 | console_config(); |
| 294 | #endif | 294 | #endif |
| 295 | /* Early detection of CMP support */ | 295 | /* Early detection of CMP support */ |
| 296 | mips_cm_probe(); | ||
| 297 | mips_cpc_probe(); | 296 | mips_cpc_probe(); |
| 298 | 297 | ||
| 299 | if (!register_cps_smp_ops()) | 298 | if (!register_cps_smp_ops()) |
| @@ -304,10 +303,3 @@ mips_pci_controller: | |||
| 304 | return; | 303 | return; |
| 305 | register_up_smp_ops(); | 304 | register_up_smp_ops(); |
| 306 | } | 305 | } |
| 307 | |||
| 308 | void platform_early_l2_init(void) | ||
| 309 | { | ||
| 310 | /* L2 configuration lives in the CM3 */ | ||
| 311 | if (mips_cm_revision() >= CM_REV_CM3) | ||
| 312 | mips_cm_probe(); | ||
| 313 | } | ||
diff --git a/arch/mips/pci/pci-mt7620.c b/arch/mips/pci/pci-mt7620.c index a009ee458934..1ae932c2d78b 100644 --- a/arch/mips/pci/pci-mt7620.c +++ b/arch/mips/pci/pci-mt7620.c | |||
| @@ -297,12 +297,12 @@ static int mt7620_pci_probe(struct platform_device *pdev) | |||
| 297 | return PTR_ERR(rstpcie0); | 297 | return PTR_ERR(rstpcie0); |
| 298 | 298 | ||
| 299 | bridge_base = devm_ioremap_resource(&pdev->dev, bridge_res); | 299 | bridge_base = devm_ioremap_resource(&pdev->dev, bridge_res); |
| 300 | if (!bridge_base) | 300 | if (IS_ERR(bridge_base)) |
| 301 | return -ENOMEM; | 301 | return PTR_ERR(bridge_base); |
| 302 | 302 | ||
| 303 | pcie_base = devm_ioremap_resource(&pdev->dev, pcie_res); | 303 | pcie_base = devm_ioremap_resource(&pdev->dev, pcie_res); |
| 304 | if (!pcie_base) | 304 | if (IS_ERR(pcie_base)) |
| 305 | return -ENOMEM; | 305 | return PTR_ERR(pcie_base); |
| 306 | 306 | ||
| 307 | iomem_resource.start = 0; | 307 | iomem_resource.start = 0; |
| 308 | iomem_resource.end = ~0; | 308 | iomem_resource.end = ~0; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9af2e6338400..ab2ed5328f0a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -475,6 +475,7 @@ config X86_UV | |||
| 475 | depends on X86_64 | 475 | depends on X86_64 |
| 476 | depends on X86_EXTENDED_PLATFORM | 476 | depends on X86_EXTENDED_PLATFORM |
| 477 | depends on NUMA | 477 | depends on NUMA |
| 478 | depends on EFI | ||
| 478 | depends on X86_X2APIC | 479 | depends on X86_X2APIC |
| 479 | depends on PCI | 480 | depends on PCI |
| 480 | ---help--- | 481 | ---help--- |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 2d5a50cb61a2..20c11d1aa4cc 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
| @@ -766,7 +766,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); | |||
| 766 | * Return saved PC of a blocked thread. | 766 | * Return saved PC of a blocked thread. |
| 767 | * What is this good for? it will be always the scheduler or ret_from_fork. | 767 | * What is this good for? it will be always the scheduler or ret_from_fork. |
| 768 | */ | 768 | */ |
| 769 | #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8)) | 769 | #define thread_saved_pc(t) READ_ONCE_NOCHECK(*(unsigned long *)((t)->thread.sp - 8)) |
| 770 | 770 | ||
| 771 | #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1) | 771 | #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1) |
| 772 | extern unsigned long KSTK_ESP(struct task_struct *task); | 772 | extern unsigned long KSTK_ESP(struct task_struct *task); |
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index c3b3f653ed0c..d04f8094bc23 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
| @@ -469,7 +469,7 @@ static void __init numa_clear_kernel_node_hotplug(void) | |||
| 469 | { | 469 | { |
| 470 | int i, nid; | 470 | int i, nid; |
| 471 | nodemask_t numa_kernel_nodes = NODE_MASK_NONE; | 471 | nodemask_t numa_kernel_nodes = NODE_MASK_NONE; |
| 472 | unsigned long start, end; | 472 | phys_addr_t start, end; |
| 473 | struct memblock_region *r; | 473 | struct memblock_region *r; |
| 474 | 474 | ||
| 475 | /* | 475 | /* |
diff --git a/block/blk-core.c b/block/blk-core.c index ab51685988c2..b83d29755b5a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -2455,14 +2455,16 @@ struct request *blk_peek_request(struct request_queue *q) | |||
| 2455 | 2455 | ||
| 2456 | rq = NULL; | 2456 | rq = NULL; |
| 2457 | break; | 2457 | break; |
| 2458 | } else if (ret == BLKPREP_KILL) { | 2458 | } else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) { |
| 2459 | int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO; | ||
| 2460 | |||
| 2459 | rq->cmd_flags |= REQ_QUIET; | 2461 | rq->cmd_flags |= REQ_QUIET; |
| 2460 | /* | 2462 | /* |
| 2461 | * Mark this request as started so we don't trigger | 2463 | * Mark this request as started so we don't trigger |
| 2462 | * any debug logic in the end I/O path. | 2464 | * any debug logic in the end I/O path. |
| 2463 | */ | 2465 | */ |
| 2464 | blk_start_request(rq); | 2466 | blk_start_request(rq); |
| 2465 | __blk_end_request_all(rq, -EIO); | 2467 | __blk_end_request_all(rq, err); |
| 2466 | } else { | 2468 | } else { |
| 2467 | printk(KERN_ERR "%s: bad return=%d\n", __func__, ret); | 2469 | printk(KERN_ERR "%s: bad return=%d\n", __func__, ret); |
| 2468 | break; | 2470 | break; |
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index 38c1aa89d3a0..28556fce4267 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c | |||
| @@ -65,18 +65,10 @@ struct skcipher_async_req { | |||
| 65 | struct skcipher_async_rsgl first_sgl; | 65 | struct skcipher_async_rsgl first_sgl; |
| 66 | struct list_head list; | 66 | struct list_head list; |
| 67 | struct scatterlist *tsg; | 67 | struct scatterlist *tsg; |
| 68 | char iv[]; | 68 | atomic_t *inflight; |
| 69 | struct skcipher_request req; | ||
| 69 | }; | 70 | }; |
| 70 | 71 | ||
| 71 | #define GET_SREQ(areq, ctx) (struct skcipher_async_req *)((char *)areq + \ | ||
| 72 | crypto_skcipher_reqsize(crypto_skcipher_reqtfm(&ctx->req))) | ||
| 73 | |||
| 74 | #define GET_REQ_SIZE(ctx) \ | ||
| 75 | crypto_skcipher_reqsize(crypto_skcipher_reqtfm(&ctx->req)) | ||
| 76 | |||
| 77 | #define GET_IV_SIZE(ctx) \ | ||
| 78 | crypto_skcipher_ivsize(crypto_skcipher_reqtfm(&ctx->req)) | ||
| 79 | |||
| 80 | #define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \ | 72 | #define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \ |
| 81 | sizeof(struct scatterlist) - 1) | 73 | sizeof(struct scatterlist) - 1) |
| 82 | 74 | ||
| @@ -102,15 +94,12 @@ static void skcipher_free_async_sgls(struct skcipher_async_req *sreq) | |||
| 102 | 94 | ||
| 103 | static void skcipher_async_cb(struct crypto_async_request *req, int err) | 95 | static void skcipher_async_cb(struct crypto_async_request *req, int err) |
| 104 | { | 96 | { |
| 105 | struct sock *sk = req->data; | 97 | struct skcipher_async_req *sreq = req->data; |
| 106 | struct alg_sock *ask = alg_sk(sk); | ||
| 107 | struct skcipher_ctx *ctx = ask->private; | ||
| 108 | struct skcipher_async_req *sreq = GET_SREQ(req, ctx); | ||
| 109 | struct kiocb *iocb = sreq->iocb; | 98 | struct kiocb *iocb = sreq->iocb; |
| 110 | 99 | ||
| 111 | atomic_dec(&ctx->inflight); | 100 | atomic_dec(sreq->inflight); |
| 112 | skcipher_free_async_sgls(sreq); | 101 | skcipher_free_async_sgls(sreq); |
| 113 | kfree(req); | 102 | kzfree(sreq); |
| 114 | iocb->ki_complete(iocb, err, err); | 103 | iocb->ki_complete(iocb, err, err); |
| 115 | } | 104 | } |
| 116 | 105 | ||
| @@ -306,8 +295,11 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg, | |||
| 306 | { | 295 | { |
| 307 | struct sock *sk = sock->sk; | 296 | struct sock *sk = sock->sk; |
| 308 | struct alg_sock *ask = alg_sk(sk); | 297 | struct alg_sock *ask = alg_sk(sk); |
| 298 | struct sock *psk = ask->parent; | ||
| 299 | struct alg_sock *pask = alg_sk(psk); | ||
| 309 | struct skcipher_ctx *ctx = ask->private; | 300 | struct skcipher_ctx *ctx = ask->private; |
| 310 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(&ctx->req); | 301 | struct skcipher_tfm *skc = pask->private; |
| 302 | struct crypto_skcipher *tfm = skc->skcipher; | ||
| 311 | unsigned ivsize = crypto_skcipher_ivsize(tfm); | 303 | unsigned ivsize = crypto_skcipher_ivsize(tfm); |
| 312 | struct skcipher_sg_list *sgl; | 304 | struct skcipher_sg_list *sgl; |
| 313 | struct af_alg_control con = {}; | 305 | struct af_alg_control con = {}; |
| @@ -509,37 +501,43 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg, | |||
| 509 | { | 501 | { |
| 510 | struct sock *sk = sock->sk; | 502 | struct sock *sk = sock->sk; |
| 511 | struct alg_sock *ask = alg_sk(sk); | 503 | struct alg_sock *ask = alg_sk(sk); |
| 504 | struct sock *psk = ask->parent; | ||
| 505 | struct alg_sock *pask = alg_sk(psk); | ||
| 512 | struct skcipher_ctx *ctx = ask->private; | 506 | struct skcipher_ctx *ctx = ask->private; |
| 507 | struct skcipher_tfm *skc = pask->private; | ||
| 508 | struct crypto_skcipher *tfm = skc->skcipher; | ||
| 513 | struct skcipher_sg_list *sgl; | 509 | struct skcipher_sg_list *sgl; |
| 514 | struct scatterlist *sg; | 510 | struct scatterlist *sg; |
| 515 | struct skcipher_async_req *sreq; | 511 | struct skcipher_async_req *sreq; |
| 516 | struct skcipher_request *req; | 512 | struct skcipher_request *req; |
| 517 | struct skcipher_async_rsgl *last_rsgl = NULL; | 513 | struct skcipher_async_rsgl *last_rsgl = NULL; |
| 518 | unsigned int txbufs = 0, len = 0, tx_nents = skcipher_all_sg_nents(ctx); | 514 | unsigned int txbufs = 0, len = 0, tx_nents; |
| 519 | unsigned int reqlen = sizeof(struct skcipher_async_req) + | 515 | unsigned int reqsize = crypto_skcipher_reqsize(tfm); |
| 520 | GET_REQ_SIZE(ctx) + GET_IV_SIZE(ctx); | 516 | unsigned int ivsize = crypto_skcipher_ivsize(tfm); |
| 521 | int err = -ENOMEM; | 517 | int err = -ENOMEM; |
| 522 | bool mark = false; | 518 | bool mark = false; |
| 519 | char *iv; | ||
| 523 | 520 | ||
| 524 | lock_sock(sk); | 521 | sreq = kzalloc(sizeof(*sreq) + reqsize + ivsize, GFP_KERNEL); |
| 525 | req = kmalloc(reqlen, GFP_KERNEL); | 522 | if (unlikely(!sreq)) |
| 526 | if (unlikely(!req)) | 523 | goto out; |
| 527 | goto unlock; | ||
| 528 | 524 | ||
| 529 | sreq = GET_SREQ(req, ctx); | 525 | req = &sreq->req; |
| 526 | iv = (char *)(req + 1) + reqsize; | ||
| 530 | sreq->iocb = msg->msg_iocb; | 527 | sreq->iocb = msg->msg_iocb; |
| 531 | memset(&sreq->first_sgl, '\0', sizeof(struct skcipher_async_rsgl)); | ||
| 532 | INIT_LIST_HEAD(&sreq->list); | 528 | INIT_LIST_HEAD(&sreq->list); |
| 529 | sreq->inflight = &ctx->inflight; | ||
| 530 | |||
| 531 | lock_sock(sk); | ||
| 532 | tx_nents = skcipher_all_sg_nents(ctx); | ||
| 533 | sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL); | 533 | sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL); |
| 534 | if (unlikely(!sreq->tsg)) { | 534 | if (unlikely(!sreq->tsg)) |
| 535 | kfree(req); | ||
| 536 | goto unlock; | 535 | goto unlock; |
| 537 | } | ||
| 538 | sg_init_table(sreq->tsg, tx_nents); | 536 | sg_init_table(sreq->tsg, tx_nents); |
| 539 | memcpy(sreq->iv, ctx->iv, GET_IV_SIZE(ctx)); | 537 | memcpy(iv, ctx->iv, ivsize); |
| 540 | skcipher_request_set_tfm(req, crypto_skcipher_reqtfm(&ctx->req)); | 538 | skcipher_request_set_tfm(req, tfm); |
| 541 | skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | 539 | skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, |
| 542 | skcipher_async_cb, sk); | 540 | skcipher_async_cb, sreq); |
| 543 | 541 | ||
| 544 | while (iov_iter_count(&msg->msg_iter)) { | 542 | while (iov_iter_count(&msg->msg_iter)) { |
| 545 | struct skcipher_async_rsgl *rsgl; | 543 | struct skcipher_async_rsgl *rsgl; |
| @@ -615,20 +613,22 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg, | |||
| 615 | sg_mark_end(sreq->tsg + txbufs - 1); | 613 | sg_mark_end(sreq->tsg + txbufs - 1); |
| 616 | 614 | ||
| 617 | skcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg, | 615 | skcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg, |
| 618 | len, sreq->iv); | 616 | len, iv); |
| 619 | err = ctx->enc ? crypto_skcipher_encrypt(req) : | 617 | err = ctx->enc ? crypto_skcipher_encrypt(req) : |
| 620 | crypto_skcipher_decrypt(req); | 618 | crypto_skcipher_decrypt(req); |
| 621 | if (err == -EINPROGRESS) { | 619 | if (err == -EINPROGRESS) { |
| 622 | atomic_inc(&ctx->inflight); | 620 | atomic_inc(&ctx->inflight); |
| 623 | err = -EIOCBQUEUED; | 621 | err = -EIOCBQUEUED; |
| 622 | sreq = NULL; | ||
| 624 | goto unlock; | 623 | goto unlock; |
| 625 | } | 624 | } |
| 626 | free: | 625 | free: |
| 627 | skcipher_free_async_sgls(sreq); | 626 | skcipher_free_async_sgls(sreq); |
| 628 | kfree(req); | ||
| 629 | unlock: | 627 | unlock: |
| 630 | skcipher_wmem_wakeup(sk); | 628 | skcipher_wmem_wakeup(sk); |
| 631 | release_sock(sk); | 629 | release_sock(sk); |
| 630 | kzfree(sreq); | ||
| 631 | out: | ||
| 632 | return err; | 632 | return err; |
| 633 | } | 633 | } |
| 634 | 634 | ||
| @@ -637,9 +637,12 @@ static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg, | |||
| 637 | { | 637 | { |
| 638 | struct sock *sk = sock->sk; | 638 | struct sock *sk = sock->sk; |
| 639 | struct alg_sock *ask = alg_sk(sk); | 639 | struct alg_sock *ask = alg_sk(sk); |
| 640 | struct sock *psk = ask->parent; | ||
| 641 | struct alg_sock *pask = alg_sk(psk); | ||
| 640 | struct skcipher_ctx *ctx = ask->private; | 642 | struct skcipher_ctx *ctx = ask->private; |
| 641 | unsigned bs = crypto_skcipher_blocksize(crypto_skcipher_reqtfm( | 643 | struct skcipher_tfm *skc = pask->private; |
| 642 | &ctx->req)); | 644 | struct crypto_skcipher *tfm = skc->skcipher; |
| 645 | unsigned bs = crypto_skcipher_blocksize(tfm); | ||
| 643 | struct skcipher_sg_list *sgl; | 646 | struct skcipher_sg_list *sgl; |
| 644 | struct scatterlist *sg; | 647 | struct scatterlist *sg; |
| 645 | int err = -EAGAIN; | 648 | int err = -EAGAIN; |
| @@ -947,7 +950,8 @@ static int skcipher_accept_parent_nokey(void *private, struct sock *sk) | |||
| 947 | ask->private = ctx; | 950 | ask->private = ctx; |
| 948 | 951 | ||
| 949 | skcipher_request_set_tfm(&ctx->req, skcipher); | 952 | skcipher_request_set_tfm(&ctx->req, skcipher); |
| 950 | skcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG, | 953 | skcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_SLEEP | |
| 954 | CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
| 951 | af_alg_complete, &ctx->completion); | 955 | af_alg_complete, &ctx->completion); |
| 952 | 956 | ||
| 953 | sk->sk_destruct = skcipher_sock_destruct; | 957 | sk->sk_destruct = skcipher_sock_destruct; |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 237f3795cfaa..43fe85f20d57 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
| @@ -499,6 +499,7 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 499 | if (link->dump == NULL) | 499 | if (link->dump == NULL) |
| 500 | return -EINVAL; | 500 | return -EINVAL; |
| 501 | 501 | ||
| 502 | down_read(&crypto_alg_sem); | ||
| 502 | list_for_each_entry(alg, &crypto_alg_list, cra_list) | 503 | list_for_each_entry(alg, &crypto_alg_list, cra_list) |
| 503 | dump_alloc += CRYPTO_REPORT_MAXSIZE; | 504 | dump_alloc += CRYPTO_REPORT_MAXSIZE; |
| 504 | 505 | ||
| @@ -508,8 +509,11 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 508 | .done = link->done, | 509 | .done = link->done, |
| 509 | .min_dump_alloc = dump_alloc, | 510 | .min_dump_alloc = dump_alloc, |
| 510 | }; | 511 | }; |
| 511 | return netlink_dump_start(crypto_nlsk, skb, nlh, &c); | 512 | err = netlink_dump_start(crypto_nlsk, skb, nlh, &c); |
| 512 | } | 513 | } |
| 514 | up_read(&crypto_alg_sem); | ||
| 515 | |||
| 516 | return err; | ||
| 513 | } | 517 | } |
| 514 | 518 | ||
| 515 | err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, | 519 | err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 594fcabd22cd..546a3692774f 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -264,6 +264,26 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 264 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ | 264 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ |
| 265 | { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ | 265 | { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ |
| 266 | { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ | 266 | { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ |
| 267 | { PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */ | ||
| 268 | { PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */ | ||
| 269 | { PCI_VDEVICE(INTEL, 0x19b2), board_ahci }, /* DNV AHCI */ | ||
| 270 | { PCI_VDEVICE(INTEL, 0x19b3), board_ahci }, /* DNV AHCI */ | ||
| 271 | { PCI_VDEVICE(INTEL, 0x19b4), board_ahci }, /* DNV AHCI */ | ||
| 272 | { PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */ | ||
| 273 | { PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */ | ||
| 274 | { PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */ | ||
| 275 | { PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */ | ||
| 276 | { PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */ | ||
| 277 | { PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */ | ||
| 278 | { PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */ | ||
| 279 | { PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */ | ||
| 280 | { PCI_VDEVICE(INTEL, 0x19c3), board_ahci }, /* DNV AHCI */ | ||
| 281 | { PCI_VDEVICE(INTEL, 0x19c4), board_ahci }, /* DNV AHCI */ | ||
| 282 | { PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */ | ||
| 283 | { PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */ | ||
| 284 | { PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */ | ||
| 285 | { PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */ | ||
| 286 | { PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */ | ||
| 267 | { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ | 287 | { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ |
| 268 | { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ | 288 | { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ |
| 269 | { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ | 289 | { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index a4faa438889c..a44c75d4c284 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
| @@ -250,6 +250,7 @@ enum { | |||
| 250 | AHCI_HFLAG_MULTI_MSI = 0, | 250 | AHCI_HFLAG_MULTI_MSI = 0, |
| 251 | AHCI_HFLAG_MULTI_MSIX = 0, | 251 | AHCI_HFLAG_MULTI_MSIX = 0, |
| 252 | #endif | 252 | #endif |
| 253 | AHCI_HFLAG_WAKE_BEFORE_STOP = (1 << 22), /* wake before DMA stop */ | ||
| 253 | 254 | ||
| 254 | /* ap->flags bits */ | 255 | /* ap->flags bits */ |
| 255 | 256 | ||
diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c index b36cae2fd04b..e87bcec0fd7c 100644 --- a/drivers/ata/ahci_brcmstb.c +++ b/drivers/ata/ahci_brcmstb.c | |||
| @@ -317,6 +317,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) | |||
| 317 | if (IS_ERR(hpriv)) | 317 | if (IS_ERR(hpriv)) |
| 318 | return PTR_ERR(hpriv); | 318 | return PTR_ERR(hpriv); |
| 319 | hpriv->plat_data = priv; | 319 | hpriv->plat_data = priv; |
| 320 | hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP; | ||
| 320 | 321 | ||
| 321 | brcm_sata_alpm_init(hpriv); | 322 | brcm_sata_alpm_init(hpriv); |
| 322 | 323 | ||
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index d61740e78d6d..402967902cbe 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -496,8 +496,8 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) | |||
| 496 | } | 496 | } |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | /* fabricate port_map from cap.nr_ports */ | 499 | /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ |
| 500 | if (!port_map) { | 500 | if (!port_map && vers < 0x10300) { |
| 501 | port_map = (1 << ahci_nr_ports(cap)) - 1; | 501 | port_map = (1 << ahci_nr_ports(cap)) - 1; |
| 502 | dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); | 502 | dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); |
| 503 | 503 | ||
| @@ -593,8 +593,22 @@ EXPORT_SYMBOL_GPL(ahci_start_engine); | |||
| 593 | int ahci_stop_engine(struct ata_port *ap) | 593 | int ahci_stop_engine(struct ata_port *ap) |
| 594 | { | 594 | { |
| 595 | void __iomem *port_mmio = ahci_port_base(ap); | 595 | void __iomem *port_mmio = ahci_port_base(ap); |
| 596 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
| 596 | u32 tmp; | 597 | u32 tmp; |
| 597 | 598 | ||
| 599 | /* | ||
| 600 | * On some controllers, stopping a port's DMA engine while the port | ||
| 601 | * is in ALPM state (partial or slumber) results in failures on | ||
| 602 | * subsequent DMA engine starts. For those controllers, put the | ||
| 603 | * port back in active state before stopping its DMA engine. | ||
| 604 | */ | ||
| 605 | if ((hpriv->flags & AHCI_HFLAG_WAKE_BEFORE_STOP) && | ||
| 606 | (ap->link.lpm_policy > ATA_LPM_MAX_POWER) && | ||
| 607 | ahci_set_lpm(&ap->link, ATA_LPM_MAX_POWER, ATA_LPM_WAKE_ONLY)) { | ||
| 608 | dev_err(ap->host->dev, "Failed to wake up port before engine stop\n"); | ||
| 609 | return -EIO; | ||
| 610 | } | ||
| 611 | |||
| 598 | tmp = readl(port_mmio + PORT_CMD); | 612 | tmp = readl(port_mmio + PORT_CMD); |
| 599 | 613 | ||
| 600 | /* check if the HBA is idle */ | 614 | /* check if the HBA is idle */ |
| @@ -689,6 +703,9 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 689 | void __iomem *port_mmio = ahci_port_base(ap); | 703 | void __iomem *port_mmio = ahci_port_base(ap); |
| 690 | 704 | ||
| 691 | if (policy != ATA_LPM_MAX_POWER) { | 705 | if (policy != ATA_LPM_MAX_POWER) { |
| 706 | /* wakeup flag only applies to the max power policy */ | ||
| 707 | hints &= ~ATA_LPM_WAKE_ONLY; | ||
| 708 | |||
| 692 | /* | 709 | /* |
| 693 | * Disable interrupts on Phy Ready. This keeps us from | 710 | * Disable interrupts on Phy Ready. This keeps us from |
| 694 | * getting woken up due to spurious phy ready | 711 | * getting woken up due to spurious phy ready |
| @@ -704,7 +721,8 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 704 | u32 cmd = readl(port_mmio + PORT_CMD); | 721 | u32 cmd = readl(port_mmio + PORT_CMD); |
| 705 | 722 | ||
| 706 | if (policy == ATA_LPM_MAX_POWER || !(hints & ATA_LPM_HIPM)) { | 723 | if (policy == ATA_LPM_MAX_POWER || !(hints & ATA_LPM_HIPM)) { |
| 707 | cmd &= ~(PORT_CMD_ASP | PORT_CMD_ALPE); | 724 | if (!(hints & ATA_LPM_WAKE_ONLY)) |
| 725 | cmd &= ~(PORT_CMD_ASP | PORT_CMD_ALPE); | ||
| 708 | cmd |= PORT_CMD_ICC_ACTIVE; | 726 | cmd |= PORT_CMD_ICC_ACTIVE; |
| 709 | 727 | ||
| 710 | writel(cmd, port_mmio + PORT_CMD); | 728 | writel(cmd, port_mmio + PORT_CMD); |
| @@ -712,6 +730,9 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 712 | 730 | ||
| 713 | /* wait 10ms to be sure we've come out of LPM state */ | 731 | /* wait 10ms to be sure we've come out of LPM state */ |
| 714 | ata_msleep(ap, 10); | 732 | ata_msleep(ap, 10); |
| 733 | |||
| 734 | if (hints & ATA_LPM_WAKE_ONLY) | ||
| 735 | return 0; | ||
| 715 | } else { | 736 | } else { |
| 716 | cmd |= PORT_CMD_ALPE; | 737 | cmd |= PORT_CMD_ALPE; |
| 717 | if (policy == ATA_LPM_MIN_POWER) | 738 | if (policy == ATA_LPM_MIN_POWER) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index cbb74719d2c1..55e257c268dd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4125,6 +4125,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4125 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, | 4125 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, |
| 4126 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, | 4126 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, |
| 4127 | { " 2GB ATA Flash Disk", "ADMA428M", ATA_HORKAGE_NODMA }, | 4127 | { " 2GB ATA Flash Disk", "ADMA428M", ATA_HORKAGE_NODMA }, |
| 4128 | { "VRFDFC22048UCHC-TE*", NULL, ATA_HORKAGE_NODMA }, | ||
| 4128 | /* Odd clown on sil3726/4726 PMPs */ | 4129 | /* Odd clown on sil3726/4726 PMPs */ |
| 4129 | { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, | 4130 | { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, |
| 4130 | 4131 | ||
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index cdf6215a9a22..051b6158d1b7 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -997,12 +997,9 @@ static inline int ata_hsm_ok_in_wq(struct ata_port *ap, | |||
| 997 | static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) | 997 | static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) |
| 998 | { | 998 | { |
| 999 | struct ata_port *ap = qc->ap; | 999 | struct ata_port *ap = qc->ap; |
| 1000 | unsigned long flags; | ||
| 1001 | 1000 | ||
| 1002 | if (ap->ops->error_handler) { | 1001 | if (ap->ops->error_handler) { |
| 1003 | if (in_wq) { | 1002 | if (in_wq) { |
| 1004 | spin_lock_irqsave(ap->lock, flags); | ||
| 1005 | |||
| 1006 | /* EH might have kicked in while host lock is | 1003 | /* EH might have kicked in while host lock is |
| 1007 | * released. | 1004 | * released. |
| 1008 | */ | 1005 | */ |
| @@ -1014,8 +1011,6 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) | |||
| 1014 | } else | 1011 | } else |
| 1015 | ata_port_freeze(ap); | 1012 | ata_port_freeze(ap); |
| 1016 | } | 1013 | } |
| 1017 | |||
| 1018 | spin_unlock_irqrestore(ap->lock, flags); | ||
| 1019 | } else { | 1014 | } else { |
| 1020 | if (likely(!(qc->err_mask & AC_ERR_HSM))) | 1015 | if (likely(!(qc->err_mask & AC_ERR_HSM))) |
| 1021 | ata_qc_complete(qc); | 1016 | ata_qc_complete(qc); |
| @@ -1024,10 +1019,8 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) | |||
| 1024 | } | 1019 | } |
| 1025 | } else { | 1020 | } else { |
| 1026 | if (in_wq) { | 1021 | if (in_wq) { |
| 1027 | spin_lock_irqsave(ap->lock, flags); | ||
| 1028 | ata_sff_irq_on(ap); | 1022 | ata_sff_irq_on(ap); |
| 1029 | ata_qc_complete(qc); | 1023 | ata_qc_complete(qc); |
| 1030 | spin_unlock_irqrestore(ap->lock, flags); | ||
| 1031 | } else | 1024 | } else |
| 1032 | ata_qc_complete(qc); | 1025 | ata_qc_complete(qc); |
| 1033 | } | 1026 | } |
| @@ -1048,9 +1041,10 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
| 1048 | { | 1041 | { |
| 1049 | struct ata_link *link = qc->dev->link; | 1042 | struct ata_link *link = qc->dev->link; |
| 1050 | struct ata_eh_info *ehi = &link->eh_info; | 1043 | struct ata_eh_info *ehi = &link->eh_info; |
| 1051 | unsigned long flags = 0; | ||
| 1052 | int poll_next; | 1044 | int poll_next; |
| 1053 | 1045 | ||
| 1046 | lockdep_assert_held(ap->lock); | ||
| 1047 | |||
| 1054 | WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0); | 1048 | WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0); |
| 1055 | 1049 | ||
| 1056 | /* Make sure ata_sff_qc_issue() does not throw things | 1050 | /* Make sure ata_sff_qc_issue() does not throw things |
| @@ -1112,14 +1106,6 @@ fsm_start: | |||
| 1112 | } | 1106 | } |
| 1113 | } | 1107 | } |
| 1114 | 1108 | ||
| 1115 | /* Send the CDB (atapi) or the first data block (ata pio out). | ||
| 1116 | * During the state transition, interrupt handler shouldn't | ||
| 1117 | * be invoked before the data transfer is complete and | ||
| 1118 | * hsm_task_state is changed. Hence, the following locking. | ||
| 1119 | */ | ||
| 1120 | if (in_wq) | ||
| 1121 | spin_lock_irqsave(ap->lock, flags); | ||
| 1122 | |||
| 1123 | if (qc->tf.protocol == ATA_PROT_PIO) { | 1109 | if (qc->tf.protocol == ATA_PROT_PIO) { |
| 1124 | /* PIO data out protocol. | 1110 | /* PIO data out protocol. |
| 1125 | * send first data block. | 1111 | * send first data block. |
| @@ -1135,9 +1121,6 @@ fsm_start: | |||
| 1135 | /* send CDB */ | 1121 | /* send CDB */ |
| 1136 | atapi_send_cdb(ap, qc); | 1122 | atapi_send_cdb(ap, qc); |
| 1137 | 1123 | ||
| 1138 | if (in_wq) | ||
| 1139 | spin_unlock_irqrestore(ap->lock, flags); | ||
| 1140 | |||
| 1141 | /* if polling, ata_sff_pio_task() handles the rest. | 1124 | /* if polling, ata_sff_pio_task() handles the rest. |
| 1142 | * otherwise, interrupt handler takes over from here. | 1125 | * otherwise, interrupt handler takes over from here. |
| 1143 | */ | 1126 | */ |
| @@ -1296,7 +1279,8 @@ fsm_start: | |||
| 1296 | break; | 1279 | break; |
| 1297 | default: | 1280 | default: |
| 1298 | poll_next = 0; | 1281 | poll_next = 0; |
| 1299 | BUG(); | 1282 | WARN(true, "ata%d: SFF host state machine in invalid state %d", |
| 1283 | ap->print_id, ap->hsm_task_state); | ||
| 1300 | } | 1284 | } |
| 1301 | 1285 | ||
| 1302 | return poll_next; | 1286 | return poll_next; |
| @@ -1361,12 +1345,14 @@ static void ata_sff_pio_task(struct work_struct *work) | |||
| 1361 | u8 status; | 1345 | u8 status; |
| 1362 | int poll_next; | 1346 | int poll_next; |
| 1363 | 1347 | ||
| 1348 | spin_lock_irq(ap->lock); | ||
| 1349 | |||
| 1364 | BUG_ON(ap->sff_pio_task_link == NULL); | 1350 | BUG_ON(ap->sff_pio_task_link == NULL); |
| 1365 | /* qc can be NULL if timeout occurred */ | 1351 | /* qc can be NULL if timeout occurred */ |
| 1366 | qc = ata_qc_from_tag(ap, link->active_tag); | 1352 | qc = ata_qc_from_tag(ap, link->active_tag); |
| 1367 | if (!qc) { | 1353 | if (!qc) { |
| 1368 | ap->sff_pio_task_link = NULL; | 1354 | ap->sff_pio_task_link = NULL; |
| 1369 | return; | 1355 | goto out_unlock; |
| 1370 | } | 1356 | } |
| 1371 | 1357 | ||
| 1372 | fsm_start: | 1358 | fsm_start: |
| @@ -1381,11 +1367,14 @@ fsm_start: | |||
| 1381 | */ | 1367 | */ |
| 1382 | status = ata_sff_busy_wait(ap, ATA_BUSY, 5); | 1368 | status = ata_sff_busy_wait(ap, ATA_BUSY, 5); |
| 1383 | if (status & ATA_BUSY) { | 1369 | if (status & ATA_BUSY) { |
| 1370 | spin_unlock_irq(ap->lock); | ||
| 1384 | ata_msleep(ap, 2); | 1371 | ata_msleep(ap, 2); |
| 1372 | spin_lock_irq(ap->lock); | ||
| 1373 | |||
| 1385 | status = ata_sff_busy_wait(ap, ATA_BUSY, 10); | 1374 | status = ata_sff_busy_wait(ap, ATA_BUSY, 10); |
| 1386 | if (status & ATA_BUSY) { | 1375 | if (status & ATA_BUSY) { |
| 1387 | ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); | 1376 | ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); |
| 1388 | return; | 1377 | goto out_unlock; |
| 1389 | } | 1378 | } |
| 1390 | } | 1379 | } |
| 1391 | 1380 | ||
| @@ -1402,6 +1391,8 @@ fsm_start: | |||
| 1402 | */ | 1391 | */ |
| 1403 | if (poll_next) | 1392 | if (poll_next) |
| 1404 | goto fsm_start; | 1393 | goto fsm_start; |
| 1394 | out_unlock: | ||
| 1395 | spin_unlock_irq(ap->lock); | ||
| 1405 | } | 1396 | } |
| 1406 | 1397 | ||
| 1407 | /** | 1398 | /** |
diff --git a/drivers/base/component.c b/drivers/base/component.c index 89f5cf68d80a..04a1582e80bb 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c | |||
| @@ -206,6 +206,8 @@ static void component_match_release(struct device *master, | |||
| 206 | if (mc->release) | 206 | if (mc->release) |
| 207 | mc->release(master, mc->data); | 207 | mc->release(master, mc->data); |
| 208 | } | 208 | } |
| 209 | |||
| 210 | kfree(match->compare); | ||
| 209 | } | 211 | } |
| 210 | 212 | ||
| 211 | static void devm_component_match_release(struct device *dev, void *res) | 213 | static void devm_component_match_release(struct device *dev, void *res) |
| @@ -221,14 +223,14 @@ static int component_match_realloc(struct device *dev, | |||
| 221 | if (match->alloc == num) | 223 | if (match->alloc == num) |
| 222 | return 0; | 224 | return 0; |
| 223 | 225 | ||
| 224 | new = devm_kmalloc_array(dev, num, sizeof(*new), GFP_KERNEL); | 226 | new = kmalloc_array(num, sizeof(*new), GFP_KERNEL); |
| 225 | if (!new) | 227 | if (!new) |
| 226 | return -ENOMEM; | 228 | return -ENOMEM; |
| 227 | 229 | ||
| 228 | if (match->compare) { | 230 | if (match->compare) { |
| 229 | memcpy(new, match->compare, sizeof(*new) * | 231 | memcpy(new, match->compare, sizeof(*new) * |
| 230 | min(match->num, num)); | 232 | min(match->num, num)); |
| 231 | devm_kfree(dev, match->compare); | 233 | kfree(match->compare); |
| 232 | } | 234 | } |
| 233 | match->compare = new; | 235 | match->compare = new; |
| 234 | match->alloc = num; | 236 | match->alloc = num; |
| @@ -283,6 +285,24 @@ void component_match_add_release(struct device *master, | |||
| 283 | } | 285 | } |
| 284 | EXPORT_SYMBOL(component_match_add_release); | 286 | EXPORT_SYMBOL(component_match_add_release); |
| 285 | 287 | ||
| 288 | static void free_master(struct master *master) | ||
| 289 | { | ||
| 290 | struct component_match *match = master->match; | ||
| 291 | int i; | ||
| 292 | |||
| 293 | list_del(&master->node); | ||
| 294 | |||
| 295 | if (match) { | ||
| 296 | for (i = 0; i < match->num; i++) { | ||
| 297 | struct component *c = match->compare[i].component; | ||
| 298 | if (c) | ||
| 299 | c->master = NULL; | ||
| 300 | } | ||
| 301 | } | ||
| 302 | |||
| 303 | kfree(master); | ||
| 304 | } | ||
| 305 | |||
| 286 | int component_master_add_with_match(struct device *dev, | 306 | int component_master_add_with_match(struct device *dev, |
| 287 | const struct component_master_ops *ops, | 307 | const struct component_master_ops *ops, |
| 288 | struct component_match *match) | 308 | struct component_match *match) |
| @@ -309,11 +329,9 @@ int component_master_add_with_match(struct device *dev, | |||
| 309 | 329 | ||
| 310 | ret = try_to_bring_up_master(master, NULL); | 330 | ret = try_to_bring_up_master(master, NULL); |
| 311 | 331 | ||
| 312 | if (ret < 0) { | 332 | if (ret < 0) |
| 313 | /* Delete off the list if we weren't successful */ | 333 | free_master(master); |
| 314 | list_del(&master->node); | 334 | |
| 315 | kfree(master); | ||
| 316 | } | ||
| 317 | mutex_unlock(&component_mutex); | 335 | mutex_unlock(&component_mutex); |
| 318 | 336 | ||
| 319 | return ret < 0 ? ret : 0; | 337 | return ret < 0 ? ret : 0; |
| @@ -324,25 +342,12 @@ void component_master_del(struct device *dev, | |||
| 324 | const struct component_master_ops *ops) | 342 | const struct component_master_ops *ops) |
| 325 | { | 343 | { |
| 326 | struct master *master; | 344 | struct master *master; |
| 327 | int i; | ||
| 328 | 345 | ||
| 329 | mutex_lock(&component_mutex); | 346 | mutex_lock(&component_mutex); |
| 330 | master = __master_find(dev, ops); | 347 | master = __master_find(dev, ops); |
| 331 | if (master) { | 348 | if (master) { |
| 332 | struct component_match *match = master->match; | ||
| 333 | |||
| 334 | take_down_master(master); | 349 | take_down_master(master); |
| 335 | 350 | free_master(master); | |
| 336 | list_del(&master->node); | ||
| 337 | |||
| 338 | if (match) { | ||
| 339 | for (i = 0; i < match->num; i++) { | ||
| 340 | struct component *c = match->compare[i].component; | ||
| 341 | if (c) | ||
| 342 | c->master = NULL; | ||
| 343 | } | ||
| 344 | } | ||
| 345 | kfree(master); | ||
| 346 | } | 351 | } |
| 347 | mutex_unlock(&component_mutex); | 352 | mutex_unlock(&component_mutex); |
| 348 | } | 353 | } |
| @@ -486,6 +491,8 @@ int component_add(struct device *dev, const struct component_ops *ops) | |||
| 486 | 491 | ||
| 487 | ret = try_to_bring_up_masters(component); | 492 | ret = try_to_bring_up_masters(component); |
| 488 | if (ret < 0) { | 493 | if (ret < 0) { |
| 494 | if (component->master) | ||
| 495 | remove_component(component->master, component); | ||
| 489 | list_del(&component->node); | 496 | list_del(&component->node); |
| 490 | 497 | ||
| 491 | kfree(component); | 498 | kfree(component); |
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 8812bfb9e3b8..eea51569f0eb 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c | |||
| @@ -133,17 +133,17 @@ static int regmap_mmio_gather_write(void *context, | |||
| 133 | while (val_size) { | 133 | while (val_size) { |
| 134 | switch (ctx->val_bytes) { | 134 | switch (ctx->val_bytes) { |
| 135 | case 1: | 135 | case 1: |
| 136 | __raw_writeb(*(u8 *)val, ctx->regs + offset); | 136 | writeb(*(u8 *)val, ctx->regs + offset); |
| 137 | break; | 137 | break; |
| 138 | case 2: | 138 | case 2: |
| 139 | __raw_writew(*(u16 *)val, ctx->regs + offset); | 139 | writew(*(u16 *)val, ctx->regs + offset); |
| 140 | break; | 140 | break; |
| 141 | case 4: | 141 | case 4: |
| 142 | __raw_writel(*(u32 *)val, ctx->regs + offset); | 142 | writel(*(u32 *)val, ctx->regs + offset); |
| 143 | break; | 143 | break; |
| 144 | #ifdef CONFIG_64BIT | 144 | #ifdef CONFIG_64BIT |
| 145 | case 8: | 145 | case 8: |
| 146 | __raw_writeq(*(u64 *)val, ctx->regs + offset); | 146 | writeq(*(u64 *)val, ctx->regs + offset); |
| 147 | break; | 147 | break; |
| 148 | #endif | 148 | #endif |
| 149 | default: | 149 | default: |
| @@ -193,17 +193,17 @@ static int regmap_mmio_read(void *context, | |||
| 193 | while (val_size) { | 193 | while (val_size) { |
| 194 | switch (ctx->val_bytes) { | 194 | switch (ctx->val_bytes) { |
| 195 | case 1: | 195 | case 1: |
| 196 | *(u8 *)val = __raw_readb(ctx->regs + offset); | 196 | *(u8 *)val = readb(ctx->regs + offset); |
| 197 | break; | 197 | break; |
| 198 | case 2: | 198 | case 2: |
| 199 | *(u16 *)val = __raw_readw(ctx->regs + offset); | 199 | *(u16 *)val = readw(ctx->regs + offset); |
| 200 | break; | 200 | break; |
| 201 | case 4: | 201 | case 4: |
| 202 | *(u32 *)val = __raw_readl(ctx->regs + offset); | 202 | *(u32 *)val = readl(ctx->regs + offset); |
| 203 | break; | 203 | break; |
| 204 | #ifdef CONFIG_64BIT | 204 | #ifdef CONFIG_64BIT |
| 205 | case 8: | 205 | case 8: |
| 206 | *(u64 *)val = __raw_readq(ctx->regs + offset); | 206 | *(u64 *)val = readq(ctx->regs + offset); |
| 207 | break; | 207 | break; |
| 208 | #endif | 208 | #endif |
| 209 | default: | 209 | default: |
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 20de861aa0ea..8bf9914d4d15 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c | |||
| @@ -782,7 +782,7 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err) | |||
| 782 | dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU | | 782 | dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU | |
| 783 | SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY); | 783 | SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY); |
| 784 | 784 | ||
| 785 | clk_disable_unprepare(dd->iclk); | 785 | clk_disable(dd->iclk); |
| 786 | 786 | ||
| 787 | if (req->base.complete) | 787 | if (req->base.complete) |
| 788 | req->base.complete(&req->base, err); | 788 | req->base.complete(&req->base, err); |
| @@ -795,7 +795,7 @@ static int atmel_sha_hw_init(struct atmel_sha_dev *dd) | |||
| 795 | { | 795 | { |
| 796 | int err; | 796 | int err; |
| 797 | 797 | ||
| 798 | err = clk_prepare_enable(dd->iclk); | 798 | err = clk_enable(dd->iclk); |
| 799 | if (err) | 799 | if (err) |
| 800 | return err; | 800 | return err; |
| 801 | 801 | ||
| @@ -822,7 +822,7 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd) | |||
| 822 | dev_info(dd->dev, | 822 | dev_info(dd->dev, |
| 823 | "version: 0x%x\n", dd->hw_version); | 823 | "version: 0x%x\n", dd->hw_version); |
| 824 | 824 | ||
| 825 | clk_disable_unprepare(dd->iclk); | 825 | clk_disable(dd->iclk); |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | static int atmel_sha_handle_queue(struct atmel_sha_dev *dd, | 828 | static int atmel_sha_handle_queue(struct atmel_sha_dev *dd, |
| @@ -1410,6 +1410,10 @@ static int atmel_sha_probe(struct platform_device *pdev) | |||
| 1410 | goto res_err; | 1410 | goto res_err; |
| 1411 | } | 1411 | } |
| 1412 | 1412 | ||
| 1413 | err = clk_prepare(sha_dd->iclk); | ||
| 1414 | if (err) | ||
| 1415 | goto res_err; | ||
| 1416 | |||
| 1413 | atmel_sha_hw_version_init(sha_dd); | 1417 | atmel_sha_hw_version_init(sha_dd); |
| 1414 | 1418 | ||
| 1415 | atmel_sha_get_cap(sha_dd); | 1419 | atmel_sha_get_cap(sha_dd); |
| @@ -1421,12 +1425,12 @@ static int atmel_sha_probe(struct platform_device *pdev) | |||
| 1421 | if (IS_ERR(pdata)) { | 1425 | if (IS_ERR(pdata)) { |
| 1422 | dev_err(&pdev->dev, "platform data not available\n"); | 1426 | dev_err(&pdev->dev, "platform data not available\n"); |
| 1423 | err = PTR_ERR(pdata); | 1427 | err = PTR_ERR(pdata); |
| 1424 | goto res_err; | 1428 | goto iclk_unprepare; |
| 1425 | } | 1429 | } |
| 1426 | } | 1430 | } |
| 1427 | if (!pdata->dma_slave) { | 1431 | if (!pdata->dma_slave) { |
| 1428 | err = -ENXIO; | 1432 | err = -ENXIO; |
| 1429 | goto res_err; | 1433 | goto iclk_unprepare; |
| 1430 | } | 1434 | } |
| 1431 | err = atmel_sha_dma_init(sha_dd, pdata); | 1435 | err = atmel_sha_dma_init(sha_dd, pdata); |
| 1432 | if (err) | 1436 | if (err) |
| @@ -1457,6 +1461,8 @@ err_algs: | |||
| 1457 | if (sha_dd->caps.has_dma) | 1461 | if (sha_dd->caps.has_dma) |
| 1458 | atmel_sha_dma_cleanup(sha_dd); | 1462 | atmel_sha_dma_cleanup(sha_dd); |
| 1459 | err_sha_dma: | 1463 | err_sha_dma: |
| 1464 | iclk_unprepare: | ||
| 1465 | clk_unprepare(sha_dd->iclk); | ||
| 1460 | res_err: | 1466 | res_err: |
| 1461 | tasklet_kill(&sha_dd->done_task); | 1467 | tasklet_kill(&sha_dd->done_task); |
| 1462 | sha_dd_err: | 1468 | sha_dd_err: |
| @@ -1483,12 +1489,7 @@ static int atmel_sha_remove(struct platform_device *pdev) | |||
| 1483 | if (sha_dd->caps.has_dma) | 1489 | if (sha_dd->caps.has_dma) |
| 1484 | atmel_sha_dma_cleanup(sha_dd); | 1490 | atmel_sha_dma_cleanup(sha_dd); |
| 1485 | 1491 | ||
| 1486 | iounmap(sha_dd->io_base); | 1492 | clk_unprepare(sha_dd->iclk); |
| 1487 | |||
| 1488 | clk_put(sha_dd->iclk); | ||
| 1489 | |||
| 1490 | if (sha_dd->irq >= 0) | ||
| 1491 | free_irq(sha_dd->irq, sha_dd); | ||
| 1492 | 1493 | ||
| 1493 | return 0; | 1494 | return 0; |
| 1494 | } | 1495 | } |
diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c index 0643e3366e33..c0656e7f37b5 100644 --- a/drivers/crypto/marvell/cesa.c +++ b/drivers/crypto/marvell/cesa.c | |||
| @@ -306,7 +306,7 @@ static int mv_cesa_dev_dma_init(struct mv_cesa_dev *cesa) | |||
| 306 | return -ENOMEM; | 306 | return -ENOMEM; |
| 307 | 307 | ||
| 308 | dma->padding_pool = dmam_pool_create("cesa_padding", dev, 72, 1, 0); | 308 | dma->padding_pool = dmam_pool_create("cesa_padding", dev, 72, 1, 0); |
| 309 | if (!dma->cache_pool) | 309 | if (!dma->padding_pool) |
| 310 | return -ENOMEM; | 310 | return -ENOMEM; |
| 311 | 311 | ||
| 312 | cesa->dma = dma; | 312 | cesa->dma = dma; |
diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c index 2aeaebd1c6e7..3f87a03abc22 100644 --- a/drivers/gpio/gpio-altera.c +++ b/drivers/gpio/gpio-altera.c | |||
| @@ -312,8 +312,8 @@ static int altera_gpio_probe(struct platform_device *pdev) | |||
| 312 | handle_simple_irq, IRQ_TYPE_NONE); | 312 | handle_simple_irq, IRQ_TYPE_NONE); |
| 313 | 313 | ||
| 314 | if (ret) { | 314 | if (ret) { |
| 315 | dev_info(&pdev->dev, "could not add irqchip\n"); | 315 | dev_err(&pdev->dev, "could not add irqchip\n"); |
| 316 | return ret; | 316 | goto teardown; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc, | 319 | gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc, |
| @@ -326,6 +326,7 @@ static int altera_gpio_probe(struct platform_device *pdev) | |||
| 326 | skip_irq: | 326 | skip_irq: |
| 327 | return 0; | 327 | return 0; |
| 328 | teardown: | 328 | teardown: |
| 329 | of_mm_gpiochip_remove(&altera_gc->mmchip); | ||
| 329 | pr_err("%s: registration failed with status %d\n", | 330 | pr_err("%s: registration failed with status %d\n", |
| 330 | node->full_name, ret); | 331 | node->full_name, ret); |
| 331 | 332 | ||
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index ec58f4288649..cd007a67b302 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
| @@ -195,7 +195,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc, | |||
| 195 | static int davinci_gpio_probe(struct platform_device *pdev) | 195 | static int davinci_gpio_probe(struct platform_device *pdev) |
| 196 | { | 196 | { |
| 197 | int i, base; | 197 | int i, base; |
| 198 | unsigned ngpio; | 198 | unsigned ngpio, nbank; |
| 199 | struct davinci_gpio_controller *chips; | 199 | struct davinci_gpio_controller *chips; |
| 200 | struct davinci_gpio_platform_data *pdata; | 200 | struct davinci_gpio_platform_data *pdata; |
| 201 | struct davinci_gpio_regs __iomem *regs; | 201 | struct davinci_gpio_regs __iomem *regs; |
| @@ -224,8 +224,9 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
| 224 | if (WARN_ON(ARCH_NR_GPIOS < ngpio)) | 224 | if (WARN_ON(ARCH_NR_GPIOS < ngpio)) |
| 225 | ngpio = ARCH_NR_GPIOS; | 225 | ngpio = ARCH_NR_GPIOS; |
| 226 | 226 | ||
| 227 | nbank = DIV_ROUND_UP(ngpio, 32); | ||
| 227 | chips = devm_kzalloc(dev, | 228 | chips = devm_kzalloc(dev, |
| 228 | ngpio * sizeof(struct davinci_gpio_controller), | 229 | nbank * sizeof(struct davinci_gpio_controller), |
| 229 | GFP_KERNEL); | 230 | GFP_KERNEL); |
| 230 | if (!chips) | 231 | if (!chips) |
| 231 | return -ENOMEM; | 232 | return -ENOMEM; |
| @@ -511,7 +512,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
| 511 | return irq; | 512 | return irq; |
| 512 | } | 513 | } |
| 513 | 514 | ||
| 514 | irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0, | 515 | irq_domain = irq_domain_add_legacy(dev->of_node, ngpio, irq, 0, |
| 515 | &davinci_gpio_irq_ops, | 516 | &davinci_gpio_irq_ops, |
| 516 | chips); | 517 | chips); |
| 517 | if (!irq_domain) { | 518 | if (!irq_domain) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 82edf95b7740..5e7770f9a415 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
| @@ -87,6 +87,8 @@ extern int amdgpu_sched_jobs; | |||
| 87 | extern int amdgpu_sched_hw_submission; | 87 | extern int amdgpu_sched_hw_submission; |
| 88 | extern int amdgpu_enable_semaphores; | 88 | extern int amdgpu_enable_semaphores; |
| 89 | extern int amdgpu_powerplay; | 89 | extern int amdgpu_powerplay; |
| 90 | extern unsigned amdgpu_pcie_gen_cap; | ||
| 91 | extern unsigned amdgpu_pcie_lane_cap; | ||
| 90 | 92 | ||
| 91 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 | 93 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 |
| 92 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ | 94 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
| @@ -132,47 +134,6 @@ extern int amdgpu_powerplay; | |||
| 132 | #define AMDGPU_RESET_VCE (1 << 13) | 134 | #define AMDGPU_RESET_VCE (1 << 13) |
| 133 | #define AMDGPU_RESET_VCE1 (1 << 14) | 135 | #define AMDGPU_RESET_VCE1 (1 << 14) |
| 134 | 136 | ||
| 135 | /* CG block flags */ | ||
| 136 | #define AMDGPU_CG_BLOCK_GFX (1 << 0) | ||
| 137 | #define AMDGPU_CG_BLOCK_MC (1 << 1) | ||
| 138 | #define AMDGPU_CG_BLOCK_SDMA (1 << 2) | ||
| 139 | #define AMDGPU_CG_BLOCK_UVD (1 << 3) | ||
| 140 | #define AMDGPU_CG_BLOCK_VCE (1 << 4) | ||
| 141 | #define AMDGPU_CG_BLOCK_HDP (1 << 5) | ||
| 142 | #define AMDGPU_CG_BLOCK_BIF (1 << 6) | ||
| 143 | |||
| 144 | /* CG flags */ | ||
| 145 | #define AMDGPU_CG_SUPPORT_GFX_MGCG (1 << 0) | ||
| 146 | #define AMDGPU_CG_SUPPORT_GFX_MGLS (1 << 1) | ||
| 147 | #define AMDGPU_CG_SUPPORT_GFX_CGCG (1 << 2) | ||
| 148 | #define AMDGPU_CG_SUPPORT_GFX_CGLS (1 << 3) | ||
| 149 | #define AMDGPU_CG_SUPPORT_GFX_CGTS (1 << 4) | ||
| 150 | #define AMDGPU_CG_SUPPORT_GFX_CGTS_LS (1 << 5) | ||
| 151 | #define AMDGPU_CG_SUPPORT_GFX_CP_LS (1 << 6) | ||
| 152 | #define AMDGPU_CG_SUPPORT_GFX_RLC_LS (1 << 7) | ||
| 153 | #define AMDGPU_CG_SUPPORT_MC_LS (1 << 8) | ||
| 154 | #define AMDGPU_CG_SUPPORT_MC_MGCG (1 << 9) | ||
| 155 | #define AMDGPU_CG_SUPPORT_SDMA_LS (1 << 10) | ||
| 156 | #define AMDGPU_CG_SUPPORT_SDMA_MGCG (1 << 11) | ||
| 157 | #define AMDGPU_CG_SUPPORT_BIF_LS (1 << 12) | ||
| 158 | #define AMDGPU_CG_SUPPORT_UVD_MGCG (1 << 13) | ||
| 159 | #define AMDGPU_CG_SUPPORT_VCE_MGCG (1 << 14) | ||
| 160 | #define AMDGPU_CG_SUPPORT_HDP_LS (1 << 15) | ||
| 161 | #define AMDGPU_CG_SUPPORT_HDP_MGCG (1 << 16) | ||
| 162 | |||
| 163 | /* PG flags */ | ||
| 164 | #define AMDGPU_PG_SUPPORT_GFX_PG (1 << 0) | ||
| 165 | #define AMDGPU_PG_SUPPORT_GFX_SMG (1 << 1) | ||
| 166 | #define AMDGPU_PG_SUPPORT_GFX_DMG (1 << 2) | ||
| 167 | #define AMDGPU_PG_SUPPORT_UVD (1 << 3) | ||
| 168 | #define AMDGPU_PG_SUPPORT_VCE (1 << 4) | ||
| 169 | #define AMDGPU_PG_SUPPORT_CP (1 << 5) | ||
| 170 | #define AMDGPU_PG_SUPPORT_GDS (1 << 6) | ||
| 171 | #define AMDGPU_PG_SUPPORT_RLC_SMU_HS (1 << 7) | ||
| 172 | #define AMDGPU_PG_SUPPORT_SDMA (1 << 8) | ||
| 173 | #define AMDGPU_PG_SUPPORT_ACP (1 << 9) | ||
| 174 | #define AMDGPU_PG_SUPPORT_SAMU (1 << 10) | ||
| 175 | |||
| 176 | /* GFX current status */ | 137 | /* GFX current status */ |
| 177 | #define AMDGPU_GFX_NORMAL_MODE 0x00000000L | 138 | #define AMDGPU_GFX_NORMAL_MODE 0x00000000L |
| 178 | #define AMDGPU_GFX_SAFE_MODE 0x00000001L | 139 | #define AMDGPU_GFX_SAFE_MODE 0x00000001L |
| @@ -606,8 +567,6 @@ struct amdgpu_sa_manager { | |||
| 606 | uint32_t align; | 567 | uint32_t align; |
| 607 | }; | 568 | }; |
| 608 | 569 | ||
| 609 | struct amdgpu_sa_bo; | ||
| 610 | |||
| 611 | /* sub-allocation buffer */ | 570 | /* sub-allocation buffer */ |
| 612 | struct amdgpu_sa_bo { | 571 | struct amdgpu_sa_bo { |
| 613 | struct list_head olist; | 572 | struct list_head olist; |
| @@ -2360,6 +2319,8 @@ bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo); | |||
| 2360 | int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr, | 2319 | int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr, |
| 2361 | uint32_t flags); | 2320 | uint32_t flags); |
| 2362 | bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm); | 2321 | bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm); |
| 2322 | bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, | ||
| 2323 | unsigned long end); | ||
| 2363 | bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm); | 2324 | bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm); |
| 2364 | uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, | 2325 | uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, |
| 2365 | struct ttm_mem_reg *mem); | 2326 | struct ttm_mem_reg *mem); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index a081dda9fa2f..7a4b101e10c6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
| @@ -795,6 +795,12 @@ static int amdgpu_cgs_query_system_info(void *cgs_device, | |||
| 795 | case CGS_SYSTEM_INFO_PCIE_MLW: | 795 | case CGS_SYSTEM_INFO_PCIE_MLW: |
| 796 | sys_info->value = adev->pm.pcie_mlw_mask; | 796 | sys_info->value = adev->pm.pcie_mlw_mask; |
| 797 | break; | 797 | break; |
| 798 | case CGS_SYSTEM_INFO_CG_FLAGS: | ||
| 799 | sys_info->value = adev->cg_flags; | ||
| 800 | break; | ||
| 801 | case CGS_SYSTEM_INFO_PG_FLAGS: | ||
| 802 | sys_info->value = adev->pg_flags; | ||
| 803 | break; | ||
| 798 | default: | 804 | default: |
| 799 | return -ENODEV; | 805 | return -ENODEV; |
| 800 | } | 806 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 65531463f88e..51bfc114584e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
| @@ -1795,15 +1795,20 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
| 1795 | } | 1795 | } |
| 1796 | 1796 | ||
| 1797 | /* post card */ | 1797 | /* post card */ |
| 1798 | amdgpu_atom_asic_init(adev->mode_info.atom_context); | 1798 | if (!amdgpu_card_posted(adev)) |
| 1799 | amdgpu_atom_asic_init(adev->mode_info.atom_context); | ||
| 1799 | 1800 | ||
| 1800 | r = amdgpu_resume(adev); | 1801 | r = amdgpu_resume(adev); |
| 1802 | if (r) | ||
| 1803 | DRM_ERROR("amdgpu_resume failed (%d).\n", r); | ||
| 1801 | 1804 | ||
| 1802 | amdgpu_fence_driver_resume(adev); | 1805 | amdgpu_fence_driver_resume(adev); |
| 1803 | 1806 | ||
| 1804 | r = amdgpu_ib_ring_tests(adev); | 1807 | if (resume) { |
| 1805 | if (r) | 1808 | r = amdgpu_ib_ring_tests(adev); |
| 1806 | DRM_ERROR("ib ring test failed (%d).\n", r); | 1809 | if (r) |
| 1810 | DRM_ERROR("ib ring test failed (%d).\n", r); | ||
| 1811 | } | ||
| 1807 | 1812 | ||
| 1808 | r = amdgpu_late_init(adev); | 1813 | r = amdgpu_late_init(adev); |
| 1809 | if (r) | 1814 | if (r) |
| @@ -1933,80 +1938,97 @@ retry: | |||
| 1933 | return r; | 1938 | return r; |
| 1934 | } | 1939 | } |
| 1935 | 1940 | ||
| 1941 | #define AMDGPU_DEFAULT_PCIE_GEN_MASK 0x30007 /* gen: chipset 1/2, asic 1/2/3 */ | ||
| 1942 | #define AMDGPU_DEFAULT_PCIE_MLW_MASK 0x2f0000 /* 1/2/4/8/16 lanes */ | ||
| 1943 | |||
| 1936 | void amdgpu_get_pcie_info(struct amdgpu_device *adev) | 1944 | void amdgpu_get_pcie_info(struct amdgpu_device *adev) |
| 1937 | { | 1945 | { |
| 1938 | u32 mask; | 1946 | u32 mask; |
| 1939 | int ret; | 1947 | int ret; |
| 1940 | 1948 | ||
| 1941 | if (pci_is_root_bus(adev->pdev->bus)) | 1949 | if (amdgpu_pcie_gen_cap) |
| 1942 | return; | 1950 | adev->pm.pcie_gen_mask = amdgpu_pcie_gen_cap; |
| 1943 | 1951 | ||
| 1944 | if (amdgpu_pcie_gen2 == 0) | 1952 | if (amdgpu_pcie_lane_cap) |
| 1945 | return; | 1953 | adev->pm.pcie_mlw_mask = amdgpu_pcie_lane_cap; |
| 1946 | 1954 | ||
| 1947 | if (adev->flags & AMD_IS_APU) | 1955 | /* covers APUs as well */ |
| 1956 | if (pci_is_root_bus(adev->pdev->bus)) { | ||
| 1957 | if (adev->pm.pcie_gen_mask == 0) | ||
| 1958 | adev->pm.pcie_gen_mask = AMDGPU_DEFAULT_PCIE_GEN_MASK; | ||
| 1959 | if (adev->pm.pcie_mlw_mask == 0) | ||
| 1960 | adev->pm.pcie_mlw_mask = AMDGPU_DEFAULT_PCIE_MLW_MASK; | ||
| 1948 | return; | 1961 | return; |
| 1962 | } | ||
| 1949 | 1963 | ||
| 1950 | ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask); | 1964 | if (adev->pm.pcie_gen_mask == 0) { |
| 1951 | if (!ret) { | 1965 | ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask); |
| 1952 | adev->pm.pcie_gen_mask = (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | | 1966 | if (!ret) { |
| 1953 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 | | 1967 | adev->pm.pcie_gen_mask = (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | |
| 1954 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3); | 1968 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 | |
| 1955 | 1969 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3); | |
| 1956 | if (mask & DRM_PCIE_SPEED_25) | 1970 | |
| 1957 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1; | 1971 | if (mask & DRM_PCIE_SPEED_25) |
| 1958 | if (mask & DRM_PCIE_SPEED_50) | 1972 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1; |
| 1959 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2; | 1973 | if (mask & DRM_PCIE_SPEED_50) |
| 1960 | if (mask & DRM_PCIE_SPEED_80) | 1974 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2; |
| 1961 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3; | 1975 | if (mask & DRM_PCIE_SPEED_80) |
| 1962 | } | 1976 | adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3; |
| 1963 | ret = drm_pcie_get_max_link_width(adev->ddev, &mask); | 1977 | } else { |
| 1964 | if (!ret) { | 1978 | adev->pm.pcie_gen_mask = AMDGPU_DEFAULT_PCIE_GEN_MASK; |
| 1965 | switch (mask) { | 1979 | } |
| 1966 | case 32: | 1980 | } |
| 1967 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X32 | | 1981 | if (adev->pm.pcie_mlw_mask == 0) { |
| 1968 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 | | 1982 | ret = drm_pcie_get_max_link_width(adev->ddev, &mask); |
| 1969 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | | 1983 | if (!ret) { |
| 1970 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | | 1984 | switch (mask) { |
| 1971 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | | 1985 | case 32: |
| 1972 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 1986 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X32 | |
| 1973 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 1987 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 | |
| 1974 | break; | 1988 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | |
| 1975 | case 16: | 1989 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | |
| 1976 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 | | 1990 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | |
| 1977 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | | 1991 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 1978 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | | 1992 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 1979 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | | 1993 | break; |
| 1980 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 1994 | case 16: |
| 1981 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 1995 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X16 | |
| 1982 | break; | 1996 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | |
| 1983 | case 12: | 1997 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | |
| 1984 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | | 1998 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | |
| 1985 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | | 1999 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 1986 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | | 2000 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 1987 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 2001 | break; |
| 1988 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 2002 | case 12: |
| 1989 | break; | 2003 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X12 | |
| 1990 | case 8: | 2004 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | |
| 1991 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | | 2005 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | |
| 1992 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | | 2006 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 1993 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 2007 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 1994 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 2008 | break; |
| 1995 | break; | 2009 | case 8: |
| 1996 | case 4: | 2010 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 | |
| 1997 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | | 2011 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | |
| 1998 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 2012 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 1999 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 2013 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 2000 | break; | 2014 | break; |
| 2001 | case 2: | 2015 | case 4: |
| 2002 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | | 2016 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 | |
| 2003 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); | 2017 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 2004 | break; | 2018 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 2005 | case 1: | 2019 | break; |
| 2006 | adev->pm.pcie_mlw_mask = CAIL_PCIE_LINK_WIDTH_SUPPORT_X1; | 2020 | case 2: |
| 2007 | break; | 2021 | adev->pm.pcie_mlw_mask = (CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 | |
| 2008 | default: | 2022 | CAIL_PCIE_LINK_WIDTH_SUPPORT_X1); |
| 2009 | break; | 2023 | break; |
| 2024 | case 1: | ||
| 2025 | adev->pm.pcie_mlw_mask = CAIL_PCIE_LINK_WIDTH_SUPPORT_X1; | ||
| 2026 | break; | ||
| 2027 | default: | ||
| 2028 | break; | ||
| 2029 | } | ||
| 2030 | } else { | ||
| 2031 | adev->pm.pcie_mlw_mask = AMDGPU_DEFAULT_PCIE_MLW_MASK; | ||
| 2010 | } | 2032 | } |
| 2011 | } | 2033 | } |
| 2012 | } | 2034 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 9c1af8976bef..9ef1db87cf26 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
| @@ -83,6 +83,8 @@ int amdgpu_sched_jobs = 32; | |||
| 83 | int amdgpu_sched_hw_submission = 2; | 83 | int amdgpu_sched_hw_submission = 2; |
| 84 | int amdgpu_enable_semaphores = 0; | 84 | int amdgpu_enable_semaphores = 0; |
| 85 | int amdgpu_powerplay = -1; | 85 | int amdgpu_powerplay = -1; |
| 86 | unsigned amdgpu_pcie_gen_cap = 0; | ||
| 87 | unsigned amdgpu_pcie_lane_cap = 0; | ||
| 86 | 88 | ||
| 87 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); | 89 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
| 88 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); | 90 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); |
| @@ -170,6 +172,12 @@ MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable, -1 = | |||
| 170 | module_param_named(powerplay, amdgpu_powerplay, int, 0444); | 172 | module_param_named(powerplay, amdgpu_powerplay, int, 0444); |
| 171 | #endif | 173 | #endif |
| 172 | 174 | ||
| 175 | MODULE_PARM_DESC(pcie_gen_cap, "PCIE Gen Caps (0: autodetect (default))"); | ||
| 176 | module_param_named(pcie_gen_cap, amdgpu_pcie_gen_cap, uint, 0444); | ||
| 177 | |||
| 178 | MODULE_PARM_DESC(pcie_lane_cap, "PCIE Lane Caps (0: autodetect (default))"); | ||
| 179 | module_param_named(pcie_lane_cap, amdgpu_pcie_lane_cap, uint, 0444); | ||
| 180 | |||
| 173 | static struct pci_device_id pciidlist[] = { | 181 | static struct pci_device_id pciidlist[] = { |
| 174 | #ifdef CONFIG_DRM_AMDGPU_CIK | 182 | #ifdef CONFIG_DRM_AMDGPU_CIK |
| 175 | /* Kaveri */ | 183 | /* Kaveri */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c index b1969f2b2038..d4e2780c0796 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | |||
| @@ -142,7 +142,8 @@ static void amdgpu_mn_invalidate_range_start(struct mmu_notifier *mn, | |||
| 142 | 142 | ||
| 143 | list_for_each_entry(bo, &node->bos, mn_list) { | 143 | list_for_each_entry(bo, &node->bos, mn_list) { |
| 144 | 144 | ||
| 145 | if (!bo->tbo.ttm || bo->tbo.ttm->state != tt_bound) | 145 | if (!amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm, start, |
| 146 | end)) | ||
| 146 | continue; | 147 | continue; |
| 147 | 148 | ||
| 148 | r = amdgpu_bo_reserve(bo, true); | 149 | r = amdgpu_bo_reserve(bo, true); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index 8b88edb0434b..ca72a2e487b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | |||
| @@ -354,12 +354,15 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, | |||
| 354 | 354 | ||
| 355 | for (i = 0, count = 0; i < AMDGPU_MAX_RINGS; ++i) | 355 | for (i = 0, count = 0; i < AMDGPU_MAX_RINGS; ++i) |
| 356 | if (fences[i]) | 356 | if (fences[i]) |
| 357 | fences[count++] = fences[i]; | 357 | fences[count++] = fence_get(fences[i]); |
| 358 | 358 | ||
| 359 | if (count) { | 359 | if (count) { |
| 360 | spin_unlock(&sa_manager->wq.lock); | 360 | spin_unlock(&sa_manager->wq.lock); |
| 361 | t = fence_wait_any_timeout(fences, count, false, | 361 | t = fence_wait_any_timeout(fences, count, false, |
| 362 | MAX_SCHEDULE_TIMEOUT); | 362 | MAX_SCHEDULE_TIMEOUT); |
| 363 | for (i = 0; i < count; ++i) | ||
| 364 | fence_put(fences[i]); | ||
| 365 | |||
| 363 | r = (t > 0) ? 0 : t; | 366 | r = (t > 0) ? 0 : t; |
| 364 | spin_lock(&sa_manager->wq.lock); | 367 | spin_lock(&sa_manager->wq.lock); |
| 365 | } else { | 368 | } else { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 55cf05e1c81c..6442a06d6fdc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
| @@ -783,6 +783,25 @@ bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm) | |||
| 783 | return !!gtt->userptr; | 783 | return !!gtt->userptr; |
| 784 | } | 784 | } |
| 785 | 785 | ||
| 786 | bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, | ||
| 787 | unsigned long end) | ||
| 788 | { | ||
| 789 | struct amdgpu_ttm_tt *gtt = (void *)ttm; | ||
| 790 | unsigned long size; | ||
| 791 | |||
| 792 | if (gtt == NULL) | ||
| 793 | return false; | ||
| 794 | |||
| 795 | if (gtt->ttm.ttm.state != tt_bound || !gtt->userptr) | ||
| 796 | return false; | ||
| 797 | |||
| 798 | size = (unsigned long)gtt->ttm.ttm.num_pages * PAGE_SIZE; | ||
| 799 | if (gtt->userptr > end || gtt->userptr + size <= start) | ||
| 800 | return false; | ||
| 801 | |||
| 802 | return true; | ||
| 803 | } | ||
| 804 | |||
| 786 | bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm) | 805 | bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm) |
| 787 | { | 806 | { |
| 788 | struct amdgpu_ttm_tt *gtt = (void *)ttm; | 807 | struct amdgpu_ttm_tt *gtt = (void *)ttm; |
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c index 8b4731d4e10e..474ca02b0949 100644 --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include "ci_dpm.h" | 31 | #include "ci_dpm.h" |
| 32 | #include "gfx_v7_0.h" | 32 | #include "gfx_v7_0.h" |
| 33 | #include "atom.h" | 33 | #include "atom.h" |
| 34 | #include "amd_pcie.h" | ||
| 34 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
| 35 | 36 | ||
| 36 | #include "smu/smu_7_0_1_d.h" | 37 | #include "smu/smu_7_0_1_d.h" |
| @@ -5835,18 +5836,16 @@ static int ci_dpm_init(struct amdgpu_device *adev) | |||
| 5835 | u8 frev, crev; | 5836 | u8 frev, crev; |
| 5836 | struct ci_power_info *pi; | 5837 | struct ci_power_info *pi; |
| 5837 | int ret; | 5838 | int ret; |
| 5838 | u32 mask; | ||
| 5839 | 5839 | ||
| 5840 | pi = kzalloc(sizeof(struct ci_power_info), GFP_KERNEL); | 5840 | pi = kzalloc(sizeof(struct ci_power_info), GFP_KERNEL); |
| 5841 | if (pi == NULL) | 5841 | if (pi == NULL) |
| 5842 | return -ENOMEM; | 5842 | return -ENOMEM; |
| 5843 | adev->pm.dpm.priv = pi; | 5843 | adev->pm.dpm.priv = pi; |
| 5844 | 5844 | ||
| 5845 | ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask); | 5845 | pi->sys_pcie_mask = |
| 5846 | if (ret) | 5846 | (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_MASK) >> |
| 5847 | pi->sys_pcie_mask = 0; | 5847 | CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT; |
| 5848 | else | 5848 | |
| 5849 | pi->sys_pcie_mask = mask; | ||
| 5850 | pi->force_pcie_gen = AMDGPU_PCIE_GEN_INVALID; | 5849 | pi->force_pcie_gen = AMDGPU_PCIE_GEN_INVALID; |
| 5851 | 5850 | ||
| 5852 | pi->pcie_gen_performance.max = AMDGPU_PCIE_GEN1; | 5851 | pi->pcie_gen_performance.max = AMDGPU_PCIE_GEN1; |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index fd9c9588ef46..155965ed14a3 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
| @@ -1762,6 +1762,9 @@ static void cik_program_aspm(struct amdgpu_device *adev) | |||
| 1762 | if (amdgpu_aspm == 0) | 1762 | if (amdgpu_aspm == 0) |
| 1763 | return; | 1763 | return; |
| 1764 | 1764 | ||
| 1765 | if (pci_is_root_bus(adev->pdev->bus)) | ||
| 1766 | return; | ||
| 1767 | |||
| 1765 | /* XXX double check APUs */ | 1768 | /* XXX double check APUs */ |
| 1766 | if (adev->flags & AMD_IS_APU) | 1769 | if (adev->flags & AMD_IS_APU) |
| 1767 | return; | 1770 | return; |
| @@ -2332,72 +2335,72 @@ static int cik_common_early_init(void *handle) | |||
| 2332 | switch (adev->asic_type) { | 2335 | switch (adev->asic_type) { |
| 2333 | case CHIP_BONAIRE: | 2336 | case CHIP_BONAIRE: |
| 2334 | adev->cg_flags = | 2337 | adev->cg_flags = |
| 2335 | AMDGPU_CG_SUPPORT_GFX_MGCG | | 2338 | AMD_CG_SUPPORT_GFX_MGCG | |
| 2336 | AMDGPU_CG_SUPPORT_GFX_MGLS | | 2339 | AMD_CG_SUPPORT_GFX_MGLS | |
| 2337 | /*AMDGPU_CG_SUPPORT_GFX_CGCG |*/ | 2340 | /*AMD_CG_SUPPORT_GFX_CGCG |*/ |
| 2338 | AMDGPU_CG_SUPPORT_GFX_CGLS | | 2341 | AMD_CG_SUPPORT_GFX_CGLS | |
| 2339 | AMDGPU_CG_SUPPORT_GFX_CGTS | | 2342 | AMD_CG_SUPPORT_GFX_CGTS | |
| 2340 | AMDGPU_CG_SUPPORT_GFX_CGTS_LS | | 2343 | AMD_CG_SUPPORT_GFX_CGTS_LS | |
| 2341 | AMDGPU_CG_SUPPORT_GFX_CP_LS | | 2344 | AMD_CG_SUPPORT_GFX_CP_LS | |
| 2342 | AMDGPU_CG_SUPPORT_MC_LS | | 2345 | AMD_CG_SUPPORT_MC_LS | |
| 2343 | AMDGPU_CG_SUPPORT_MC_MGCG | | 2346 | AMD_CG_SUPPORT_MC_MGCG | |
| 2344 | AMDGPU_CG_SUPPORT_SDMA_MGCG | | 2347 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 2345 | AMDGPU_CG_SUPPORT_SDMA_LS | | 2348 | AMD_CG_SUPPORT_SDMA_LS | |
| 2346 | AMDGPU_CG_SUPPORT_BIF_LS | | 2349 | AMD_CG_SUPPORT_BIF_LS | |
| 2347 | AMDGPU_CG_SUPPORT_VCE_MGCG | | 2350 | AMD_CG_SUPPORT_VCE_MGCG | |
| 2348 | AMDGPU_CG_SUPPORT_UVD_MGCG | | 2351 | AMD_CG_SUPPORT_UVD_MGCG | |
| 2349 | AMDGPU_CG_SUPPORT_HDP_LS | | 2352 | AMD_CG_SUPPORT_HDP_LS | |
| 2350 | AMDGPU_CG_SUPPORT_HDP_MGCG; | 2353 | AMD_CG_SUPPORT_HDP_MGCG; |
| 2351 | adev->pg_flags = 0; | 2354 | adev->pg_flags = 0; |
| 2352 | adev->external_rev_id = adev->rev_id + 0x14; | 2355 | adev->external_rev_id = adev->rev_id + 0x14; |
| 2353 | break; | 2356 | break; |
| 2354 | case CHIP_HAWAII: | 2357 | case CHIP_HAWAII: |
| 2355 | adev->cg_flags = | 2358 | adev->cg_flags = |
| 2356 | AMDGPU_CG_SUPPORT_GFX_MGCG | | 2359 | AMD_CG_SUPPORT_GFX_MGCG | |
| 2357 | AMDGPU_CG_SUPPORT_GFX_MGLS | | 2360 | AMD_CG_SUPPORT_GFX_MGLS | |
| 2358 | /*AMDGPU_CG_SUPPORT_GFX_CGCG |*/ | 2361 | /*AMD_CG_SUPPORT_GFX_CGCG |*/ |
| 2359 | AMDGPU_CG_SUPPORT_GFX_CGLS | | 2362 | AMD_CG_SUPPORT_GFX_CGLS | |
| 2360 | AMDGPU_CG_SUPPORT_GFX_CGTS | | 2363 | AMD_CG_SUPPORT_GFX_CGTS | |
| 2361 | AMDGPU_CG_SUPPORT_GFX_CP_LS | | 2364 | AMD_CG_SUPPORT_GFX_CP_LS | |
| 2362 | AMDGPU_CG_SUPPORT_MC_LS | | 2365 | AMD_CG_SUPPORT_MC_LS | |
| 2363 | AMDGPU_CG_SUPPORT_MC_MGCG | | 2366 | AMD_CG_SUPPORT_MC_MGCG | |
| 2364 | AMDGPU_CG_SUPPORT_SDMA_MGCG | | 2367 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 2365 | AMDGPU_CG_SUPPORT_SDMA_LS | | 2368 | AMD_CG_SUPPORT_SDMA_LS | |
| 2366 | AMDGPU_CG_SUPPORT_BIF_LS | | 2369 | AMD_CG_SUPPORT_BIF_LS | |
| 2367 | AMDGPU_CG_SUPPORT_VCE_MGCG | | 2370 | AMD_CG_SUPPORT_VCE_MGCG | |
| 2368 | AMDGPU_CG_SUPPORT_UVD_MGCG | | 2371 | AMD_CG_SUPPORT_UVD_MGCG | |
| 2369 | AMDGPU_CG_SUPPORT_HDP_LS | | 2372 | AMD_CG_SUPPORT_HDP_LS | |
| 2370 | AMDGPU_CG_SUPPORT_HDP_MGCG; | 2373 | AMD_CG_SUPPORT_HDP_MGCG; |
| 2371 | adev->pg_flags = 0; | 2374 | adev->pg_flags = 0; |
| 2372 | adev->external_rev_id = 0x28; | 2375 | adev->external_rev_id = 0x28; |
| 2373 | break; | 2376 | break; |
| 2374 | case CHIP_KAVERI: | 2377 | case CHIP_KAVERI: |
| 2375 | adev->cg_flags = | 2378 | adev->cg_flags = |
| 2376 | AMDGPU_CG_SUPPORT_GFX_MGCG | | 2379 | AMD_CG_SUPPORT_GFX_MGCG | |
| 2377 | AMDGPU_CG_SUPPORT_GFX_MGLS | | 2380 | AMD_CG_SUPPORT_GFX_MGLS | |
| 2378 | /*AMDGPU_CG_SUPPORT_GFX_CGCG |*/ | 2381 | /*AMD_CG_SUPPORT_GFX_CGCG |*/ |
| 2379 | AMDGPU_CG_SUPPORT_GFX_CGLS | | 2382 | AMD_CG_SUPPORT_GFX_CGLS | |
| 2380 | AMDGPU_CG_SUPPORT_GFX_CGTS | | 2383 | AMD_CG_SUPPORT_GFX_CGTS | |
| 2381 | AMDGPU_CG_SUPPORT_GFX_CGTS_LS | | 2384 | AMD_CG_SUPPORT_GFX_CGTS_LS | |
| 2382 | AMDGPU_CG_SUPPORT_GFX_CP_LS | | 2385 | AMD_CG_SUPPORT_GFX_CP_LS | |
| 2383 | AMDGPU_CG_SUPPORT_SDMA_MGCG | | 2386 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 2384 | AMDGPU_CG_SUPPORT_SDMA_LS | | 2387 | AMD_CG_SUPPORT_SDMA_LS | |
| 2385 | AMDGPU_CG_SUPPORT_BIF_LS | | 2388 | AMD_CG_SUPPORT_BIF_LS | |
| 2386 | AMDGPU_CG_SUPPORT_VCE_MGCG | | 2389 | AMD_CG_SUPPORT_VCE_MGCG | |
| 2387 | AMDGPU_CG_SUPPORT_UVD_MGCG | | 2390 | AMD_CG_SUPPORT_UVD_MGCG | |
| 2388 | AMDGPU_CG_SUPPORT_HDP_LS | | 2391 | AMD_CG_SUPPORT_HDP_LS | |
| 2389 | AMDGPU_CG_SUPPORT_HDP_MGCG; | 2392 | AMD_CG_SUPPORT_HDP_MGCG; |
| 2390 | adev->pg_flags = | 2393 | adev->pg_flags = |
| 2391 | /*AMDGPU_PG_SUPPORT_GFX_PG | | 2394 | /*AMD_PG_SUPPORT_GFX_PG | |
| 2392 | AMDGPU_PG_SUPPORT_GFX_SMG | | 2395 | AMD_PG_SUPPORT_GFX_SMG | |
| 2393 | AMDGPU_PG_SUPPORT_GFX_DMG |*/ | 2396 | AMD_PG_SUPPORT_GFX_DMG |*/ |
| 2394 | AMDGPU_PG_SUPPORT_UVD | | 2397 | AMD_PG_SUPPORT_UVD | |
| 2395 | /*AMDGPU_PG_SUPPORT_VCE | | 2398 | /*AMD_PG_SUPPORT_VCE | |
| 2396 | AMDGPU_PG_SUPPORT_CP | | 2399 | AMD_PG_SUPPORT_CP | |
| 2397 | AMDGPU_PG_SUPPORT_GDS | | 2400 | AMD_PG_SUPPORT_GDS | |
| 2398 | AMDGPU_PG_SUPPORT_RLC_SMU_HS | | 2401 | AMD_PG_SUPPORT_RLC_SMU_HS | |
| 2399 | AMDGPU_PG_SUPPORT_ACP | | 2402 | AMD_PG_SUPPORT_ACP | |
| 2400 | AMDGPU_PG_SUPPORT_SAMU |*/ | 2403 | AMD_PG_SUPPORT_SAMU |*/ |
| 2401 | 0; | 2404 | 0; |
| 2402 | if (adev->pdev->device == 0x1312 || | 2405 | if (adev->pdev->device == 0x1312 || |
| 2403 | adev->pdev->device == 0x1316 || | 2406 | adev->pdev->device == 0x1316 || |
| @@ -2409,29 +2412,29 @@ static int cik_common_early_init(void *handle) | |||
| 2409 | case CHIP_KABINI: | 2412 | case CHIP_KABINI: |
| 2410 | case CHIP_MULLINS: | 2413 | case CHIP_MULLINS: |
| 2411 | adev->cg_flags = | 2414 | adev->cg_flags = |
| 2412 | AMDGPU_CG_SUPPORT_GFX_MGCG | | 2415 | AMD_CG_SUPPORT_GFX_MGCG | |
| 2413 | AMDGPU_CG_SUPPORT_GFX_MGLS | | 2416 | AMD_CG_SUPPORT_GFX_MGLS | |
| 2414 | /*AMDGPU_CG_SUPPORT_GFX_CGCG |*/ | 2417 | /*AMD_CG_SUPPORT_GFX_CGCG |*/ |
| 2415 | AMDGPU_CG_SUPPORT_GFX_CGLS | | 2418 | AMD_CG_SUPPORT_GFX_CGLS | |
| 2416 | AMDGPU_CG_SUPPORT_GFX_CGTS | | 2419 | AMD_CG_SUPPORT_GFX_CGTS | |
| 2417 | AMDGPU_CG_SUPPORT_GFX_CGTS_LS | | 2420 | AMD_CG_SUPPORT_GFX_CGTS_LS | |
| 2418 | AMDGPU_CG_SUPPORT_GFX_CP_LS | | 2421 | AMD_CG_SUPPORT_GFX_CP_LS | |
| 2419 | AMDGPU_CG_SUPPORT_SDMA_MGCG | | 2422 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 2420 | AMDGPU_CG_SUPPORT_SDMA_LS | | 2423 | AMD_CG_SUPPORT_SDMA_LS | |
| 2421 | AMDGPU_CG_SUPPORT_BIF_LS | | 2424 | AMD_CG_SUPPORT_BIF_LS | |
| 2422 | AMDGPU_CG_SUPPORT_VCE_MGCG | | 2425 | AMD_CG_SUPPORT_VCE_MGCG | |
| 2423 | AMDGPU_CG_SUPPORT_UVD_MGCG | | 2426 | AMD_CG_SUPPORT_UVD_MGCG | |
| 2424 | AMDGPU_CG_SUPPORT_HDP_LS | | 2427 | AMD_CG_SUPPORT_HDP_LS | |
| 2425 | AMDGPU_CG_SUPPORT_HDP_MGCG; | 2428 | AMD_CG_SUPPORT_HDP_MGCG; |
| 2426 | adev->pg_flags = | 2429 | adev->pg_flags = |
| 2427 | /*AMDGPU_PG_SUPPORT_GFX_PG | | 2430 | /*AMD_PG_SUPPORT_GFX_PG | |
| 2428 | AMDGPU_PG_SUPPORT_GFX_SMG | */ | 2431 | AMD_PG_SUPPORT_GFX_SMG | */ |
| 2429 | AMDGPU_PG_SUPPORT_UVD | | 2432 | AMD_PG_SUPPORT_UVD | |
| 2430 | /*AMDGPU_PG_SUPPORT_VCE | | 2433 | /*AMD_PG_SUPPORT_VCE | |
| 2431 | AMDGPU_PG_SUPPORT_CP | | 2434 | AMD_PG_SUPPORT_CP | |
| 2432 | AMDGPU_PG_SUPPORT_GDS | | 2435 | AMD_PG_SUPPORT_GDS | |
| 2433 | AMDGPU_PG_SUPPORT_RLC_SMU_HS | | 2436 | AMD_PG_SUPPORT_RLC_SMU_HS | |
| 2434 | AMDGPU_PG_SUPPORT_SAMU |*/ | 2437 | AMD_PG_SUPPORT_SAMU |*/ |
| 2435 | 0; | 2438 | 0; |
| 2436 | if (adev->asic_type == CHIP_KABINI) { | 2439 | if (adev->asic_type == CHIP_KABINI) { |
| 2437 | if (adev->rev_id == 0) | 2440 | if (adev->rev_id == 0) |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index 5f712ceddf08..c55ecf0ea845 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |||
| @@ -885,7 +885,7 @@ static void cik_enable_sdma_mgcg(struct amdgpu_device *adev, | |||
| 885 | { | 885 | { |
| 886 | u32 orig, data; | 886 | u32 orig, data; |
| 887 | 887 | ||
| 888 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_SDMA_MGCG)) { | 888 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) { |
| 889 | WREG32(mmSDMA0_CLK_CTRL + SDMA0_REGISTER_OFFSET, 0x00000100); | 889 | WREG32(mmSDMA0_CLK_CTRL + SDMA0_REGISTER_OFFSET, 0x00000100); |
| 890 | WREG32(mmSDMA0_CLK_CTRL + SDMA1_REGISTER_OFFSET, 0x00000100); | 890 | WREG32(mmSDMA0_CLK_CTRL + SDMA1_REGISTER_OFFSET, 0x00000100); |
| 891 | } else { | 891 | } else { |
| @@ -906,7 +906,7 @@ static void cik_enable_sdma_mgls(struct amdgpu_device *adev, | |||
| 906 | { | 906 | { |
| 907 | u32 orig, data; | 907 | u32 orig, data; |
| 908 | 908 | ||
| 909 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_SDMA_LS)) { | 909 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_LS)) { |
| 910 | orig = data = RREG32(mmSDMA0_POWER_CNTL + SDMA0_REGISTER_OFFSET); | 910 | orig = data = RREG32(mmSDMA0_POWER_CNTL + SDMA0_REGISTER_OFFSET); |
| 911 | data |= 0x100; | 911 | data |= 0x100; |
| 912 | if (orig != data) | 912 | if (orig != data) |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c index 4dd17f2dd905..9056355309d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c | |||
| @@ -445,13 +445,13 @@ static int cz_dpm_init(struct amdgpu_device *adev) | |||
| 445 | pi->gfx_pg_threshold = 500; | 445 | pi->gfx_pg_threshold = 500; |
| 446 | pi->caps_fps = true; | 446 | pi->caps_fps = true; |
| 447 | /* uvd */ | 447 | /* uvd */ |
| 448 | pi->caps_uvd_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_UVD) ? true : false; | 448 | pi->caps_uvd_pg = (adev->pg_flags & AMD_PG_SUPPORT_UVD) ? true : false; |
| 449 | pi->caps_uvd_dpm = true; | 449 | pi->caps_uvd_dpm = true; |
| 450 | /* vce */ | 450 | /* vce */ |
| 451 | pi->caps_vce_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_VCE) ? true : false; | 451 | pi->caps_vce_pg = (adev->pg_flags & AMD_PG_SUPPORT_VCE) ? true : false; |
| 452 | pi->caps_vce_dpm = true; | 452 | pi->caps_vce_dpm = true; |
| 453 | /* acp */ | 453 | /* acp */ |
| 454 | pi->caps_acp_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_ACP) ? true : false; | 454 | pi->caps_acp_pg = (adev->pg_flags & AMD_PG_SUPPORT_ACP) ? true : false; |
| 455 | pi->caps_acp_dpm = true; | 455 | pi->caps_acp_dpm = true; |
| 456 | 456 | ||
| 457 | pi->caps_stable_power_state = false; | 457 | pi->caps_stable_power_state = false; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 6c76139de1c9..7732059ae30f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
| @@ -4109,7 +4109,7 @@ static void gfx_v7_0_enable_cgcg(struct amdgpu_device *adev, bool enable) | |||
| 4109 | 4109 | ||
| 4110 | orig = data = RREG32(mmRLC_CGCG_CGLS_CTRL); | 4110 | orig = data = RREG32(mmRLC_CGCG_CGLS_CTRL); |
| 4111 | 4111 | ||
| 4112 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_CGCG)) { | 4112 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGCG)) { |
| 4113 | gfx_v7_0_enable_gui_idle_interrupt(adev, true); | 4113 | gfx_v7_0_enable_gui_idle_interrupt(adev, true); |
| 4114 | 4114 | ||
| 4115 | tmp = gfx_v7_0_halt_rlc(adev); | 4115 | tmp = gfx_v7_0_halt_rlc(adev); |
| @@ -4147,9 +4147,9 @@ static void gfx_v7_0_enable_mgcg(struct amdgpu_device *adev, bool enable) | |||
| 4147 | { | 4147 | { |
| 4148 | u32 data, orig, tmp = 0; | 4148 | u32 data, orig, tmp = 0; |
| 4149 | 4149 | ||
| 4150 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_MGCG)) { | 4150 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGCG)) { |
| 4151 | if (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_MGLS) { | 4151 | if (adev->cg_flags & AMD_CG_SUPPORT_GFX_MGLS) { |
| 4152 | if (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_CP_LS) { | 4152 | if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CP_LS) { |
| 4153 | orig = data = RREG32(mmCP_MEM_SLP_CNTL); | 4153 | orig = data = RREG32(mmCP_MEM_SLP_CNTL); |
| 4154 | data |= CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK; | 4154 | data |= CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK; |
| 4155 | if (orig != data) | 4155 | if (orig != data) |
| @@ -4176,14 +4176,14 @@ static void gfx_v7_0_enable_mgcg(struct amdgpu_device *adev, bool enable) | |||
| 4176 | 4176 | ||
| 4177 | gfx_v7_0_update_rlc(adev, tmp); | 4177 | gfx_v7_0_update_rlc(adev, tmp); |
| 4178 | 4178 | ||
| 4179 | if (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_CGTS) { | 4179 | if (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGTS) { |
| 4180 | orig = data = RREG32(mmCGTS_SM_CTRL_REG); | 4180 | orig = data = RREG32(mmCGTS_SM_CTRL_REG); |
| 4181 | data &= ~CGTS_SM_CTRL_REG__SM_MODE_MASK; | 4181 | data &= ~CGTS_SM_CTRL_REG__SM_MODE_MASK; |
| 4182 | data |= (0x2 << CGTS_SM_CTRL_REG__SM_MODE__SHIFT); | 4182 | data |= (0x2 << CGTS_SM_CTRL_REG__SM_MODE__SHIFT); |
| 4183 | data |= CGTS_SM_CTRL_REG__SM_MODE_ENABLE_MASK; | 4183 | data |= CGTS_SM_CTRL_REG__SM_MODE_ENABLE_MASK; |
| 4184 | data &= ~CGTS_SM_CTRL_REG__OVERRIDE_MASK; | 4184 | data &= ~CGTS_SM_CTRL_REG__OVERRIDE_MASK; |
| 4185 | if ((adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_MGLS) && | 4185 | if ((adev->cg_flags & AMD_CG_SUPPORT_GFX_MGLS) && |
| 4186 | (adev->cg_flags & AMDGPU_CG_SUPPORT_GFX_CGTS_LS)) | 4186 | (adev->cg_flags & AMD_CG_SUPPORT_GFX_CGTS_LS)) |
| 4187 | data &= ~CGTS_SM_CTRL_REG__LS_OVERRIDE_MASK; | 4187 | data &= ~CGTS_SM_CTRL_REG__LS_OVERRIDE_MASK; |
| 4188 | data &= ~CGTS_SM_CTRL_REG__ON_MONITOR_ADD_MASK; | 4188 | data &= ~CGTS_SM_CTRL_REG__ON_MONITOR_ADD_MASK; |
| 4189 | data |= CGTS_SM_CTRL_REG__ON_MONITOR_ADD_EN_MASK; | 4189 | data |= CGTS_SM_CTRL_REG__ON_MONITOR_ADD_EN_MASK; |
| @@ -4249,7 +4249,7 @@ static void gfx_v7_0_enable_sclk_slowdown_on_pu(struct amdgpu_device *adev, | |||
| 4249 | u32 data, orig; | 4249 | u32 data, orig; |
| 4250 | 4250 | ||
| 4251 | orig = data = RREG32(mmRLC_PG_CNTL); | 4251 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4252 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_RLC_SMU_HS)) | 4252 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS)) |
| 4253 | data |= RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PU_ENABLE_MASK; | 4253 | data |= RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PU_ENABLE_MASK; |
| 4254 | else | 4254 | else |
| 4255 | data &= ~RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PU_ENABLE_MASK; | 4255 | data &= ~RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PU_ENABLE_MASK; |
| @@ -4263,7 +4263,7 @@ static void gfx_v7_0_enable_sclk_slowdown_on_pd(struct amdgpu_device *adev, | |||
| 4263 | u32 data, orig; | 4263 | u32 data, orig; |
| 4264 | 4264 | ||
| 4265 | orig = data = RREG32(mmRLC_PG_CNTL); | 4265 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4266 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_RLC_SMU_HS)) | 4266 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS)) |
| 4267 | data |= RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PD_ENABLE_MASK; | 4267 | data |= RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PD_ENABLE_MASK; |
| 4268 | else | 4268 | else |
| 4269 | data &= ~RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PD_ENABLE_MASK; | 4269 | data &= ~RLC_PG_CNTL__SMU_CLK_SLOWDOWN_ON_PD_ENABLE_MASK; |
| @@ -4276,7 +4276,7 @@ static void gfx_v7_0_enable_cp_pg(struct amdgpu_device *adev, bool enable) | |||
| 4276 | u32 data, orig; | 4276 | u32 data, orig; |
| 4277 | 4277 | ||
| 4278 | orig = data = RREG32(mmRLC_PG_CNTL); | 4278 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4279 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_CP)) | 4279 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_CP)) |
| 4280 | data &= ~0x8000; | 4280 | data &= ~0x8000; |
| 4281 | else | 4281 | else |
| 4282 | data |= 0x8000; | 4282 | data |= 0x8000; |
| @@ -4289,7 +4289,7 @@ static void gfx_v7_0_enable_gds_pg(struct amdgpu_device *adev, bool enable) | |||
| 4289 | u32 data, orig; | 4289 | u32 data, orig; |
| 4290 | 4290 | ||
| 4291 | orig = data = RREG32(mmRLC_PG_CNTL); | 4291 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4292 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_GDS)) | 4292 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GDS)) |
| 4293 | data &= ~0x2000; | 4293 | data &= ~0x2000; |
| 4294 | else | 4294 | else |
| 4295 | data |= 0x2000; | 4295 | data |= 0x2000; |
| @@ -4370,7 +4370,7 @@ static void gfx_v7_0_enable_gfx_cgpg(struct amdgpu_device *adev, | |||
| 4370 | { | 4370 | { |
| 4371 | u32 data, orig; | 4371 | u32 data, orig; |
| 4372 | 4372 | ||
| 4373 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_PG)) { | 4373 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) { |
| 4374 | orig = data = RREG32(mmRLC_PG_CNTL); | 4374 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4375 | data |= RLC_PG_CNTL__GFX_POWER_GATING_ENABLE_MASK; | 4375 | data |= RLC_PG_CNTL__GFX_POWER_GATING_ENABLE_MASK; |
| 4376 | if (orig != data) | 4376 | if (orig != data) |
| @@ -4442,7 +4442,7 @@ static void gfx_v7_0_enable_gfx_static_mgpg(struct amdgpu_device *adev, | |||
| 4442 | u32 data, orig; | 4442 | u32 data, orig; |
| 4443 | 4443 | ||
| 4444 | orig = data = RREG32(mmRLC_PG_CNTL); | 4444 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4445 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_SMG)) | 4445 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG)) |
| 4446 | data |= RLC_PG_CNTL__STATIC_PER_CU_PG_ENABLE_MASK; | 4446 | data |= RLC_PG_CNTL__STATIC_PER_CU_PG_ENABLE_MASK; |
| 4447 | else | 4447 | else |
| 4448 | data &= ~RLC_PG_CNTL__STATIC_PER_CU_PG_ENABLE_MASK; | 4448 | data &= ~RLC_PG_CNTL__STATIC_PER_CU_PG_ENABLE_MASK; |
| @@ -4456,7 +4456,7 @@ static void gfx_v7_0_enable_gfx_dynamic_mgpg(struct amdgpu_device *adev, | |||
| 4456 | u32 data, orig; | 4456 | u32 data, orig; |
| 4457 | 4457 | ||
| 4458 | orig = data = RREG32(mmRLC_PG_CNTL); | 4458 | orig = data = RREG32(mmRLC_PG_CNTL); |
| 4459 | if (enable && (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_DMG)) | 4459 | if (enable && (adev->pg_flags & AMD_PG_SUPPORT_GFX_DMG)) |
| 4460 | data |= RLC_PG_CNTL__DYN_PER_CU_PG_ENABLE_MASK; | 4460 | data |= RLC_PG_CNTL__DYN_PER_CU_PG_ENABLE_MASK; |
| 4461 | else | 4461 | else |
| 4462 | data &= ~RLC_PG_CNTL__DYN_PER_CU_PG_ENABLE_MASK; | 4462 | data &= ~RLC_PG_CNTL__DYN_PER_CU_PG_ENABLE_MASK; |
| @@ -4623,15 +4623,15 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, | |||
| 4623 | 4623 | ||
| 4624 | static void gfx_v7_0_init_pg(struct amdgpu_device *adev) | 4624 | static void gfx_v7_0_init_pg(struct amdgpu_device *adev) |
| 4625 | { | 4625 | { |
| 4626 | if (adev->pg_flags & (AMDGPU_PG_SUPPORT_GFX_PG | | 4626 | if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG | |
| 4627 | AMDGPU_PG_SUPPORT_GFX_SMG | | 4627 | AMD_PG_SUPPORT_GFX_SMG | |
| 4628 | AMDGPU_PG_SUPPORT_GFX_DMG | | 4628 | AMD_PG_SUPPORT_GFX_DMG | |
| 4629 | AMDGPU_PG_SUPPORT_CP | | 4629 | AMD_PG_SUPPORT_CP | |
| 4630 | AMDGPU_PG_SUPPORT_GDS | | 4630 | AMD_PG_SUPPORT_GDS | |
| 4631 | AMDGPU_PG_SUPPORT_RLC_SMU_HS)) { | 4631 | AMD_PG_SUPPORT_RLC_SMU_HS)) { |
| 4632 | gfx_v7_0_enable_sclk_slowdown_on_pu(adev, true); | 4632 | gfx_v7_0_enable_sclk_slowdown_on_pu(adev, true); |
| 4633 | gfx_v7_0_enable_sclk_slowdown_on_pd(adev, true); | 4633 | gfx_v7_0_enable_sclk_slowdown_on_pd(adev, true); |
| 4634 | if (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_PG) { | 4634 | if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) { |
| 4635 | gfx_v7_0_init_gfx_cgpg(adev); | 4635 | gfx_v7_0_init_gfx_cgpg(adev); |
| 4636 | gfx_v7_0_enable_cp_pg(adev, true); | 4636 | gfx_v7_0_enable_cp_pg(adev, true); |
| 4637 | gfx_v7_0_enable_gds_pg(adev, true); | 4637 | gfx_v7_0_enable_gds_pg(adev, true); |
| @@ -4643,14 +4643,14 @@ static void gfx_v7_0_init_pg(struct amdgpu_device *adev) | |||
| 4643 | 4643 | ||
| 4644 | static void gfx_v7_0_fini_pg(struct amdgpu_device *adev) | 4644 | static void gfx_v7_0_fini_pg(struct amdgpu_device *adev) |
| 4645 | { | 4645 | { |
| 4646 | if (adev->pg_flags & (AMDGPU_PG_SUPPORT_GFX_PG | | 4646 | if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG | |
| 4647 | AMDGPU_PG_SUPPORT_GFX_SMG | | 4647 | AMD_PG_SUPPORT_GFX_SMG | |
| 4648 | AMDGPU_PG_SUPPORT_GFX_DMG | | 4648 | AMD_PG_SUPPORT_GFX_DMG | |
| 4649 | AMDGPU_PG_SUPPORT_CP | | 4649 | AMD_PG_SUPPORT_CP | |
| 4650 | AMDGPU_PG_SUPPORT_GDS | | 4650 | AMD_PG_SUPPORT_GDS | |
| 4651 | AMDGPU_PG_SUPPORT_RLC_SMU_HS)) { | 4651 | AMD_PG_SUPPORT_RLC_SMU_HS)) { |
| 4652 | gfx_v7_0_update_gfx_pg(adev, false); | 4652 | gfx_v7_0_update_gfx_pg(adev, false); |
| 4653 | if (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_PG) { | 4653 | if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) { |
| 4654 | gfx_v7_0_enable_cp_pg(adev, false); | 4654 | gfx_v7_0_enable_cp_pg(adev, false); |
| 4655 | gfx_v7_0_enable_gds_pg(adev, false); | 4655 | gfx_v7_0_enable_gds_pg(adev, false); |
| 4656 | } | 4656 | } |
| @@ -5527,14 +5527,14 @@ static int gfx_v7_0_set_powergating_state(void *handle, | |||
| 5527 | if (state == AMD_PG_STATE_GATE) | 5527 | if (state == AMD_PG_STATE_GATE) |
| 5528 | gate = true; | 5528 | gate = true; |
| 5529 | 5529 | ||
| 5530 | if (adev->pg_flags & (AMDGPU_PG_SUPPORT_GFX_PG | | 5530 | if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG | |
| 5531 | AMDGPU_PG_SUPPORT_GFX_SMG | | 5531 | AMD_PG_SUPPORT_GFX_SMG | |
| 5532 | AMDGPU_PG_SUPPORT_GFX_DMG | | 5532 | AMD_PG_SUPPORT_GFX_DMG | |
| 5533 | AMDGPU_PG_SUPPORT_CP | | 5533 | AMD_PG_SUPPORT_CP | |
| 5534 | AMDGPU_PG_SUPPORT_GDS | | 5534 | AMD_PG_SUPPORT_GDS | |
| 5535 | AMDGPU_PG_SUPPORT_RLC_SMU_HS)) { | 5535 | AMD_PG_SUPPORT_RLC_SMU_HS)) { |
| 5536 | gfx_v7_0_update_gfx_pg(adev, gate); | 5536 | gfx_v7_0_update_gfx_pg(adev, gate); |
| 5537 | if (adev->pg_flags & AMDGPU_PG_SUPPORT_GFX_PG) { | 5537 | if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) { |
| 5538 | gfx_v7_0_enable_cp_pg(adev, gate); | 5538 | gfx_v7_0_enable_cp_pg(adev, gate); |
| 5539 | gfx_v7_0_enable_gds_pg(adev, gate); | 5539 | gfx_v7_0_enable_gds_pg(adev, gate); |
| 5540 | } | 5540 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 8aa2991ab379..b8060795b27b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
| @@ -792,7 +792,7 @@ static void gmc_v7_0_enable_mc_ls(struct amdgpu_device *adev, | |||
| 792 | 792 | ||
| 793 | for (i = 0; i < ARRAY_SIZE(mc_cg_registers); i++) { | 793 | for (i = 0; i < ARRAY_SIZE(mc_cg_registers); i++) { |
| 794 | orig = data = RREG32(mc_cg_registers[i]); | 794 | orig = data = RREG32(mc_cg_registers[i]); |
| 795 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_MC_LS)) | 795 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_LS)) |
| 796 | data |= mc_cg_ls_en[i]; | 796 | data |= mc_cg_ls_en[i]; |
| 797 | else | 797 | else |
| 798 | data &= ~mc_cg_ls_en[i]; | 798 | data &= ~mc_cg_ls_en[i]; |
| @@ -809,7 +809,7 @@ static void gmc_v7_0_enable_mc_mgcg(struct amdgpu_device *adev, | |||
| 809 | 809 | ||
| 810 | for (i = 0; i < ARRAY_SIZE(mc_cg_registers); i++) { | 810 | for (i = 0; i < ARRAY_SIZE(mc_cg_registers); i++) { |
| 811 | orig = data = RREG32(mc_cg_registers[i]); | 811 | orig = data = RREG32(mc_cg_registers[i]); |
| 812 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_MC_MGCG)) | 812 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_MGCG)) |
| 813 | data |= mc_cg_en[i]; | 813 | data |= mc_cg_en[i]; |
| 814 | else | 814 | else |
| 815 | data &= ~mc_cg_en[i]; | 815 | data &= ~mc_cg_en[i]; |
| @@ -825,7 +825,7 @@ static void gmc_v7_0_enable_bif_mgls(struct amdgpu_device *adev, | |||
| 825 | 825 | ||
| 826 | orig = data = RREG32_PCIE(ixPCIE_CNTL2); | 826 | orig = data = RREG32_PCIE(ixPCIE_CNTL2); |
| 827 | 827 | ||
| 828 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_BIF_LS)) { | 828 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_LS)) { |
| 829 | data = REG_SET_FIELD(data, PCIE_CNTL2, SLV_MEM_LS_EN, 1); | 829 | data = REG_SET_FIELD(data, PCIE_CNTL2, SLV_MEM_LS_EN, 1); |
| 830 | data = REG_SET_FIELD(data, PCIE_CNTL2, MST_MEM_LS_EN, 1); | 830 | data = REG_SET_FIELD(data, PCIE_CNTL2, MST_MEM_LS_EN, 1); |
| 831 | data = REG_SET_FIELD(data, PCIE_CNTL2, REPLAY_MEM_LS_EN, 1); | 831 | data = REG_SET_FIELD(data, PCIE_CNTL2, REPLAY_MEM_LS_EN, 1); |
| @@ -848,7 +848,7 @@ static void gmc_v7_0_enable_hdp_mgcg(struct amdgpu_device *adev, | |||
| 848 | 848 | ||
| 849 | orig = data = RREG32(mmHDP_HOST_PATH_CNTL); | 849 | orig = data = RREG32(mmHDP_HOST_PATH_CNTL); |
| 850 | 850 | ||
| 851 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_HDP_MGCG)) | 851 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_HDP_MGCG)) |
| 852 | data = REG_SET_FIELD(data, HDP_HOST_PATH_CNTL, CLOCK_GATING_DIS, 0); | 852 | data = REG_SET_FIELD(data, HDP_HOST_PATH_CNTL, CLOCK_GATING_DIS, 0); |
| 853 | else | 853 | else |
| 854 | data = REG_SET_FIELD(data, HDP_HOST_PATH_CNTL, CLOCK_GATING_DIS, 1); | 854 | data = REG_SET_FIELD(data, HDP_HOST_PATH_CNTL, CLOCK_GATING_DIS, 1); |
| @@ -864,7 +864,7 @@ static void gmc_v7_0_enable_hdp_ls(struct amdgpu_device *adev, | |||
| 864 | 864 | ||
| 865 | orig = data = RREG32(mmHDP_MEM_POWER_LS); | 865 | orig = data = RREG32(mmHDP_MEM_POWER_LS); |
| 866 | 866 | ||
| 867 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_HDP_LS)) | 867 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS)) |
| 868 | data = REG_SET_FIELD(data, HDP_MEM_POWER_LS, LS_ENABLE, 1); | 868 | data = REG_SET_FIELD(data, HDP_MEM_POWER_LS, LS_ENABLE, 1); |
| 869 | else | 869 | else |
| 870 | data = REG_SET_FIELD(data, HDP_MEM_POWER_LS, LS_ENABLE, 0); | 870 | data = REG_SET_FIELD(data, HDP_MEM_POWER_LS, LS_ENABLE, 0); |
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c index 7e9154c7f1db..654d76723bc3 100644 --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c | |||
| @@ -2859,11 +2859,11 @@ static int kv_dpm_init(struct amdgpu_device *adev) | |||
| 2859 | pi->voltage_drop_t = 0; | 2859 | pi->voltage_drop_t = 0; |
| 2860 | pi->caps_sclk_throttle_low_notification = false; | 2860 | pi->caps_sclk_throttle_low_notification = false; |
| 2861 | pi->caps_fps = false; /* true? */ | 2861 | pi->caps_fps = false; /* true? */ |
| 2862 | pi->caps_uvd_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_UVD) ? true : false; | 2862 | pi->caps_uvd_pg = (adev->pg_flags & AMD_PG_SUPPORT_UVD) ? true : false; |
| 2863 | pi->caps_uvd_dpm = true; | 2863 | pi->caps_uvd_dpm = true; |
| 2864 | pi->caps_vce_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_VCE) ? true : false; | 2864 | pi->caps_vce_pg = (adev->pg_flags & AMD_PG_SUPPORT_VCE) ? true : false; |
| 2865 | pi->caps_samu_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_SAMU) ? true : false; | 2865 | pi->caps_samu_pg = (adev->pg_flags & AMD_PG_SUPPORT_SAMU) ? true : false; |
| 2866 | pi->caps_acp_pg = (adev->pg_flags & AMDGPU_PG_SUPPORT_ACP) ? true : false; | 2866 | pi->caps_acp_pg = (adev->pg_flags & AMD_PG_SUPPORT_ACP) ? true : false; |
| 2867 | pi->caps_stable_p_state = false; | 2867 | pi->caps_stable_p_state = false; |
| 2868 | 2868 | ||
| 2869 | ret = kv_parse_sys_info_table(adev); | 2869 | ret = kv_parse_sys_info_table(adev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c index 5e9f73af83a8..fbd3767671bb 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | |||
| @@ -611,7 +611,7 @@ static void uvd_v4_2_enable_mgcg(struct amdgpu_device *adev, | |||
| 611 | { | 611 | { |
| 612 | u32 orig, data; | 612 | u32 orig, data; |
| 613 | 613 | ||
| 614 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_UVD_MGCG)) { | 614 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG)) { |
| 615 | data = RREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL); | 615 | data = RREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL); |
| 616 | data = 0xfff; | 616 | data = 0xfff; |
| 617 | WREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL, data); | 617 | WREG32_UVD_CTX(ixUVD_CGC_MEM_CTRL, data); |
| @@ -830,6 +830,9 @@ static int uvd_v4_2_set_clockgating_state(void *handle, | |||
| 830 | bool gate = false; | 830 | bool gate = false; |
| 831 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 831 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 832 | 832 | ||
| 833 | if (!(adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG)) | ||
| 834 | return 0; | ||
| 835 | |||
| 833 | if (state == AMD_CG_STATE_GATE) | 836 | if (state == AMD_CG_STATE_GATE) |
| 834 | gate = true; | 837 | gate = true; |
| 835 | 838 | ||
| @@ -848,7 +851,10 @@ static int uvd_v4_2_set_powergating_state(void *handle, | |||
| 848 | * revisit this when there is a cleaner line between | 851 | * revisit this when there is a cleaner line between |
| 849 | * the smc and the hw blocks | 852 | * the smc and the hw blocks |
| 850 | */ | 853 | */ |
| 851 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 854 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 855 | |||
| 856 | if (!(adev->pg_flags & AMD_PG_SUPPORT_UVD)) | ||
| 857 | return 0; | ||
| 852 | 858 | ||
| 853 | if (state == AMD_PG_STATE_GATE) { | 859 | if (state == AMD_PG_STATE_GATE) { |
| 854 | uvd_v4_2_stop(adev); | 860 | uvd_v4_2_stop(adev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c index 38864f562981..57f1c5bf3bf1 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | |||
| @@ -774,6 +774,11 @@ static int uvd_v5_0_process_interrupt(struct amdgpu_device *adev, | |||
| 774 | static int uvd_v5_0_set_clockgating_state(void *handle, | 774 | static int uvd_v5_0_set_clockgating_state(void *handle, |
| 775 | enum amd_clockgating_state state) | 775 | enum amd_clockgating_state state) |
| 776 | { | 776 | { |
| 777 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
| 778 | |||
| 779 | if (!(adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG)) | ||
| 780 | return 0; | ||
| 781 | |||
| 777 | return 0; | 782 | return 0; |
| 778 | } | 783 | } |
| 779 | 784 | ||
| @@ -789,6 +794,9 @@ static int uvd_v5_0_set_powergating_state(void *handle, | |||
| 789 | */ | 794 | */ |
| 790 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 795 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 791 | 796 | ||
| 797 | if (!(adev->pg_flags & AMD_PG_SUPPORT_UVD)) | ||
| 798 | return 0; | ||
| 799 | |||
| 792 | if (state == AMD_PG_STATE_GATE) { | 800 | if (state == AMD_PG_STATE_GATE) { |
| 793 | uvd_v5_0_stop(adev); | 801 | uvd_v5_0_stop(adev); |
| 794 | return 0; | 802 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 3d5913926436..0b365b7651ff 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | |||
| @@ -532,7 +532,7 @@ static int uvd_v6_0_start(struct amdgpu_device *adev) | |||
| 532 | uvd_v6_0_mc_resume(adev); | 532 | uvd_v6_0_mc_resume(adev); |
| 533 | 533 | ||
| 534 | /* Set dynamic clock gating in S/W control mode */ | 534 | /* Set dynamic clock gating in S/W control mode */ |
| 535 | if (adev->cg_flags & AMDGPU_CG_SUPPORT_UVD_MGCG) { | 535 | if (adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG) { |
| 536 | if (adev->flags & AMD_IS_APU) | 536 | if (adev->flags & AMD_IS_APU) |
| 537 | cz_set_uvd_clock_gating_branches(adev, false); | 537 | cz_set_uvd_clock_gating_branches(adev, false); |
| 538 | else | 538 | else |
| @@ -1000,7 +1000,7 @@ static int uvd_v6_0_set_clockgating_state(void *handle, | |||
| 1000 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 1000 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 1001 | bool enable = (state == AMD_CG_STATE_GATE) ? true : false; | 1001 | bool enable = (state == AMD_CG_STATE_GATE) ? true : false; |
| 1002 | 1002 | ||
| 1003 | if (!(adev->cg_flags & AMDGPU_CG_SUPPORT_UVD_MGCG)) | 1003 | if (!(adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG)) |
| 1004 | return 0; | 1004 | return 0; |
| 1005 | 1005 | ||
| 1006 | if (enable) { | 1006 | if (enable) { |
| @@ -1030,6 +1030,9 @@ static int uvd_v6_0_set_powergating_state(void *handle, | |||
| 1030 | */ | 1030 | */ |
| 1031 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 1031 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 1032 | 1032 | ||
| 1033 | if (!(adev->pg_flags & AMD_PG_SUPPORT_UVD)) | ||
| 1034 | return 0; | ||
| 1035 | |||
| 1033 | if (state == AMD_PG_STATE_GATE) { | 1036 | if (state == AMD_PG_STATE_GATE) { |
| 1034 | uvd_v6_0_stop(adev); | 1037 | uvd_v6_0_stop(adev); |
| 1035 | return 0; | 1038 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c index 52ac7a8f1e58..a822edacfa95 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | |||
| @@ -373,7 +373,7 @@ static void vce_v2_0_enable_mgcg(struct amdgpu_device *adev, bool enable) | |||
| 373 | { | 373 | { |
| 374 | bool sw_cg = false; | 374 | bool sw_cg = false; |
| 375 | 375 | ||
| 376 | if (enable && (adev->cg_flags & AMDGPU_CG_SUPPORT_VCE_MGCG)) { | 376 | if (enable && (adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG)) { |
| 377 | if (sw_cg) | 377 | if (sw_cg) |
| 378 | vce_v2_0_set_sw_cg(adev, true); | 378 | vce_v2_0_set_sw_cg(adev, true); |
| 379 | else | 379 | else |
| @@ -608,6 +608,9 @@ static int vce_v2_0_set_powergating_state(void *handle, | |||
| 608 | */ | 608 | */ |
| 609 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 609 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 610 | 610 | ||
| 611 | if (!(adev->pg_flags & AMD_PG_SUPPORT_VCE)) | ||
| 612 | return 0; | ||
| 613 | |||
| 611 | if (state == AMD_PG_STATE_GATE) | 614 | if (state == AMD_PG_STATE_GATE) |
| 612 | /* XXX do we need a vce_v2_0_stop()? */ | 615 | /* XXX do we need a vce_v2_0_stop()? */ |
| 613 | return 0; | 616 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c index e99af81e4aec..d662fa9f9091 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | |||
| @@ -277,7 +277,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev) | |||
| 277 | WREG32_P(mmVCE_STATUS, 0, ~1); | 277 | WREG32_P(mmVCE_STATUS, 0, ~1); |
| 278 | 278 | ||
| 279 | /* Set Clock-Gating off */ | 279 | /* Set Clock-Gating off */ |
| 280 | if (adev->cg_flags & AMDGPU_CG_SUPPORT_VCE_MGCG) | 280 | if (adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG) |
| 281 | vce_v3_0_set_vce_sw_clock_gating(adev, false); | 281 | vce_v3_0_set_vce_sw_clock_gating(adev, false); |
| 282 | 282 | ||
| 283 | if (r) { | 283 | if (r) { |
| @@ -676,7 +676,7 @@ static int vce_v3_0_set_clockgating_state(void *handle, | |||
| 676 | bool enable = (state == AMD_CG_STATE_GATE) ? true : false; | 676 | bool enable = (state == AMD_CG_STATE_GATE) ? true : false; |
| 677 | int i; | 677 | int i; |
| 678 | 678 | ||
| 679 | if (!(adev->cg_flags & AMDGPU_CG_SUPPORT_VCE_MGCG)) | 679 | if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG)) |
| 680 | return 0; | 680 | return 0; |
| 681 | 681 | ||
| 682 | mutex_lock(&adev->grbm_idx_mutex); | 682 | mutex_lock(&adev->grbm_idx_mutex); |
| @@ -728,6 +728,9 @@ static int vce_v3_0_set_powergating_state(void *handle, | |||
| 728 | */ | 728 | */ |
| 729 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 729 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 730 | 730 | ||
| 731 | if (!(adev->pg_flags & AMD_PG_SUPPORT_VCE)) | ||
| 732 | return 0; | ||
| 733 | |||
| 731 | if (state == AMD_PG_STATE_GATE) | 734 | if (state == AMD_PG_STATE_GATE) |
| 732 | /* XXX do we need a vce_v3_0_stop()? */ | 735 | /* XXX do we need a vce_v3_0_stop()? */ |
| 733 | return 0; | 736 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 89f5a1ff6f43..0d14d108a6c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
| @@ -1457,8 +1457,7 @@ static int vi_common_early_init(void *handle) | |||
| 1457 | case CHIP_STONEY: | 1457 | case CHIP_STONEY: |
| 1458 | adev->has_uvd = true; | 1458 | adev->has_uvd = true; |
| 1459 | adev->cg_flags = 0; | 1459 | adev->cg_flags = 0; |
| 1460 | /* Disable UVD pg */ | 1460 | adev->pg_flags = 0; |
| 1461 | adev->pg_flags = /* AMDGPU_PG_SUPPORT_UVD | */AMDGPU_PG_SUPPORT_VCE; | ||
| 1462 | adev->external_rev_id = adev->rev_id + 0x1; | 1461 | adev->external_rev_id = adev->rev_id + 0x1; |
| 1463 | break; | 1462 | break; |
| 1464 | default: | 1463 | default: |
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h index 1195d06f55bc..dbf7e6413cab 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h | |||
| @@ -85,6 +85,38 @@ enum amd_powergating_state { | |||
| 85 | AMD_PG_STATE_UNGATE, | 85 | AMD_PG_STATE_UNGATE, |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | /* CG flags */ | ||
| 89 | #define AMD_CG_SUPPORT_GFX_MGCG (1 << 0) | ||
| 90 | #define AMD_CG_SUPPORT_GFX_MGLS (1 << 1) | ||
| 91 | #define AMD_CG_SUPPORT_GFX_CGCG (1 << 2) | ||
| 92 | #define AMD_CG_SUPPORT_GFX_CGLS (1 << 3) | ||
| 93 | #define AMD_CG_SUPPORT_GFX_CGTS (1 << 4) | ||
| 94 | #define AMD_CG_SUPPORT_GFX_CGTS_LS (1 << 5) | ||
| 95 | #define AMD_CG_SUPPORT_GFX_CP_LS (1 << 6) | ||
| 96 | #define AMD_CG_SUPPORT_GFX_RLC_LS (1 << 7) | ||
| 97 | #define AMD_CG_SUPPORT_MC_LS (1 << 8) | ||
| 98 | #define AMD_CG_SUPPORT_MC_MGCG (1 << 9) | ||
| 99 | #define AMD_CG_SUPPORT_SDMA_LS (1 << 10) | ||
| 100 | #define AMD_CG_SUPPORT_SDMA_MGCG (1 << 11) | ||
| 101 | #define AMD_CG_SUPPORT_BIF_LS (1 << 12) | ||
| 102 | #define AMD_CG_SUPPORT_UVD_MGCG (1 << 13) | ||
| 103 | #define AMD_CG_SUPPORT_VCE_MGCG (1 << 14) | ||
| 104 | #define AMD_CG_SUPPORT_HDP_LS (1 << 15) | ||
| 105 | #define AMD_CG_SUPPORT_HDP_MGCG (1 << 16) | ||
| 106 | |||
| 107 | /* PG flags */ | ||
| 108 | #define AMD_PG_SUPPORT_GFX_PG (1 << 0) | ||
| 109 | #define AMD_PG_SUPPORT_GFX_SMG (1 << 1) | ||
| 110 | #define AMD_PG_SUPPORT_GFX_DMG (1 << 2) | ||
| 111 | #define AMD_PG_SUPPORT_UVD (1 << 3) | ||
| 112 | #define AMD_PG_SUPPORT_VCE (1 << 4) | ||
| 113 | #define AMD_PG_SUPPORT_CP (1 << 5) | ||
| 114 | #define AMD_PG_SUPPORT_GDS (1 << 6) | ||
| 115 | #define AMD_PG_SUPPORT_RLC_SMU_HS (1 << 7) | ||
| 116 | #define AMD_PG_SUPPORT_SDMA (1 << 8) | ||
| 117 | #define AMD_PG_SUPPORT_ACP (1 << 9) | ||
| 118 | #define AMD_PG_SUPPORT_SAMU (1 << 10) | ||
| 119 | |||
| 88 | enum amd_pm_state_type { | 120 | enum amd_pm_state_type { |
| 89 | /* not used for dpm */ | 121 | /* not used for dpm */ |
| 90 | POWER_STATE_TYPE_DEFAULT, | 122 | POWER_STATE_TYPE_DEFAULT, |
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h index 713aec954692..aec38fc3834f 100644 --- a/drivers/gpu/drm/amd/include/cgs_common.h +++ b/drivers/gpu/drm/amd/include/cgs_common.h | |||
| @@ -109,6 +109,8 @@ enum cgs_system_info_id { | |||
| 109 | CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1, | 109 | CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1, |
| 110 | CGS_SYSTEM_INFO_PCIE_GEN_INFO, | 110 | CGS_SYSTEM_INFO_PCIE_GEN_INFO, |
| 111 | CGS_SYSTEM_INFO_PCIE_MLW, | 111 | CGS_SYSTEM_INFO_PCIE_MLW, |
| 112 | CGS_SYSTEM_INFO_CG_FLAGS, | ||
| 113 | CGS_SYSTEM_INFO_PG_FLAGS, | ||
| 112 | CGS_SYSTEM_INFO_ID_MAXIMUM, | 114 | CGS_SYSTEM_INFO_ID_MAXIMUM, |
| 113 | }; | 115 | }; |
| 114 | 116 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c index 0874ab42ee95..cf01177ca3b5 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | |||
| @@ -174,6 +174,8 @@ static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
| 174 | { | 174 | { |
| 175 | struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); | 175 | struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); |
| 176 | uint32_t i; | 176 | uint32_t i; |
| 177 | struct cgs_system_info sys_info = {0}; | ||
| 178 | int result; | ||
| 177 | 179 | ||
| 178 | cz_hwmgr->gfx_ramp_step = 256*25/100; | 180 | cz_hwmgr->gfx_ramp_step = 256*25/100; |
| 179 | 181 | ||
| @@ -247,6 +249,22 @@ static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
| 247 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 249 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
| 248 | PHM_PlatformCaps_DisableVoltageIsland); | 250 | PHM_PlatformCaps_DisableVoltageIsland); |
| 249 | 251 | ||
| 252 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, | ||
| 253 | PHM_PlatformCaps_UVDPowerGating); | ||
| 254 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, | ||
| 255 | PHM_PlatformCaps_VCEPowerGating); | ||
| 256 | sys_info.size = sizeof(struct cgs_system_info); | ||
| 257 | sys_info.info_id = CGS_SYSTEM_INFO_PG_FLAGS; | ||
| 258 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
| 259 | if (!result) { | ||
| 260 | if (sys_info.value & AMD_PG_SUPPORT_UVD) | ||
| 261 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
| 262 | PHM_PlatformCaps_UVDPowerGating); | ||
| 263 | if (sys_info.value & AMD_PG_SUPPORT_VCE) | ||
| 264 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
| 265 | PHM_PlatformCaps_VCEPowerGating); | ||
| 266 | } | ||
| 267 | |||
| 250 | return 0; | 268 | return 0; |
| 251 | } | 269 | } |
| 252 | 270 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 44a925006479..980d3bf8ea76 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
| @@ -4451,6 +4451,7 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
| 4451 | pp_atomctrl_gpio_pin_assignment gpio_pin_assignment; | 4451 | pp_atomctrl_gpio_pin_assignment gpio_pin_assignment; |
| 4452 | struct phm_ppt_v1_information *pptable_info = (struct phm_ppt_v1_information *)(hwmgr->pptable); | 4452 | struct phm_ppt_v1_information *pptable_info = (struct phm_ppt_v1_information *)(hwmgr->pptable); |
| 4453 | phw_tonga_ulv_parm *ulv; | 4453 | phw_tonga_ulv_parm *ulv; |
| 4454 | struct cgs_system_info sys_info = {0}; | ||
| 4454 | 4455 | ||
| 4455 | PP_ASSERT_WITH_CODE((NULL != hwmgr), | 4456 | PP_ASSERT_WITH_CODE((NULL != hwmgr), |
| 4456 | "Invalid Parameter!", return -1;); | 4457 | "Invalid Parameter!", return -1;); |
| @@ -4615,9 +4616,23 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
| 4615 | 4616 | ||
| 4616 | data->vddc_phase_shed_control = 0; | 4617 | data->vddc_phase_shed_control = 0; |
| 4617 | 4618 | ||
| 4618 | if (0 == result) { | 4619 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, |
| 4619 | struct cgs_system_info sys_info = {0}; | 4620 | PHM_PlatformCaps_UVDPowerGating); |
| 4621 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, | ||
| 4622 | PHM_PlatformCaps_VCEPowerGating); | ||
| 4623 | sys_info.size = sizeof(struct cgs_system_info); | ||
| 4624 | sys_info.info_id = CGS_SYSTEM_INFO_PG_FLAGS; | ||
| 4625 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
| 4626 | if (!result) { | ||
| 4627 | if (sys_info.value & AMD_PG_SUPPORT_UVD) | ||
| 4628 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
| 4629 | PHM_PlatformCaps_UVDPowerGating); | ||
| 4630 | if (sys_info.value & AMD_PG_SUPPORT_VCE) | ||
| 4631 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
| 4632 | PHM_PlatformCaps_VCEPowerGating); | ||
| 4633 | } | ||
| 4620 | 4634 | ||
| 4635 | if (0 == result) { | ||
| 4621 | data->is_tlu_enabled = 0; | 4636 | data->is_tlu_enabled = 0; |
| 4622 | hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = | 4637 | hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = |
| 4623 | TONGA_MAX_HARDWARE_POWERLEVELS; | 4638 | TONGA_MAX_HARDWARE_POWERLEVELS; |
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 8ae13de272c4..27fbd79d0daf 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | |||
| @@ -1159,11 +1159,13 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, | |||
| 1159 | drm_dp_put_port(port); | 1159 | drm_dp_put_port(port); |
| 1160 | goto out; | 1160 | goto out; |
| 1161 | } | 1161 | } |
| 1162 | 1162 | if (port->port_num >= DP_MST_LOGICAL_PORT_0) { | |
| 1163 | drm_mode_connector_set_tile_property(port->connector); | 1163 | port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); |
| 1164 | 1164 | drm_mode_connector_set_tile_property(port->connector); | |
| 1165 | } | ||
| 1165 | (*mstb->mgr->cbs->register_connector)(port->connector); | 1166 | (*mstb->mgr->cbs->register_connector)(port->connector); |
| 1166 | } | 1167 | } |
| 1168 | |||
| 1167 | out: | 1169 | out: |
| 1168 | /* put reference to this port */ | 1170 | /* put reference to this port */ |
| 1169 | drm_dp_put_port(port); | 1171 | drm_dp_put_port(port); |
| @@ -1188,8 +1190,8 @@ static void drm_dp_update_port(struct drm_dp_mst_branch *mstb, | |||
| 1188 | port->ddps = conn_stat->displayport_device_plug_status; | 1190 | port->ddps = conn_stat->displayport_device_plug_status; |
| 1189 | 1191 | ||
| 1190 | if (old_ddps != port->ddps) { | 1192 | if (old_ddps != port->ddps) { |
| 1191 | dowork = true; | ||
| 1192 | if (port->ddps) { | 1193 | if (port->ddps) { |
| 1194 | dowork = true; | ||
| 1193 | } else { | 1195 | } else { |
| 1194 | port->available_pbn = 0; | 1196 | port->available_pbn = 0; |
| 1195 | } | 1197 | } |
| @@ -1294,13 +1296,8 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m | |||
| 1294 | if (port->input) | 1296 | if (port->input) |
| 1295 | continue; | 1297 | continue; |
| 1296 | 1298 | ||
| 1297 | if (!port->ddps) { | 1299 | if (!port->ddps) |
| 1298 | if (port->cached_edid) { | ||
| 1299 | kfree(port->cached_edid); | ||
| 1300 | port->cached_edid = NULL; | ||
| 1301 | } | ||
| 1302 | continue; | 1300 | continue; |
| 1303 | } | ||
| 1304 | 1301 | ||
| 1305 | if (!port->available_pbn) | 1302 | if (!port->available_pbn) |
| 1306 | drm_dp_send_enum_path_resources(mgr, mstb, port); | 1303 | drm_dp_send_enum_path_resources(mgr, mstb, port); |
| @@ -1311,12 +1308,6 @@ static void drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *m | |||
| 1311 | drm_dp_check_and_send_link_address(mgr, mstb_child); | 1308 | drm_dp_check_and_send_link_address(mgr, mstb_child); |
| 1312 | drm_dp_put_mst_branch_device(mstb_child); | 1309 | drm_dp_put_mst_branch_device(mstb_child); |
| 1313 | } | 1310 | } |
| 1314 | } else if (port->pdt == DP_PEER_DEVICE_SST_SINK || | ||
| 1315 | port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV) { | ||
| 1316 | if (!port->cached_edid) { | ||
| 1317 | port->cached_edid = | ||
| 1318 | drm_get_edid(port->connector, &port->aux.ddc); | ||
| 1319 | } | ||
| 1320 | } | 1311 | } |
| 1321 | } | 1312 | } |
| 1322 | } | 1313 | } |
| @@ -1336,8 +1327,6 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work) | |||
| 1336 | drm_dp_check_and_send_link_address(mgr, mstb); | 1327 | drm_dp_check_and_send_link_address(mgr, mstb); |
| 1337 | drm_dp_put_mst_branch_device(mstb); | 1328 | drm_dp_put_mst_branch_device(mstb); |
| 1338 | } | 1329 | } |
| 1339 | |||
| 1340 | (*mgr->cbs->hotplug)(mgr); | ||
| 1341 | } | 1330 | } |
| 1342 | 1331 | ||
| 1343 | static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr, | 1332 | static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr, |
| @@ -1597,6 +1586,7 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr, | |||
| 1597 | for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) { | 1586 | for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) { |
| 1598 | drm_dp_add_port(mstb, mgr->dev, &txmsg->reply.u.link_addr.ports[i]); | 1587 | drm_dp_add_port(mstb, mgr->dev, &txmsg->reply.u.link_addr.ports[i]); |
| 1599 | } | 1588 | } |
| 1589 | (*mgr->cbs->hotplug)(mgr); | ||
| 1600 | } | 1590 | } |
| 1601 | } else { | 1591 | } else { |
| 1602 | mstb->link_address_sent = false; | 1592 | mstb->link_address_sent = false; |
| @@ -2293,6 +2283,8 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) | |||
| 2293 | drm_dp_update_port(mstb, &msg.u.conn_stat); | 2283 | drm_dp_update_port(mstb, &msg.u.conn_stat); |
| 2294 | 2284 | ||
| 2295 | DRM_DEBUG_KMS("Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", msg.u.conn_stat.port_number, msg.u.conn_stat.legacy_device_plug_status, msg.u.conn_stat.displayport_device_plug_status, msg.u.conn_stat.message_capability_status, msg.u.conn_stat.input_port, msg.u.conn_stat.peer_device_type); | 2285 | DRM_DEBUG_KMS("Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n", msg.u.conn_stat.port_number, msg.u.conn_stat.legacy_device_plug_status, msg.u.conn_stat.displayport_device_plug_status, msg.u.conn_stat.message_capability_status, msg.u.conn_stat.input_port, msg.u.conn_stat.peer_device_type); |
| 2286 | (*mgr->cbs->hotplug)(mgr); | ||
| 2287 | |||
| 2296 | } else if (msg.req_type == DP_RESOURCE_STATUS_NOTIFY) { | 2288 | } else if (msg.req_type == DP_RESOURCE_STATUS_NOTIFY) { |
| 2297 | drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, msg.req_type, seqno, false); | 2289 | drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, msg.req_type, seqno, false); |
| 2298 | if (!mstb) | 2290 | if (!mstb) |
| @@ -2379,6 +2371,10 @@ enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector | |||
| 2379 | 2371 | ||
| 2380 | case DP_PEER_DEVICE_SST_SINK: | 2372 | case DP_PEER_DEVICE_SST_SINK: |
| 2381 | status = connector_status_connected; | 2373 | status = connector_status_connected; |
| 2374 | /* for logical ports - cache the EDID */ | ||
| 2375 | if (port->port_num >= 8 && !port->cached_edid) { | ||
| 2376 | port->cached_edid = drm_get_edid(connector, &port->aux.ddc); | ||
| 2377 | } | ||
| 2382 | break; | 2378 | break; |
| 2383 | case DP_PEER_DEVICE_DP_LEGACY_CONV: | 2379 | case DP_PEER_DEVICE_DP_LEGACY_CONV: |
| 2384 | if (port->ldps) | 2380 | if (port->ldps) |
| @@ -2433,7 +2429,10 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_ | |||
| 2433 | 2429 | ||
| 2434 | if (port->cached_edid) | 2430 | if (port->cached_edid) |
| 2435 | edid = drm_edid_duplicate(port->cached_edid); | 2431 | edid = drm_edid_duplicate(port->cached_edid); |
| 2436 | 2432 | else { | |
| 2433 | edid = drm_get_edid(connector, &port->aux.ddc); | ||
| 2434 | drm_mode_connector_set_tile_property(connector); | ||
| 2435 | } | ||
| 2437 | port->has_audio = drm_detect_monitor_audio(edid); | 2436 | port->has_audio = drm_detect_monitor_audio(edid); |
| 2438 | drm_dp_put_port(port); | 2437 | drm_dp_put_port(port); |
| 2439 | return edid; | 2438 | return edid; |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index d12a4efa651b..1fe14579e8c9 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -224,6 +224,64 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, | |||
| 224 | diff = (flags & DRM_CALLED_FROM_VBLIRQ) != 0; | 224 | diff = (flags & DRM_CALLED_FROM_VBLIRQ) != 0; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | /* | ||
| 228 | * Within a drm_vblank_pre_modeset - drm_vblank_post_modeset | ||
| 229 | * interval? If so then vblank irqs keep running and it will likely | ||
| 230 | * happen that the hardware vblank counter is not trustworthy as it | ||
| 231 | * might reset at some point in that interval and vblank timestamps | ||
| 232 | * are not trustworthy either in that interval. Iow. this can result | ||
| 233 | * in a bogus diff >> 1 which must be avoided as it would cause | ||
| 234 | * random large forward jumps of the software vblank counter. | ||
| 235 | */ | ||
| 236 | if (diff > 1 && (vblank->inmodeset & 0x2)) { | ||
| 237 | DRM_DEBUG_VBL("clamping vblank bump to 1 on crtc %u: diffr=%u" | ||
| 238 | " due to pre-modeset.\n", pipe, diff); | ||
| 239 | diff = 1; | ||
| 240 | } | ||
| 241 | |||
| 242 | /* | ||
| 243 | * FIMXE: Need to replace this hack with proper seqlocks. | ||
| 244 | * | ||
| 245 | * Restrict the bump of the software vblank counter to a safe maximum | ||
| 246 | * value of +1 whenever there is the possibility that concurrent readers | ||
| 247 | * of vblank timestamps could be active at the moment, as the current | ||
| 248 | * implementation of the timestamp caching and updating is not safe | ||
| 249 | * against concurrent readers for calls to store_vblank() with a bump | ||
| 250 | * of anything but +1. A bump != 1 would very likely return corrupted | ||
| 251 | * timestamps to userspace, because the same slot in the cache could | ||
| 252 | * be concurrently written by store_vblank() and read by one of those | ||
| 253 | * readers without the read-retry logic detecting the collision. | ||
| 254 | * | ||
| 255 | * Concurrent readers can exist when we are called from the | ||
| 256 | * drm_vblank_off() or drm_vblank_on() functions and other non-vblank- | ||
| 257 | * irq callers. However, all those calls to us are happening with the | ||
| 258 | * vbl_lock locked to prevent drm_vblank_get(), so the vblank refcount | ||
| 259 | * can't increase while we are executing. Therefore a zero refcount at | ||
| 260 | * this point is safe for arbitrary counter bumps if we are called | ||
| 261 | * outside vblank irq, a non-zero count is not 100% safe. Unfortunately | ||
| 262 | * we must also accept a refcount of 1, as whenever we are called from | ||
| 263 | * drm_vblank_get() -> drm_vblank_enable() the refcount will be 1 and | ||
| 264 | * we must let that one pass through in order to not lose vblank counts | ||
| 265 | * during vblank irq off - which would completely defeat the whole | ||
| 266 | * point of this routine. | ||
| 267 | * | ||
| 268 | * Whenever we are called from vblank irq, we have to assume concurrent | ||
| 269 | * readers exist or can show up any time during our execution, even if | ||
| 270 | * the refcount is currently zero, as vblank irqs are usually only | ||
| 271 | * enabled due to the presence of readers, and because when we are called | ||
| 272 | * from vblank irq we can't hold the vbl_lock to protect us from sudden | ||
| 273 | * bumps in vblank refcount. Therefore also restrict bumps to +1 when | ||
| 274 | * called from vblank irq. | ||
| 275 | */ | ||
| 276 | if ((diff > 1) && (atomic_read(&vblank->refcount) > 1 || | ||
| 277 | (flags & DRM_CALLED_FROM_VBLIRQ))) { | ||
| 278 | DRM_DEBUG_VBL("clamping vblank bump to 1 on crtc %u: diffr=%u " | ||
| 279 | "refcount %u, vblirq %u\n", pipe, diff, | ||
| 280 | atomic_read(&vblank->refcount), | ||
| 281 | (flags & DRM_CALLED_FROM_VBLIRQ) != 0); | ||
| 282 | diff = 1; | ||
| 283 | } | ||
| 284 | |||
| 227 | DRM_DEBUG_VBL("updating vblank count on crtc %u:" | 285 | DRM_DEBUG_VBL("updating vblank count on crtc %u:" |
| 228 | " current=%u, diff=%u, hw=%u hw_last=%u\n", | 286 | " current=%u, diff=%u, hw=%u hw_last=%u\n", |
| 229 | pipe, vblank->count, diff, cur_vblank, vblank->last); | 287 | pipe, vblank->count, diff, cur_vblank, vblank->last); |
| @@ -1316,7 +1374,13 @@ void drm_vblank_off(struct drm_device *dev, unsigned int pipe) | |||
| 1316 | spin_lock_irqsave(&dev->event_lock, irqflags); | 1374 | spin_lock_irqsave(&dev->event_lock, irqflags); |
| 1317 | 1375 | ||
| 1318 | spin_lock(&dev->vbl_lock); | 1376 | spin_lock(&dev->vbl_lock); |
| 1319 | vblank_disable_and_save(dev, pipe); | 1377 | DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n", |
| 1378 | pipe, vblank->enabled, vblank->inmodeset); | ||
| 1379 | |||
| 1380 | /* Avoid redundant vblank disables without previous drm_vblank_on(). */ | ||
| 1381 | if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) | ||
| 1382 | vblank_disable_and_save(dev, pipe); | ||
| 1383 | |||
| 1320 | wake_up(&vblank->queue); | 1384 | wake_up(&vblank->queue); |
| 1321 | 1385 | ||
| 1322 | /* | 1386 | /* |
| @@ -1418,6 +1482,9 @@ void drm_vblank_on(struct drm_device *dev, unsigned int pipe) | |||
| 1418 | return; | 1482 | return; |
| 1419 | 1483 | ||
| 1420 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 1484 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
| 1485 | DRM_DEBUG_VBL("crtc %d, vblank enabled %d, inmodeset %d\n", | ||
| 1486 | pipe, vblank->enabled, vblank->inmodeset); | ||
| 1487 | |||
| 1421 | /* Drop our private "prevent drm_vblank_get" refcount */ | 1488 | /* Drop our private "prevent drm_vblank_get" refcount */ |
| 1422 | if (vblank->inmodeset) { | 1489 | if (vblank->inmodeset) { |
| 1423 | atomic_dec(&vblank->refcount); | 1490 | atomic_dec(&vblank->refcount); |
| @@ -1430,8 +1497,7 @@ void drm_vblank_on(struct drm_device *dev, unsigned int pipe) | |||
| 1430 | * re-enable interrupts if there are users left, or the | 1497 | * re-enable interrupts if there are users left, or the |
| 1431 | * user wishes vblank interrupts to be enabled all the time. | 1498 | * user wishes vblank interrupts to be enabled all the time. |
| 1432 | */ | 1499 | */ |
| 1433 | if (atomic_read(&vblank->refcount) != 0 || | 1500 | if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) |
| 1434 | (!dev->vblank_disable_immediate && drm_vblank_offdelay == 0)) | ||
| 1435 | WARN_ON(drm_vblank_enable(dev, pipe)); | 1501 | WARN_ON(drm_vblank_enable(dev, pipe)); |
| 1436 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 1502 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
| 1437 | } | 1503 | } |
| @@ -1526,6 +1592,7 @@ void drm_vblank_post_modeset(struct drm_device *dev, unsigned int pipe) | |||
| 1526 | if (vblank->inmodeset) { | 1592 | if (vblank->inmodeset) { |
| 1527 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 1593 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
| 1528 | dev->vblank_disable_allowed = true; | 1594 | dev->vblank_disable_allowed = true; |
| 1595 | drm_reset_vblank_timestamp(dev, pipe); | ||
| 1529 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 1596 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
| 1530 | 1597 | ||
| 1531 | if (vblank->inmodeset & 0x2) | 1598 | if (vblank->inmodeset & 0x2) |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 83efca941388..f17d39279596 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config DRM_EXYNOS | 1 | config DRM_EXYNOS |
| 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" | 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
| 3 | depends on OF && DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) | 3 | depends on OF && DRM && (ARCH_S3C64XX || ARCH_EXYNOS || ARCH_MULTIPLATFORM) |
| 4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
| 5 | select DRM_KMS_FB_HELPER | 5 | select DRM_KMS_FB_HELPER |
| 6 | select FB_CFB_FILLRECT | 6 | select FB_CFB_FILLRECT |
diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 1bf6a21130c7..162ab93e99cb 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c | |||
| @@ -93,7 +93,7 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc) | |||
| 93 | if (test_bit(BIT_SUSPENDED, &ctx->flags)) | 93 | if (test_bit(BIT_SUSPENDED, &ctx->flags)) |
| 94 | return -EPERM; | 94 | return -EPERM; |
| 95 | 95 | ||
| 96 | if (test_and_set_bit(BIT_IRQS_ENABLED, &ctx->flags)) { | 96 | if (!test_and_set_bit(BIT_IRQS_ENABLED, &ctx->flags)) { |
| 97 | val = VIDINTCON0_INTEN; | 97 | val = VIDINTCON0_INTEN; |
| 98 | if (ctx->out_type == IFTYPE_I80) | 98 | if (ctx->out_type == IFTYPE_I80) |
| 99 | val |= VIDINTCON0_FRAMEDONE; | 99 | val |= VIDINTCON0_FRAMEDONE; |
| @@ -402,8 +402,6 @@ static void decon_enable(struct exynos_drm_crtc *crtc) | |||
| 402 | decon_enable_vblank(ctx->crtc); | 402 | decon_enable_vblank(ctx->crtc); |
| 403 | 403 | ||
| 404 | decon_commit(ctx->crtc); | 404 | decon_commit(ctx->crtc); |
| 405 | |||
| 406 | set_bit(BIT_SUSPENDED, &ctx->flags); | ||
| 407 | } | 405 | } |
| 408 | 406 | ||
| 409 | static void decon_disable(struct exynos_drm_crtc *crtc) | 407 | static void decon_disable(struct exynos_drm_crtc *crtc) |
| @@ -582,9 +580,9 @@ out: | |||
| 582 | static int exynos5433_decon_suspend(struct device *dev) | 580 | static int exynos5433_decon_suspend(struct device *dev) |
| 583 | { | 581 | { |
| 584 | struct decon_context *ctx = dev_get_drvdata(dev); | 582 | struct decon_context *ctx = dev_get_drvdata(dev); |
| 585 | int i; | 583 | int i = ARRAY_SIZE(decon_clks_name); |
| 586 | 584 | ||
| 587 | for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) | 585 | while (--i >= 0) |
| 588 | clk_disable_unprepare(ctx->clks[i]); | 586 | clk_disable_unprepare(ctx->clks[i]); |
| 589 | 587 | ||
| 590 | return 0; | 588 | return 0; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index e977a81af2e6..26e81d191f56 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c | |||
| @@ -1782,6 +1782,7 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, | |||
| 1782 | 1782 | ||
| 1783 | bridge = of_drm_find_bridge(dsi->bridge_node); | 1783 | bridge = of_drm_find_bridge(dsi->bridge_node); |
| 1784 | if (bridge) { | 1784 | if (bridge) { |
| 1785 | encoder->bridge = bridge; | ||
| 1785 | drm_bridge_attach(drm_dev, bridge); | 1786 | drm_bridge_attach(drm_dev, bridge); |
| 1786 | } | 1787 | } |
| 1787 | 1788 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index f6118baa8e3e..8baabd813ff5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
| @@ -50,7 +50,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info, | |||
| 50 | if (vm_size > exynos_gem->size) | 50 | if (vm_size > exynos_gem->size) |
| 51 | return -EINVAL; | 51 | return -EINVAL; |
| 52 | 52 | ||
| 53 | ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->pages, | 53 | ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->cookie, |
| 54 | exynos_gem->dma_addr, exynos_gem->size, | 54 | exynos_gem->dma_addr, exynos_gem->size, |
| 55 | &exynos_gem->dma_attrs); | 55 | &exynos_gem->dma_attrs); |
| 56 | if (ret < 0) { | 56 | if (ret < 0) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index c747824f3c98..8a4f4a0211d0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
| @@ -1723,7 +1723,7 @@ static int fimc_probe(struct platform_device *pdev) | |||
| 1723 | goto err_put_clk; | 1723 | goto err_put_clk; |
| 1724 | } | 1724 | } |
| 1725 | 1725 | ||
| 1726 | DRM_DEBUG_KMS("id[%d]ippdrv[0x%x]\n", ctx->id, (int)ippdrv); | 1726 | DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv); |
| 1727 | 1727 | ||
| 1728 | spin_lock_init(&ctx->lock); | 1728 | spin_lock_init(&ctx->lock); |
| 1729 | platform_set_drvdata(pdev, ctx); | 1729 | platform_set_drvdata(pdev, ctx); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index c17efdb238a6..8dfe6e113a88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
| @@ -1166,7 +1166,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
| 1166 | goto err_free_event; | 1166 | goto err_free_event; |
| 1167 | } | 1167 | } |
| 1168 | 1168 | ||
| 1169 | cmd = (struct drm_exynos_g2d_cmd *)(uint32_t)req->cmd; | 1169 | cmd = (struct drm_exynos_g2d_cmd *)(unsigned long)req->cmd; |
| 1170 | 1170 | ||
| 1171 | if (copy_from_user(cmdlist->data + cmdlist->last, | 1171 | if (copy_from_user(cmdlist->data + cmdlist->last, |
| 1172 | (void __user *)cmd, | 1172 | (void __user *)cmd, |
| @@ -1184,7 +1184,8 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, | |||
| 1184 | if (req->cmd_buf_nr) { | 1184 | if (req->cmd_buf_nr) { |
| 1185 | struct drm_exynos_g2d_cmd *cmd_buf; | 1185 | struct drm_exynos_g2d_cmd *cmd_buf; |
| 1186 | 1186 | ||
| 1187 | cmd_buf = (struct drm_exynos_g2d_cmd *)(uint32_t)req->cmd_buf; | 1187 | cmd_buf = (struct drm_exynos_g2d_cmd *) |
| 1188 | (unsigned long)req->cmd_buf; | ||
| 1188 | 1189 | ||
| 1189 | if (copy_from_user(cmdlist->data + cmdlist->last, | 1190 | if (copy_from_user(cmdlist->data + cmdlist->last, |
| 1190 | (void __user *)cmd_buf, | 1191 | (void __user *)cmd_buf, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 32358c5e3db4..26b5e4bd55b6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
| @@ -218,7 +218,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, | |||
| 218 | return ERR_PTR(ret); | 218 | return ERR_PTR(ret); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); | 221 | DRM_DEBUG_KMS("created file object = %p\n", obj->filp); |
| 222 | 222 | ||
| 223 | return exynos_gem; | 223 | return exynos_gem; |
| 224 | } | 224 | } |
| @@ -335,7 +335,7 @@ static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem, | |||
| 335 | if (vm_size > exynos_gem->size) | 335 | if (vm_size > exynos_gem->size) |
| 336 | return -EINVAL; | 336 | return -EINVAL; |
| 337 | 337 | ||
| 338 | ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->pages, | 338 | ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->cookie, |
| 339 | exynos_gem->dma_addr, exynos_gem->size, | 339 | exynos_gem->dma_addr, exynos_gem->size, |
| 340 | &exynos_gem->dma_attrs); | 340 | &exynos_gem->dma_attrs); |
| 341 | if (ret < 0) { | 341 | if (ret < 0) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 7aecd23cfa11..5d20da8f957e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
| @@ -1723,7 +1723,7 @@ static int gsc_probe(struct platform_device *pdev) | |||
| 1723 | return ret; | 1723 | return ret; |
| 1724 | } | 1724 | } |
| 1725 | 1725 | ||
| 1726 | DRM_DEBUG_KMS("id[%d]ippdrv[0x%x]\n", ctx->id, (int)ippdrv); | 1726 | DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv); |
| 1727 | 1727 | ||
| 1728 | mutex_init(&ctx->lock); | 1728 | mutex_init(&ctx->lock); |
| 1729 | platform_set_drvdata(pdev, ctx); | 1729 | platform_set_drvdata(pdev, ctx); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 67d24236e745..95eeb9116f10 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
| @@ -208,7 +208,7 @@ static struct exynos_drm_ippdrv *ipp_find_drv_by_handle(u32 prop_id) | |||
| 208 | * e.g PAUSE state, queue buf, command control. | 208 | * e.g PAUSE state, queue buf, command control. |
| 209 | */ | 209 | */ |
| 210 | list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) { | 210 | list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) { |
| 211 | DRM_DEBUG_KMS("count[%d]ippdrv[0x%x]\n", count++, (int)ippdrv); | 211 | DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n", count++, ippdrv); |
| 212 | 212 | ||
| 213 | mutex_lock(&ippdrv->cmd_lock); | 213 | mutex_lock(&ippdrv->cmd_lock); |
| 214 | list_for_each_entry(c_node, &ippdrv->cmd_list, list) { | 214 | list_for_each_entry(c_node, &ippdrv->cmd_list, list) { |
| @@ -388,8 +388,8 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, | |||
| 388 | } | 388 | } |
| 389 | property->prop_id = ret; | 389 | property->prop_id = ret; |
| 390 | 390 | ||
| 391 | DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[0x%x]\n", | 391 | DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[%p]\n", |
| 392 | property->prop_id, property->cmd, (int)ippdrv); | 392 | property->prop_id, property->cmd, ippdrv); |
| 393 | 393 | ||
| 394 | /* stored property information and ippdrv in private data */ | 394 | /* stored property information and ippdrv in private data */ |
| 395 | c_node->property = *property; | 395 | c_node->property = *property; |
| @@ -518,7 +518,7 @@ static int ipp_put_mem_node(struct drm_device *drm_dev, | |||
| 518 | { | 518 | { |
| 519 | int i; | 519 | int i; |
| 520 | 520 | ||
| 521 | DRM_DEBUG_KMS("node[0x%x]\n", (int)m_node); | 521 | DRM_DEBUG_KMS("node[%p]\n", m_node); |
| 522 | 522 | ||
| 523 | if (!m_node) { | 523 | if (!m_node) { |
| 524 | DRM_ERROR("invalid dequeue node.\n"); | 524 | DRM_ERROR("invalid dequeue node.\n"); |
| @@ -562,7 +562,7 @@ static struct drm_exynos_ipp_mem_node | |||
| 562 | m_node->buf_id = qbuf->buf_id; | 562 | m_node->buf_id = qbuf->buf_id; |
| 563 | INIT_LIST_HEAD(&m_node->list); | 563 | INIT_LIST_HEAD(&m_node->list); |
| 564 | 564 | ||
| 565 | DRM_DEBUG_KMS("m_node[0x%x]ops_id[%d]\n", (int)m_node, qbuf->ops_id); | 565 | DRM_DEBUG_KMS("m_node[%p]ops_id[%d]\n", m_node, qbuf->ops_id); |
| 566 | DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]\n", qbuf->prop_id, m_node->buf_id); | 566 | DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]\n", qbuf->prop_id, m_node->buf_id); |
| 567 | 567 | ||
| 568 | for_each_ipp_planar(i) { | 568 | for_each_ipp_planar(i) { |
| @@ -582,8 +582,8 @@ static struct drm_exynos_ipp_mem_node | |||
| 582 | 582 | ||
| 583 | buf_info->handles[i] = qbuf->handle[i]; | 583 | buf_info->handles[i] = qbuf->handle[i]; |
| 584 | buf_info->base[i] = *addr; | 584 | buf_info->base[i] = *addr; |
| 585 | DRM_DEBUG_KMS("i[%d]base[0x%x]hd[0x%lx]\n", i, | 585 | DRM_DEBUG_KMS("i[%d]base[%pad]hd[0x%lx]\n", i, |
| 586 | buf_info->base[i], buf_info->handles[i]); | 586 | &buf_info->base[i], buf_info->handles[i]); |
| 587 | } | 587 | } |
| 588 | } | 588 | } |
| 589 | 589 | ||
| @@ -664,7 +664,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, | |||
| 664 | 664 | ||
| 665 | mutex_lock(&c_node->event_lock); | 665 | mutex_lock(&c_node->event_lock); |
| 666 | list_for_each_entry_safe(e, te, &c_node->event_list, base.link) { | 666 | list_for_each_entry_safe(e, te, &c_node->event_list, base.link) { |
| 667 | DRM_DEBUG_KMS("count[%d]e[0x%x]\n", count++, (int)e); | 667 | DRM_DEBUG_KMS("count[%d]e[%p]\n", count++, e); |
| 668 | 668 | ||
| 669 | /* | 669 | /* |
| 670 | * qbuf == NULL condition means all event deletion. | 670 | * qbuf == NULL condition means all event deletion. |
| @@ -755,7 +755,7 @@ static struct drm_exynos_ipp_mem_node | |||
| 755 | 755 | ||
| 756 | /* find memory node from memory list */ | 756 | /* find memory node from memory list */ |
| 757 | list_for_each_entry(m_node, head, list) { | 757 | list_for_each_entry(m_node, head, list) { |
| 758 | DRM_DEBUG_KMS("count[%d]m_node[0x%x]\n", count++, (int)m_node); | 758 | DRM_DEBUG_KMS("count[%d]m_node[%p]\n", count++, m_node); |
| 759 | 759 | ||
| 760 | /* compare buffer id */ | 760 | /* compare buffer id */ |
| 761 | if (m_node->buf_id == qbuf->buf_id) | 761 | if (m_node->buf_id == qbuf->buf_id) |
| @@ -772,7 +772,7 @@ static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv, | |||
| 772 | struct exynos_drm_ipp_ops *ops = NULL; | 772 | struct exynos_drm_ipp_ops *ops = NULL; |
| 773 | int ret = 0; | 773 | int ret = 0; |
| 774 | 774 | ||
| 775 | DRM_DEBUG_KMS("node[0x%x]\n", (int)m_node); | 775 | DRM_DEBUG_KMS("node[%p]\n", m_node); |
| 776 | 776 | ||
| 777 | if (!m_node) { | 777 | if (!m_node) { |
| 778 | DRM_ERROR("invalid queue node.\n"); | 778 | DRM_ERROR("invalid queue node.\n"); |
| @@ -1237,7 +1237,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, | |||
| 1237 | m_node = list_first_entry(head, | 1237 | m_node = list_first_entry(head, |
| 1238 | struct drm_exynos_ipp_mem_node, list); | 1238 | struct drm_exynos_ipp_mem_node, list); |
| 1239 | 1239 | ||
| 1240 | DRM_DEBUG_KMS("m_node[0x%x]\n", (int)m_node); | 1240 | DRM_DEBUG_KMS("m_node[%p]\n", m_node); |
| 1241 | 1241 | ||
| 1242 | ret = ipp_set_mem_node(ippdrv, c_node, m_node); | 1242 | ret = ipp_set_mem_node(ippdrv, c_node, m_node); |
| 1243 | if (ret) { | 1243 | if (ret) { |
| @@ -1610,8 +1610,8 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) | |||
| 1610 | } | 1610 | } |
| 1611 | ippdrv->prop_list.ipp_id = ret; | 1611 | ippdrv->prop_list.ipp_id = ret; |
| 1612 | 1612 | ||
| 1613 | DRM_DEBUG_KMS("count[%d]ippdrv[0x%x]ipp_id[%d]\n", | 1613 | DRM_DEBUG_KMS("count[%d]ippdrv[%p]ipp_id[%d]\n", |
| 1614 | count++, (int)ippdrv, ret); | 1614 | count++, ippdrv, ret); |
| 1615 | 1615 | ||
| 1616 | /* store parent device for node */ | 1616 | /* store parent device for node */ |
| 1617 | ippdrv->parent_dev = dev; | 1617 | ippdrv->parent_dev = dev; |
| @@ -1668,7 +1668,7 @@ static int ipp_subdrv_open(struct drm_device *drm_dev, struct device *dev, | |||
| 1668 | 1668 | ||
| 1669 | file_priv->ipp_dev = dev; | 1669 | file_priv->ipp_dev = dev; |
| 1670 | 1670 | ||
| 1671 | DRM_DEBUG_KMS("done priv[0x%x]\n", (int)dev); | 1671 | DRM_DEBUG_KMS("done priv[%p]\n", dev); |
| 1672 | 1672 | ||
| 1673 | return 0; | 1673 | return 0; |
| 1674 | } | 1674 | } |
| @@ -1685,8 +1685,8 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev, | |||
| 1685 | mutex_lock(&ippdrv->cmd_lock); | 1685 | mutex_lock(&ippdrv->cmd_lock); |
| 1686 | list_for_each_entry_safe(c_node, tc_node, | 1686 | list_for_each_entry_safe(c_node, tc_node, |
| 1687 | &ippdrv->cmd_list, list) { | 1687 | &ippdrv->cmd_list, list) { |
| 1688 | DRM_DEBUG_KMS("count[%d]ippdrv[0x%x]\n", | 1688 | DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n", |
| 1689 | count++, (int)ippdrv); | 1689 | count++, ippdrv); |
| 1690 | 1690 | ||
| 1691 | if (c_node->filp == file) { | 1691 | if (c_node->filp == file) { |
| 1692 | /* | 1692 | /* |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c index 4eaef36aec5a..9869d70e9e54 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
| 19 | #include <linux/of_graph.h> | 19 | #include <linux/of_graph.h> |
| 20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
| 21 | #include <linux/component.h> | ||
| 21 | #include <drm/drmP.h> | 22 | #include <drm/drmP.h> |
| 22 | #include <linux/mfd/syscon.h> | 23 | #include <linux/mfd/syscon.h> |
| 23 | #include <linux/regmap.h> | 24 | #include <linux/regmap.h> |
| @@ -306,9 +307,9 @@ exit: | |||
| 306 | return ret; | 307 | return ret; |
| 307 | } | 308 | } |
| 308 | 309 | ||
| 309 | void mic_disable(struct drm_bridge *bridge) { } | 310 | static void mic_disable(struct drm_bridge *bridge) { } |
| 310 | 311 | ||
| 311 | void mic_post_disable(struct drm_bridge *bridge) | 312 | static void mic_post_disable(struct drm_bridge *bridge) |
| 312 | { | 313 | { |
| 313 | struct exynos_mic *mic = bridge->driver_private; | 314 | struct exynos_mic *mic = bridge->driver_private; |
| 314 | int i; | 315 | int i; |
| @@ -328,7 +329,7 @@ already_disabled: | |||
| 328 | mutex_unlock(&mic_mutex); | 329 | mutex_unlock(&mic_mutex); |
| 329 | } | 330 | } |
| 330 | 331 | ||
| 331 | void mic_pre_enable(struct drm_bridge *bridge) | 332 | static void mic_pre_enable(struct drm_bridge *bridge) |
| 332 | { | 333 | { |
| 333 | struct exynos_mic *mic = bridge->driver_private; | 334 | struct exynos_mic *mic = bridge->driver_private; |
| 334 | int ret, i; | 335 | int ret, i; |
| @@ -371,11 +372,35 @@ already_enabled: | |||
| 371 | mutex_unlock(&mic_mutex); | 372 | mutex_unlock(&mic_mutex); |
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | void mic_enable(struct drm_bridge *bridge) { } | 375 | static void mic_enable(struct drm_bridge *bridge) { } |
| 375 | 376 | ||
| 376 | void mic_destroy(struct drm_bridge *bridge) | 377 | static const struct drm_bridge_funcs mic_bridge_funcs = { |
| 378 | .disable = mic_disable, | ||
| 379 | .post_disable = mic_post_disable, | ||
| 380 | .pre_enable = mic_pre_enable, | ||
| 381 | .enable = mic_enable, | ||
| 382 | }; | ||
| 383 | |||
| 384 | static int exynos_mic_bind(struct device *dev, struct device *master, | ||
| 385 | void *data) | ||
| 377 | { | 386 | { |
| 378 | struct exynos_mic *mic = bridge->driver_private; | 387 | struct exynos_mic *mic = dev_get_drvdata(dev); |
| 388 | int ret; | ||
| 389 | |||
| 390 | mic->bridge.funcs = &mic_bridge_funcs; | ||
| 391 | mic->bridge.of_node = dev->of_node; | ||
| 392 | mic->bridge.driver_private = mic; | ||
| 393 | ret = drm_bridge_add(&mic->bridge); | ||
| 394 | if (ret) | ||
| 395 | DRM_ERROR("mic: Failed to add MIC to the global bridge list\n"); | ||
| 396 | |||
| 397 | return ret; | ||
| 398 | } | ||
| 399 | |||
| 400 | static void exynos_mic_unbind(struct device *dev, struct device *master, | ||
| 401 | void *data) | ||
| 402 | { | ||
| 403 | struct exynos_mic *mic = dev_get_drvdata(dev); | ||
| 379 | int i; | 404 | int i; |
| 380 | 405 | ||
| 381 | mutex_lock(&mic_mutex); | 406 | mutex_lock(&mic_mutex); |
| @@ -387,16 +412,16 @@ void mic_destroy(struct drm_bridge *bridge) | |||
| 387 | 412 | ||
| 388 | already_disabled: | 413 | already_disabled: |
| 389 | mutex_unlock(&mic_mutex); | 414 | mutex_unlock(&mic_mutex); |
| 415 | |||
| 416 | drm_bridge_remove(&mic->bridge); | ||
| 390 | } | 417 | } |
| 391 | 418 | ||
| 392 | static const struct drm_bridge_funcs mic_bridge_funcs = { | 419 | static const struct component_ops exynos_mic_component_ops = { |
| 393 | .disable = mic_disable, | 420 | .bind = exynos_mic_bind, |
| 394 | .post_disable = mic_post_disable, | 421 | .unbind = exynos_mic_unbind, |
| 395 | .pre_enable = mic_pre_enable, | ||
| 396 | .enable = mic_enable, | ||
| 397 | }; | 422 | }; |
| 398 | 423 | ||
| 399 | int exynos_mic_probe(struct platform_device *pdev) | 424 | static int exynos_mic_probe(struct platform_device *pdev) |
| 400 | { | 425 | { |
| 401 | struct device *dev = &pdev->dev; | 426 | struct device *dev = &pdev->dev; |
| 402 | struct exynos_mic *mic; | 427 | struct exynos_mic *mic; |
| @@ -435,17 +460,8 @@ int exynos_mic_probe(struct platform_device *pdev) | |||
| 435 | goto err; | 460 | goto err; |
| 436 | } | 461 | } |
| 437 | 462 | ||
| 438 | mic->bridge.funcs = &mic_bridge_funcs; | ||
| 439 | mic->bridge.of_node = dev->of_node; | ||
| 440 | mic->bridge.driver_private = mic; | ||
| 441 | ret = drm_bridge_add(&mic->bridge); | ||
| 442 | if (ret) { | ||
| 443 | DRM_ERROR("mic: Failed to add MIC to the global bridge list\n"); | ||
| 444 | goto err; | ||
| 445 | } | ||
| 446 | |||
| 447 | for (i = 0; i < NUM_CLKS; i++) { | 463 | for (i = 0; i < NUM_CLKS; i++) { |
| 448 | mic->clks[i] = of_clk_get_by_name(dev->of_node, clk_names[i]); | 464 | mic->clks[i] = devm_clk_get(dev, clk_names[i]); |
| 449 | if (IS_ERR(mic->clks[i])) { | 465 | if (IS_ERR(mic->clks[i])) { |
| 450 | DRM_ERROR("mic: Failed to get clock (%s)\n", | 466 | DRM_ERROR("mic: Failed to get clock (%s)\n", |
| 451 | clk_names[i]); | 467 | clk_names[i]); |
| @@ -454,7 +470,10 @@ int exynos_mic_probe(struct platform_device *pdev) | |||
| 454 | } | 470 | } |
| 455 | } | 471 | } |
| 456 | 472 | ||
| 473 | platform_set_drvdata(pdev, mic); | ||
| 474 | |||
| 457 | DRM_DEBUG_KMS("MIC has been probed\n"); | 475 | DRM_DEBUG_KMS("MIC has been probed\n"); |
| 476 | return component_add(dev, &exynos_mic_component_ops); | ||
| 458 | 477 | ||
| 459 | err: | 478 | err: |
| 460 | return ret; | 479 | return ret; |
| @@ -462,14 +481,7 @@ err: | |||
| 462 | 481 | ||
| 463 | static int exynos_mic_remove(struct platform_device *pdev) | 482 | static int exynos_mic_remove(struct platform_device *pdev) |
| 464 | { | 483 | { |
| 465 | struct exynos_mic *mic = platform_get_drvdata(pdev); | 484 | component_del(&pdev->dev, &exynos_mic_component_ops); |
| 466 | int i; | ||
| 467 | |||
| 468 | drm_bridge_remove(&mic->bridge); | ||
| 469 | |||
| 470 | for (i = NUM_CLKS - 1; i > -1; i--) | ||
| 471 | clk_put(mic->clks[i]); | ||
| 472 | |||
| 473 | return 0; | 485 | return 0; |
| 474 | } | 486 | } |
| 475 | 487 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index bea0f7826d30..ce59f4443394 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
| @@ -754,7 +754,7 @@ static int rotator_probe(struct platform_device *pdev) | |||
| 754 | goto err_ippdrv_register; | 754 | goto err_ippdrv_register; |
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | DRM_DEBUG_KMS("ippdrv[0x%x]\n", (int)ippdrv); | 757 | DRM_DEBUG_KMS("ippdrv[%p]\n", ippdrv); |
| 758 | 758 | ||
| 759 | platform_set_drvdata(pdev, rot); | 759 | platform_set_drvdata(pdev, rot); |
| 760 | 760 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 62ac4e5fa51d..b605bd7395ec 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
| @@ -223,7 +223,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static int vidi_show_connection(struct device *dev, | 226 | static ssize_t vidi_show_connection(struct device *dev, |
| 227 | struct device_attribute *attr, char *buf) | 227 | struct device_attribute *attr, char *buf) |
| 228 | { | 228 | { |
| 229 | struct vidi_context *ctx = dev_get_drvdata(dev); | 229 | struct vidi_context *ctx = dev_get_drvdata(dev); |
| @@ -238,7 +238,7 @@ static int vidi_show_connection(struct device *dev, | |||
| 238 | return rc; | 238 | return rc; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static int vidi_store_connection(struct device *dev, | 241 | static ssize_t vidi_store_connection(struct device *dev, |
| 242 | struct device_attribute *attr, | 242 | struct device_attribute *attr, |
| 243 | const char *buf, size_t len) | 243 | const char *buf, size_t len) |
| 244 | { | 244 | { |
| @@ -294,7 +294,9 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, | |||
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | if (vidi->connection) { | 296 | if (vidi->connection) { |
| 297 | struct edid *raw_edid = (struct edid *)(uint32_t)vidi->edid; | 297 | struct edid *raw_edid; |
| 298 | |||
| 299 | raw_edid = (struct edid *)(unsigned long)vidi->edid; | ||
| 298 | if (!drm_edid_is_valid(raw_edid)) { | 300 | if (!drm_edid_is_valid(raw_edid)) { |
| 299 | DRM_DEBUG_KMS("edid data is invalid.\n"); | 301 | DRM_DEBUG_KMS("edid data is invalid.\n"); |
| 300 | return -EINVAL; | 302 | return -EINVAL; |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f0f75d7c0d94..e7cd311e9fbb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -1988,6 +1988,9 @@ enum hdmi_force_audio { | |||
| 1988 | #define I915_GTT_OFFSET_NONE ((u32)-1) | 1988 | #define I915_GTT_OFFSET_NONE ((u32)-1) |
| 1989 | 1989 | ||
| 1990 | struct drm_i915_gem_object_ops { | 1990 | struct drm_i915_gem_object_ops { |
| 1991 | unsigned int flags; | ||
| 1992 | #define I915_GEM_OBJECT_HAS_STRUCT_PAGE 0x1 | ||
| 1993 | |||
| 1991 | /* Interface between the GEM object and its backing storage. | 1994 | /* Interface between the GEM object and its backing storage. |
| 1992 | * get_pages() is called once prior to the use of the associated set | 1995 | * get_pages() is called once prior to the use of the associated set |
| 1993 | * of pages before to binding them into the GTT, and put_pages() is | 1996 | * of pages before to binding them into the GTT, and put_pages() is |
| @@ -2003,6 +2006,7 @@ struct drm_i915_gem_object_ops { | |||
| 2003 | */ | 2006 | */ |
| 2004 | int (*get_pages)(struct drm_i915_gem_object *); | 2007 | int (*get_pages)(struct drm_i915_gem_object *); |
| 2005 | void (*put_pages)(struct drm_i915_gem_object *); | 2008 | void (*put_pages)(struct drm_i915_gem_object *); |
| 2009 | |||
| 2006 | int (*dmabuf_export)(struct drm_i915_gem_object *); | 2010 | int (*dmabuf_export)(struct drm_i915_gem_object *); |
| 2007 | void (*release)(struct drm_i915_gem_object *); | 2011 | void (*release)(struct drm_i915_gem_object *); |
| 2008 | }; | 2012 | }; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ddc21d4b388d..bb44bad15403 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -4425,6 +4425,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj, | |||
| 4425 | } | 4425 | } |
| 4426 | 4426 | ||
| 4427 | static const struct drm_i915_gem_object_ops i915_gem_object_ops = { | 4427 | static const struct drm_i915_gem_object_ops i915_gem_object_ops = { |
| 4428 | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE, | ||
| 4428 | .get_pages = i915_gem_object_get_pages_gtt, | 4429 | .get_pages = i915_gem_object_get_pages_gtt, |
| 4429 | .put_pages = i915_gem_object_put_pages_gtt, | 4430 | .put_pages = i915_gem_object_put_pages_gtt, |
| 4430 | }; | 4431 | }; |
| @@ -5261,7 +5262,7 @@ i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, int n) | |||
| 5261 | struct page *page; | 5262 | struct page *page; |
| 5262 | 5263 | ||
| 5263 | /* Only default objects have per-page dirty tracking */ | 5264 | /* Only default objects have per-page dirty tracking */ |
| 5264 | if (WARN_ON(obj->ops != &i915_gem_object_ops)) | 5265 | if (WARN_ON((obj->ops->flags & I915_GEM_OBJECT_HAS_STRUCT_PAGE) == 0)) |
| 5265 | return NULL; | 5266 | return NULL; |
| 5266 | 5267 | ||
| 5267 | page = i915_gem_object_get_page(obj, n); | 5268 | page = i915_gem_object_get_page(obj, n); |
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index 19fb0bddc1cd..59e45b3a6937 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c | |||
| @@ -789,9 +789,10 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) | |||
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { | 791 | static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { |
| 792 | .dmabuf_export = i915_gem_userptr_dmabuf_export, | 792 | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE, |
| 793 | .get_pages = i915_gem_userptr_get_pages, | 793 | .get_pages = i915_gem_userptr_get_pages, |
| 794 | .put_pages = i915_gem_userptr_put_pages, | 794 | .put_pages = i915_gem_userptr_put_pages, |
| 795 | .dmabuf_export = i915_gem_userptr_dmabuf_export, | ||
| 795 | .release = i915_gem_userptr_release, | 796 | .release = i915_gem_userptr_release, |
| 796 | }; | 797 | }; |
| 797 | 798 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 007ae83a4086..b9a564b76528 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -7514,7 +7514,7 @@ enum skl_disp_power_wells { | |||
| 7514 | #define DPLL_CFGCR2_PDIV_7 (4<<2) | 7514 | #define DPLL_CFGCR2_PDIV_7 (4<<2) |
| 7515 | #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3) | 7515 | #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3) |
| 7516 | 7516 | ||
| 7517 | #define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR2) | 7517 | #define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR1) |
| 7518 | #define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2) | 7518 | #define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2) |
| 7519 | 7519 | ||
| 7520 | /* BXT display engine PLL */ | 7520 | /* BXT display engine PLL */ |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index a2aa09ce3202..a8af594fbd00 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
| @@ -49,7 +49,7 @@ static void i915_save_display(struct drm_device *dev) | |||
| 49 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); | 49 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); |
| 50 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); | 50 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); |
| 51 | dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); | 51 | dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); |
| 52 | } else if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { | 52 | } else if (INTEL_INFO(dev)->gen <= 4) { |
| 53 | dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL); | 53 | dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL); |
| 54 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | 54 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); |
| 55 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | 55 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); |
| @@ -84,7 +84,7 @@ static void i915_restore_display(struct drm_device *dev) | |||
| 84 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); | 84 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); |
| 85 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); | 85 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); |
| 86 | I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL); | 86 | I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL); |
| 87 | } else if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { | 87 | } else if (INTEL_INFO(dev)->gen <= 4) { |
| 88 | I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS); | 88 | I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS); |
| 89 | I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); | 89 | I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); |
| 90 | I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); | 90 | I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index e6408e5583d7..54a165b9c92d 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
| @@ -1589,7 +1589,8 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc, | |||
| 1589 | DPLL_CFGCR2_KDIV(wrpll_params.kdiv) | | 1589 | DPLL_CFGCR2_KDIV(wrpll_params.kdiv) | |
| 1590 | DPLL_CFGCR2_PDIV(wrpll_params.pdiv) | | 1590 | DPLL_CFGCR2_PDIV(wrpll_params.pdiv) | |
| 1591 | wrpll_params.central_freq; | 1591 | wrpll_params.central_freq; |
| 1592 | } else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) { | 1592 | } else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT || |
| 1593 | intel_encoder->type == INTEL_OUTPUT_DP_MST) { | ||
| 1593 | switch (crtc_state->port_clock / 2) { | 1594 | switch (crtc_state->port_clock / 2) { |
| 1594 | case 81000: | 1595 | case 81000: |
| 1595 | ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0); | 1596 | ctrl1 |= DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_810, 0); |
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 88887938e0bf..0b8eefc2acc5 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c | |||
| @@ -215,27 +215,46 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) | |||
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | static void | 218 | /* |
| 219 | intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) | 219 | * Pick training pattern for channel equalization. Training Pattern 3 for HBR2 |
| 220 | * or 1.2 devices that support it, Training Pattern 2 otherwise. | ||
| 221 | */ | ||
| 222 | static u32 intel_dp_training_pattern(struct intel_dp *intel_dp) | ||
| 220 | { | 223 | { |
| 221 | bool channel_eq = false; | 224 | u32 training_pattern = DP_TRAINING_PATTERN_2; |
| 222 | int tries, cr_tries; | 225 | bool source_tps3, sink_tps3; |
| 223 | uint32_t training_pattern = DP_TRAINING_PATTERN_2; | ||
| 224 | 226 | ||
| 225 | /* | 227 | /* |
| 226 | * Training Pattern 3 for HBR2 or 1.2 devices that support it. | ||
| 227 | * | ||
| 228 | * Intel platforms that support HBR2 also support TPS3. TPS3 support is | 228 | * Intel platforms that support HBR2 also support TPS3. TPS3 support is |
| 229 | * also mandatory for downstream devices that support HBR2. | 229 | * also mandatory for downstream devices that support HBR2. However, not |
| 230 | * all sinks follow the spec. | ||
| 230 | * | 231 | * |
| 231 | * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is | 232 | * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is |
| 232 | * supported but still not enabled. | 233 | * supported in source but still not enabled. |
| 233 | */ | 234 | */ |
| 234 | if (intel_dp_source_supports_hbr2(intel_dp) && | 235 | source_tps3 = intel_dp_source_supports_hbr2(intel_dp); |
| 235 | drm_dp_tps3_supported(intel_dp->dpcd)) | 236 | sink_tps3 = drm_dp_tps3_supported(intel_dp->dpcd); |
| 237 | |||
| 238 | if (source_tps3 && sink_tps3) { | ||
| 236 | training_pattern = DP_TRAINING_PATTERN_3; | 239 | training_pattern = DP_TRAINING_PATTERN_3; |
| 237 | else if (intel_dp->link_rate == 540000) | 240 | } else if (intel_dp->link_rate == 540000) { |
| 238 | DRM_ERROR("5.4 Gbps link rate without HBR2/TPS3 support\n"); | 241 | if (!source_tps3) |
| 242 | DRM_DEBUG_KMS("5.4 Gbps link rate without source HBR2/TPS3 support\n"); | ||
| 243 | if (!sink_tps3) | ||
| 244 | DRM_DEBUG_KMS("5.4 Gbps link rate without sink TPS3 support\n"); | ||
| 245 | } | ||
| 246 | |||
| 247 | return training_pattern; | ||
| 248 | } | ||
| 249 | |||
| 250 | static void | ||
| 251 | intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) | ||
| 252 | { | ||
| 253 | bool channel_eq = false; | ||
| 254 | int tries, cr_tries; | ||
| 255 | u32 training_pattern; | ||
| 256 | |||
| 257 | training_pattern = intel_dp_training_pattern(intel_dp); | ||
| 239 | 258 | ||
| 240 | /* channel equalization */ | 259 | /* channel equalization */ |
| 241 | if (!intel_dp_set_link_train(intel_dp, | 260 | if (!intel_dp_set_link_train(intel_dp, |
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c index a5e99ac305da..e8113ad65477 100644 --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | |||
| @@ -204,10 +204,28 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data) | |||
| 204 | struct drm_device *dev = intel_dsi->base.base.dev; | 204 | struct drm_device *dev = intel_dsi->base.base.dev; |
| 205 | struct drm_i915_private *dev_priv = dev->dev_private; | 205 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 206 | 206 | ||
| 207 | if (dev_priv->vbt.dsi.seq_version >= 3) | ||
| 208 | data++; | ||
| 209 | |||
| 207 | gpio = *data++; | 210 | gpio = *data++; |
| 208 | 211 | ||
| 209 | /* pull up/down */ | 212 | /* pull up/down */ |
| 210 | action = *data++; | 213 | action = *data++ & 1; |
| 214 | |||
| 215 | if (gpio >= ARRAY_SIZE(gtable)) { | ||
| 216 | DRM_DEBUG_KMS("unknown gpio %u\n", gpio); | ||
| 217 | goto out; | ||
| 218 | } | ||
| 219 | |||
| 220 | if (!IS_VALLEYVIEW(dev_priv)) { | ||
| 221 | DRM_DEBUG_KMS("GPIO element not supported on this platform\n"); | ||
| 222 | goto out; | ||
| 223 | } | ||
| 224 | |||
| 225 | if (dev_priv->vbt.dsi.seq_version >= 3) { | ||
| 226 | DRM_DEBUG_KMS("GPIO element v3 not supported\n"); | ||
| 227 | goto out; | ||
| 228 | } | ||
| 211 | 229 | ||
| 212 | function = gtable[gpio].function_reg; | 230 | function = gtable[gpio].function_reg; |
| 213 | pad = gtable[gpio].pad_reg; | 231 | pad = gtable[gpio].pad_reg; |
| @@ -226,6 +244,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data) | |||
| 226 | vlv_gpio_nc_write(dev_priv, pad, val); | 244 | vlv_gpio_nc_write(dev_priv, pad, val); |
| 227 | mutex_unlock(&dev_priv->sb_lock); | 245 | mutex_unlock(&dev_priv->sb_lock); |
| 228 | 246 | ||
| 247 | out: | ||
| 229 | return data; | 248 | return data; |
| 230 | } | 249 | } |
| 231 | 250 | ||
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 25254b5c1ac5..deb8282c26d8 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
| @@ -683,7 +683,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
| 683 | return 0; | 683 | return 0; |
| 684 | 684 | ||
| 685 | err: | 685 | err: |
| 686 | while (--pin) { | 686 | while (pin--) { |
| 687 | if (!intel_gmbus_is_valid_pin(dev_priv, pin)) | 687 | if (!intel_gmbus_is_valid_pin(dev_priv, pin)) |
| 688 | continue; | 688 | continue; |
| 689 | 689 | ||
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index eb5fa05cf476..a234687792f0 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
| @@ -1783,16 +1783,20 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate, | |||
| 1783 | const struct intel_plane_state *pstate, | 1783 | const struct intel_plane_state *pstate, |
| 1784 | uint32_t mem_value) | 1784 | uint32_t mem_value) |
| 1785 | { | 1785 | { |
| 1786 | int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; | 1786 | /* |
| 1787 | * We treat the cursor plane as always-on for the purposes of watermark | ||
| 1788 | * calculation. Until we have two-stage watermark programming merged, | ||
| 1789 | * this is necessary to avoid flickering. | ||
| 1790 | */ | ||
| 1791 | int cpp = 4; | ||
| 1792 | int width = pstate->visible ? pstate->base.crtc_w : 64; | ||
| 1787 | 1793 | ||
| 1788 | if (!cstate->base.active || !pstate->visible) | 1794 | if (!cstate->base.active) |
| 1789 | return 0; | 1795 | return 0; |
| 1790 | 1796 | ||
| 1791 | return ilk_wm_method2(ilk_pipe_pixel_rate(cstate), | 1797 | return ilk_wm_method2(ilk_pipe_pixel_rate(cstate), |
| 1792 | cstate->base.adjusted_mode.crtc_htotal, | 1798 | cstate->base.adjusted_mode.crtc_htotal, |
| 1793 | drm_rect_width(&pstate->dst), | 1799 | width, cpp, mem_value); |
| 1794 | bpp, | ||
| 1795 | mem_value); | ||
| 1796 | } | 1800 | } |
| 1797 | 1801 | ||
| 1798 | /* Only for WM_LP. */ | 1802 | /* Only for WM_LP. */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 24be27d3cd18..20935eb2a09e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -635,10 +635,6 @@ nouveau_display_resume(struct drm_device *dev, bool runtime) | |||
| 635 | nv_crtc->lut.depth = 0; | 635 | nv_crtc->lut.depth = 0; |
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | /* Make sure that drm and hw vblank irqs get resumed if needed. */ | ||
| 639 | for (head = 0; head < dev->mode_config.num_crtc; head++) | ||
| 640 | drm_vblank_on(dev, head); | ||
| 641 | |||
| 642 | /* This should ensure we don't hit a locking problem when someone | 638 | /* This should ensure we don't hit a locking problem when someone |
| 643 | * wakes us up via a connector. We should never go into suspend | 639 | * wakes us up via a connector. We should never go into suspend |
| 644 | * while the display is on anyways. | 640 | * while the display is on anyways. |
| @@ -648,6 +644,10 @@ nouveau_display_resume(struct drm_device *dev, bool runtime) | |||
| 648 | 644 | ||
| 649 | drm_helper_resume_force_mode(dev); | 645 | drm_helper_resume_force_mode(dev); |
| 650 | 646 | ||
| 647 | /* Make sure that drm and hw vblank irqs get resumed if needed. */ | ||
| 648 | for (head = 0; head < dev->mode_config.num_crtc; head++) | ||
| 649 | drm_vblank_on(dev, head); | ||
| 650 | |||
| 651 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 651 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
| 652 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 652 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
| 653 | 653 | ||
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index 2ae8577497ca..7c2e78201ead 100644 --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c | |||
| @@ -168,7 +168,8 @@ static int qxl_process_single_command(struct qxl_device *qdev, | |||
| 168 | cmd->command_size)) | 168 | cmd->command_size)) |
| 169 | return -EFAULT; | 169 | return -EFAULT; |
| 170 | 170 | ||
| 171 | reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL); | 171 | reloc_info = kmalloc_array(cmd->relocs_num, |
| 172 | sizeof(struct qxl_reloc_info), GFP_KERNEL); | ||
| 172 | if (!reloc_info) | 173 | if (!reloc_info) |
| 173 | return -ENOMEM; | 174 | return -ENOMEM; |
| 174 | 175 | ||
diff --git a/drivers/gpu/drm/qxl/qxl_prime.c b/drivers/gpu/drm/qxl/qxl_prime.c index 3d031b50a8fd..9f029dda1f07 100644 --- a/drivers/gpu/drm/qxl/qxl_prime.c +++ b/drivers/gpu/drm/qxl/qxl_prime.c | |||
| @@ -68,5 +68,5 @@ int qxl_gem_prime_mmap(struct drm_gem_object *obj, | |||
| 68 | struct vm_area_struct *area) | 68 | struct vm_area_struct *area) |
| 69 | { | 69 | { |
| 70 | WARN_ONCE(1, "not implemented"); | 70 | WARN_ONCE(1, "not implemented"); |
| 71 | return ENOSYS; | 71 | return -ENOSYS; |
| 72 | } | 72 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 460c8f2989da..248c5a9fb0b6 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -276,8 +276,12 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) | |||
| 276 | if (rdev->irq.installed) { | 276 | if (rdev->irq.installed) { |
| 277 | for (i = 0; i < rdev->num_crtc; i++) { | 277 | for (i = 0; i < rdev->num_crtc; i++) { |
| 278 | if (rdev->pm.active_crtcs & (1 << i)) { | 278 | if (rdev->pm.active_crtcs & (1 << i)) { |
| 279 | rdev->pm.req_vblank |= (1 << i); | 279 | /* This can fail if a modeset is in progress */ |
| 280 | drm_vblank_get(rdev->ddev, i); | 280 | if (drm_vblank_get(rdev->ddev, i) == 0) |
| 281 | rdev->pm.req_vblank |= (1 << i); | ||
| 282 | else | ||
| 283 | DRM_DEBUG_DRIVER("crtc %d no vblank, can glitch\n", | ||
| 284 | i); | ||
| 281 | } | 285 | } |
| 282 | } | 286 | } |
| 283 | } | 287 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index c507896aca45..197b157b73d0 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c | |||
| @@ -349,8 +349,13 @@ int radeon_sa_bo_new(struct radeon_device *rdev, | |||
| 349 | /* see if we can skip over some allocations */ | 349 | /* see if we can skip over some allocations */ |
| 350 | } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); | 350 | } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); |
| 351 | 351 | ||
| 352 | for (i = 0; i < RADEON_NUM_RINGS; ++i) | ||
| 353 | radeon_fence_ref(fences[i]); | ||
| 354 | |||
| 352 | spin_unlock(&sa_manager->wq.lock); | 355 | spin_unlock(&sa_manager->wq.lock); |
| 353 | r = radeon_fence_wait_any(rdev, fences, false); | 356 | r = radeon_fence_wait_any(rdev, fences, false); |
| 357 | for (i = 0; i < RADEON_NUM_RINGS; ++i) | ||
| 358 | radeon_fence_unref(&fences[i]); | ||
| 354 | spin_lock(&sa_manager->wq.lock); | 359 | spin_lock(&sa_manager->wq.lock); |
| 355 | /* if we have nothing to wait for block */ | 360 | /* if we have nothing to wait for block */ |
| 356 | if (r == -ENOENT) { | 361 | if (r == -ENOENT) { |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 3de93517efe4..14606afbfaa8 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
| @@ -336,7 +336,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p, | |||
| 336 | union ib_gid gid; | 336 | union ib_gid gid; |
| 337 | struct ib_gid_attr gid_attr = {}; | 337 | struct ib_gid_attr gid_attr = {}; |
| 338 | ssize_t ret; | 338 | ssize_t ret; |
| 339 | va_list args; | ||
| 340 | 339 | ||
| 341 | ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid, | 340 | ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid, |
| 342 | &gid_attr); | 341 | &gid_attr); |
| @@ -348,7 +347,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p, | |||
| 348 | err: | 347 | err: |
| 349 | if (gid_attr.ndev) | 348 | if (gid_attr.ndev) |
| 350 | dev_put(gid_attr.ndev); | 349 | dev_put(gid_attr.ndev); |
| 351 | va_end(args); | ||
| 352 | return ret; | 350 | return ret; |
| 353 | } | 351 | } |
| 354 | 352 | ||
| @@ -722,12 +720,11 @@ static struct attribute_group *get_counter_table(struct ib_device *dev, | |||
| 722 | 720 | ||
| 723 | if (get_perf_mad(dev, port_num, IB_PMA_CLASS_PORT_INFO, | 721 | if (get_perf_mad(dev, port_num, IB_PMA_CLASS_PORT_INFO, |
| 724 | &cpi, 40, sizeof(cpi)) >= 0) { | 722 | &cpi, 40, sizeof(cpi)) >= 0) { |
| 725 | 723 | if (cpi.capability_mask & IB_PMA_CLASS_CAP_EXT_WIDTH) | |
| 726 | if (cpi.capability_mask && IB_PMA_CLASS_CAP_EXT_WIDTH) | ||
| 727 | /* We have extended counters */ | 724 | /* We have extended counters */ |
| 728 | return &pma_group_ext; | 725 | return &pma_group_ext; |
| 729 | 726 | ||
| 730 | if (cpi.capability_mask && IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF) | 727 | if (cpi.capability_mask & IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF) |
| 731 | /* But not the IETF ones */ | 728 | /* But not the IETF ones */ |
| 732 | return &pma_group_noietf; | 729 | return &pma_group_noietf; |
| 733 | } | 730 | } |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 9116bc3988a6..34cb8e87c7b8 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -270,8 +270,10 @@ static int sq_overhead(enum ib_qp_type qp_type) | |||
| 270 | /* fall through */ | 270 | /* fall through */ |
| 271 | case IB_QPT_RC: | 271 | case IB_QPT_RC: |
| 272 | size += sizeof(struct mlx5_wqe_ctrl_seg) + | 272 | size += sizeof(struct mlx5_wqe_ctrl_seg) + |
| 273 | sizeof(struct mlx5_wqe_atomic_seg) + | 273 | max(sizeof(struct mlx5_wqe_atomic_seg) + |
| 274 | sizeof(struct mlx5_wqe_raddr_seg); | 274 | sizeof(struct mlx5_wqe_raddr_seg), |
| 275 | sizeof(struct mlx5_wqe_umr_ctrl_seg) + | ||
| 276 | sizeof(struct mlx5_mkey_seg)); | ||
| 275 | break; | 277 | break; |
| 276 | 278 | ||
| 277 | case IB_QPT_XRC_TGT: | 279 | case IB_QPT_XRC_TGT: |
| @@ -279,9 +281,9 @@ static int sq_overhead(enum ib_qp_type qp_type) | |||
| 279 | 281 | ||
| 280 | case IB_QPT_UC: | 282 | case IB_QPT_UC: |
| 281 | size += sizeof(struct mlx5_wqe_ctrl_seg) + | 283 | size += sizeof(struct mlx5_wqe_ctrl_seg) + |
| 282 | sizeof(struct mlx5_wqe_raddr_seg) + | 284 | max(sizeof(struct mlx5_wqe_raddr_seg), |
| 283 | sizeof(struct mlx5_wqe_umr_ctrl_seg) + | 285 | sizeof(struct mlx5_wqe_umr_ctrl_seg) + |
| 284 | sizeof(struct mlx5_mkey_seg); | 286 | sizeof(struct mlx5_mkey_seg)); |
| 285 | break; | 287 | break; |
| 286 | 288 | ||
| 287 | case IB_QPT_UD: | 289 | case IB_QPT_UD: |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 573849354cb9..f38743018cb4 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
| @@ -228,6 +228,11 @@ static int ocrdma_alloc_resources(struct ocrdma_dev *dev) | |||
| 228 | 228 | ||
| 229 | ocrdma_alloc_pd_pool(dev); | 229 | ocrdma_alloc_pd_pool(dev); |
| 230 | 230 | ||
| 231 | if (!ocrdma_alloc_stats_resources(dev)) { | ||
| 232 | pr_err("%s: stats resource allocation failed\n", __func__); | ||
| 233 | goto alloc_err; | ||
| 234 | } | ||
| 235 | |||
| 231 | spin_lock_init(&dev->av_tbl.lock); | 236 | spin_lock_init(&dev->av_tbl.lock); |
| 232 | spin_lock_init(&dev->flush_q_lock); | 237 | spin_lock_init(&dev->flush_q_lock); |
| 233 | return 0; | 238 | return 0; |
| @@ -238,6 +243,7 @@ alloc_err: | |||
| 238 | 243 | ||
| 239 | static void ocrdma_free_resources(struct ocrdma_dev *dev) | 244 | static void ocrdma_free_resources(struct ocrdma_dev *dev) |
| 240 | { | 245 | { |
| 246 | ocrdma_release_stats_resources(dev); | ||
| 241 | kfree(dev->stag_arr); | 247 | kfree(dev->stag_arr); |
| 242 | kfree(dev->qp_tbl); | 248 | kfree(dev->qp_tbl); |
| 243 | kfree(dev->cq_tbl); | 249 | kfree(dev->cq_tbl); |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c index 86c303a620c1..255f774080a4 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c | |||
| @@ -64,10 +64,11 @@ static int ocrdma_add_stat(char *start, char *pcur, | |||
| 64 | return cpy_len; | 64 | return cpy_len; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev) | 67 | bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev) |
| 68 | { | 68 | { |
| 69 | struct stats_mem *mem = &dev->stats_mem; | 69 | struct stats_mem *mem = &dev->stats_mem; |
| 70 | 70 | ||
| 71 | mutex_init(&dev->stats_lock); | ||
| 71 | /* Alloc mbox command mem*/ | 72 | /* Alloc mbox command mem*/ |
| 72 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), | 73 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), |
| 73 | sizeof(struct ocrdma_rdma_stats_resp)); | 74 | sizeof(struct ocrdma_rdma_stats_resp)); |
| @@ -91,13 +92,14 @@ static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev) | |||
| 91 | return true; | 92 | return true; |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | static void ocrdma_release_stats_mem(struct ocrdma_dev *dev) | 95 | void ocrdma_release_stats_resources(struct ocrdma_dev *dev) |
| 95 | { | 96 | { |
| 96 | struct stats_mem *mem = &dev->stats_mem; | 97 | struct stats_mem *mem = &dev->stats_mem; |
| 97 | 98 | ||
| 98 | if (mem->va) | 99 | if (mem->va) |
| 99 | dma_free_coherent(&dev->nic_info.pdev->dev, mem->size, | 100 | dma_free_coherent(&dev->nic_info.pdev->dev, mem->size, |
| 100 | mem->va, mem->pa); | 101 | mem->va, mem->pa); |
| 102 | mem->va = NULL; | ||
| 101 | kfree(mem->debugfs_mem); | 103 | kfree(mem->debugfs_mem); |
| 102 | } | 104 | } |
| 103 | 105 | ||
| @@ -838,15 +840,9 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev) | |||
| 838 | &dev->reset_stats, &ocrdma_dbg_ops)) | 840 | &dev->reset_stats, &ocrdma_dbg_ops)) |
| 839 | goto err; | 841 | goto err; |
| 840 | 842 | ||
| 841 | /* Now create dma_mem for stats mbx command */ | ||
| 842 | if (!ocrdma_alloc_stats_mem(dev)) | ||
| 843 | goto err; | ||
| 844 | |||
| 845 | mutex_init(&dev->stats_lock); | ||
| 846 | 843 | ||
| 847 | return; | 844 | return; |
| 848 | err: | 845 | err: |
| 849 | ocrdma_release_stats_mem(dev); | ||
| 850 | debugfs_remove_recursive(dev->dir); | 846 | debugfs_remove_recursive(dev->dir); |
| 851 | dev->dir = NULL; | 847 | dev->dir = NULL; |
| 852 | } | 848 | } |
| @@ -855,9 +851,7 @@ void ocrdma_rem_port_stats(struct ocrdma_dev *dev) | |||
| 855 | { | 851 | { |
| 856 | if (!dev->dir) | 852 | if (!dev->dir) |
| 857 | return; | 853 | return; |
| 858 | debugfs_remove(dev->dir); | 854 | debugfs_remove_recursive(dev->dir); |
| 859 | mutex_destroy(&dev->stats_lock); | ||
| 860 | ocrdma_release_stats_mem(dev); | ||
| 861 | } | 855 | } |
| 862 | 856 | ||
| 863 | void ocrdma_init_debugfs(void) | 857 | void ocrdma_init_debugfs(void) |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.h b/drivers/infiniband/hw/ocrdma/ocrdma_stats.h index c9e58d04c7b8..bba1fec4f11f 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.h | |||
| @@ -65,6 +65,8 @@ enum OCRDMA_STATS_TYPE { | |||
| 65 | 65 | ||
| 66 | void ocrdma_rem_debugfs(void); | 66 | void ocrdma_rem_debugfs(void); |
| 67 | void ocrdma_init_debugfs(void); | 67 | void ocrdma_init_debugfs(void); |
| 68 | bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev); | ||
| 69 | void ocrdma_release_stats_resources(struct ocrdma_dev *dev); | ||
| 68 | void ocrdma_rem_port_stats(struct ocrdma_dev *dev); | 70 | void ocrdma_rem_port_stats(struct ocrdma_dev *dev); |
| 69 | void ocrdma_add_port_stats(struct ocrdma_dev *dev); | 71 | void ocrdma_add_port_stats(struct ocrdma_dev *dev); |
| 70 | int ocrdma_pma_counters(struct ocrdma_dev *dev, | 72 | int ocrdma_pma_counters(struct ocrdma_dev *dev, |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index d4c687b548d8..37620b4baafb 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
| @@ -125,8 +125,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr, | |||
| 125 | IB_DEVICE_SYS_IMAGE_GUID | | 125 | IB_DEVICE_SYS_IMAGE_GUID | |
| 126 | IB_DEVICE_LOCAL_DMA_LKEY | | 126 | IB_DEVICE_LOCAL_DMA_LKEY | |
| 127 | IB_DEVICE_MEM_MGT_EXTENSIONS; | 127 | IB_DEVICE_MEM_MGT_EXTENSIONS; |
| 128 | attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_srq_sge); | 128 | attr->max_sge = dev->attr.max_send_sge; |
| 129 | attr->max_sge_rd = 0; | 129 | attr->max_sge_rd = attr->max_sge; |
| 130 | attr->max_cq = dev->attr.max_cq; | 130 | attr->max_cq = dev->attr.max_cq; |
| 131 | attr->max_cqe = dev->attr.max_cqe; | 131 | attr->max_cqe = dev->attr.max_cqe; |
| 132 | attr->max_mr = dev->attr.max_mr; | 132 | attr->max_mr = dev->attr.max_mr; |
| @@ -2726,8 +2726,7 @@ static int ocrdma_update_ud_rcqe(struct ib_wc *ibwc, struct ocrdma_cqe *cqe) | |||
| 2726 | OCRDMA_CQE_UD_STATUS_MASK) >> OCRDMA_CQE_UD_STATUS_SHIFT; | 2726 | OCRDMA_CQE_UD_STATUS_MASK) >> OCRDMA_CQE_UD_STATUS_SHIFT; |
| 2727 | ibwc->src_qp = le32_to_cpu(cqe->flags_status_srcqpn) & | 2727 | ibwc->src_qp = le32_to_cpu(cqe->flags_status_srcqpn) & |
| 2728 | OCRDMA_CQE_SRCQP_MASK; | 2728 | OCRDMA_CQE_SRCQP_MASK; |
| 2729 | ibwc->pkey_index = le32_to_cpu(cqe->ud.rxlen_pkey) & | 2729 | ibwc->pkey_index = 0; |
| 2730 | OCRDMA_CQE_PKEY_MASK; | ||
| 2731 | ibwc->wc_flags = IB_WC_GRH; | 2730 | ibwc->wc_flags = IB_WC_GRH; |
| 2732 | ibwc->byte_len = (le32_to_cpu(cqe->ud.rxlen_pkey) >> | 2731 | ibwc->byte_len = (le32_to_cpu(cqe->ud.rxlen_pkey) >> |
| 2733 | OCRDMA_CQE_UD_XFER_LEN_SHIFT); | 2732 | OCRDMA_CQE_UD_XFER_LEN_SHIFT); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 5ea0c14070d1..fa9c42ff1fb0 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -245,8 +245,6 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
| 245 | skb_reset_mac_header(skb); | 245 | skb_reset_mac_header(skb); |
| 246 | skb_pull(skb, IPOIB_ENCAP_LEN); | 246 | skb_pull(skb, IPOIB_ENCAP_LEN); |
| 247 | 247 | ||
| 248 | skb->truesize = SKB_TRUESIZE(skb->len); | ||
| 249 | |||
| 250 | ++dev->stats.rx_packets; | 248 | ++dev->stats.rx_packets; |
| 251 | dev->stats.rx_bytes += skb->len; | 249 | dev->stats.rx_bytes += skb->len; |
| 252 | 250 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 050dfa175d16..25889311b1e9 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -456,7 +456,10 @@ out_locked: | |||
| 456 | return status; | 456 | return status; |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) | 459 | /* |
| 460 | * Caller must hold 'priv->lock' | ||
| 461 | */ | ||
| 462 | static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) | ||
| 460 | { | 463 | { |
| 461 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 464 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 462 | struct ib_sa_multicast *multicast; | 465 | struct ib_sa_multicast *multicast; |
| @@ -466,6 +469,10 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) | |||
| 466 | ib_sa_comp_mask comp_mask; | 469 | ib_sa_comp_mask comp_mask; |
| 467 | int ret = 0; | 470 | int ret = 0; |
| 468 | 471 | ||
| 472 | if (!priv->broadcast || | ||
| 473 | !test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | ||
| 474 | return -EINVAL; | ||
| 475 | |||
| 469 | ipoib_dbg_mcast(priv, "joining MGID %pI6\n", mcast->mcmember.mgid.raw); | 476 | ipoib_dbg_mcast(priv, "joining MGID %pI6\n", mcast->mcmember.mgid.raw); |
| 470 | 477 | ||
| 471 | rec.mgid = mcast->mcmember.mgid; | 478 | rec.mgid = mcast->mcmember.mgid; |
| @@ -525,20 +532,23 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) | |||
| 525 | rec.join_state = 4; | 532 | rec.join_state = 4; |
| 526 | #endif | 533 | #endif |
| 527 | } | 534 | } |
| 535 | spin_unlock_irq(&priv->lock); | ||
| 528 | 536 | ||
| 529 | multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, | 537 | multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, |
| 530 | &rec, comp_mask, GFP_KERNEL, | 538 | &rec, comp_mask, GFP_KERNEL, |
| 531 | ipoib_mcast_join_complete, mcast); | 539 | ipoib_mcast_join_complete, mcast); |
| 540 | spin_lock_irq(&priv->lock); | ||
| 532 | if (IS_ERR(multicast)) { | 541 | if (IS_ERR(multicast)) { |
| 533 | ret = PTR_ERR(multicast); | 542 | ret = PTR_ERR(multicast); |
| 534 | ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); | 543 | ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); |
| 535 | spin_lock_irq(&priv->lock); | ||
| 536 | /* Requeue this join task with a backoff delay */ | 544 | /* Requeue this join task with a backoff delay */ |
| 537 | __ipoib_mcast_schedule_join_thread(priv, mcast, 1); | 545 | __ipoib_mcast_schedule_join_thread(priv, mcast, 1); |
| 538 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); | 546 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
| 539 | spin_unlock_irq(&priv->lock); | 547 | spin_unlock_irq(&priv->lock); |
| 540 | complete(&mcast->done); | 548 | complete(&mcast->done); |
| 549 | spin_lock_irq(&priv->lock); | ||
| 541 | } | 550 | } |
| 551 | return 0; | ||
| 542 | } | 552 | } |
| 543 | 553 | ||
| 544 | void ipoib_mcast_join_task(struct work_struct *work) | 554 | void ipoib_mcast_join_task(struct work_struct *work) |
| @@ -620,9 +630,10 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
| 620 | /* Found the next unjoined group */ | 630 | /* Found the next unjoined group */ |
| 621 | init_completion(&mcast->done); | 631 | init_completion(&mcast->done); |
| 622 | set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); | 632 | set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
| 623 | spin_unlock_irq(&priv->lock); | 633 | if (ipoib_mcast_join(dev, mcast)) { |
| 624 | ipoib_mcast_join(dev, mcast); | 634 | spin_unlock_irq(&priv->lock); |
| 625 | spin_lock_irq(&priv->lock); | 635 | return; |
| 636 | } | ||
| 626 | } else if (!delay_until || | 637 | } else if (!delay_until || |
| 627 | time_before(mcast->delay_until, delay_until)) | 638 | time_before(mcast->delay_until, delay_until)) |
| 628 | delay_until = mcast->delay_until; | 639 | delay_until = mcast->delay_until; |
| @@ -641,10 +652,9 @@ out: | |||
| 641 | if (mcast) { | 652 | if (mcast) { |
| 642 | init_completion(&mcast->done); | 653 | init_completion(&mcast->done); |
| 643 | set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); | 654 | set_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
| 655 | ipoib_mcast_join(dev, mcast); | ||
| 644 | } | 656 | } |
| 645 | spin_unlock_irq(&priv->lock); | 657 | spin_unlock_irq(&priv->lock); |
| 646 | if (mcast) | ||
| 647 | ipoib_mcast_join(dev, mcast); | ||
| 648 | } | 658 | } |
| 649 | 659 | ||
| 650 | int ipoib_mcast_start_thread(struct net_device *dev) | 660 | int ipoib_mcast_start_thread(struct net_device *dev) |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 6727954ab74b..e8a84d12b7ff 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -1207,7 +1207,6 @@ static void xpad_led_disconnect(struct usb_xpad *xpad) | |||
| 1207 | #else | 1207 | #else |
| 1208 | static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } | 1208 | static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } |
| 1209 | static void xpad_led_disconnect(struct usb_xpad *xpad) { } | 1209 | static void xpad_led_disconnect(struct usb_xpad *xpad) { } |
| 1210 | static void xpad_identify_controller(struct usb_xpad *xpad) { } | ||
| 1211 | #endif | 1210 | #endif |
| 1212 | 1211 | ||
| 1213 | static int xpad_start_input(struct usb_xpad *xpad) | 1212 | static int xpad_start_input(struct usb_xpad *xpad) |
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4d446d5085aa..c01a1d648f9f 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c | |||
| @@ -235,7 +235,7 @@ struct adp5589_kpad { | |||
| 235 | unsigned short gpimapsize; | 235 | unsigned short gpimapsize; |
| 236 | unsigned extend_cfg; | 236 | unsigned extend_cfg; |
| 237 | bool is_adp5585; | 237 | bool is_adp5585; |
| 238 | bool adp5585_support_row5; | 238 | bool support_row5; |
| 239 | #ifdef CONFIG_GPIOLIB | 239 | #ifdef CONFIG_GPIOLIB |
| 240 | unsigned char gpiomap[ADP5589_MAXGPIO]; | 240 | unsigned char gpiomap[ADP5589_MAXGPIO]; |
| 241 | bool export_gpio; | 241 | bool export_gpio; |
| @@ -485,7 +485,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, | |||
| 485 | if (kpad->extend_cfg & C4_EXTEND_CFG) | 485 | if (kpad->extend_cfg & C4_EXTEND_CFG) |
| 486 | pin_used[kpad->var->c4_extend_cfg] = true; | 486 | pin_used[kpad->var->c4_extend_cfg] = true; |
| 487 | 487 | ||
| 488 | if (!kpad->adp5585_support_row5) | 488 | if (!kpad->support_row5) |
| 489 | pin_used[5] = true; | 489 | pin_used[5] = true; |
| 490 | 490 | ||
| 491 | for (i = 0; i < kpad->var->maxgpio; i++) | 491 | for (i = 0; i < kpad->var->maxgpio; i++) |
| @@ -884,12 +884,13 @@ static int adp5589_probe(struct i2c_client *client, | |||
| 884 | 884 | ||
| 885 | switch (id->driver_data) { | 885 | switch (id->driver_data) { |
| 886 | case ADP5585_02: | 886 | case ADP5585_02: |
| 887 | kpad->adp5585_support_row5 = true; | 887 | kpad->support_row5 = true; |
| 888 | case ADP5585_01: | 888 | case ADP5585_01: |
| 889 | kpad->is_adp5585 = true; | 889 | kpad->is_adp5585 = true; |
| 890 | kpad->var = &const_adp5585; | 890 | kpad->var = &const_adp5585; |
| 891 | break; | 891 | break; |
| 892 | case ADP5589: | 892 | case ADP5589: |
| 893 | kpad->support_row5 = true; | ||
| 893 | kpad->var = &const_adp5589; | 894 | kpad->var = &const_adp5589; |
| 894 | break; | 895 | break; |
| 895 | } | 896 | } |
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 378db10001df..4401be225d64 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c | |||
| @@ -304,8 +304,10 @@ static int cap11xx_init_leds(struct device *dev, | |||
| 304 | led->cdev.brightness = LED_OFF; | 304 | led->cdev.brightness = LED_OFF; |
| 305 | 305 | ||
| 306 | error = of_property_read_u32(child, "reg", ®); | 306 | error = of_property_read_u32(child, "reg", ®); |
| 307 | if (error != 0 || reg >= num_leds) | 307 | if (error != 0 || reg >= num_leds) { |
| 308 | of_node_put(child); | ||
| 308 | return -EINVAL; | 309 | return -EINVAL; |
| 310 | } | ||
| 309 | 311 | ||
| 310 | led->reg = reg; | 312 | led->reg = reg; |
| 311 | led->priv = priv; | 313 | led->priv = priv; |
| @@ -313,8 +315,10 @@ static int cap11xx_init_leds(struct device *dev, | |||
| 313 | INIT_WORK(&led->work, cap11xx_led_work); | 315 | INIT_WORK(&led->work, cap11xx_led_work); |
| 314 | 316 | ||
| 315 | error = devm_led_classdev_register(dev, &led->cdev); | 317 | error = devm_led_classdev_register(dev, &led->cdev); |
| 316 | if (error) | 318 | if (error) { |
| 319 | of_node_put(child); | ||
| 317 | return error; | 320 | return error; |
| 321 | } | ||
| 318 | 322 | ||
| 319 | priv->num_leds++; | 323 | priv->num_leds++; |
| 320 | led++; | 324 | led++; |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index d6d16fa78281..1f2337abcf2f 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
| @@ -733,7 +733,7 @@ config INPUT_XEN_KBDDEV_FRONTEND | |||
| 733 | module will be called xen-kbdfront. | 733 | module will be called xen-kbdfront. |
| 734 | 734 | ||
| 735 | config INPUT_SIRFSOC_ONKEY | 735 | config INPUT_SIRFSOC_ONKEY |
| 736 | bool "CSR SiRFSoC power on/off/suspend key support" | 736 | tristate "CSR SiRFSoC power on/off/suspend key support" |
| 737 | depends on ARCH_SIRF && OF | 737 | depends on ARCH_SIRF && OF |
| 738 | default y | 738 | default y |
| 739 | help | 739 | help |
diff --git a/drivers/input/misc/sirfsoc-onkey.c b/drivers/input/misc/sirfsoc-onkey.c index 9d5b89befe6f..ed7237f19539 100644 --- a/drivers/input/misc/sirfsoc-onkey.c +++ b/drivers/input/misc/sirfsoc-onkey.c | |||
| @@ -101,7 +101,7 @@ static void sirfsoc_pwrc_close(struct input_dev *input) | |||
| 101 | static const struct of_device_id sirfsoc_pwrc_of_match[] = { | 101 | static const struct of_device_id sirfsoc_pwrc_of_match[] = { |
| 102 | { .compatible = "sirf,prima2-pwrc" }, | 102 | { .compatible = "sirf,prima2-pwrc" }, |
| 103 | {}, | 103 | {}, |
| 104 | } | 104 | }; |
| 105 | MODULE_DEVICE_TABLE(of, sirfsoc_pwrc_of_match); | 105 | MODULE_DEVICE_TABLE(of, sirfsoc_pwrc_of_match); |
| 106 | 106 | ||
| 107 | static int sirfsoc_pwrc_probe(struct platform_device *pdev) | 107 | static int sirfsoc_pwrc_probe(struct platform_device *pdev) |
diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index e272f06258ce..a3f0f5a47490 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c | |||
| @@ -458,8 +458,6 @@ int vmmouse_init(struct psmouse *psmouse) | |||
| 458 | priv->abs_dev = abs_dev; | 458 | priv->abs_dev = abs_dev; |
| 459 | psmouse->private = priv; | 459 | psmouse->private = priv; |
| 460 | 460 | ||
| 461 | input_set_capability(rel_dev, EV_REL, REL_WHEEL); | ||
| 462 | |||
| 463 | /* Set up and register absolute device */ | 461 | /* Set up and register absolute device */ |
| 464 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", | 462 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", |
| 465 | psmouse->ps2dev.serio->phys); | 463 | psmouse->ps2dev.serio->phys); |
| @@ -475,10 +473,6 @@ int vmmouse_init(struct psmouse *psmouse) | |||
| 475 | abs_dev->id.version = psmouse->model; | 473 | abs_dev->id.version = psmouse->model; |
| 476 | abs_dev->dev.parent = &psmouse->ps2dev.serio->dev; | 474 | abs_dev->dev.parent = &psmouse->ps2dev.serio->dev; |
| 477 | 475 | ||
| 478 | error = input_register_device(priv->abs_dev); | ||
| 479 | if (error) | ||
| 480 | goto init_fail; | ||
| 481 | |||
| 482 | /* Set absolute device capabilities */ | 476 | /* Set absolute device capabilities */ |
| 483 | input_set_capability(abs_dev, EV_KEY, BTN_LEFT); | 477 | input_set_capability(abs_dev, EV_KEY, BTN_LEFT); |
| 484 | input_set_capability(abs_dev, EV_KEY, BTN_RIGHT); | 478 | input_set_capability(abs_dev, EV_KEY, BTN_RIGHT); |
| @@ -488,6 +482,13 @@ int vmmouse_init(struct psmouse *psmouse) | |||
| 488 | input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0); | 482 | input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0); |
| 489 | input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0); | 483 | input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0); |
| 490 | 484 | ||
| 485 | error = input_register_device(priv->abs_dev); | ||
| 486 | if (error) | ||
| 487 | goto init_fail; | ||
| 488 | |||
| 489 | /* Add wheel capability to the relative device */ | ||
| 490 | input_set_capability(rel_dev, EV_REL, REL_WHEEL); | ||
| 491 | |||
| 491 | psmouse->protocol_handler = vmmouse_process_byte; | 492 | psmouse->protocol_handler = vmmouse_process_byte; |
| 492 | psmouse->disconnect = vmmouse_disconnect; | 493 | psmouse->disconnect = vmmouse_disconnect; |
| 493 | psmouse->reconnect = vmmouse_reconnect; | 494 | psmouse->reconnect = vmmouse_reconnect; |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8f828975ab10..1ca7f551e2da 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
| @@ -134,7 +134,7 @@ static void serio_find_driver(struct serio *serio) | |||
| 134 | int error; | 134 | int error; |
| 135 | 135 | ||
| 136 | error = device_attach(&serio->dev); | 136 | error = device_attach(&serio->dev); |
| 137 | if (error < 0) | 137 | if (error < 0 && error != -EPROBE_DEFER) |
| 138 | dev_warn(&serio->dev, | 138 | dev_warn(&serio->dev, |
| 139 | "device_attach() failed for %s (%s), error: %d\n", | 139 | "device_attach() failed for %s (%s), error: %d\n", |
| 140 | serio->phys, serio->name, error); | 140 | serio->phys, serio->name, error); |
diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c index 5d4903a402cc..69828d015d45 100644 --- a/drivers/input/touchscreen/colibri-vf50-ts.c +++ b/drivers/input/touchscreen/colibri-vf50-ts.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
| 22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/of.h> | ||
| 24 | #include <linux/pinctrl/consumer.h> | 25 | #include <linux/pinctrl/consumer.h> |
| 25 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
| 26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 0b0f8c17f3f7..23fbe382da8b 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c | |||
| @@ -822,16 +822,22 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev, | |||
| 822 | int error; | 822 | int error; |
| 823 | 823 | ||
| 824 | error = device_property_read_u32(dev, "threshold", &val); | 824 | error = device_property_read_u32(dev, "threshold", &val); |
| 825 | if (!error) | 825 | if (!error) { |
| 826 | reg_addr->reg_threshold = val; | 826 | edt_ft5x06_register_write(tsdata, reg_addr->reg_threshold, val); |
| 827 | tsdata->threshold = val; | ||
| 828 | } | ||
| 827 | 829 | ||
| 828 | error = device_property_read_u32(dev, "gain", &val); | 830 | error = device_property_read_u32(dev, "gain", &val); |
| 829 | if (!error) | 831 | if (!error) { |
| 830 | reg_addr->reg_gain = val; | 832 | edt_ft5x06_register_write(tsdata, reg_addr->reg_gain, val); |
| 833 | tsdata->gain = val; | ||
| 834 | } | ||
| 831 | 835 | ||
| 832 | error = device_property_read_u32(dev, "offset", &val); | 836 | error = device_property_read_u32(dev, "offset", &val); |
| 833 | if (!error) | 837 | if (!error) { |
| 834 | reg_addr->reg_offset = val; | 838 | edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val); |
| 839 | tsdata->offset = val; | ||
| 840 | } | ||
| 835 | } | 841 | } |
| 836 | 842 | ||
| 837 | static void | 843 | static void |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 62a400c5ba06..fb092f3f11cb 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
| @@ -1353,7 +1353,7 @@ void dmar_disable_qi(struct intel_iommu *iommu) | |||
| 1353 | 1353 | ||
| 1354 | raw_spin_lock_irqsave(&iommu->register_lock, flags); | 1354 | raw_spin_lock_irqsave(&iommu->register_lock, flags); |
| 1355 | 1355 | ||
| 1356 | sts = dmar_readq(iommu->reg + DMAR_GSTS_REG); | 1356 | sts = readl(iommu->reg + DMAR_GSTS_REG); |
| 1357 | if (!(sts & DMA_GSTS_QIES)) | 1357 | if (!(sts & DMA_GSTS_QIES)) |
| 1358 | goto end; | 1358 | goto end; |
| 1359 | 1359 | ||
diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 50464833d0b8..d9939fa9b588 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c | |||
| @@ -249,12 +249,30 @@ static void intel_flush_pasid_dev(struct intel_svm *svm, struct intel_svm_dev *s | |||
| 249 | static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) | 249 | static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) |
| 250 | { | 250 | { |
| 251 | struct intel_svm *svm = container_of(mn, struct intel_svm, notifier); | 251 | struct intel_svm *svm = container_of(mn, struct intel_svm, notifier); |
| 252 | struct intel_svm_dev *sdev; | ||
| 252 | 253 | ||
| 254 | /* This might end up being called from exit_mmap(), *before* the page | ||
| 255 | * tables are cleared. And __mmu_notifier_release() will delete us from | ||
| 256 | * the list of notifiers so that our invalidate_range() callback doesn't | ||
| 257 | * get called when the page tables are cleared. So we need to protect | ||
| 258 | * against hardware accessing those page tables. | ||
| 259 | * | ||
| 260 | * We do it by clearing the entry in the PASID table and then flushing | ||
| 261 | * the IOTLB and the PASID table caches. This might upset hardware; | ||
| 262 | * perhaps we'll want to point the PASID to a dummy PGD (like the zero | ||
| 263 | * page) so that we end up taking a fault that the hardware really | ||
| 264 | * *has* to handle gracefully without affecting other processes. | ||
| 265 | */ | ||
| 253 | svm->iommu->pasid_table[svm->pasid].val = 0; | 266 | svm->iommu->pasid_table[svm->pasid].val = 0; |
| 267 | wmb(); | ||
| 268 | |||
| 269 | rcu_read_lock(); | ||
| 270 | list_for_each_entry_rcu(sdev, &svm->devs, list) { | ||
| 271 | intel_flush_pasid_dev(svm, sdev, svm->pasid); | ||
| 272 | intel_flush_svm_range_dev(svm, sdev, 0, -1, 0, !svm->mm); | ||
| 273 | } | ||
| 274 | rcu_read_unlock(); | ||
| 254 | 275 | ||
| 255 | /* There's no need to do any flush because we can't get here if there | ||
| 256 | * are any devices left anyway. */ | ||
| 257 | WARN_ON(!list_empty(&svm->devs)); | ||
| 258 | } | 276 | } |
| 259 | 277 | ||
| 260 | static const struct mmu_notifier_ops intel_mmuops = { | 278 | static const struct mmu_notifier_ops intel_mmuops = { |
| @@ -379,7 +397,6 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ | |||
| 379 | goto out; | 397 | goto out; |
| 380 | } | 398 | } |
| 381 | iommu->pasid_table[svm->pasid].val = (u64)__pa(mm->pgd) | 1; | 399 | iommu->pasid_table[svm->pasid].val = (u64)__pa(mm->pgd) | 1; |
| 382 | mm = NULL; | ||
| 383 | } else | 400 | } else |
| 384 | iommu->pasid_table[svm->pasid].val = (u64)__pa(init_mm.pgd) | 1 | (1ULL << 11); | 401 | iommu->pasid_table[svm->pasid].val = (u64)__pa(init_mm.pgd) | 1 | (1ULL << 11); |
| 385 | wmb(); | 402 | wmb(); |
| @@ -442,11 +459,11 @@ int intel_svm_unbind_mm(struct device *dev, int pasid) | |||
| 442 | kfree_rcu(sdev, rcu); | 459 | kfree_rcu(sdev, rcu); |
| 443 | 460 | ||
| 444 | if (list_empty(&svm->devs)) { | 461 | if (list_empty(&svm->devs)) { |
| 445 | mmu_notifier_unregister(&svm->notifier, svm->mm); | ||
| 446 | 462 | ||
| 447 | idr_remove(&svm->iommu->pasid_idr, svm->pasid); | 463 | idr_remove(&svm->iommu->pasid_idr, svm->pasid); |
| 448 | if (svm->mm) | 464 | if (svm->mm) |
| 449 | mmput(svm->mm); | 465 | mmu_notifier_unregister(&svm->notifier, svm->mm); |
| 466 | |||
| 450 | /* We mandate that no page faults may be outstanding | 467 | /* We mandate that no page faults may be outstanding |
| 451 | * for the PASID when intel_svm_unbind_mm() is called. | 468 | * for the PASID when intel_svm_unbind_mm() is called. |
| 452 | * If that is not obeyed, subtle errors will happen. | 469 | * If that is not obeyed, subtle errors will happen. |
| @@ -507,6 +524,10 @@ static irqreturn_t prq_event_thread(int irq, void *d) | |||
| 507 | struct intel_svm *svm = NULL; | 524 | struct intel_svm *svm = NULL; |
| 508 | int head, tail, handled = 0; | 525 | int head, tail, handled = 0; |
| 509 | 526 | ||
| 527 | /* Clear PPR bit before reading head/tail registers, to | ||
| 528 | * ensure that we get a new interrupt if needed. */ | ||
| 529 | writel(DMA_PRS_PPR, iommu->reg + DMAR_PRS_REG); | ||
| 530 | |||
| 510 | tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK; | 531 | tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK; |
| 511 | head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK; | 532 | head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK; |
| 512 | while (head != tail) { | 533 | while (head != tail) { |
| @@ -551,6 +572,9 @@ static irqreturn_t prq_event_thread(int irq, void *d) | |||
| 551 | * any faults on kernel addresses. */ | 572 | * any faults on kernel addresses. */ |
| 552 | if (!svm->mm) | 573 | if (!svm->mm) |
| 553 | goto bad_req; | 574 | goto bad_req; |
| 575 | /* If the mm is already defunct, don't handle faults. */ | ||
| 576 | if (!atomic_inc_not_zero(&svm->mm->mm_users)) | ||
| 577 | goto bad_req; | ||
| 554 | down_read(&svm->mm->mmap_sem); | 578 | down_read(&svm->mm->mmap_sem); |
| 555 | vma = find_extend_vma(svm->mm, address); | 579 | vma = find_extend_vma(svm->mm, address); |
| 556 | if (!vma || address < vma->vm_start) | 580 | if (!vma || address < vma->vm_start) |
| @@ -567,6 +591,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) | |||
| 567 | result = QI_RESP_SUCCESS; | 591 | result = QI_RESP_SUCCESS; |
| 568 | invalid: | 592 | invalid: |
| 569 | up_read(&svm->mm->mmap_sem); | 593 | up_read(&svm->mm->mmap_sem); |
| 594 | mmput(svm->mm); | ||
| 570 | bad_req: | 595 | bad_req: |
| 571 | /* Accounting for major/minor faults? */ | 596 | /* Accounting for major/minor faults? */ |
| 572 | rcu_read_lock(); | 597 | rcu_read_lock(); |
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index c12ba4516df2..ac596928f6b4 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
| @@ -629,7 +629,7 @@ static void iommu_disable_irq_remapping(struct intel_iommu *iommu) | |||
| 629 | 629 | ||
| 630 | raw_spin_lock_irqsave(&iommu->register_lock, flags); | 630 | raw_spin_lock_irqsave(&iommu->register_lock, flags); |
| 631 | 631 | ||
| 632 | sts = dmar_readq(iommu->reg + DMAR_GSTS_REG); | 632 | sts = readl(iommu->reg + DMAR_GSTS_REG); |
| 633 | if (!(sts & DMA_GSTS_IRES)) | 633 | if (!(sts & DMA_GSTS_IRES)) |
| 634 | goto end; | 634 | goto end; |
| 635 | 635 | ||
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 3447549fcc93..0a73632b28d5 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
| @@ -66,7 +66,10 @@ struct its_node { | |||
| 66 | unsigned long phys_base; | 66 | unsigned long phys_base; |
| 67 | struct its_cmd_block *cmd_base; | 67 | struct its_cmd_block *cmd_base; |
| 68 | struct its_cmd_block *cmd_write; | 68 | struct its_cmd_block *cmd_write; |
| 69 | void *tables[GITS_BASER_NR_REGS]; | 69 | struct { |
| 70 | void *base; | ||
| 71 | u32 order; | ||
| 72 | } tables[GITS_BASER_NR_REGS]; | ||
| 70 | struct its_collection *collections; | 73 | struct its_collection *collections; |
| 71 | struct list_head its_device_list; | 74 | struct list_head its_device_list; |
| 72 | u64 flags; | 75 | u64 flags; |
| @@ -807,9 +810,10 @@ static void its_free_tables(struct its_node *its) | |||
| 807 | int i; | 810 | int i; |
| 808 | 811 | ||
| 809 | for (i = 0; i < GITS_BASER_NR_REGS; i++) { | 812 | for (i = 0; i < GITS_BASER_NR_REGS; i++) { |
| 810 | if (its->tables[i]) { | 813 | if (its->tables[i].base) { |
| 811 | free_page((unsigned long)its->tables[i]); | 814 | free_pages((unsigned long)its->tables[i].base, |
| 812 | its->tables[i] = NULL; | 815 | its->tables[i].order); |
| 816 | its->tables[i].base = NULL; | ||
| 813 | } | 817 | } |
| 814 | } | 818 | } |
| 815 | } | 819 | } |
| @@ -890,7 +894,8 @@ retry_alloc_baser: | |||
| 890 | goto out_free; | 894 | goto out_free; |
| 891 | } | 895 | } |
| 892 | 896 | ||
| 893 | its->tables[i] = base; | 897 | its->tables[i].base = base; |
| 898 | its->tables[i].order = order; | ||
| 894 | 899 | ||
| 895 | retry_baser: | 900 | retry_baser: |
| 896 | val = (virt_to_phys(base) | | 901 | val = (virt_to_phys(base) | |
| @@ -940,7 +945,7 @@ retry_baser: | |||
| 940 | * something is horribly wrong... | 945 | * something is horribly wrong... |
| 941 | */ | 946 | */ |
| 942 | free_pages((unsigned long)base, order); | 947 | free_pages((unsigned long)base, order); |
| 943 | its->tables[i] = NULL; | 948 | its->tables[i].base = NULL; |
| 944 | 949 | ||
| 945 | switch (psz) { | 950 | switch (psz) { |
| 946 | case SZ_16K: | 951 | case SZ_16K: |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 911758c056c1..8f9ebf714e2b 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
| @@ -384,9 +384,6 @@ static struct irq_chip gic_chip = { | |||
| 384 | .irq_unmask = gic_unmask_irq, | 384 | .irq_unmask = gic_unmask_irq, |
| 385 | .irq_eoi = gic_eoi_irq, | 385 | .irq_eoi = gic_eoi_irq, |
| 386 | .irq_set_type = gic_set_type, | 386 | .irq_set_type = gic_set_type, |
| 387 | #ifdef CONFIG_SMP | ||
| 388 | .irq_set_affinity = gic_set_affinity, | ||
| 389 | #endif | ||
| 390 | .irq_get_irqchip_state = gic_irq_get_irqchip_state, | 387 | .irq_get_irqchip_state = gic_irq_get_irqchip_state, |
| 391 | .irq_set_irqchip_state = gic_irq_set_irqchip_state, | 388 | .irq_set_irqchip_state = gic_irq_set_irqchip_state, |
| 392 | .flags = IRQCHIP_SET_TYPE_MASKED | | 389 | .flags = IRQCHIP_SET_TYPE_MASKED | |
| @@ -400,9 +397,6 @@ static struct irq_chip gic_eoimode1_chip = { | |||
| 400 | .irq_unmask = gic_unmask_irq, | 397 | .irq_unmask = gic_unmask_irq, |
| 401 | .irq_eoi = gic_eoimode1_eoi_irq, | 398 | .irq_eoi = gic_eoimode1_eoi_irq, |
| 402 | .irq_set_type = gic_set_type, | 399 | .irq_set_type = gic_set_type, |
| 403 | #ifdef CONFIG_SMP | ||
| 404 | .irq_set_affinity = gic_set_affinity, | ||
| 405 | #endif | ||
| 406 | .irq_get_irqchip_state = gic_irq_get_irqchip_state, | 400 | .irq_get_irqchip_state = gic_irq_get_irqchip_state, |
| 407 | .irq_set_irqchip_state = gic_irq_set_irqchip_state, | 401 | .irq_set_irqchip_state = gic_irq_set_irqchip_state, |
| 408 | .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity, | 402 | .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity, |
| @@ -443,7 +437,7 @@ static void gic_cpu_if_up(struct gic_chip_data *gic) | |||
| 443 | u32 bypass = 0; | 437 | u32 bypass = 0; |
| 444 | u32 mode = 0; | 438 | u32 mode = 0; |
| 445 | 439 | ||
| 446 | if (static_key_true(&supports_deactivate)) | 440 | if (gic == &gic_data[0] && static_key_true(&supports_deactivate)) |
| 447 | mode = GIC_CPU_CTRL_EOImodeNS; | 441 | mode = GIC_CPU_CTRL_EOImodeNS; |
| 448 | 442 | ||
| 449 | /* | 443 | /* |
| @@ -1039,6 +1033,11 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start, | |||
| 1039 | gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr); | 1033 | gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr); |
| 1040 | } | 1034 | } |
| 1041 | 1035 | ||
| 1036 | #ifdef CONFIG_SMP | ||
| 1037 | if (gic_nr == 0) | ||
| 1038 | gic->chip.irq_set_affinity = gic_set_affinity; | ||
| 1039 | #endif | ||
| 1040 | |||
| 1042 | #ifdef CONFIG_GIC_NON_BANKED | 1041 | #ifdef CONFIG_GIC_NON_BANKED |
| 1043 | if (percpu_offset) { /* Frankein-GIC without banked registers... */ | 1042 | if (percpu_offset) { /* Frankein-GIC without banked registers... */ |
| 1044 | unsigned int cpu; | 1043 | unsigned int cpu; |
diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c index 0704362f4c82..376b28074e0d 100644 --- a/drivers/irqchip/irq-sun4i.c +++ b/drivers/irqchip/irq-sun4i.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/of_irq.h> | 22 | #include <linux/of_irq.h> |
| 23 | 23 | ||
| 24 | #include <asm/exception.h> | 24 | #include <asm/exception.h> |
| 25 | #include <asm/mach/irq.h> | ||
| 26 | 25 | ||
| 27 | #define SUN4I_IRQ_VECTOR_REG 0x00 | 26 | #define SUN4I_IRQ_VECTOR_REG 0x00 |
| 28 | #define SUN4I_IRQ_PROTECTION_REG 0x08 | 27 | #define SUN4I_IRQ_PROTECTION_REG 0x08 |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index e6e4bacb09ee..12099b09a9a7 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
| @@ -2048,6 +2048,7 @@ int db8500_prcmu_config_hotmon(u8 low, u8 high) | |||
| 2048 | 2048 | ||
| 2049 | return 0; | 2049 | return 0; |
| 2050 | } | 2050 | } |
| 2051 | EXPORT_SYMBOL_GPL(db8500_prcmu_config_hotmon); | ||
| 2051 | 2052 | ||
| 2052 | static int config_hot_period(u16 val) | 2053 | static int config_hot_period(u16 val) |
| 2053 | { | 2054 | { |
| @@ -2074,11 +2075,13 @@ int db8500_prcmu_start_temp_sense(u16 cycles32k) | |||
| 2074 | 2075 | ||
| 2075 | return config_hot_period(cycles32k); | 2076 | return config_hot_period(cycles32k); |
| 2076 | } | 2077 | } |
| 2078 | EXPORT_SYMBOL_GPL(db8500_prcmu_start_temp_sense); | ||
| 2077 | 2079 | ||
| 2078 | int db8500_prcmu_stop_temp_sense(void) | 2080 | int db8500_prcmu_stop_temp_sense(void) |
| 2079 | { | 2081 | { |
| 2080 | return config_hot_period(0xFFFF); | 2082 | return config_hot_period(0xFFFF); |
| 2081 | } | 2083 | } |
| 2084 | EXPORT_SYMBOL_GPL(db8500_prcmu_stop_temp_sense); | ||
| 2082 | 2085 | ||
| 2083 | static int prcmu_a9wdog(u8 cmd, u8 d0, u8 d1, u8 d2, u8 d3) | 2086 | static int prcmu_a9wdog(u8 cmd, u8 d0, u8 d1, u8 d2, u8 d3) |
| 2084 | { | 2087 | { |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 677d0362f334..80f9afcb1382 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
| @@ -458,7 +458,11 @@ static int mei_ioctl_client_notify_request(struct file *file, u32 request) | |||
| 458 | { | 458 | { |
| 459 | struct mei_cl *cl = file->private_data; | 459 | struct mei_cl *cl = file->private_data; |
| 460 | 460 | ||
| 461 | return mei_cl_notify_request(cl, file, request); | 461 | if (request != MEI_HBM_NOTIFICATION_START && |
| 462 | request != MEI_HBM_NOTIFICATION_STOP) | ||
| 463 | return -EINVAL; | ||
| 464 | |||
| 465 | return mei_cl_notify_request(cl, file, (u8)request); | ||
| 462 | } | 466 | } |
| 463 | 467 | ||
| 464 | /** | 468 | /** |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 5914263090fc..fe207e542032 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -47,13 +47,10 @@ | |||
| 47 | #include "queue.h" | 47 | #include "queue.h" |
| 48 | 48 | ||
| 49 | MODULE_ALIAS("mmc:block"); | 49 | MODULE_ALIAS("mmc:block"); |
| 50 | |||
| 51 | #ifdef KERNEL | ||
| 52 | #ifdef MODULE_PARAM_PREFIX | 50 | #ifdef MODULE_PARAM_PREFIX |
| 53 | #undef MODULE_PARAM_PREFIX | 51 | #undef MODULE_PARAM_PREFIX |
| 54 | #endif | 52 | #endif |
| 55 | #define MODULE_PARAM_PREFIX "mmcblk." | 53 | #define MODULE_PARAM_PREFIX "mmcblk." |
| 56 | #endif | ||
| 57 | 54 | ||
| 58 | #define INAND_CMD38_ARG_EXT_CSD 113 | 55 | #define INAND_CMD38_ARG_EXT_CSD 113 |
| 59 | #define INAND_CMD38_ARG_ERASE 0x00 | 56 | #define INAND_CMD38_ARG_ERASE 0x00 |
| @@ -655,8 +652,10 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev, | |||
| 655 | } | 652 | } |
| 656 | 653 | ||
| 657 | md = mmc_blk_get(bdev->bd_disk); | 654 | md = mmc_blk_get(bdev->bd_disk); |
| 658 | if (!md) | 655 | if (!md) { |
| 656 | err = -EINVAL; | ||
| 659 | goto cmd_err; | 657 | goto cmd_err; |
| 658 | } | ||
| 660 | 659 | ||
| 661 | card = md->queue.card; | 660 | card = md->queue.card; |
| 662 | if (IS_ERR(card)) { | 661 | if (IS_ERR(card)) { |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 1c1b45ef3faf..3446097a43c0 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
| @@ -925,6 +925,10 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, | |||
| 925 | 925 | ||
| 926 | dma_addr = dma_map_page(dma_dev, sg_page(sg), 0, | 926 | dma_addr = dma_map_page(dma_dev, sg_page(sg), 0, |
| 927 | PAGE_SIZE, dir); | 927 | PAGE_SIZE, dir); |
| 928 | if (dma_mapping_error(dma_dev, dma_addr)) { | ||
| 929 | data->error = -EFAULT; | ||
| 930 | break; | ||
| 931 | } | ||
| 928 | if (direction == DMA_TO_DEVICE) | 932 | if (direction == DMA_TO_DEVICE) |
| 929 | t->tx_dma = dma_addr + sg->offset; | 933 | t->tx_dma = dma_addr + sg->offset; |
| 930 | else | 934 | else |
| @@ -1393,10 +1397,12 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
| 1393 | host->dma_dev = dev; | 1397 | host->dma_dev = dev; |
| 1394 | host->ones_dma = dma_map_single(dev, ones, | 1398 | host->ones_dma = dma_map_single(dev, ones, |
| 1395 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); | 1399 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); |
| 1400 | if (dma_mapping_error(dev, host->ones_dma)) | ||
| 1401 | goto fail_ones_dma; | ||
| 1396 | host->data_dma = dma_map_single(dev, host->data, | 1402 | host->data_dma = dma_map_single(dev, host->data, |
| 1397 | sizeof(*host->data), DMA_BIDIRECTIONAL); | 1403 | sizeof(*host->data), DMA_BIDIRECTIONAL); |
| 1398 | 1404 | if (dma_mapping_error(dev, host->data_dma)) | |
| 1399 | /* REVISIT in theory those map operations can fail... */ | 1405 | goto fail_data_dma; |
| 1400 | 1406 | ||
| 1401 | dma_sync_single_for_cpu(host->dma_dev, | 1407 | dma_sync_single_for_cpu(host->dma_dev, |
| 1402 | host->data_dma, sizeof(*host->data), | 1408 | host->data_dma, sizeof(*host->data), |
| @@ -1462,6 +1468,11 @@ fail_glue_init: | |||
| 1462 | if (host->dma_dev) | 1468 | if (host->dma_dev) |
| 1463 | dma_unmap_single(host->dma_dev, host->data_dma, | 1469 | dma_unmap_single(host->dma_dev, host->data_dma, |
| 1464 | sizeof(*host->data), DMA_BIDIRECTIONAL); | 1470 | sizeof(*host->data), DMA_BIDIRECTIONAL); |
| 1471 | fail_data_dma: | ||
| 1472 | if (host->dma_dev) | ||
| 1473 | dma_unmap_single(host->dma_dev, host->ones_dma, | ||
| 1474 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); | ||
| 1475 | fail_ones_dma: | ||
| 1465 | kfree(host->data); | 1476 | kfree(host->data); |
| 1466 | 1477 | ||
| 1467 | fail_nobuf1: | 1478 | fail_nobuf1: |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index ce08896b9d69..da824772bbb4 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
| @@ -86,7 +86,7 @@ struct pxamci_host { | |||
| 86 | static inline void pxamci_init_ocr(struct pxamci_host *host) | 86 | static inline void pxamci_init_ocr(struct pxamci_host *host) |
| 87 | { | 87 | { |
| 88 | #ifdef CONFIG_REGULATOR | 88 | #ifdef CONFIG_REGULATOR |
| 89 | host->vcc = regulator_get_optional(mmc_dev(host->mmc), "vmmc"); | 89 | host->vcc = devm_regulator_get_optional(mmc_dev(host->mmc), "vmmc"); |
| 90 | 90 | ||
| 91 | if (IS_ERR(host->vcc)) | 91 | if (IS_ERR(host->vcc)) |
| 92 | host->vcc = NULL; | 92 | host->vcc = NULL; |
| @@ -654,12 +654,8 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 654 | 654 | ||
| 655 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 655 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 656 | irq = platform_get_irq(pdev, 0); | 656 | irq = platform_get_irq(pdev, 0); |
| 657 | if (!r || irq < 0) | 657 | if (irq < 0) |
| 658 | return -ENXIO; | 658 | return irq; |
| 659 | |||
| 660 | r = request_mem_region(r->start, SZ_4K, DRIVER_NAME); | ||
| 661 | if (!r) | ||
| 662 | return -EBUSY; | ||
| 663 | 659 | ||
| 664 | mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev); | 660 | mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev); |
| 665 | if (!mmc) { | 661 | if (!mmc) { |
| @@ -695,7 +691,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 695 | host->pdata = pdev->dev.platform_data; | 691 | host->pdata = pdev->dev.platform_data; |
| 696 | host->clkrt = CLKRT_OFF; | 692 | host->clkrt = CLKRT_OFF; |
| 697 | 693 | ||
| 698 | host->clk = clk_get(&pdev->dev, NULL); | 694 | host->clk = devm_clk_get(&pdev->dev, NULL); |
| 699 | if (IS_ERR(host->clk)) { | 695 | if (IS_ERR(host->clk)) { |
| 700 | ret = PTR_ERR(host->clk); | 696 | ret = PTR_ERR(host->clk); |
| 701 | host->clk = NULL; | 697 | host->clk = NULL; |
| @@ -727,9 +723,9 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 727 | host->irq = irq; | 723 | host->irq = irq; |
| 728 | host->imask = MMC_I_MASK_ALL; | 724 | host->imask = MMC_I_MASK_ALL; |
| 729 | 725 | ||
| 730 | host->base = ioremap(r->start, SZ_4K); | 726 | host->base = devm_ioremap_resource(&pdev->dev, r); |
| 731 | if (!host->base) { | 727 | if (IS_ERR(host->base)) { |
| 732 | ret = -ENOMEM; | 728 | ret = PTR_ERR(host->base); |
| 733 | goto out; | 729 | goto out; |
| 734 | } | 730 | } |
| 735 | 731 | ||
| @@ -742,7 +738,8 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 742 | writel(64, host->base + MMC_RESTO); | 738 | writel(64, host->base + MMC_RESTO); |
| 743 | writel(host->imask, host->base + MMC_I_MASK); | 739 | writel(host->imask, host->base + MMC_I_MASK); |
| 744 | 740 | ||
| 745 | ret = request_irq(host->irq, pxamci_irq, 0, DRIVER_NAME, host); | 741 | ret = devm_request_irq(&pdev->dev, host->irq, pxamci_irq, 0, |
| 742 | DRIVER_NAME, host); | ||
| 746 | if (ret) | 743 | if (ret) |
| 747 | goto out; | 744 | goto out; |
| 748 | 745 | ||
| @@ -804,7 +801,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 804 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); | 801 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); |
| 805 | goto out; | 802 | goto out; |
| 806 | } else { | 803 | } else { |
| 807 | mmc->caps |= host->pdata->gpio_card_ro_invert ? | 804 | mmc->caps2 |= host->pdata->gpio_card_ro_invert ? |
| 808 | 0 : MMC_CAP2_RO_ACTIVE_HIGH; | 805 | 0 : MMC_CAP2_RO_ACTIVE_HIGH; |
| 809 | } | 806 | } |
| 810 | 807 | ||
| @@ -833,14 +830,9 @@ out: | |||
| 833 | dma_release_channel(host->dma_chan_rx); | 830 | dma_release_channel(host->dma_chan_rx); |
| 834 | if (host->dma_chan_tx) | 831 | if (host->dma_chan_tx) |
| 835 | dma_release_channel(host->dma_chan_tx); | 832 | dma_release_channel(host->dma_chan_tx); |
| 836 | if (host->base) | ||
| 837 | iounmap(host->base); | ||
| 838 | if (host->clk) | ||
| 839 | clk_put(host->clk); | ||
| 840 | } | 833 | } |
| 841 | if (mmc) | 834 | if (mmc) |
| 842 | mmc_free_host(mmc); | 835 | mmc_free_host(mmc); |
| 843 | release_resource(r); | ||
| 844 | return ret; | 836 | return ret; |
| 845 | } | 837 | } |
| 846 | 838 | ||
| @@ -859,9 +851,6 @@ static int pxamci_remove(struct platform_device *pdev) | |||
| 859 | gpio_ro = host->pdata->gpio_card_ro; | 851 | gpio_ro = host->pdata->gpio_card_ro; |
| 860 | gpio_power = host->pdata->gpio_power; | 852 | gpio_power = host->pdata->gpio_power; |
| 861 | } | 853 | } |
| 862 | if (host->vcc) | ||
| 863 | regulator_put(host->vcc); | ||
| 864 | |||
| 865 | if (host->pdata && host->pdata->exit) | 854 | if (host->pdata && host->pdata->exit) |
| 866 | host->pdata->exit(&pdev->dev, mmc); | 855 | host->pdata->exit(&pdev->dev, mmc); |
| 867 | 856 | ||
| @@ -870,16 +859,10 @@ static int pxamci_remove(struct platform_device *pdev) | |||
| 870 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, | 859 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, |
| 871 | host->base + MMC_I_MASK); | 860 | host->base + MMC_I_MASK); |
| 872 | 861 | ||
| 873 | free_irq(host->irq, host); | ||
| 874 | dmaengine_terminate_all(host->dma_chan_rx); | 862 | dmaengine_terminate_all(host->dma_chan_rx); |
| 875 | dmaengine_terminate_all(host->dma_chan_tx); | 863 | dmaengine_terminate_all(host->dma_chan_tx); |
| 876 | dma_release_channel(host->dma_chan_rx); | 864 | dma_release_channel(host->dma_chan_rx); |
| 877 | dma_release_channel(host->dma_chan_tx); | 865 | dma_release_channel(host->dma_chan_tx); |
| 878 | iounmap(host->base); | ||
| 879 | |||
| 880 | clk_put(host->clk); | ||
| 881 | |||
| 882 | release_resource(host->res); | ||
| 883 | 866 | ||
| 884 | mmc_free_host(mmc); | 867 | mmc_free_host(mmc); |
| 885 | } | 868 | } |
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index f6047fc94062..a5cda926d38e 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c | |||
| @@ -146,6 +146,33 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { | |||
| 146 | .ops = &sdhci_acpi_ops_int, | 146 | .ops = &sdhci_acpi_ops_int, |
| 147 | }; | 147 | }; |
| 148 | 148 | ||
| 149 | static int bxt_get_cd(struct mmc_host *mmc) | ||
| 150 | { | ||
| 151 | int gpio_cd = mmc_gpio_get_cd(mmc); | ||
| 152 | struct sdhci_host *host = mmc_priv(mmc); | ||
| 153 | unsigned long flags; | ||
| 154 | int ret = 0; | ||
| 155 | |||
| 156 | if (!gpio_cd) | ||
| 157 | return 0; | ||
| 158 | |||
| 159 | pm_runtime_get_sync(mmc->parent); | ||
| 160 | |||
| 161 | spin_lock_irqsave(&host->lock, flags); | ||
| 162 | |||
| 163 | if (host->flags & SDHCI_DEVICE_DEAD) | ||
| 164 | goto out; | ||
| 165 | |||
| 166 | ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); | ||
| 167 | out: | ||
| 168 | spin_unlock_irqrestore(&host->lock, flags); | ||
| 169 | |||
| 170 | pm_runtime_mark_last_busy(mmc->parent); | ||
| 171 | pm_runtime_put_autosuspend(mmc->parent); | ||
| 172 | |||
| 173 | return ret; | ||
| 174 | } | ||
| 175 | |||
| 149 | static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev, | 176 | static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev, |
| 150 | const char *hid, const char *uid) | 177 | const char *hid, const char *uid) |
| 151 | { | 178 | { |
| @@ -196,6 +223,9 @@ static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev, | |||
| 196 | 223 | ||
| 197 | /* Platform specific code during sd probe slot goes here */ | 224 | /* Platform specific code during sd probe slot goes here */ |
| 198 | 225 | ||
| 226 | if (hid && !strcmp(hid, "80865ACA")) | ||
| 227 | host->mmc_host_ops.get_cd = bxt_get_cd; | ||
| 228 | |||
| 199 | return 0; | 229 | return 0; |
| 200 | } | 230 | } |
| 201 | 231 | ||
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c index 7e7d8f0c9438..9cb86fb25976 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c | |||
| @@ -217,6 +217,7 @@ static int sdhci_at91_probe(struct platform_device *pdev) | |||
| 217 | pm_runtime_disable: | 217 | pm_runtime_disable: |
| 218 | pm_runtime_disable(&pdev->dev); | 218 | pm_runtime_disable(&pdev->dev); |
| 219 | pm_runtime_set_suspended(&pdev->dev); | 219 | pm_runtime_set_suspended(&pdev->dev); |
| 220 | pm_runtime_put_noidle(&pdev->dev); | ||
| 220 | clocks_disable_unprepare: | 221 | clocks_disable_unprepare: |
| 221 | clk_disable_unprepare(priv->gck); | 222 | clk_disable_unprepare(priv->gck); |
| 222 | clk_disable_unprepare(priv->mainck); | 223 | clk_disable_unprepare(priv->mainck); |
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index cc851b065d0a..df3b8eced8c4 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c | |||
| @@ -330,6 +330,33 @@ static void spt_read_drive_strength(struct sdhci_host *host) | |||
| 330 | sdhci_pci_spt_drive_strength = 0x10 | ((val >> 12) & 0xf); | 330 | sdhci_pci_spt_drive_strength = 0x10 | ((val >> 12) & 0xf); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | static int bxt_get_cd(struct mmc_host *mmc) | ||
| 334 | { | ||
| 335 | int gpio_cd = mmc_gpio_get_cd(mmc); | ||
| 336 | struct sdhci_host *host = mmc_priv(mmc); | ||
| 337 | unsigned long flags; | ||
| 338 | int ret = 0; | ||
| 339 | |||
| 340 | if (!gpio_cd) | ||
| 341 | return 0; | ||
| 342 | |||
| 343 | pm_runtime_get_sync(mmc->parent); | ||
| 344 | |||
| 345 | spin_lock_irqsave(&host->lock, flags); | ||
| 346 | |||
| 347 | if (host->flags & SDHCI_DEVICE_DEAD) | ||
| 348 | goto out; | ||
| 349 | |||
| 350 | ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); | ||
| 351 | out: | ||
| 352 | spin_unlock_irqrestore(&host->lock, flags); | ||
| 353 | |||
| 354 | pm_runtime_mark_last_busy(mmc->parent); | ||
| 355 | pm_runtime_put_autosuspend(mmc->parent); | ||
| 356 | |||
| 357 | return ret; | ||
| 358 | } | ||
| 359 | |||
| 333 | static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) | 360 | static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) |
| 334 | { | 361 | { |
| 335 | slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | | 362 | slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | |
| @@ -362,6 +389,10 @@ static int byt_sd_probe_slot(struct sdhci_pci_slot *slot) | |||
| 362 | slot->cd_con_id = NULL; | 389 | slot->cd_con_id = NULL; |
| 363 | slot->cd_idx = 0; | 390 | slot->cd_idx = 0; |
| 364 | slot->cd_override_level = true; | 391 | slot->cd_override_level = true; |
| 392 | if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD || | ||
| 393 | slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD) | ||
| 394 | slot->host->mmc_host_ops.get_cd = bxt_get_cd; | ||
| 395 | |||
| 365 | return 0; | 396 | return 0; |
| 366 | } | 397 | } |
| 367 | 398 | ||
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index d622435d1bcc..add9fdfd1d8f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -1360,7 +1360,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
| 1360 | sdhci_runtime_pm_get(host); | 1360 | sdhci_runtime_pm_get(host); |
| 1361 | 1361 | ||
| 1362 | /* Firstly check card presence */ | 1362 | /* Firstly check card presence */ |
| 1363 | present = sdhci_do_get_cd(host); | 1363 | present = mmc->ops->get_cd(mmc); |
| 1364 | 1364 | ||
| 1365 | spin_lock_irqsave(&host->lock, flags); | 1365 | spin_lock_irqsave(&host->lock, flags); |
| 1366 | 1366 | ||
| @@ -2849,6 +2849,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, | |||
| 2849 | 2849 | ||
| 2850 | host = mmc_priv(mmc); | 2850 | host = mmc_priv(mmc); |
| 2851 | host->mmc = mmc; | 2851 | host->mmc = mmc; |
| 2852 | host->mmc_host_ops = sdhci_ops; | ||
| 2853 | mmc->ops = &host->mmc_host_ops; | ||
| 2852 | 2854 | ||
| 2853 | return host; | 2855 | return host; |
| 2854 | } | 2856 | } |
| @@ -3037,7 +3039,6 @@ int sdhci_add_host(struct sdhci_host *host) | |||
| 3037 | /* | 3039 | /* |
| 3038 | * Set host parameters. | 3040 | * Set host parameters. |
| 3039 | */ | 3041 | */ |
| 3040 | mmc->ops = &sdhci_ops; | ||
| 3041 | max_clk = host->max_clk; | 3042 | max_clk = host->max_clk; |
| 3042 | 3043 | ||
| 3043 | if (host->ops->get_min_clock) | 3044 | if (host->ops->get_min_clock) |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 7654ae5d2b4e..0115e9907bf8 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
| @@ -430,6 +430,7 @@ struct sdhci_host { | |||
| 430 | 430 | ||
| 431 | /* Internal data */ | 431 | /* Internal data */ |
| 432 | struct mmc_host *mmc; /* MMC structure */ | 432 | struct mmc_host *mmc; /* MMC structure */ |
| 433 | struct mmc_host_ops mmc_host_ops; /* MMC host ops */ | ||
| 433 | u64 dma_mask; /* custom DMA mask */ | 434 | u64 dma_mask; /* custom DMA mask */ |
| 434 | 435 | ||
| 435 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 436 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 1ca8a1359cbc..6234eab38ff3 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
| @@ -445,7 +445,7 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host) | |||
| 445 | pdata->slave_id_rx); | 445 | pdata->slave_id_rx); |
| 446 | } else { | 446 | } else { |
| 447 | host->chan_tx = dma_request_slave_channel(dev, "tx"); | 447 | host->chan_tx = dma_request_slave_channel(dev, "tx"); |
| 448 | host->chan_tx = dma_request_slave_channel(dev, "rx"); | 448 | host->chan_rx = dma_request_slave_channel(dev, "rx"); |
| 449 | } | 449 | } |
| 450 | dev_dbg(dev, "%s: got channel TX %p RX %p\n", __func__, host->chan_tx, | 450 | dev_dbg(dev, "%s: got channel TX %p RX %p\n", __func__, host->chan_tx, |
| 451 | host->chan_rx); | 451 | host->chan_rx); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 49eea8981332..3010080cfeee 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -7831,6 +7831,14 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, | |||
| 7831 | return ret; | 7831 | return ret; |
| 7832 | } | 7832 | } |
| 7833 | 7833 | ||
| 7834 | static bool tg3_tso_bug_gso_check(struct tg3_napi *tnapi, struct sk_buff *skb) | ||
| 7835 | { | ||
| 7836 | /* Check if we will never have enough descriptors, | ||
| 7837 | * as gso_segs can be more than current ring size | ||
| 7838 | */ | ||
| 7839 | return skb_shinfo(skb)->gso_segs < tnapi->tx_pending / 3; | ||
| 7840 | } | ||
| 7841 | |||
| 7834 | static netdev_tx_t tg3_start_xmit(struct sk_buff *, struct net_device *); | 7842 | static netdev_tx_t tg3_start_xmit(struct sk_buff *, struct net_device *); |
| 7835 | 7843 | ||
| 7836 | /* Use GSO to workaround all TSO packets that meet HW bug conditions | 7844 | /* Use GSO to workaround all TSO packets that meet HW bug conditions |
| @@ -7934,14 +7942,19 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 7934 | * vlan encapsulated. | 7942 | * vlan encapsulated. |
| 7935 | */ | 7943 | */ |
| 7936 | if (skb->protocol == htons(ETH_P_8021Q) || | 7944 | if (skb->protocol == htons(ETH_P_8021Q) || |
| 7937 | skb->protocol == htons(ETH_P_8021AD)) | 7945 | skb->protocol == htons(ETH_P_8021AD)) { |
| 7938 | return tg3_tso_bug(tp, tnapi, txq, skb); | 7946 | if (tg3_tso_bug_gso_check(tnapi, skb)) |
| 7947 | return tg3_tso_bug(tp, tnapi, txq, skb); | ||
| 7948 | goto drop; | ||
| 7949 | } | ||
| 7939 | 7950 | ||
| 7940 | if (!skb_is_gso_v6(skb)) { | 7951 | if (!skb_is_gso_v6(skb)) { |
| 7941 | if (unlikely((ETH_HLEN + hdr_len) > 80) && | 7952 | if (unlikely((ETH_HLEN + hdr_len) > 80) && |
| 7942 | tg3_flag(tp, TSO_BUG)) | 7953 | tg3_flag(tp, TSO_BUG)) { |
| 7943 | return tg3_tso_bug(tp, tnapi, txq, skb); | 7954 | if (tg3_tso_bug_gso_check(tnapi, skb)) |
| 7944 | 7955 | return tg3_tso_bug(tp, tnapi, txq, skb); | |
| 7956 | goto drop; | ||
| 7957 | } | ||
| 7945 | ip_csum = iph->check; | 7958 | ip_csum = iph->check; |
| 7946 | ip_tot_len = iph->tot_len; | 7959 | ip_tot_len = iph->tot_len; |
| 7947 | iph->check = 0; | 7960 | iph->check = 0; |
| @@ -8073,7 +8086,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 8073 | if (would_hit_hwbug) { | 8086 | if (would_hit_hwbug) { |
| 8074 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, i); | 8087 | tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, i); |
| 8075 | 8088 | ||
| 8076 | if (mss) { | 8089 | if (mss && tg3_tso_bug_gso_check(tnapi, skb)) { |
| 8077 | /* If it's a TSO packet, do GSO instead of | 8090 | /* If it's a TSO packet, do GSO instead of |
| 8078 | * allocating and copying to a large linear SKB | 8091 | * allocating and copying to a large linear SKB |
| 8079 | */ | 8092 | */ |
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h index 1671fa3332c2..7ba6d530b0c0 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | #define DRV_NAME "enic" | 34 | #define DRV_NAME "enic" |
| 35 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" | 35 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" |
| 36 | #define DRV_VERSION "2.3.0.12" | 36 | #define DRV_VERSION "2.3.0.20" |
| 37 | #define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc" | 37 | #define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc" |
| 38 | 38 | ||
| 39 | #define ENIC_BARS_MAX 6 | 39 | #define ENIC_BARS_MAX 6 |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c index 1ffd1050860b..1fdf5fe12a95 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_dev.c +++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c | |||
| @@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, | |||
| 298 | int wait) | 298 | int wait) |
| 299 | { | 299 | { |
| 300 | struct devcmd2_controller *dc2c = vdev->devcmd2; | 300 | struct devcmd2_controller *dc2c = vdev->devcmd2; |
| 301 | struct devcmd2_result *result = dc2c->result + dc2c->next_result; | 301 | struct devcmd2_result *result; |
| 302 | u8 color; | ||
| 302 | unsigned int i; | 303 | unsigned int i; |
| 303 | int delay, err; | 304 | int delay, err; |
| 304 | u32 fetch_index, new_posted; | 305 | u32 fetch_index, new_posted; |
| @@ -336,13 +337,17 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, | |||
| 336 | if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT) | 337 | if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT) |
| 337 | return 0; | 338 | return 0; |
| 338 | 339 | ||
| 340 | result = dc2c->result + dc2c->next_result; | ||
| 341 | color = dc2c->color; | ||
| 342 | |||
| 343 | dc2c->next_result++; | ||
| 344 | if (dc2c->next_result == dc2c->result_size) { | ||
| 345 | dc2c->next_result = 0; | ||
| 346 | dc2c->color = dc2c->color ? 0 : 1; | ||
| 347 | } | ||
| 348 | |||
| 339 | for (delay = 0; delay < wait; delay++) { | 349 | for (delay = 0; delay < wait; delay++) { |
| 340 | if (result->color == dc2c->color) { | 350 | if (result->color == color) { |
| 341 | dc2c->next_result++; | ||
| 342 | if (dc2c->next_result == dc2c->result_size) { | ||
| 343 | dc2c->next_result = 0; | ||
| 344 | dc2c->color = dc2c->color ? 0 : 1; | ||
| 345 | } | ||
| 346 | if (result->error) { | 351 | if (result->error) { |
| 347 | err = result->error; | 352 | err = result->error; |
| 348 | if (err != ERR_ECMDUNKNOWN || | 353 | if (err != ERR_ECMDUNKNOWN || |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index d48d5793407d..e94ca1c3fc7c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
| @@ -2429,7 +2429,7 @@ err_thread: | |||
| 2429 | flush_workqueue(priv->mfunc.master.comm_wq); | 2429 | flush_workqueue(priv->mfunc.master.comm_wq); |
| 2430 | destroy_workqueue(priv->mfunc.master.comm_wq); | 2430 | destroy_workqueue(priv->mfunc.master.comm_wq); |
| 2431 | err_slaves: | 2431 | err_slaves: |
| 2432 | while (--i) { | 2432 | while (i--) { |
| 2433 | for (port = 1; port <= MLX4_MAX_PORTS; port++) | 2433 | for (port = 1; port <= MLX4_MAX_PORTS; port++) |
| 2434 | kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); | 2434 | kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); |
| 2435 | } | 2435 | } |
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c index 70814b7386b3..fc8bbff2d7e3 100644 --- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c +++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c | |||
| @@ -1880,9 +1880,9 @@ static int dwceqos_open(struct net_device *ndev) | |||
| 1880 | } | 1880 | } |
| 1881 | netdev_reset_queue(ndev); | 1881 | netdev_reset_queue(ndev); |
| 1882 | 1882 | ||
| 1883 | dwceqos_init_hw(lp); | ||
| 1883 | napi_enable(&lp->napi); | 1884 | napi_enable(&lp->napi); |
| 1884 | phy_start(lp->phy_dev); | 1885 | phy_start(lp->phy_dev); |
| 1885 | dwceqos_init_hw(lp); | ||
| 1886 | 1886 | ||
| 1887 | netif_start_queue(ndev); | 1887 | netif_start_queue(ndev); |
| 1888 | tasklet_enable(&lp->tx_bdreclaim_tasklet); | 1888 | tasklet_enable(&lp->tx_bdreclaim_tasklet); |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 0b14ac3b8d11..028e3873c310 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
| @@ -1039,6 +1039,17 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1039 | return geneve_xmit_skb(skb, dev, info); | 1039 | return geneve_xmit_skb(skb, dev, info); |
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | static int geneve_change_mtu(struct net_device *dev, int new_mtu) | ||
| 1043 | { | ||
| 1044 | /* GENEVE overhead is not fixed, so we can't enforce a more | ||
| 1045 | * precise max MTU. | ||
| 1046 | */ | ||
| 1047 | if (new_mtu < 68 || new_mtu > IP_MAX_MTU) | ||
| 1048 | return -EINVAL; | ||
| 1049 | dev->mtu = new_mtu; | ||
| 1050 | return 0; | ||
| 1051 | } | ||
| 1052 | |||
| 1042 | static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) | 1053 | static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) |
| 1043 | { | 1054 | { |
| 1044 | struct ip_tunnel_info *info = skb_tunnel_info(skb); | 1055 | struct ip_tunnel_info *info = skb_tunnel_info(skb); |
| @@ -1083,7 +1094,7 @@ static const struct net_device_ops geneve_netdev_ops = { | |||
| 1083 | .ndo_stop = geneve_stop, | 1094 | .ndo_stop = geneve_stop, |
| 1084 | .ndo_start_xmit = geneve_xmit, | 1095 | .ndo_start_xmit = geneve_xmit, |
| 1085 | .ndo_get_stats64 = ip_tunnel_get_stats64, | 1096 | .ndo_get_stats64 = ip_tunnel_get_stats64, |
| 1086 | .ndo_change_mtu = eth_change_mtu, | 1097 | .ndo_change_mtu = geneve_change_mtu, |
| 1087 | .ndo_validate_addr = eth_validate_addr, | 1098 | .ndo_validate_addr = eth_validate_addr, |
| 1088 | .ndo_set_mac_address = eth_mac_addr, | 1099 | .ndo_set_mac_address = eth_mac_addr, |
| 1089 | .ndo_fill_metadata_dst = geneve_fill_metadata_dst, | 1100 | .ndo_fill_metadata_dst = geneve_fill_metadata_dst, |
| @@ -1442,11 +1453,21 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, | |||
| 1442 | 1453 | ||
| 1443 | err = geneve_configure(net, dev, &geneve_remote_unspec, | 1454 | err = geneve_configure(net, dev, &geneve_remote_unspec, |
| 1444 | 0, 0, 0, htons(dst_port), true, 0); | 1455 | 0, 0, 0, htons(dst_port), true, 0); |
| 1445 | if (err) { | 1456 | if (err) |
| 1446 | free_netdev(dev); | 1457 | goto err; |
| 1447 | return ERR_PTR(err); | 1458 | |
| 1448 | } | 1459 | /* openvswitch users expect packet sizes to be unrestricted, |
| 1460 | * so set the largest MTU we can. | ||
| 1461 | */ | ||
| 1462 | err = geneve_change_mtu(dev, IP_MAX_MTU); | ||
| 1463 | if (err) | ||
| 1464 | goto err; | ||
| 1465 | |||
| 1449 | return dev; | 1466 | return dev; |
| 1467 | |||
| 1468 | err: | ||
| 1469 | free_netdev(dev); | ||
| 1470 | return ERR_PTR(err); | ||
| 1450 | } | 1471 | } |
| 1451 | EXPORT_SYMBOL_GPL(geneve_dev_create_fb); | 1472 | EXPORT_SYMBOL_GPL(geneve_dev_create_fb); |
| 1452 | 1473 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 65439188c582..a31cd954b308 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -2367,29 +2367,43 @@ static void vxlan_set_multicast_list(struct net_device *dev) | |||
| 2367 | { | 2367 | { |
| 2368 | } | 2368 | } |
| 2369 | 2369 | ||
| 2370 | static int vxlan_change_mtu(struct net_device *dev, int new_mtu) | 2370 | static int __vxlan_change_mtu(struct net_device *dev, |
| 2371 | struct net_device *lowerdev, | ||
| 2372 | struct vxlan_rdst *dst, int new_mtu, bool strict) | ||
| 2371 | { | 2373 | { |
| 2372 | struct vxlan_dev *vxlan = netdev_priv(dev); | 2374 | int max_mtu = IP_MAX_MTU; |
| 2373 | struct vxlan_rdst *dst = &vxlan->default_dst; | ||
| 2374 | struct net_device *lowerdev; | ||
| 2375 | int max_mtu; | ||
| 2376 | 2375 | ||
| 2377 | lowerdev = __dev_get_by_index(vxlan->net, dst->remote_ifindex); | 2376 | if (lowerdev) |
| 2378 | if (lowerdev == NULL) | 2377 | max_mtu = lowerdev->mtu; |
| 2379 | return eth_change_mtu(dev, new_mtu); | ||
| 2380 | 2378 | ||
| 2381 | if (dst->remote_ip.sa.sa_family == AF_INET6) | 2379 | if (dst->remote_ip.sa.sa_family == AF_INET6) |
| 2382 | max_mtu = lowerdev->mtu - VXLAN6_HEADROOM; | 2380 | max_mtu -= VXLAN6_HEADROOM; |
| 2383 | else | 2381 | else |
| 2384 | max_mtu = lowerdev->mtu - VXLAN_HEADROOM; | 2382 | max_mtu -= VXLAN_HEADROOM; |
| 2385 | 2383 | ||
| 2386 | if (new_mtu < 68 || new_mtu > max_mtu) | 2384 | if (new_mtu < 68) |
| 2387 | return -EINVAL; | 2385 | return -EINVAL; |
| 2388 | 2386 | ||
| 2387 | if (new_mtu > max_mtu) { | ||
| 2388 | if (strict) | ||
| 2389 | return -EINVAL; | ||
| 2390 | |||
| 2391 | new_mtu = max_mtu; | ||
| 2392 | } | ||
| 2393 | |||
| 2389 | dev->mtu = new_mtu; | 2394 | dev->mtu = new_mtu; |
| 2390 | return 0; | 2395 | return 0; |
| 2391 | } | 2396 | } |
| 2392 | 2397 | ||
| 2398 | static int vxlan_change_mtu(struct net_device *dev, int new_mtu) | ||
| 2399 | { | ||
| 2400 | struct vxlan_dev *vxlan = netdev_priv(dev); | ||
| 2401 | struct vxlan_rdst *dst = &vxlan->default_dst; | ||
| 2402 | struct net_device *lowerdev = __dev_get_by_index(vxlan->net, | ||
| 2403 | dst->remote_ifindex); | ||
| 2404 | return __vxlan_change_mtu(dev, lowerdev, dst, new_mtu, true); | ||
| 2405 | } | ||
| 2406 | |||
| 2393 | static int egress_ipv4_tun_info(struct net_device *dev, struct sk_buff *skb, | 2407 | static int egress_ipv4_tun_info(struct net_device *dev, struct sk_buff *skb, |
| 2394 | struct ip_tunnel_info *info, | 2408 | struct ip_tunnel_info *info, |
| 2395 | __be16 sport, __be16 dport) | 2409 | __be16 sport, __be16 dport) |
| @@ -2765,6 +2779,7 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
| 2765 | int err; | 2779 | int err; |
| 2766 | bool use_ipv6 = false; | 2780 | bool use_ipv6 = false; |
| 2767 | __be16 default_port = vxlan->cfg.dst_port; | 2781 | __be16 default_port = vxlan->cfg.dst_port; |
| 2782 | struct net_device *lowerdev = NULL; | ||
| 2768 | 2783 | ||
| 2769 | vxlan->net = src_net; | 2784 | vxlan->net = src_net; |
| 2770 | 2785 | ||
| @@ -2785,9 +2800,7 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
| 2785 | } | 2800 | } |
| 2786 | 2801 | ||
| 2787 | if (conf->remote_ifindex) { | 2802 | if (conf->remote_ifindex) { |
| 2788 | struct net_device *lowerdev | 2803 | lowerdev = __dev_get_by_index(src_net, conf->remote_ifindex); |
| 2789 | = __dev_get_by_index(src_net, conf->remote_ifindex); | ||
| 2790 | |||
| 2791 | dst->remote_ifindex = conf->remote_ifindex; | 2804 | dst->remote_ifindex = conf->remote_ifindex; |
| 2792 | 2805 | ||
| 2793 | if (!lowerdev) { | 2806 | if (!lowerdev) { |
| @@ -2811,6 +2824,12 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
| 2811 | needed_headroom = lowerdev->hard_header_len; | 2824 | needed_headroom = lowerdev->hard_header_len; |
| 2812 | } | 2825 | } |
| 2813 | 2826 | ||
| 2827 | if (conf->mtu) { | ||
| 2828 | err = __vxlan_change_mtu(dev, lowerdev, dst, conf->mtu, false); | ||
| 2829 | if (err) | ||
| 2830 | return err; | ||
| 2831 | } | ||
| 2832 | |||
| 2814 | if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA) | 2833 | if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA) |
| 2815 | needed_headroom += VXLAN6_HEADROOM; | 2834 | needed_headroom += VXLAN6_HEADROOM; |
| 2816 | else | 2835 | else |
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6fd4e5a5ef4a..9d11d9837312 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c | |||
| @@ -70,6 +70,9 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj, | |||
| 70 | if (pos >= nvmem->size) | 70 | if (pos >= nvmem->size) |
| 71 | return 0; | 71 | return 0; |
| 72 | 72 | ||
| 73 | if (count < nvmem->word_size) | ||
| 74 | return -EINVAL; | ||
| 75 | |||
| 73 | if (pos + count > nvmem->size) | 76 | if (pos + count > nvmem->size) |
| 74 | count = nvmem->size - pos; | 77 | count = nvmem->size - pos; |
| 75 | 78 | ||
| @@ -95,6 +98,9 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, | |||
| 95 | if (pos >= nvmem->size) | 98 | if (pos >= nvmem->size) |
| 96 | return 0; | 99 | return 0; |
| 97 | 100 | ||
| 101 | if (count < nvmem->word_size) | ||
| 102 | return -EINVAL; | ||
| 103 | |||
| 98 | if (pos + count > nvmem->size) | 104 | if (pos + count > nvmem->size) |
| 99 | count = nvmem->size - pos; | 105 | count = nvmem->size - pos; |
| 100 | 106 | ||
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index afb67e7eeee4..3829e5fbf8c3 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c | |||
| @@ -21,6 +21,7 @@ static struct regmap_config qfprom_regmap_config = { | |||
| 21 | .reg_bits = 32, | 21 | .reg_bits = 32, |
| 22 | .val_bits = 8, | 22 | .val_bits = 8, |
| 23 | .reg_stride = 1, | 23 | .reg_stride = 1, |
| 24 | .val_format_endian = REGMAP_ENDIAN_LITTLE, | ||
| 24 | }; | 25 | }; |
| 25 | 26 | ||
| 26 | static struct nvmem_config econfig = { | 27 | static struct nvmem_config econfig = { |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 5648317d355f..39c4be41ef83 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -154,6 +154,7 @@ static const struct of_device_id whitelist_phys[] = { | |||
| 154 | { .compatible = "marvell,88E1111", }, | 154 | { .compatible = "marvell,88E1111", }, |
| 155 | { .compatible = "marvell,88e1116", }, | 155 | { .compatible = "marvell,88e1116", }, |
| 156 | { .compatible = "marvell,88e1118", }, | 156 | { .compatible = "marvell,88e1118", }, |
| 157 | { .compatible = "marvell,88e1145", }, | ||
| 157 | { .compatible = "marvell,88e1149r", }, | 158 | { .compatible = "marvell,88e1149r", }, |
| 158 | { .compatible = "marvell,88e1310", }, | 159 | { .compatible = "marvell,88e1310", }, |
| 159 | { .compatible = "marvell,88E1510", }, | 160 | { .compatible = "marvell,88E1510", }, |
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index 5816bceddb65..a576aeeb22da 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | #define OARR_SIZE_CFG BIT(OARR_SIZE_CFG_SHIFT) | 64 | #define OARR_SIZE_CFG BIT(OARR_SIZE_CFG_SHIFT) |
| 65 | 65 | ||
| 66 | #define MAX_NUM_OB_WINDOWS 2 | 66 | #define MAX_NUM_OB_WINDOWS 2 |
| 67 | #define MAX_NUM_PAXC_PF 4 | ||
| 68 | 67 | ||
| 69 | #define IPROC_PCIE_REG_INVALID 0xffff | 68 | #define IPROC_PCIE_REG_INVALID 0xffff |
| 70 | 69 | ||
| @@ -170,20 +169,6 @@ static inline void iproc_pcie_ob_write(struct iproc_pcie *pcie, | |||
| 170 | writel(val, pcie->base + offset + (window * 8)); | 169 | writel(val, pcie->base + offset + (window * 8)); |
| 171 | } | 170 | } |
| 172 | 171 | ||
| 173 | static inline bool iproc_pcie_device_is_valid(struct iproc_pcie *pcie, | ||
| 174 | unsigned int slot, | ||
| 175 | unsigned int fn) | ||
| 176 | { | ||
| 177 | if (slot > 0) | ||
| 178 | return false; | ||
| 179 | |||
| 180 | /* PAXC can only support limited number of functions */ | ||
| 181 | if (pcie->type == IPROC_PCIE_PAXC && fn >= MAX_NUM_PAXC_PF) | ||
| 182 | return false; | ||
| 183 | |||
| 184 | return true; | ||
| 185 | } | ||
| 186 | |||
| 187 | /** | 172 | /** |
| 188 | * Note access to the configuration registers are protected at the higher layer | 173 | * Note access to the configuration registers are protected at the higher layer |
| 189 | * by 'pci_lock' in drivers/pci/access.c | 174 | * by 'pci_lock' in drivers/pci/access.c |
| @@ -199,11 +184,11 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus, | |||
| 199 | u32 val; | 184 | u32 val; |
| 200 | u16 offset; | 185 | u16 offset; |
| 201 | 186 | ||
| 202 | if (!iproc_pcie_device_is_valid(pcie, slot, fn)) | ||
| 203 | return NULL; | ||
| 204 | |||
| 205 | /* root complex access */ | 187 | /* root complex access */ |
| 206 | if (busno == 0) { | 188 | if (busno == 0) { |
| 189 | if (slot > 0 || fn > 0) | ||
| 190 | return NULL; | ||
| 191 | |||
| 207 | iproc_pcie_write_reg(pcie, IPROC_PCIE_CFG_IND_ADDR, | 192 | iproc_pcie_write_reg(pcie, IPROC_PCIE_CFG_IND_ADDR, |
| 208 | where & CFG_IND_ADDR_MASK); | 193 | where & CFG_IND_ADDR_MASK); |
| 209 | offset = iproc_pcie_reg_offset(pcie, IPROC_PCIE_CFG_IND_DATA); | 194 | offset = iproc_pcie_reg_offset(pcie, IPROC_PCIE_CFG_IND_DATA); |
| @@ -213,6 +198,14 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus, | |||
| 213 | return (pcie->base + offset); | 198 | return (pcie->base + offset); |
| 214 | } | 199 | } |
| 215 | 200 | ||
| 201 | /* | ||
| 202 | * PAXC is connected to an internally emulated EP within the SoC. It | ||
| 203 | * allows only one device. | ||
| 204 | */ | ||
| 205 | if (pcie->type == IPROC_PCIE_PAXC) | ||
| 206 | if (slot > 0) | ||
| 207 | return NULL; | ||
| 208 | |||
| 216 | /* EP device access */ | 209 | /* EP device access */ |
| 217 | val = (busno << CFG_ADDR_BUS_NUM_SHIFT) | | 210 | val = (busno << CFG_ADDR_BUS_NUM_SHIFT) | |
| 218 | (slot << CFG_ADDR_DEV_NUM_SHIFT) | | 211 | (slot << CFG_ADDR_DEV_NUM_SHIFT) | |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 0bf82a20a0fb..48d21e0edd56 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
| @@ -262,7 +262,6 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev) | |||
| 262 | rpc->rpd = dev; | 262 | rpc->rpd = dev; |
| 263 | INIT_WORK(&rpc->dpc_handler, aer_isr); | 263 | INIT_WORK(&rpc->dpc_handler, aer_isr); |
| 264 | mutex_init(&rpc->rpc_mutex); | 264 | mutex_init(&rpc->rpc_mutex); |
| 265 | init_waitqueue_head(&rpc->wait_release); | ||
| 266 | 265 | ||
| 267 | /* Use PCIe bus function to store rpc into PCIe device */ | 266 | /* Use PCIe bus function to store rpc into PCIe device */ |
| 268 | set_service_data(dev, rpc); | 267 | set_service_data(dev, rpc); |
| @@ -285,8 +284,7 @@ static void aer_remove(struct pcie_device *dev) | |||
| 285 | if (rpc->isr) | 284 | if (rpc->isr) |
| 286 | free_irq(dev->irq, dev); | 285 | free_irq(dev->irq, dev); |
| 287 | 286 | ||
| 288 | wait_event(rpc->wait_release, rpc->prod_idx == rpc->cons_idx); | 287 | flush_work(&rpc->dpc_handler); |
| 289 | |||
| 290 | aer_disable_rootport(rpc); | 288 | aer_disable_rootport(rpc); |
| 291 | kfree(rpc); | 289 | kfree(rpc); |
| 292 | set_service_data(dev, NULL); | 290 | set_service_data(dev, NULL); |
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index 84420b7c9456..945c939a86c5 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h | |||
| @@ -72,7 +72,6 @@ struct aer_rpc { | |||
| 72 | * recovery on the same | 72 | * recovery on the same |
| 73 | * root port hierarchy | 73 | * root port hierarchy |
| 74 | */ | 74 | */ |
| 75 | wait_queue_head_t wait_release; | ||
| 76 | }; | 75 | }; |
| 77 | 76 | ||
| 78 | struct aer_broadcast_data { | 77 | struct aer_broadcast_data { |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 712392504ed9..521e39c1b66d 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
| @@ -811,8 +811,6 @@ void aer_isr(struct work_struct *work) | |||
| 811 | while (get_e_source(rpc, &e_src)) | 811 | while (get_e_source(rpc, &e_src)) |
| 812 | aer_isr_one_error(p_device, &e_src); | 812 | aer_isr_one_error(p_device, &e_src); |
| 813 | mutex_unlock(&rpc->rpc_mutex); | 813 | mutex_unlock(&rpc->rpc_mutex); |
| 814 | |||
| 815 | wake_up(&rpc->wait_release); | ||
| 816 | } | 814 | } |
| 817 | 815 | ||
| 818 | /** | 816 | /** |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index e7e117d5dbbe..0124d17bd9fe 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
| @@ -224,6 +224,7 @@ config PHY_MT65XX_USB3 | |||
| 224 | 224 | ||
| 225 | config PHY_HI6220_USB | 225 | config PHY_HI6220_USB |
| 226 | tristate "hi6220 USB PHY support" | 226 | tristate "hi6220 USB PHY support" |
| 227 | depends on (ARCH_HISI && ARM64) || COMPILE_TEST | ||
| 227 | select GENERIC_PHY | 228 | select GENERIC_PHY |
| 228 | select MFD_SYSCON | 229 | select MFD_SYSCON |
| 229 | help | 230 | help |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 8c7f27db6ad3..e7e574dc667a 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
| @@ -275,20 +275,21 @@ EXPORT_SYMBOL_GPL(phy_exit); | |||
| 275 | 275 | ||
| 276 | int phy_power_on(struct phy *phy) | 276 | int phy_power_on(struct phy *phy) |
| 277 | { | 277 | { |
| 278 | int ret; | 278 | int ret = 0; |
| 279 | 279 | ||
| 280 | if (!phy) | 280 | if (!phy) |
| 281 | return 0; | 281 | goto out; |
| 282 | 282 | ||
| 283 | if (phy->pwr) { | 283 | if (phy->pwr) { |
| 284 | ret = regulator_enable(phy->pwr); | 284 | ret = regulator_enable(phy->pwr); |
| 285 | if (ret) | 285 | if (ret) |
| 286 | return ret; | 286 | goto out; |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | ret = phy_pm_runtime_get_sync(phy); | 289 | ret = phy_pm_runtime_get_sync(phy); |
| 290 | if (ret < 0 && ret != -ENOTSUPP) | 290 | if (ret < 0 && ret != -ENOTSUPP) |
| 291 | return ret; | 291 | goto err_pm_sync; |
| 292 | |||
| 292 | ret = 0; /* Override possible ret == -ENOTSUPP */ | 293 | ret = 0; /* Override possible ret == -ENOTSUPP */ |
| 293 | 294 | ||
| 294 | mutex_lock(&phy->mutex); | 295 | mutex_lock(&phy->mutex); |
| @@ -296,19 +297,20 @@ int phy_power_on(struct phy *phy) | |||
| 296 | ret = phy->ops->power_on(phy); | 297 | ret = phy->ops->power_on(phy); |
| 297 | if (ret < 0) { | 298 | if (ret < 0) { |
| 298 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); | 299 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); |
| 299 | goto out; | 300 | goto err_pwr_on; |
| 300 | } | 301 | } |
| 301 | } | 302 | } |
| 302 | ++phy->power_count; | 303 | ++phy->power_count; |
| 303 | mutex_unlock(&phy->mutex); | 304 | mutex_unlock(&phy->mutex); |
| 304 | return 0; | 305 | return 0; |
| 305 | 306 | ||
| 306 | out: | 307 | err_pwr_on: |
| 307 | mutex_unlock(&phy->mutex); | 308 | mutex_unlock(&phy->mutex); |
| 308 | phy_pm_runtime_put_sync(phy); | 309 | phy_pm_runtime_put_sync(phy); |
| 310 | err_pm_sync: | ||
| 309 | if (phy->pwr) | 311 | if (phy->pwr) |
| 310 | regulator_disable(phy->pwr); | 312 | regulator_disable(phy->pwr); |
| 311 | 313 | out: | |
| 312 | return ret; | 314 | return ret; |
| 313 | } | 315 | } |
| 314 | EXPORT_SYMBOL_GPL(phy_power_on); | 316 | EXPORT_SYMBOL_GPL(phy_power_on); |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 4a3fc6e59f8e..840f3eae428b 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
| @@ -715,6 +715,7 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
| 715 | pm_runtime_use_autosuspend(&pdev->dev); | 715 | pm_runtime_use_autosuspend(&pdev->dev); |
| 716 | pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); | 716 | pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); |
| 717 | pm_runtime_enable(&pdev->dev); | 717 | pm_runtime_enable(&pdev->dev); |
| 718 | pm_runtime_get_sync(&pdev->dev); | ||
| 718 | 719 | ||
| 719 | /* Our job is to use irqs and status from the power module | 720 | /* Our job is to use irqs and status from the power module |
| 720 | * to keep the transceiver disabled when nothing's connected. | 721 | * to keep the transceiver disabled when nothing's connected. |
| @@ -750,6 +751,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
| 750 | struct twl4030_usb *twl = platform_get_drvdata(pdev); | 751 | struct twl4030_usb *twl = platform_get_drvdata(pdev); |
| 751 | int val; | 752 | int val; |
| 752 | 753 | ||
| 754 | usb_remove_phy(&twl->phy); | ||
| 753 | pm_runtime_get_sync(twl->dev); | 755 | pm_runtime_get_sync(twl->dev); |
| 754 | cancel_delayed_work(&twl->id_workaround_work); | 756 | cancel_delayed_work(&twl->id_workaround_work); |
| 755 | device_remove_file(twl->dev, &dev_attr_vbus); | 757 | device_remove_file(twl->dev, &dev_attr_vbus); |
| @@ -757,6 +759,13 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
| 757 | /* set transceiver mode to power on defaults */ | 759 | /* set transceiver mode to power on defaults */ |
| 758 | twl4030_usb_set_mode(twl, -1); | 760 | twl4030_usb_set_mode(twl, -1); |
| 759 | 761 | ||
| 762 | /* idle ulpi before powering off */ | ||
| 763 | if (cable_present(twl->linkstat)) | ||
| 764 | pm_runtime_put_noidle(twl->dev); | ||
| 765 | pm_runtime_mark_last_busy(twl->dev); | ||
| 766 | pm_runtime_put_sync_suspend(twl->dev); | ||
| 767 | pm_runtime_disable(twl->dev); | ||
| 768 | |||
| 760 | /* autogate 60MHz ULPI clock, | 769 | /* autogate 60MHz ULPI clock, |
| 761 | * clear dpll clock request for i2c access, | 770 | * clear dpll clock request for i2c access, |
| 762 | * disable 32KHz | 771 | * disable 32KHz |
| @@ -771,11 +780,6 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
| 771 | /* disable complete OTG block */ | 780 | /* disable complete OTG block */ |
| 772 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); | 781 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); |
| 773 | 782 | ||
| 774 | if (cable_present(twl->linkstat)) | ||
| 775 | pm_runtime_put_noidle(twl->dev); | ||
| 776 | pm_runtime_mark_last_busy(twl->dev); | ||
| 777 | pm_runtime_put(twl->dev); | ||
| 778 | |||
| 779 | return 0; | 783 | return 0; |
| 780 | } | 784 | } |
| 781 | 785 | ||
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index 20f0ad9bb9f3..e20f23e04c24 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c | |||
| @@ -41,8 +41,7 @@ static const struct key_entry intel_hid_keymap[] = { | |||
| 41 | { KE_KEY, 4, { KEY_HOME } }, | 41 | { KE_KEY, 4, { KEY_HOME } }, |
| 42 | { KE_KEY, 5, { KEY_END } }, | 42 | { KE_KEY, 5, { KEY_END } }, |
| 43 | { KE_KEY, 6, { KEY_PAGEUP } }, | 43 | { KE_KEY, 6, { KEY_PAGEUP } }, |
| 44 | { KE_KEY, 4, { KEY_PAGEDOWN } }, | 44 | { KE_KEY, 7, { KEY_PAGEDOWN } }, |
| 45 | { KE_KEY, 4, { KEY_HOME } }, | ||
| 46 | { KE_KEY, 8, { KEY_RFKILL } }, | 45 | { KE_KEY, 8, { KEY_RFKILL } }, |
| 47 | { KE_KEY, 9, { KEY_POWER } }, | 46 | { KE_KEY, 9, { KEY_POWER } }, |
| 48 | { KE_KEY, 11, { KEY_SLEEP } }, | 47 | { KE_KEY, 11, { KEY_SLEEP } }, |
diff --git a/drivers/platform/x86/intel_scu_ipcutil.c b/drivers/platform/x86/intel_scu_ipcutil.c index 02bc5a6343c3..aa454241489c 100644 --- a/drivers/platform/x86/intel_scu_ipcutil.c +++ b/drivers/platform/x86/intel_scu_ipcutil.c | |||
| @@ -49,7 +49,7 @@ struct scu_ipc_data { | |||
| 49 | 49 | ||
| 50 | static int scu_reg_access(u32 cmd, struct scu_ipc_data *data) | 50 | static int scu_reg_access(u32 cmd, struct scu_ipc_data *data) |
| 51 | { | 51 | { |
| 52 | int count = data->count; | 52 | unsigned int count = data->count; |
| 53 | 53 | ||
| 54 | if (count == 0 || count == 3 || count > 4) | 54 | if (count == 0 || count == 3 || count > 4) |
| 55 | return -EINVAL; | 55 | return -EINVAL; |
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 361358134315..93880ed6291c 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c | |||
| @@ -562,7 +562,7 @@ static int mode_select_handle_sense(struct scsi_device *sdev, | |||
| 562 | /* | 562 | /* |
| 563 | * Command Lock contention | 563 | * Command Lock contention |
| 564 | */ | 564 | */ |
| 565 | err = SCSI_DH_RETRY; | 565 | err = SCSI_DH_IMM_RETRY; |
| 566 | break; | 566 | break; |
| 567 | default: | 567 | default: |
| 568 | break; | 568 | break; |
| @@ -612,6 +612,8 @@ retry: | |||
| 612 | err = mode_select_handle_sense(sdev, h->sense); | 612 | err = mode_select_handle_sense(sdev, h->sense); |
| 613 | if (err == SCSI_DH_RETRY && retry_cnt--) | 613 | if (err == SCSI_DH_RETRY && retry_cnt--) |
| 614 | goto retry; | 614 | goto retry; |
| 615 | if (err == SCSI_DH_IMM_RETRY) | ||
| 616 | goto retry; | ||
| 615 | } | 617 | } |
| 616 | if (err == SCSI_DH_OK) { | 618 | if (err == SCSI_DH_OK) { |
| 617 | h->state = RDAC_STATE_ACTIVE; | 619 | h->state = RDAC_STATE_ACTIVE; |
diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig index b67661836c9f..d1dd1616f983 100644 --- a/drivers/scsi/hisi_sas/Kconfig +++ b/drivers/scsi/hisi_sas/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config SCSI_HISI_SAS | 1 | config SCSI_HISI_SAS |
| 2 | tristate "HiSilicon SAS" | 2 | tristate "HiSilicon SAS" |
| 3 | depends on HAS_DMA | 3 | depends on HAS_DMA && HAS_IOMEM |
| 4 | depends on ARM64 || COMPILE_TEST | 4 | depends on ARM64 || COMPILE_TEST |
| 5 | select SCSI_SAS_LIBSAS | 5 | select SCSI_SAS_LIBSAS |
| 6 | select BLK_DEV_INTEGRITY | 6 | select BLK_DEV_INTEGRITY |
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 057fdeb720ac..eea24d7531cf 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | |||
| @@ -1289,13 +1289,10 @@ static int slot_complete_v1_hw(struct hisi_hba *hisi_hba, | |||
| 1289 | goto out; | 1289 | goto out; |
| 1290 | } | 1290 | } |
| 1291 | 1291 | ||
| 1292 | if (cmplt_hdr_data & CMPLT_HDR_ERR_RCRD_XFRD_MSK) { | 1292 | if (cmplt_hdr_data & CMPLT_HDR_ERR_RCRD_XFRD_MSK && |
| 1293 | if (!(cmplt_hdr_data & CMPLT_HDR_CMD_CMPLT_MSK) || | 1293 | !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK)) { |
| 1294 | !(cmplt_hdr_data & CMPLT_HDR_RSPNS_XFRD_MSK)) | ||
| 1295 | ts->stat = SAS_DATA_OVERRUN; | ||
| 1296 | else | ||
| 1297 | slot_err_v1_hw(hisi_hba, task, slot); | ||
| 1298 | 1294 | ||
| 1295 | slot_err_v1_hw(hisi_hba, task, slot); | ||
| 1299 | goto out; | 1296 | goto out; |
| 1300 | } | 1297 | } |
| 1301 | 1298 | ||
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 52a87657c7dd..692a7570b5e1 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
| @@ -2204,7 +2204,7 @@ qla2x00_init_rings(scsi_qla_host_t *vha) | |||
| 2204 | /* Clear outstanding commands array. */ | 2204 | /* Clear outstanding commands array. */ |
| 2205 | for (que = 0; que < ha->max_req_queues; que++) { | 2205 | for (que = 0; que < ha->max_req_queues; que++) { |
| 2206 | req = ha->req_q_map[que]; | 2206 | req = ha->req_q_map[que]; |
| 2207 | if (!req) | 2207 | if (!req || !test_bit(que, ha->req_qid_map)) |
| 2208 | continue; | 2208 | continue; |
| 2209 | req->out_ptr = (void *)(req->ring + req->length); | 2209 | req->out_ptr = (void *)(req->ring + req->length); |
| 2210 | *req->out_ptr = 0; | 2210 | *req->out_ptr = 0; |
| @@ -2221,7 +2221,7 @@ qla2x00_init_rings(scsi_qla_host_t *vha) | |||
| 2221 | 2221 | ||
| 2222 | for (que = 0; que < ha->max_rsp_queues; que++) { | 2222 | for (que = 0; que < ha->max_rsp_queues; que++) { |
| 2223 | rsp = ha->rsp_q_map[que]; | 2223 | rsp = ha->rsp_q_map[que]; |
| 2224 | if (!rsp) | 2224 | if (!rsp || !test_bit(que, ha->rsp_qid_map)) |
| 2225 | continue; | 2225 | continue; |
| 2226 | rsp->in_ptr = (void *)(rsp->ring + rsp->length); | 2226 | rsp->in_ptr = (void *)(rsp->ring + rsp->length); |
| 2227 | *rsp->in_ptr = 0; | 2227 | *rsp->in_ptr = 0; |
| @@ -4981,7 +4981,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
| 4981 | 4981 | ||
| 4982 | for (i = 1; i < ha->max_rsp_queues; i++) { | 4982 | for (i = 1; i < ha->max_rsp_queues; i++) { |
| 4983 | rsp = ha->rsp_q_map[i]; | 4983 | rsp = ha->rsp_q_map[i]; |
| 4984 | if (rsp) { | 4984 | if (rsp && test_bit(i, ha->rsp_qid_map)) { |
| 4985 | rsp->options &= ~BIT_0; | 4985 | rsp->options &= ~BIT_0; |
| 4986 | ret = qla25xx_init_rsp_que(base_vha, rsp); | 4986 | ret = qla25xx_init_rsp_que(base_vha, rsp); |
| 4987 | if (ret != QLA_SUCCESS) | 4987 | if (ret != QLA_SUCCESS) |
| @@ -4996,8 +4996,8 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
| 4996 | } | 4996 | } |
| 4997 | for (i = 1; i < ha->max_req_queues; i++) { | 4997 | for (i = 1; i < ha->max_req_queues; i++) { |
| 4998 | req = ha->req_q_map[i]; | 4998 | req = ha->req_q_map[i]; |
| 4999 | if (req) { | 4999 | if (req && test_bit(i, ha->req_qid_map)) { |
| 5000 | /* Clear outstanding commands array. */ | 5000 | /* Clear outstanding commands array. */ |
| 5001 | req->options &= ~BIT_0; | 5001 | req->options &= ~BIT_0; |
| 5002 | ret = qla25xx_init_req_que(base_vha, req); | 5002 | ret = qla25xx_init_req_que(base_vha, req); |
| 5003 | if (ret != QLA_SUCCESS) | 5003 | if (ret != QLA_SUCCESS) |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index d4d65eb0e9b4..4af95479a9db 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -3063,9 +3063,9 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) | |||
| 3063 | "MSI-X: Failed to enable support " | 3063 | "MSI-X: Failed to enable support " |
| 3064 | "-- %d/%d\n Retry with %d vectors.\n", | 3064 | "-- %d/%d\n Retry with %d vectors.\n", |
| 3065 | ha->msix_count, ret, ret); | 3065 | ha->msix_count, ret, ret); |
| 3066 | ha->msix_count = ret; | ||
| 3067 | ha->max_rsp_queues = ha->msix_count - 1; | ||
| 3066 | } | 3068 | } |
| 3067 | ha->msix_count = ret; | ||
| 3068 | ha->max_rsp_queues = ha->msix_count - 1; | ||
| 3069 | ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) * | 3069 | ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) * |
| 3070 | ha->msix_count, GFP_KERNEL); | 3070 | ha->msix_count, GFP_KERNEL); |
| 3071 | if (!ha->msix_entries) { | 3071 | if (!ha->msix_entries) { |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index c5dd594f6c31..cf7ba52bae66 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
| @@ -600,7 +600,7 @@ qla25xx_delete_queues(struct scsi_qla_host *vha) | |||
| 600 | /* Delete request queues */ | 600 | /* Delete request queues */ |
| 601 | for (cnt = 1; cnt < ha->max_req_queues; cnt++) { | 601 | for (cnt = 1; cnt < ha->max_req_queues; cnt++) { |
| 602 | req = ha->req_q_map[cnt]; | 602 | req = ha->req_q_map[cnt]; |
| 603 | if (req) { | 603 | if (req && test_bit(cnt, ha->req_qid_map)) { |
| 604 | ret = qla25xx_delete_req_que(vha, req); | 604 | ret = qla25xx_delete_req_que(vha, req); |
| 605 | if (ret != QLA_SUCCESS) { | 605 | if (ret != QLA_SUCCESS) { |
| 606 | ql_log(ql_log_warn, vha, 0x00ea, | 606 | ql_log(ql_log_warn, vha, 0x00ea, |
| @@ -614,7 +614,7 @@ qla25xx_delete_queues(struct scsi_qla_host *vha) | |||
| 614 | /* Delete response queues */ | 614 | /* Delete response queues */ |
| 615 | for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) { | 615 | for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) { |
| 616 | rsp = ha->rsp_q_map[cnt]; | 616 | rsp = ha->rsp_q_map[cnt]; |
| 617 | if (rsp) { | 617 | if (rsp && test_bit(cnt, ha->rsp_qid_map)) { |
| 618 | ret = qla25xx_delete_rsp_que(vha, rsp); | 618 | ret = qla25xx_delete_rsp_que(vha, rsp); |
| 619 | if (ret != QLA_SUCCESS) { | 619 | if (ret != QLA_SUCCESS) { |
| 620 | ql_log(ql_log_warn, vha, 0x00eb, | 620 | ql_log(ql_log_warn, vha, 0x00eb, |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index f1788db43195..f6c7ce35b542 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -409,6 +409,9 @@ static void qla2x00_free_queues(struct qla_hw_data *ha) | |||
| 409 | int cnt; | 409 | int cnt; |
| 410 | 410 | ||
| 411 | for (cnt = 0; cnt < ha->max_req_queues; cnt++) { | 411 | for (cnt = 0; cnt < ha->max_req_queues; cnt++) { |
| 412 | if (!test_bit(cnt, ha->req_qid_map)) | ||
| 413 | continue; | ||
| 414 | |||
| 412 | req = ha->req_q_map[cnt]; | 415 | req = ha->req_q_map[cnt]; |
| 413 | qla2x00_free_req_que(ha, req); | 416 | qla2x00_free_req_que(ha, req); |
| 414 | } | 417 | } |
| @@ -416,6 +419,9 @@ static void qla2x00_free_queues(struct qla_hw_data *ha) | |||
| 416 | ha->req_q_map = NULL; | 419 | ha->req_q_map = NULL; |
| 417 | 420 | ||
| 418 | for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { | 421 | for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { |
| 422 | if (!test_bit(cnt, ha->rsp_qid_map)) | ||
| 423 | continue; | ||
| 424 | |||
| 419 | rsp = ha->rsp_q_map[cnt]; | 425 | rsp = ha->rsp_q_map[cnt]; |
| 420 | qla2x00_free_rsp_que(ha, rsp); | 426 | qla2x00_free_rsp_que(ha, rsp); |
| 421 | } | 427 | } |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 8075a4cdb45c..ee967becd257 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
| @@ -105,7 +105,7 @@ static void qlt_response_pkt(struct scsi_qla_host *ha, response_t *pkt); | |||
| 105 | static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun, | 105 | static int qlt_issue_task_mgmt(struct qla_tgt_sess *sess, uint32_t lun, |
| 106 | int fn, void *iocb, int flags); | 106 | int fn, void *iocb, int flags); |
| 107 | static void qlt_send_term_exchange(struct scsi_qla_host *ha, struct qla_tgt_cmd | 107 | static void qlt_send_term_exchange(struct scsi_qla_host *ha, struct qla_tgt_cmd |
| 108 | *cmd, struct atio_from_isp *atio, int ha_locked); | 108 | *cmd, struct atio_from_isp *atio, int ha_locked, int ul_abort); |
| 109 | static void qlt_reject_free_srr_imm(struct scsi_qla_host *ha, | 109 | static void qlt_reject_free_srr_imm(struct scsi_qla_host *ha, |
| 110 | struct qla_tgt_srr_imm *imm, int ha_lock); | 110 | struct qla_tgt_srr_imm *imm, int ha_lock); |
| 111 | static void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, | 111 | static void qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, |
| @@ -1756,7 +1756,7 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) | |||
| 1756 | qlt_send_notify_ack(vha, &mcmd->orig_iocb.imm_ntfy, | 1756 | qlt_send_notify_ack(vha, &mcmd->orig_iocb.imm_ntfy, |
| 1757 | 0, 0, 0, 0, 0, 0); | 1757 | 0, 0, 0, 0, 0, 0); |
| 1758 | else { | 1758 | else { |
| 1759 | if (mcmd->se_cmd.se_tmr_req->function == TMR_ABORT_TASK) | 1759 | if (mcmd->orig_iocb.atio.u.raw.entry_type == ABTS_RECV_24XX) |
| 1760 | qlt_24xx_send_abts_resp(vha, &mcmd->orig_iocb.abts, | 1760 | qlt_24xx_send_abts_resp(vha, &mcmd->orig_iocb.abts, |
| 1761 | mcmd->fc_tm_rsp, false); | 1761 | mcmd->fc_tm_rsp, false); |
| 1762 | else | 1762 | else |
| @@ -2665,7 +2665,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, | |||
| 2665 | /* no need to terminate. FW already freed exchange. */ | 2665 | /* no need to terminate. FW already freed exchange. */ |
| 2666 | qlt_abort_cmd_on_host_reset(cmd->vha, cmd); | 2666 | qlt_abort_cmd_on_host_reset(cmd->vha, cmd); |
| 2667 | else | 2667 | else |
| 2668 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); | 2668 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1, 0); |
| 2669 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 2669 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 2670 | return 0; | 2670 | return 0; |
| 2671 | } | 2671 | } |
| @@ -3173,7 +3173,8 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
| 3173 | } | 3173 | } |
| 3174 | 3174 | ||
| 3175 | static void qlt_send_term_exchange(struct scsi_qla_host *vha, | 3175 | static void qlt_send_term_exchange(struct scsi_qla_host *vha, |
| 3176 | struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked) | 3176 | struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked, |
| 3177 | int ul_abort) | ||
| 3177 | { | 3178 | { |
| 3178 | unsigned long flags = 0; | 3179 | unsigned long flags = 0; |
| 3179 | int rc; | 3180 | int rc; |
| @@ -3193,8 +3194,7 @@ static void qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
| 3193 | qlt_alloc_qfull_cmd(vha, atio, 0, 0); | 3194 | qlt_alloc_qfull_cmd(vha, atio, 0, 0); |
| 3194 | 3195 | ||
| 3195 | done: | 3196 | done: |
| 3196 | if (cmd && (!cmd->aborted || | 3197 | if (cmd && !ul_abort && !cmd->aborted) { |
| 3197 | !cmd->cmd_sent_to_fw)) { | ||
| 3198 | if (cmd->sg_mapped) | 3198 | if (cmd->sg_mapped) |
| 3199 | qlt_unmap_sg(vha, cmd); | 3199 | qlt_unmap_sg(vha, cmd); |
| 3200 | vha->hw->tgt.tgt_ops->free_cmd(cmd); | 3200 | vha->hw->tgt.tgt_ops->free_cmd(cmd); |
| @@ -3253,21 +3253,38 @@ static void qlt_chk_exch_leak_thresh_hold(struct scsi_qla_host *vha) | |||
| 3253 | 3253 | ||
| 3254 | } | 3254 | } |
| 3255 | 3255 | ||
| 3256 | void qlt_abort_cmd(struct qla_tgt_cmd *cmd) | 3256 | int qlt_abort_cmd(struct qla_tgt_cmd *cmd) |
| 3257 | { | 3257 | { |
| 3258 | struct qla_tgt *tgt = cmd->tgt; | 3258 | struct qla_tgt *tgt = cmd->tgt; |
| 3259 | struct scsi_qla_host *vha = tgt->vha; | 3259 | struct scsi_qla_host *vha = tgt->vha; |
| 3260 | struct se_cmd *se_cmd = &cmd->se_cmd; | 3260 | struct se_cmd *se_cmd = &cmd->se_cmd; |
| 3261 | unsigned long flags; | ||
| 3261 | 3262 | ||
| 3262 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf014, | 3263 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf014, |
| 3263 | "qla_target(%d): terminating exchange for aborted cmd=%p " | 3264 | "qla_target(%d): terminating exchange for aborted cmd=%p " |
| 3264 | "(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd, | 3265 | "(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd, |
| 3265 | se_cmd->tag); | 3266 | se_cmd->tag); |
| 3266 | 3267 | ||
| 3268 | spin_lock_irqsave(&cmd->cmd_lock, flags); | ||
| 3269 | if (cmd->aborted) { | ||
| 3270 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 3271 | /* | ||
| 3272 | * It's normal to see 2 calls in this path: | ||
| 3273 | * 1) XFER Rdy completion + CMD_T_ABORT | ||
| 3274 | * 2) TCM TMR - drain_state_list | ||
| 3275 | */ | ||
| 3276 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xffff, | ||
| 3277 | "multiple abort. %p transport_state %x, t_state %x," | ||
| 3278 | " se_cmd_flags %x \n", cmd, cmd->se_cmd.transport_state, | ||
| 3279 | cmd->se_cmd.t_state,cmd->se_cmd.se_cmd_flags); | ||
| 3280 | return EIO; | ||
| 3281 | } | ||
| 3267 | cmd->aborted = 1; | 3282 | cmd->aborted = 1; |
| 3268 | cmd->cmd_flags |= BIT_6; | 3283 | cmd->cmd_flags |= BIT_6; |
| 3284 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 3269 | 3285 | ||
| 3270 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 0); | 3286 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 0, 1); |
| 3287 | return 0; | ||
| 3271 | } | 3288 | } |
| 3272 | EXPORT_SYMBOL(qlt_abort_cmd); | 3289 | EXPORT_SYMBOL(qlt_abort_cmd); |
| 3273 | 3290 | ||
| @@ -3282,6 +3299,9 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd) | |||
| 3282 | 3299 | ||
| 3283 | BUG_ON(cmd->cmd_in_wq); | 3300 | BUG_ON(cmd->cmd_in_wq); |
| 3284 | 3301 | ||
| 3302 | if (cmd->sg_mapped) | ||
| 3303 | qlt_unmap_sg(cmd->vha, cmd); | ||
| 3304 | |||
| 3285 | if (!cmd->q_full) | 3305 | if (!cmd->q_full) |
| 3286 | qlt_decr_num_pend_cmds(cmd->vha); | 3306 | qlt_decr_num_pend_cmds(cmd->vha); |
| 3287 | 3307 | ||
| @@ -3399,7 +3419,7 @@ static int qlt_term_ctio_exchange(struct scsi_qla_host *vha, void *ctio, | |||
| 3399 | term = 1; | 3419 | term = 1; |
| 3400 | 3420 | ||
| 3401 | if (term) | 3421 | if (term) |
| 3402 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); | 3422 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1, 0); |
| 3403 | 3423 | ||
| 3404 | return term; | 3424 | return term; |
| 3405 | } | 3425 | } |
| @@ -3580,12 +3600,13 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, | |||
| 3580 | case CTIO_PORT_LOGGED_OUT: | 3600 | case CTIO_PORT_LOGGED_OUT: |
| 3581 | case CTIO_PORT_UNAVAILABLE: | 3601 | case CTIO_PORT_UNAVAILABLE: |
| 3582 | { | 3602 | { |
| 3583 | int logged_out = (status & 0xFFFF); | 3603 | int logged_out = |
| 3604 | (status & 0xFFFF) == CTIO_PORT_LOGGED_OUT; | ||
| 3605 | |||
| 3584 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf059, | 3606 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf059, |
| 3585 | "qla_target(%d): CTIO with %s status %x " | 3607 | "qla_target(%d): CTIO with %s status %x " |
| 3586 | "received (state %x, se_cmd %p)\n", vha->vp_idx, | 3608 | "received (state %x, se_cmd %p)\n", vha->vp_idx, |
| 3587 | (logged_out == CTIO_PORT_LOGGED_OUT) ? | 3609 | logged_out ? "PORT LOGGED OUT" : "PORT UNAVAILABLE", |
| 3588 | "PORT LOGGED OUT" : "PORT UNAVAILABLE", | ||
| 3589 | status, cmd->state, se_cmd); | 3610 | status, cmd->state, se_cmd); |
| 3590 | 3611 | ||
| 3591 | if (logged_out && cmd->sess) { | 3612 | if (logged_out && cmd->sess) { |
| @@ -3754,6 +3775,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) | |||
| 3754 | goto out_term; | 3775 | goto out_term; |
| 3755 | } | 3776 | } |
| 3756 | 3777 | ||
| 3778 | spin_lock_init(&cmd->cmd_lock); | ||
| 3757 | cdb = &atio->u.isp24.fcp_cmnd.cdb[0]; | 3779 | cdb = &atio->u.isp24.fcp_cmnd.cdb[0]; |
| 3758 | cmd->se_cmd.tag = atio->u.isp24.exchange_addr; | 3780 | cmd->se_cmd.tag = atio->u.isp24.exchange_addr; |
| 3759 | cmd->unpacked_lun = scsilun_to_int( | 3781 | cmd->unpacked_lun = scsilun_to_int( |
| @@ -3796,7 +3818,7 @@ out_term: | |||
| 3796 | */ | 3818 | */ |
| 3797 | cmd->cmd_flags |= BIT_2; | 3819 | cmd->cmd_flags |= BIT_2; |
| 3798 | spin_lock_irqsave(&ha->hardware_lock, flags); | 3820 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 3799 | qlt_send_term_exchange(vha, NULL, &cmd->atio, 1); | 3821 | qlt_send_term_exchange(vha, NULL, &cmd->atio, 1, 0); |
| 3800 | 3822 | ||
| 3801 | qlt_decr_num_pend_cmds(vha); | 3823 | qlt_decr_num_pend_cmds(vha); |
| 3802 | percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); | 3824 | percpu_ida_free(&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); |
| @@ -3918,7 +3940,7 @@ static void qlt_create_sess_from_atio(struct work_struct *work) | |||
| 3918 | 3940 | ||
| 3919 | out_term: | 3941 | out_term: |
| 3920 | spin_lock_irqsave(&ha->hardware_lock, flags); | 3942 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 3921 | qlt_send_term_exchange(vha, NULL, &op->atio, 1); | 3943 | qlt_send_term_exchange(vha, NULL, &op->atio, 1, 0); |
| 3922 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 3944 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 3923 | kfree(op); | 3945 | kfree(op); |
| 3924 | 3946 | ||
| @@ -3982,7 +4004,8 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, | |||
| 3982 | 4004 | ||
| 3983 | cmd->cmd_in_wq = 1; | 4005 | cmd->cmd_in_wq = 1; |
| 3984 | cmd->cmd_flags |= BIT_0; | 4006 | cmd->cmd_flags |= BIT_0; |
| 3985 | cmd->se_cmd.cpuid = -1; | 4007 | cmd->se_cmd.cpuid = ha->msix_count ? |
| 4008 | ha->tgt.rspq_vector_cpuid : WORK_CPU_UNBOUND; | ||
| 3986 | 4009 | ||
| 3987 | spin_lock(&vha->cmd_list_lock); | 4010 | spin_lock(&vha->cmd_list_lock); |
| 3988 | list_add_tail(&cmd->cmd_list, &vha->qla_cmd_list); | 4011 | list_add_tail(&cmd->cmd_list, &vha->qla_cmd_list); |
| @@ -3990,7 +4013,6 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, | |||
| 3990 | 4013 | ||
| 3991 | INIT_WORK(&cmd->work, qlt_do_work); | 4014 | INIT_WORK(&cmd->work, qlt_do_work); |
| 3992 | if (ha->msix_count) { | 4015 | if (ha->msix_count) { |
| 3993 | cmd->se_cmd.cpuid = ha->tgt.rspq_vector_cpuid; | ||
| 3994 | if (cmd->atio.u.isp24.fcp_cmnd.rddata) | 4016 | if (cmd->atio.u.isp24.fcp_cmnd.rddata) |
| 3995 | queue_work_on(smp_processor_id(), qla_tgt_wq, | 4017 | queue_work_on(smp_processor_id(), qla_tgt_wq, |
| 3996 | &cmd->work); | 4018 | &cmd->work); |
| @@ -4771,7 +4793,7 @@ out_reject: | |||
| 4771 | dump_stack(); | 4793 | dump_stack(); |
| 4772 | } else { | 4794 | } else { |
| 4773 | cmd->cmd_flags |= BIT_9; | 4795 | cmd->cmd_flags |= BIT_9; |
| 4774 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1); | 4796 | qlt_send_term_exchange(vha, cmd, &cmd->atio, 1, 0); |
| 4775 | } | 4797 | } |
| 4776 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4798 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 4777 | } | 4799 | } |
| @@ -4950,7 +4972,7 @@ static void qlt_prepare_srr_imm(struct scsi_qla_host *vha, | |||
| 4950 | sctio, sctio->srr_id); | 4972 | sctio, sctio->srr_id); |
| 4951 | list_del(&sctio->srr_list_entry); | 4973 | list_del(&sctio->srr_list_entry); |
| 4952 | qlt_send_term_exchange(vha, sctio->cmd, | 4974 | qlt_send_term_exchange(vha, sctio->cmd, |
| 4953 | &sctio->cmd->atio, 1); | 4975 | &sctio->cmd->atio, 1, 0); |
| 4954 | kfree(sctio); | 4976 | kfree(sctio); |
| 4955 | } | 4977 | } |
| 4956 | } | 4978 | } |
| @@ -5123,7 +5145,7 @@ static int __qlt_send_busy(struct scsi_qla_host *vha, | |||
| 5123 | atio->u.isp24.fcp_hdr.s_id); | 5145 | atio->u.isp24.fcp_hdr.s_id); |
| 5124 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); | 5146 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
| 5125 | if (!sess) { | 5147 | if (!sess) { |
| 5126 | qlt_send_term_exchange(vha, NULL, atio, 1); | 5148 | qlt_send_term_exchange(vha, NULL, atio, 1, 0); |
| 5127 | return 0; | 5149 | return 0; |
| 5128 | } | 5150 | } |
| 5129 | /* Sending marker isn't necessary, since we called from ISR */ | 5151 | /* Sending marker isn't necessary, since we called from ISR */ |
| @@ -5406,7 +5428,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, | |||
| 5406 | #if 1 /* With TERM EXCHANGE some FC cards refuse to boot */ | 5428 | #if 1 /* With TERM EXCHANGE some FC cards refuse to boot */ |
| 5407 | qlt_send_busy(vha, atio, SAM_STAT_BUSY); | 5429 | qlt_send_busy(vha, atio, SAM_STAT_BUSY); |
| 5408 | #else | 5430 | #else |
| 5409 | qlt_send_term_exchange(vha, NULL, atio, 1); | 5431 | qlt_send_term_exchange(vha, NULL, atio, 1, 0); |
| 5410 | #endif | 5432 | #endif |
| 5411 | 5433 | ||
| 5412 | if (!ha_locked) | 5434 | if (!ha_locked) |
| @@ -5523,7 +5545,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt) | |||
| 5523 | #if 1 /* With TERM EXCHANGE some FC cards refuse to boot */ | 5545 | #if 1 /* With TERM EXCHANGE some FC cards refuse to boot */ |
| 5524 | qlt_send_busy(vha, atio, 0); | 5546 | qlt_send_busy(vha, atio, 0); |
| 5525 | #else | 5547 | #else |
| 5526 | qlt_send_term_exchange(vha, NULL, atio, 1); | 5548 | qlt_send_term_exchange(vha, NULL, atio, 1, 0); |
| 5527 | #endif | 5549 | #endif |
| 5528 | } else { | 5550 | } else { |
| 5529 | if (tgt->tgt_stop) { | 5551 | if (tgt->tgt_stop) { |
| @@ -5532,7 +5554,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt) | |||
| 5532 | "command to target, sending TERM " | 5554 | "command to target, sending TERM " |
| 5533 | "EXCHANGE for rsp\n"); | 5555 | "EXCHANGE for rsp\n"); |
| 5534 | qlt_send_term_exchange(vha, NULL, | 5556 | qlt_send_term_exchange(vha, NULL, |
| 5535 | atio, 1); | 5557 | atio, 1, 0); |
| 5536 | } else { | 5558 | } else { |
| 5537 | ql_dbg(ql_dbg_tgt, vha, 0xe060, | 5559 | ql_dbg(ql_dbg_tgt, vha, 0xe060, |
| 5538 | "qla_target(%d): Unable to send " | 5560 | "qla_target(%d): Unable to send " |
| @@ -5960,7 +5982,7 @@ static void qlt_tmr_work(struct qla_tgt *tgt, | |||
| 5960 | return; | 5982 | return; |
| 5961 | 5983 | ||
| 5962 | out_term: | 5984 | out_term: |
| 5963 | qlt_send_term_exchange(vha, NULL, &prm->tm_iocb2, 0); | 5985 | qlt_send_term_exchange(vha, NULL, &prm->tm_iocb2, 1, 0); |
| 5964 | if (sess) | 5986 | if (sess) |
| 5965 | ha->tgt.tgt_ops->put_sess(sess); | 5987 | ha->tgt.tgt_ops->put_sess(sess); |
| 5966 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); | 5988 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 71b2865ba3c8..22a6a767fe07 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
| @@ -943,6 +943,36 @@ struct qla_tgt_sess { | |||
| 943 | qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX]; | 943 | qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX]; |
| 944 | }; | 944 | }; |
| 945 | 945 | ||
| 946 | typedef enum { | ||
| 947 | /* | ||
| 948 | * BIT_0 - Atio Arrival / schedule to work | ||
| 949 | * BIT_1 - qlt_do_work | ||
| 950 | * BIT_2 - qlt_do work failed | ||
| 951 | * BIT_3 - xfer rdy/tcm_qla2xxx_write_pending | ||
| 952 | * BIT_4 - read respond/tcm_qla2xx_queue_data_in | ||
| 953 | * BIT_5 - status respond / tcm_qla2xx_queue_status | ||
| 954 | * BIT_6 - tcm request to abort/Term exchange. | ||
| 955 | * pre_xmit_response->qlt_send_term_exchange | ||
| 956 | * BIT_7 - SRR received (qlt_handle_srr->qlt_xmit_response) | ||
| 957 | * BIT_8 - SRR received (qlt_handle_srr->qlt_rdy_to_xfer) | ||
| 958 | * BIT_9 - SRR received (qla_handle_srr->qlt_send_term_exchange) | ||
| 959 | * BIT_10 - Data in - hanlde_data->tcm_qla2xxx_handle_data | ||
| 960 | |||
| 961 | * BIT_12 - good completion - qlt_ctio_do_completion -->free_cmd | ||
| 962 | * BIT_13 - Bad completion - | ||
| 963 | * qlt_ctio_do_completion --> qlt_term_ctio_exchange | ||
| 964 | * BIT_14 - Back end data received/sent. | ||
| 965 | * BIT_15 - SRR prepare ctio | ||
| 966 | * BIT_16 - complete free | ||
| 967 | * BIT_17 - flush - qlt_abort_cmd_on_host_reset | ||
| 968 | * BIT_18 - completion w/abort status | ||
| 969 | * BIT_19 - completion w/unknown status | ||
| 970 | * BIT_20 - tcm_qla2xxx_free_cmd | ||
| 971 | */ | ||
| 972 | CMD_FLAG_DATA_WORK = BIT_11, | ||
| 973 | CMD_FLAG_DATA_WORK_FREE = BIT_21, | ||
| 974 | } cmd_flags_t; | ||
| 975 | |||
| 946 | struct qla_tgt_cmd { | 976 | struct qla_tgt_cmd { |
| 947 | struct se_cmd se_cmd; | 977 | struct se_cmd se_cmd; |
| 948 | struct qla_tgt_sess *sess; | 978 | struct qla_tgt_sess *sess; |
| @@ -952,6 +982,7 @@ struct qla_tgt_cmd { | |||
| 952 | /* Sense buffer that will be mapped into outgoing status */ | 982 | /* Sense buffer that will be mapped into outgoing status */ |
| 953 | unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; | 983 | unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; |
| 954 | 984 | ||
| 985 | spinlock_t cmd_lock; | ||
| 955 | /* to save extra sess dereferences */ | 986 | /* to save extra sess dereferences */ |
| 956 | unsigned int conf_compl_supported:1; | 987 | unsigned int conf_compl_supported:1; |
| 957 | unsigned int sg_mapped:1; | 988 | unsigned int sg_mapped:1; |
| @@ -986,30 +1017,8 @@ struct qla_tgt_cmd { | |||
| 986 | 1017 | ||
| 987 | uint64_t jiffies_at_alloc; | 1018 | uint64_t jiffies_at_alloc; |
| 988 | uint64_t jiffies_at_free; | 1019 | uint64_t jiffies_at_free; |
| 989 | /* BIT_0 - Atio Arrival / schedule to work | 1020 | |
| 990 | * BIT_1 - qlt_do_work | 1021 | cmd_flags_t cmd_flags; |
| 991 | * BIT_2 - qlt_do work failed | ||
| 992 | * BIT_3 - xfer rdy/tcm_qla2xxx_write_pending | ||
| 993 | * BIT_4 - read respond/tcm_qla2xx_queue_data_in | ||
| 994 | * BIT_5 - status respond / tcm_qla2xx_queue_status | ||
| 995 | * BIT_6 - tcm request to abort/Term exchange. | ||
| 996 | * pre_xmit_response->qlt_send_term_exchange | ||
| 997 | * BIT_7 - SRR received (qlt_handle_srr->qlt_xmit_response) | ||
| 998 | * BIT_8 - SRR received (qlt_handle_srr->qlt_rdy_to_xfer) | ||
| 999 | * BIT_9 - SRR received (qla_handle_srr->qlt_send_term_exchange) | ||
| 1000 | * BIT_10 - Data in - hanlde_data->tcm_qla2xxx_handle_data | ||
| 1001 | * BIT_11 - Data actually going to TCM : tcm_qla2xx_handle_data_work | ||
| 1002 | * BIT_12 - good completion - qlt_ctio_do_completion -->free_cmd | ||
| 1003 | * BIT_13 - Bad completion - | ||
| 1004 | * qlt_ctio_do_completion --> qlt_term_ctio_exchange | ||
| 1005 | * BIT_14 - Back end data received/sent. | ||
| 1006 | * BIT_15 - SRR prepare ctio | ||
| 1007 | * BIT_16 - complete free | ||
| 1008 | * BIT_17 - flush - qlt_abort_cmd_on_host_reset | ||
| 1009 | * BIT_18 - completion w/abort status | ||
| 1010 | * BIT_19 - completion w/unknown status | ||
| 1011 | */ | ||
| 1012 | uint32_t cmd_flags; | ||
| 1013 | }; | 1022 | }; |
| 1014 | 1023 | ||
| 1015 | struct qla_tgt_sess_work_param { | 1024 | struct qla_tgt_sess_work_param { |
| @@ -1148,7 +1157,7 @@ static inline void sid_to_portid(const uint8_t *s_id, port_id_t *p) | |||
| 1148 | extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); | 1157 | extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); |
| 1149 | extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); | 1158 | extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); |
| 1150 | extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); | 1159 | extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); |
| 1151 | extern void qlt_abort_cmd(struct qla_tgt_cmd *); | 1160 | extern int qlt_abort_cmd(struct qla_tgt_cmd *); |
| 1152 | extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); | 1161 | extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); |
| 1153 | extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); | 1162 | extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); |
| 1154 | extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); | 1163 | extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); |
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c index ddbe2e7ac14d..c3e622524604 100644 --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c | |||
| @@ -395,6 +395,10 @@ qla27xx_fwdt_entry_t263(struct scsi_qla_host *vha, | |||
| 395 | if (ent->t263.queue_type == T263_QUEUE_TYPE_REQ) { | 395 | if (ent->t263.queue_type == T263_QUEUE_TYPE_REQ) { |
| 396 | for (i = 0; i < vha->hw->max_req_queues; i++) { | 396 | for (i = 0; i < vha->hw->max_req_queues; i++) { |
| 397 | struct req_que *req = vha->hw->req_q_map[i]; | 397 | struct req_que *req = vha->hw->req_q_map[i]; |
| 398 | |||
| 399 | if (!test_bit(i, vha->hw->req_qid_map)) | ||
| 400 | continue; | ||
| 401 | |||
| 398 | if (req || !buf) { | 402 | if (req || !buf) { |
| 399 | length = req ? | 403 | length = req ? |
| 400 | req->length : REQUEST_ENTRY_CNT_24XX; | 404 | req->length : REQUEST_ENTRY_CNT_24XX; |
| @@ -408,6 +412,10 @@ qla27xx_fwdt_entry_t263(struct scsi_qla_host *vha, | |||
| 408 | } else if (ent->t263.queue_type == T263_QUEUE_TYPE_RSP) { | 412 | } else if (ent->t263.queue_type == T263_QUEUE_TYPE_RSP) { |
| 409 | for (i = 0; i < vha->hw->max_rsp_queues; i++) { | 413 | for (i = 0; i < vha->hw->max_rsp_queues; i++) { |
| 410 | struct rsp_que *rsp = vha->hw->rsp_q_map[i]; | 414 | struct rsp_que *rsp = vha->hw->rsp_q_map[i]; |
| 415 | |||
| 416 | if (!test_bit(i, vha->hw->rsp_qid_map)) | ||
| 417 | continue; | ||
| 418 | |||
| 411 | if (rsp || !buf) { | 419 | if (rsp || !buf) { |
| 412 | length = rsp ? | 420 | length = rsp ? |
| 413 | rsp->length : RESPONSE_ENTRY_CNT_MQ; | 421 | rsp->length : RESPONSE_ENTRY_CNT_MQ; |
| @@ -634,6 +642,10 @@ qla27xx_fwdt_entry_t274(struct scsi_qla_host *vha, | |||
| 634 | if (ent->t274.queue_type == T274_QUEUE_TYPE_REQ_SHAD) { | 642 | if (ent->t274.queue_type == T274_QUEUE_TYPE_REQ_SHAD) { |
| 635 | for (i = 0; i < vha->hw->max_req_queues; i++) { | 643 | for (i = 0; i < vha->hw->max_req_queues; i++) { |
| 636 | struct req_que *req = vha->hw->req_q_map[i]; | 644 | struct req_que *req = vha->hw->req_q_map[i]; |
| 645 | |||
| 646 | if (!test_bit(i, vha->hw->req_qid_map)) | ||
| 647 | continue; | ||
| 648 | |||
| 637 | if (req || !buf) { | 649 | if (req || !buf) { |
| 638 | qla27xx_insert16(i, buf, len); | 650 | qla27xx_insert16(i, buf, len); |
| 639 | qla27xx_insert16(1, buf, len); | 651 | qla27xx_insert16(1, buf, len); |
| @@ -645,6 +657,10 @@ qla27xx_fwdt_entry_t274(struct scsi_qla_host *vha, | |||
| 645 | } else if (ent->t274.queue_type == T274_QUEUE_TYPE_RSP_SHAD) { | 657 | } else if (ent->t274.queue_type == T274_QUEUE_TYPE_RSP_SHAD) { |
| 646 | for (i = 0; i < vha->hw->max_rsp_queues; i++) { | 658 | for (i = 0; i < vha->hw->max_rsp_queues; i++) { |
| 647 | struct rsp_que *rsp = vha->hw->rsp_q_map[i]; | 659 | struct rsp_que *rsp = vha->hw->rsp_q_map[i]; |
| 660 | |||
| 661 | if (!test_bit(i, vha->hw->rsp_qid_map)) | ||
| 662 | continue; | ||
| 663 | |||
| 648 | if (rsp || !buf) { | 664 | if (rsp || !buf) { |
| 649 | qla27xx_insert16(i, buf, len); | 665 | qla27xx_insert16(i, buf, len); |
| 650 | qla27xx_insert16(1, buf, len); | 666 | qla27xx_insert16(1, buf, len); |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index faf0a126627f..1808a01cfb7e 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
| @@ -298,6 +298,10 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd) | |||
| 298 | { | 298 | { |
| 299 | cmd->vha->tgt_counters.core_qla_free_cmd++; | 299 | cmd->vha->tgt_counters.core_qla_free_cmd++; |
| 300 | cmd->cmd_in_wq = 1; | 300 | cmd->cmd_in_wq = 1; |
| 301 | |||
| 302 | BUG_ON(cmd->cmd_flags & BIT_20); | ||
| 303 | cmd->cmd_flags |= BIT_20; | ||
| 304 | |||
| 301 | INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free); | 305 | INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free); |
| 302 | queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); | 306 | queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work); |
| 303 | } | 307 | } |
| @@ -374,6 +378,20 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) | |||
| 374 | { | 378 | { |
| 375 | struct qla_tgt_cmd *cmd = container_of(se_cmd, | 379 | struct qla_tgt_cmd *cmd = container_of(se_cmd, |
| 376 | struct qla_tgt_cmd, se_cmd); | 380 | struct qla_tgt_cmd, se_cmd); |
| 381 | |||
| 382 | if (cmd->aborted) { | ||
| 383 | /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task | ||
| 384 | * can get ahead of this cmd. tcm_qla2xxx_aborted_task | ||
| 385 | * already kick start the free. | ||
| 386 | */ | ||
| 387 | pr_debug("write_pending aborted cmd[%p] refcount %d " | ||
| 388 | "transport_state %x, t_state %x, se_cmd_flags %x\n", | ||
| 389 | cmd,cmd->se_cmd.cmd_kref.refcount.counter, | ||
| 390 | cmd->se_cmd.transport_state, | ||
| 391 | cmd->se_cmd.t_state, | ||
| 392 | cmd->se_cmd.se_cmd_flags); | ||
| 393 | return 0; | ||
| 394 | } | ||
| 377 | cmd->cmd_flags |= BIT_3; | 395 | cmd->cmd_flags |= BIT_3; |
| 378 | cmd->bufflen = se_cmd->data_length; | 396 | cmd->bufflen = se_cmd->data_length; |
| 379 | cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); | 397 | cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); |
| @@ -405,7 +423,7 @@ static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd) | |||
| 405 | se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { | 423 | se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { |
| 406 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | 424 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); |
| 407 | wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, | 425 | wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, |
| 408 | 3 * HZ); | 426 | 50); |
| 409 | return 0; | 427 | return 0; |
| 410 | } | 428 | } |
| 411 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | 429 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); |
| @@ -444,6 +462,9 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, | |||
| 444 | if (bidi) | 462 | if (bidi) |
| 445 | flags |= TARGET_SCF_BIDI_OP; | 463 | flags |= TARGET_SCF_BIDI_OP; |
| 446 | 464 | ||
| 465 | if (se_cmd->cpuid != WORK_CPU_UNBOUND) | ||
| 466 | flags |= TARGET_SCF_USE_CPUID; | ||
| 467 | |||
| 447 | sess = cmd->sess; | 468 | sess = cmd->sess; |
| 448 | if (!sess) { | 469 | if (!sess) { |
| 449 | pr_err("Unable to locate struct qla_tgt_sess from qla_tgt_cmd\n"); | 470 | pr_err("Unable to locate struct qla_tgt_sess from qla_tgt_cmd\n"); |
| @@ -465,13 +486,25 @@ static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd, | |||
| 465 | static void tcm_qla2xxx_handle_data_work(struct work_struct *work) | 486 | static void tcm_qla2xxx_handle_data_work(struct work_struct *work) |
| 466 | { | 487 | { |
| 467 | struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); | 488 | struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); |
| 489 | unsigned long flags; | ||
| 468 | 490 | ||
| 469 | /* | 491 | /* |
| 470 | * Ensure that the complete FCP WRITE payload has been received. | 492 | * Ensure that the complete FCP WRITE payload has been received. |
| 471 | * Otherwise return an exception via CHECK_CONDITION status. | 493 | * Otherwise return an exception via CHECK_CONDITION status. |
| 472 | */ | 494 | */ |
| 473 | cmd->cmd_in_wq = 0; | 495 | cmd->cmd_in_wq = 0; |
| 474 | cmd->cmd_flags |= BIT_11; | 496 | |
| 497 | spin_lock_irqsave(&cmd->cmd_lock, flags); | ||
| 498 | cmd->cmd_flags |= CMD_FLAG_DATA_WORK; | ||
| 499 | if (cmd->aborted) { | ||
| 500 | cmd->cmd_flags |= CMD_FLAG_DATA_WORK_FREE; | ||
| 501 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 502 | |||
| 503 | tcm_qla2xxx_free_cmd(cmd); | ||
| 504 | return; | ||
| 505 | } | ||
| 506 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 507 | |||
| 475 | cmd->vha->tgt_counters.qla_core_ret_ctio++; | 508 | cmd->vha->tgt_counters.qla_core_ret_ctio++; |
| 476 | if (!cmd->write_data_transferred) { | 509 | if (!cmd->write_data_transferred) { |
| 477 | /* | 510 | /* |
| @@ -546,6 +579,20 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd) | |||
| 546 | struct qla_tgt_cmd *cmd = container_of(se_cmd, | 579 | struct qla_tgt_cmd *cmd = container_of(se_cmd, |
| 547 | struct qla_tgt_cmd, se_cmd); | 580 | struct qla_tgt_cmd, se_cmd); |
| 548 | 581 | ||
| 582 | if (cmd->aborted) { | ||
| 583 | /* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task | ||
| 584 | * can get ahead of this cmd. tcm_qla2xxx_aborted_task | ||
| 585 | * already kick start the free. | ||
| 586 | */ | ||
| 587 | pr_debug("queue_data_in aborted cmd[%p] refcount %d " | ||
| 588 | "transport_state %x, t_state %x, se_cmd_flags %x\n", | ||
| 589 | cmd,cmd->se_cmd.cmd_kref.refcount.counter, | ||
| 590 | cmd->se_cmd.transport_state, | ||
| 591 | cmd->se_cmd.t_state, | ||
| 592 | cmd->se_cmd.se_cmd_flags); | ||
| 593 | return 0; | ||
| 594 | } | ||
| 595 | |||
| 549 | cmd->cmd_flags |= BIT_4; | 596 | cmd->cmd_flags |= BIT_4; |
| 550 | cmd->bufflen = se_cmd->data_length; | 597 | cmd->bufflen = se_cmd->data_length; |
| 551 | cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); | 598 | cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); |
| @@ -637,11 +684,34 @@ static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) | |||
| 637 | qlt_xmit_tm_rsp(mcmd); | 684 | qlt_xmit_tm_rsp(mcmd); |
| 638 | } | 685 | } |
| 639 | 686 | ||
| 687 | |||
| 688 | #define DATA_WORK_NOT_FREE(_flags) \ | ||
| 689 | (( _flags & (CMD_FLAG_DATA_WORK|CMD_FLAG_DATA_WORK_FREE)) == \ | ||
| 690 | CMD_FLAG_DATA_WORK) | ||
| 640 | static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) | 691 | static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) |
| 641 | { | 692 | { |
| 642 | struct qla_tgt_cmd *cmd = container_of(se_cmd, | 693 | struct qla_tgt_cmd *cmd = container_of(se_cmd, |
| 643 | struct qla_tgt_cmd, se_cmd); | 694 | struct qla_tgt_cmd, se_cmd); |
| 644 | qlt_abort_cmd(cmd); | 695 | unsigned long flags; |
| 696 | |||
| 697 | if (qlt_abort_cmd(cmd)) | ||
| 698 | return; | ||
| 699 | |||
| 700 | spin_lock_irqsave(&cmd->cmd_lock, flags); | ||
| 701 | if ((cmd->state == QLA_TGT_STATE_NEW)|| | ||
| 702 | ((cmd->state == QLA_TGT_STATE_DATA_IN) && | ||
| 703 | DATA_WORK_NOT_FREE(cmd->cmd_flags)) ) { | ||
| 704 | |||
| 705 | cmd->cmd_flags |= CMD_FLAG_DATA_WORK_FREE; | ||
| 706 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 707 | /* Cmd have not reached firmware. | ||
| 708 | * Use this trigger to free it. */ | ||
| 709 | tcm_qla2xxx_free_cmd(cmd); | ||
| 710 | return; | ||
| 711 | } | ||
| 712 | spin_unlock_irqrestore(&cmd->cmd_lock, flags); | ||
| 713 | return; | ||
| 714 | |||
| 645 | } | 715 | } |
| 646 | 716 | ||
| 647 | static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *, | 717 | static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *, |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 47b9d13f97b8..da2e068ee47d 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
| @@ -205,6 +205,7 @@ static struct { | |||
| 205 | {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, | 205 | {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, |
| 206 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 206 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
| 207 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, | 207 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, |
| 208 | {"Marvell", "Console", NULL, BLIST_SKIP_VPD_PAGES}, | ||
| 208 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 209 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
| 209 | {"MATSHITA", "DMC-LC5", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 210 | {"MATSHITA", "DMC-LC5", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
| 210 | {"MATSHITA", "DMC-LC40", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 211 | {"MATSHITA", "DMC-LC40", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb669d32ccd0..d749da765df1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -761,7 +761,7 @@ static int sd_setup_discard_cmnd(struct scsi_cmnd *cmd) | |||
| 761 | break; | 761 | break; |
| 762 | 762 | ||
| 763 | default: | 763 | default: |
| 764 | ret = BLKPREP_KILL; | 764 | ret = BLKPREP_INVALID; |
| 765 | goto out; | 765 | goto out; |
| 766 | } | 766 | } |
| 767 | 767 | ||
| @@ -839,7 +839,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd) | |||
| 839 | int ret; | 839 | int ret; |
| 840 | 840 | ||
| 841 | if (sdkp->device->no_write_same) | 841 | if (sdkp->device->no_write_same) |
| 842 | return BLKPREP_KILL; | 842 | return BLKPREP_INVALID; |
| 843 | 843 | ||
| 844 | BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size); | 844 | BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size); |
| 845 | 845 | ||
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 55627d097873..292c04eec9ad 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <scsi/scsi_devinfo.h> | 42 | #include <scsi/scsi_devinfo.h> |
| 43 | #include <scsi/scsi_dbg.h> | 43 | #include <scsi/scsi_dbg.h> |
| 44 | #include <scsi/scsi_transport_fc.h> | 44 | #include <scsi/scsi_transport_fc.h> |
| 45 | #include <scsi/scsi_transport.h> | ||
| 45 | 46 | ||
| 46 | /* | 47 | /* |
| 47 | * All wire protocol details (storage protocol between the guest and the host) | 48 | * All wire protocol details (storage protocol between the guest and the host) |
| @@ -477,19 +478,18 @@ struct hv_host_device { | |||
| 477 | struct storvsc_scan_work { | 478 | struct storvsc_scan_work { |
| 478 | struct work_struct work; | 479 | struct work_struct work; |
| 479 | struct Scsi_Host *host; | 480 | struct Scsi_Host *host; |
| 480 | uint lun; | 481 | u8 lun; |
| 482 | u8 tgt_id; | ||
| 481 | }; | 483 | }; |
| 482 | 484 | ||
| 483 | static void storvsc_device_scan(struct work_struct *work) | 485 | static void storvsc_device_scan(struct work_struct *work) |
| 484 | { | 486 | { |
| 485 | struct storvsc_scan_work *wrk; | 487 | struct storvsc_scan_work *wrk; |
| 486 | uint lun; | ||
| 487 | struct scsi_device *sdev; | 488 | struct scsi_device *sdev; |
| 488 | 489 | ||
| 489 | wrk = container_of(work, struct storvsc_scan_work, work); | 490 | wrk = container_of(work, struct storvsc_scan_work, work); |
| 490 | lun = wrk->lun; | ||
| 491 | 491 | ||
| 492 | sdev = scsi_device_lookup(wrk->host, 0, 0, lun); | 492 | sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk->lun); |
| 493 | if (!sdev) | 493 | if (!sdev) |
| 494 | goto done; | 494 | goto done; |
| 495 | scsi_rescan_device(&sdev->sdev_gendev); | 495 | scsi_rescan_device(&sdev->sdev_gendev); |
| @@ -540,7 +540,7 @@ static void storvsc_remove_lun(struct work_struct *work) | |||
| 540 | if (!scsi_host_get(wrk->host)) | 540 | if (!scsi_host_get(wrk->host)) |
| 541 | goto done; | 541 | goto done; |
| 542 | 542 | ||
| 543 | sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun); | 543 | sdev = scsi_device_lookup(wrk->host, 0, wrk->tgt_id, wrk->lun); |
| 544 | 544 | ||
| 545 | if (sdev) { | 545 | if (sdev) { |
| 546 | scsi_remove_device(sdev); | 546 | scsi_remove_device(sdev); |
| @@ -940,6 +940,7 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, | |||
| 940 | 940 | ||
| 941 | wrk->host = host; | 941 | wrk->host = host; |
| 942 | wrk->lun = vm_srb->lun; | 942 | wrk->lun = vm_srb->lun; |
| 943 | wrk->tgt_id = vm_srb->target_id; | ||
| 943 | INIT_WORK(&wrk->work, process_err_fn); | 944 | INIT_WORK(&wrk->work, process_err_fn); |
| 944 | schedule_work(&wrk->work); | 945 | schedule_work(&wrk->work); |
| 945 | } | 946 | } |
| @@ -1770,6 +1771,11 @@ static int __init storvsc_drv_init(void) | |||
| 1770 | fc_transport_template = fc_attach_transport(&fc_transport_functions); | 1771 | fc_transport_template = fc_attach_transport(&fc_transport_functions); |
| 1771 | if (!fc_transport_template) | 1772 | if (!fc_transport_template) |
| 1772 | return -ENODEV; | 1773 | return -ENODEV; |
| 1774 | |||
| 1775 | /* | ||
| 1776 | * Install Hyper-V specific timeout handler. | ||
| 1777 | */ | ||
| 1778 | fc_transport_template->eh_timed_out = storvsc_eh_timed_out; | ||
| 1773 | #endif | 1779 | #endif |
| 1774 | 1780 | ||
| 1775 | ret = vmbus_driver_register(&storvsc_drv); | 1781 | ret = vmbus_driver_register(&storvsc_drv); |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index aebad36391c9..8feac599e9ab 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
| @@ -1571,6 +1571,7 @@ static int atmel_spi_probe(struct platform_device *pdev) | |||
| 1571 | 1571 | ||
| 1572 | as->use_cs_gpios = true; | 1572 | as->use_cs_gpios = true; |
| 1573 | if (atmel_spi_is_v2(as) && | 1573 | if (atmel_spi_is_v2(as) && |
| 1574 | pdev->dev.of_node && | ||
| 1574 | !of_get_property(pdev->dev.of_node, "cs-gpios", NULL)) { | 1575 | !of_get_property(pdev->dev.of_node, "cs-gpios", NULL)) { |
| 1575 | as->use_cs_gpios = false; | 1576 | as->use_cs_gpios = false; |
| 1576 | master->num_chipselect = 4; | 1577 | master->num_chipselect = 4; |
diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c index 7de6f8472a81..ecc73c0a97cf 100644 --- a/drivers/spi/spi-bcm2835aux.c +++ b/drivers/spi/spi-bcm2835aux.c | |||
| @@ -73,8 +73,8 @@ | |||
| 73 | 73 | ||
| 74 | /* Bitfields in CNTL1 */ | 74 | /* Bitfields in CNTL1 */ |
| 75 | #define BCM2835_AUX_SPI_CNTL1_CSHIGH 0x00000700 | 75 | #define BCM2835_AUX_SPI_CNTL1_CSHIGH 0x00000700 |
| 76 | #define BCM2835_AUX_SPI_CNTL1_IDLE 0x00000080 | 76 | #define BCM2835_AUX_SPI_CNTL1_TXEMPTY 0x00000080 |
| 77 | #define BCM2835_AUX_SPI_CNTL1_TXEMPTY 0x00000040 | 77 | #define BCM2835_AUX_SPI_CNTL1_IDLE 0x00000040 |
| 78 | #define BCM2835_AUX_SPI_CNTL1_MSBF_IN 0x00000002 | 78 | #define BCM2835_AUX_SPI_CNTL1_MSBF_IN 0x00000002 |
| 79 | #define BCM2835_AUX_SPI_CNTL1_KEEP_IN 0x00000001 | 79 | #define BCM2835_AUX_SPI_CNTL1_KEEP_IN 0x00000001 |
| 80 | 80 | ||
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 7fd6a4c009d2..7cb0c1921495 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
| @@ -84,7 +84,7 @@ struct fsl_espi_transfer { | |||
| 84 | /* SPCOM register values */ | 84 | /* SPCOM register values */ |
| 85 | #define SPCOM_CS(x) ((x) << 30) | 85 | #define SPCOM_CS(x) ((x) << 30) |
| 86 | #define SPCOM_TRANLEN(x) ((x) << 0) | 86 | #define SPCOM_TRANLEN(x) ((x) << 0) |
| 87 | #define SPCOM_TRANLEN_MAX 0xFFFF /* Max transaction length */ | 87 | #define SPCOM_TRANLEN_MAX 0x10000 /* Max transaction length */ |
| 88 | 88 | ||
| 89 | #define AUTOSUSPEND_TIMEOUT 2000 | 89 | #define AUTOSUSPEND_TIMEOUT 2000 |
| 90 | 90 | ||
| @@ -233,7 +233,7 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
| 233 | reinit_completion(&mpc8xxx_spi->done); | 233 | reinit_completion(&mpc8xxx_spi->done); |
| 234 | 234 | ||
| 235 | /* Set SPCOM[CS] and SPCOM[TRANLEN] field */ | 235 | /* Set SPCOM[CS] and SPCOM[TRANLEN] field */ |
| 236 | if ((t->len - 1) > SPCOM_TRANLEN_MAX) { | 236 | if (t->len > SPCOM_TRANLEN_MAX) { |
| 237 | dev_err(mpc8xxx_spi->dev, "Transaction length (%d)" | 237 | dev_err(mpc8xxx_spi->dev, "Transaction length (%d)" |
| 238 | " beyond the SPCOM[TRANLEN] field\n", t->len); | 238 | " beyond the SPCOM[TRANLEN] field\n", t->len); |
| 239 | return -EINVAL; | 239 | return -EINVAL; |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index d98c33cb64f9..6a4ff27f4357 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
| @@ -929,7 +929,7 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 929 | tx->sgl, tx->nents, DMA_MEM_TO_DEV, | 929 | tx->sgl, tx->nents, DMA_MEM_TO_DEV, |
| 930 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 930 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 931 | if (!desc_tx) | 931 | if (!desc_tx) |
| 932 | goto no_dma; | 932 | goto tx_nodma; |
| 933 | 933 | ||
| 934 | desc_tx->callback = spi_imx_dma_tx_callback; | 934 | desc_tx->callback = spi_imx_dma_tx_callback; |
| 935 | desc_tx->callback_param = (void *)spi_imx; | 935 | desc_tx->callback_param = (void *)spi_imx; |
| @@ -941,7 +941,7 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 941 | rx->sgl, rx->nents, DMA_DEV_TO_MEM, | 941 | rx->sgl, rx->nents, DMA_DEV_TO_MEM, |
| 942 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 942 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 943 | if (!desc_rx) | 943 | if (!desc_rx) |
| 944 | goto no_dma; | 944 | goto rx_nodma; |
| 945 | 945 | ||
| 946 | desc_rx->callback = spi_imx_dma_rx_callback; | 946 | desc_rx->callback = spi_imx_dma_rx_callback; |
| 947 | desc_rx->callback_param = (void *)spi_imx; | 947 | desc_rx->callback_param = (void *)spi_imx; |
| @@ -1008,7 +1008,9 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx, | |||
| 1008 | 1008 | ||
| 1009 | return ret; | 1009 | return ret; |
| 1010 | 1010 | ||
| 1011 | no_dma: | 1011 | rx_nodma: |
| 1012 | dmaengine_terminate_all(master->dma_tx); | ||
| 1013 | tx_nodma: | ||
| 1012 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | 1014 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", |
| 1013 | dev_driver_string(&master->dev), | 1015 | dev_driver_string(&master->dev), |
| 1014 | dev_name(&master->dev)); | 1016 | dev_name(&master->dev)); |
diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 894616f687b0..cf4bb36bee25 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c | |||
| @@ -761,6 +761,7 @@ static int spi_test_run_iter(struct spi_device *spi, | |||
| 761 | test.iterate_transfer_mask = 1; | 761 | test.iterate_transfer_mask = 1; |
| 762 | 762 | ||
| 763 | /* count number of transfers with tx/rx_buf != NULL */ | 763 | /* count number of transfers with tx/rx_buf != NULL */ |
| 764 | rx_count = tx_count = 0; | ||
| 764 | for (i = 0; i < test.transfer_count; i++) { | 765 | for (i = 0; i < test.transfer_count; i++) { |
| 765 | if (test.transfers[i].tx_buf) | 766 | if (test.transfers[i].tx_buf) |
| 766 | tx_count++; | 767 | tx_count++; |
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 7273820275e9..0caa3c8bef46 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
| @@ -1490,6 +1490,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev) | |||
| 1490 | return status; | 1490 | return status; |
| 1491 | 1491 | ||
| 1492 | disable_pm: | 1492 | disable_pm: |
| 1493 | pm_runtime_dont_use_autosuspend(&pdev->dev); | ||
| 1494 | pm_runtime_put_sync(&pdev->dev); | ||
| 1493 | pm_runtime_disable(&pdev->dev); | 1495 | pm_runtime_disable(&pdev->dev); |
| 1494 | free_master: | 1496 | free_master: |
| 1495 | spi_master_put(master); | 1497 | spi_master_put(master); |
| @@ -1501,6 +1503,7 @@ static int omap2_mcspi_remove(struct platform_device *pdev) | |||
| 1501 | struct spi_master *master = platform_get_drvdata(pdev); | 1503 | struct spi_master *master = platform_get_drvdata(pdev); |
| 1502 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); | 1504 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); |
| 1503 | 1505 | ||
| 1506 | pm_runtime_dont_use_autosuspend(mcspi->dev); | ||
| 1504 | pm_runtime_put_sync(mcspi->dev); | 1507 | pm_runtime_put_sync(mcspi->dev); |
| 1505 | pm_runtime_disable(&pdev->dev); | 1508 | pm_runtime_disable(&pdev->dev); |
| 1506 | 1509 | ||
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 3327c49674d3..713c63d9681b 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
| @@ -898,7 +898,7 @@ static ssize_t unmap_zeroes_data_store(struct config_item *item, | |||
| 898 | da->unmap_zeroes_data = flag; | 898 | da->unmap_zeroes_data = flag; |
| 899 | pr_debug("dev[%p]: SE Device Thin Provisioning LBPRZ bit: %d\n", | 899 | pr_debug("dev[%p]: SE Device Thin Provisioning LBPRZ bit: %d\n", |
| 900 | da->da_dev, flag); | 900 | da->da_dev, flag); |
| 901 | return 0; | 901 | return count; |
| 902 | } | 902 | } |
| 903 | 903 | ||
| 904 | /* | 904 | /* |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index cacd97a8cbd0..da457e25717a 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -828,6 +828,50 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) | |||
| 828 | return dev; | 828 | return dev; |
| 829 | } | 829 | } |
| 830 | 830 | ||
| 831 | /* | ||
| 832 | * Check if the underlying struct block_device request_queue supports | ||
| 833 | * the QUEUE_FLAG_DISCARD bit for UNMAP/WRITE_SAME in SCSI + TRIM | ||
| 834 | * in ATA and we need to set TPE=1 | ||
| 835 | */ | ||
| 836 | bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, | ||
| 837 | struct request_queue *q, int block_size) | ||
| 838 | { | ||
| 839 | if (!blk_queue_discard(q)) | ||
| 840 | return false; | ||
| 841 | |||
| 842 | attrib->max_unmap_lba_count = (q->limits.max_discard_sectors << 9) / | ||
| 843 | block_size; | ||
| 844 | /* | ||
| 845 | * Currently hardcoded to 1 in Linux/SCSI code.. | ||
| 846 | */ | ||
| 847 | attrib->max_unmap_block_desc_count = 1; | ||
| 848 | attrib->unmap_granularity = q->limits.discard_granularity / block_size; | ||
| 849 | attrib->unmap_granularity_alignment = q->limits.discard_alignment / | ||
| 850 | block_size; | ||
| 851 | attrib->unmap_zeroes_data = q->limits.discard_zeroes_data; | ||
| 852 | return true; | ||
| 853 | } | ||
| 854 | EXPORT_SYMBOL(target_configure_unmap_from_queue); | ||
| 855 | |||
| 856 | /* | ||
| 857 | * Convert from blocksize advertised to the initiator to the 512 byte | ||
| 858 | * units unconditionally used by the Linux block layer. | ||
| 859 | */ | ||
| 860 | sector_t target_to_linux_sector(struct se_device *dev, sector_t lb) | ||
| 861 | { | ||
| 862 | switch (dev->dev_attrib.block_size) { | ||
| 863 | case 4096: | ||
| 864 | return lb << 3; | ||
| 865 | case 2048: | ||
| 866 | return lb << 2; | ||
| 867 | case 1024: | ||
| 868 | return lb << 1; | ||
| 869 | default: | ||
| 870 | return lb; | ||
| 871 | } | ||
| 872 | } | ||
| 873 | EXPORT_SYMBOL(target_to_linux_sector); | ||
| 874 | |||
| 831 | int target_configure_device(struct se_device *dev) | 875 | int target_configure_device(struct se_device *dev) |
| 832 | { | 876 | { |
| 833 | struct se_hba *hba = dev->se_hba; | 877 | struct se_hba *hba = dev->se_hba; |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index e3195700211a..75f0f08b2a34 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
| @@ -160,25 +160,11 @@ static int fd_configure_device(struct se_device *dev) | |||
| 160 | " block_device blocks: %llu logical_block_size: %d\n", | 160 | " block_device blocks: %llu logical_block_size: %d\n", |
| 161 | dev_size, div_u64(dev_size, fd_dev->fd_block_size), | 161 | dev_size, div_u64(dev_size, fd_dev->fd_block_size), |
| 162 | fd_dev->fd_block_size); | 162 | fd_dev->fd_block_size); |
| 163 | /* | 163 | |
| 164 | * Check if the underlying struct block_device request_queue supports | 164 | if (target_configure_unmap_from_queue(&dev->dev_attrib, q, |
| 165 | * the QUEUE_FLAG_DISCARD bit for UNMAP/WRITE_SAME in SCSI + TRIM | 165 | fd_dev->fd_block_size)) |
| 166 | * in ATA and we need to set TPE=1 | ||
| 167 | */ | ||
| 168 | if (blk_queue_discard(q)) { | ||
| 169 | dev->dev_attrib.max_unmap_lba_count = | ||
| 170 | q->limits.max_discard_sectors; | ||
| 171 | /* | ||
| 172 | * Currently hardcoded to 1 in Linux/SCSI code.. | ||
| 173 | */ | ||
| 174 | dev->dev_attrib.max_unmap_block_desc_count = 1; | ||
| 175 | dev->dev_attrib.unmap_granularity = | ||
| 176 | q->limits.discard_granularity >> 9; | ||
| 177 | dev->dev_attrib.unmap_granularity_alignment = | ||
| 178 | q->limits.discard_alignment; | ||
| 179 | pr_debug("IFILE: BLOCK Discard support available," | 166 | pr_debug("IFILE: BLOCK Discard support available," |
| 180 | " disabled by default\n"); | 167 | " disabled by default\n"); |
| 181 | } | ||
| 182 | /* | 168 | /* |
| 183 | * Enable write same emulation for IBLOCK and use 0xFFFF as | 169 | * Enable write same emulation for IBLOCK and use 0xFFFF as |
| 184 | * the smaller WRITE_SAME(10) only has a two-byte block count. | 170 | * the smaller WRITE_SAME(10) only has a two-byte block count. |
| @@ -490,9 +476,12 @@ fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) | |||
| 490 | if (S_ISBLK(inode->i_mode)) { | 476 | if (S_ISBLK(inode->i_mode)) { |
| 491 | /* The backend is block device, use discard */ | 477 | /* The backend is block device, use discard */ |
| 492 | struct block_device *bdev = inode->i_bdev; | 478 | struct block_device *bdev = inode->i_bdev; |
| 479 | struct se_device *dev = cmd->se_dev; | ||
| 493 | 480 | ||
| 494 | ret = blkdev_issue_discard(bdev, lba, | 481 | ret = blkdev_issue_discard(bdev, |
| 495 | nolb, GFP_KERNEL, 0); | 482 | target_to_linux_sector(dev, lba), |
| 483 | target_to_linux_sector(dev, nolb), | ||
| 484 | GFP_KERNEL, 0); | ||
| 496 | if (ret < 0) { | 485 | if (ret < 0) { |
| 497 | pr_warn("FILEIO: blkdev_issue_discard() failed: %d\n", | 486 | pr_warn("FILEIO: blkdev_issue_discard() failed: %d\n", |
| 498 | ret); | 487 | ret); |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 5a2899f9f50b..abe4eb997a84 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
| @@ -121,29 +121,11 @@ static int iblock_configure_device(struct se_device *dev) | |||
| 121 | dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); | 121 | dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); |
| 122 | dev->dev_attrib.hw_queue_depth = q->nr_requests; | 122 | dev->dev_attrib.hw_queue_depth = q->nr_requests; |
| 123 | 123 | ||
| 124 | /* | 124 | if (target_configure_unmap_from_queue(&dev->dev_attrib, q, |
| 125 | * Check if the underlying struct block_device request_queue supports | 125 | dev->dev_attrib.hw_block_size)) |
| 126 | * the QUEUE_FLAG_DISCARD bit for UNMAP/WRITE_SAME in SCSI + TRIM | ||
| 127 | * in ATA and we need to set TPE=1 | ||
| 128 | */ | ||
| 129 | if (blk_queue_discard(q)) { | ||
| 130 | dev->dev_attrib.max_unmap_lba_count = | ||
| 131 | q->limits.max_discard_sectors; | ||
| 132 | |||
| 133 | /* | ||
| 134 | * Currently hardcoded to 1 in Linux/SCSI code.. | ||
| 135 | */ | ||
| 136 | dev->dev_attrib.max_unmap_block_desc_count = 1; | ||
| 137 | dev->dev_attrib.unmap_granularity = | ||
| 138 | q->limits.discard_granularity >> 9; | ||
| 139 | dev->dev_attrib.unmap_granularity_alignment = | ||
| 140 | q->limits.discard_alignment; | ||
| 141 | dev->dev_attrib.unmap_zeroes_data = | ||
| 142 | q->limits.discard_zeroes_data; | ||
| 143 | |||
| 144 | pr_debug("IBLOCK: BLOCK Discard support available," | 126 | pr_debug("IBLOCK: BLOCK Discard support available," |
| 145 | " disabled by default\n"); | 127 | " disabled by default\n"); |
| 146 | } | 128 | |
| 147 | /* | 129 | /* |
| 148 | * Enable write same emulation for IBLOCK and use 0xFFFF as | 130 | * Enable write same emulation for IBLOCK and use 0xFFFF as |
| 149 | * the smaller WRITE_SAME(10) only has a two-byte block count. | 131 | * the smaller WRITE_SAME(10) only has a two-byte block count. |
| @@ -415,9 +397,13 @@ static sense_reason_t | |||
| 415 | iblock_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) | 397 | iblock_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) |
| 416 | { | 398 | { |
| 417 | struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd; | 399 | struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd; |
| 400 | struct se_device *dev = cmd->se_dev; | ||
| 418 | int ret; | 401 | int ret; |
| 419 | 402 | ||
| 420 | ret = blkdev_issue_discard(bdev, lba, nolb, GFP_KERNEL, 0); | 403 | ret = blkdev_issue_discard(bdev, |
| 404 | target_to_linux_sector(dev, lba), | ||
| 405 | target_to_linux_sector(dev, nolb), | ||
| 406 | GFP_KERNEL, 0); | ||
| 421 | if (ret < 0) { | 407 | if (ret < 0) { |
| 422 | pr_err("blkdev_issue_discard() failed: %d\n", ret); | 408 | pr_err("blkdev_issue_discard() failed: %d\n", ret); |
| 423 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 409 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| @@ -433,8 +419,10 @@ iblock_execute_write_same(struct se_cmd *cmd) | |||
| 433 | struct scatterlist *sg; | 419 | struct scatterlist *sg; |
| 434 | struct bio *bio; | 420 | struct bio *bio; |
| 435 | struct bio_list list; | 421 | struct bio_list list; |
| 436 | sector_t block_lba = cmd->t_task_lba; | 422 | struct se_device *dev = cmd->se_dev; |
| 437 | sector_t sectors = sbc_get_write_same_sectors(cmd); | 423 | sector_t block_lba = target_to_linux_sector(dev, cmd->t_task_lba); |
| 424 | sector_t sectors = target_to_linux_sector(dev, | ||
| 425 | sbc_get_write_same_sectors(cmd)); | ||
| 438 | 426 | ||
| 439 | if (cmd->prot_op) { | 427 | if (cmd->prot_op) { |
| 440 | pr_err("WRITE_SAME: Protection information with IBLOCK" | 428 | pr_err("WRITE_SAME: Protection information with IBLOCK" |
| @@ -648,12 +636,12 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 648 | enum dma_data_direction data_direction) | 636 | enum dma_data_direction data_direction) |
| 649 | { | 637 | { |
| 650 | struct se_device *dev = cmd->se_dev; | 638 | struct se_device *dev = cmd->se_dev; |
| 639 | sector_t block_lba = target_to_linux_sector(dev, cmd->t_task_lba); | ||
| 651 | struct iblock_req *ibr; | 640 | struct iblock_req *ibr; |
| 652 | struct bio *bio, *bio_start; | 641 | struct bio *bio, *bio_start; |
| 653 | struct bio_list list; | 642 | struct bio_list list; |
| 654 | struct scatterlist *sg; | 643 | struct scatterlist *sg; |
| 655 | u32 sg_num = sgl_nents; | 644 | u32 sg_num = sgl_nents; |
| 656 | sector_t block_lba; | ||
| 657 | unsigned bio_cnt; | 645 | unsigned bio_cnt; |
| 658 | int rw = 0; | 646 | int rw = 0; |
| 659 | int i; | 647 | int i; |
| @@ -679,24 +667,6 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 679 | rw = READ; | 667 | rw = READ; |
| 680 | } | 668 | } |
| 681 | 669 | ||
| 682 | /* | ||
| 683 | * Convert the blocksize advertised to the initiator to the 512 byte | ||
| 684 | * units unconditionally used by the Linux block layer. | ||
| 685 | */ | ||
| 686 | if (dev->dev_attrib.block_size == 4096) | ||
| 687 | block_lba = (cmd->t_task_lba << 3); | ||
| 688 | else if (dev->dev_attrib.block_size == 2048) | ||
| 689 | block_lba = (cmd->t_task_lba << 2); | ||
| 690 | else if (dev->dev_attrib.block_size == 1024) | ||
| 691 | block_lba = (cmd->t_task_lba << 1); | ||
| 692 | else if (dev->dev_attrib.block_size == 512) | ||
| 693 | block_lba = cmd->t_task_lba; | ||
| 694 | else { | ||
| 695 | pr_err("Unsupported SCSI -> BLOCK LBA conversion:" | ||
| 696 | " %u\n", dev->dev_attrib.block_size); | ||
| 697 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 698 | } | ||
| 699 | |||
| 700 | ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL); | 670 | ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL); |
| 701 | if (!ibr) | 671 | if (!ibr) |
| 702 | goto fail; | 672 | goto fail; |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index dae0750c2032..db4412fe6b8a 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
| @@ -141,7 +141,6 @@ void transport_dump_vpd_proto_id(struct t10_vpd *, unsigned char *, int); | |||
| 141 | int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int); | 141 | int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int); |
| 142 | int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int); | 142 | int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int); |
| 143 | int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int); | 143 | int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int); |
| 144 | bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags); | ||
| 145 | void transport_clear_lun_ref(struct se_lun *); | 144 | void transport_clear_lun_ref(struct se_lun *); |
| 146 | void transport_send_task_abort(struct se_cmd *); | 145 | void transport_send_task_abort(struct se_cmd *); |
| 147 | sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size); | 146 | sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size); |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index fcdcb117c60d..82a663ba9800 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
| @@ -68,23 +68,25 @@ void core_tmr_release_req(struct se_tmr_req *tmr) | |||
| 68 | 68 | ||
| 69 | if (dev) { | 69 | if (dev) { |
| 70 | spin_lock_irqsave(&dev->se_tmr_lock, flags); | 70 | spin_lock_irqsave(&dev->se_tmr_lock, flags); |
| 71 | list_del(&tmr->tmr_list); | 71 | list_del_init(&tmr->tmr_list); |
| 72 | spin_unlock_irqrestore(&dev->se_tmr_lock, flags); | 72 | spin_unlock_irqrestore(&dev->se_tmr_lock, flags); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | kfree(tmr); | 75 | kfree(tmr); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | static void core_tmr_handle_tas_abort( | 78 | static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) |
| 79 | struct se_node_acl *tmr_nacl, | ||
| 80 | struct se_cmd *cmd, | ||
| 81 | int tas) | ||
| 82 | { | 79 | { |
| 83 | bool remove = true; | 80 | unsigned long flags; |
| 81 | bool remove = true, send_tas; | ||
| 84 | /* | 82 | /* |
| 85 | * TASK ABORTED status (TAS) bit support | 83 | * TASK ABORTED status (TAS) bit support |
| 86 | */ | 84 | */ |
| 87 | if ((tmr_nacl && (tmr_nacl != cmd->se_sess->se_node_acl)) && tas) { | 85 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
| 86 | send_tas = (cmd->transport_state & CMD_T_TAS); | ||
| 87 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 88 | |||
| 89 | if (send_tas) { | ||
| 88 | remove = false; | 90 | remove = false; |
| 89 | transport_send_task_abort(cmd); | 91 | transport_send_task_abort(cmd); |
| 90 | } | 92 | } |
| @@ -107,6 +109,46 @@ static int target_check_cdb_and_preempt(struct list_head *list, | |||
| 107 | return 1; | 109 | return 1; |
| 108 | } | 110 | } |
| 109 | 111 | ||
| 112 | static bool __target_check_io_state(struct se_cmd *se_cmd, | ||
| 113 | struct se_session *tmr_sess, int tas) | ||
| 114 | { | ||
| 115 | struct se_session *sess = se_cmd->se_sess; | ||
| 116 | |||
| 117 | assert_spin_locked(&sess->sess_cmd_lock); | ||
| 118 | WARN_ON_ONCE(!irqs_disabled()); | ||
| 119 | /* | ||
| 120 | * If command already reached CMD_T_COMPLETE state within | ||
| 121 | * target_complete_cmd() or CMD_T_FABRIC_STOP due to shutdown, | ||
| 122 | * this se_cmd has been passed to fabric driver and will | ||
| 123 | * not be aborted. | ||
| 124 | * | ||
| 125 | * Otherwise, obtain a local se_cmd->cmd_kref now for TMR | ||
| 126 | * ABORT_TASK + LUN_RESET for CMD_T_ABORTED processing as | ||
| 127 | * long as se_cmd->cmd_kref is still active unless zero. | ||
| 128 | */ | ||
| 129 | spin_lock(&se_cmd->t_state_lock); | ||
| 130 | if (se_cmd->transport_state & (CMD_T_COMPLETE | CMD_T_FABRIC_STOP)) { | ||
| 131 | pr_debug("Attempted to abort io tag: %llu already complete or" | ||
| 132 | " fabric stop, skipping\n", se_cmd->tag); | ||
| 133 | spin_unlock(&se_cmd->t_state_lock); | ||
| 134 | return false; | ||
| 135 | } | ||
| 136 | if (sess->sess_tearing_down || se_cmd->cmd_wait_set) { | ||
| 137 | pr_debug("Attempted to abort io tag: %llu already shutdown," | ||
| 138 | " skipping\n", se_cmd->tag); | ||
| 139 | spin_unlock(&se_cmd->t_state_lock); | ||
| 140 | return false; | ||
| 141 | } | ||
| 142 | se_cmd->transport_state |= CMD_T_ABORTED; | ||
| 143 | |||
| 144 | if ((tmr_sess != se_cmd->se_sess) && tas) | ||
| 145 | se_cmd->transport_state |= CMD_T_TAS; | ||
| 146 | |||
| 147 | spin_unlock(&se_cmd->t_state_lock); | ||
| 148 | |||
| 149 | return kref_get_unless_zero(&se_cmd->cmd_kref); | ||
| 150 | } | ||
| 151 | |||
| 110 | void core_tmr_abort_task( | 152 | void core_tmr_abort_task( |
| 111 | struct se_device *dev, | 153 | struct se_device *dev, |
| 112 | struct se_tmr_req *tmr, | 154 | struct se_tmr_req *tmr, |
| @@ -130,34 +172,22 @@ void core_tmr_abort_task( | |||
| 130 | if (tmr->ref_task_tag != ref_tag) | 172 | if (tmr->ref_task_tag != ref_tag) |
| 131 | continue; | 173 | continue; |
| 132 | 174 | ||
| 133 | if (!kref_get_unless_zero(&se_cmd->cmd_kref)) | ||
| 134 | continue; | ||
| 135 | |||
| 136 | printk("ABORT_TASK: Found referenced %s task_tag: %llu\n", | 175 | printk("ABORT_TASK: Found referenced %s task_tag: %llu\n", |
| 137 | se_cmd->se_tfo->get_fabric_name(), ref_tag); | 176 | se_cmd->se_tfo->get_fabric_name(), ref_tag); |
| 138 | 177 | ||
| 139 | spin_lock(&se_cmd->t_state_lock); | 178 | if (!__target_check_io_state(se_cmd, se_sess, 0)) { |
| 140 | if (se_cmd->transport_state & CMD_T_COMPLETE) { | ||
| 141 | printk("ABORT_TASK: ref_tag: %llu already complete," | ||
| 142 | " skipping\n", ref_tag); | ||
| 143 | spin_unlock(&se_cmd->t_state_lock); | ||
| 144 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 179 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 145 | |||
| 146 | target_put_sess_cmd(se_cmd); | 180 | target_put_sess_cmd(se_cmd); |
| 147 | |||
| 148 | goto out; | 181 | goto out; |
| 149 | } | 182 | } |
| 150 | se_cmd->transport_state |= CMD_T_ABORTED; | ||
| 151 | spin_unlock(&se_cmd->t_state_lock); | ||
| 152 | |||
| 153 | list_del_init(&se_cmd->se_cmd_list); | 183 | list_del_init(&se_cmd->se_cmd_list); |
| 154 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 184 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 155 | 185 | ||
| 156 | cancel_work_sync(&se_cmd->work); | 186 | cancel_work_sync(&se_cmd->work); |
| 157 | transport_wait_for_tasks(se_cmd); | 187 | transport_wait_for_tasks(se_cmd); |
| 158 | 188 | ||
| 159 | target_put_sess_cmd(se_cmd); | ||
| 160 | transport_cmd_finish_abort(se_cmd, true); | 189 | transport_cmd_finish_abort(se_cmd, true); |
| 190 | target_put_sess_cmd(se_cmd); | ||
| 161 | 191 | ||
| 162 | printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" | 192 | printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" |
| 163 | " ref_tag: %llu\n", ref_tag); | 193 | " ref_tag: %llu\n", ref_tag); |
| @@ -178,9 +208,11 @@ static void core_tmr_drain_tmr_list( | |||
| 178 | struct list_head *preempt_and_abort_list) | 208 | struct list_head *preempt_and_abort_list) |
| 179 | { | 209 | { |
| 180 | LIST_HEAD(drain_tmr_list); | 210 | LIST_HEAD(drain_tmr_list); |
| 211 | struct se_session *sess; | ||
| 181 | struct se_tmr_req *tmr_p, *tmr_pp; | 212 | struct se_tmr_req *tmr_p, *tmr_pp; |
| 182 | struct se_cmd *cmd; | 213 | struct se_cmd *cmd; |
| 183 | unsigned long flags; | 214 | unsigned long flags; |
| 215 | bool rc; | ||
| 184 | /* | 216 | /* |
| 185 | * Release all pending and outgoing TMRs aside from the received | 217 | * Release all pending and outgoing TMRs aside from the received |
| 186 | * LUN_RESET tmr.. | 218 | * LUN_RESET tmr.. |
| @@ -206,17 +238,39 @@ static void core_tmr_drain_tmr_list( | |||
| 206 | if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) | 238 | if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) |
| 207 | continue; | 239 | continue; |
| 208 | 240 | ||
| 241 | sess = cmd->se_sess; | ||
| 242 | if (WARN_ON_ONCE(!sess)) | ||
| 243 | continue; | ||
| 244 | |||
| 245 | spin_lock(&sess->sess_cmd_lock); | ||
| 209 | spin_lock(&cmd->t_state_lock); | 246 | spin_lock(&cmd->t_state_lock); |
| 210 | if (!(cmd->transport_state & CMD_T_ACTIVE)) { | 247 | if (!(cmd->transport_state & CMD_T_ACTIVE) || |
| 248 | (cmd->transport_state & CMD_T_FABRIC_STOP)) { | ||
| 211 | spin_unlock(&cmd->t_state_lock); | 249 | spin_unlock(&cmd->t_state_lock); |
| 250 | spin_unlock(&sess->sess_cmd_lock); | ||
| 212 | continue; | 251 | continue; |
| 213 | } | 252 | } |
| 214 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { | 253 | if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { |
| 215 | spin_unlock(&cmd->t_state_lock); | 254 | spin_unlock(&cmd->t_state_lock); |
| 255 | spin_unlock(&sess->sess_cmd_lock); | ||
| 216 | continue; | 256 | continue; |
| 217 | } | 257 | } |
| 258 | if (sess->sess_tearing_down || cmd->cmd_wait_set) { | ||
| 259 | spin_unlock(&cmd->t_state_lock); | ||
| 260 | spin_unlock(&sess->sess_cmd_lock); | ||
| 261 | continue; | ||
| 262 | } | ||
| 263 | cmd->transport_state |= CMD_T_ABORTED; | ||
| 218 | spin_unlock(&cmd->t_state_lock); | 264 | spin_unlock(&cmd->t_state_lock); |
| 219 | 265 | ||
| 266 | rc = kref_get_unless_zero(&cmd->cmd_kref); | ||
| 267 | if (!rc) { | ||
| 268 | printk("LUN_RESET TMR: non-zero kref_get_unless_zero\n"); | ||
| 269 | spin_unlock(&sess->sess_cmd_lock); | ||
| 270 | continue; | ||
| 271 | } | ||
| 272 | spin_unlock(&sess->sess_cmd_lock); | ||
| 273 | |||
| 220 | list_move_tail(&tmr_p->tmr_list, &drain_tmr_list); | 274 | list_move_tail(&tmr_p->tmr_list, &drain_tmr_list); |
| 221 | } | 275 | } |
| 222 | spin_unlock_irqrestore(&dev->se_tmr_lock, flags); | 276 | spin_unlock_irqrestore(&dev->se_tmr_lock, flags); |
| @@ -230,20 +284,26 @@ static void core_tmr_drain_tmr_list( | |||
| 230 | (preempt_and_abort_list) ? "Preempt" : "", tmr_p, | 284 | (preempt_and_abort_list) ? "Preempt" : "", tmr_p, |
| 231 | tmr_p->function, tmr_p->response, cmd->t_state); | 285 | tmr_p->function, tmr_p->response, cmd->t_state); |
| 232 | 286 | ||
| 287 | cancel_work_sync(&cmd->work); | ||
| 288 | transport_wait_for_tasks(cmd); | ||
| 289 | |||
| 233 | transport_cmd_finish_abort(cmd, 1); | 290 | transport_cmd_finish_abort(cmd, 1); |
| 291 | target_put_sess_cmd(cmd); | ||
| 234 | } | 292 | } |
| 235 | } | 293 | } |
| 236 | 294 | ||
| 237 | static void core_tmr_drain_state_list( | 295 | static void core_tmr_drain_state_list( |
| 238 | struct se_device *dev, | 296 | struct se_device *dev, |
| 239 | struct se_cmd *prout_cmd, | 297 | struct se_cmd *prout_cmd, |
| 240 | struct se_node_acl *tmr_nacl, | 298 | struct se_session *tmr_sess, |
| 241 | int tas, | 299 | int tas, |
| 242 | struct list_head *preempt_and_abort_list) | 300 | struct list_head *preempt_and_abort_list) |
| 243 | { | 301 | { |
| 244 | LIST_HEAD(drain_task_list); | 302 | LIST_HEAD(drain_task_list); |
| 303 | struct se_session *sess; | ||
| 245 | struct se_cmd *cmd, *next; | 304 | struct se_cmd *cmd, *next; |
| 246 | unsigned long flags; | 305 | unsigned long flags; |
| 306 | int rc; | ||
| 247 | 307 | ||
| 248 | /* | 308 | /* |
| 249 | * Complete outstanding commands with TASK_ABORTED SAM status. | 309 | * Complete outstanding commands with TASK_ABORTED SAM status. |
| @@ -282,6 +342,16 @@ static void core_tmr_drain_state_list( | |||
| 282 | if (prout_cmd == cmd) | 342 | if (prout_cmd == cmd) |
| 283 | continue; | 343 | continue; |
| 284 | 344 | ||
| 345 | sess = cmd->se_sess; | ||
| 346 | if (WARN_ON_ONCE(!sess)) | ||
| 347 | continue; | ||
| 348 | |||
| 349 | spin_lock(&sess->sess_cmd_lock); | ||
| 350 | rc = __target_check_io_state(cmd, tmr_sess, tas); | ||
| 351 | spin_unlock(&sess->sess_cmd_lock); | ||
| 352 | if (!rc) | ||
| 353 | continue; | ||
| 354 | |||
| 285 | list_move_tail(&cmd->state_list, &drain_task_list); | 355 | list_move_tail(&cmd->state_list, &drain_task_list); |
| 286 | cmd->state_active = false; | 356 | cmd->state_active = false; |
| 287 | } | 357 | } |
| @@ -289,7 +359,7 @@ static void core_tmr_drain_state_list( | |||
| 289 | 359 | ||
| 290 | while (!list_empty(&drain_task_list)) { | 360 | while (!list_empty(&drain_task_list)) { |
| 291 | cmd = list_entry(drain_task_list.next, struct se_cmd, state_list); | 361 | cmd = list_entry(drain_task_list.next, struct se_cmd, state_list); |
| 292 | list_del(&cmd->state_list); | 362 | list_del_init(&cmd->state_list); |
| 293 | 363 | ||
| 294 | pr_debug("LUN_RESET: %s cmd: %p" | 364 | pr_debug("LUN_RESET: %s cmd: %p" |
| 295 | " ITT/CmdSN: 0x%08llx/0x%08x, i_state: %d, t_state: %d" | 365 | " ITT/CmdSN: 0x%08llx/0x%08x, i_state: %d, t_state: %d" |
| @@ -313,16 +383,11 @@ static void core_tmr_drain_state_list( | |||
| 313 | * loop above, but we do it down here given that | 383 | * loop above, but we do it down here given that |
| 314 | * cancel_work_sync may block. | 384 | * cancel_work_sync may block. |
| 315 | */ | 385 | */ |
| 316 | if (cmd->t_state == TRANSPORT_COMPLETE) | 386 | cancel_work_sync(&cmd->work); |
| 317 | cancel_work_sync(&cmd->work); | 387 | transport_wait_for_tasks(cmd); |
| 318 | |||
| 319 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 320 | target_stop_cmd(cmd, &flags); | ||
| 321 | |||
| 322 | cmd->transport_state |= CMD_T_ABORTED; | ||
| 323 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 324 | 388 | ||
| 325 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas); | 389 | core_tmr_handle_tas_abort(cmd, tas); |
| 390 | target_put_sess_cmd(cmd); | ||
| 326 | } | 391 | } |
| 327 | } | 392 | } |
| 328 | 393 | ||
| @@ -334,6 +399,7 @@ int core_tmr_lun_reset( | |||
| 334 | { | 399 | { |
| 335 | struct se_node_acl *tmr_nacl = NULL; | 400 | struct se_node_acl *tmr_nacl = NULL; |
| 336 | struct se_portal_group *tmr_tpg = NULL; | 401 | struct se_portal_group *tmr_tpg = NULL; |
| 402 | struct se_session *tmr_sess = NULL; | ||
| 337 | int tas; | 403 | int tas; |
| 338 | /* | 404 | /* |
| 339 | * TASK_ABORTED status bit, this is configurable via ConfigFS | 405 | * TASK_ABORTED status bit, this is configurable via ConfigFS |
| @@ -352,8 +418,9 @@ int core_tmr_lun_reset( | |||
| 352 | * or struct se_device passthrough.. | 418 | * or struct se_device passthrough.. |
| 353 | */ | 419 | */ |
| 354 | if (tmr && tmr->task_cmd && tmr->task_cmd->se_sess) { | 420 | if (tmr && tmr->task_cmd && tmr->task_cmd->se_sess) { |
| 355 | tmr_nacl = tmr->task_cmd->se_sess->se_node_acl; | 421 | tmr_sess = tmr->task_cmd->se_sess; |
| 356 | tmr_tpg = tmr->task_cmd->se_sess->se_tpg; | 422 | tmr_nacl = tmr_sess->se_node_acl; |
| 423 | tmr_tpg = tmr_sess->se_tpg; | ||
| 357 | if (tmr_nacl && tmr_tpg) { | 424 | if (tmr_nacl && tmr_tpg) { |
| 358 | pr_debug("LUN_RESET: TMR caller fabric: %s" | 425 | pr_debug("LUN_RESET: TMR caller fabric: %s" |
| 359 | " initiator port %s\n", | 426 | " initiator port %s\n", |
| @@ -366,7 +433,7 @@ int core_tmr_lun_reset( | |||
| 366 | dev->transport->name, tas); | 433 | dev->transport->name, tas); |
| 367 | 434 | ||
| 368 | core_tmr_drain_tmr_list(dev, tmr, preempt_and_abort_list); | 435 | core_tmr_drain_tmr_list(dev, tmr, preempt_and_abort_list); |
| 369 | core_tmr_drain_state_list(dev, prout_cmd, tmr_nacl, tas, | 436 | core_tmr_drain_state_list(dev, prout_cmd, tmr_sess, tas, |
| 370 | preempt_and_abort_list); | 437 | preempt_and_abort_list); |
| 371 | 438 | ||
| 372 | /* | 439 | /* |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 9f3608e10f25..867bc6d0a68a 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -534,9 +534,6 @@ void transport_deregister_session(struct se_session *se_sess) | |||
| 534 | } | 534 | } |
| 535 | EXPORT_SYMBOL(transport_deregister_session); | 535 | EXPORT_SYMBOL(transport_deregister_session); |
| 536 | 536 | ||
| 537 | /* | ||
| 538 | * Called with cmd->t_state_lock held. | ||
| 539 | */ | ||
| 540 | static void target_remove_from_state_list(struct se_cmd *cmd) | 537 | static void target_remove_from_state_list(struct se_cmd *cmd) |
| 541 | { | 538 | { |
| 542 | struct se_device *dev = cmd->se_dev; | 539 | struct se_device *dev = cmd->se_dev; |
| @@ -561,10 +558,6 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists, | |||
| 561 | { | 558 | { |
| 562 | unsigned long flags; | 559 | unsigned long flags; |
| 563 | 560 | ||
| 564 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 565 | if (write_pending) | ||
| 566 | cmd->t_state = TRANSPORT_WRITE_PENDING; | ||
| 567 | |||
| 568 | if (remove_from_lists) { | 561 | if (remove_from_lists) { |
| 569 | target_remove_from_state_list(cmd); | 562 | target_remove_from_state_list(cmd); |
| 570 | 563 | ||
| @@ -574,6 +567,10 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists, | |||
| 574 | cmd->se_lun = NULL; | 567 | cmd->se_lun = NULL; |
| 575 | } | 568 | } |
| 576 | 569 | ||
| 570 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 571 | if (write_pending) | ||
| 572 | cmd->t_state = TRANSPORT_WRITE_PENDING; | ||
| 573 | |||
| 577 | /* | 574 | /* |
| 578 | * Determine if frontend context caller is requesting the stopping of | 575 | * Determine if frontend context caller is requesting the stopping of |
| 579 | * this command for frontend exceptions. | 576 | * this command for frontend exceptions. |
| @@ -627,6 +624,8 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) | |||
| 627 | 624 | ||
| 628 | void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) | 625 | void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) |
| 629 | { | 626 | { |
| 627 | bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF); | ||
| 628 | |||
| 630 | if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) | 629 | if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) |
| 631 | transport_lun_remove_cmd(cmd); | 630 | transport_lun_remove_cmd(cmd); |
| 632 | /* | 631 | /* |
| @@ -638,7 +637,7 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) | |||
| 638 | 637 | ||
| 639 | if (transport_cmd_check_stop_to_fabric(cmd)) | 638 | if (transport_cmd_check_stop_to_fabric(cmd)) |
| 640 | return; | 639 | return; |
| 641 | if (remove) | 640 | if (remove && ack_kref) |
| 642 | transport_put_cmd(cmd); | 641 | transport_put_cmd(cmd); |
| 643 | } | 642 | } |
| 644 | 643 | ||
| @@ -694,19 +693,10 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) | |||
| 694 | } | 693 | } |
| 695 | 694 | ||
| 696 | /* | 695 | /* |
| 697 | * See if we are waiting to complete for an exception condition. | ||
| 698 | */ | ||
| 699 | if (cmd->transport_state & CMD_T_REQUEST_STOP) { | ||
| 700 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 701 | complete(&cmd->task_stop_comp); | ||
| 702 | return; | ||
| 703 | } | ||
| 704 | |||
| 705 | /* | ||
| 706 | * Check for case where an explicit ABORT_TASK has been received | 696 | * Check for case where an explicit ABORT_TASK has been received |
| 707 | * and transport_wait_for_tasks() will be waiting for completion.. | 697 | * and transport_wait_for_tasks() will be waiting for completion.. |
| 708 | */ | 698 | */ |
| 709 | if (cmd->transport_state & CMD_T_ABORTED && | 699 | if (cmd->transport_state & CMD_T_ABORTED || |
| 710 | cmd->transport_state & CMD_T_STOP) { | 700 | cmd->transport_state & CMD_T_STOP) { |
| 711 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 701 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
| 712 | complete_all(&cmd->t_transport_stop_comp); | 702 | complete_all(&cmd->t_transport_stop_comp); |
| @@ -721,10 +711,10 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) | |||
| 721 | cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); | 711 | cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); |
| 722 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 712 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
| 723 | 713 | ||
| 724 | if (cmd->cpuid == -1) | 714 | if (cmd->se_cmd_flags & SCF_USE_CPUID) |
| 725 | queue_work(target_completion_wq, &cmd->work); | ||
| 726 | else | ||
| 727 | queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); | 715 | queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); |
| 716 | else | ||
| 717 | queue_work(target_completion_wq, &cmd->work); | ||
| 728 | } | 718 | } |
| 729 | EXPORT_SYMBOL(target_complete_cmd); | 719 | EXPORT_SYMBOL(target_complete_cmd); |
| 730 | 720 | ||
| @@ -1203,7 +1193,6 @@ void transport_init_se_cmd( | |||
| 1203 | INIT_LIST_HEAD(&cmd->state_list); | 1193 | INIT_LIST_HEAD(&cmd->state_list); |
| 1204 | init_completion(&cmd->t_transport_stop_comp); | 1194 | init_completion(&cmd->t_transport_stop_comp); |
| 1205 | init_completion(&cmd->cmd_wait_comp); | 1195 | init_completion(&cmd->cmd_wait_comp); |
| 1206 | init_completion(&cmd->task_stop_comp); | ||
| 1207 | spin_lock_init(&cmd->t_state_lock); | 1196 | spin_lock_init(&cmd->t_state_lock); |
| 1208 | kref_init(&cmd->cmd_kref); | 1197 | kref_init(&cmd->cmd_kref); |
| 1209 | cmd->transport_state = CMD_T_DEV_ACTIVE; | 1198 | cmd->transport_state = CMD_T_DEV_ACTIVE; |
| @@ -1437,6 +1426,12 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess | |||
| 1437 | */ | 1426 | */ |
| 1438 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, | 1427 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, |
| 1439 | data_length, data_dir, task_attr, sense); | 1428 | data_length, data_dir, task_attr, sense); |
| 1429 | |||
| 1430 | if (flags & TARGET_SCF_USE_CPUID) | ||
| 1431 | se_cmd->se_cmd_flags |= SCF_USE_CPUID; | ||
| 1432 | else | ||
| 1433 | se_cmd->cpuid = WORK_CPU_UNBOUND; | ||
| 1434 | |||
| 1440 | if (flags & TARGET_SCF_UNKNOWN_SIZE) | 1435 | if (flags & TARGET_SCF_UNKNOWN_SIZE) |
| 1441 | se_cmd->unknown_data_length = 1; | 1436 | se_cmd->unknown_data_length = 1; |
| 1442 | /* | 1437 | /* |
| @@ -1635,33 +1630,6 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, | |||
| 1635 | EXPORT_SYMBOL(target_submit_tmr); | 1630 | EXPORT_SYMBOL(target_submit_tmr); |
| 1636 | 1631 | ||
| 1637 | /* | 1632 | /* |
| 1638 | * If the cmd is active, request it to be stopped and sleep until it | ||
| 1639 | * has completed. | ||
| 1640 | */ | ||
| 1641 | bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags) | ||
| 1642 | __releases(&cmd->t_state_lock) | ||
| 1643 | __acquires(&cmd->t_state_lock) | ||
| 1644 | { | ||
| 1645 | bool was_active = false; | ||
| 1646 | |||
| 1647 | if (cmd->transport_state & CMD_T_BUSY) { | ||
| 1648 | cmd->transport_state |= CMD_T_REQUEST_STOP; | ||
| 1649 | spin_unlock_irqrestore(&cmd->t_state_lock, *flags); | ||
| 1650 | |||
| 1651 | pr_debug("cmd %p waiting to complete\n", cmd); | ||
| 1652 | wait_for_completion(&cmd->task_stop_comp); | ||
| 1653 | pr_debug("cmd %p stopped successfully\n", cmd); | ||
| 1654 | |||
| 1655 | spin_lock_irqsave(&cmd->t_state_lock, *flags); | ||
| 1656 | cmd->transport_state &= ~CMD_T_REQUEST_STOP; | ||
| 1657 | cmd->transport_state &= ~CMD_T_BUSY; | ||
| 1658 | was_active = true; | ||
| 1659 | } | ||
| 1660 | |||
| 1661 | return was_active; | ||
| 1662 | } | ||
| 1663 | |||
| 1664 | /* | ||
| 1665 | * Handle SAM-esque emulation for generic transport request failures. | 1633 | * Handle SAM-esque emulation for generic transport request failures. |
| 1666 | */ | 1634 | */ |
| 1667 | void transport_generic_request_failure(struct se_cmd *cmd, | 1635 | void transport_generic_request_failure(struct se_cmd *cmd, |
| @@ -1859,19 +1827,21 @@ static bool target_handle_task_attr(struct se_cmd *cmd) | |||
| 1859 | return true; | 1827 | return true; |
| 1860 | } | 1828 | } |
| 1861 | 1829 | ||
| 1830 | static int __transport_check_aborted_status(struct se_cmd *, int); | ||
| 1831 | |||
| 1862 | void target_execute_cmd(struct se_cmd *cmd) | 1832 | void target_execute_cmd(struct se_cmd *cmd) |
| 1863 | { | 1833 | { |
| 1864 | /* | 1834 | /* |
| 1865 | * If the received CDB has aleady been aborted stop processing it here. | ||
| 1866 | */ | ||
| 1867 | if (transport_check_aborted_status(cmd, 1)) | ||
| 1868 | return; | ||
| 1869 | |||
| 1870 | /* | ||
| 1871 | * Determine if frontend context caller is requesting the stopping of | 1835 | * Determine if frontend context caller is requesting the stopping of |
| 1872 | * this command for frontend exceptions. | 1836 | * this command for frontend exceptions. |
| 1837 | * | ||
| 1838 | * If the received CDB has aleady been aborted stop processing it here. | ||
| 1873 | */ | 1839 | */ |
| 1874 | spin_lock_irq(&cmd->t_state_lock); | 1840 | spin_lock_irq(&cmd->t_state_lock); |
| 1841 | if (__transport_check_aborted_status(cmd, 1)) { | ||
| 1842 | spin_unlock_irq(&cmd->t_state_lock); | ||
| 1843 | return; | ||
| 1844 | } | ||
| 1875 | if (cmd->transport_state & CMD_T_STOP) { | 1845 | if (cmd->transport_state & CMD_T_STOP) { |
| 1876 | pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n", | 1846 | pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n", |
| 1877 | __func__, __LINE__, cmd->tag); | 1847 | __func__, __LINE__, cmd->tag); |
| @@ -2222,20 +2192,14 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
| 2222 | } | 2192 | } |
| 2223 | 2193 | ||
| 2224 | /** | 2194 | /** |
| 2225 | * transport_release_cmd - free a command | 2195 | * transport_put_cmd - release a reference to a command |
| 2226 | * @cmd: command to free | 2196 | * @cmd: command to release |
| 2227 | * | 2197 | * |
| 2228 | * This routine unconditionally frees a command, and reference counting | 2198 | * This routine releases our reference to the command and frees it if possible. |
| 2229 | * or list removal must be done in the caller. | ||
| 2230 | */ | 2199 | */ |
| 2231 | static int transport_release_cmd(struct se_cmd *cmd) | 2200 | static int transport_put_cmd(struct se_cmd *cmd) |
| 2232 | { | 2201 | { |
| 2233 | BUG_ON(!cmd->se_tfo); | 2202 | BUG_ON(!cmd->se_tfo); |
| 2234 | |||
| 2235 | if (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) | ||
| 2236 | core_tmr_release_req(cmd->se_tmr_req); | ||
| 2237 | if (cmd->t_task_cdb != cmd->__t_task_cdb) | ||
| 2238 | kfree(cmd->t_task_cdb); | ||
| 2239 | /* | 2203 | /* |
| 2240 | * If this cmd has been setup with target_get_sess_cmd(), drop | 2204 | * If this cmd has been setup with target_get_sess_cmd(), drop |
| 2241 | * the kref and call ->release_cmd() in kref callback. | 2205 | * the kref and call ->release_cmd() in kref callback. |
| @@ -2243,18 +2207,6 @@ static int transport_release_cmd(struct se_cmd *cmd) | |||
| 2243 | return target_put_sess_cmd(cmd); | 2207 | return target_put_sess_cmd(cmd); |
| 2244 | } | 2208 | } |
| 2245 | 2209 | ||
| 2246 | /** | ||
| 2247 | * transport_put_cmd - release a reference to a command | ||
| 2248 | * @cmd: command to release | ||
| 2249 | * | ||
| 2250 | * This routine releases our reference to the command and frees it if possible. | ||
| 2251 | */ | ||
| 2252 | static int transport_put_cmd(struct se_cmd *cmd) | ||
| 2253 | { | ||
| 2254 | transport_free_pages(cmd); | ||
| 2255 | return transport_release_cmd(cmd); | ||
| 2256 | } | ||
| 2257 | |||
| 2258 | void *transport_kmap_data_sg(struct se_cmd *cmd) | 2210 | void *transport_kmap_data_sg(struct se_cmd *cmd) |
| 2259 | { | 2211 | { |
| 2260 | struct scatterlist *sg = cmd->t_data_sg; | 2212 | struct scatterlist *sg = cmd->t_data_sg; |
| @@ -2450,34 +2402,58 @@ static void transport_write_pending_qf(struct se_cmd *cmd) | |||
| 2450 | } | 2402 | } |
| 2451 | } | 2403 | } |
| 2452 | 2404 | ||
| 2453 | int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | 2405 | static bool |
| 2406 | __transport_wait_for_tasks(struct se_cmd *, bool, bool *, bool *, | ||
| 2407 | unsigned long *flags); | ||
| 2408 | |||
| 2409 | static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) | ||
| 2454 | { | 2410 | { |
| 2455 | unsigned long flags; | 2411 | unsigned long flags; |
| 2412 | |||
| 2413 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 2414 | __transport_wait_for_tasks(cmd, true, aborted, tas, &flags); | ||
| 2415 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2416 | } | ||
| 2417 | |||
| 2418 | int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | ||
| 2419 | { | ||
| 2456 | int ret = 0; | 2420 | int ret = 0; |
| 2421 | bool aborted = false, tas = false; | ||
| 2457 | 2422 | ||
| 2458 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { | 2423 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { |
| 2459 | if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) | 2424 | if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) |
| 2460 | transport_wait_for_tasks(cmd); | 2425 | target_wait_free_cmd(cmd, &aborted, &tas); |
| 2461 | 2426 | ||
| 2462 | ret = transport_release_cmd(cmd); | 2427 | if (!aborted || tas) |
| 2428 | ret = transport_put_cmd(cmd); | ||
| 2463 | } else { | 2429 | } else { |
| 2464 | if (wait_for_tasks) | 2430 | if (wait_for_tasks) |
| 2465 | transport_wait_for_tasks(cmd); | 2431 | target_wait_free_cmd(cmd, &aborted, &tas); |
| 2466 | /* | 2432 | /* |
| 2467 | * Handle WRITE failure case where transport_generic_new_cmd() | 2433 | * Handle WRITE failure case where transport_generic_new_cmd() |
| 2468 | * has already added se_cmd to state_list, but fabric has | 2434 | * has already added se_cmd to state_list, but fabric has |
| 2469 | * failed command before I/O submission. | 2435 | * failed command before I/O submission. |
| 2470 | */ | 2436 | */ |
| 2471 | if (cmd->state_active) { | 2437 | if (cmd->state_active) |
| 2472 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 2473 | target_remove_from_state_list(cmd); | 2438 | target_remove_from_state_list(cmd); |
| 2474 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2475 | } | ||
| 2476 | 2439 | ||
| 2477 | if (cmd->se_lun) | 2440 | if (cmd->se_lun) |
| 2478 | transport_lun_remove_cmd(cmd); | 2441 | transport_lun_remove_cmd(cmd); |
| 2479 | 2442 | ||
| 2480 | ret = transport_put_cmd(cmd); | 2443 | if (!aborted || tas) |
| 2444 | ret = transport_put_cmd(cmd); | ||
| 2445 | } | ||
| 2446 | /* | ||
| 2447 | * If the task has been internally aborted due to TMR ABORT_TASK | ||
| 2448 | * or LUN_RESET, target_core_tmr.c is responsible for performing | ||
| 2449 | * the remaining calls to target_put_sess_cmd(), and not the | ||
| 2450 | * callers of this function. | ||
| 2451 | */ | ||
| 2452 | if (aborted) { | ||
| 2453 | pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); | ||
| 2454 | wait_for_completion(&cmd->cmd_wait_comp); | ||
| 2455 | cmd->se_tfo->release_cmd(cmd); | ||
| 2456 | ret = 1; | ||
| 2481 | } | 2457 | } |
| 2482 | return ret; | 2458 | return ret; |
| 2483 | } | 2459 | } |
| @@ -2517,26 +2493,46 @@ out: | |||
| 2517 | } | 2493 | } |
| 2518 | EXPORT_SYMBOL(target_get_sess_cmd); | 2494 | EXPORT_SYMBOL(target_get_sess_cmd); |
| 2519 | 2495 | ||
| 2496 | static void target_free_cmd_mem(struct se_cmd *cmd) | ||
| 2497 | { | ||
| 2498 | transport_free_pages(cmd); | ||
| 2499 | |||
| 2500 | if (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) | ||
| 2501 | core_tmr_release_req(cmd->se_tmr_req); | ||
| 2502 | if (cmd->t_task_cdb != cmd->__t_task_cdb) | ||
| 2503 | kfree(cmd->t_task_cdb); | ||
| 2504 | } | ||
| 2505 | |||
| 2520 | static void target_release_cmd_kref(struct kref *kref) | 2506 | static void target_release_cmd_kref(struct kref *kref) |
| 2521 | { | 2507 | { |
| 2522 | struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); | 2508 | struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); |
| 2523 | struct se_session *se_sess = se_cmd->se_sess; | 2509 | struct se_session *se_sess = se_cmd->se_sess; |
| 2524 | unsigned long flags; | 2510 | unsigned long flags; |
| 2511 | bool fabric_stop; | ||
| 2525 | 2512 | ||
| 2526 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | 2513 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
| 2527 | if (list_empty(&se_cmd->se_cmd_list)) { | 2514 | if (list_empty(&se_cmd->se_cmd_list)) { |
| 2528 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2515 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2516 | target_free_cmd_mem(se_cmd); | ||
| 2529 | se_cmd->se_tfo->release_cmd(se_cmd); | 2517 | se_cmd->se_tfo->release_cmd(se_cmd); |
| 2530 | return; | 2518 | return; |
| 2531 | } | 2519 | } |
| 2532 | if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) { | 2520 | |
| 2521 | spin_lock(&se_cmd->t_state_lock); | ||
| 2522 | fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP); | ||
| 2523 | spin_unlock(&se_cmd->t_state_lock); | ||
| 2524 | |||
| 2525 | if (se_cmd->cmd_wait_set || fabric_stop) { | ||
| 2526 | list_del_init(&se_cmd->se_cmd_list); | ||
| 2533 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2527 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2528 | target_free_cmd_mem(se_cmd); | ||
| 2534 | complete(&se_cmd->cmd_wait_comp); | 2529 | complete(&se_cmd->cmd_wait_comp); |
| 2535 | return; | 2530 | return; |
| 2536 | } | 2531 | } |
| 2537 | list_del(&se_cmd->se_cmd_list); | 2532 | list_del_init(&se_cmd->se_cmd_list); |
| 2538 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2533 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2539 | 2534 | ||
| 2535 | target_free_cmd_mem(se_cmd); | ||
| 2540 | se_cmd->se_tfo->release_cmd(se_cmd); | 2536 | se_cmd->se_tfo->release_cmd(se_cmd); |
| 2541 | } | 2537 | } |
| 2542 | 2538 | ||
| @@ -2548,6 +2544,7 @@ int target_put_sess_cmd(struct se_cmd *se_cmd) | |||
| 2548 | struct se_session *se_sess = se_cmd->se_sess; | 2544 | struct se_session *se_sess = se_cmd->se_sess; |
| 2549 | 2545 | ||
| 2550 | if (!se_sess) { | 2546 | if (!se_sess) { |
| 2547 | target_free_cmd_mem(se_cmd); | ||
| 2551 | se_cmd->se_tfo->release_cmd(se_cmd); | 2548 | se_cmd->se_tfo->release_cmd(se_cmd); |
| 2552 | return 1; | 2549 | return 1; |
| 2553 | } | 2550 | } |
| @@ -2564,6 +2561,7 @@ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) | |||
| 2564 | { | 2561 | { |
| 2565 | struct se_cmd *se_cmd; | 2562 | struct se_cmd *se_cmd; |
| 2566 | unsigned long flags; | 2563 | unsigned long flags; |
| 2564 | int rc; | ||
| 2567 | 2565 | ||
| 2568 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | 2566 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
| 2569 | if (se_sess->sess_tearing_down) { | 2567 | if (se_sess->sess_tearing_down) { |
| @@ -2573,8 +2571,15 @@ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) | |||
| 2573 | se_sess->sess_tearing_down = 1; | 2571 | se_sess->sess_tearing_down = 1; |
| 2574 | list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); | 2572 | list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); |
| 2575 | 2573 | ||
| 2576 | list_for_each_entry(se_cmd, &se_sess->sess_wait_list, se_cmd_list) | 2574 | list_for_each_entry(se_cmd, &se_sess->sess_wait_list, se_cmd_list) { |
| 2577 | se_cmd->cmd_wait_set = 1; | 2575 | rc = kref_get_unless_zero(&se_cmd->cmd_kref); |
| 2576 | if (rc) { | ||
| 2577 | se_cmd->cmd_wait_set = 1; | ||
| 2578 | spin_lock(&se_cmd->t_state_lock); | ||
| 2579 | se_cmd->transport_state |= CMD_T_FABRIC_STOP; | ||
| 2580 | spin_unlock(&se_cmd->t_state_lock); | ||
| 2581 | } | ||
| 2582 | } | ||
| 2578 | 2583 | ||
| 2579 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2584 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2580 | } | 2585 | } |
| @@ -2587,15 +2592,25 @@ void target_wait_for_sess_cmds(struct se_session *se_sess) | |||
| 2587 | { | 2592 | { |
| 2588 | struct se_cmd *se_cmd, *tmp_cmd; | 2593 | struct se_cmd *se_cmd, *tmp_cmd; |
| 2589 | unsigned long flags; | 2594 | unsigned long flags; |
| 2595 | bool tas; | ||
| 2590 | 2596 | ||
| 2591 | list_for_each_entry_safe(se_cmd, tmp_cmd, | 2597 | list_for_each_entry_safe(se_cmd, tmp_cmd, |
| 2592 | &se_sess->sess_wait_list, se_cmd_list) { | 2598 | &se_sess->sess_wait_list, se_cmd_list) { |
| 2593 | list_del(&se_cmd->se_cmd_list); | 2599 | list_del_init(&se_cmd->se_cmd_list); |
| 2594 | 2600 | ||
| 2595 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" | 2601 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" |
| 2596 | " %d\n", se_cmd, se_cmd->t_state, | 2602 | " %d\n", se_cmd, se_cmd->t_state, |
| 2597 | se_cmd->se_tfo->get_cmd_state(se_cmd)); | 2603 | se_cmd->se_tfo->get_cmd_state(se_cmd)); |
| 2598 | 2604 | ||
| 2605 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); | ||
| 2606 | tas = (se_cmd->transport_state & CMD_T_TAS); | ||
| 2607 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | ||
| 2608 | |||
| 2609 | if (!target_put_sess_cmd(se_cmd)) { | ||
| 2610 | if (tas) | ||
| 2611 | target_put_sess_cmd(se_cmd); | ||
| 2612 | } | ||
| 2613 | |||
| 2599 | wait_for_completion(&se_cmd->cmd_wait_comp); | 2614 | wait_for_completion(&se_cmd->cmd_wait_comp); |
| 2600 | pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" | 2615 | pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" |
| 2601 | " fabric state: %d\n", se_cmd, se_cmd->t_state, | 2616 | " fabric state: %d\n", se_cmd, se_cmd->t_state, |
| @@ -2617,53 +2632,75 @@ void transport_clear_lun_ref(struct se_lun *lun) | |||
| 2617 | wait_for_completion(&lun->lun_ref_comp); | 2632 | wait_for_completion(&lun->lun_ref_comp); |
| 2618 | } | 2633 | } |
| 2619 | 2634 | ||
| 2620 | /** | 2635 | static bool |
| 2621 | * transport_wait_for_tasks - wait for completion to occur | 2636 | __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, |
| 2622 | * @cmd: command to wait | 2637 | bool *aborted, bool *tas, unsigned long *flags) |
| 2623 | * | 2638 | __releases(&cmd->t_state_lock) |
| 2624 | * Called from frontend fabric context to wait for storage engine | 2639 | __acquires(&cmd->t_state_lock) |
| 2625 | * to pause and/or release frontend generated struct se_cmd. | ||
| 2626 | */ | ||
| 2627 | bool transport_wait_for_tasks(struct se_cmd *cmd) | ||
| 2628 | { | 2640 | { |
| 2629 | unsigned long flags; | ||
| 2630 | 2641 | ||
| 2631 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 2642 | assert_spin_locked(&cmd->t_state_lock); |
| 2643 | WARN_ON_ONCE(!irqs_disabled()); | ||
| 2644 | |||
| 2645 | if (fabric_stop) | ||
| 2646 | cmd->transport_state |= CMD_T_FABRIC_STOP; | ||
| 2647 | |||
| 2648 | if (cmd->transport_state & CMD_T_ABORTED) | ||
| 2649 | *aborted = true; | ||
| 2650 | |||
| 2651 | if (cmd->transport_state & CMD_T_TAS) | ||
| 2652 | *tas = true; | ||
| 2653 | |||
| 2632 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD) && | 2654 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD) && |
| 2633 | !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) { | 2655 | !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) |
| 2634 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2635 | return false; | 2656 | return false; |
| 2636 | } | ||
| 2637 | 2657 | ||
| 2638 | if (!(cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) && | 2658 | if (!(cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) && |
| 2639 | !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) { | 2659 | !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) |
| 2640 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2641 | return false; | 2660 | return false; |
| 2642 | } | ||
| 2643 | 2661 | ||
| 2644 | if (!(cmd->transport_state & CMD_T_ACTIVE)) { | 2662 | if (!(cmd->transport_state & CMD_T_ACTIVE)) |
| 2645 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 2663 | return false; |
| 2664 | |||
| 2665 | if (fabric_stop && *aborted) | ||
| 2646 | return false; | 2666 | return false; |
| 2647 | } | ||
| 2648 | 2667 | ||
| 2649 | cmd->transport_state |= CMD_T_STOP; | 2668 | cmd->transport_state |= CMD_T_STOP; |
| 2650 | 2669 | ||
| 2651 | pr_debug("wait_for_tasks: Stopping %p ITT: 0x%08llx i_state: %d, t_state: %d, CMD_T_STOP\n", | 2670 | pr_debug("wait_for_tasks: Stopping %p ITT: 0x%08llx i_state: %d," |
| 2652 | cmd, cmd->tag, cmd->se_tfo->get_cmd_state(cmd), cmd->t_state); | 2671 | " t_state: %d, CMD_T_STOP\n", cmd, cmd->tag, |
| 2672 | cmd->se_tfo->get_cmd_state(cmd), cmd->t_state); | ||
| 2653 | 2673 | ||
| 2654 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 2674 | spin_unlock_irqrestore(&cmd->t_state_lock, *flags); |
| 2655 | 2675 | ||
| 2656 | wait_for_completion(&cmd->t_transport_stop_comp); | 2676 | wait_for_completion(&cmd->t_transport_stop_comp); |
| 2657 | 2677 | ||
| 2658 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 2678 | spin_lock_irqsave(&cmd->t_state_lock, *flags); |
| 2659 | cmd->transport_state &= ~(CMD_T_ACTIVE | CMD_T_STOP); | 2679 | cmd->transport_state &= ~(CMD_T_ACTIVE | CMD_T_STOP); |
| 2660 | 2680 | ||
| 2661 | pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->t_transport_stop_comp) for ITT: 0x%08llx\n", | 2681 | pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->" |
| 2662 | cmd->tag); | 2682 | "t_transport_stop_comp) for ITT: 0x%08llx\n", cmd->tag); |
| 2663 | 2683 | ||
| 2684 | return true; | ||
| 2685 | } | ||
| 2686 | |||
| 2687 | /** | ||
| 2688 | * transport_wait_for_tasks - wait for completion to occur | ||
| 2689 | * @cmd: command to wait | ||
| 2690 | * | ||
| 2691 | * Called from frontend fabric context to wait for storage engine | ||
| 2692 | * to pause and/or release frontend generated struct se_cmd. | ||
| 2693 | */ | ||
| 2694 | bool transport_wait_for_tasks(struct se_cmd *cmd) | ||
| 2695 | { | ||
| 2696 | unsigned long flags; | ||
| 2697 | bool ret, aborted = false, tas = false; | ||
| 2698 | |||
| 2699 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 2700 | ret = __transport_wait_for_tasks(cmd, false, &aborted, &tas, &flags); | ||
| 2664 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 2701 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
| 2665 | 2702 | ||
| 2666 | return true; | 2703 | return ret; |
| 2667 | } | 2704 | } |
| 2668 | EXPORT_SYMBOL(transport_wait_for_tasks); | 2705 | EXPORT_SYMBOL(transport_wait_for_tasks); |
| 2669 | 2706 | ||
| @@ -2845,28 +2882,49 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, | |||
| 2845 | } | 2882 | } |
| 2846 | EXPORT_SYMBOL(transport_send_check_condition_and_sense); | 2883 | EXPORT_SYMBOL(transport_send_check_condition_and_sense); |
| 2847 | 2884 | ||
| 2848 | int transport_check_aborted_status(struct se_cmd *cmd, int send_status) | 2885 | static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status) |
| 2886 | __releases(&cmd->t_state_lock) | ||
| 2887 | __acquires(&cmd->t_state_lock) | ||
| 2849 | { | 2888 | { |
| 2889 | assert_spin_locked(&cmd->t_state_lock); | ||
| 2890 | WARN_ON_ONCE(!irqs_disabled()); | ||
| 2891 | |||
| 2850 | if (!(cmd->transport_state & CMD_T_ABORTED)) | 2892 | if (!(cmd->transport_state & CMD_T_ABORTED)) |
| 2851 | return 0; | 2893 | return 0; |
| 2852 | |||
| 2853 | /* | 2894 | /* |
| 2854 | * If cmd has been aborted but either no status is to be sent or it has | 2895 | * If cmd has been aborted but either no status is to be sent or it has |
| 2855 | * already been sent, just return | 2896 | * already been sent, just return |
| 2856 | */ | 2897 | */ |
| 2857 | if (!send_status || !(cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS)) | 2898 | if (!send_status || !(cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS)) { |
| 2899 | if (send_status) | ||
| 2900 | cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; | ||
| 2858 | return 1; | 2901 | return 1; |
| 2902 | } | ||
| 2859 | 2903 | ||
| 2860 | pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB: 0x%02x ITT: 0x%08llx\n", | 2904 | pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB:" |
| 2861 | cmd->t_task_cdb[0], cmd->tag); | 2905 | " 0x%02x ITT: 0x%08llx\n", cmd->t_task_cdb[0], cmd->tag); |
| 2862 | 2906 | ||
| 2863 | cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS; | 2907 | cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS; |
| 2864 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | 2908 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
| 2865 | trace_target_cmd_complete(cmd); | 2909 | trace_target_cmd_complete(cmd); |
| 2910 | |||
| 2911 | spin_unlock_irq(&cmd->t_state_lock); | ||
| 2866 | cmd->se_tfo->queue_status(cmd); | 2912 | cmd->se_tfo->queue_status(cmd); |
| 2913 | spin_lock_irq(&cmd->t_state_lock); | ||
| 2867 | 2914 | ||
| 2868 | return 1; | 2915 | return 1; |
| 2869 | } | 2916 | } |
| 2917 | |||
| 2918 | int transport_check_aborted_status(struct se_cmd *cmd, int send_status) | ||
| 2919 | { | ||
| 2920 | int ret; | ||
| 2921 | |||
| 2922 | spin_lock_irq(&cmd->t_state_lock); | ||
| 2923 | ret = __transport_check_aborted_status(cmd, send_status); | ||
| 2924 | spin_unlock_irq(&cmd->t_state_lock); | ||
| 2925 | |||
| 2926 | return ret; | ||
| 2927 | } | ||
| 2870 | EXPORT_SYMBOL(transport_check_aborted_status); | 2928 | EXPORT_SYMBOL(transport_check_aborted_status); |
| 2871 | 2929 | ||
| 2872 | void transport_send_task_abort(struct se_cmd *cmd) | 2930 | void transport_send_task_abort(struct se_cmd *cmd) |
| @@ -2888,11 +2946,17 @@ void transport_send_task_abort(struct se_cmd *cmd) | |||
| 2888 | */ | 2946 | */ |
| 2889 | if (cmd->data_direction == DMA_TO_DEVICE) { | 2947 | if (cmd->data_direction == DMA_TO_DEVICE) { |
| 2890 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { | 2948 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { |
| 2891 | cmd->transport_state |= CMD_T_ABORTED; | 2949 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
| 2950 | if (cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS) { | ||
| 2951 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2952 | goto send_abort; | ||
| 2953 | } | ||
| 2892 | cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; | 2954 | cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; |
| 2955 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2893 | return; | 2956 | return; |
| 2894 | } | 2957 | } |
| 2895 | } | 2958 | } |
| 2959 | send_abort: | ||
| 2896 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | 2960 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
| 2897 | 2961 | ||
| 2898 | transport_lun_remove_cmd(cmd); | 2962 | transport_lun_remove_cmd(cmd); |
| @@ -2909,8 +2973,17 @@ static void target_tmr_work(struct work_struct *work) | |||
| 2909 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); | 2973 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); |
| 2910 | struct se_device *dev = cmd->se_dev; | 2974 | struct se_device *dev = cmd->se_dev; |
| 2911 | struct se_tmr_req *tmr = cmd->se_tmr_req; | 2975 | struct se_tmr_req *tmr = cmd->se_tmr_req; |
| 2976 | unsigned long flags; | ||
| 2912 | int ret; | 2977 | int ret; |
| 2913 | 2978 | ||
| 2979 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 2980 | if (cmd->transport_state & CMD_T_ABORTED) { | ||
| 2981 | tmr->response = TMR_FUNCTION_REJECTED; | ||
| 2982 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2983 | goto check_stop; | ||
| 2984 | } | ||
| 2985 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 2986 | |||
| 2914 | switch (tmr->function) { | 2987 | switch (tmr->function) { |
| 2915 | case TMR_ABORT_TASK: | 2988 | case TMR_ABORT_TASK: |
| 2916 | core_tmr_abort_task(dev, tmr, cmd->se_sess); | 2989 | core_tmr_abort_task(dev, tmr, cmd->se_sess); |
| @@ -2943,9 +3016,17 @@ static void target_tmr_work(struct work_struct *work) | |||
| 2943 | break; | 3016 | break; |
| 2944 | } | 3017 | } |
| 2945 | 3018 | ||
| 3019 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
| 3020 | if (cmd->transport_state & CMD_T_ABORTED) { | ||
| 3021 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 3022 | goto check_stop; | ||
| 3023 | } | ||
| 2946 | cmd->t_state = TRANSPORT_ISTATE_PROCESSING; | 3024 | cmd->t_state = TRANSPORT_ISTATE_PROCESSING; |
| 3025 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
| 3026 | |||
| 2947 | cmd->se_tfo->queue_tm_rsp(cmd); | 3027 | cmd->se_tfo->queue_tm_rsp(cmd); |
| 2948 | 3028 | ||
| 3029 | check_stop: | ||
| 2949 | transport_cmd_check_stop_to_fabric(cmd); | 3030 | transport_cmd_check_stop_to_fabric(cmd); |
| 2950 | } | 3031 | } |
| 2951 | 3032 | ||
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index dd600e5ead71..94f5154ac788 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
| @@ -903,7 +903,7 @@ static int tcmu_configure_device(struct se_device *dev) | |||
| 903 | info->version = __stringify(TCMU_MAILBOX_VERSION); | 903 | info->version = __stringify(TCMU_MAILBOX_VERSION); |
| 904 | 904 | ||
| 905 | info->mem[0].name = "tcm-user command & data buffer"; | 905 | info->mem[0].name = "tcm-user command & data buffer"; |
| 906 | info->mem[0].addr = (phys_addr_t) udev->mb_addr; | 906 | info->mem[0].addr = (phys_addr_t)(uintptr_t)udev->mb_addr; |
| 907 | info->mem[0].size = TCMU_RING_SIZE; | 907 | info->mem[0].size = TCMU_RING_SIZE; |
| 908 | info->mem[0].memtype = UIO_MEM_VIRTUAL; | 908 | info->mem[0].memtype = UIO_MEM_VIRTUAL; |
| 909 | 909 | ||
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 8cc4ac64a91c..7c92c09be213 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
| @@ -195,7 +195,7 @@ config IMX_THERMAL | |||
| 195 | passive trip is crossed. | 195 | passive trip is crossed. |
| 196 | 196 | ||
| 197 | config SPEAR_THERMAL | 197 | config SPEAR_THERMAL |
| 198 | bool "SPEAr thermal sensor driver" | 198 | tristate "SPEAr thermal sensor driver" |
| 199 | depends on PLAT_SPEAR || COMPILE_TEST | 199 | depends on PLAT_SPEAR || COMPILE_TEST |
| 200 | depends on OF | 200 | depends on OF |
| 201 | help | 201 | help |
| @@ -237,8 +237,8 @@ config DOVE_THERMAL | |||
| 237 | framework. | 237 | framework. |
| 238 | 238 | ||
| 239 | config DB8500_THERMAL | 239 | config DB8500_THERMAL |
| 240 | bool "DB8500 thermal management" | 240 | tristate "DB8500 thermal management" |
| 241 | depends on ARCH_U8500 | 241 | depends on MFD_DB8500_PRCMU |
| 242 | default y | 242 | default y |
| 243 | help | 243 | help |
| 244 | Adds DB8500 thermal management implementation according to the thermal | 244 | Adds DB8500 thermal management implementation according to the thermal |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index e3fbc5a5d88f..6ceac4f2d4b2 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
| @@ -377,26 +377,28 @@ static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_device, | |||
| 377 | * get_load() - get load for a cpu since last updated | 377 | * get_load() - get load for a cpu since last updated |
| 378 | * @cpufreq_device: &struct cpufreq_cooling_device for this cpu | 378 | * @cpufreq_device: &struct cpufreq_cooling_device for this cpu |
| 379 | * @cpu: cpu number | 379 | * @cpu: cpu number |
| 380 | * @cpu_idx: index of the cpu in cpufreq_device->allowed_cpus | ||
| 380 | * | 381 | * |
| 381 | * Return: The average load of cpu @cpu in percentage since this | 382 | * Return: The average load of cpu @cpu in percentage since this |
| 382 | * function was last called. | 383 | * function was last called. |
| 383 | */ | 384 | */ |
| 384 | static u32 get_load(struct cpufreq_cooling_device *cpufreq_device, int cpu) | 385 | static u32 get_load(struct cpufreq_cooling_device *cpufreq_device, int cpu, |
| 386 | int cpu_idx) | ||
| 385 | { | 387 | { |
| 386 | u32 load; | 388 | u32 load; |
| 387 | u64 now, now_idle, delta_time, delta_idle; | 389 | u64 now, now_idle, delta_time, delta_idle; |
| 388 | 390 | ||
| 389 | now_idle = get_cpu_idle_time(cpu, &now, 0); | 391 | now_idle = get_cpu_idle_time(cpu, &now, 0); |
| 390 | delta_idle = now_idle - cpufreq_device->time_in_idle[cpu]; | 392 | delta_idle = now_idle - cpufreq_device->time_in_idle[cpu_idx]; |
| 391 | delta_time = now - cpufreq_device->time_in_idle_timestamp[cpu]; | 393 | delta_time = now - cpufreq_device->time_in_idle_timestamp[cpu_idx]; |
| 392 | 394 | ||
| 393 | if (delta_time <= delta_idle) | 395 | if (delta_time <= delta_idle) |
| 394 | load = 0; | 396 | load = 0; |
| 395 | else | 397 | else |
| 396 | load = div64_u64(100 * (delta_time - delta_idle), delta_time); | 398 | load = div64_u64(100 * (delta_time - delta_idle), delta_time); |
| 397 | 399 | ||
| 398 | cpufreq_device->time_in_idle[cpu] = now_idle; | 400 | cpufreq_device->time_in_idle[cpu_idx] = now_idle; |
| 399 | cpufreq_device->time_in_idle_timestamp[cpu] = now; | 401 | cpufreq_device->time_in_idle_timestamp[cpu_idx] = now; |
| 400 | 402 | ||
| 401 | return load; | 403 | return load; |
| 402 | } | 404 | } |
| @@ -598,7 +600,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, | |||
| 598 | u32 load; | 600 | u32 load; |
| 599 | 601 | ||
| 600 | if (cpu_online(cpu)) | 602 | if (cpu_online(cpu)) |
| 601 | load = get_load(cpufreq_device, cpu); | 603 | load = get_load(cpufreq_device, cpu, i); |
| 602 | else | 604 | else |
| 603 | load = 0; | 605 | load = 0; |
| 604 | 606 | ||
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index be4eedcb839a..9043f8f91852 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
| @@ -475,14 +475,10 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, | |||
| 475 | 475 | ||
| 476 | sensor_np = of_node_get(dev->of_node); | 476 | sensor_np = of_node_get(dev->of_node); |
| 477 | 477 | ||
| 478 | for_each_child_of_node(np, child) { | 478 | for_each_available_child_of_node(np, child) { |
| 479 | struct of_phandle_args sensor_specs; | 479 | struct of_phandle_args sensor_specs; |
| 480 | int ret, id; | 480 | int ret, id; |
| 481 | 481 | ||
| 482 | /* Check whether child is enabled or not */ | ||
| 483 | if (!of_device_is_available(child)) | ||
| 484 | continue; | ||
| 485 | |||
| 486 | /* For now, thermal framework supports only 1 sensor per zone */ | 482 | /* For now, thermal framework supports only 1 sensor per zone */ |
| 487 | ret = of_parse_phandle_with_args(child, "thermal-sensors", | 483 | ret = of_parse_phandle_with_args(child, "thermal-sensors", |
| 488 | "#thermal-sensor-cells", | 484 | "#thermal-sensor-cells", |
| @@ -881,16 +877,12 @@ int __init of_parse_thermal_zones(void) | |||
| 881 | return 0; /* Run successfully on systems without thermal DT */ | 877 | return 0; /* Run successfully on systems without thermal DT */ |
| 882 | } | 878 | } |
| 883 | 879 | ||
| 884 | for_each_child_of_node(np, child) { | 880 | for_each_available_child_of_node(np, child) { |
| 885 | struct thermal_zone_device *zone; | 881 | struct thermal_zone_device *zone; |
| 886 | struct thermal_zone_params *tzp; | 882 | struct thermal_zone_params *tzp; |
| 887 | int i, mask = 0; | 883 | int i, mask = 0; |
| 888 | u32 prop; | 884 | u32 prop; |
| 889 | 885 | ||
| 890 | /* Check whether child is enabled or not */ | ||
| 891 | if (!of_device_is_available(child)) | ||
| 892 | continue; | ||
| 893 | |||
| 894 | tz = thermal_of_build_thermal_zone(child); | 886 | tz = thermal_of_build_thermal_zone(child); |
| 895 | if (IS_ERR(tz)) { | 887 | if (IS_ERR(tz)) { |
| 896 | pr_err("failed to build thermal zone %s: %ld\n", | 888 | pr_err("failed to build thermal zone %s: %ld\n", |
| @@ -968,13 +960,9 @@ void of_thermal_destroy_zones(void) | |||
| 968 | return; | 960 | return; |
| 969 | } | 961 | } |
| 970 | 962 | ||
| 971 | for_each_child_of_node(np, child) { | 963 | for_each_available_child_of_node(np, child) { |
| 972 | struct thermal_zone_device *zone; | 964 | struct thermal_zone_device *zone; |
| 973 | 965 | ||
| 974 | /* Check whether child is enabled or not */ | ||
| 975 | if (!of_device_is_available(child)) | ||
| 976 | continue; | ||
| 977 | |||
| 978 | zone = thermal_zone_get_zone_by_name(child->name); | 966 | zone = thermal_zone_get_zone_by_name(child->name); |
| 979 | if (IS_ERR(zone)) | 967 | if (IS_ERR(zone)) |
| 980 | continue; | 968 | continue; |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 44b9c485157d..0e735acea33a 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
| 25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
| 26 | #include <linux/of_device.h> | ||
| 26 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
| 27 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
| 28 | #include <linux/reboot.h> | 29 | #include <linux/reboot.h> |
| @@ -75,8 +76,10 @@ struct rcar_thermal_priv { | |||
| 75 | #define rcar_has_irq_support(priv) ((priv)->common->base) | 76 | #define rcar_has_irq_support(priv) ((priv)->common->base) |
| 76 | #define rcar_id_to_shift(priv) ((priv)->id * 8) | 77 | #define rcar_id_to_shift(priv) ((priv)->id * 8) |
| 77 | 78 | ||
| 79 | #define USE_OF_THERMAL 1 | ||
| 78 | static const struct of_device_id rcar_thermal_dt_ids[] = { | 80 | static const struct of_device_id rcar_thermal_dt_ids[] = { |
| 79 | { .compatible = "renesas,rcar-thermal", }, | 81 | { .compatible = "renesas,rcar-thermal", }, |
| 82 | { .compatible = "renesas,rcar-gen2-thermal", .data = (void *)USE_OF_THERMAL }, | ||
| 80 | {}, | 83 | {}, |
| 81 | }; | 84 | }; |
| 82 | MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids); | 85 | MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids); |
| @@ -200,9 +203,9 @@ err_out_unlock: | |||
| 200 | return ret; | 203 | return ret; |
| 201 | } | 204 | } |
| 202 | 205 | ||
| 203 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) | 206 | static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, |
| 207 | int *temp) | ||
| 204 | { | 208 | { |
| 205 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); | ||
| 206 | int tmp; | 209 | int tmp; |
| 207 | int ret; | 210 | int ret; |
| 208 | 211 | ||
| @@ -226,6 +229,20 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) | |||
| 226 | return 0; | 229 | return 0; |
| 227 | } | 230 | } |
| 228 | 231 | ||
| 232 | static int rcar_thermal_of_get_temp(void *data, int *temp) | ||
| 233 | { | ||
| 234 | struct rcar_thermal_priv *priv = data; | ||
| 235 | |||
| 236 | return rcar_thermal_get_current_temp(priv, temp); | ||
| 237 | } | ||
| 238 | |||
| 239 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) | ||
| 240 | { | ||
| 241 | struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); | ||
| 242 | |||
| 243 | return rcar_thermal_get_current_temp(priv, temp); | ||
| 244 | } | ||
| 245 | |||
| 229 | static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone, | 246 | static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone, |
| 230 | int trip, enum thermal_trip_type *type) | 247 | int trip, enum thermal_trip_type *type) |
| 231 | { | 248 | { |
| @@ -282,6 +299,10 @@ static int rcar_thermal_notify(struct thermal_zone_device *zone, | |||
| 282 | return 0; | 299 | return 0; |
| 283 | } | 300 | } |
| 284 | 301 | ||
| 302 | static const struct thermal_zone_of_device_ops rcar_thermal_zone_of_ops = { | ||
| 303 | .get_temp = rcar_thermal_of_get_temp, | ||
| 304 | }; | ||
| 305 | |||
| 285 | static struct thermal_zone_device_ops rcar_thermal_zone_ops = { | 306 | static struct thermal_zone_device_ops rcar_thermal_zone_ops = { |
| 286 | .get_temp = rcar_thermal_get_temp, | 307 | .get_temp = rcar_thermal_get_temp, |
| 287 | .get_trip_type = rcar_thermal_get_trip_type, | 308 | .get_trip_type = rcar_thermal_get_trip_type, |
| @@ -318,14 +339,20 @@ static void rcar_thermal_work(struct work_struct *work) | |||
| 318 | 339 | ||
| 319 | priv = container_of(work, struct rcar_thermal_priv, work.work); | 340 | priv = container_of(work, struct rcar_thermal_priv, work.work); |
| 320 | 341 | ||
| 321 | rcar_thermal_get_temp(priv->zone, &cctemp); | 342 | ret = rcar_thermal_get_current_temp(priv, &cctemp); |
| 343 | if (ret < 0) | ||
| 344 | return; | ||
| 345 | |||
| 322 | ret = rcar_thermal_update_temp(priv); | 346 | ret = rcar_thermal_update_temp(priv); |
| 323 | if (ret < 0) | 347 | if (ret < 0) |
| 324 | return; | 348 | return; |
| 325 | 349 | ||
| 326 | rcar_thermal_irq_enable(priv); | 350 | rcar_thermal_irq_enable(priv); |
| 327 | 351 | ||
| 328 | rcar_thermal_get_temp(priv->zone, &nctemp); | 352 | ret = rcar_thermal_get_current_temp(priv, &nctemp); |
| 353 | if (ret < 0) | ||
| 354 | return; | ||
| 355 | |||
| 329 | if (nctemp != cctemp) | 356 | if (nctemp != cctemp) |
| 330 | thermal_zone_device_update(priv->zone); | 357 | thermal_zone_device_update(priv->zone); |
| 331 | } | 358 | } |
| @@ -403,6 +430,8 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 403 | struct rcar_thermal_priv *priv; | 430 | struct rcar_thermal_priv *priv; |
| 404 | struct device *dev = &pdev->dev; | 431 | struct device *dev = &pdev->dev; |
| 405 | struct resource *res, *irq; | 432 | struct resource *res, *irq; |
| 433 | const struct of_device_id *of_id = of_match_device(rcar_thermal_dt_ids, dev); | ||
| 434 | unsigned long of_data = (unsigned long)of_id->data; | ||
| 406 | int mres = 0; | 435 | int mres = 0; |
| 407 | int i; | 436 | int i; |
| 408 | int ret = -ENODEV; | 437 | int ret = -ENODEV; |
| @@ -463,7 +492,13 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
| 463 | if (ret < 0) | 492 | if (ret < 0) |
| 464 | goto error_unregister; | 493 | goto error_unregister; |
| 465 | 494 | ||
| 466 | priv->zone = thermal_zone_device_register("rcar_thermal", | 495 | if (of_data == USE_OF_THERMAL) |
| 496 | priv->zone = thermal_zone_of_sensor_register( | ||
| 497 | dev, i, priv, | ||
| 498 | &rcar_thermal_zone_of_ops); | ||
| 499 | else | ||
| 500 | priv->zone = thermal_zone_device_register( | ||
| 501 | "rcar_thermal", | ||
| 467 | 1, 0, priv, | 502 | 1, 0, priv, |
| 468 | &rcar_thermal_zone_ops, NULL, 0, | 503 | &rcar_thermal_zone_ops, NULL, 0, |
| 469 | idle); | 504 | idle); |
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 534dd9136662..81b35aace9de 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c | |||
| @@ -54,8 +54,7 @@ static struct thermal_zone_device_ops ops = { | |||
| 54 | .get_temp = thermal_get_temp, | 54 | .get_temp = thermal_get_temp, |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | #ifdef CONFIG_PM | 57 | static int __maybe_unused spear_thermal_suspend(struct device *dev) |
| 58 | static int spear_thermal_suspend(struct device *dev) | ||
| 59 | { | 58 | { |
| 60 | struct platform_device *pdev = to_platform_device(dev); | 59 | struct platform_device *pdev = to_platform_device(dev); |
| 61 | struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); | 60 | struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); |
| @@ -72,7 +71,7 @@ static int spear_thermal_suspend(struct device *dev) | |||
| 72 | return 0; | 71 | return 0; |
| 73 | } | 72 | } |
| 74 | 73 | ||
| 75 | static int spear_thermal_resume(struct device *dev) | 74 | static int __maybe_unused spear_thermal_resume(struct device *dev) |
| 76 | { | 75 | { |
| 77 | struct platform_device *pdev = to_platform_device(dev); | 76 | struct platform_device *pdev = to_platform_device(dev); |
| 78 | struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); | 77 | struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); |
| @@ -94,7 +93,6 @@ static int spear_thermal_resume(struct device *dev) | |||
| 94 | 93 | ||
| 95 | return 0; | 94 | return 0; |
| 96 | } | 95 | } |
| 97 | #endif | ||
| 98 | 96 | ||
| 99 | static SIMPLE_DEV_PM_OPS(spear_thermal_pm_ops, spear_thermal_suspend, | 97 | static SIMPLE_DEV_PM_OPS(spear_thermal_pm_ops, spear_thermal_suspend, |
| 100 | spear_thermal_resume); | 98 | spear_thermal_resume); |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index b3110040164a..2348fa613707 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
| @@ -681,7 +681,14 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) | |||
| 681 | /* this is called once with whichever end is closed last */ | 681 | /* this is called once with whichever end is closed last */ |
| 682 | static void pty_unix98_shutdown(struct tty_struct *tty) | 682 | static void pty_unix98_shutdown(struct tty_struct *tty) |
| 683 | { | 683 | { |
| 684 | devpts_kill_index(tty->driver_data, tty->index); | 684 | struct inode *ptmx_inode; |
| 685 | |||
| 686 | if (tty->driver->subtype == PTY_TYPE_MASTER) | ||
| 687 | ptmx_inode = tty->driver_data; | ||
| 688 | else | ||
| 689 | ptmx_inode = tty->link->driver_data; | ||
| 690 | devpts_kill_index(ptmx_inode, tty->index); | ||
| 691 | devpts_del_ref(ptmx_inode); | ||
| 685 | } | 692 | } |
| 686 | 693 | ||
| 687 | static const struct tty_operations ptm_unix98_ops = { | 694 | static const struct tty_operations ptm_unix98_ops = { |
| @@ -773,6 +780,18 @@ static int ptmx_open(struct inode *inode, struct file *filp) | |||
| 773 | set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ | 780 | set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ |
| 774 | tty->driver_data = inode; | 781 | tty->driver_data = inode; |
| 775 | 782 | ||
| 783 | /* | ||
| 784 | * In the case where all references to ptmx inode are dropped and we | ||
| 785 | * still have /dev/tty opened pointing to the master/slave pair (ptmx | ||
| 786 | * is closed/released before /dev/tty), we must make sure that the inode | ||
| 787 | * is still valid when we call the final pty_unix98_shutdown, thus we | ||
| 788 | * hold an additional reference to the ptmx inode. For the same /dev/tty | ||
| 789 | * last close case, we also need to make sure the super_block isn't | ||
| 790 | * destroyed (devpts instance unmounted), before /dev/tty is closed and | ||
| 791 | * on its release devpts_kill_index is called. | ||
| 792 | */ | ||
| 793 | devpts_add_ref(inode); | ||
| 794 | |||
| 776 | tty_add_file(tty, filp); | 795 | tty_add_file(tty, filp); |
| 777 | 796 | ||
| 778 | slave_inode = devpts_pty_new(inode, | 797 | slave_inode = devpts_pty_new(inode, |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index e71ec78fc11e..7cd6f9a90542 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
| @@ -1941,6 +1941,7 @@ pci_wch_ch38x_setup(struct serial_private *priv, | |||
| 1941 | #define PCIE_VENDOR_ID_WCH 0x1c00 | 1941 | #define PCIE_VENDOR_ID_WCH 0x1c00 |
| 1942 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 | 1942 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 |
| 1943 | #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 | 1943 | #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 |
| 1944 | #define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253 | ||
| 1944 | 1945 | ||
| 1945 | #define PCI_VENDOR_ID_PERICOM 0x12D8 | 1946 | #define PCI_VENDOR_ID_PERICOM 0x12D8 |
| 1946 | #define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951 | 1947 | #define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951 |
| @@ -2637,6 +2638,14 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
| 2637 | .subdevice = PCI_ANY_ID, | 2638 | .subdevice = PCI_ANY_ID, |
| 2638 | .setup = pci_wch_ch353_setup, | 2639 | .setup = pci_wch_ch353_setup, |
| 2639 | }, | 2640 | }, |
| 2641 | /* WCH CH382 2S card (16850 clone) */ | ||
| 2642 | { | ||
| 2643 | .vendor = PCIE_VENDOR_ID_WCH, | ||
| 2644 | .device = PCIE_DEVICE_ID_WCH_CH382_2S, | ||
| 2645 | .subvendor = PCI_ANY_ID, | ||
| 2646 | .subdevice = PCI_ANY_ID, | ||
| 2647 | .setup = pci_wch_ch38x_setup, | ||
| 2648 | }, | ||
| 2640 | /* WCH CH382 2S1P card (16850 clone) */ | 2649 | /* WCH CH382 2S1P card (16850 clone) */ |
| 2641 | { | 2650 | { |
| 2642 | .vendor = PCIE_VENDOR_ID_WCH, | 2651 | .vendor = PCIE_VENDOR_ID_WCH, |
| @@ -2955,6 +2964,7 @@ enum pci_board_num_t { | |||
| 2955 | pbn_fintek_4, | 2964 | pbn_fintek_4, |
| 2956 | pbn_fintek_8, | 2965 | pbn_fintek_8, |
| 2957 | pbn_fintek_12, | 2966 | pbn_fintek_12, |
| 2967 | pbn_wch382_2, | ||
| 2958 | pbn_wch384_4, | 2968 | pbn_wch384_4, |
| 2959 | pbn_pericom_PI7C9X7951, | 2969 | pbn_pericom_PI7C9X7951, |
| 2960 | pbn_pericom_PI7C9X7952, | 2970 | pbn_pericom_PI7C9X7952, |
| @@ -3775,6 +3785,13 @@ static struct pciserial_board pci_boards[] = { | |||
| 3775 | .base_baud = 115200, | 3785 | .base_baud = 115200, |
| 3776 | .first_offset = 0x40, | 3786 | .first_offset = 0x40, |
| 3777 | }, | 3787 | }, |
| 3788 | [pbn_wch382_2] = { | ||
| 3789 | .flags = FL_BASE0, | ||
| 3790 | .num_ports = 2, | ||
| 3791 | .base_baud = 115200, | ||
| 3792 | .uart_offset = 8, | ||
| 3793 | .first_offset = 0xC0, | ||
| 3794 | }, | ||
| 3778 | [pbn_wch384_4] = { | 3795 | [pbn_wch384_4] = { |
| 3779 | .flags = FL_BASE0, | 3796 | .flags = FL_BASE0, |
| 3780 | .num_ports = 4, | 3797 | .num_ports = 4, |
| @@ -5574,6 +5591,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
| 5574 | PCI_ANY_ID, PCI_ANY_ID, | 5591 | PCI_ANY_ID, PCI_ANY_ID, |
| 5575 | 0, 0, pbn_b0_bt_2_115200 }, | 5592 | 0, 0, pbn_b0_bt_2_115200 }, |
| 5576 | 5593 | ||
| 5594 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH382_2S, | ||
| 5595 | PCI_ANY_ID, PCI_ANY_ID, | ||
| 5596 | 0, 0, pbn_wch382_2 }, | ||
| 5597 | |||
| 5577 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, | 5598 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, |
| 5578 | PCI_ANY_ID, PCI_ANY_ID, | 5599 | PCI_ANY_ID, PCI_ANY_ID, |
| 5579 | 0, 0, pbn_wch384_4 }, | 5600 | 0, 0, pbn_wch384_4 }, |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index b645f9228ed7..fa49eb1e2fa2 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
| @@ -1165,7 +1165,7 @@ serial_omap_type(struct uart_port *port) | |||
| 1165 | 1165 | ||
| 1166 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) | 1166 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
| 1167 | 1167 | ||
| 1168 | static void wait_for_xmitr(struct uart_omap_port *up) | 1168 | static void __maybe_unused wait_for_xmitr(struct uart_omap_port *up) |
| 1169 | { | 1169 | { |
| 1170 | unsigned int status, tmout = 10000; | 1170 | unsigned int status, tmout = 10000; |
| 1171 | 1171 | ||
| @@ -1343,7 +1343,7 @@ static inline void serial_omap_add_console_port(struct uart_omap_port *up) | |||
| 1343 | 1343 | ||
| 1344 | /* Enable or disable the rs485 support */ | 1344 | /* Enable or disable the rs485 support */ |
| 1345 | static int | 1345 | static int |
| 1346 | serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf) | 1346 | serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) |
| 1347 | { | 1347 | { |
| 1348 | struct uart_omap_port *up = to_uart_omap_port(port); | 1348 | struct uart_omap_port *up = to_uart_omap_port(port); |
| 1349 | unsigned int mode; | 1349 | unsigned int mode; |
| @@ -1356,8 +1356,12 @@ serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf) | |||
| 1356 | up->ier = 0; | 1356 | up->ier = 0; |
| 1357 | serial_out(up, UART_IER, 0); | 1357 | serial_out(up, UART_IER, 0); |
| 1358 | 1358 | ||
| 1359 | /* Clamp the delays to [0, 100ms] */ | ||
| 1360 | rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); | ||
| 1361 | rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); | ||
| 1362 | |||
| 1359 | /* store new config */ | 1363 | /* store new config */ |
| 1360 | port->rs485 = *rs485conf; | 1364 | port->rs485 = *rs485; |
| 1361 | 1365 | ||
| 1362 | /* | 1366 | /* |
| 1363 | * Just as a precaution, only allow rs485 | 1367 | * Just as a precaution, only allow rs485 |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 5cec01c75691..a7eacef1bd22 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -2066,13 +2066,12 @@ retry_open: | |||
| 2066 | if (tty) { | 2066 | if (tty) { |
| 2067 | mutex_unlock(&tty_mutex); | 2067 | mutex_unlock(&tty_mutex); |
| 2068 | retval = tty_lock_interruptible(tty); | 2068 | retval = tty_lock_interruptible(tty); |
| 2069 | tty_kref_put(tty); /* drop kref from tty_driver_lookup_tty() */ | ||
| 2069 | if (retval) { | 2070 | if (retval) { |
| 2070 | if (retval == -EINTR) | 2071 | if (retval == -EINTR) |
| 2071 | retval = -ERESTARTSYS; | 2072 | retval = -ERESTARTSYS; |
| 2072 | goto err_unref; | 2073 | goto err_unref; |
| 2073 | } | 2074 | } |
| 2074 | /* safe to drop the kref from tty_driver_lookup_tty() */ | ||
| 2075 | tty_kref_put(tty); | ||
| 2076 | retval = tty_reopen(tty); | 2075 | retval = tty_reopen(tty); |
| 2077 | if (retval < 0) { | 2076 | if (retval < 0) { |
| 2078 | tty_unlock(tty); | 2077 | tty_unlock(tty); |
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c index d2f3c4cd697f..dfa9ec03fa8e 100644 --- a/drivers/tty/tty_mutex.c +++ b/drivers/tty/tty_mutex.c | |||
| @@ -21,10 +21,15 @@ EXPORT_SYMBOL(tty_lock); | |||
| 21 | 21 | ||
| 22 | int tty_lock_interruptible(struct tty_struct *tty) | 22 | int tty_lock_interruptible(struct tty_struct *tty) |
| 23 | { | 23 | { |
| 24 | int ret; | ||
| 25 | |||
| 24 | if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty)) | 26 | if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty)) |
| 25 | return -EIO; | 27 | return -EIO; |
| 26 | tty_kref_get(tty); | 28 | tty_kref_get(tty); |
| 27 | return mutex_lock_interruptible(&tty->legacy_mutex); | 29 | ret = mutex_lock_interruptible(&tty->legacy_mutex); |
| 30 | if (ret) | ||
| 31 | tty_kref_put(tty); | ||
| 32 | return ret; | ||
| 28 | } | 33 | } |
| 29 | 34 | ||
| 30 | void __lockfunc tty_unlock(struct tty_struct *tty) | 35 | void __lockfunc tty_unlock(struct tty_struct *tty) |
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 0081725c6b5b..6b2a06d09f2b 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c | |||
| @@ -152,7 +152,7 @@ static void lcdc_write(unsigned int val, unsigned int addr) | |||
| 152 | 152 | ||
| 153 | struct da8xx_fb_par { | 153 | struct da8xx_fb_par { |
| 154 | struct device *dev; | 154 | struct device *dev; |
| 155 | resource_size_t p_palette_base; | 155 | dma_addr_t p_palette_base; |
| 156 | unsigned char *v_palette_base; | 156 | unsigned char *v_palette_base; |
| 157 | dma_addr_t vram_phys; | 157 | dma_addr_t vram_phys; |
| 158 | unsigned long vram_size; | 158 | unsigned long vram_size; |
| @@ -1428,7 +1428,7 @@ static int fb_probe(struct platform_device *device) | |||
| 1428 | 1428 | ||
| 1429 | par->vram_virt = dma_alloc_coherent(NULL, | 1429 | par->vram_virt = dma_alloc_coherent(NULL, |
| 1430 | par->vram_size, | 1430 | par->vram_size, |
| 1431 | (resource_size_t *) &par->vram_phys, | 1431 | &par->vram_phys, |
| 1432 | GFP_KERNEL | GFP_DMA); | 1432 | GFP_KERNEL | GFP_DMA); |
| 1433 | if (!par->vram_virt) { | 1433 | if (!par->vram_virt) { |
| 1434 | dev_err(&device->dev, | 1434 | dev_err(&device->dev, |
| @@ -1448,7 +1448,7 @@ static int fb_probe(struct platform_device *device) | |||
| 1448 | 1448 | ||
| 1449 | /* allocate palette buffer */ | 1449 | /* allocate palette buffer */ |
| 1450 | par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE, | 1450 | par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE, |
| 1451 | (resource_size_t *)&par->p_palette_base, | 1451 | &par->p_palette_base, |
| 1452 | GFP_KERNEL | GFP_DMA); | 1452 | GFP_KERNEL | GFP_DMA); |
| 1453 | if (!par->v_palette_base) { | 1453 | if (!par->v_palette_base) { |
| 1454 | dev_err(&device->dev, | 1454 | dev_err(&device->dev, |
diff --git a/drivers/video/fbdev/exynos/s6e8ax0.c b/drivers/video/fbdev/exynos/s6e8ax0.c index 95873f26e39c..de2f3e793786 100644 --- a/drivers/video/fbdev/exynos/s6e8ax0.c +++ b/drivers/video/fbdev/exynos/s6e8ax0.c | |||
| @@ -829,8 +829,7 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev) | |||
| 829 | return 0; | 829 | return 0; |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | #ifdef CONFIG_PM | 832 | static int __maybe_unused s6e8ax0_suspend(struct mipi_dsim_lcd_device *dsim_dev) |
| 833 | static int s6e8ax0_suspend(struct mipi_dsim_lcd_device *dsim_dev) | ||
| 834 | { | 833 | { |
| 835 | struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev); | 834 | struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev); |
| 836 | 835 | ||
| @@ -843,7 +842,7 @@ static int s6e8ax0_suspend(struct mipi_dsim_lcd_device *dsim_dev) | |||
| 843 | return 0; | 842 | return 0; |
| 844 | } | 843 | } |
| 845 | 844 | ||
| 846 | static int s6e8ax0_resume(struct mipi_dsim_lcd_device *dsim_dev) | 845 | static int __maybe_unused s6e8ax0_resume(struct mipi_dsim_lcd_device *dsim_dev) |
| 847 | { | 846 | { |
| 848 | struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev); | 847 | struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev); |
| 849 | 848 | ||
| @@ -855,10 +854,6 @@ static int s6e8ax0_resume(struct mipi_dsim_lcd_device *dsim_dev) | |||
| 855 | 854 | ||
| 856 | return 0; | 855 | return 0; |
| 857 | } | 856 | } |
| 858 | #else | ||
| 859 | #define s6e8ax0_suspend NULL | ||
| 860 | #define s6e8ax0_resume NULL | ||
| 861 | #endif | ||
| 862 | 857 | ||
| 863 | static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = { | 858 | static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = { |
| 864 | .name = "s6e8ax0", | 859 | .name = "s6e8ax0", |
| @@ -867,8 +862,8 @@ static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = { | |||
| 867 | .power_on = s6e8ax0_power_on, | 862 | .power_on = s6e8ax0_power_on, |
| 868 | .set_sequence = s6e8ax0_set_sequence, | 863 | .set_sequence = s6e8ax0_set_sequence, |
| 869 | .probe = s6e8ax0_probe, | 864 | .probe = s6e8ax0_probe, |
| 870 | .suspend = s6e8ax0_suspend, | 865 | .suspend = IS_ENABLED(CONFIG_PM) ? s6e8ax0_suspend : NULL, |
| 871 | .resume = s6e8ax0_resume, | 866 | .resume = IS_ENABLED(CONFIG_PM) ? s6e8ax0_resume : NULL, |
| 872 | }; | 867 | }; |
| 873 | 868 | ||
| 874 | static int s6e8ax0_init(void) | 869 | static int s6e8ax0_init(void) |
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index cee88603efc9..bb2f1e866020 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c | |||
| @@ -902,6 +902,21 @@ static int imxfb_probe(struct platform_device *pdev) | |||
| 902 | goto failed_getclock; | 902 | goto failed_getclock; |
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | /* | ||
| 906 | * The LCDC controller does not have an enable bit. The | ||
| 907 | * controller starts directly when the clocks are enabled. | ||
| 908 | * If the clocks are enabled when the controller is not yet | ||
| 909 | * programmed with proper register values (enabled at the | ||
| 910 | * bootloader, for example) then it just goes into some undefined | ||
| 911 | * state. | ||
| 912 | * To avoid this issue, let's enable and disable LCDC IPG clock | ||
| 913 | * so that we force some kind of 'reset' to the LCDC block. | ||
| 914 | */ | ||
| 915 | ret = clk_prepare_enable(fbi->clk_ipg); | ||
| 916 | if (ret) | ||
| 917 | goto failed_getclock; | ||
| 918 | clk_disable_unprepare(fbi->clk_ipg); | ||
| 919 | |||
| 905 | fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); | 920 | fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); |
| 906 | if (IS_ERR(fbi->clk_ahb)) { | 921 | if (IS_ERR(fbi->clk_ahb)) { |
| 907 | ret = PTR_ERR(fbi->clk_ahb); | 922 | ret = PTR_ERR(fbi->clk_ahb); |
diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c index de54a4748065..b6f83d5df9fd 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c | |||
| @@ -503,8 +503,7 @@ static int mmphw_probe(struct platform_device *pdev) | |||
| 503 | ctrl->reg_base = devm_ioremap_nocache(ctrl->dev, | 503 | ctrl->reg_base = devm_ioremap_nocache(ctrl->dev, |
| 504 | res->start, resource_size(res)); | 504 | res->start, resource_size(res)); |
| 505 | if (ctrl->reg_base == NULL) { | 505 | if (ctrl->reg_base == NULL) { |
| 506 | dev_err(ctrl->dev, "%s: res %x - %x map failed\n", __func__, | 506 | dev_err(ctrl->dev, "%s: res %pR map failed\n", __func__, res); |
| 507 | res->start, res->end); | ||
| 508 | ret = -ENOMEM; | 507 | ret = -ENOMEM; |
| 509 | goto failed; | 508 | goto failed; |
| 510 | } | 509 | } |
diff --git a/drivers/video/fbdev/ocfb.c b/drivers/video/fbdev/ocfb.c index c9293aea8ec3..a970edc2a6f8 100644 --- a/drivers/video/fbdev/ocfb.c +++ b/drivers/video/fbdev/ocfb.c | |||
| @@ -123,11 +123,11 @@ static int ocfb_setupfb(struct ocfb_dev *fbdev) | |||
| 123 | 123 | ||
| 124 | /* Horizontal timings */ | 124 | /* Horizontal timings */ |
| 125 | ocfb_writereg(fbdev, OCFB_HTIM, (var->hsync_len - 1) << 24 | | 125 | ocfb_writereg(fbdev, OCFB_HTIM, (var->hsync_len - 1) << 24 | |
| 126 | (var->right_margin - 1) << 16 | (var->xres - 1)); | 126 | (var->left_margin - 1) << 16 | (var->xres - 1)); |
| 127 | 127 | ||
| 128 | /* Vertical timings */ | 128 | /* Vertical timings */ |
| 129 | ocfb_writereg(fbdev, OCFB_VTIM, (var->vsync_len - 1) << 24 | | 129 | ocfb_writereg(fbdev, OCFB_VTIM, (var->vsync_len - 1) << 24 | |
| 130 | (var->lower_margin - 1) << 16 | (var->yres - 1)); | 130 | (var->upper_margin - 1) << 16 | (var->yres - 1)); |
| 131 | 131 | ||
| 132 | /* Total length of frame */ | 132 | /* Total length of frame */ |
| 133 | hlen = var->left_margin + var->right_margin + var->hsync_len + | 133 | hlen = var->left_margin + var->right_margin + var->hsync_len + |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index b90cd3776f8e..f6dac40f87ff 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
| @@ -1406,7 +1406,8 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | |||
| 1406 | read_extent_buffer(eb, dest + bytes_left, | 1406 | read_extent_buffer(eb, dest + bytes_left, |
| 1407 | name_off, name_len); | 1407 | name_off, name_len); |
| 1408 | if (eb != eb_in) { | 1408 | if (eb != eb_in) { |
| 1409 | btrfs_tree_read_unlock_blocking(eb); | 1409 | if (!path->skip_locking) |
| 1410 | btrfs_tree_read_unlock_blocking(eb); | ||
| 1410 | free_extent_buffer(eb); | 1411 | free_extent_buffer(eb); |
| 1411 | } | 1412 | } |
| 1412 | ret = btrfs_find_item(fs_root, path, parent, 0, | 1413 | ret = btrfs_find_item(fs_root, path, parent, 0, |
| @@ -1426,9 +1427,10 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | |||
| 1426 | eb = path->nodes[0]; | 1427 | eb = path->nodes[0]; |
| 1427 | /* make sure we can use eb after releasing the path */ | 1428 | /* make sure we can use eb after releasing the path */ |
| 1428 | if (eb != eb_in) { | 1429 | if (eb != eb_in) { |
| 1429 | atomic_inc(&eb->refs); | 1430 | if (!path->skip_locking) |
| 1430 | btrfs_tree_read_lock(eb); | 1431 | btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
| 1431 | btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); | 1432 | path->nodes[0] = NULL; |
| 1433 | path->locks[0] = 0; | ||
| 1432 | } | 1434 | } |
| 1433 | btrfs_release_path(path); | 1435 | btrfs_release_path(path); |
| 1434 | iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); | 1436 | iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index c473c42d7d6c..3346cd8f9910 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -637,11 +637,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | |||
| 637 | faili = nr_pages - 1; | 637 | faili = nr_pages - 1; |
| 638 | cb->nr_pages = nr_pages; | 638 | cb->nr_pages = nr_pages; |
| 639 | 639 | ||
| 640 | /* In the parent-locked case, we only locked the range we are | 640 | add_ra_bio_pages(inode, em_start + em_len, cb); |
| 641 | * interested in. In all other cases, we can opportunistically | ||
| 642 | * cache decompressed data that goes beyond the requested range. */ | ||
| 643 | if (!(bio_flags & EXTENT_BIO_PARENT_LOCKED)) | ||
| 644 | add_ra_bio_pages(inode, em_start + em_len, cb); | ||
| 645 | 641 | ||
| 646 | /* include any pages we added in add_ra-bio_pages */ | 642 | /* include any pages we added in add_ra-bio_pages */ |
| 647 | uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE; | 643 | uncompressed_len = bio->bi_vcnt * PAGE_CACHE_SIZE; |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 0be47e4b8136..b57daa895cea 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
| @@ -1689,7 +1689,7 @@ int btrfs_should_delete_dir_index(struct list_head *del_list, | |||
| 1689 | * | 1689 | * |
| 1690 | */ | 1690 | */ |
| 1691 | int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, | 1691 | int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, |
| 1692 | struct list_head *ins_list) | 1692 | struct list_head *ins_list, bool *emitted) |
| 1693 | { | 1693 | { |
| 1694 | struct btrfs_dir_item *di; | 1694 | struct btrfs_dir_item *di; |
| 1695 | struct btrfs_delayed_item *curr, *next; | 1695 | struct btrfs_delayed_item *curr, *next; |
| @@ -1733,6 +1733,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, | |||
| 1733 | 1733 | ||
| 1734 | if (over) | 1734 | if (over) |
| 1735 | return 1; | 1735 | return 1; |
| 1736 | *emitted = true; | ||
| 1736 | } | 1737 | } |
| 1737 | return 0; | 1738 | return 0; |
| 1738 | } | 1739 | } |
diff --git a/fs/btrfs/delayed-inode.h b/fs/btrfs/delayed-inode.h index f70119f25421..0167853c84ae 100644 --- a/fs/btrfs/delayed-inode.h +++ b/fs/btrfs/delayed-inode.h | |||
| @@ -144,7 +144,7 @@ void btrfs_put_delayed_items(struct list_head *ins_list, | |||
| 144 | int btrfs_should_delete_dir_index(struct list_head *del_list, | 144 | int btrfs_should_delete_dir_index(struct list_head *del_list, |
| 145 | u64 index); | 145 | u64 index); |
| 146 | int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, | 146 | int btrfs_readdir_delayed_dir_index(struct dir_context *ctx, |
| 147 | struct list_head *ins_list); | 147 | struct list_head *ins_list, bool *emitted); |
| 148 | 148 | ||
| 149 | /* for init */ | 149 | /* for init */ |
| 150 | int __init btrfs_delayed_inode_init(void); | 150 | int __init btrfs_delayed_inode_init(void); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 2e7c97a3f344..392592dc7010 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -2897,12 +2897,11 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 2897 | struct block_device *bdev; | 2897 | struct block_device *bdev; |
| 2898 | int ret; | 2898 | int ret; |
| 2899 | int nr = 0; | 2899 | int nr = 0; |
| 2900 | int parent_locked = *bio_flags & EXTENT_BIO_PARENT_LOCKED; | ||
| 2901 | size_t pg_offset = 0; | 2900 | size_t pg_offset = 0; |
| 2902 | size_t iosize; | 2901 | size_t iosize; |
| 2903 | size_t disk_io_size; | 2902 | size_t disk_io_size; |
| 2904 | size_t blocksize = inode->i_sb->s_blocksize; | 2903 | size_t blocksize = inode->i_sb->s_blocksize; |
| 2905 | unsigned long this_bio_flag = *bio_flags & EXTENT_BIO_PARENT_LOCKED; | 2904 | unsigned long this_bio_flag = 0; |
| 2906 | 2905 | ||
| 2907 | set_page_extent_mapped(page); | 2906 | set_page_extent_mapped(page); |
| 2908 | 2907 | ||
| @@ -2942,18 +2941,16 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 2942 | kunmap_atomic(userpage); | 2941 | kunmap_atomic(userpage); |
| 2943 | set_extent_uptodate(tree, cur, cur + iosize - 1, | 2942 | set_extent_uptodate(tree, cur, cur + iosize - 1, |
| 2944 | &cached, GFP_NOFS); | 2943 | &cached, GFP_NOFS); |
| 2945 | if (!parent_locked) | 2944 | unlock_extent_cached(tree, cur, |
| 2946 | unlock_extent_cached(tree, cur, | 2945 | cur + iosize - 1, |
| 2947 | cur + iosize - 1, | 2946 | &cached, GFP_NOFS); |
| 2948 | &cached, GFP_NOFS); | ||
| 2949 | break; | 2947 | break; |
| 2950 | } | 2948 | } |
| 2951 | em = __get_extent_map(inode, page, pg_offset, cur, | 2949 | em = __get_extent_map(inode, page, pg_offset, cur, |
| 2952 | end - cur + 1, get_extent, em_cached); | 2950 | end - cur + 1, get_extent, em_cached); |
| 2953 | if (IS_ERR_OR_NULL(em)) { | 2951 | if (IS_ERR_OR_NULL(em)) { |
| 2954 | SetPageError(page); | 2952 | SetPageError(page); |
| 2955 | if (!parent_locked) | 2953 | unlock_extent(tree, cur, end); |
| 2956 | unlock_extent(tree, cur, end); | ||
| 2957 | break; | 2954 | break; |
| 2958 | } | 2955 | } |
| 2959 | extent_offset = cur - em->start; | 2956 | extent_offset = cur - em->start; |
| @@ -3038,12 +3035,9 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 3038 | 3035 | ||
| 3039 | set_extent_uptodate(tree, cur, cur + iosize - 1, | 3036 | set_extent_uptodate(tree, cur, cur + iosize - 1, |
| 3040 | &cached, GFP_NOFS); | 3037 | &cached, GFP_NOFS); |
| 3041 | if (parent_locked) | 3038 | unlock_extent_cached(tree, cur, |
| 3042 | free_extent_state(cached); | 3039 | cur + iosize - 1, |
| 3043 | else | 3040 | &cached, GFP_NOFS); |
| 3044 | unlock_extent_cached(tree, cur, | ||
| 3045 | cur + iosize - 1, | ||
| 3046 | &cached, GFP_NOFS); | ||
| 3047 | cur = cur + iosize; | 3041 | cur = cur + iosize; |
| 3048 | pg_offset += iosize; | 3042 | pg_offset += iosize; |
| 3049 | continue; | 3043 | continue; |
| @@ -3052,8 +3046,7 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 3052 | if (test_range_bit(tree, cur, cur_end, | 3046 | if (test_range_bit(tree, cur, cur_end, |
| 3053 | EXTENT_UPTODATE, 1, NULL)) { | 3047 | EXTENT_UPTODATE, 1, NULL)) { |
| 3054 | check_page_uptodate(tree, page); | 3048 | check_page_uptodate(tree, page); |
| 3055 | if (!parent_locked) | 3049 | unlock_extent(tree, cur, cur + iosize - 1); |
| 3056 | unlock_extent(tree, cur, cur + iosize - 1); | ||
| 3057 | cur = cur + iosize; | 3050 | cur = cur + iosize; |
| 3058 | pg_offset += iosize; | 3051 | pg_offset += iosize; |
| 3059 | continue; | 3052 | continue; |
| @@ -3063,8 +3056,7 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 3063 | */ | 3056 | */ |
| 3064 | if (block_start == EXTENT_MAP_INLINE) { | 3057 | if (block_start == EXTENT_MAP_INLINE) { |
| 3065 | SetPageError(page); | 3058 | SetPageError(page); |
| 3066 | if (!parent_locked) | 3059 | unlock_extent(tree, cur, cur + iosize - 1); |
| 3067 | unlock_extent(tree, cur, cur + iosize - 1); | ||
| 3068 | cur = cur + iosize; | 3060 | cur = cur + iosize; |
| 3069 | pg_offset += iosize; | 3061 | pg_offset += iosize; |
| 3070 | continue; | 3062 | continue; |
| @@ -3083,8 +3075,7 @@ static int __do_readpage(struct extent_io_tree *tree, | |||
| 3083 | *bio_flags = this_bio_flag; | 3075 | *bio_flags = this_bio_flag; |
| 3084 | } else { | 3076 | } else { |
| 3085 | SetPageError(page); | 3077 | SetPageError(page); |
| 3086 | if (!parent_locked) | 3078 | unlock_extent(tree, cur, cur + iosize - 1); |
| 3087 | unlock_extent(tree, cur, cur + iosize - 1); | ||
| 3088 | } | 3079 | } |
| 3089 | cur = cur + iosize; | 3080 | cur = cur + iosize; |
| 3090 | pg_offset += iosize; | 3081 | pg_offset += iosize; |
| @@ -3213,20 +3204,6 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, | |||
| 3213 | return ret; | 3204 | return ret; |
| 3214 | } | 3205 | } |
| 3215 | 3206 | ||
| 3216 | int extent_read_full_page_nolock(struct extent_io_tree *tree, struct page *page, | ||
| 3217 | get_extent_t *get_extent, int mirror_num) | ||
| 3218 | { | ||
| 3219 | struct bio *bio = NULL; | ||
| 3220 | unsigned long bio_flags = EXTENT_BIO_PARENT_LOCKED; | ||
| 3221 | int ret; | ||
| 3222 | |||
| 3223 | ret = __do_readpage(tree, page, get_extent, NULL, &bio, mirror_num, | ||
| 3224 | &bio_flags, READ, NULL); | ||
| 3225 | if (bio) | ||
| 3226 | ret = submit_one_bio(READ, bio, mirror_num, bio_flags); | ||
| 3227 | return ret; | ||
| 3228 | } | ||
| 3229 | |||
| 3230 | static noinline void update_nr_written(struct page *page, | 3207 | static noinline void update_nr_written(struct page *page, |
| 3231 | struct writeback_control *wbc, | 3208 | struct writeback_control *wbc, |
| 3232 | unsigned long nr_written) | 3209 | unsigned long nr_written) |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 0377413bd4b9..880d5292e972 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | */ | 29 | */ |
| 30 | #define EXTENT_BIO_COMPRESSED 1 | 30 | #define EXTENT_BIO_COMPRESSED 1 |
| 31 | #define EXTENT_BIO_TREE_LOG 2 | 31 | #define EXTENT_BIO_TREE_LOG 2 |
| 32 | #define EXTENT_BIO_PARENT_LOCKED 4 | ||
| 33 | #define EXTENT_BIO_FLAG_SHIFT 16 | 32 | #define EXTENT_BIO_FLAG_SHIFT 16 |
| 34 | 33 | ||
| 35 | /* these are bit numbers for test/set bit */ | 34 | /* these are bit numbers for test/set bit */ |
| @@ -210,8 +209,6 @@ static inline int lock_extent(struct extent_io_tree *tree, u64 start, u64 end) | |||
| 210 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end); | 209 | int try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end); |
| 211 | int extent_read_full_page(struct extent_io_tree *tree, struct page *page, | 210 | int extent_read_full_page(struct extent_io_tree *tree, struct page *page, |
| 212 | get_extent_t *get_extent, int mirror_num); | 211 | get_extent_t *get_extent, int mirror_num); |
| 213 | int extent_read_full_page_nolock(struct extent_io_tree *tree, struct page *page, | ||
| 214 | get_extent_t *get_extent, int mirror_num); | ||
| 215 | int __init extent_io_init(void); | 212 | int __init extent_io_init(void); |
| 216 | void extent_io_exit(void); | 213 | void extent_io_exit(void); |
| 217 | 214 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5f06eb1f4384..151b7c71b868 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -5717,6 +5717,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx) | |||
| 5717 | char *name_ptr; | 5717 | char *name_ptr; |
| 5718 | int name_len; | 5718 | int name_len; |
| 5719 | int is_curr = 0; /* ctx->pos points to the current index? */ | 5719 | int is_curr = 0; /* ctx->pos points to the current index? */ |
| 5720 | bool emitted; | ||
| 5720 | 5721 | ||
| 5721 | /* FIXME, use a real flag for deciding about the key type */ | 5722 | /* FIXME, use a real flag for deciding about the key type */ |
| 5722 | if (root->fs_info->tree_root == root) | 5723 | if (root->fs_info->tree_root == root) |
| @@ -5745,6 +5746,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx) | |||
| 5745 | if (ret < 0) | 5746 | if (ret < 0) |
| 5746 | goto err; | 5747 | goto err; |
| 5747 | 5748 | ||
| 5749 | emitted = false; | ||
| 5748 | while (1) { | 5750 | while (1) { |
| 5749 | leaf = path->nodes[0]; | 5751 | leaf = path->nodes[0]; |
| 5750 | slot = path->slots[0]; | 5752 | slot = path->slots[0]; |
| @@ -5824,6 +5826,7 @@ skip: | |||
| 5824 | 5826 | ||
| 5825 | if (over) | 5827 | if (over) |
| 5826 | goto nopos; | 5828 | goto nopos; |
| 5829 | emitted = true; | ||
| 5827 | di_len = btrfs_dir_name_len(leaf, di) + | 5830 | di_len = btrfs_dir_name_len(leaf, di) + |
| 5828 | btrfs_dir_data_len(leaf, di) + sizeof(*di); | 5831 | btrfs_dir_data_len(leaf, di) + sizeof(*di); |
| 5829 | di_cur += di_len; | 5832 | di_cur += di_len; |
| @@ -5836,11 +5839,20 @@ next: | |||
| 5836 | if (key_type == BTRFS_DIR_INDEX_KEY) { | 5839 | if (key_type == BTRFS_DIR_INDEX_KEY) { |
| 5837 | if (is_curr) | 5840 | if (is_curr) |
| 5838 | ctx->pos++; | 5841 | ctx->pos++; |
| 5839 | ret = btrfs_readdir_delayed_dir_index(ctx, &ins_list); | 5842 | ret = btrfs_readdir_delayed_dir_index(ctx, &ins_list, &emitted); |
| 5840 | if (ret) | 5843 | if (ret) |
| 5841 | goto nopos; | 5844 | goto nopos; |
| 5842 | } | 5845 | } |
| 5843 | 5846 | ||
| 5847 | /* | ||
| 5848 | * If we haven't emitted any dir entry, we must not touch ctx->pos as | ||
| 5849 | * it was was set to the termination value in previous call. We assume | ||
| 5850 | * that "." and ".." were emitted if we reach this point and set the | ||
| 5851 | * termination value as well for an empty directory. | ||
| 5852 | */ | ||
| 5853 | if (ctx->pos > 2 && !emitted) | ||
| 5854 | goto nopos; | ||
| 5855 | |||
| 5844 | /* Reached end of directory/root. Bump pos past the last item. */ | 5856 | /* Reached end of directory/root. Bump pos past the last item. */ |
| 5845 | ctx->pos++; | 5857 | ctx->pos++; |
| 5846 | 5858 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 952172ca7e45..48aee9846329 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -2794,24 +2794,29 @@ out: | |||
| 2794 | static struct page *extent_same_get_page(struct inode *inode, pgoff_t index) | 2794 | static struct page *extent_same_get_page(struct inode *inode, pgoff_t index) |
| 2795 | { | 2795 | { |
| 2796 | struct page *page; | 2796 | struct page *page; |
| 2797 | struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree; | ||
| 2798 | 2797 | ||
| 2799 | page = grab_cache_page(inode->i_mapping, index); | 2798 | page = grab_cache_page(inode->i_mapping, index); |
| 2800 | if (!page) | 2799 | if (!page) |
| 2801 | return NULL; | 2800 | return ERR_PTR(-ENOMEM); |
| 2802 | 2801 | ||
| 2803 | if (!PageUptodate(page)) { | 2802 | if (!PageUptodate(page)) { |
| 2804 | if (extent_read_full_page_nolock(tree, page, btrfs_get_extent, | 2803 | int ret; |
| 2805 | 0)) | 2804 | |
| 2806 | return NULL; | 2805 | ret = btrfs_readpage(NULL, page); |
| 2806 | if (ret) | ||
| 2807 | return ERR_PTR(ret); | ||
| 2807 | lock_page(page); | 2808 | lock_page(page); |
| 2808 | if (!PageUptodate(page)) { | 2809 | if (!PageUptodate(page)) { |
| 2809 | unlock_page(page); | 2810 | unlock_page(page); |
| 2810 | page_cache_release(page); | 2811 | page_cache_release(page); |
| 2811 | return NULL; | 2812 | return ERR_PTR(-EIO); |
| 2813 | } | ||
| 2814 | if (page->mapping != inode->i_mapping) { | ||
| 2815 | unlock_page(page); | ||
| 2816 | page_cache_release(page); | ||
| 2817 | return ERR_PTR(-EAGAIN); | ||
| 2812 | } | 2818 | } |
| 2813 | } | 2819 | } |
| 2814 | unlock_page(page); | ||
| 2815 | 2820 | ||
| 2816 | return page; | 2821 | return page; |
| 2817 | } | 2822 | } |
| @@ -2823,17 +2828,31 @@ static int gather_extent_pages(struct inode *inode, struct page **pages, | |||
| 2823 | pgoff_t index = off >> PAGE_CACHE_SHIFT; | 2828 | pgoff_t index = off >> PAGE_CACHE_SHIFT; |
| 2824 | 2829 | ||
| 2825 | for (i = 0; i < num_pages; i++) { | 2830 | for (i = 0; i < num_pages; i++) { |
| 2831 | again: | ||
| 2826 | pages[i] = extent_same_get_page(inode, index + i); | 2832 | pages[i] = extent_same_get_page(inode, index + i); |
| 2827 | if (!pages[i]) | 2833 | if (IS_ERR(pages[i])) { |
| 2828 | return -ENOMEM; | 2834 | int err = PTR_ERR(pages[i]); |
| 2835 | |||
| 2836 | if (err == -EAGAIN) | ||
| 2837 | goto again; | ||
| 2838 | pages[i] = NULL; | ||
| 2839 | return err; | ||
| 2840 | } | ||
| 2829 | } | 2841 | } |
| 2830 | return 0; | 2842 | return 0; |
| 2831 | } | 2843 | } |
| 2832 | 2844 | ||
| 2833 | static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) | 2845 | static int lock_extent_range(struct inode *inode, u64 off, u64 len, |
| 2846 | bool retry_range_locking) | ||
| 2834 | { | 2847 | { |
| 2835 | /* do any pending delalloc/csum calc on src, one way or | 2848 | /* |
| 2836 | another, and lock file content */ | 2849 | * Do any pending delalloc/csum calculations on inode, one way or |
| 2850 | * another, and lock file content. | ||
| 2851 | * The locking order is: | ||
| 2852 | * | ||
| 2853 | * 1) pages | ||
| 2854 | * 2) range in the inode's io tree | ||
| 2855 | */ | ||
| 2837 | while (1) { | 2856 | while (1) { |
| 2838 | struct btrfs_ordered_extent *ordered; | 2857 | struct btrfs_ordered_extent *ordered; |
| 2839 | lock_extent(&BTRFS_I(inode)->io_tree, off, off + len - 1); | 2858 | lock_extent(&BTRFS_I(inode)->io_tree, off, off + len - 1); |
| @@ -2851,8 +2870,11 @@ static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) | |||
| 2851 | unlock_extent(&BTRFS_I(inode)->io_tree, off, off + len - 1); | 2870 | unlock_extent(&BTRFS_I(inode)->io_tree, off, off + len - 1); |
| 2852 | if (ordered) | 2871 | if (ordered) |
| 2853 | btrfs_put_ordered_extent(ordered); | 2872 | btrfs_put_ordered_extent(ordered); |
| 2873 | if (!retry_range_locking) | ||
| 2874 | return -EAGAIN; | ||
| 2854 | btrfs_wait_ordered_range(inode, off, len); | 2875 | btrfs_wait_ordered_range(inode, off, len); |
| 2855 | } | 2876 | } |
| 2877 | return 0; | ||
| 2856 | } | 2878 | } |
| 2857 | 2879 | ||
| 2858 | static void btrfs_double_inode_unlock(struct inode *inode1, struct inode *inode2) | 2880 | static void btrfs_double_inode_unlock(struct inode *inode1, struct inode *inode2) |
| @@ -2877,15 +2899,24 @@ static void btrfs_double_extent_unlock(struct inode *inode1, u64 loff1, | |||
| 2877 | unlock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1); | 2899 | unlock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1); |
| 2878 | } | 2900 | } |
| 2879 | 2901 | ||
| 2880 | static void btrfs_double_extent_lock(struct inode *inode1, u64 loff1, | 2902 | static int btrfs_double_extent_lock(struct inode *inode1, u64 loff1, |
| 2881 | struct inode *inode2, u64 loff2, u64 len) | 2903 | struct inode *inode2, u64 loff2, u64 len, |
| 2904 | bool retry_range_locking) | ||
| 2882 | { | 2905 | { |
| 2906 | int ret; | ||
| 2907 | |||
| 2883 | if (inode1 < inode2) { | 2908 | if (inode1 < inode2) { |
| 2884 | swap(inode1, inode2); | 2909 | swap(inode1, inode2); |
| 2885 | swap(loff1, loff2); | 2910 | swap(loff1, loff2); |
| 2886 | } | 2911 | } |
| 2887 | lock_extent_range(inode1, loff1, len); | 2912 | ret = lock_extent_range(inode1, loff1, len, retry_range_locking); |
| 2888 | lock_extent_range(inode2, loff2, len); | 2913 | if (ret) |
| 2914 | return ret; | ||
| 2915 | ret = lock_extent_range(inode2, loff2, len, retry_range_locking); | ||
| 2916 | if (ret) | ||
| 2917 | unlock_extent(&BTRFS_I(inode1)->io_tree, loff1, | ||
| 2918 | loff1 + len - 1); | ||
| 2919 | return ret; | ||
| 2889 | } | 2920 | } |
| 2890 | 2921 | ||
| 2891 | struct cmp_pages { | 2922 | struct cmp_pages { |
| @@ -2901,11 +2932,15 @@ static void btrfs_cmp_data_free(struct cmp_pages *cmp) | |||
| 2901 | 2932 | ||
| 2902 | for (i = 0; i < cmp->num_pages; i++) { | 2933 | for (i = 0; i < cmp->num_pages; i++) { |
| 2903 | pg = cmp->src_pages[i]; | 2934 | pg = cmp->src_pages[i]; |
| 2904 | if (pg) | 2935 | if (pg) { |
| 2936 | unlock_page(pg); | ||
| 2905 | page_cache_release(pg); | 2937 | page_cache_release(pg); |
| 2938 | } | ||
| 2906 | pg = cmp->dst_pages[i]; | 2939 | pg = cmp->dst_pages[i]; |
| 2907 | if (pg) | 2940 | if (pg) { |
| 2941 | unlock_page(pg); | ||
| 2908 | page_cache_release(pg); | 2942 | page_cache_release(pg); |
| 2943 | } | ||
| 2909 | } | 2944 | } |
| 2910 | kfree(cmp->src_pages); | 2945 | kfree(cmp->src_pages); |
| 2911 | kfree(cmp->dst_pages); | 2946 | kfree(cmp->dst_pages); |
| @@ -2966,6 +3001,8 @@ static int btrfs_cmp_data(struct inode *src, u64 loff, struct inode *dst, | |||
| 2966 | 3001 | ||
| 2967 | src_page = cmp->src_pages[i]; | 3002 | src_page = cmp->src_pages[i]; |
| 2968 | dst_page = cmp->dst_pages[i]; | 3003 | dst_page = cmp->dst_pages[i]; |
| 3004 | ASSERT(PageLocked(src_page)); | ||
| 3005 | ASSERT(PageLocked(dst_page)); | ||
| 2969 | 3006 | ||
| 2970 | addr = kmap_atomic(src_page); | 3007 | addr = kmap_atomic(src_page); |
| 2971 | dst_addr = kmap_atomic(dst_page); | 3008 | dst_addr = kmap_atomic(dst_page); |
| @@ -3078,14 +3115,46 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
| 3078 | goto out_unlock; | 3115 | goto out_unlock; |
| 3079 | } | 3116 | } |
| 3080 | 3117 | ||
| 3118 | again: | ||
| 3081 | ret = btrfs_cmp_data_prepare(src, loff, dst, dst_loff, olen, &cmp); | 3119 | ret = btrfs_cmp_data_prepare(src, loff, dst, dst_loff, olen, &cmp); |
| 3082 | if (ret) | 3120 | if (ret) |
| 3083 | goto out_unlock; | 3121 | goto out_unlock; |
| 3084 | 3122 | ||
| 3085 | if (same_inode) | 3123 | if (same_inode) |
| 3086 | lock_extent_range(src, same_lock_start, same_lock_len); | 3124 | ret = lock_extent_range(src, same_lock_start, same_lock_len, |
| 3125 | false); | ||
| 3087 | else | 3126 | else |
| 3088 | btrfs_double_extent_lock(src, loff, dst, dst_loff, len); | 3127 | ret = btrfs_double_extent_lock(src, loff, dst, dst_loff, len, |
| 3128 | false); | ||
| 3129 | /* | ||
| 3130 | * If one of the inodes has dirty pages in the respective range or | ||
| 3131 | * ordered extents, we need to flush dellaloc and wait for all ordered | ||
| 3132 | * extents in the range. We must unlock the pages and the ranges in the | ||
| 3133 | * io trees to avoid deadlocks when flushing delalloc (requires locking | ||
| 3134 | * pages) and when waiting for ordered extents to complete (they require | ||
| 3135 | * range locking). | ||
| 3136 | */ | ||
| 3137 | if (ret == -EAGAIN) { | ||
| 3138 | /* | ||
| 3139 | * Ranges in the io trees already unlocked. Now unlock all | ||
| 3140 | * pages before waiting for all IO to complete. | ||
| 3141 | */ | ||
| 3142 | btrfs_cmp_data_free(&cmp); | ||
| 3143 | if (same_inode) { | ||
| 3144 | btrfs_wait_ordered_range(src, same_lock_start, | ||
| 3145 | same_lock_len); | ||
| 3146 | } else { | ||
| 3147 | btrfs_wait_ordered_range(src, loff, len); | ||
| 3148 | btrfs_wait_ordered_range(dst, dst_loff, len); | ||
| 3149 | } | ||
| 3150 | goto again; | ||
| 3151 | } | ||
| 3152 | ASSERT(ret == 0); | ||
| 3153 | if (WARN_ON(ret)) { | ||
| 3154 | /* ranges in the io trees already unlocked */ | ||
| 3155 | btrfs_cmp_data_free(&cmp); | ||
| 3156 | return ret; | ||
| 3157 | } | ||
| 3089 | 3158 | ||
| 3090 | /* pass original length for comparison so we stay within i_size */ | 3159 | /* pass original length for comparison so we stay within i_size */ |
| 3091 | ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen, &cmp); | 3160 | ret = btrfs_cmp_data(src, loff, dst, dst_loff, olen, &cmp); |
| @@ -3795,9 +3864,15 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, | |||
| 3795 | u64 lock_start = min_t(u64, off, destoff); | 3864 | u64 lock_start = min_t(u64, off, destoff); |
| 3796 | u64 lock_len = max_t(u64, off, destoff) + len - lock_start; | 3865 | u64 lock_len = max_t(u64, off, destoff) + len - lock_start; |
| 3797 | 3866 | ||
| 3798 | lock_extent_range(src, lock_start, lock_len); | 3867 | ret = lock_extent_range(src, lock_start, lock_len, true); |
| 3799 | } else { | 3868 | } else { |
| 3800 | btrfs_double_extent_lock(src, off, inode, destoff, len); | 3869 | ret = btrfs_double_extent_lock(src, off, inode, destoff, len, |
| 3870 | true); | ||
| 3871 | } | ||
| 3872 | ASSERT(ret == 0); | ||
| 3873 | if (WARN_ON(ret)) { | ||
| 3874 | /* ranges in the io trees already unlocked */ | ||
| 3875 | goto out_unlock; | ||
| 3801 | } | 3876 | } |
| 3802 | 3877 | ||
| 3803 | ret = btrfs_clone(src, inode, off, olen, len, destoff, 0); | 3878 | ret = btrfs_clone(src, inode, off, olen, len, destoff, 0); |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 7dc886c9a78f..e956cba94338 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
| @@ -175,7 +175,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata, | |||
| 175 | * string to the length of the original string to allow for worst case. | 175 | * string to the length of the original string to allow for worst case. |
| 176 | */ | 176 | */ |
| 177 | md_len = strlen(sb_mountdata) + INET6_ADDRSTRLEN; | 177 | md_len = strlen(sb_mountdata) + INET6_ADDRSTRLEN; |
| 178 | mountdata = kzalloc(md_len + 1, GFP_KERNEL); | 178 | mountdata = kzalloc(md_len + sizeof("ip=") + 1, GFP_KERNEL); |
| 179 | if (mountdata == NULL) { | 179 | if (mountdata == NULL) { |
| 180 | rc = -ENOMEM; | 180 | rc = -ENOMEM; |
| 181 | goto compose_mount_options_err; | 181 | goto compose_mount_options_err; |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index afa09fce8151..e682b36a210f 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
| @@ -714,7 +714,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) | |||
| 714 | 714 | ||
| 715 | ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); | 715 | ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); |
| 716 | if (!ses->auth_key.response) { | 716 | if (!ses->auth_key.response) { |
| 717 | rc = ENOMEM; | 717 | rc = -ENOMEM; |
| 718 | ses->auth_key.len = 0; | 718 | ses->auth_key.len = 0; |
| 719 | goto setup_ntlmv2_rsp_ret; | 719 | goto setup_ntlmv2_rsp_ret; |
| 720 | } | 720 | } |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 4fbd92d2e113..a763cd3d9e7c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -2999,8 +2999,7 @@ ip_rfc1001_connect(struct TCP_Server_Info *server) | |||
| 2999 | if (ses_init_buf) { | 2999 | if (ses_init_buf) { |
| 3000 | ses_init_buf->trailer.session_req.called_len = 32; | 3000 | ses_init_buf->trailer.session_req.called_len = 32; |
| 3001 | 3001 | ||
| 3002 | if (server->server_RFC1001_name && | 3002 | if (server->server_RFC1001_name[0] != 0) |
| 3003 | server->server_RFC1001_name[0] != 0) | ||
| 3004 | rfc1002mangle(ses_init_buf->trailer. | 3003 | rfc1002mangle(ses_init_buf->trailer. |
| 3005 | session_req.called_name, | 3004 | session_req.called_name, |
| 3006 | server->server_RFC1001_name, | 3005 | server->server_RFC1001_name, |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 1f107fd51328..655f21f99160 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
| @@ -575,6 +575,26 @@ void devpts_kill_index(struct inode *ptmx_inode, int idx) | |||
| 575 | mutex_unlock(&allocated_ptys_lock); | 575 | mutex_unlock(&allocated_ptys_lock); |
| 576 | } | 576 | } |
| 577 | 577 | ||
| 578 | /* | ||
| 579 | * pty code needs to hold extra references in case of last /dev/tty close | ||
| 580 | */ | ||
| 581 | |||
| 582 | void devpts_add_ref(struct inode *ptmx_inode) | ||
| 583 | { | ||
| 584 | struct super_block *sb = pts_sb_from_inode(ptmx_inode); | ||
| 585 | |||
| 586 | atomic_inc(&sb->s_active); | ||
| 587 | ihold(ptmx_inode); | ||
| 588 | } | ||
| 589 | |||
| 590 | void devpts_del_ref(struct inode *ptmx_inode) | ||
| 591 | { | ||
| 592 | struct super_block *sb = pts_sb_from_inode(ptmx_inode); | ||
| 593 | |||
| 594 | iput(ptmx_inode); | ||
| 595 | deactivate_super(sb); | ||
| 596 | } | ||
| 597 | |||
| 578 | /** | 598 | /** |
| 579 | * devpts_pty_new -- create a new inode in /dev/pts/ | 599 | * devpts_pty_new -- create a new inode in /dev/pts/ |
| 580 | * @ptmx_inode: inode of the master | 600 | * @ptmx_inode: inode of the master |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index da37beb76f6e..594f7e63b432 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
| @@ -4491,7 +4491,7 @@ xlog_recover_process( | |||
| 4491 | * know precisely what failed. | 4491 | * know precisely what failed. |
| 4492 | */ | 4492 | */ |
| 4493 | if (pass == XLOG_RECOVER_CRCPASS) { | 4493 | if (pass == XLOG_RECOVER_CRCPASS) { |
| 4494 | if (rhead->h_crc && crc != le32_to_cpu(rhead->h_crc)) | 4494 | if (rhead->h_crc && crc != rhead->h_crc) |
| 4495 | return -EFSBADCRC; | 4495 | return -EFSBADCRC; |
| 4496 | return 0; | 4496 | return 0; |
| 4497 | } | 4497 | } |
| @@ -4502,7 +4502,7 @@ xlog_recover_process( | |||
| 4502 | * zero CRC check prevents warnings from being emitted when upgrading | 4502 | * zero CRC check prevents warnings from being emitted when upgrading |
| 4503 | * the kernel from one that does not add CRCs by default. | 4503 | * the kernel from one that does not add CRCs by default. |
| 4504 | */ | 4504 | */ |
| 4505 | if (crc != le32_to_cpu(rhead->h_crc)) { | 4505 | if (crc != rhead->h_crc) { |
| 4506 | if (rhead->h_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) { | 4506 | if (rhead->h_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) { |
| 4507 | xfs_alert(log->l_mp, | 4507 | xfs_alert(log->l_mp, |
| 4508 | "log record CRC mismatch: found 0x%x, expected 0x%x.", | 4508 | "log record CRC mismatch: found 0x%x, expected 0x%x.", |
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index 0419485891f2..0f1c6f315cdc 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h | |||
| @@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t; | |||
| 75 | */ | 75 | */ |
| 76 | static inline cputime_t timespec_to_cputime(const struct timespec *val) | 76 | static inline cputime_t timespec_to_cputime(const struct timespec *val) |
| 77 | { | 77 | { |
| 78 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec; | 78 | u64 ret = (u64)val->tv_sec * NSEC_PER_SEC + val->tv_nsec; |
| 79 | return (__force cputime_t) ret; | 79 | return (__force cputime_t) ret; |
| 80 | } | 80 | } |
| 81 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | 81 | static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) |
| @@ -91,7 +91,8 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) | |||
| 91 | */ | 91 | */ |
| 92 | static inline cputime_t timeval_to_cputime(const struct timeval *val) | 92 | static inline cputime_t timeval_to_cputime(const struct timeval *val) |
| 93 | { | 93 | { |
| 94 | u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC; | 94 | u64 ret = (u64)val->tv_sec * NSEC_PER_SEC + |
| 95 | val->tv_usec * NSEC_PER_USEC; | ||
| 95 | return (__force cputime_t) ret; | 96 | return (__force cputime_t) ret; |
| 96 | } | 97 | } |
| 97 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) | 98 | static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 29189aeace19..4571ef1a12a9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -682,9 +682,12 @@ static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b) | |||
| 682 | /* | 682 | /* |
| 683 | * q->prep_rq_fn return values | 683 | * q->prep_rq_fn return values |
| 684 | */ | 684 | */ |
| 685 | #define BLKPREP_OK 0 /* serve it */ | 685 | enum { |
| 686 | #define BLKPREP_KILL 1 /* fatal error, kill */ | 686 | BLKPREP_OK, /* serve it */ |
| 687 | #define BLKPREP_DEFER 2 /* leave on queue */ | 687 | BLKPREP_KILL, /* fatal error, kill, return -EIO */ |
| 688 | BLKPREP_DEFER, /* leave on queue */ | ||
| 689 | BLKPREP_INVALID, /* invalid command, kill, return -EREMOTEIO */ | ||
| 690 | }; | ||
| 688 | 691 | ||
| 689 | extern unsigned long blk_max_low_pfn, blk_max_pfn; | 692 | extern unsigned long blk_max_low_pfn, blk_max_pfn; |
| 690 | 693 | ||
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 7f540f7f588d..789471dba6fb 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h | |||
| @@ -127,6 +127,12 @@ struct cgroup_subsys_state { | |||
| 127 | */ | 127 | */ |
| 128 | u64 serial_nr; | 128 | u64 serial_nr; |
| 129 | 129 | ||
| 130 | /* | ||
| 131 | * Incremented by online self and children. Used to guarantee that | ||
| 132 | * parents are not offlined before their children. | ||
| 133 | */ | ||
| 134 | atomic_t online_cnt; | ||
| 135 | |||
| 130 | /* percpu_ref killing and RCU release */ | 136 | /* percpu_ref killing and RCU release */ |
| 131 | struct rcu_head rcu_head; | 137 | struct rcu_head rcu_head; |
| 132 | struct work_struct destroy_work; | 138 | struct work_struct destroy_work; |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 00b042c49ccd..48f5aab117ae 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -144,7 +144,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 144 | */ | 144 | */ |
| 145 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) | 145 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) |
| 146 | #define __trace_if(cond) \ | 146 | #define __trace_if(cond) \ |
| 147 | if (__builtin_constant_p((cond)) ? !!(cond) : \ | 147 | if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ |
| 148 | ({ \ | 148 | ({ \ |
| 149 | int ______r; \ | 149 | int ______r; \ |
| 150 | static struct ftrace_branch_data \ | 150 | static struct ftrace_branch_data \ |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 85a868ccb493..fea160ee5803 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
| @@ -137,6 +137,8 @@ static inline void set_mems_allowed(nodemask_t nodemask) | |||
| 137 | task_unlock(current); | 137 | task_unlock(current); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | extern void cpuset_post_attach_flush(void); | ||
| 141 | |||
| 140 | #else /* !CONFIG_CPUSETS */ | 142 | #else /* !CONFIG_CPUSETS */ |
| 141 | 143 | ||
| 142 | static inline bool cpusets_enabled(void) { return false; } | 144 | static inline bool cpusets_enabled(void) { return false; } |
| @@ -243,6 +245,10 @@ static inline bool read_mems_allowed_retry(unsigned int seq) | |||
| 243 | return false; | 245 | return false; |
| 244 | } | 246 | } |
| 245 | 247 | ||
| 248 | static inline void cpuset_post_attach_flush(void) | ||
| 249 | { | ||
| 250 | } | ||
| 251 | |||
| 246 | #endif /* !CONFIG_CPUSETS */ | 252 | #endif /* !CONFIG_CPUSETS */ |
| 247 | 253 | ||
| 248 | #endif /* _LINUX_CPUSET_H */ | 254 | #endif /* _LINUX_CPUSET_H */ |
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index 251a2090a554..e0ee0b3000b2 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | 19 | ||
| 20 | int devpts_new_index(struct inode *ptmx_inode); | 20 | int devpts_new_index(struct inode *ptmx_inode); |
| 21 | void devpts_kill_index(struct inode *ptmx_inode, int idx); | 21 | void devpts_kill_index(struct inode *ptmx_inode, int idx); |
| 22 | void devpts_add_ref(struct inode *ptmx_inode); | ||
| 23 | void devpts_del_ref(struct inode *ptmx_inode); | ||
| 22 | /* mknod in devpts */ | 24 | /* mknod in devpts */ |
| 23 | struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, | 25 | struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, |
| 24 | void *priv); | 26 | void *priv); |
| @@ -32,6 +34,8 @@ void devpts_pty_kill(struct inode *inode); | |||
| 32 | /* Dummy stubs in the no-pty case */ | 34 | /* Dummy stubs in the no-pty case */ |
| 33 | static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } | 35 | static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } |
| 34 | static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } | 36 | static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } |
| 37 | static inline void devpts_add_ref(struct inode *ptmx_inode) { } | ||
| 38 | static inline void devpts_del_ref(struct inode *ptmx_inode) { } | ||
| 35 | static inline struct inode *devpts_pty_new(struct inode *ptmx_inode, | 39 | static inline struct inode *devpts_pty_new(struct inode *ptmx_inode, |
| 36 | dev_t device, int index, void *priv) | 40 | dev_t device, int index, void *priv) |
| 37 | { | 41 | { |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 821273ca4873..2d9b650047a5 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -235,6 +235,9 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 235 | /* low 64 bit */ | 235 | /* low 64 bit */ |
| 236 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT)) | 236 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT)) |
| 237 | 237 | ||
| 238 | /* PRS_REG */ | ||
| 239 | #define DMA_PRS_PPR ((u32)1) | ||
| 240 | |||
| 238 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | 241 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ |
| 239 | do { \ | 242 | do { \ |
| 240 | cycles_t start_time = get_cycles(); \ | 243 | cycles_t start_time = get_cycles(); \ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 851821bfd553..bec2abbd7ab2 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -526,6 +526,7 @@ enum ata_lpm_policy { | |||
| 526 | enum ata_lpm_hints { | 526 | enum ata_lpm_hints { |
| 527 | ATA_LPM_EMPTY = (1 << 0), /* port empty/probing */ | 527 | ATA_LPM_EMPTY = (1 << 0), /* port empty/probing */ |
| 528 | ATA_LPM_HIPM = (1 << 1), /* may use HIPM */ | 528 | ATA_LPM_HIPM = (1 << 1), /* may use HIPM */ |
| 529 | ATA_LPM_WAKE_ONLY = (1 << 2), /* only wake up link */ | ||
| 529 | }; | 530 | }; |
| 530 | 531 | ||
| 531 | /* forward declarations */ | 532 | /* forward declarations */ |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index c57e424d914b..4dca42fd32f5 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
| @@ -66,7 +66,7 @@ struct lock_class { | |||
| 66 | /* | 66 | /* |
| 67 | * class-hash: | 67 | * class-hash: |
| 68 | */ | 68 | */ |
| 69 | struct list_head hash_entry; | 69 | struct hlist_node hash_entry; |
| 70 | 70 | ||
| 71 | /* | 71 | /* |
| 72 | * global list of all lock-classes: | 72 | * global list of all lock-classes: |
| @@ -199,7 +199,7 @@ struct lock_chain { | |||
| 199 | u8 irq_context; | 199 | u8 irq_context; |
| 200 | u8 depth; | 200 | u8 depth; |
| 201 | u16 base; | 201 | u16 base; |
| 202 | struct list_head entry; | 202 | struct hlist_node entry; |
| 203 | u64 chain_key; | 203 | u64 chain_key; |
| 204 | }; | 204 | }; |
| 205 | 205 | ||
diff --git a/include/linux/module.h b/include/linux/module.h index 4560d8f1545d..2bb0c3085706 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -324,6 +324,12 @@ struct module_layout { | |||
| 324 | #define __module_layout_align | 324 | #define __module_layout_align |
| 325 | #endif | 325 | #endif |
| 326 | 326 | ||
| 327 | struct mod_kallsyms { | ||
| 328 | Elf_Sym *symtab; | ||
| 329 | unsigned int num_symtab; | ||
| 330 | char *strtab; | ||
| 331 | }; | ||
| 332 | |||
| 327 | struct module { | 333 | struct module { |
| 328 | enum module_state state; | 334 | enum module_state state; |
| 329 | 335 | ||
| @@ -405,15 +411,10 @@ struct module { | |||
| 405 | #endif | 411 | #endif |
| 406 | 412 | ||
| 407 | #ifdef CONFIG_KALLSYMS | 413 | #ifdef CONFIG_KALLSYMS |
| 408 | /* | 414 | /* Protected by RCU and/or module_mutex: use rcu_dereference() */ |
| 409 | * We keep the symbol and string tables for kallsyms. | 415 | struct mod_kallsyms *kallsyms; |
| 410 | * The core_* fields below are temporary, loader-only (they | 416 | struct mod_kallsyms core_kallsyms; |
| 411 | * could really be discarded after module init). | 417 | |
| 412 | */ | ||
| 413 | Elf_Sym *symtab, *core_symtab; | ||
| 414 | unsigned int num_symtab, core_num_syms; | ||
| 415 | char *strtab, *core_strtab; | ||
| 416 | |||
| 417 | /* Section attributes */ | 418 | /* Section attributes */ |
| 418 | struct module_sect_attrs *sect_attrs; | 419 | struct module_sect_attrs *sect_attrs; |
| 419 | 420 | ||
diff --git a/include/linux/pfn.h b/include/linux/pfn.h index 2d8e49711b63..1132953235c0 100644 --- a/include/linux/pfn.h +++ b/include/linux/pfn.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * backing is indicated by flags in the high bits of the value. | 10 | * backing is indicated by flags in the high bits of the value. |
| 11 | */ | 11 | */ |
| 12 | typedef struct { | 12 | typedef struct { |
| 13 | unsigned long val; | 13 | u64 val; |
| 14 | } pfn_t; | 14 | } pfn_t; |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h index 37448ab5fb5c..94994810c7c0 100644 --- a/include/linux/pfn_t.h +++ b/include/linux/pfn_t.h | |||
| @@ -9,14 +9,13 @@ | |||
| 9 | * PFN_DEV - pfn is not covered by system memmap by default | 9 | * PFN_DEV - pfn is not covered by system memmap by default |
| 10 | * PFN_MAP - pfn has a dynamic page mapping established by a device driver | 10 | * PFN_MAP - pfn has a dynamic page mapping established by a device driver |
| 11 | */ | 11 | */ |
| 12 | #define PFN_FLAGS_MASK (((unsigned long) ~PAGE_MASK) \ | 12 | #define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) |
| 13 | << (BITS_PER_LONG - PAGE_SHIFT)) | 13 | #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) |
| 14 | #define PFN_SG_CHAIN (1UL << (BITS_PER_LONG - 1)) | 14 | #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2)) |
| 15 | #define PFN_SG_LAST (1UL << (BITS_PER_LONG - 2)) | 15 | #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3)) |
| 16 | #define PFN_DEV (1UL << (BITS_PER_LONG - 3)) | 16 | #define PFN_MAP (1ULL << (BITS_PER_LONG_LONG - 4)) |
| 17 | #define PFN_MAP (1UL << (BITS_PER_LONG - 4)) | 17 | |
| 18 | 18 | static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, u64 flags) | |
| 19 | static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, unsigned long flags) | ||
| 20 | { | 19 | { |
| 21 | pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), }; | 20 | pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), }; |
| 22 | 21 | ||
| @@ -29,7 +28,7 @@ static inline pfn_t pfn_to_pfn_t(unsigned long pfn) | |||
| 29 | return __pfn_to_pfn_t(pfn, 0); | 28 | return __pfn_to_pfn_t(pfn, 0); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags); | 31 | extern pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags); |
| 33 | 32 | ||
| 34 | static inline bool pfn_t_has_page(pfn_t pfn) | 33 | static inline bool pfn_t_has_page(pfn_t pfn) |
| 35 | { | 34 | { |
| @@ -87,7 +86,7 @@ static inline pmd_t pfn_t_pmd(pfn_t pfn, pgprot_t pgprot) | |||
| 87 | #ifdef __HAVE_ARCH_PTE_DEVMAP | 86 | #ifdef __HAVE_ARCH_PTE_DEVMAP |
| 88 | static inline bool pfn_t_devmap(pfn_t pfn) | 87 | static inline bool pfn_t_devmap(pfn_t pfn) |
| 89 | { | 88 | { |
| 90 | const unsigned long flags = PFN_DEV|PFN_MAP; | 89 | const u64 flags = PFN_DEV|PFN_MAP; |
| 91 | 90 | ||
| 92 | return (pfn.val & flags) == flags; | 91 | return (pfn.val & flags) == flags; |
| 93 | } | 92 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 11f935c1a090..4ce9ff7086f4 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -299,6 +299,7 @@ struct sk_buff; | |||
| 299 | #else | 299 | #else |
| 300 | #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1) | 300 | #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1) |
| 301 | #endif | 301 | #endif |
| 302 | extern int sysctl_max_skb_frags; | ||
| 302 | 303 | ||
| 303 | typedef struct skb_frag_struct skb_frag_t; | 304 | typedef struct skb_frag_struct skb_frag_t; |
| 304 | 305 | ||
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index acd522a91539..acfdbf353a0b 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -14,8 +14,10 @@ | |||
| 14 | * See the file COPYING for more details. | 14 | * See the file COPYING for more details. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/smp.h> | ||
| 17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
| 18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/cpumask.h> | ||
| 19 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
| 20 | #include <linux/tracepoint-defs.h> | 22 | #include <linux/tracepoint-defs.h> |
| 21 | 23 | ||
| @@ -132,6 +134,9 @@ extern void syscall_unregfunc(void); | |||
| 132 | void *it_func; \ | 134 | void *it_func; \ |
| 133 | void *__data; \ | 135 | void *__data; \ |
| 134 | \ | 136 | \ |
| 137 | if (!cpu_online(raw_smp_processor_id())) \ | ||
| 138 | return; \ | ||
| 139 | \ | ||
| 135 | if (!(cond)) \ | 140 | if (!(cond)) \ |
| 136 | return; \ | 141 | return; \ |
| 137 | prercu; \ | 142 | prercu; \ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 0e32bc71245e..ca73c503b92a 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -311,6 +311,7 @@ enum { | |||
| 311 | 311 | ||
| 312 | __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ | 312 | __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ |
| 313 | __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ | 313 | __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ |
| 314 | __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */ | ||
| 314 | 315 | ||
| 315 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ | 316 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ |
| 316 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ | 317 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ |
| @@ -411,12 +412,12 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | |||
| 411 | alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) | 412 | alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) |
| 412 | 413 | ||
| 413 | #define create_workqueue(name) \ | 414 | #define create_workqueue(name) \ |
| 414 | alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name)) | 415 | alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name)) |
| 415 | #define create_freezable_workqueue(name) \ | 416 | #define create_freezable_workqueue(name) \ |
| 416 | alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ | 417 | alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | \ |
| 417 | 1, (name)) | 418 | WQ_MEM_RECLAIM, 1, (name)) |
| 418 | #define create_singlethread_workqueue(name) \ | 419 | #define create_singlethread_workqueue(name) \ |
| 419 | alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) | 420 | alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name) |
| 420 | 421 | ||
| 421 | extern void destroy_workqueue(struct workqueue_struct *wq); | 422 | extern void destroy_workqueue(struct workqueue_struct *wq); |
| 422 | 423 | ||
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 2a91a0561a47..9b4c418bebd8 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
| 7 | #include <net/sock.h> | 7 | #include <net/sock.h> |
| 8 | 8 | ||
| 9 | void unix_inflight(struct file *fp); | 9 | void unix_inflight(struct user_struct *user, struct file *fp); |
| 10 | void unix_notinflight(struct file *fp); | 10 | void unix_notinflight(struct user_struct *user, struct file *fp); |
| 11 | void unix_gc(void); | 11 | void unix_gc(void); |
| 12 | void wait_for_unix_gc(void); | 12 | void wait_for_unix_gc(void); |
| 13 | struct sock *unix_get_socket(struct file *filp); | 13 | struct sock *unix_get_socket(struct file *filp); |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 6db96ea0144f..dda9abf6b89c 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
| @@ -230,6 +230,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |||
| 230 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); | 230 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); |
| 231 | int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, | 231 | int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, |
| 232 | u8 *protocol, struct flowi4 *fl4); | 232 | u8 *protocol, struct flowi4 *fl4); |
| 233 | int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict); | ||
| 233 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); | 234 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); |
| 234 | 235 | ||
| 235 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | 236 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, |
diff --git a/include/net/scm.h b/include/net/scm.h index 262532d111f5..59fa93c01d2a 100644 --- a/include/net/scm.h +++ b/include/net/scm.h | |||
| @@ -21,6 +21,7 @@ struct scm_creds { | |||
| 21 | struct scm_fp_list { | 21 | struct scm_fp_list { |
| 22 | short count; | 22 | short count; |
| 23 | short max; | 23 | short max; |
| 24 | struct user_struct *user; | ||
| 24 | struct file *fp[SCM_MAX_FD]; | 25 | struct file *fp[SCM_MAX_FD]; |
| 25 | }; | 26 | }; |
| 26 | 27 | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index f6f8f032c73e..ae6468f5c9f3 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -447,7 +447,7 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); | |||
| 447 | 447 | ||
| 448 | void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); | 448 | void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); |
| 449 | void tcp_v4_mtu_reduced(struct sock *sk); | 449 | void tcp_v4_mtu_reduced(struct sock *sk); |
| 450 | void tcp_req_err(struct sock *sk, u32 seq); | 450 | void tcp_req_err(struct sock *sk, u32 seq, bool abort); |
| 451 | int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); | 451 | int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); |
| 452 | struct sock *tcp_create_openreq_child(const struct sock *sk, | 452 | struct sock *tcp_create_openreq_child(const struct sock *sk, |
| 453 | struct request_sock *req, | 453 | struct request_sock *req, |
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 56cf8e485ef2..28ee5c2e6bcd 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
| @@ -94,5 +94,8 @@ sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, | |||
| 94 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)); | 94 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)); |
| 95 | 95 | ||
| 96 | bool target_sense_desc_format(struct se_device *dev); | 96 | bool target_sense_desc_format(struct se_device *dev); |
| 97 | sector_t target_to_linux_sector(struct se_device *dev, sector_t lb); | ||
| 98 | bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, | ||
| 99 | struct request_queue *q, int block_size); | ||
| 97 | 100 | ||
| 98 | #endif /* TARGET_CORE_BACKEND_H */ | 101 | #endif /* TARGET_CORE_BACKEND_H */ |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5d82816cc4e3..e8c8c08bf575 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -140,6 +140,8 @@ enum se_cmd_flags_table { | |||
| 140 | SCF_COMPARE_AND_WRITE = 0x00080000, | 140 | SCF_COMPARE_AND_WRITE = 0x00080000, |
| 141 | SCF_COMPARE_AND_WRITE_POST = 0x00100000, | 141 | SCF_COMPARE_AND_WRITE_POST = 0x00100000, |
| 142 | SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, | 142 | SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC = 0x00200000, |
| 143 | SCF_ACK_KREF = 0x00400000, | ||
| 144 | SCF_USE_CPUID = 0x00800000, | ||
| 143 | }; | 145 | }; |
| 144 | 146 | ||
| 145 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ | 147 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ |
| @@ -187,6 +189,7 @@ enum target_sc_flags_table { | |||
| 187 | TARGET_SCF_BIDI_OP = 0x01, | 189 | TARGET_SCF_BIDI_OP = 0x01, |
| 188 | TARGET_SCF_ACK_KREF = 0x02, | 190 | TARGET_SCF_ACK_KREF = 0x02, |
| 189 | TARGET_SCF_UNKNOWN_SIZE = 0x04, | 191 | TARGET_SCF_UNKNOWN_SIZE = 0x04, |
| 192 | TARGET_SCF_USE_CPUID = 0x08, | ||
| 190 | }; | 193 | }; |
| 191 | 194 | ||
| 192 | /* fabric independent task management function values */ | 195 | /* fabric independent task management function values */ |
| @@ -490,8 +493,9 @@ struct se_cmd { | |||
| 490 | #define CMD_T_SENT (1 << 4) | 493 | #define CMD_T_SENT (1 << 4) |
| 491 | #define CMD_T_STOP (1 << 5) | 494 | #define CMD_T_STOP (1 << 5) |
| 492 | #define CMD_T_DEV_ACTIVE (1 << 7) | 495 | #define CMD_T_DEV_ACTIVE (1 << 7) |
| 493 | #define CMD_T_REQUEST_STOP (1 << 8) | ||
| 494 | #define CMD_T_BUSY (1 << 9) | 496 | #define CMD_T_BUSY (1 << 9) |
| 497 | #define CMD_T_TAS (1 << 10) | ||
| 498 | #define CMD_T_FABRIC_STOP (1 << 11) | ||
| 495 | spinlock_t t_state_lock; | 499 | spinlock_t t_state_lock; |
| 496 | struct kref cmd_kref; | 500 | struct kref cmd_kref; |
| 497 | struct completion t_transport_stop_comp; | 501 | struct completion t_transport_stop_comp; |
| @@ -511,9 +515,6 @@ struct se_cmd { | |||
| 511 | 515 | ||
| 512 | struct list_head state_list; | 516 | struct list_head state_list; |
| 513 | 517 | ||
| 514 | /* old task stop completion, consider merging with some of the above */ | ||
| 515 | struct completion task_stop_comp; | ||
| 516 | |||
| 517 | /* backend private data */ | 518 | /* backend private data */ |
| 518 | void *priv; | 519 | void *priv; |
| 519 | 520 | ||
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d1d3e8f57de9..2e7f7ab739e4 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
| @@ -2082,7 +2082,7 @@ static void adjust_branches(struct bpf_prog *prog, int pos, int delta) | |||
| 2082 | /* adjust offset of jmps if necessary */ | 2082 | /* adjust offset of jmps if necessary */ |
| 2083 | if (i < pos && i + insn->off + 1 > pos) | 2083 | if (i < pos && i + insn->off + 1 > pos) |
| 2084 | insn->off += delta; | 2084 | insn->off += delta; |
| 2085 | else if (i > pos && i + insn->off + 1 < pos) | 2085 | else if (i > pos + delta && i + insn->off + 1 <= pos + delta) |
| 2086 | insn->off -= delta; | 2086 | insn->off -= delta; |
| 2087 | } | 2087 | } |
| 2088 | } | 2088 | } |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index c03a640ef6da..d27904c193da 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
| 59 | #include <linux/delay.h> | 59 | #include <linux/delay.h> |
| 60 | #include <linux/atomic.h> | 60 | #include <linux/atomic.h> |
| 61 | #include <linux/cpuset.h> | ||
| 61 | #include <net/sock.h> | 62 | #include <net/sock.h> |
| 62 | 63 | ||
| 63 | /* | 64 | /* |
| @@ -2739,6 +2740,7 @@ out_unlock_rcu: | |||
| 2739 | out_unlock_threadgroup: | 2740 | out_unlock_threadgroup: |
| 2740 | percpu_up_write(&cgroup_threadgroup_rwsem); | 2741 | percpu_up_write(&cgroup_threadgroup_rwsem); |
| 2741 | cgroup_kn_unlock(of->kn); | 2742 | cgroup_kn_unlock(of->kn); |
| 2743 | cpuset_post_attach_flush(); | ||
| 2742 | return ret ?: nbytes; | 2744 | return ret ?: nbytes; |
| 2743 | } | 2745 | } |
| 2744 | 2746 | ||
| @@ -4655,14 +4657,15 @@ static void css_free_work_fn(struct work_struct *work) | |||
| 4655 | 4657 | ||
| 4656 | if (ss) { | 4658 | if (ss) { |
| 4657 | /* css free path */ | 4659 | /* css free path */ |
| 4660 | struct cgroup_subsys_state *parent = css->parent; | ||
| 4658 | int id = css->id; | 4661 | int id = css->id; |
| 4659 | 4662 | ||
| 4660 | if (css->parent) | ||
| 4661 | css_put(css->parent); | ||
| 4662 | |||
| 4663 | ss->css_free(css); | 4663 | ss->css_free(css); |
| 4664 | cgroup_idr_remove(&ss->css_idr, id); | 4664 | cgroup_idr_remove(&ss->css_idr, id); |
| 4665 | cgroup_put(cgrp); | 4665 | cgroup_put(cgrp); |
| 4666 | |||
| 4667 | if (parent) | ||
| 4668 | css_put(parent); | ||
| 4666 | } else { | 4669 | } else { |
| 4667 | /* cgroup free path */ | 4670 | /* cgroup free path */ |
| 4668 | atomic_dec(&cgrp->root->nr_cgrps); | 4671 | atomic_dec(&cgrp->root->nr_cgrps); |
| @@ -4758,6 +4761,7 @@ static void init_and_link_css(struct cgroup_subsys_state *css, | |||
| 4758 | INIT_LIST_HEAD(&css->sibling); | 4761 | INIT_LIST_HEAD(&css->sibling); |
| 4759 | INIT_LIST_HEAD(&css->children); | 4762 | INIT_LIST_HEAD(&css->children); |
| 4760 | css->serial_nr = css_serial_nr_next++; | 4763 | css->serial_nr = css_serial_nr_next++; |
| 4764 | atomic_set(&css->online_cnt, 0); | ||
| 4761 | 4765 | ||
| 4762 | if (cgroup_parent(cgrp)) { | 4766 | if (cgroup_parent(cgrp)) { |
| 4763 | css->parent = cgroup_css(cgroup_parent(cgrp), ss); | 4767 | css->parent = cgroup_css(cgroup_parent(cgrp), ss); |
| @@ -4780,6 +4784,10 @@ static int online_css(struct cgroup_subsys_state *css) | |||
| 4780 | if (!ret) { | 4784 | if (!ret) { |
| 4781 | css->flags |= CSS_ONLINE; | 4785 | css->flags |= CSS_ONLINE; |
| 4782 | rcu_assign_pointer(css->cgroup->subsys[ss->id], css); | 4786 | rcu_assign_pointer(css->cgroup->subsys[ss->id], css); |
| 4787 | |||
| 4788 | atomic_inc(&css->online_cnt); | ||
| 4789 | if (css->parent) | ||
| 4790 | atomic_inc(&css->parent->online_cnt); | ||
| 4783 | } | 4791 | } |
| 4784 | return ret; | 4792 | return ret; |
| 4785 | } | 4793 | } |
| @@ -5017,10 +5025,15 @@ static void css_killed_work_fn(struct work_struct *work) | |||
| 5017 | container_of(work, struct cgroup_subsys_state, destroy_work); | 5025 | container_of(work, struct cgroup_subsys_state, destroy_work); |
| 5018 | 5026 | ||
| 5019 | mutex_lock(&cgroup_mutex); | 5027 | mutex_lock(&cgroup_mutex); |
| 5020 | offline_css(css); | ||
| 5021 | mutex_unlock(&cgroup_mutex); | ||
| 5022 | 5028 | ||
| 5023 | css_put(css); | 5029 | do { |
| 5030 | offline_css(css); | ||
| 5031 | css_put(css); | ||
| 5032 | /* @css can't go away while we're holding cgroup_mutex */ | ||
| 5033 | css = css->parent; | ||
| 5034 | } while (css && atomic_dec_and_test(&css->online_cnt)); | ||
| 5035 | |||
| 5036 | mutex_unlock(&cgroup_mutex); | ||
| 5024 | } | 5037 | } |
| 5025 | 5038 | ||
| 5026 | /* css kill confirmation processing requires process context, bounce */ | 5039 | /* css kill confirmation processing requires process context, bounce */ |
| @@ -5029,8 +5042,10 @@ static void css_killed_ref_fn(struct percpu_ref *ref) | |||
| 5029 | struct cgroup_subsys_state *css = | 5042 | struct cgroup_subsys_state *css = |
| 5030 | container_of(ref, struct cgroup_subsys_state, refcnt); | 5043 | container_of(ref, struct cgroup_subsys_state, refcnt); |
| 5031 | 5044 | ||
| 5032 | INIT_WORK(&css->destroy_work, css_killed_work_fn); | 5045 | if (atomic_dec_and_test(&css->online_cnt)) { |
| 5033 | queue_work(cgroup_destroy_wq, &css->destroy_work); | 5046 | INIT_WORK(&css->destroy_work, css_killed_work_fn); |
| 5047 | queue_work(cgroup_destroy_wq, &css->destroy_work); | ||
| 5048 | } | ||
| 5034 | } | 5049 | } |
| 5035 | 5050 | ||
| 5036 | /** | 5051 | /** |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 3e945fcd8179..41989ab4db57 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
| @@ -287,6 +287,8 @@ static struct cpuset top_cpuset = { | |||
| 287 | static DEFINE_MUTEX(cpuset_mutex); | 287 | static DEFINE_MUTEX(cpuset_mutex); |
| 288 | static DEFINE_SPINLOCK(callback_lock); | 288 | static DEFINE_SPINLOCK(callback_lock); |
| 289 | 289 | ||
| 290 | static struct workqueue_struct *cpuset_migrate_mm_wq; | ||
| 291 | |||
| 290 | /* | 292 | /* |
| 291 | * CPU / memory hotplug is handled asynchronously. | 293 | * CPU / memory hotplug is handled asynchronously. |
| 292 | */ | 294 | */ |
| @@ -972,31 +974,51 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, | |||
| 972 | } | 974 | } |
| 973 | 975 | ||
| 974 | /* | 976 | /* |
| 975 | * cpuset_migrate_mm | 977 | * Migrate memory region from one set of nodes to another. This is |
| 976 | * | 978 | * performed asynchronously as it can be called from process migration path |
| 977 | * Migrate memory region from one set of nodes to another. | 979 | * holding locks involved in process management. All mm migrations are |
| 978 | * | 980 | * performed in the queued order and can be waited for by flushing |
| 979 | * Temporarilly set tasks mems_allowed to target nodes of migration, | 981 | * cpuset_migrate_mm_wq. |
| 980 | * so that the migration code can allocate pages on these nodes. | ||
| 981 | * | ||
| 982 | * While the mm_struct we are migrating is typically from some | ||
| 983 | * other task, the task_struct mems_allowed that we are hacking | ||
| 984 | * is for our current task, which must allocate new pages for that | ||
| 985 | * migrating memory region. | ||
| 986 | */ | 982 | */ |
| 987 | 983 | ||
| 984 | struct cpuset_migrate_mm_work { | ||
| 985 | struct work_struct work; | ||
| 986 | struct mm_struct *mm; | ||
| 987 | nodemask_t from; | ||
| 988 | nodemask_t to; | ||
| 989 | }; | ||
| 990 | |||
| 991 | static void cpuset_migrate_mm_workfn(struct work_struct *work) | ||
| 992 | { | ||
| 993 | struct cpuset_migrate_mm_work *mwork = | ||
| 994 | container_of(work, struct cpuset_migrate_mm_work, work); | ||
| 995 | |||
| 996 | /* on a wq worker, no need to worry about %current's mems_allowed */ | ||
| 997 | do_migrate_pages(mwork->mm, &mwork->from, &mwork->to, MPOL_MF_MOVE_ALL); | ||
| 998 | mmput(mwork->mm); | ||
| 999 | kfree(mwork); | ||
| 1000 | } | ||
| 1001 | |||
| 988 | static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from, | 1002 | static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from, |
| 989 | const nodemask_t *to) | 1003 | const nodemask_t *to) |
| 990 | { | 1004 | { |
| 991 | struct task_struct *tsk = current; | 1005 | struct cpuset_migrate_mm_work *mwork; |
| 992 | |||
| 993 | tsk->mems_allowed = *to; | ||
| 994 | 1006 | ||
| 995 | do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL); | 1007 | mwork = kzalloc(sizeof(*mwork), GFP_KERNEL); |
| 1008 | if (mwork) { | ||
| 1009 | mwork->mm = mm; | ||
| 1010 | mwork->from = *from; | ||
| 1011 | mwork->to = *to; | ||
| 1012 | INIT_WORK(&mwork->work, cpuset_migrate_mm_workfn); | ||
| 1013 | queue_work(cpuset_migrate_mm_wq, &mwork->work); | ||
| 1014 | } else { | ||
| 1015 | mmput(mm); | ||
| 1016 | } | ||
| 1017 | } | ||
| 996 | 1018 | ||
| 997 | rcu_read_lock(); | 1019 | void cpuset_post_attach_flush(void) |
| 998 | guarantee_online_mems(task_cs(tsk), &tsk->mems_allowed); | 1020 | { |
| 999 | rcu_read_unlock(); | 1021 | flush_workqueue(cpuset_migrate_mm_wq); |
| 1000 | } | 1022 | } |
| 1001 | 1023 | ||
| 1002 | /* | 1024 | /* |
| @@ -1097,7 +1119,8 @@ static void update_tasks_nodemask(struct cpuset *cs) | |||
| 1097 | mpol_rebind_mm(mm, &cs->mems_allowed); | 1119 | mpol_rebind_mm(mm, &cs->mems_allowed); |
| 1098 | if (migrate) | 1120 | if (migrate) |
| 1099 | cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems); | 1121 | cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems); |
| 1100 | mmput(mm); | 1122 | else |
| 1123 | mmput(mm); | ||
| 1101 | } | 1124 | } |
| 1102 | css_task_iter_end(&it); | 1125 | css_task_iter_end(&it); |
| 1103 | 1126 | ||
| @@ -1545,11 +1568,11 @@ static void cpuset_attach(struct cgroup_taskset *tset) | |||
| 1545 | * @old_mems_allowed is the right nodesets that we | 1568 | * @old_mems_allowed is the right nodesets that we |
| 1546 | * migrate mm from. | 1569 | * migrate mm from. |
| 1547 | */ | 1570 | */ |
| 1548 | if (is_memory_migrate(cs)) { | 1571 | if (is_memory_migrate(cs)) |
| 1549 | cpuset_migrate_mm(mm, &oldcs->old_mems_allowed, | 1572 | cpuset_migrate_mm(mm, &oldcs->old_mems_allowed, |
| 1550 | &cpuset_attach_nodemask_to); | 1573 | &cpuset_attach_nodemask_to); |
| 1551 | } | 1574 | else |
| 1552 | mmput(mm); | 1575 | mmput(mm); |
| 1553 | } | 1576 | } |
| 1554 | } | 1577 | } |
| 1555 | 1578 | ||
| @@ -1714,6 +1737,7 @@ out_unlock: | |||
| 1714 | mutex_unlock(&cpuset_mutex); | 1737 | mutex_unlock(&cpuset_mutex); |
| 1715 | kernfs_unbreak_active_protection(of->kn); | 1738 | kernfs_unbreak_active_protection(of->kn); |
| 1716 | css_put(&cs->css); | 1739 | css_put(&cs->css); |
| 1740 | flush_workqueue(cpuset_migrate_mm_wq); | ||
| 1717 | return retval ?: nbytes; | 1741 | return retval ?: nbytes; |
| 1718 | } | 1742 | } |
| 1719 | 1743 | ||
| @@ -2359,6 +2383,9 @@ void __init cpuset_init_smp(void) | |||
| 2359 | top_cpuset.effective_mems = node_states[N_MEMORY]; | 2383 | top_cpuset.effective_mems = node_states[N_MEMORY]; |
| 2360 | 2384 | ||
| 2361 | register_hotmemory_notifier(&cpuset_track_online_nodes_nb); | 2385 | register_hotmemory_notifier(&cpuset_track_online_nodes_nb); |
| 2386 | |||
| 2387 | cpuset_migrate_mm_wq = alloc_ordered_workqueue("cpuset_migrate_mm", 0); | ||
| 2388 | BUG_ON(!cpuset_migrate_mm_wq); | ||
| 2362 | } | 2389 | } |
| 2363 | 2390 | ||
| 2364 | /** | 2391 | /** |
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 60ace56618f6..716547fdb873 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
| @@ -292,7 +292,7 @@ LIST_HEAD(all_lock_classes); | |||
| 292 | #define __classhashfn(key) hash_long((unsigned long)key, CLASSHASH_BITS) | 292 | #define __classhashfn(key) hash_long((unsigned long)key, CLASSHASH_BITS) |
| 293 | #define classhashentry(key) (classhash_table + __classhashfn((key))) | 293 | #define classhashentry(key) (classhash_table + __classhashfn((key))) |
| 294 | 294 | ||
| 295 | static struct list_head classhash_table[CLASSHASH_SIZE]; | 295 | static struct hlist_head classhash_table[CLASSHASH_SIZE]; |
| 296 | 296 | ||
| 297 | /* | 297 | /* |
| 298 | * We put the lock dependency chains into a hash-table as well, to cache | 298 | * We put the lock dependency chains into a hash-table as well, to cache |
| @@ -303,7 +303,7 @@ static struct list_head classhash_table[CLASSHASH_SIZE]; | |||
| 303 | #define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS) | 303 | #define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS) |
| 304 | #define chainhashentry(chain) (chainhash_table + __chainhashfn((chain))) | 304 | #define chainhashentry(chain) (chainhash_table + __chainhashfn((chain))) |
| 305 | 305 | ||
| 306 | static struct list_head chainhash_table[CHAINHASH_SIZE]; | 306 | static struct hlist_head chainhash_table[CHAINHASH_SIZE]; |
| 307 | 307 | ||
| 308 | /* | 308 | /* |
| 309 | * The hash key of the lock dependency chains is a hash itself too: | 309 | * The hash key of the lock dependency chains is a hash itself too: |
| @@ -666,7 +666,7 @@ static inline struct lock_class * | |||
| 666 | look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | 666 | look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) |
| 667 | { | 667 | { |
| 668 | struct lockdep_subclass_key *key; | 668 | struct lockdep_subclass_key *key; |
| 669 | struct list_head *hash_head; | 669 | struct hlist_head *hash_head; |
| 670 | struct lock_class *class; | 670 | struct lock_class *class; |
| 671 | 671 | ||
| 672 | #ifdef CONFIG_DEBUG_LOCKDEP | 672 | #ifdef CONFIG_DEBUG_LOCKDEP |
| @@ -719,7 +719,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
| 719 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 719 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
| 720 | return NULL; | 720 | return NULL; |
| 721 | 721 | ||
| 722 | list_for_each_entry_rcu(class, hash_head, hash_entry) { | 722 | hlist_for_each_entry_rcu(class, hash_head, hash_entry) { |
| 723 | if (class->key == key) { | 723 | if (class->key == key) { |
| 724 | /* | 724 | /* |
| 725 | * Huh! same key, different name? Did someone trample | 725 | * Huh! same key, different name? Did someone trample |
| @@ -742,7 +742,7 @@ static inline struct lock_class * | |||
| 742 | register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) | 742 | register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) |
| 743 | { | 743 | { |
| 744 | struct lockdep_subclass_key *key; | 744 | struct lockdep_subclass_key *key; |
| 745 | struct list_head *hash_head; | 745 | struct hlist_head *hash_head; |
| 746 | struct lock_class *class; | 746 | struct lock_class *class; |
| 747 | 747 | ||
| 748 | DEBUG_LOCKS_WARN_ON(!irqs_disabled()); | 748 | DEBUG_LOCKS_WARN_ON(!irqs_disabled()); |
| @@ -774,7 +774,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) | |||
| 774 | * We have to do the hash-walk again, to avoid races | 774 | * We have to do the hash-walk again, to avoid races |
| 775 | * with another CPU: | 775 | * with another CPU: |
| 776 | */ | 776 | */ |
| 777 | list_for_each_entry_rcu(class, hash_head, hash_entry) { | 777 | hlist_for_each_entry_rcu(class, hash_head, hash_entry) { |
| 778 | if (class->key == key) | 778 | if (class->key == key) |
| 779 | goto out_unlock_set; | 779 | goto out_unlock_set; |
| 780 | } | 780 | } |
| @@ -805,7 +805,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) | |||
| 805 | * We use RCU's safe list-add method to make | 805 | * We use RCU's safe list-add method to make |
| 806 | * parallel walking of the hash-list safe: | 806 | * parallel walking of the hash-list safe: |
| 807 | */ | 807 | */ |
| 808 | list_add_tail_rcu(&class->hash_entry, hash_head); | 808 | hlist_add_head_rcu(&class->hash_entry, hash_head); |
| 809 | /* | 809 | /* |
| 810 | * Add it to the global list of classes: | 810 | * Add it to the global list of classes: |
| 811 | */ | 811 | */ |
| @@ -1822,7 +1822,7 @@ check_deadlock(struct task_struct *curr, struct held_lock *next, | |||
| 1822 | */ | 1822 | */ |
| 1823 | static int | 1823 | static int |
| 1824 | check_prev_add(struct task_struct *curr, struct held_lock *prev, | 1824 | check_prev_add(struct task_struct *curr, struct held_lock *prev, |
| 1825 | struct held_lock *next, int distance, int trylock_loop) | 1825 | struct held_lock *next, int distance, int *stack_saved) |
| 1826 | { | 1826 | { |
| 1827 | struct lock_list *entry; | 1827 | struct lock_list *entry; |
| 1828 | int ret; | 1828 | int ret; |
| @@ -1883,8 +1883,11 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev, | |||
| 1883 | } | 1883 | } |
| 1884 | } | 1884 | } |
| 1885 | 1885 | ||
| 1886 | if (!trylock_loop && !save_trace(&trace)) | 1886 | if (!*stack_saved) { |
| 1887 | return 0; | 1887 | if (!save_trace(&trace)) |
| 1888 | return 0; | ||
| 1889 | *stack_saved = 1; | ||
| 1890 | } | ||
| 1888 | 1891 | ||
| 1889 | /* | 1892 | /* |
| 1890 | * Ok, all validations passed, add the new lock | 1893 | * Ok, all validations passed, add the new lock |
| @@ -1907,6 +1910,8 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev, | |||
| 1907 | * Debugging printouts: | 1910 | * Debugging printouts: |
| 1908 | */ | 1911 | */ |
| 1909 | if (verbose(hlock_class(prev)) || verbose(hlock_class(next))) { | 1912 | if (verbose(hlock_class(prev)) || verbose(hlock_class(next))) { |
| 1913 | /* We drop graph lock, so another thread can overwrite trace. */ | ||
| 1914 | *stack_saved = 0; | ||
| 1910 | graph_unlock(); | 1915 | graph_unlock(); |
| 1911 | printk("\n new dependency: "); | 1916 | printk("\n new dependency: "); |
| 1912 | print_lock_name(hlock_class(prev)); | 1917 | print_lock_name(hlock_class(prev)); |
| @@ -1929,7 +1934,7 @@ static int | |||
| 1929 | check_prevs_add(struct task_struct *curr, struct held_lock *next) | 1934 | check_prevs_add(struct task_struct *curr, struct held_lock *next) |
| 1930 | { | 1935 | { |
| 1931 | int depth = curr->lockdep_depth; | 1936 | int depth = curr->lockdep_depth; |
| 1932 | int trylock_loop = 0; | 1937 | int stack_saved = 0; |
| 1933 | struct held_lock *hlock; | 1938 | struct held_lock *hlock; |
| 1934 | 1939 | ||
| 1935 | /* | 1940 | /* |
| @@ -1956,7 +1961,7 @@ check_prevs_add(struct task_struct *curr, struct held_lock *next) | |||
| 1956 | */ | 1961 | */ |
| 1957 | if (hlock->read != 2 && hlock->check) { | 1962 | if (hlock->read != 2 && hlock->check) { |
| 1958 | if (!check_prev_add(curr, hlock, next, | 1963 | if (!check_prev_add(curr, hlock, next, |
| 1959 | distance, trylock_loop)) | 1964 | distance, &stack_saved)) |
| 1960 | return 0; | 1965 | return 0; |
| 1961 | /* | 1966 | /* |
| 1962 | * Stop after the first non-trylock entry, | 1967 | * Stop after the first non-trylock entry, |
| @@ -1979,7 +1984,6 @@ check_prevs_add(struct task_struct *curr, struct held_lock *next) | |||
| 1979 | if (curr->held_locks[depth].irq_context != | 1984 | if (curr->held_locks[depth].irq_context != |
| 1980 | curr->held_locks[depth-1].irq_context) | 1985 | curr->held_locks[depth-1].irq_context) |
| 1981 | break; | 1986 | break; |
| 1982 | trylock_loop = 1; | ||
| 1983 | } | 1987 | } |
| 1984 | return 1; | 1988 | return 1; |
| 1985 | out_bug: | 1989 | out_bug: |
| @@ -2017,7 +2021,7 @@ static inline int lookup_chain_cache(struct task_struct *curr, | |||
| 2017 | u64 chain_key) | 2021 | u64 chain_key) |
| 2018 | { | 2022 | { |
| 2019 | struct lock_class *class = hlock_class(hlock); | 2023 | struct lock_class *class = hlock_class(hlock); |
| 2020 | struct list_head *hash_head = chainhashentry(chain_key); | 2024 | struct hlist_head *hash_head = chainhashentry(chain_key); |
| 2021 | struct lock_chain *chain; | 2025 | struct lock_chain *chain; |
| 2022 | struct held_lock *hlock_curr; | 2026 | struct held_lock *hlock_curr; |
| 2023 | int i, j; | 2027 | int i, j; |
| @@ -2033,7 +2037,7 @@ static inline int lookup_chain_cache(struct task_struct *curr, | |||
| 2033 | * We can walk it lock-free, because entries only get added | 2037 | * We can walk it lock-free, because entries only get added |
| 2034 | * to the hash: | 2038 | * to the hash: |
| 2035 | */ | 2039 | */ |
| 2036 | list_for_each_entry_rcu(chain, hash_head, entry) { | 2040 | hlist_for_each_entry_rcu(chain, hash_head, entry) { |
| 2037 | if (chain->chain_key == chain_key) { | 2041 | if (chain->chain_key == chain_key) { |
| 2038 | cache_hit: | 2042 | cache_hit: |
| 2039 | debug_atomic_inc(chain_lookup_hits); | 2043 | debug_atomic_inc(chain_lookup_hits); |
| @@ -2057,7 +2061,7 @@ cache_hit: | |||
| 2057 | /* | 2061 | /* |
| 2058 | * We have to walk the chain again locked - to avoid duplicates: | 2062 | * We have to walk the chain again locked - to avoid duplicates: |
| 2059 | */ | 2063 | */ |
| 2060 | list_for_each_entry(chain, hash_head, entry) { | 2064 | hlist_for_each_entry(chain, hash_head, entry) { |
| 2061 | if (chain->chain_key == chain_key) { | 2065 | if (chain->chain_key == chain_key) { |
| 2062 | graph_unlock(); | 2066 | graph_unlock(); |
| 2063 | goto cache_hit; | 2067 | goto cache_hit; |
| @@ -2091,7 +2095,7 @@ cache_hit: | |||
| 2091 | } | 2095 | } |
| 2092 | chain_hlocks[chain->base + j] = class - lock_classes; | 2096 | chain_hlocks[chain->base + j] = class - lock_classes; |
| 2093 | } | 2097 | } |
| 2094 | list_add_tail_rcu(&chain->entry, hash_head); | 2098 | hlist_add_head_rcu(&chain->entry, hash_head); |
| 2095 | debug_atomic_inc(chain_lookup_misses); | 2099 | debug_atomic_inc(chain_lookup_misses); |
| 2096 | inc_chains(); | 2100 | inc_chains(); |
| 2097 | 2101 | ||
| @@ -3875,7 +3879,7 @@ void lockdep_reset(void) | |||
| 3875 | nr_process_chains = 0; | 3879 | nr_process_chains = 0; |
| 3876 | debug_locks = 1; | 3880 | debug_locks = 1; |
| 3877 | for (i = 0; i < CHAINHASH_SIZE; i++) | 3881 | for (i = 0; i < CHAINHASH_SIZE; i++) |
| 3878 | INIT_LIST_HEAD(chainhash_table + i); | 3882 | INIT_HLIST_HEAD(chainhash_table + i); |
| 3879 | raw_local_irq_restore(flags); | 3883 | raw_local_irq_restore(flags); |
| 3880 | } | 3884 | } |
| 3881 | 3885 | ||
| @@ -3894,7 +3898,7 @@ static void zap_class(struct lock_class *class) | |||
| 3894 | /* | 3898 | /* |
| 3895 | * Unhash the class and remove it from the all_lock_classes list: | 3899 | * Unhash the class and remove it from the all_lock_classes list: |
| 3896 | */ | 3900 | */ |
| 3897 | list_del_rcu(&class->hash_entry); | 3901 | hlist_del_rcu(&class->hash_entry); |
| 3898 | list_del_rcu(&class->lock_entry); | 3902 | list_del_rcu(&class->lock_entry); |
| 3899 | 3903 | ||
| 3900 | RCU_INIT_POINTER(class->key, NULL); | 3904 | RCU_INIT_POINTER(class->key, NULL); |
| @@ -3917,7 +3921,7 @@ static inline int within(const void *addr, void *start, unsigned long size) | |||
| 3917 | void lockdep_free_key_range(void *start, unsigned long size) | 3921 | void lockdep_free_key_range(void *start, unsigned long size) |
| 3918 | { | 3922 | { |
| 3919 | struct lock_class *class; | 3923 | struct lock_class *class; |
| 3920 | struct list_head *head; | 3924 | struct hlist_head *head; |
| 3921 | unsigned long flags; | 3925 | unsigned long flags; |
| 3922 | int i; | 3926 | int i; |
| 3923 | int locked; | 3927 | int locked; |
| @@ -3930,9 +3934,7 @@ void lockdep_free_key_range(void *start, unsigned long size) | |||
| 3930 | */ | 3934 | */ |
| 3931 | for (i = 0; i < CLASSHASH_SIZE; i++) { | 3935 | for (i = 0; i < CLASSHASH_SIZE; i++) { |
| 3932 | head = classhash_table + i; | 3936 | head = classhash_table + i; |
| 3933 | if (list_empty(head)) | 3937 | hlist_for_each_entry_rcu(class, head, hash_entry) { |
| 3934 | continue; | ||
| 3935 | list_for_each_entry_rcu(class, head, hash_entry) { | ||
| 3936 | if (within(class->key, start, size)) | 3938 | if (within(class->key, start, size)) |
| 3937 | zap_class(class); | 3939 | zap_class(class); |
| 3938 | else if (within(class->name, start, size)) | 3940 | else if (within(class->name, start, size)) |
| @@ -3962,7 +3964,7 @@ void lockdep_free_key_range(void *start, unsigned long size) | |||
| 3962 | void lockdep_reset_lock(struct lockdep_map *lock) | 3964 | void lockdep_reset_lock(struct lockdep_map *lock) |
| 3963 | { | 3965 | { |
| 3964 | struct lock_class *class; | 3966 | struct lock_class *class; |
| 3965 | struct list_head *head; | 3967 | struct hlist_head *head; |
| 3966 | unsigned long flags; | 3968 | unsigned long flags; |
| 3967 | int i, j; | 3969 | int i, j; |
| 3968 | int locked; | 3970 | int locked; |
| @@ -3987,9 +3989,7 @@ void lockdep_reset_lock(struct lockdep_map *lock) | |||
| 3987 | locked = graph_lock(); | 3989 | locked = graph_lock(); |
| 3988 | for (i = 0; i < CLASSHASH_SIZE; i++) { | 3990 | for (i = 0; i < CLASSHASH_SIZE; i++) { |
| 3989 | head = classhash_table + i; | 3991 | head = classhash_table + i; |
| 3990 | if (list_empty(head)) | 3992 | hlist_for_each_entry_rcu(class, head, hash_entry) { |
| 3991 | continue; | ||
| 3992 | list_for_each_entry_rcu(class, head, hash_entry) { | ||
| 3993 | int match = 0; | 3993 | int match = 0; |
| 3994 | 3994 | ||
| 3995 | for (j = 0; j < NR_LOCKDEP_CACHING_CLASSES; j++) | 3995 | for (j = 0; j < NR_LOCKDEP_CACHING_CLASSES; j++) |
| @@ -4027,10 +4027,10 @@ void lockdep_init(void) | |||
| 4027 | return; | 4027 | return; |
| 4028 | 4028 | ||
| 4029 | for (i = 0; i < CLASSHASH_SIZE; i++) | 4029 | for (i = 0; i < CLASSHASH_SIZE; i++) |
| 4030 | INIT_LIST_HEAD(classhash_table + i); | 4030 | INIT_HLIST_HEAD(classhash_table + i); |
| 4031 | 4031 | ||
| 4032 | for (i = 0; i < CHAINHASH_SIZE; i++) | 4032 | for (i = 0; i < CHAINHASH_SIZE; i++) |
| 4033 | INIT_LIST_HEAD(chainhash_table + i); | 4033 | INIT_HLIST_HEAD(chainhash_table + i); |
| 4034 | 4034 | ||
| 4035 | lockdep_initialized = 1; | 4035 | lockdep_initialized = 1; |
| 4036 | } | 4036 | } |
diff --git a/kernel/memremap.c b/kernel/memremap.c index 70ee3775de24..2c468dea60bc 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c | |||
| @@ -150,7 +150,7 @@ void devm_memunmap(struct device *dev, void *addr) | |||
| 150 | } | 150 | } |
| 151 | EXPORT_SYMBOL(devm_memunmap); | 151 | EXPORT_SYMBOL(devm_memunmap); |
| 152 | 152 | ||
| 153 | pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags) | 153 | pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags) |
| 154 | { | 154 | { |
| 155 | return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags); | 155 | return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags); |
| 156 | } | 156 | } |
diff --git a/kernel/module.c b/kernel/module.c index 8358f4697c0c..9537da37ce87 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -303,6 +303,9 @@ struct load_info { | |||
| 303 | struct _ddebug *debug; | 303 | struct _ddebug *debug; |
| 304 | unsigned int num_debug; | 304 | unsigned int num_debug; |
| 305 | bool sig_ok; | 305 | bool sig_ok; |
| 306 | #ifdef CONFIG_KALLSYMS | ||
| 307 | unsigned long mod_kallsyms_init_off; | ||
| 308 | #endif | ||
| 306 | struct { | 309 | struct { |
| 307 | unsigned int sym, str, mod, vers, info, pcpu; | 310 | unsigned int sym, str, mod, vers, info, pcpu; |
| 308 | } index; | 311 | } index; |
| @@ -2480,10 +2483,21 @@ static void layout_symtab(struct module *mod, struct load_info *info) | |||
| 2480 | strsect->sh_flags |= SHF_ALLOC; | 2483 | strsect->sh_flags |= SHF_ALLOC; |
| 2481 | strsect->sh_entsize = get_offset(mod, &mod->init_layout.size, strsect, | 2484 | strsect->sh_entsize = get_offset(mod, &mod->init_layout.size, strsect, |
| 2482 | info->index.str) | INIT_OFFSET_MASK; | 2485 | info->index.str) | INIT_OFFSET_MASK; |
| 2483 | mod->init_layout.size = debug_align(mod->init_layout.size); | ||
| 2484 | pr_debug("\t%s\n", info->secstrings + strsect->sh_name); | 2486 | pr_debug("\t%s\n", info->secstrings + strsect->sh_name); |
| 2487 | |||
| 2488 | /* We'll tack temporary mod_kallsyms on the end. */ | ||
| 2489 | mod->init_layout.size = ALIGN(mod->init_layout.size, | ||
| 2490 | __alignof__(struct mod_kallsyms)); | ||
| 2491 | info->mod_kallsyms_init_off = mod->init_layout.size; | ||
| 2492 | mod->init_layout.size += sizeof(struct mod_kallsyms); | ||
| 2493 | mod->init_layout.size = debug_align(mod->init_layout.size); | ||
| 2485 | } | 2494 | } |
| 2486 | 2495 | ||
| 2496 | /* | ||
| 2497 | * We use the full symtab and strtab which layout_symtab arranged to | ||
| 2498 | * be appended to the init section. Later we switch to the cut-down | ||
| 2499 | * core-only ones. | ||
| 2500 | */ | ||
| 2487 | static void add_kallsyms(struct module *mod, const struct load_info *info) | 2501 | static void add_kallsyms(struct module *mod, const struct load_info *info) |
| 2488 | { | 2502 | { |
| 2489 | unsigned int i, ndst; | 2503 | unsigned int i, ndst; |
| @@ -2492,29 +2506,34 @@ static void add_kallsyms(struct module *mod, const struct load_info *info) | |||
| 2492 | char *s; | 2506 | char *s; |
| 2493 | Elf_Shdr *symsec = &info->sechdrs[info->index.sym]; | 2507 | Elf_Shdr *symsec = &info->sechdrs[info->index.sym]; |
| 2494 | 2508 | ||
| 2495 | mod->symtab = (void *)symsec->sh_addr; | 2509 | /* Set up to point into init section. */ |
| 2496 | mod->num_symtab = symsec->sh_size / sizeof(Elf_Sym); | 2510 | mod->kallsyms = mod->init_layout.base + info->mod_kallsyms_init_off; |
| 2511 | |||
| 2512 | mod->kallsyms->symtab = (void *)symsec->sh_addr; | ||
| 2513 | mod->kallsyms->num_symtab = symsec->sh_size / sizeof(Elf_Sym); | ||
| 2497 | /* Make sure we get permanent strtab: don't use info->strtab. */ | 2514 | /* Make sure we get permanent strtab: don't use info->strtab. */ |
| 2498 | mod->strtab = (void *)info->sechdrs[info->index.str].sh_addr; | 2515 | mod->kallsyms->strtab = (void *)info->sechdrs[info->index.str].sh_addr; |
| 2499 | 2516 | ||
| 2500 | /* Set types up while we still have access to sections. */ | 2517 | /* Set types up while we still have access to sections. */ |
| 2501 | for (i = 0; i < mod->num_symtab; i++) | 2518 | for (i = 0; i < mod->kallsyms->num_symtab; i++) |
| 2502 | mod->symtab[i].st_info = elf_type(&mod->symtab[i], info); | 2519 | mod->kallsyms->symtab[i].st_info |
| 2503 | 2520 | = elf_type(&mod->kallsyms->symtab[i], info); | |
| 2504 | mod->core_symtab = dst = mod->core_layout.base + info->symoffs; | 2521 | |
| 2505 | mod->core_strtab = s = mod->core_layout.base + info->stroffs; | 2522 | /* Now populate the cut down core kallsyms for after init. */ |
| 2506 | src = mod->symtab; | 2523 | mod->core_kallsyms.symtab = dst = mod->core_layout.base + info->symoffs; |
| 2507 | for (ndst = i = 0; i < mod->num_symtab; i++) { | 2524 | mod->core_kallsyms.strtab = s = mod->core_layout.base + info->stroffs; |
| 2525 | src = mod->kallsyms->symtab; | ||
| 2526 | for (ndst = i = 0; i < mod->kallsyms->num_symtab; i++) { | ||
| 2508 | if (i == 0 || | 2527 | if (i == 0 || |
| 2509 | is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum, | 2528 | is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum, |
| 2510 | info->index.pcpu)) { | 2529 | info->index.pcpu)) { |
| 2511 | dst[ndst] = src[i]; | 2530 | dst[ndst] = src[i]; |
| 2512 | dst[ndst++].st_name = s - mod->core_strtab; | 2531 | dst[ndst++].st_name = s - mod->core_kallsyms.strtab; |
| 2513 | s += strlcpy(s, &mod->strtab[src[i].st_name], | 2532 | s += strlcpy(s, &mod->kallsyms->strtab[src[i].st_name], |
| 2514 | KSYM_NAME_LEN) + 1; | 2533 | KSYM_NAME_LEN) + 1; |
| 2515 | } | 2534 | } |
| 2516 | } | 2535 | } |
| 2517 | mod->core_num_syms = ndst; | 2536 | mod->core_kallsyms.num_symtab = ndst; |
| 2518 | } | 2537 | } |
| 2519 | #else | 2538 | #else |
| 2520 | static inline void layout_symtab(struct module *mod, struct load_info *info) | 2539 | static inline void layout_symtab(struct module *mod, struct load_info *info) |
| @@ -3263,9 +3282,8 @@ static noinline int do_init_module(struct module *mod) | |||
| 3263 | module_put(mod); | 3282 | module_put(mod); |
| 3264 | trim_init_extable(mod); | 3283 | trim_init_extable(mod); |
| 3265 | #ifdef CONFIG_KALLSYMS | 3284 | #ifdef CONFIG_KALLSYMS |
| 3266 | mod->num_symtab = mod->core_num_syms; | 3285 | /* Switch to core kallsyms now init is done: kallsyms may be walking! */ |
| 3267 | mod->symtab = mod->core_symtab; | 3286 | rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); |
| 3268 | mod->strtab = mod->core_strtab; | ||
| 3269 | #endif | 3287 | #endif |
| 3270 | mod_tree_remove_init(mod); | 3288 | mod_tree_remove_init(mod); |
| 3271 | disable_ro_nx(&mod->init_layout); | 3289 | disable_ro_nx(&mod->init_layout); |
| @@ -3496,7 +3514,7 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
| 3496 | 3514 | ||
| 3497 | /* Module is ready to execute: parsing args may do that. */ | 3515 | /* Module is ready to execute: parsing args may do that. */ |
| 3498 | after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, | 3516 | after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
| 3499 | -32768, 32767, NULL, | 3517 | -32768, 32767, mod, |
| 3500 | unknown_module_param_cb); | 3518 | unknown_module_param_cb); |
| 3501 | if (IS_ERR(after_dashes)) { | 3519 | if (IS_ERR(after_dashes)) { |
| 3502 | err = PTR_ERR(after_dashes); | 3520 | err = PTR_ERR(after_dashes); |
| @@ -3627,6 +3645,11 @@ static inline int is_arm_mapping_symbol(const char *str) | |||
| 3627 | && (str[2] == '\0' || str[2] == '.'); | 3645 | && (str[2] == '\0' || str[2] == '.'); |
| 3628 | } | 3646 | } |
| 3629 | 3647 | ||
| 3648 | static const char *symname(struct mod_kallsyms *kallsyms, unsigned int symnum) | ||
| 3649 | { | ||
| 3650 | return kallsyms->strtab + kallsyms->symtab[symnum].st_name; | ||
| 3651 | } | ||
| 3652 | |||
| 3630 | static const char *get_ksymbol(struct module *mod, | 3653 | static const char *get_ksymbol(struct module *mod, |
| 3631 | unsigned long addr, | 3654 | unsigned long addr, |
| 3632 | unsigned long *size, | 3655 | unsigned long *size, |
| @@ -3634,6 +3657,7 @@ static const char *get_ksymbol(struct module *mod, | |||
| 3634 | { | 3657 | { |
| 3635 | unsigned int i, best = 0; | 3658 | unsigned int i, best = 0; |
| 3636 | unsigned long nextval; | 3659 | unsigned long nextval; |
| 3660 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); | ||
| 3637 | 3661 | ||
| 3638 | /* At worse, next value is at end of module */ | 3662 | /* At worse, next value is at end of module */ |
| 3639 | if (within_module_init(addr, mod)) | 3663 | if (within_module_init(addr, mod)) |
| @@ -3643,32 +3667,32 @@ static const char *get_ksymbol(struct module *mod, | |||
| 3643 | 3667 | ||
| 3644 | /* Scan for closest preceding symbol, and next symbol. (ELF | 3668 | /* Scan for closest preceding symbol, and next symbol. (ELF |
| 3645 | starts real symbols at 1). */ | 3669 | starts real symbols at 1). */ |
| 3646 | for (i = 1; i < mod->num_symtab; i++) { | 3670 | for (i = 1; i < kallsyms->num_symtab; i++) { |
| 3647 | if (mod->symtab[i].st_shndx == SHN_UNDEF) | 3671 | if (kallsyms->symtab[i].st_shndx == SHN_UNDEF) |
| 3648 | continue; | 3672 | continue; |
| 3649 | 3673 | ||
| 3650 | /* We ignore unnamed symbols: they're uninformative | 3674 | /* We ignore unnamed symbols: they're uninformative |
| 3651 | * and inserted at a whim. */ | 3675 | * and inserted at a whim. */ |
| 3652 | if (mod->symtab[i].st_value <= addr | 3676 | if (*symname(kallsyms, i) == '\0' |
| 3653 | && mod->symtab[i].st_value > mod->symtab[best].st_value | 3677 | || is_arm_mapping_symbol(symname(kallsyms, i))) |
| 3654 | && *(mod->strtab + mod->symtab[i].st_name) != '\0' | 3678 | continue; |
| 3655 | && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name)) | 3679 | |
| 3680 | if (kallsyms->symtab[i].st_value <= addr | ||
| 3681 | && kallsyms->symtab[i].st_value > kallsyms->symtab[best].st_value) | ||
| 3656 | best = i; | 3682 | best = i; |
| 3657 | if (mod->symtab[i].st_value > addr | 3683 | if (kallsyms->symtab[i].st_value > addr |
| 3658 | && mod->symtab[i].st_value < nextval | 3684 | && kallsyms->symtab[i].st_value < nextval) |
| 3659 | && *(mod->strtab + mod->symtab[i].st_name) != '\0' | 3685 | nextval = kallsyms->symtab[i].st_value; |
| 3660 | && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name)) | ||
| 3661 | nextval = mod->symtab[i].st_value; | ||
| 3662 | } | 3686 | } |
| 3663 | 3687 | ||
| 3664 | if (!best) | 3688 | if (!best) |
| 3665 | return NULL; | 3689 | return NULL; |
| 3666 | 3690 | ||
| 3667 | if (size) | 3691 | if (size) |
| 3668 | *size = nextval - mod->symtab[best].st_value; | 3692 | *size = nextval - kallsyms->symtab[best].st_value; |
| 3669 | if (offset) | 3693 | if (offset) |
| 3670 | *offset = addr - mod->symtab[best].st_value; | 3694 | *offset = addr - kallsyms->symtab[best].st_value; |
| 3671 | return mod->strtab + mod->symtab[best].st_name; | 3695 | return symname(kallsyms, best); |
| 3672 | } | 3696 | } |
| 3673 | 3697 | ||
| 3674 | /* For kallsyms to ask for address resolution. NULL means not found. Careful | 3698 | /* For kallsyms to ask for address resolution. NULL means not found. Careful |
| @@ -3758,19 +3782,21 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | |||
| 3758 | 3782 | ||
| 3759 | preempt_disable(); | 3783 | preempt_disable(); |
| 3760 | list_for_each_entry_rcu(mod, &modules, list) { | 3784 | list_for_each_entry_rcu(mod, &modules, list) { |
| 3785 | struct mod_kallsyms *kallsyms; | ||
| 3786 | |||
| 3761 | if (mod->state == MODULE_STATE_UNFORMED) | 3787 | if (mod->state == MODULE_STATE_UNFORMED) |
| 3762 | continue; | 3788 | continue; |
| 3763 | if (symnum < mod->num_symtab) { | 3789 | kallsyms = rcu_dereference_sched(mod->kallsyms); |
| 3764 | *value = mod->symtab[symnum].st_value; | 3790 | if (symnum < kallsyms->num_symtab) { |
| 3765 | *type = mod->symtab[symnum].st_info; | 3791 | *value = kallsyms->symtab[symnum].st_value; |
| 3766 | strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, | 3792 | *type = kallsyms->symtab[symnum].st_info; |
| 3767 | KSYM_NAME_LEN); | 3793 | strlcpy(name, symname(kallsyms, symnum), KSYM_NAME_LEN); |
| 3768 | strlcpy(module_name, mod->name, MODULE_NAME_LEN); | 3794 | strlcpy(module_name, mod->name, MODULE_NAME_LEN); |
| 3769 | *exported = is_exported(name, *value, mod); | 3795 | *exported = is_exported(name, *value, mod); |
| 3770 | preempt_enable(); | 3796 | preempt_enable(); |
| 3771 | return 0; | 3797 | return 0; |
| 3772 | } | 3798 | } |
| 3773 | symnum -= mod->num_symtab; | 3799 | symnum -= kallsyms->num_symtab; |
| 3774 | } | 3800 | } |
| 3775 | preempt_enable(); | 3801 | preempt_enable(); |
| 3776 | return -ERANGE; | 3802 | return -ERANGE; |
| @@ -3779,11 +3805,12 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | |||
| 3779 | static unsigned long mod_find_symname(struct module *mod, const char *name) | 3805 | static unsigned long mod_find_symname(struct module *mod, const char *name) |
| 3780 | { | 3806 | { |
| 3781 | unsigned int i; | 3807 | unsigned int i; |
| 3808 | struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); | ||
| 3782 | 3809 | ||
| 3783 | for (i = 0; i < mod->num_symtab; i++) | 3810 | for (i = 0; i < kallsyms->num_symtab; i++) |
| 3784 | if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 && | 3811 | if (strcmp(name, symname(kallsyms, i)) == 0 && |
| 3785 | mod->symtab[i].st_info != 'U') | 3812 | kallsyms->symtab[i].st_info != 'U') |
| 3786 | return mod->symtab[i].st_value; | 3813 | return kallsyms->symtab[i].st_value; |
| 3787 | return 0; | 3814 | return 0; |
| 3788 | } | 3815 | } |
| 3789 | 3816 | ||
| @@ -3822,11 +3849,14 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | |||
| 3822 | module_assert_mutex(); | 3849 | module_assert_mutex(); |
| 3823 | 3850 | ||
| 3824 | list_for_each_entry(mod, &modules, list) { | 3851 | list_for_each_entry(mod, &modules, list) { |
| 3852 | /* We hold module_mutex: no need for rcu_dereference_sched */ | ||
| 3853 | struct mod_kallsyms *kallsyms = mod->kallsyms; | ||
| 3854 | |||
| 3825 | if (mod->state == MODULE_STATE_UNFORMED) | 3855 | if (mod->state == MODULE_STATE_UNFORMED) |
| 3826 | continue; | 3856 | continue; |
| 3827 | for (i = 0; i < mod->num_symtab; i++) { | 3857 | for (i = 0; i < kallsyms->num_symtab; i++) { |
| 3828 | ret = fn(data, mod->strtab + mod->symtab[i].st_name, | 3858 | ret = fn(data, symname(kallsyms, i), |
| 3829 | mod, mod->symtab[i].st_value); | 3859 | mod, kallsyms->symtab[i].st_value); |
| 3830 | if (ret != 0) | 3860 | if (ret != 0) |
| 3831 | return ret; | 3861 | return ret; |
| 3832 | } | 3862 | } |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 61a0264e28f9..7ff5dc7d2ac5 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -301,7 +301,23 @@ static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ | |||
| 301 | static LIST_HEAD(workqueues); /* PR: list of all workqueues */ | 301 | static LIST_HEAD(workqueues); /* PR: list of all workqueues */ |
| 302 | static bool workqueue_freezing; /* PL: have wqs started freezing? */ | 302 | static bool workqueue_freezing; /* PL: have wqs started freezing? */ |
| 303 | 303 | ||
| 304 | static cpumask_var_t wq_unbound_cpumask; /* PL: low level cpumask for all unbound wqs */ | 304 | /* PL: allowable cpus for unbound wqs and work items */ |
| 305 | static cpumask_var_t wq_unbound_cpumask; | ||
| 306 | |||
| 307 | /* CPU where unbound work was last round robin scheduled from this CPU */ | ||
| 308 | static DEFINE_PER_CPU(int, wq_rr_cpu_last); | ||
| 309 | |||
| 310 | /* | ||
| 311 | * Local execution of unbound work items is no longer guaranteed. The | ||
| 312 | * following always forces round-robin CPU selection on unbound work items | ||
| 313 | * to uncover usages which depend on it. | ||
| 314 | */ | ||
| 315 | #ifdef CONFIG_DEBUG_WQ_FORCE_RR_CPU | ||
| 316 | static bool wq_debug_force_rr_cpu = true; | ||
| 317 | #else | ||
| 318 | static bool wq_debug_force_rr_cpu = false; | ||
| 319 | #endif | ||
| 320 | module_param_named(debug_force_rr_cpu, wq_debug_force_rr_cpu, bool, 0644); | ||
| 305 | 321 | ||
| 306 | /* the per-cpu worker pools */ | 322 | /* the per-cpu worker pools */ |
| 307 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS], | 323 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS], |
| @@ -570,6 +586,16 @@ static struct pool_workqueue *unbound_pwq_by_node(struct workqueue_struct *wq, | |||
| 570 | int node) | 586 | int node) |
| 571 | { | 587 | { |
| 572 | assert_rcu_or_wq_mutex_or_pool_mutex(wq); | 588 | assert_rcu_or_wq_mutex_or_pool_mutex(wq); |
| 589 | |||
| 590 | /* | ||
| 591 | * XXX: @node can be NUMA_NO_NODE if CPU goes offline while a | ||
| 592 | * delayed item is pending. The plan is to keep CPU -> NODE | ||
| 593 | * mapping valid and stable across CPU on/offlines. Once that | ||
| 594 | * happens, this workaround can be removed. | ||
| 595 | */ | ||
| 596 | if (unlikely(node == NUMA_NO_NODE)) | ||
| 597 | return wq->dfl_pwq; | ||
| 598 | |||
| 573 | return rcu_dereference_raw(wq->numa_pwq_tbl[node]); | 599 | return rcu_dereference_raw(wq->numa_pwq_tbl[node]); |
| 574 | } | 600 | } |
| 575 | 601 | ||
| @@ -1298,6 +1324,39 @@ static bool is_chained_work(struct workqueue_struct *wq) | |||
| 1298 | return worker && worker->current_pwq->wq == wq; | 1324 | return worker && worker->current_pwq->wq == wq; |
| 1299 | } | 1325 | } |
| 1300 | 1326 | ||
| 1327 | /* | ||
| 1328 | * When queueing an unbound work item to a wq, prefer local CPU if allowed | ||
| 1329 | * by wq_unbound_cpumask. Otherwise, round robin among the allowed ones to | ||
| 1330 | * avoid perturbing sensitive tasks. | ||
| 1331 | */ | ||
| 1332 | static int wq_select_unbound_cpu(int cpu) | ||
| 1333 | { | ||
| 1334 | static bool printed_dbg_warning; | ||
| 1335 | int new_cpu; | ||
| 1336 | |||
| 1337 | if (likely(!wq_debug_force_rr_cpu)) { | ||
| 1338 | if (cpumask_test_cpu(cpu, wq_unbound_cpumask)) | ||
| 1339 | return cpu; | ||
| 1340 | } else if (!printed_dbg_warning) { | ||
| 1341 | pr_warn("workqueue: round-robin CPU selection forced, expect performance impact\n"); | ||
| 1342 | printed_dbg_warning = true; | ||
| 1343 | } | ||
| 1344 | |||
| 1345 | if (cpumask_empty(wq_unbound_cpumask)) | ||
| 1346 | return cpu; | ||
| 1347 | |||
| 1348 | new_cpu = __this_cpu_read(wq_rr_cpu_last); | ||
| 1349 | new_cpu = cpumask_next_and(new_cpu, wq_unbound_cpumask, cpu_online_mask); | ||
| 1350 | if (unlikely(new_cpu >= nr_cpu_ids)) { | ||
| 1351 | new_cpu = cpumask_first_and(wq_unbound_cpumask, cpu_online_mask); | ||
| 1352 | if (unlikely(new_cpu >= nr_cpu_ids)) | ||
| 1353 | return cpu; | ||
| 1354 | } | ||
| 1355 | __this_cpu_write(wq_rr_cpu_last, new_cpu); | ||
| 1356 | |||
| 1357 | return new_cpu; | ||
| 1358 | } | ||
| 1359 | |||
| 1301 | static void __queue_work(int cpu, struct workqueue_struct *wq, | 1360 | static void __queue_work(int cpu, struct workqueue_struct *wq, |
| 1302 | struct work_struct *work) | 1361 | struct work_struct *work) |
| 1303 | { | 1362 | { |
| @@ -1323,7 +1382,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, | |||
| 1323 | return; | 1382 | return; |
| 1324 | retry: | 1383 | retry: |
| 1325 | if (req_cpu == WORK_CPU_UNBOUND) | 1384 | if (req_cpu == WORK_CPU_UNBOUND) |
| 1326 | cpu = raw_smp_processor_id(); | 1385 | cpu = wq_select_unbound_cpu(raw_smp_processor_id()); |
| 1327 | 1386 | ||
| 1328 | /* pwq which will be used unless @work is executing elsewhere */ | 1387 | /* pwq which will be used unless @work is executing elsewhere */ |
| 1329 | if (!(wq->flags & WQ_UNBOUND)) | 1388 | if (!(wq->flags & WQ_UNBOUND)) |
| @@ -1464,13 +1523,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, | |||
| 1464 | timer_stats_timer_set_start_info(&dwork->timer); | 1523 | timer_stats_timer_set_start_info(&dwork->timer); |
| 1465 | 1524 | ||
| 1466 | dwork->wq = wq; | 1525 | dwork->wq = wq; |
| 1467 | /* timer isn't guaranteed to run in this cpu, record earlier */ | ||
| 1468 | if (cpu == WORK_CPU_UNBOUND) | ||
| 1469 | cpu = raw_smp_processor_id(); | ||
| 1470 | dwork->cpu = cpu; | 1526 | dwork->cpu = cpu; |
| 1471 | timer->expires = jiffies + delay; | 1527 | timer->expires = jiffies + delay; |
| 1472 | 1528 | ||
| 1473 | add_timer_on(timer, cpu); | 1529 | if (unlikely(cpu != WORK_CPU_UNBOUND)) |
| 1530 | add_timer_on(timer, cpu); | ||
| 1531 | else | ||
| 1532 | add_timer(timer); | ||
| 1474 | } | 1533 | } |
| 1475 | 1534 | ||
| 1476 | /** | 1535 | /** |
| @@ -2355,7 +2414,8 @@ static void check_flush_dependency(struct workqueue_struct *target_wq, | |||
| 2355 | WARN_ONCE(current->flags & PF_MEMALLOC, | 2414 | WARN_ONCE(current->flags & PF_MEMALLOC, |
| 2356 | "workqueue: PF_MEMALLOC task %d(%s) is flushing !WQ_MEM_RECLAIM %s:%pf", | 2415 | "workqueue: PF_MEMALLOC task %d(%s) is flushing !WQ_MEM_RECLAIM %s:%pf", |
| 2357 | current->pid, current->comm, target_wq->name, target_func); | 2416 | current->pid, current->comm, target_wq->name, target_func); |
| 2358 | WARN_ONCE(worker && (worker->current_pwq->wq->flags & WQ_MEM_RECLAIM), | 2417 | WARN_ONCE(worker && ((worker->current_pwq->wq->flags & |
| 2418 | (WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM), | ||
| 2359 | "workqueue: WQ_MEM_RECLAIM %s:%pf is flushing !WQ_MEM_RECLAIM %s:%pf", | 2419 | "workqueue: WQ_MEM_RECLAIM %s:%pf is flushing !WQ_MEM_RECLAIM %s:%pf", |
| 2360 | worker->current_pwq->wq->name, worker->current_func, | 2420 | worker->current_pwq->wq->name, worker->current_func, |
| 2361 | target_wq->name, target_func); | 2421 | target_wq->name, target_func); |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ecb9e75614bf..8bfd1aca7a3d 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -1400,6 +1400,21 @@ config RCU_EQS_DEBUG | |||
| 1400 | 1400 | ||
| 1401 | endmenu # "RCU Debugging" | 1401 | endmenu # "RCU Debugging" |
| 1402 | 1402 | ||
| 1403 | config DEBUG_WQ_FORCE_RR_CPU | ||
| 1404 | bool "Force round-robin CPU selection for unbound work items" | ||
| 1405 | depends on DEBUG_KERNEL | ||
| 1406 | default n | ||
| 1407 | help | ||
| 1408 | Workqueue used to implicitly guarantee that work items queued | ||
| 1409 | without explicit CPU specified are put on the local CPU. This | ||
| 1410 | guarantee is no longer true and while local CPU is still | ||
| 1411 | preferred work items may be put on foreign CPUs. Kernel | ||
| 1412 | parameter "workqueue.debug_force_rr_cpu" is added to force | ||
| 1413 | round-robin CPU selection to flush out usages which depend on the | ||
| 1414 | now broken guarantee. This config option enables the debug | ||
| 1415 | feature by default. When enabled, memory and cache locality will | ||
| 1416 | be impacted. | ||
| 1417 | |||
| 1403 | config DEBUG_BLOCK_EXT_DEVT | 1418 | config DEBUG_BLOCK_EXT_DEVT |
| 1404 | bool "Force extended block device numbers and spread them" | 1419 | bool "Force extended block device numbers and spread them" |
| 1405 | depends on DEBUG_KERNEL | 1420 | depends on DEBUG_KERNEL |
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 49518fb48cab..e07c1ba9ba13 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan | |||
| @@ -18,6 +18,8 @@ config UBSAN_SANITIZE_ALL | |||
| 18 | This option activates instrumentation for the entire kernel. | 18 | This option activates instrumentation for the entire kernel. |
| 19 | If you don't enable this option, you have to explicitly specify | 19 | If you don't enable this option, you have to explicitly specify |
| 20 | UBSAN_SANITIZE := y for the files/directories you want to check for UB. | 20 | UBSAN_SANITIZE := y for the files/directories you want to check for UB. |
| 21 | Enabling this option will get kernel image size increased | ||
| 22 | significantly. | ||
| 21 | 23 | ||
| 22 | config UBSAN_ALIGNMENT | 24 | config UBSAN_ALIGNMENT |
| 23 | bool "Enable checking of pointers alignment" | 25 | bool "Enable checking of pointers alignment" |
| @@ -25,5 +27,5 @@ config UBSAN_ALIGNMENT | |||
| 25 | default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS | 27 | default y if !HAVE_EFFICIENT_UNALIGNED_ACCESS |
| 26 | help | 28 | help |
| 27 | This option enables detection of unaligned memory accesses. | 29 | This option enables detection of unaligned memory accesses. |
| 28 | Enabling this option on architectures that support unalligned | 30 | Enabling this option on architectures that support unaligned |
| 29 | accesses may produce a lot of false positives. | 31 | accesses may produce a lot of false positives. |
diff --git a/lib/klist.c b/lib/klist.c index d74cf7a29afd..0507fa5d84c5 100644 --- a/lib/klist.c +++ b/lib/klist.c | |||
| @@ -282,9 +282,9 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i, | |||
| 282 | struct klist_node *n) | 282 | struct klist_node *n) |
| 283 | { | 283 | { |
| 284 | i->i_klist = k; | 284 | i->i_klist = k; |
| 285 | i->i_cur = n; | 285 | i->i_cur = NULL; |
| 286 | if (n) | 286 | if (n && kref_get_unless_zero(&n->n_ref)) |
| 287 | kref_get(&n->n_ref); | 287 | i->i_cur = n; |
| 288 | } | 288 | } |
| 289 | EXPORT_SYMBOL_GPL(klist_iter_init_node); | 289 | EXPORT_SYMBOL_GPL(klist_iter_init_node); |
| 290 | 290 | ||
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index bafa9933fa76..004fc70fc56a 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
| @@ -598,9 +598,9 @@ EXPORT_SYMBOL(sg_miter_next); | |||
| 598 | * | 598 | * |
| 599 | * Description: | 599 | * Description: |
| 600 | * Stops mapping iterator @miter. @miter should have been started | 600 | * Stops mapping iterator @miter. @miter should have been started |
| 601 | * started using sg_miter_start(). A stopped iteration can be | 601 | * using sg_miter_start(). A stopped iteration can be resumed by |
| 602 | * resumed by calling sg_miter_next() on it. This is useful when | 602 | * calling sg_miter_next() on it. This is useful when resources (kmap) |
| 603 | * resources (kmap) need to be released during iteration. | 603 | * need to be released during iteration. |
| 604 | * | 604 | * |
| 605 | * Context: | 605 | * Context: |
| 606 | * Preemption disabled if the SG_MITER_ATOMIC is set. Don't care | 606 | * Preemption disabled if the SG_MITER_ATOMIC is set. Don't care |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 48ff9c36644d..f44e178e6ede 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
| @@ -1590,22 +1590,23 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1590 | return buf; | 1590 | return buf; |
| 1591 | } | 1591 | } |
| 1592 | case 'K': | 1592 | case 'K': |
| 1593 | /* | ||
| 1594 | * %pK cannot be used in IRQ context because its test | ||
| 1595 | * for CAP_SYSLOG would be meaningless. | ||
| 1596 | */ | ||
| 1597 | if (kptr_restrict && (in_irq() || in_serving_softirq() || | ||
| 1598 | in_nmi())) { | ||
| 1599 | if (spec.field_width == -1) | ||
| 1600 | spec.field_width = default_width; | ||
| 1601 | return string(buf, end, "pK-error", spec); | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | switch (kptr_restrict) { | 1593 | switch (kptr_restrict) { |
| 1605 | case 0: | 1594 | case 0: |
| 1606 | /* Always print %pK values */ | 1595 | /* Always print %pK values */ |
| 1607 | break; | 1596 | break; |
| 1608 | case 1: { | 1597 | case 1: { |
| 1598 | const struct cred *cred; | ||
| 1599 | |||
| 1600 | /* | ||
| 1601 | * kptr_restrict==1 cannot be used in IRQ context | ||
| 1602 | * because its test for CAP_SYSLOG would be meaningless. | ||
| 1603 | */ | ||
| 1604 | if (in_irq() || in_serving_softirq() || in_nmi()) { | ||
| 1605 | if (spec.field_width == -1) | ||
| 1606 | spec.field_width = default_width; | ||
| 1607 | return string(buf, end, "pK-error", spec); | ||
| 1608 | } | ||
| 1609 | |||
| 1609 | /* | 1610 | /* |
| 1610 | * Only print the real pointer value if the current | 1611 | * Only print the real pointer value if the current |
| 1611 | * process has CAP_SYSLOG and is running with the | 1612 | * process has CAP_SYSLOG and is running with the |
| @@ -1615,8 +1616,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
| 1615 | * leak pointer values if a binary opens a file using | 1616 | * leak pointer values if a binary opens a file using |
| 1616 | * %pK and then elevates privileges before reading it. | 1617 | * %pK and then elevates privileges before reading it. |
| 1617 | */ | 1618 | */ |
| 1618 | const struct cred *cred = current_cred(); | 1619 | cred = current_cred(); |
| 1619 | |||
| 1620 | if (!has_capability_noaudit(current, CAP_SYSLOG) || | 1620 | if (!has_capability_noaudit(current, CAP_SYSLOG) || |
| 1621 | !uid_eq(cred->euid, cred->uid) || | 1621 | !uid_eq(cred->euid, cred->uid) || |
| 1622 | !gid_eq(cred->egid, cred->gid)) | 1622 | !gid_eq(cred->egid, cred->gid)) |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 926c76d56388..c554d173a65f 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
| @@ -328,7 +328,7 @@ static int wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi, | |||
| 328 | return 0; | 328 | return 0; |
| 329 | 329 | ||
| 330 | out_destroy_stat: | 330 | out_destroy_stat: |
| 331 | while (--i) | 331 | while (i--) |
| 332 | percpu_counter_destroy(&wb->stat[i]); | 332 | percpu_counter_destroy(&wb->stat[i]); |
| 333 | fprop_local_destroy_percpu(&wb->completions); | 333 | fprop_local_destroy_percpu(&wb->completions); |
| 334 | out_put_cong: | 334 | out_put_cong: |
diff --git a/mm/filemap.c b/mm/filemap.c index bc943867d68c..23edccecadb0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
| @@ -1890,6 +1890,7 @@ EXPORT_SYMBOL(generic_file_read_iter); | |||
| 1890 | * page_cache_read - adds requested page to the page cache if not already there | 1890 | * page_cache_read - adds requested page to the page cache if not already there |
| 1891 | * @file: file to read | 1891 | * @file: file to read |
| 1892 | * @offset: page index | 1892 | * @offset: page index |
| 1893 | * @gfp_mask: memory allocation flags | ||
| 1893 | * | 1894 | * |
| 1894 | * This adds the requested page to the page cache if it isn't already there, | 1895 | * This adds the requested page to the page cache if it isn't already there, |
| 1895 | * and schedules an I/O to read in its contents from disk. | 1896 | * and schedules an I/O to read in its contents from disk. |
diff --git a/mm/mprotect.c b/mm/mprotect.c index 8eb7bb40dc40..f7cb3d4d9c2e 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
| @@ -160,9 +160,11 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma, | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { | 162 | if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { |
| 163 | if (next - addr != HPAGE_PMD_SIZE) | 163 | if (next - addr != HPAGE_PMD_SIZE) { |
| 164 | split_huge_pmd(vma, pmd, addr); | 164 | split_huge_pmd(vma, pmd, addr); |
| 165 | else { | 165 | if (pmd_none(*pmd)) |
| 166 | continue; | ||
| 167 | } else { | ||
| 166 | int nr_ptes = change_huge_pmd(vma, pmd, addr, | 168 | int nr_ptes = change_huge_pmd(vma, pmd, addr, |
| 167 | newprot, prot_numa); | 169 | newprot, prot_numa); |
| 168 | 170 | ||
diff --git a/mm/mremap.c b/mm/mremap.c index d77946a997f7..8eeba02fc991 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
| @@ -210,6 +210,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma, | |||
| 210 | } | 210 | } |
| 211 | } | 211 | } |
| 212 | split_huge_pmd(vma, old_pmd, old_addr); | 212 | split_huge_pmd(vma, old_pmd, old_addr); |
| 213 | if (pmd_none(*old_pmd)) | ||
| 214 | continue; | ||
| 213 | VM_BUG_ON(pmd_trans_huge(*old_pmd)); | 215 | VM_BUG_ON(pmd_trans_huge(*old_pmd)); |
| 214 | } | 216 | } |
| 215 | if (pmd_none(*new_pmd) && __pte_alloc(new_vma->vm_mm, new_vma, | 217 | if (pmd_none(*new_pmd) && __pte_alloc(new_vma->vm_mm, new_vma, |
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 9d4767698a1c..06a005b979a7 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c | |||
| @@ -90,9 +90,9 @@ pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address, | |||
| 90 | * ARCHes with special requirements for evicting THP backing TLB entries can | 90 | * ARCHes with special requirements for evicting THP backing TLB entries can |
| 91 | * implement this. Otherwise also, it can help optimize normal TLB flush in | 91 | * implement this. Otherwise also, it can help optimize normal TLB flush in |
| 92 | * THP regime. stock flush_tlb_range() typically has optimization to nuke the | 92 | * THP regime. stock flush_tlb_range() typically has optimization to nuke the |
| 93 | * entire TLB TLB if flush span is greater than a threshhold, which will | 93 | * entire TLB if flush span is greater than a threshold, which will |
| 94 | * likely be true for a single huge page. Thus a single thp flush will | 94 | * likely be true for a single huge page. Thus a single thp flush will |
| 95 | * invalidate the entire TLB which is not desitable. | 95 | * invalidate the entire TLB which is not desirable. |
| 96 | * e.g. see arch/arc: flush_pmd_tlb_range | 96 | * e.g. see arch/arc: flush_pmd_tlb_range |
| 97 | */ | 97 | */ |
| 98 | #define flush_pmd_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end) | 98 | #define flush_pmd_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end) |
| @@ -195,7 +195,9 @@ pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address, | |||
| 195 | VM_BUG_ON(address & ~HPAGE_PMD_MASK); | 195 | VM_BUG_ON(address & ~HPAGE_PMD_MASK); |
| 196 | VM_BUG_ON(pmd_trans_huge(*pmdp)); | 196 | VM_BUG_ON(pmd_trans_huge(*pmdp)); |
| 197 | pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp); | 197 | pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp); |
| 198 | flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE); | 198 | |
| 199 | /* collapse entails shooting down ptes not pmd */ | ||
| 200 | flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE); | ||
| 199 | return pmd; | 201 | return pmd; |
| 200 | } | 202 | } |
| 201 | #endif | 203 | #endif |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index d79699c9d1b9..eab81bc80e5c 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
| @@ -208,7 +208,6 @@ ip: | |||
| 208 | case htons(ETH_P_IPV6): { | 208 | case htons(ETH_P_IPV6): { |
| 209 | const struct ipv6hdr *iph; | 209 | const struct ipv6hdr *iph; |
| 210 | struct ipv6hdr _iph; | 210 | struct ipv6hdr _iph; |
| 211 | __be32 flow_label; | ||
| 212 | 211 | ||
| 213 | ipv6: | 212 | ipv6: |
| 214 | iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph); | 213 | iph = __skb_header_pointer(skb, nhoff, sizeof(_iph), data, hlen, &_iph); |
| @@ -230,8 +229,12 @@ ipv6: | |||
| 230 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; | 229 | key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 233 | flow_label = ip6_flowlabel(iph); | 232 | if ((dissector_uses_key(flow_dissector, |
| 234 | if (flow_label) { | 233 | FLOW_DISSECTOR_KEY_FLOW_LABEL) || |
| 234 | (flags & FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL)) && | ||
| 235 | ip6_flowlabel(iph)) { | ||
| 236 | __be32 flow_label = ip6_flowlabel(iph); | ||
| 237 | |||
| 235 | if (dissector_uses_key(flow_dissector, | 238 | if (dissector_uses_key(flow_dissector, |
| 236 | FLOW_DISSECTOR_KEY_FLOW_LABEL)) { | 239 | FLOW_DISSECTOR_KEY_FLOW_LABEL)) { |
| 237 | key_tags = skb_flow_dissector_target(flow_dissector, | 240 | key_tags = skb_flow_dissector_target(flow_dissector, |
diff --git a/net/core/scm.c b/net/core/scm.c index 14596fb37172..2696aefdc148 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
| @@ -87,6 +87,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
| 87 | *fplp = fpl; | 87 | *fplp = fpl; |
| 88 | fpl->count = 0; | 88 | fpl->count = 0; |
| 89 | fpl->max = SCM_MAX_FD; | 89 | fpl->max = SCM_MAX_FD; |
| 90 | fpl->user = NULL; | ||
| 90 | } | 91 | } |
| 91 | fpp = &fpl->fp[fpl->count]; | 92 | fpp = &fpl->fp[fpl->count]; |
| 92 | 93 | ||
| @@ -107,6 +108,10 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
| 107 | *fpp++ = file; | 108 | *fpp++ = file; |
| 108 | fpl->count++; | 109 | fpl->count++; |
| 109 | } | 110 | } |
| 111 | |||
| 112 | if (!fpl->user) | ||
| 113 | fpl->user = get_uid(current_user()); | ||
| 114 | |||
| 110 | return num; | 115 | return num; |
| 111 | } | 116 | } |
| 112 | 117 | ||
| @@ -119,6 +124,7 @@ void __scm_destroy(struct scm_cookie *scm) | |||
| 119 | scm->fp = NULL; | 124 | scm->fp = NULL; |
| 120 | for (i=fpl->count-1; i>=0; i--) | 125 | for (i=fpl->count-1; i>=0; i--) |
| 121 | fput(fpl->fp[i]); | 126 | fput(fpl->fp[i]); |
| 127 | free_uid(fpl->user); | ||
| 122 | kfree(fpl); | 128 | kfree(fpl); |
| 123 | } | 129 | } |
| 124 | } | 130 | } |
| @@ -336,6 +342,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) | |||
| 336 | for (i = 0; i < fpl->count; i++) | 342 | for (i = 0; i < fpl->count; i++) |
| 337 | get_file(fpl->fp[i]); | 343 | get_file(fpl->fp[i]); |
| 338 | new_fpl->max = new_fpl->count; | 344 | new_fpl->max = new_fpl->count; |
| 345 | new_fpl->user = get_uid(fpl->user); | ||
| 339 | } | 346 | } |
| 340 | return new_fpl; | 347 | return new_fpl; |
| 341 | } | 348 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b2df375ec9c2..5bf88f58bee7 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -79,6 +79,8 @@ | |||
| 79 | 79 | ||
| 80 | struct kmem_cache *skbuff_head_cache __read_mostly; | 80 | struct kmem_cache *skbuff_head_cache __read_mostly; |
| 81 | static struct kmem_cache *skbuff_fclone_cache __read_mostly; | 81 | static struct kmem_cache *skbuff_fclone_cache __read_mostly; |
| 82 | int sysctl_max_skb_frags __read_mostly = MAX_SKB_FRAGS; | ||
| 83 | EXPORT_SYMBOL(sysctl_max_skb_frags); | ||
| 82 | 84 | ||
| 83 | /** | 85 | /** |
| 84 | * skb_panic - private function for out-of-line support | 86 | * skb_panic - private function for out-of-line support |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 95b6139d710c..a6beb7b6ae55 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
| @@ -26,6 +26,7 @@ static int zero = 0; | |||
| 26 | static int one = 1; | 26 | static int one = 1; |
| 27 | static int min_sndbuf = SOCK_MIN_SNDBUF; | 27 | static int min_sndbuf = SOCK_MIN_SNDBUF; |
| 28 | static int min_rcvbuf = SOCK_MIN_RCVBUF; | 28 | static int min_rcvbuf = SOCK_MIN_RCVBUF; |
| 29 | static int max_skb_frags = MAX_SKB_FRAGS; | ||
| 29 | 30 | ||
| 30 | static int net_msg_warn; /* Unused, but still a sysctl */ | 31 | static int net_msg_warn; /* Unused, but still a sysctl */ |
| 31 | 32 | ||
| @@ -392,6 +393,15 @@ static struct ctl_table net_core_table[] = { | |||
| 392 | .mode = 0644, | 393 | .mode = 0644, |
| 393 | .proc_handler = proc_dointvec | 394 | .proc_handler = proc_dointvec |
| 394 | }, | 395 | }, |
| 396 | { | ||
| 397 | .procname = "max_skb_frags", | ||
| 398 | .data = &sysctl_max_skb_frags, | ||
| 399 | .maxlen = sizeof(int), | ||
| 400 | .mode = 0644, | ||
| 401 | .proc_handler = proc_dointvec_minmax, | ||
| 402 | .extra1 = &one, | ||
| 403 | .extra2 = &max_skb_frags, | ||
| 404 | }, | ||
| 395 | { } | 405 | { } |
| 396 | }; | 406 | }; |
| 397 | 407 | ||
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 7c51c4e1661f..56fdf4e0dce4 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
| @@ -1240,6 +1240,14 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, | |||
| 1240 | err = ipgre_newlink(net, dev, tb, NULL); | 1240 | err = ipgre_newlink(net, dev, tb, NULL); |
| 1241 | if (err < 0) | 1241 | if (err < 0) |
| 1242 | goto out; | 1242 | goto out; |
| 1243 | |||
| 1244 | /* openvswitch users expect packet sizes to be unrestricted, | ||
| 1245 | * so set the largest MTU we can. | ||
| 1246 | */ | ||
| 1247 | err = __ip_tunnel_change_mtu(dev, IP_MAX_MTU, false); | ||
| 1248 | if (err) | ||
| 1249 | goto out; | ||
| 1250 | |||
| 1243 | return dev; | 1251 | return dev; |
| 1244 | out: | 1252 | out: |
| 1245 | free_netdev(dev); | 1253 | free_netdev(dev); |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index c7bd72e9b544..89e8861e05fc 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
| @@ -943,17 +943,31 @@ done: | |||
| 943 | } | 943 | } |
| 944 | EXPORT_SYMBOL_GPL(ip_tunnel_ioctl); | 944 | EXPORT_SYMBOL_GPL(ip_tunnel_ioctl); |
| 945 | 945 | ||
| 946 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu) | 946 | int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict) |
| 947 | { | 947 | { |
| 948 | struct ip_tunnel *tunnel = netdev_priv(dev); | 948 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 949 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); | 949 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); |
| 950 | int max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen; | ||
| 950 | 951 | ||
| 951 | if (new_mtu < 68 || | 952 | if (new_mtu < 68) |
| 952 | new_mtu > 0xFFF8 - dev->hard_header_len - t_hlen) | ||
| 953 | return -EINVAL; | 953 | return -EINVAL; |
| 954 | |||
| 955 | if (new_mtu > max_mtu) { | ||
| 956 | if (strict) | ||
| 957 | return -EINVAL; | ||
| 958 | |||
| 959 | new_mtu = max_mtu; | ||
| 960 | } | ||
| 961 | |||
| 954 | dev->mtu = new_mtu; | 962 | dev->mtu = new_mtu; |
| 955 | return 0; | 963 | return 0; |
| 956 | } | 964 | } |
| 965 | EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu); | ||
| 966 | |||
| 967 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu) | ||
| 968 | { | ||
| 969 | return __ip_tunnel_change_mtu(dev, new_mtu, true); | ||
| 970 | } | ||
| 957 | EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu); | 971 | EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu); |
| 958 | 972 | ||
| 959 | static void ip_tunnel_dev_free(struct net_device *dev) | 973 | static void ip_tunnel_dev_free(struct net_device *dev) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 19746b3fcbbe..0c36ef4a3f86 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -940,7 +940,7 @@ new_segment: | |||
| 940 | 940 | ||
| 941 | i = skb_shinfo(skb)->nr_frags; | 941 | i = skb_shinfo(skb)->nr_frags; |
| 942 | can_coalesce = skb_can_coalesce(skb, i, page, offset); | 942 | can_coalesce = skb_can_coalesce(skb, i, page, offset); |
| 943 | if (!can_coalesce && i >= MAX_SKB_FRAGS) { | 943 | if (!can_coalesce && i >= sysctl_max_skb_frags) { |
| 944 | tcp_mark_push(tp, skb); | 944 | tcp_mark_push(tp, skb); |
| 945 | goto new_segment; | 945 | goto new_segment; |
| 946 | } | 946 | } |
| @@ -1213,7 +1213,7 @@ new_segment: | |||
| 1213 | 1213 | ||
| 1214 | if (!skb_can_coalesce(skb, i, pfrag->page, | 1214 | if (!skb_can_coalesce(skb, i, pfrag->page, |
| 1215 | pfrag->offset)) { | 1215 | pfrag->offset)) { |
| 1216 | if (i == MAX_SKB_FRAGS || !sg) { | 1216 | if (i == sysctl_max_skb_frags || !sg) { |
| 1217 | tcp_mark_push(tp, skb); | 1217 | tcp_mark_push(tp, skb); |
| 1218 | goto new_segment; | 1218 | goto new_segment; |
| 1219 | } | 1219 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a4d523709ab3..7f6ff037adaf 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -311,7 +311,7 @@ static void do_redirect(struct sk_buff *skb, struct sock *sk) | |||
| 311 | 311 | ||
| 312 | 312 | ||
| 313 | /* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ | 313 | /* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ |
| 314 | void tcp_req_err(struct sock *sk, u32 seq) | 314 | void tcp_req_err(struct sock *sk, u32 seq, bool abort) |
| 315 | { | 315 | { |
| 316 | struct request_sock *req = inet_reqsk(sk); | 316 | struct request_sock *req = inet_reqsk(sk); |
| 317 | struct net *net = sock_net(sk); | 317 | struct net *net = sock_net(sk); |
| @@ -323,7 +323,7 @@ void tcp_req_err(struct sock *sk, u32 seq) | |||
| 323 | 323 | ||
| 324 | if (seq != tcp_rsk(req)->snt_isn) { | 324 | if (seq != tcp_rsk(req)->snt_isn) { |
| 325 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); | 325 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); |
| 326 | } else { | 326 | } else if (abort) { |
| 327 | /* | 327 | /* |
| 328 | * Still in SYN_RECV, just remove it silently. | 328 | * Still in SYN_RECV, just remove it silently. |
| 329 | * There is no good way to pass the error to the newly | 329 | * There is no good way to pass the error to the newly |
| @@ -383,7 +383,12 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
| 383 | } | 383 | } |
| 384 | seq = ntohl(th->seq); | 384 | seq = ntohl(th->seq); |
| 385 | if (sk->sk_state == TCP_NEW_SYN_RECV) | 385 | if (sk->sk_state == TCP_NEW_SYN_RECV) |
| 386 | return tcp_req_err(sk, seq); | 386 | return tcp_req_err(sk, seq, |
| 387 | type == ICMP_PARAMETERPROB || | ||
| 388 | type == ICMP_TIME_EXCEEDED || | ||
| 389 | (type == ICMP_DEST_UNREACH && | ||
| 390 | (code == ICMP_NET_UNREACH || | ||
| 391 | code == ICMP_HOST_UNREACH))); | ||
| 387 | 392 | ||
| 388 | bh_lock_sock(sk); | 393 | bh_lock_sock(sk); |
| 389 | /* If too many ICMPs get dropped on busy | 394 | /* If too many ICMPs get dropped on busy |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 38eeddedfc21..9efd9ffdc34c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -3538,6 +3538,7 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
| 3538 | { | 3538 | { |
| 3539 | struct inet6_dev *idev = ifp->idev; | 3539 | struct inet6_dev *idev = ifp->idev; |
| 3540 | struct net_device *dev = idev->dev; | 3540 | struct net_device *dev = idev->dev; |
| 3541 | bool notify = false; | ||
| 3541 | 3542 | ||
| 3542 | addrconf_join_solict(dev, &ifp->addr); | 3543 | addrconf_join_solict(dev, &ifp->addr); |
| 3543 | 3544 | ||
| @@ -3583,7 +3584,7 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
| 3583 | /* Because optimistic nodes can use this address, | 3584 | /* Because optimistic nodes can use this address, |
| 3584 | * notify listeners. If DAD fails, RTM_DELADDR is sent. | 3585 | * notify listeners. If DAD fails, RTM_DELADDR is sent. |
| 3585 | */ | 3586 | */ |
| 3586 | ipv6_ifa_notify(RTM_NEWADDR, ifp); | 3587 | notify = true; |
| 3587 | } | 3588 | } |
| 3588 | } | 3589 | } |
| 3589 | 3590 | ||
| @@ -3591,6 +3592,8 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) | |||
| 3591 | out: | 3592 | out: |
| 3592 | spin_unlock(&ifp->lock); | 3593 | spin_unlock(&ifp->lock); |
| 3593 | read_unlock_bh(&idev->lock); | 3594 | read_unlock_bh(&idev->lock); |
| 3595 | if (notify) | ||
| 3596 | ipv6_ifa_notify(RTM_NEWADDR, ifp); | ||
| 3594 | } | 3597 | } |
| 3595 | 3598 | ||
| 3596 | static void addrconf_dad_start(struct inet6_ifaddr *ifp) | 3599 | static void addrconf_dad_start(struct inet6_ifaddr *ifp) |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 1f9ebe3cbb4a..dc2db4f7b182 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
| @@ -540,12 +540,13 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) | |||
| 540 | } | 540 | } |
| 541 | spin_lock_bh(&ip6_sk_fl_lock); | 541 | spin_lock_bh(&ip6_sk_fl_lock); |
| 542 | for (sflp = &np->ipv6_fl_list; | 542 | for (sflp = &np->ipv6_fl_list; |
| 543 | (sfl = rcu_dereference(*sflp)) != NULL; | 543 | (sfl = rcu_dereference_protected(*sflp, |
| 544 | lockdep_is_held(&ip6_sk_fl_lock))) != NULL; | ||
| 544 | sflp = &sfl->next) { | 545 | sflp = &sfl->next) { |
| 545 | if (sfl->fl->label == freq.flr_label) { | 546 | if (sfl->fl->label == freq.flr_label) { |
| 546 | if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) | 547 | if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK)) |
| 547 | np->flow_label &= ~IPV6_FLOWLABEL_MASK; | 548 | np->flow_label &= ~IPV6_FLOWLABEL_MASK; |
| 548 | *sflp = rcu_dereference(sfl->next); | 549 | *sflp = sfl->next; |
| 549 | spin_unlock_bh(&ip6_sk_fl_lock); | 550 | spin_unlock_bh(&ip6_sk_fl_lock); |
| 550 | fl_release(sfl->fl); | 551 | fl_release(sfl->fl); |
| 551 | kfree_rcu(sfl, rcu); | 552 | kfree_rcu(sfl, rcu); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 006396e31cb0..1a5a70fb8551 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -327,6 +327,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 327 | struct tcp_sock *tp; | 327 | struct tcp_sock *tp; |
| 328 | __u32 seq, snd_una; | 328 | __u32 seq, snd_una; |
| 329 | struct sock *sk; | 329 | struct sock *sk; |
| 330 | bool fatal; | ||
| 330 | int err; | 331 | int err; |
| 331 | 332 | ||
| 332 | sk = __inet6_lookup_established(net, &tcp_hashinfo, | 333 | sk = __inet6_lookup_established(net, &tcp_hashinfo, |
| @@ -345,8 +346,9 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 345 | return; | 346 | return; |
| 346 | } | 347 | } |
| 347 | seq = ntohl(th->seq); | 348 | seq = ntohl(th->seq); |
| 349 | fatal = icmpv6_err_convert(type, code, &err); | ||
| 348 | if (sk->sk_state == TCP_NEW_SYN_RECV) | 350 | if (sk->sk_state == TCP_NEW_SYN_RECV) |
| 349 | return tcp_req_err(sk, seq); | 351 | return tcp_req_err(sk, seq, fatal); |
| 350 | 352 | ||
| 351 | bh_lock_sock(sk); | 353 | bh_lock_sock(sk); |
| 352 | if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG) | 354 | if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG) |
| @@ -400,7 +402,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 400 | goto out; | 402 | goto out; |
| 401 | } | 403 | } |
| 402 | 404 | ||
| 403 | icmpv6_err_convert(type, code, &err); | ||
| 404 | 405 | ||
| 405 | /* Might be for an request_sock */ | 406 | /* Might be for an request_sock */ |
| 406 | switch (sk->sk_state) { | 407 | switch (sk->sk_state) { |
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c index 1605691d9414..de9cb19efb6a 100644 --- a/net/openvswitch/vport-vxlan.c +++ b/net/openvswitch/vport-vxlan.c | |||
| @@ -91,6 +91,8 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms) | |||
| 91 | struct vxlan_config conf = { | 91 | struct vxlan_config conf = { |
| 92 | .no_share = true, | 92 | .no_share = true, |
| 93 | .flags = VXLAN_F_COLLECT_METADATA, | 93 | .flags = VXLAN_F_COLLECT_METADATA, |
| 94 | /* Don't restrict the packets that can be sent by MTU */ | ||
| 95 | .mtu = IP_MAX_MTU, | ||
| 94 | }; | 96 | }; |
| 95 | 97 | ||
| 96 | if (!options) { | 98 | if (!options) { |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 5ca2ebfe0be8..e878da0949db 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -5538,6 +5538,7 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | |||
| 5538 | struct sctp_hmac_algo_param *hmacs; | 5538 | struct sctp_hmac_algo_param *hmacs; |
| 5539 | __u16 data_len = 0; | 5539 | __u16 data_len = 0; |
| 5540 | u32 num_idents; | 5540 | u32 num_idents; |
| 5541 | int i; | ||
| 5541 | 5542 | ||
| 5542 | if (!ep->auth_enable) | 5543 | if (!ep->auth_enable) |
| 5543 | return -EACCES; | 5544 | return -EACCES; |
| @@ -5555,8 +5556,12 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, | |||
| 5555 | return -EFAULT; | 5556 | return -EFAULT; |
| 5556 | if (put_user(num_idents, &p->shmac_num_idents)) | 5557 | if (put_user(num_idents, &p->shmac_num_idents)) |
| 5557 | return -EFAULT; | 5558 | return -EFAULT; |
| 5558 | if (copy_to_user(p->shmac_idents, hmacs->hmac_ids, data_len)) | 5559 | for (i = 0; i < num_idents; i++) { |
| 5559 | return -EFAULT; | 5560 | __u16 hmacid = ntohs(hmacs->hmac_ids[i]); |
| 5561 | |||
| 5562 | if (copy_to_user(&p->shmac_idents[i], &hmacid, sizeof(__u16))) | ||
| 5563 | return -EFAULT; | ||
| 5564 | } | ||
| 5560 | return 0; | 5565 | return 0; |
| 5561 | } | 5566 | } |
| 5562 | 5567 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 49d5093eb055..29be035f9c65 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
| 1496 | UNIXCB(skb).fp = NULL; | 1496 | UNIXCB(skb).fp = NULL; |
| 1497 | 1497 | ||
| 1498 | for (i = scm->fp->count-1; i >= 0; i--) | 1498 | for (i = scm->fp->count-1; i >= 0; i--) |
| 1499 | unix_notinflight(scm->fp->fp[i]); | 1499 | unix_notinflight(scm->fp->user, scm->fp->fp[i]); |
| 1500 | } | 1500 | } |
| 1501 | 1501 | ||
| 1502 | static void unix_destruct_scm(struct sk_buff *skb) | 1502 | static void unix_destruct_scm(struct sk_buff *skb) |
| @@ -1561,7 +1561,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
| 1561 | return -ENOMEM; | 1561 | return -ENOMEM; |
| 1562 | 1562 | ||
| 1563 | for (i = scm->fp->count - 1; i >= 0; i--) | 1563 | for (i = scm->fp->count - 1; i >= 0; i--) |
| 1564 | unix_inflight(scm->fp->fp[i]); | 1564 | unix_inflight(scm->fp->user, scm->fp->fp[i]); |
| 1565 | return max_level; | 1565 | return max_level; |
| 1566 | } | 1566 | } |
| 1567 | 1567 | ||
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 8fcdc2283af5..6a0d48525fcf 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
| @@ -116,7 +116,7 @@ struct sock *unix_get_socket(struct file *filp) | |||
| 116 | * descriptor if it is for an AF_UNIX socket. | 116 | * descriptor if it is for an AF_UNIX socket. |
| 117 | */ | 117 | */ |
| 118 | 118 | ||
| 119 | void unix_inflight(struct file *fp) | 119 | void unix_inflight(struct user_struct *user, struct file *fp) |
| 120 | { | 120 | { |
| 121 | struct sock *s = unix_get_socket(fp); | 121 | struct sock *s = unix_get_socket(fp); |
| 122 | 122 | ||
| @@ -133,11 +133,11 @@ void unix_inflight(struct file *fp) | |||
| 133 | } | 133 | } |
| 134 | unix_tot_inflight++; | 134 | unix_tot_inflight++; |
| 135 | } | 135 | } |
| 136 | fp->f_cred->user->unix_inflight++; | 136 | user->unix_inflight++; |
| 137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | void unix_notinflight(struct file *fp) | 140 | void unix_notinflight(struct user_struct *user, struct file *fp) |
| 141 | { | 141 | { |
| 142 | struct sock *s = unix_get_socket(fp); | 142 | struct sock *s = unix_get_socket(fp); |
| 143 | 143 | ||
| @@ -152,7 +152,7 @@ void unix_notinflight(struct file *fp) | |||
| 152 | list_del_init(&u->link); | 152 | list_del_init(&u->link); |
| 153 | unix_tot_inflight--; | 153 | unix_tot_inflight--; |
| 154 | } | 154 | } |
| 155 | fp->f_cred->user->unix_inflight--; | 155 | user->unix_inflight--; |
| 156 | spin_unlock(&unix_gc_lock); | 156 | spin_unlock(&unix_gc_lock); |
| 157 | } | 157 | } |
| 158 | 158 | ||
diff --git a/scripts/prune-kernel b/scripts/prune-kernel new file mode 100755 index 000000000000..ab5034e1d081 --- /dev/null +++ b/scripts/prune-kernel | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and | ||
| 4 | # again, /boot and /lib/modules/ eventually fill up. | ||
| 5 | # Dumb script to purge that stuff: | ||
| 6 | |||
| 7 | for f in "$@" | ||
| 8 | do | ||
| 9 | if rpm -qf "/lib/modules/$f" >/dev/null; then | ||
| 10 | echo "keeping $f (installed from rpm)" | ||
| 11 | elif [ $(uname -r) = "$f" ]; then | ||
| 12 | echo "keeping $f (running kernel) " | ||
| 13 | else | ||
| 14 | echo "removing $f" | ||
| 15 | rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" | ||
| 16 | rm -f "/boot/vmlinuz-$f" "/boot/config-$f" | ||
| 17 | rm -rf "/lib/modules/$f" | ||
| 18 | new-kernel-pkg --remove $f | ||
| 19 | fi | ||
| 20 | done | ||
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index f7160253f17f..e6ea9d4b1de9 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/integrity.h> | 23 | #include <linux/integrity.h> |
| 24 | #include <linux/evm.h> | 24 | #include <linux/evm.h> |
| 25 | #include <crypto/hash.h> | 25 | #include <crypto/hash.h> |
| 26 | #include <crypto/algapi.h> | ||
| 26 | #include "evm.h" | 27 | #include "evm.h" |
| 27 | 28 | ||
| 28 | int evm_initialized; | 29 | int evm_initialized; |
| @@ -148,7 +149,7 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, | |||
| 148 | xattr_value_len, calc.digest); | 149 | xattr_value_len, calc.digest); |
| 149 | if (rc) | 150 | if (rc) |
| 150 | break; | 151 | break; |
| 151 | rc = memcmp(xattr_data->digest, calc.digest, | 152 | rc = crypto_memneq(xattr_data->digest, calc.digest, |
| 152 | sizeof(calc.digest)); | 153 | sizeof(calc.digest)); |
| 153 | if (rc) | 154 | if (rc) |
| 154 | rc = -EINVAL; | 155 | rc = -EINVAL; |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 2bbb41822d8e..8495b9368190 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
| @@ -83,6 +83,7 @@ static struct nlmsg_perm nlmsg_tcpdiag_perms[] = | |||
| 83 | { TCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | 83 | { TCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, |
| 84 | { DCCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | 84 | { DCCPDIAG_GETSOCK, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, |
| 85 | { SOCK_DIAG_BY_FAMILY, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, | 85 | { SOCK_DIAG_BY_FAMILY, NETLINK_TCPDIAG_SOCKET__NLMSG_READ }, |
| 86 | { SOCK_DESTROY, NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE }, | ||
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| 88 | static struct nlmsg_perm nlmsg_xfrm_perms[] = | 89 | static struct nlmsg_perm nlmsg_xfrm_perms[] = |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 9b513a05765a..dca817fc7894 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
| @@ -422,7 +422,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) | |||
| 422 | spin_lock_irqsave(&timer->lock, flags); | 422 | spin_lock_irqsave(&timer->lock, flags); |
| 423 | list_for_each_entry(ts, &ti->slave_active_head, active_list) | 423 | list_for_each_entry(ts, &ti->slave_active_head, active_list) |
| 424 | if (ts->ccallback) | 424 | if (ts->ccallback) |
| 425 | ts->ccallback(ti, event + 100, &tstamp, resolution); | 425 | ts->ccallback(ts, event + 100, &tstamp, resolution); |
| 426 | spin_unlock_irqrestore(&timer->lock, flags); | 426 | spin_unlock_irqrestore(&timer->lock, flags); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| @@ -518,9 +518,13 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri, int event) | |||
| 518 | spin_unlock_irqrestore(&slave_active_lock, flags); | 518 | spin_unlock_irqrestore(&slave_active_lock, flags); |
| 519 | return -EBUSY; | 519 | return -EBUSY; |
| 520 | } | 520 | } |
| 521 | if (timeri->timer) | ||
| 522 | spin_lock(&timeri->timer->lock); | ||
| 521 | timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; | 523 | timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; |
| 522 | list_del_init(&timeri->ack_list); | 524 | list_del_init(&timeri->ack_list); |
| 523 | list_del_init(&timeri->active_list); | 525 | list_del_init(&timeri->active_list); |
| 526 | if (timeri->timer) | ||
| 527 | spin_unlock(&timeri->timer->lock); | ||
| 524 | spin_unlock_irqrestore(&slave_active_lock, flags); | 528 | spin_unlock_irqrestore(&slave_active_lock, flags); |
| 525 | goto __end; | 529 | goto __end; |
| 526 | } | 530 | } |
| @@ -1929,6 +1933,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, | |||
| 1929 | { | 1933 | { |
| 1930 | struct snd_timer_user *tu; | 1934 | struct snd_timer_user *tu; |
| 1931 | long result = 0, unit; | 1935 | long result = 0, unit; |
| 1936 | int qhead; | ||
| 1932 | int err = 0; | 1937 | int err = 0; |
| 1933 | 1938 | ||
| 1934 | tu = file->private_data; | 1939 | tu = file->private_data; |
| @@ -1940,7 +1945,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, | |||
| 1940 | 1945 | ||
| 1941 | if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { | 1946 | if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { |
| 1942 | err = -EAGAIN; | 1947 | err = -EAGAIN; |
| 1943 | break; | 1948 | goto _error; |
| 1944 | } | 1949 | } |
| 1945 | 1950 | ||
| 1946 | set_current_state(TASK_INTERRUPTIBLE); | 1951 | set_current_state(TASK_INTERRUPTIBLE); |
| @@ -1955,42 +1960,37 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, | |||
| 1955 | 1960 | ||
| 1956 | if (tu->disconnected) { | 1961 | if (tu->disconnected) { |
| 1957 | err = -ENODEV; | 1962 | err = -ENODEV; |
| 1958 | break; | 1963 | goto _error; |
| 1959 | } | 1964 | } |
| 1960 | if (signal_pending(current)) { | 1965 | if (signal_pending(current)) { |
| 1961 | err = -ERESTARTSYS; | 1966 | err = -ERESTARTSYS; |
| 1962 | break; | 1967 | goto _error; |
| 1963 | } | 1968 | } |
| 1964 | } | 1969 | } |
| 1965 | 1970 | ||
| 1971 | qhead = tu->qhead++; | ||
| 1972 | tu->qhead %= tu->queue_size; | ||
| 1966 | spin_unlock_irq(&tu->qlock); | 1973 | spin_unlock_irq(&tu->qlock); |
| 1967 | if (err < 0) | ||
| 1968 | goto _error; | ||
| 1969 | 1974 | ||
| 1970 | if (tu->tread) { | 1975 | if (tu->tread) { |
| 1971 | if (copy_to_user(buffer, &tu->tqueue[tu->qhead++], | 1976 | if (copy_to_user(buffer, &tu->tqueue[qhead], |
| 1972 | sizeof(struct snd_timer_tread))) { | 1977 | sizeof(struct snd_timer_tread))) |
| 1973 | err = -EFAULT; | 1978 | err = -EFAULT; |
| 1974 | goto _error; | ||
| 1975 | } | ||
| 1976 | } else { | 1979 | } else { |
| 1977 | if (copy_to_user(buffer, &tu->queue[tu->qhead++], | 1980 | if (copy_to_user(buffer, &tu->queue[qhead], |
| 1978 | sizeof(struct snd_timer_read))) { | 1981 | sizeof(struct snd_timer_read))) |
| 1979 | err = -EFAULT; | 1982 | err = -EFAULT; |
| 1980 | goto _error; | ||
| 1981 | } | ||
| 1982 | } | 1983 | } |
| 1983 | 1984 | ||
| 1984 | tu->qhead %= tu->queue_size; | ||
| 1985 | |||
| 1986 | result += unit; | ||
| 1987 | buffer += unit; | ||
| 1988 | |||
| 1989 | spin_lock_irq(&tu->qlock); | 1985 | spin_lock_irq(&tu->qlock); |
| 1990 | tu->qused--; | 1986 | tu->qused--; |
| 1987 | if (err < 0) | ||
| 1988 | goto _error; | ||
| 1989 | result += unit; | ||
| 1990 | buffer += unit; | ||
| 1991 | } | 1991 | } |
| 1992 | spin_unlock_irq(&tu->qlock); | ||
| 1993 | _error: | 1992 | _error: |
| 1993 | spin_unlock_irq(&tu->qlock); | ||
| 1994 | return result > 0 ? result : err; | 1994 | return result > 0 ? result : err; |
| 1995 | } | 1995 | } |
| 1996 | 1996 | ||
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index bde33308f0d6..c0f8f613f1f1 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
| @@ -87,7 +87,7 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-128) for dummy driver."); | |||
| 87 | module_param(fake_buffer, bool, 0444); | 87 | module_param(fake_buffer, bool, 0444); |
| 88 | MODULE_PARM_DESC(fake_buffer, "Fake buffer allocations."); | 88 | MODULE_PARM_DESC(fake_buffer, "Fake buffer allocations."); |
| 89 | #ifdef CONFIG_HIGH_RES_TIMERS | 89 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 90 | module_param(hrtimer, bool, 0444); | 90 | module_param(hrtimer, bool, 0644); |
| 91 | MODULE_PARM_DESC(hrtimer, "Use hrtimer as the timer source."); | 91 | MODULE_PARM_DESC(hrtimer, "Use hrtimer as the timer source."); |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| @@ -109,6 +109,9 @@ struct dummy_timer_ops { | |||
| 109 | snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); | 109 | snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | #define get_dummy_ops(substream) \ | ||
| 113 | (*(const struct dummy_timer_ops **)(substream)->runtime->private_data) | ||
| 114 | |||
| 112 | struct dummy_model { | 115 | struct dummy_model { |
| 113 | const char *name; | 116 | const char *name; |
| 114 | int (*playback_constraints)(struct snd_pcm_runtime *runtime); | 117 | int (*playback_constraints)(struct snd_pcm_runtime *runtime); |
| @@ -137,7 +140,6 @@ struct snd_dummy { | |||
| 137 | int iobox; | 140 | int iobox; |
| 138 | struct snd_kcontrol *cd_volume_ctl; | 141 | struct snd_kcontrol *cd_volume_ctl; |
| 139 | struct snd_kcontrol *cd_switch_ctl; | 142 | struct snd_kcontrol *cd_switch_ctl; |
| 140 | const struct dummy_timer_ops *timer_ops; | ||
| 141 | }; | 143 | }; |
| 142 | 144 | ||
| 143 | /* | 145 | /* |
| @@ -231,6 +233,8 @@ static struct dummy_model *dummy_models[] = { | |||
| 231 | */ | 233 | */ |
| 232 | 234 | ||
| 233 | struct dummy_systimer_pcm { | 235 | struct dummy_systimer_pcm { |
| 236 | /* ops must be the first item */ | ||
| 237 | const struct dummy_timer_ops *timer_ops; | ||
| 234 | spinlock_t lock; | 238 | spinlock_t lock; |
| 235 | struct timer_list timer; | 239 | struct timer_list timer; |
| 236 | unsigned long base_time; | 240 | unsigned long base_time; |
| @@ -366,6 +370,8 @@ static const struct dummy_timer_ops dummy_systimer_ops = { | |||
| 366 | */ | 370 | */ |
| 367 | 371 | ||
| 368 | struct dummy_hrtimer_pcm { | 372 | struct dummy_hrtimer_pcm { |
| 373 | /* ops must be the first item */ | ||
| 374 | const struct dummy_timer_ops *timer_ops; | ||
| 369 | ktime_t base_time; | 375 | ktime_t base_time; |
| 370 | ktime_t period_time; | 376 | ktime_t period_time; |
| 371 | atomic_t running; | 377 | atomic_t running; |
| @@ -492,31 +498,25 @@ static const struct dummy_timer_ops dummy_hrtimer_ops = { | |||
| 492 | 498 | ||
| 493 | static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 499 | static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
| 494 | { | 500 | { |
| 495 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); | ||
| 496 | |||
| 497 | switch (cmd) { | 501 | switch (cmd) { |
| 498 | case SNDRV_PCM_TRIGGER_START: | 502 | case SNDRV_PCM_TRIGGER_START: |
| 499 | case SNDRV_PCM_TRIGGER_RESUME: | 503 | case SNDRV_PCM_TRIGGER_RESUME: |
| 500 | return dummy->timer_ops->start(substream); | 504 | return get_dummy_ops(substream)->start(substream); |
| 501 | case SNDRV_PCM_TRIGGER_STOP: | 505 | case SNDRV_PCM_TRIGGER_STOP: |
| 502 | case SNDRV_PCM_TRIGGER_SUSPEND: | 506 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| 503 | return dummy->timer_ops->stop(substream); | 507 | return get_dummy_ops(substream)->stop(substream); |
| 504 | } | 508 | } |
| 505 | return -EINVAL; | 509 | return -EINVAL; |
| 506 | } | 510 | } |
| 507 | 511 | ||
| 508 | static int dummy_pcm_prepare(struct snd_pcm_substream *substream) | 512 | static int dummy_pcm_prepare(struct snd_pcm_substream *substream) |
| 509 | { | 513 | { |
| 510 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); | 514 | return get_dummy_ops(substream)->prepare(substream); |
| 511 | |||
| 512 | return dummy->timer_ops->prepare(substream); | ||
| 513 | } | 515 | } |
| 514 | 516 | ||
| 515 | static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream) | 517 | static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream) |
| 516 | { | 518 | { |
| 517 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); | 519 | return get_dummy_ops(substream)->pointer(substream); |
| 518 | |||
| 519 | return dummy->timer_ops->pointer(substream); | ||
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | static struct snd_pcm_hardware dummy_pcm_hardware = { | 522 | static struct snd_pcm_hardware dummy_pcm_hardware = { |
| @@ -562,17 +562,19 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) | |||
| 562 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); | 562 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); |
| 563 | struct dummy_model *model = dummy->model; | 563 | struct dummy_model *model = dummy->model; |
| 564 | struct snd_pcm_runtime *runtime = substream->runtime; | 564 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 565 | const struct dummy_timer_ops *ops; | ||
| 565 | int err; | 566 | int err; |
| 566 | 567 | ||
| 567 | dummy->timer_ops = &dummy_systimer_ops; | 568 | ops = &dummy_systimer_ops; |
| 568 | #ifdef CONFIG_HIGH_RES_TIMERS | 569 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 569 | if (hrtimer) | 570 | if (hrtimer) |
| 570 | dummy->timer_ops = &dummy_hrtimer_ops; | 571 | ops = &dummy_hrtimer_ops; |
| 571 | #endif | 572 | #endif |
| 572 | 573 | ||
| 573 | err = dummy->timer_ops->create(substream); | 574 | err = ops->create(substream); |
| 574 | if (err < 0) | 575 | if (err < 0) |
| 575 | return err; | 576 | return err; |
| 577 | get_dummy_ops(substream) = ops; | ||
| 576 | 578 | ||
| 577 | runtime->hw = dummy->pcm_hw; | 579 | runtime->hw = dummy->pcm_hw; |
| 578 | if (substream->pcm->device & 1) { | 580 | if (substream->pcm->device & 1) { |
| @@ -594,7 +596,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) | |||
| 594 | err = model->capture_constraints(substream->runtime); | 596 | err = model->capture_constraints(substream->runtime); |
| 595 | } | 597 | } |
| 596 | if (err < 0) { | 598 | if (err < 0) { |
| 597 | dummy->timer_ops->free(substream); | 599 | get_dummy_ops(substream)->free(substream); |
| 598 | return err; | 600 | return err; |
| 599 | } | 601 | } |
| 600 | return 0; | 602 | return 0; |
| @@ -602,8 +604,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) | |||
| 602 | 604 | ||
| 603 | static int dummy_pcm_close(struct snd_pcm_substream *substream) | 605 | static int dummy_pcm_close(struct snd_pcm_substream *substream) |
| 604 | { | 606 | { |
| 605 | struct snd_dummy *dummy = snd_pcm_substream_chip(substream); | 607 | get_dummy_ops(substream)->free(substream); |
| 606 | dummy->timer_ops->free(substream); | ||
| 607 | return 0; | 608 | return 0; |
| 608 | } | 609 | } |
| 609 | 610 | ||
diff --git a/sound/firewire/digi00x/amdtp-dot.c b/sound/firewire/digi00x/amdtp-dot.c index b02a5e8cad44..0ac92aba5bc1 100644 --- a/sound/firewire/digi00x/amdtp-dot.c +++ b/sound/firewire/digi00x/amdtp-dot.c | |||
| @@ -63,7 +63,7 @@ struct amdtp_dot { | |||
| 63 | #define BYTE_PER_SAMPLE (4) | 63 | #define BYTE_PER_SAMPLE (4) |
| 64 | #define MAGIC_DOT_BYTE (2) | 64 | #define MAGIC_DOT_BYTE (2) |
| 65 | #define MAGIC_BYTE_OFF(x) (((x) * BYTE_PER_SAMPLE) + MAGIC_DOT_BYTE) | 65 | #define MAGIC_BYTE_OFF(x) (((x) * BYTE_PER_SAMPLE) + MAGIC_DOT_BYTE) |
| 66 | static const u8 dot_scrt(const u8 idx, const unsigned int off) | 66 | static u8 dot_scrt(const u8 idx, const unsigned int off) |
| 67 | { | 67 | { |
| 68 | /* | 68 | /* |
| 69 | * the length of the added pattern only depends on the lower nibble | 69 | * the length of the added pattern only depends on the lower nibble |
diff --git a/sound/firewire/tascam/tascam-transaction.c b/sound/firewire/tascam/tascam-transaction.c index 904ce0329fa1..040a96d1ba8e 100644 --- a/sound/firewire/tascam/tascam-transaction.c +++ b/sound/firewire/tascam/tascam-transaction.c | |||
| @@ -230,6 +230,7 @@ int snd_tscm_transaction_register(struct snd_tscm *tscm) | |||
| 230 | return err; | 230 | return err; |
| 231 | error: | 231 | error: |
| 232 | fw_core_remove_address_handler(&tscm->async_handler); | 232 | fw_core_remove_address_handler(&tscm->async_handler); |
| 233 | tscm->async_handler.callback_data = NULL; | ||
| 233 | return err; | 234 | return err; |
| 234 | } | 235 | } |
| 235 | 236 | ||
| @@ -276,6 +277,9 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) | |||
| 276 | __be32 reg; | 277 | __be32 reg; |
| 277 | unsigned int i; | 278 | unsigned int i; |
| 278 | 279 | ||
| 280 | if (tscm->async_handler.callback_data == NULL) | ||
| 281 | return; | ||
| 282 | |||
| 279 | /* Turn off FireWire LED. */ | 283 | /* Turn off FireWire LED. */ |
| 280 | reg = cpu_to_be32(0x0000008e); | 284 | reg = cpu_to_be32(0x0000008e); |
| 281 | snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, | 285 | snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST, |
| @@ -297,6 +301,8 @@ void snd_tscm_transaction_unregister(struct snd_tscm *tscm) | |||
| 297 | ®, sizeof(reg), 0); | 301 | ®, sizeof(reg), 0); |
| 298 | 302 | ||
| 299 | fw_core_remove_address_handler(&tscm->async_handler); | 303 | fw_core_remove_address_handler(&tscm->async_handler); |
| 304 | tscm->async_handler.callback_data = NULL; | ||
| 305 | |||
| 300 | for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) | 306 | for (i = 0; i < TSCM_MIDI_OUT_PORT_MAX; i++) |
| 301 | snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); | 307 | snd_fw_async_midi_port_destroy(&tscm->out_ports[i]); |
| 302 | } | 308 | } |
diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c index ee0bc1839508..e281c338e562 100644 --- a/sound/firewire/tascam/tascam.c +++ b/sound/firewire/tascam/tascam.c | |||
| @@ -21,7 +21,6 @@ static struct snd_tscm_spec model_specs[] = { | |||
| 21 | .pcm_playback_analog_channels = 8, | 21 | .pcm_playback_analog_channels = 8, |
| 22 | .midi_capture_ports = 4, | 22 | .midi_capture_ports = 4, |
| 23 | .midi_playback_ports = 4, | 23 | .midi_playback_ports = 4, |
| 24 | .is_controller = true, | ||
| 25 | }, | 24 | }, |
| 26 | { | 25 | { |
| 27 | .name = "FW-1082", | 26 | .name = "FW-1082", |
| @@ -31,9 +30,16 @@ static struct snd_tscm_spec model_specs[] = { | |||
| 31 | .pcm_playback_analog_channels = 2, | 30 | .pcm_playback_analog_channels = 2, |
| 32 | .midi_capture_ports = 2, | 31 | .midi_capture_ports = 2, |
| 33 | .midi_playback_ports = 2, | 32 | .midi_playback_ports = 2, |
| 34 | .is_controller = true, | ||
| 35 | }, | 33 | }, |
| 36 | /* FW-1804 may be supported. */ | 34 | { |
| 35 | .name = "FW-1804", | ||
| 36 | .has_adat = true, | ||
| 37 | .has_spdif = true, | ||
| 38 | .pcm_capture_analog_channels = 8, | ||
| 39 | .pcm_playback_analog_channels = 2, | ||
| 40 | .midi_capture_ports = 2, | ||
| 41 | .midi_playback_ports = 4, | ||
| 42 | }, | ||
| 37 | }; | 43 | }; |
| 38 | 44 | ||
| 39 | static int identify_model(struct snd_tscm *tscm) | 45 | static int identify_model(struct snd_tscm *tscm) |
diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h index 2d028d2bd3bd..30ab77e924f7 100644 --- a/sound/firewire/tascam/tascam.h +++ b/sound/firewire/tascam/tascam.h | |||
| @@ -39,7 +39,6 @@ struct snd_tscm_spec { | |||
| 39 | unsigned int pcm_playback_analog_channels; | 39 | unsigned int pcm_playback_analog_channels; |
| 40 | unsigned int midi_capture_ports; | 40 | unsigned int midi_capture_ports; |
| 41 | unsigned int midi_playback_ports; | 41 | unsigned int midi_playback_ports; |
| 42 | bool is_controller; | ||
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| 45 | #define TSCM_MIDI_IN_PORT_MAX 4 | 44 | #define TSCM_MIDI_IN_PORT_MAX 4 |
| @@ -72,9 +71,6 @@ struct snd_tscm { | |||
| 72 | struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; | 71 | struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; |
| 73 | u8 running_status[TSCM_MIDI_OUT_PORT_MAX]; | 72 | u8 running_status[TSCM_MIDI_OUT_PORT_MAX]; |
| 74 | bool on_sysex[TSCM_MIDI_OUT_PORT_MAX]; | 73 | bool on_sysex[TSCM_MIDI_OUT_PORT_MAX]; |
| 75 | |||
| 76 | /* For control messages. */ | ||
| 77 | struct snd_firewire_tascam_status *status; | ||
| 78 | }; | 74 | }; |
| 79 | 75 | ||
| 80 | #define TSCM_ADDR_BASE 0xffff00000000ull | 76 | #define TSCM_ADDR_BASE 0xffff00000000ull |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 30c8efe0f80a..7ca5b89f088a 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
| @@ -4028,9 +4028,9 @@ static void pin_power_callback(struct hda_codec *codec, | |||
| 4028 | struct hda_jack_callback *jack, | 4028 | struct hda_jack_callback *jack, |
| 4029 | bool on) | 4029 | bool on) |
| 4030 | { | 4030 | { |
| 4031 | if (jack && jack->tbl->nid) | 4031 | if (jack && jack->nid) |
| 4032 | sync_power_state_change(codec, | 4032 | sync_power_state_change(codec, |
| 4033 | set_pin_power_jack(codec, jack->tbl->nid, on)); | 4033 | set_pin_power_jack(codec, jack->nid, on)); |
| 4034 | } | 4034 | } |
| 4035 | 4035 | ||
| 4036 | /* callback only doing power up -- called at first */ | 4036 | /* callback only doing power up -- called at first */ |
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index c945e257d368..a33234e04d4f 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c | |||
| @@ -259,7 +259,7 @@ snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, | |||
| 259 | if (!callback) | 259 | if (!callback) |
| 260 | return ERR_PTR(-ENOMEM); | 260 | return ERR_PTR(-ENOMEM); |
| 261 | callback->func = func; | 261 | callback->func = func; |
| 262 | callback->tbl = jack; | 262 | callback->nid = jack->nid; |
| 263 | callback->next = jack->callback; | 263 | callback->next = jack->callback; |
| 264 | jack->callback = callback; | 264 | jack->callback = callback; |
| 265 | } | 265 | } |
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 858708a044f5..e9814c0168ea 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h | |||
| @@ -21,7 +21,7 @@ struct hda_jack_callback; | |||
| 21 | typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *); | 21 | typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *); |
| 22 | 22 | ||
| 23 | struct hda_jack_callback { | 23 | struct hda_jack_callback { |
| 24 | struct hda_jack_tbl *tbl; | 24 | hda_nid_t nid; |
| 25 | hda_jack_callback_fn func; | 25 | hda_jack_callback_fn func; |
| 26 | unsigned int private_data; /* arbitrary data */ | 26 | unsigned int private_data; /* arbitrary data */ |
| 27 | struct hda_jack_callback *next; | 27 | struct hda_jack_callback *next; |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 4ef2259f88ca..9ceb2bc36e68 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
| @@ -4427,13 +4427,16 @@ static void ca0132_process_dsp_response(struct hda_codec *codec, | |||
| 4427 | static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) | 4427 | static void hp_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
| 4428 | { | 4428 | { |
| 4429 | struct ca0132_spec *spec = codec->spec; | 4429 | struct ca0132_spec *spec = codec->spec; |
| 4430 | struct hda_jack_tbl *tbl; | ||
| 4430 | 4431 | ||
| 4431 | /* Delay enabling the HP amp, to let the mic-detection | 4432 | /* Delay enabling the HP amp, to let the mic-detection |
| 4432 | * state machine run. | 4433 | * state machine run. |
| 4433 | */ | 4434 | */ |
| 4434 | cancel_delayed_work_sync(&spec->unsol_hp_work); | 4435 | cancel_delayed_work_sync(&spec->unsol_hp_work); |
| 4435 | schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); | 4436 | schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500)); |
| 4436 | cb->tbl->block_report = 1; | 4437 | tbl = snd_hda_jack_tbl_get(codec, cb->nid); |
| 4438 | if (tbl) | ||
| 4439 | tbl->block_report = 1; | ||
| 4437 | } | 4440 | } |
| 4438 | 4441 | ||
| 4439 | static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) | 4442 | static void amic_callback(struct hda_codec *codec, struct hda_jack_callback *cb) |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 1f52b55d77c9..8ee78dbd4c60 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -448,7 +448,8 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, | |||
| 448 | eld = &per_pin->sink_eld; | 448 | eld = &per_pin->sink_eld; |
| 449 | 449 | ||
| 450 | mutex_lock(&per_pin->lock); | 450 | mutex_lock(&per_pin->lock); |
| 451 | if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data)) { | 451 | if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || |
| 452 | eld->eld_size > ELD_MAX_SIZE) { | ||
| 452 | mutex_unlock(&per_pin->lock); | 453 | mutex_unlock(&per_pin->lock); |
| 453 | snd_BUG(); | 454 | snd_BUG(); |
| 454 | return -EINVAL; | 455 | return -EINVAL; |
| @@ -1193,7 +1194,7 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid) | |||
| 1193 | static void jack_callback(struct hda_codec *codec, | 1194 | static void jack_callback(struct hda_codec *codec, |
| 1194 | struct hda_jack_callback *jack) | 1195 | struct hda_jack_callback *jack) |
| 1195 | { | 1196 | { |
| 1196 | check_presence_and_report(codec, jack->tbl->nid); | 1197 | check_presence_and_report(codec, jack->nid); |
| 1197 | } | 1198 | } |
| 1198 | 1199 | ||
| 1199 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1200 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 21992fb7035d..efd4980cffb8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -282,7 +282,7 @@ static void alc_update_knob_master(struct hda_codec *codec, | |||
| 282 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 282 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
| 283 | if (!uctl) | 283 | if (!uctl) |
| 284 | return; | 284 | return; |
| 285 | val = snd_hda_codec_read(codec, jack->tbl->nid, 0, | 285 | val = snd_hda_codec_read(codec, jack->nid, 0, |
| 286 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | 286 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 287 | val &= HDA_AMP_VOLMASK; | 287 | val &= HDA_AMP_VOLMASK; |
| 288 | uctl->value.integer.value[0] = val; | 288 | uctl->value.integer.value[0] = val; |
| @@ -1787,7 +1787,6 @@ enum { | |||
| 1787 | ALC882_FIXUP_NO_PRIMARY_HP, | 1787 | ALC882_FIXUP_NO_PRIMARY_HP, |
| 1788 | ALC887_FIXUP_ASUS_BASS, | 1788 | ALC887_FIXUP_ASUS_BASS, |
| 1789 | ALC887_FIXUP_BASS_CHMAP, | 1789 | ALC887_FIXUP_BASS_CHMAP, |
| 1790 | ALC882_FIXUP_DISABLE_AAMIX, | ||
| 1791 | }; | 1790 | }; |
| 1792 | 1791 | ||
| 1793 | static void alc889_fixup_coef(struct hda_codec *codec, | 1792 | static void alc889_fixup_coef(struct hda_codec *codec, |
| @@ -1949,8 +1948,6 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec, | |||
| 1949 | 1948 | ||
| 1950 | static void alc_fixup_bass_chmap(struct hda_codec *codec, | 1949 | static void alc_fixup_bass_chmap(struct hda_codec *codec, |
| 1951 | const struct hda_fixup *fix, int action); | 1950 | const struct hda_fixup *fix, int action); |
| 1952 | static void alc_fixup_disable_aamix(struct hda_codec *codec, | ||
| 1953 | const struct hda_fixup *fix, int action); | ||
| 1954 | 1951 | ||
| 1955 | static const struct hda_fixup alc882_fixups[] = { | 1952 | static const struct hda_fixup alc882_fixups[] = { |
| 1956 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { | 1953 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
| @@ -2188,10 +2185,6 @@ static const struct hda_fixup alc882_fixups[] = { | |||
| 2188 | .type = HDA_FIXUP_FUNC, | 2185 | .type = HDA_FIXUP_FUNC, |
| 2189 | .v.func = alc_fixup_bass_chmap, | 2186 | .v.func = alc_fixup_bass_chmap, |
| 2190 | }, | 2187 | }, |
| 2191 | [ALC882_FIXUP_DISABLE_AAMIX] = { | ||
| 2192 | .type = HDA_FIXUP_FUNC, | ||
| 2193 | .v.func = alc_fixup_disable_aamix, | ||
| 2194 | }, | ||
| 2195 | }; | 2188 | }; |
| 2196 | 2189 | ||
| 2197 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { | 2190 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
| @@ -2230,6 +2223,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
| 2230 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), | 2223 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
| 2231 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), | 2224 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
| 2232 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), | 2225 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
| 2226 | SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), | ||
| 2233 | 2227 | ||
| 2234 | /* All Apple entries are in codec SSIDs */ | 2228 | /* All Apple entries are in codec SSIDs */ |
| 2235 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), | 2229 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
| @@ -2259,7 +2253,6 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
| 2259 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), | 2253 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
| 2260 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), | 2254 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
| 2261 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), | 2255 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), |
| 2262 | SND_PCI_QUIRK(0x1458, 0xa182, "Gigabyte Z170X-UD3", ALC882_FIXUP_DISABLE_AAMIX), | ||
| 2263 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), | 2256 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
| 2264 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), | 2257 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), |
| 2265 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), | 2258 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 2c7c5eb8b1e9..37b70f8e878f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -493,9 +493,9 @@ static void jack_update_power(struct hda_codec *codec, | |||
| 493 | if (!spec->num_pwrs) | 493 | if (!spec->num_pwrs) |
| 494 | return; | 494 | return; |
| 495 | 495 | ||
| 496 | if (jack && jack->tbl->nid) { | 496 | if (jack && jack->nid) { |
| 497 | stac_toggle_power_map(codec, jack->tbl->nid, | 497 | stac_toggle_power_map(codec, jack->nid, |
| 498 | snd_hda_jack_detect(codec, jack->tbl->nid), | 498 | snd_hda_jack_detect(codec, jack->nid), |
| 499 | true); | 499 | true); |
| 500 | return; | 500 | return; |
| 501 | } | 501 | } |
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 3191e0a7d273..d1fb035f44db 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c | |||
| @@ -635,6 +635,7 @@ static int acp_dma_open(struct snd_pcm_substream *substream) | |||
| 635 | SNDRV_PCM_HW_PARAM_PERIODS); | 635 | SNDRV_PCM_HW_PARAM_PERIODS); |
| 636 | if (ret < 0) { | 636 | if (ret < 0) { |
| 637 | dev_err(prtd->platform->dev, "set integer constraint failed\n"); | 637 | dev_err(prtd->platform->dev, "set integer constraint failed\n"); |
| 638 | kfree(adata); | ||
| 638 | return ret; | 639 | return ret; |
| 639 | } | 640 | } |
| 640 | 641 | ||
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 33143fe1de0b..91785318b283 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
| @@ -1929,6 +1929,25 @@ static struct { | |||
| 1929 | { 1000000, 13500000, 0, 1 }, | 1929 | { 1000000, 13500000, 0, 1 }, |
| 1930 | }; | 1930 | }; |
| 1931 | 1931 | ||
| 1932 | static const unsigned int pseudo_fref_max[ARIZONA_FLL_MAX_FRATIO] = { | ||
| 1933 | 13500000, | ||
| 1934 | 6144000, | ||
| 1935 | 6144000, | ||
| 1936 | 3072000, | ||
| 1937 | 3072000, | ||
| 1938 | 2822400, | ||
| 1939 | 2822400, | ||
| 1940 | 1536000, | ||
| 1941 | 1536000, | ||
| 1942 | 1536000, | ||
| 1943 | 1536000, | ||
| 1944 | 1536000, | ||
| 1945 | 1536000, | ||
| 1946 | 1536000, | ||
| 1947 | 1536000, | ||
| 1948 | 768000, | ||
| 1949 | }; | ||
| 1950 | |||
| 1932 | static struct { | 1951 | static struct { |
| 1933 | unsigned int min; | 1952 | unsigned int min; |
| 1934 | unsigned int max; | 1953 | unsigned int max; |
| @@ -2042,16 +2061,32 @@ static int arizona_calc_fratio(struct arizona_fll *fll, | |||
| 2042 | /* Adjust FRATIO/refdiv to avoid integer mode if possible */ | 2061 | /* Adjust FRATIO/refdiv to avoid integer mode if possible */ |
| 2043 | refdiv = cfg->refdiv; | 2062 | refdiv = cfg->refdiv; |
| 2044 | 2063 | ||
| 2064 | arizona_fll_dbg(fll, "pseudo: initial ratio=%u fref=%u refdiv=%u\n", | ||
| 2065 | init_ratio, Fref, refdiv); | ||
| 2066 | |||
| 2045 | while (div <= ARIZONA_FLL_MAX_REFDIV) { | 2067 | while (div <= ARIZONA_FLL_MAX_REFDIV) { |
| 2046 | for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; | 2068 | for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; |
| 2047 | ratio++) { | 2069 | ratio++) { |
| 2048 | if ((ARIZONA_FLL_VCO_CORNER / 2) / | 2070 | if ((ARIZONA_FLL_VCO_CORNER / 2) / |
| 2049 | (fll->vco_mult * ratio) < Fref) | 2071 | (fll->vco_mult * ratio) < Fref) { |
| 2072 | arizona_fll_dbg(fll, "pseudo: hit VCO corner\n"); | ||
| 2050 | break; | 2073 | break; |
| 2074 | } | ||
| 2075 | |||
| 2076 | if (Fref > pseudo_fref_max[ratio - 1]) { | ||
| 2077 | arizona_fll_dbg(fll, | ||
| 2078 | "pseudo: exceeded max fref(%u) for ratio=%u\n", | ||
| 2079 | pseudo_fref_max[ratio - 1], | ||
| 2080 | ratio); | ||
| 2081 | break; | ||
| 2082 | } | ||
| 2051 | 2083 | ||
| 2052 | if (target % (ratio * Fref)) { | 2084 | if (target % (ratio * Fref)) { |
| 2053 | cfg->refdiv = refdiv; | 2085 | cfg->refdiv = refdiv; |
| 2054 | cfg->fratio = ratio - 1; | 2086 | cfg->fratio = ratio - 1; |
| 2087 | arizona_fll_dbg(fll, | ||
| 2088 | "pseudo: found fref=%u refdiv=%d(%d) ratio=%d\n", | ||
| 2089 | Fref, refdiv, div, ratio); | ||
| 2055 | return ratio; | 2090 | return ratio; |
| 2056 | } | 2091 | } |
| 2057 | } | 2092 | } |
| @@ -2060,6 +2095,9 @@ static int arizona_calc_fratio(struct arizona_fll *fll, | |||
| 2060 | if (target % (ratio * Fref)) { | 2095 | if (target % (ratio * Fref)) { |
| 2061 | cfg->refdiv = refdiv; | 2096 | cfg->refdiv = refdiv; |
| 2062 | cfg->fratio = ratio - 1; | 2097 | cfg->fratio = ratio - 1; |
| 2098 | arizona_fll_dbg(fll, | ||
| 2099 | "pseudo: found fref=%u refdiv=%d(%d) ratio=%d\n", | ||
| 2100 | Fref, refdiv, div, ratio); | ||
| 2063 | return ratio; | 2101 | return ratio; |
| 2064 | } | 2102 | } |
| 2065 | } | 2103 | } |
| @@ -2068,6 +2106,9 @@ static int arizona_calc_fratio(struct arizona_fll *fll, | |||
| 2068 | Fref /= 2; | 2106 | Fref /= 2; |
| 2069 | refdiv++; | 2107 | refdiv++; |
| 2070 | init_ratio = arizona_find_fratio(Fref, NULL); | 2108 | init_ratio = arizona_find_fratio(Fref, NULL); |
| 2109 | arizona_fll_dbg(fll, | ||
| 2110 | "pseudo: change fref=%u refdiv=%d(%d) ratio=%u\n", | ||
| 2111 | Fref, refdiv, div, init_ratio); | ||
| 2071 | } | 2112 | } |
| 2072 | 2113 | ||
| 2073 | arizona_fll_warn(fll, "Falling back to integer mode operation\n"); | 2114 | arizona_fll_warn(fll, "Falling back to integer mode operation\n"); |
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index bc08f0c5a5f6..1bd31644a782 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
| @@ -266,6 +266,8 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
| 266 | } else { | 266 | } else { |
| 267 | *mic = false; | 267 | *mic = false; |
| 268 | regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20); | 268 | regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20); |
| 269 | regmap_update_bits(rt286->regmap, | ||
| 270 | RT286_CBJ_CTRL1, 0x0400, 0x0000); | ||
| 269 | } | 271 | } |
| 270 | } else { | 272 | } else { |
| 271 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); | 273 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); |
| @@ -470,24 +472,6 @@ static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w, | |||
| 470 | return 0; | 472 | return 0; |
| 471 | } | 473 | } |
| 472 | 474 | ||
| 473 | static int rt286_vref_event(struct snd_soc_dapm_widget *w, | ||
| 474 | struct snd_kcontrol *kcontrol, int event) | ||
| 475 | { | ||
| 476 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
| 477 | |||
| 478 | switch (event) { | ||
| 479 | case SND_SOC_DAPM_PRE_PMU: | ||
| 480 | snd_soc_update_bits(codec, | ||
| 481 | RT286_CBJ_CTRL1, 0x0400, 0x0000); | ||
| 482 | mdelay(50); | ||
| 483 | break; | ||
| 484 | default: | ||
| 485 | return 0; | ||
| 486 | } | ||
| 487 | |||
| 488 | return 0; | ||
| 489 | } | ||
| 490 | |||
| 491 | static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, | 475 | static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, |
| 492 | struct snd_kcontrol *kcontrol, int event) | 476 | struct snd_kcontrol *kcontrol, int event) |
| 493 | { | 477 | { |
| @@ -536,7 +520,7 @@ static const struct snd_soc_dapm_widget rt286_dapm_widgets[] = { | |||
| 536 | SND_SOC_DAPM_SUPPLY_S("HV", 1, RT286_POWER_CTRL1, | 520 | SND_SOC_DAPM_SUPPLY_S("HV", 1, RT286_POWER_CTRL1, |
| 537 | 12, 1, NULL, 0), | 521 | 12, 1, NULL, 0), |
| 538 | SND_SOC_DAPM_SUPPLY("VREF", RT286_POWER_CTRL1, | 522 | SND_SOC_DAPM_SUPPLY("VREF", RT286_POWER_CTRL1, |
| 539 | 0, 1, rt286_vref_event, SND_SOC_DAPM_PRE_PMU), | 523 | 0, 1, NULL, 0), |
| 540 | SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT286_POWER_CTRL2, | 524 | SND_SOC_DAPM_SUPPLY_S("LDO1", 1, RT286_POWER_CTRL2, |
| 541 | 2, 0, NULL, 0), | 525 | 2, 0, NULL, 0), |
| 542 | SND_SOC_DAPM_SUPPLY_S("LDO2", 2, RT286_POWER_CTRL1, | 526 | SND_SOC_DAPM_SUPPLY_S("LDO2", 2, RT286_POWER_CTRL1, |
| @@ -911,8 +895,6 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec, | |||
| 911 | case SND_SOC_BIAS_ON: | 895 | case SND_SOC_BIAS_ON: |
| 912 | mdelay(10); | 896 | mdelay(10); |
| 913 | snd_soc_update_bits(codec, | 897 | snd_soc_update_bits(codec, |
| 914 | RT286_CBJ_CTRL1, 0x0400, 0x0400); | ||
| 915 | snd_soc_update_bits(codec, | ||
| 916 | RT286_DC_GAIN, 0x200, 0x0); | 898 | RT286_DC_GAIN, 0x200, 0x0); |
| 917 | 899 | ||
| 918 | break; | 900 | break; |
| @@ -920,8 +902,6 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec, | |||
| 920 | case SND_SOC_BIAS_STANDBY: | 902 | case SND_SOC_BIAS_STANDBY: |
| 921 | snd_soc_write(codec, | 903 | snd_soc_write(codec, |
| 922 | RT286_SET_AUDIO_POWER, AC_PWRST_D3); | 904 | RT286_SET_AUDIO_POWER, AC_PWRST_D3); |
| 923 | snd_soc_update_bits(codec, | ||
| 924 | RT286_CBJ_CTRL1, 0x0400, 0x0000); | ||
| 925 | break; | 905 | break; |
| 926 | 906 | ||
| 927 | default: | 907 | default: |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index c61d38b585fb..93e8c9017633 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
| @@ -776,7 +776,7 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = { | |||
| 776 | 776 | ||
| 777 | /* IN1/IN2 Control */ | 777 | /* IN1/IN2 Control */ |
| 778 | SOC_SINGLE_TLV("IN1 Boost", RT5645_IN1_CTRL1, | 778 | SOC_SINGLE_TLV("IN1 Boost", RT5645_IN1_CTRL1, |
| 779 | RT5645_BST_SFT1, 8, 0, bst_tlv), | 779 | RT5645_BST_SFT1, 12, 0, bst_tlv), |
| 780 | SOC_SINGLE_TLV("IN2 Boost", RT5645_IN2_CTRL, | 780 | SOC_SINGLE_TLV("IN2 Boost", RT5645_IN2_CTRL, |
| 781 | RT5645_BST_SFT2, 8, 0, bst_tlv), | 781 | RT5645_BST_SFT2, 8, 0, bst_tlv), |
| 782 | 782 | ||
diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c index 820d8fa62b5e..fb8ea05c0de1 100644 --- a/sound/soc/codecs/rt5659.c +++ b/sound/soc/codecs/rt5659.c | |||
| @@ -3985,7 +3985,6 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, | |||
| 3985 | if (rt5659 == NULL) | 3985 | if (rt5659 == NULL) |
| 3986 | return -ENOMEM; | 3986 | return -ENOMEM; |
| 3987 | 3987 | ||
| 3988 | rt5659->i2c = i2c; | ||
| 3989 | i2c_set_clientdata(i2c, rt5659); | 3988 | i2c_set_clientdata(i2c, rt5659); |
| 3990 | 3989 | ||
| 3991 | if (pdata) | 3990 | if (pdata) |
| @@ -4157,24 +4156,17 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, | |||
| 4157 | 4156 | ||
| 4158 | INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); | 4157 | INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); |
| 4159 | 4158 | ||
| 4160 | if (rt5659->i2c->irq) { | 4159 | if (i2c->irq) { |
| 4161 | ret = request_threaded_irq(rt5659->i2c->irq, NULL, rt5659_irq, | 4160 | ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, |
| 4162 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | 4161 | rt5659_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
| 4163 | | IRQF_ONESHOT, "rt5659", rt5659); | 4162 | | IRQF_ONESHOT, "rt5659", rt5659); |
| 4164 | if (ret) | 4163 | if (ret) |
| 4165 | dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); | 4164 | dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); |
| 4166 | 4165 | ||
| 4167 | } | 4166 | } |
| 4168 | 4167 | ||
| 4169 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, | 4168 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, |
| 4170 | rt5659_dai, ARRAY_SIZE(rt5659_dai)); | 4169 | rt5659_dai, ARRAY_SIZE(rt5659_dai)); |
| 4171 | |||
| 4172 | if (ret) { | ||
| 4173 | if (rt5659->i2c->irq) | ||
| 4174 | free_irq(rt5659->i2c->irq, rt5659); | ||
| 4175 | } | ||
| 4176 | |||
| 4177 | return 0; | ||
| 4178 | } | 4170 | } |
| 4179 | 4171 | ||
| 4180 | static int rt5659_i2c_remove(struct i2c_client *i2c) | 4172 | static int rt5659_i2c_remove(struct i2c_client *i2c) |
| @@ -4191,24 +4183,29 @@ void rt5659_i2c_shutdown(struct i2c_client *client) | |||
| 4191 | regmap_write(rt5659->regmap, RT5659_RESET, 0); | 4183 | regmap_write(rt5659->regmap, RT5659_RESET, 0); |
| 4192 | } | 4184 | } |
| 4193 | 4185 | ||
| 4186 | #ifdef CONFIG_OF | ||
| 4194 | static const struct of_device_id rt5659_of_match[] = { | 4187 | static const struct of_device_id rt5659_of_match[] = { |
| 4195 | { .compatible = "realtek,rt5658", }, | 4188 | { .compatible = "realtek,rt5658", }, |
| 4196 | { .compatible = "realtek,rt5659", }, | 4189 | { .compatible = "realtek,rt5659", }, |
| 4197 | {}, | 4190 | { }, |
| 4198 | }; | 4191 | }; |
| 4192 | MODULE_DEVICE_TABLE(of, rt5659_of_match); | ||
| 4193 | #endif | ||
| 4199 | 4194 | ||
| 4195 | #ifdef CONFIG_ACPI | ||
| 4200 | static struct acpi_device_id rt5659_acpi_match[] = { | 4196 | static struct acpi_device_id rt5659_acpi_match[] = { |
| 4201 | { "10EC5658", 0}, | 4197 | { "10EC5658", 0, }, |
| 4202 | { "10EC5659", 0}, | 4198 | { "10EC5659", 0, }, |
| 4203 | { }, | 4199 | { }, |
| 4204 | }; | 4200 | }; |
| 4205 | MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match); | 4201 | MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match); |
| 4202 | #endif | ||
| 4206 | 4203 | ||
| 4207 | struct i2c_driver rt5659_i2c_driver = { | 4204 | struct i2c_driver rt5659_i2c_driver = { |
| 4208 | .driver = { | 4205 | .driver = { |
| 4209 | .name = "rt5659", | 4206 | .name = "rt5659", |
| 4210 | .owner = THIS_MODULE, | 4207 | .owner = THIS_MODULE, |
| 4211 | .of_match_table = rt5659_of_match, | 4208 | .of_match_table = of_match_ptr(rt5659_of_match), |
| 4212 | .acpi_match_table = ACPI_PTR(rt5659_acpi_match), | 4209 | .acpi_match_table = ACPI_PTR(rt5659_acpi_match), |
| 4213 | }, | 4210 | }, |
| 4214 | .probe = rt5659_i2c_probe, | 4211 | .probe = rt5659_i2c_probe, |
diff --git a/sound/soc/codecs/rt5659.h b/sound/soc/codecs/rt5659.h index 8f07ee903eaa..d31c9e5bcec8 100644 --- a/sound/soc/codecs/rt5659.h +++ b/sound/soc/codecs/rt5659.h | |||
| @@ -1792,7 +1792,6 @@ struct rt5659_priv { | |||
| 1792 | struct snd_soc_codec *codec; | 1792 | struct snd_soc_codec *codec; |
| 1793 | struct rt5659_platform_data pdata; | 1793 | struct rt5659_platform_data pdata; |
| 1794 | struct regmap *regmap; | 1794 | struct regmap *regmap; |
| 1795 | struct i2c_client *i2c; | ||
| 1796 | struct gpio_desc *gpiod_ldo1_en; | 1795 | struct gpio_desc *gpiod_ldo1_en; |
| 1797 | struct gpio_desc *gpiod_reset; | 1796 | struct gpio_desc *gpiod_reset; |
| 1798 | struct snd_soc_jack *hs_jack; | 1797 | struct snd_soc_jack *hs_jack; |
diff --git a/sound/soc/codecs/sigmadsp-i2c.c b/sound/soc/codecs/sigmadsp-i2c.c index 21ca3a5e9f66..d374c18d4db7 100644 --- a/sound/soc/codecs/sigmadsp-i2c.c +++ b/sound/soc/codecs/sigmadsp-i2c.c | |||
| @@ -31,7 +31,10 @@ static int sigmadsp_write_i2c(void *control_data, | |||
| 31 | 31 | ||
| 32 | kfree(buf); | 32 | kfree(buf); |
| 33 | 33 | ||
| 34 | return ret; | 34 | if (ret < 0) |
| 35 | return ret; | ||
| 36 | |||
| 37 | return 0; | ||
| 35 | } | 38 | } |
| 36 | 39 | ||
| 37 | static int sigmadsp_read_i2c(void *control_data, | 40 | static int sigmadsp_read_i2c(void *control_data, |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 6088d30962a9..97c0f1e23886 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
| @@ -2382,6 +2382,7 @@ error: | |||
| 2382 | 2382 | ||
| 2383 | static int wm5110_remove(struct platform_device *pdev) | 2383 | static int wm5110_remove(struct platform_device *pdev) |
| 2384 | { | 2384 | { |
| 2385 | snd_soc_unregister_platform(&pdev->dev); | ||
| 2385 | snd_soc_unregister_codec(&pdev->dev); | 2386 | snd_soc_unregister_codec(&pdev->dev); |
| 2386 | pm_runtime_disable(&pdev->dev); | 2387 | pm_runtime_disable(&pdev->dev); |
| 2387 | 2388 | ||
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index ff237726775a..d7f444f87460 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
| @@ -240,13 +240,13 @@ SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL, | |||
| 240 | SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL, | 240 | SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL, |
| 241 | 7, 1, 1), | 241 | 7, 1, 1), |
| 242 | 242 | ||
| 243 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume", | 243 | SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume", |
| 244 | WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv), | 244 | WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv), |
| 245 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume", | 245 | SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume", |
| 246 | WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv), | 246 | WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv), |
| 247 | SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume", | 247 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume", |
| 248 | WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv), | 248 | WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv), |
| 249 | SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume", | 249 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume", |
| 250 | WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv), | 250 | WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv), |
| 251 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume", | 251 | SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume", |
| 252 | WM8960_RINPATH, 4, 3, 0, micboost_tlv), | 252 | WM8960_RINPATH, 4, 3, 0, micboost_tlv), |
| @@ -643,29 +643,31 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec) | |||
| 643 | return -EINVAL; | 643 | return -EINVAL; |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | /* check if the sysclk frequency is available. */ | 646 | if (wm8960->clk_id != WM8960_SYSCLK_PLL) { |
| 647 | for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { | 647 | /* check if the sysclk frequency is available. */ |
| 648 | if (sysclk_divs[i] == -1) | 648 | for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { |
| 649 | continue; | 649 | if (sysclk_divs[i] == -1) |
| 650 | sysclk = freq_out / sysclk_divs[i]; | 650 | continue; |
| 651 | for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { | 651 | sysclk = freq_out / sysclk_divs[i]; |
| 652 | if (sysclk == dac_divs[j] * lrclk) { | 652 | for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { |
| 653 | if (sysclk != dac_divs[j] * lrclk) | ||
| 654 | continue; | ||
| 653 | for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k) | 655 | for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k) |
| 654 | if (sysclk == bclk * bclk_divs[k] / 10) | 656 | if (sysclk == bclk * bclk_divs[k] / 10) |
| 655 | break; | 657 | break; |
| 656 | if (k != ARRAY_SIZE(bclk_divs)) | 658 | if (k != ARRAY_SIZE(bclk_divs)) |
| 657 | break; | 659 | break; |
| 658 | } | 660 | } |
| 661 | if (j != ARRAY_SIZE(dac_divs)) | ||
| 662 | break; | ||
| 659 | } | 663 | } |
| 660 | if (j != ARRAY_SIZE(dac_divs)) | ||
| 661 | break; | ||
| 662 | } | ||
| 663 | 664 | ||
| 664 | if (i != ARRAY_SIZE(sysclk_divs)) { | 665 | if (i != ARRAY_SIZE(sysclk_divs)) { |
| 665 | goto configure_clock; | 666 | goto configure_clock; |
| 666 | } else if (wm8960->clk_id != WM8960_SYSCLK_AUTO) { | 667 | } else if (wm8960->clk_id != WM8960_SYSCLK_AUTO) { |
| 667 | dev_err(codec->dev, "failed to configure clock\n"); | 668 | dev_err(codec->dev, "failed to configure clock\n"); |
| 668 | return -EINVAL; | 669 | return -EINVAL; |
| 670 | } | ||
| 669 | } | 671 | } |
| 670 | /* get a available pll out frequency and set pll */ | 672 | /* get a available pll out frequency and set pll */ |
| 671 | for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { | 673 | for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { |
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index ce664c239be3..bff258d7bcea 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
| @@ -645,6 +645,8 @@ static int dw_i2s_probe(struct platform_device *pdev) | |||
| 645 | 645 | ||
| 646 | dev->dev = &pdev->dev; | 646 | dev->dev = &pdev->dev; |
| 647 | 647 | ||
| 648 | dev->i2s_reg_comp1 = I2S_COMP_PARAM_1; | ||
| 649 | dev->i2s_reg_comp2 = I2S_COMP_PARAM_2; | ||
| 648 | if (pdata) { | 650 | if (pdata) { |
| 649 | dev->capability = pdata->cap; | 651 | dev->capability = pdata->cap; |
| 650 | clk_id = NULL; | 652 | clk_id = NULL; |
| @@ -652,9 +654,6 @@ static int dw_i2s_probe(struct platform_device *pdev) | |||
| 652 | if (dev->quirks & DW_I2S_QUIRK_COMP_REG_OFFSET) { | 654 | if (dev->quirks & DW_I2S_QUIRK_COMP_REG_OFFSET) { |
| 653 | dev->i2s_reg_comp1 = pdata->i2s_reg_comp1; | 655 | dev->i2s_reg_comp1 = pdata->i2s_reg_comp1; |
| 654 | dev->i2s_reg_comp2 = pdata->i2s_reg_comp2; | 656 | dev->i2s_reg_comp2 = pdata->i2s_reg_comp2; |
| 655 | } else { | ||
| 656 | dev->i2s_reg_comp1 = I2S_COMP_PARAM_1; | ||
| 657 | dev->i2s_reg_comp2 = I2S_COMP_PARAM_2; | ||
| 658 | } | 657 | } |
| 659 | ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); | 658 | ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); |
| 660 | } else { | 659 | } else { |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 40dfd8a36484..ed8de1035cda 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
| @@ -112,20 +112,6 @@ struct fsl_ssi_rxtx_reg_val { | |||
| 112 | struct fsl_ssi_reg_val tx; | 112 | struct fsl_ssi_reg_val tx; |
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | static const struct reg_default fsl_ssi_reg_defaults[] = { | ||
| 116 | {CCSR_SSI_SCR, 0x00000000}, | ||
| 117 | {CCSR_SSI_SIER, 0x00003003}, | ||
| 118 | {CCSR_SSI_STCR, 0x00000200}, | ||
| 119 | {CCSR_SSI_SRCR, 0x00000200}, | ||
| 120 | {CCSR_SSI_STCCR, 0x00040000}, | ||
| 121 | {CCSR_SSI_SRCCR, 0x00040000}, | ||
| 122 | {CCSR_SSI_SACNT, 0x00000000}, | ||
| 123 | {CCSR_SSI_STMSK, 0x00000000}, | ||
| 124 | {CCSR_SSI_SRMSK, 0x00000000}, | ||
| 125 | {CCSR_SSI_SACCEN, 0x00000000}, | ||
| 126 | {CCSR_SSI_SACCDIS, 0x00000000}, | ||
| 127 | }; | ||
| 128 | |||
| 129 | static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg) | 115 | static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg) |
| 130 | { | 116 | { |
| 131 | switch (reg) { | 117 | switch (reg) { |
| @@ -190,8 +176,7 @@ static const struct regmap_config fsl_ssi_regconfig = { | |||
| 190 | .val_bits = 32, | 176 | .val_bits = 32, |
| 191 | .reg_stride = 4, | 177 | .reg_stride = 4, |
| 192 | .val_format_endian = REGMAP_ENDIAN_NATIVE, | 178 | .val_format_endian = REGMAP_ENDIAN_NATIVE, |
| 193 | .reg_defaults = fsl_ssi_reg_defaults, | 179 | .num_reg_defaults_raw = CCSR_SSI_SACCDIS / sizeof(uint32_t) + 1, |
| 194 | .num_reg_defaults = ARRAY_SIZE(fsl_ssi_reg_defaults), | ||
| 195 | .readable_reg = fsl_ssi_readable_reg, | 180 | .readable_reg = fsl_ssi_readable_reg, |
| 196 | .volatile_reg = fsl_ssi_volatile_reg, | 181 | .volatile_reg = fsl_ssi_volatile_reg, |
| 197 | .precious_reg = fsl_ssi_precious_reg, | 182 | .precious_reg = fsl_ssi_precious_reg, |
| @@ -201,6 +186,7 @@ static const struct regmap_config fsl_ssi_regconfig = { | |||
| 201 | 186 | ||
| 202 | struct fsl_ssi_soc_data { | 187 | struct fsl_ssi_soc_data { |
| 203 | bool imx; | 188 | bool imx; |
| 189 | bool imx21regs; /* imx21-class SSI - no SACC{ST,EN,DIS} regs */ | ||
| 204 | bool offline_config; | 190 | bool offline_config; |
| 205 | u32 sisr_write_mask; | 191 | u32 sisr_write_mask; |
| 206 | }; | 192 | }; |
| @@ -303,6 +289,7 @@ static struct fsl_ssi_soc_data fsl_ssi_mpc8610 = { | |||
| 303 | 289 | ||
| 304 | static struct fsl_ssi_soc_data fsl_ssi_imx21 = { | 290 | static struct fsl_ssi_soc_data fsl_ssi_imx21 = { |
| 305 | .imx = true, | 291 | .imx = true, |
| 292 | .imx21regs = true, | ||
| 306 | .offline_config = true, | 293 | .offline_config = true, |
| 307 | .sisr_write_mask = 0, | 294 | .sisr_write_mask = 0, |
| 308 | }; | 295 | }; |
| @@ -586,8 +573,12 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private) | |||
| 586 | */ | 573 | */ |
| 587 | regmap_write(regs, CCSR_SSI_SACNT, | 574 | regmap_write(regs, CCSR_SSI_SACNT, |
| 588 | CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV); | 575 | CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV); |
| 589 | regmap_write(regs, CCSR_SSI_SACCDIS, 0xff); | 576 | |
| 590 | regmap_write(regs, CCSR_SSI_SACCEN, 0x300); | 577 | /* no SACC{ST,EN,DIS} regs on imx21-class SSI */ |
| 578 | if (!ssi_private->soc->imx21regs) { | ||
| 579 | regmap_write(regs, CCSR_SSI_SACCDIS, 0xff); | ||
| 580 | regmap_write(regs, CCSR_SSI_SACCEN, 0x300); | ||
| 581 | } | ||
| 591 | 582 | ||
| 592 | /* | 583 | /* |
| 593 | * Enable SSI, Transmit and Receive. AC97 has to communicate with the | 584 | * Enable SSI, Transmit and Receive. AC97 has to communicate with the |
| @@ -1397,6 +1388,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
| 1397 | struct resource *res; | 1388 | struct resource *res; |
| 1398 | void __iomem *iomem; | 1389 | void __iomem *iomem; |
| 1399 | char name[64]; | 1390 | char name[64]; |
| 1391 | struct regmap_config regconfig = fsl_ssi_regconfig; | ||
| 1400 | 1392 | ||
| 1401 | of_id = of_match_device(fsl_ssi_ids, &pdev->dev); | 1393 | of_id = of_match_device(fsl_ssi_ids, &pdev->dev); |
| 1402 | if (!of_id || !of_id->data) | 1394 | if (!of_id || !of_id->data) |
| @@ -1444,15 +1436,25 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
| 1444 | return PTR_ERR(iomem); | 1436 | return PTR_ERR(iomem); |
| 1445 | ssi_private->ssi_phys = res->start; | 1437 | ssi_private->ssi_phys = res->start; |
| 1446 | 1438 | ||
| 1439 | if (ssi_private->soc->imx21regs) { | ||
| 1440 | /* | ||
| 1441 | * According to datasheet imx21-class SSI | ||
| 1442 | * don't have SACC{ST,EN,DIS} regs. | ||
| 1443 | */ | ||
| 1444 | regconfig.max_register = CCSR_SSI_SRMSK; | ||
| 1445 | regconfig.num_reg_defaults_raw = | ||
| 1446 | CCSR_SSI_SRMSK / sizeof(uint32_t) + 1; | ||
| 1447 | } | ||
| 1448 | |||
| 1447 | ret = of_property_match_string(np, "clock-names", "ipg"); | 1449 | ret = of_property_match_string(np, "clock-names", "ipg"); |
| 1448 | if (ret < 0) { | 1450 | if (ret < 0) { |
| 1449 | ssi_private->has_ipg_clk_name = false; | 1451 | ssi_private->has_ipg_clk_name = false; |
| 1450 | ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem, | 1452 | ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem, |
| 1451 | &fsl_ssi_regconfig); | 1453 | ®config); |
| 1452 | } else { | 1454 | } else { |
| 1453 | ssi_private->has_ipg_clk_name = true; | 1455 | ssi_private->has_ipg_clk_name = true; |
| 1454 | ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev, | 1456 | ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev, |
| 1455 | "ipg", iomem, &fsl_ssi_regconfig); | 1457 | "ipg", iomem, ®config); |
| 1456 | } | 1458 | } |
| 1457 | if (IS_ERR(ssi_private->regs)) { | 1459 | if (IS_ERR(ssi_private->regs)) { |
| 1458 | dev_err(&pdev->dev, "Failed to init register map\n"); | 1460 | dev_err(&pdev->dev, "Failed to init register map\n"); |
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c index a407e833c612..fb896b2c9ba3 100644 --- a/sound/soc/fsl/imx-spdif.c +++ b/sound/soc/fsl/imx-spdif.c | |||
| @@ -72,8 +72,6 @@ static int imx_spdif_audio_probe(struct platform_device *pdev) | |||
| 72 | goto end; | 72 | goto end; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | platform_set_drvdata(pdev, data); | ||
| 76 | |||
| 77 | end: | 75 | end: |
| 78 | of_node_put(spdif_np); | 76 | of_node_put(spdif_np); |
| 79 | 77 | ||
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 1ded8811598e..2389ab47e25f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
| @@ -99,7 +99,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, | |||
| 99 | if (ret && ret != -ENOTSUPP) | 99 | if (ret && ret != -ENOTSUPP) |
| 100 | goto err; | 100 | goto err; |
| 101 | } | 101 | } |
| 102 | 102 | return 0; | |
| 103 | err: | 103 | err: |
| 104 | return ret; | 104 | return ret; |
| 105 | } | 105 | } |
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 803f95e40679..7d7c872c280d 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
| @@ -30,11 +30,15 @@ config SND_SST_IPC_ACPI | |||
| 30 | config SND_SOC_INTEL_SST | 30 | config SND_SOC_INTEL_SST |
| 31 | tristate | 31 | tristate |
| 32 | select SND_SOC_INTEL_SST_ACPI if ACPI | 32 | select SND_SOC_INTEL_SST_ACPI if ACPI |
| 33 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 33 | depends on (X86 || COMPILE_TEST) | 34 | depends on (X86 || COMPILE_TEST) |
| 34 | 35 | ||
| 35 | config SND_SOC_INTEL_SST_ACPI | 36 | config SND_SOC_INTEL_SST_ACPI |
| 36 | tristate | 37 | tristate |
| 37 | 38 | ||
| 39 | config SND_SOC_INTEL_SST_MATCH | ||
| 40 | tristate | ||
| 41 | |||
| 38 | config SND_SOC_INTEL_HASWELL | 42 | config SND_SOC_INTEL_HASWELL |
| 39 | tristate | 43 | tristate |
| 40 | 44 | ||
| @@ -57,7 +61,7 @@ config SND_SOC_INTEL_HASWELL_MACH | |||
| 57 | config SND_SOC_INTEL_BYT_RT5640_MACH | 61 | config SND_SOC_INTEL_BYT_RT5640_MACH |
| 58 | tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" | 62 | tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" |
| 59 | depends on X86_INTEL_LPSS && I2C | 63 | depends on X86_INTEL_LPSS && I2C |
| 60 | depends on DW_DMAC_CORE=y && (SND_SOC_INTEL_BYTCR_RT5640_MACH = n) | 64 | depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n) |
| 61 | select SND_SOC_INTEL_SST | 65 | select SND_SOC_INTEL_SST |
| 62 | select SND_SOC_INTEL_BAYTRAIL | 66 | select SND_SOC_INTEL_BAYTRAIL |
| 63 | select SND_SOC_RT5640 | 67 | select SND_SOC_RT5640 |
| @@ -69,7 +73,7 @@ config SND_SOC_INTEL_BYT_RT5640_MACH | |||
| 69 | config SND_SOC_INTEL_BYT_MAX98090_MACH | 73 | config SND_SOC_INTEL_BYT_MAX98090_MACH |
| 70 | tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" | 74 | tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" |
| 71 | depends on X86_INTEL_LPSS && I2C | 75 | depends on X86_INTEL_LPSS && I2C |
| 72 | depends on DW_DMAC_CORE=y | 76 | depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n) |
| 73 | select SND_SOC_INTEL_SST | 77 | select SND_SOC_INTEL_SST |
| 74 | select SND_SOC_INTEL_BAYTRAIL | 78 | select SND_SOC_INTEL_BAYTRAIL |
| 75 | select SND_SOC_MAX98090 | 79 | select SND_SOC_MAX98090 |
| @@ -97,6 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH | |||
| 97 | select SND_SOC_RT5640 | 101 | select SND_SOC_RT5640 |
| 98 | select SND_SST_MFLD_PLATFORM | 102 | select SND_SST_MFLD_PLATFORM |
| 99 | select SND_SST_IPC_ACPI | 103 | select SND_SST_IPC_ACPI |
| 104 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 100 | help | 105 | help |
| 101 | This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR | 106 | This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR |
| 102 | platforms with RT5640 audio codec. | 107 | platforms with RT5640 audio codec. |
| @@ -109,6 +114,7 @@ config SND_SOC_INTEL_BYTCR_RT5651_MACH | |||
| 109 | select SND_SOC_RT5651 | 114 | select SND_SOC_RT5651 |
| 110 | select SND_SST_MFLD_PLATFORM | 115 | select SND_SST_MFLD_PLATFORM |
| 111 | select SND_SST_IPC_ACPI | 116 | select SND_SST_IPC_ACPI |
| 117 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 112 | help | 118 | help |
| 113 | This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR | 119 | This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR |
| 114 | platforms with RT5651 audio codec. | 120 | platforms with RT5651 audio codec. |
| @@ -121,6 +127,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH | |||
| 121 | select SND_SOC_RT5670 | 127 | select SND_SOC_RT5670 |
| 122 | select SND_SST_MFLD_PLATFORM | 128 | select SND_SST_MFLD_PLATFORM |
| 123 | select SND_SST_IPC_ACPI | 129 | select SND_SST_IPC_ACPI |
| 130 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 124 | help | 131 | help |
| 125 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell | 132 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell |
| 126 | platforms with RT5672 audio codec. | 133 | platforms with RT5672 audio codec. |
| @@ -133,6 +140,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5645_MACH | |||
| 133 | select SND_SOC_RT5645 | 140 | select SND_SOC_RT5645 |
| 134 | select SND_SST_MFLD_PLATFORM | 141 | select SND_SST_MFLD_PLATFORM |
| 135 | select SND_SST_IPC_ACPI | 142 | select SND_SST_IPC_ACPI |
| 143 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 136 | help | 144 | help |
| 137 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell | 145 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell |
| 138 | platforms with RT5645/5650 audio codec. | 146 | platforms with RT5645/5650 audio codec. |
| @@ -145,6 +153,7 @@ config SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH | |||
| 145 | select SND_SOC_TS3A227E | 153 | select SND_SOC_TS3A227E |
| 146 | select SND_SST_MFLD_PLATFORM | 154 | select SND_SST_MFLD_PLATFORM |
| 147 | select SND_SST_IPC_ACPI | 155 | select SND_SST_IPC_ACPI |
| 156 | select SND_SOC_INTEL_SST_MATCH if ACPI | ||
| 148 | help | 157 | help |
| 149 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell | 158 | This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell |
| 150 | platforms with MAX98090 audio codec it also can support TI jack chip as aux device. | 159 | platforms with MAX98090 audio codec it also can support TI jack chip as aux device. |
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 55c33dc76ce4..52ed434cbca6 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c | |||
| @@ -528,6 +528,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { | |||
| 528 | .ops = &sst_compr_dai_ops, | 528 | .ops = &sst_compr_dai_ops, |
| 529 | .playback = { | 529 | .playback = { |
| 530 | .stream_name = "Compress Playback", | 530 | .stream_name = "Compress Playback", |
| 531 | .channels_min = 1, | ||
| 531 | }, | 532 | }, |
| 532 | }, | 533 | }, |
| 533 | /* BE CPU Dais */ | 534 | /* BE CPU Dais */ |
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index 7396ddb427d8..2cbcbe412661 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c | |||
| @@ -212,7 +212,10 @@ static int skylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd, | |||
| 212 | { | 212 | { |
| 213 | struct snd_interval *channels = hw_param_interval(params, | 213 | struct snd_interval *channels = hw_param_interval(params, |
| 214 | SNDRV_PCM_HW_PARAM_CHANNELS); | 214 | SNDRV_PCM_HW_PARAM_CHANNELS); |
| 215 | channels->min = channels->max = 4; | 215 | if (params_channels(params) == 2) |
| 216 | channels->min = channels->max = 2; | ||
| 217 | else | ||
| 218 | channels->min = channels->max = 4; | ||
| 216 | 219 | ||
| 217 | return 0; | 220 | return 0; |
| 218 | } | 221 | } |
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile index 668fdeee195e..fbbb25c2ceed 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile | |||
| @@ -1,13 +1,10 @@ | |||
| 1 | snd-soc-sst-dsp-objs := sst-dsp.o | 1 | snd-soc-sst-dsp-objs := sst-dsp.o |
| 2 | ifneq ($(CONFIG_SND_SST_IPC_ACPI),) | 2 | snd-soc-sst-acpi-objs := sst-acpi.o |
| 3 | snd-soc-sst-acpi-objs := sst-match-acpi.o | 3 | snd-soc-sst-match-objs := sst-match-acpi.o |
| 4 | else | ||
| 5 | snd-soc-sst-acpi-objs := sst-acpi.o sst-match-acpi.o | ||
| 6 | endif | ||
| 7 | |||
| 8 | snd-soc-sst-ipc-objs := sst-ipc.o | 4 | snd-soc-sst-ipc-objs := sst-ipc.o |
| 9 | 5 | ||
| 10 | snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o | 6 | snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o |
| 11 | 7 | ||
| 12 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o | 8 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o |
| 13 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o | 9 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o |
| 10 | obj-$(CONFIG_SND_SOC_INTEL_SST_MATCH) += snd-soc-sst-match.o | ||
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c index 7a85c576dad3..2c5eda14d510 100644 --- a/sound/soc/intel/common/sst-acpi.c +++ b/sound/soc/intel/common/sst-acpi.c | |||
| @@ -215,6 +215,7 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { | |||
| 215 | .dma_size = SST_LPT_DSP_DMA_SIZE, | 215 | .dma_size = SST_LPT_DSP_DMA_SIZE, |
| 216 | }; | 216 | }; |
| 217 | 217 | ||
| 218 | #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI) | ||
| 218 | static struct sst_acpi_mach baytrail_machines[] = { | 219 | static struct sst_acpi_mach baytrail_machines[] = { |
| 219 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, | 220 | { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, |
| 220 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, | 221 | { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL }, |
| @@ -231,11 +232,14 @@ static struct sst_acpi_desc sst_acpi_baytrail_desc = { | |||
| 231 | .sst_id = SST_DEV_ID_BYT, | 232 | .sst_id = SST_DEV_ID_BYT, |
| 232 | .resindex_dma_base = -1, | 233 | .resindex_dma_base = -1, |
| 233 | }; | 234 | }; |
| 235 | #endif | ||
| 234 | 236 | ||
| 235 | static const struct acpi_device_id sst_acpi_match[] = { | 237 | static const struct acpi_device_id sst_acpi_match[] = { |
| 236 | { "INT33C8", (unsigned long)&sst_acpi_haswell_desc }, | 238 | { "INT33C8", (unsigned long)&sst_acpi_haswell_desc }, |
| 237 | { "INT3438", (unsigned long)&sst_acpi_broadwell_desc }, | 239 | { "INT3438", (unsigned long)&sst_acpi_broadwell_desc }, |
| 240 | #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI) | ||
| 238 | { "80860F28", (unsigned long)&sst_acpi_baytrail_desc }, | 241 | { "80860F28", (unsigned long)&sst_acpi_baytrail_desc }, |
| 242 | #endif | ||
| 239 | { } | 243 | { } |
| 240 | }; | 244 | }; |
| 241 | MODULE_DEVICE_TABLE(acpi, sst_acpi_match); | 245 | MODULE_DEVICE_TABLE(acpi, sst_acpi_match); |
diff --git a/sound/soc/intel/common/sst-match-acpi.c b/sound/soc/intel/common/sst-match-acpi.c index dd077e116d25..3b4539d21492 100644 --- a/sound/soc/intel/common/sst-match-acpi.c +++ b/sound/soc/intel/common/sst-match-acpi.c | |||
| @@ -41,3 +41,6 @@ struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines) | |||
| 41 | return NULL; | 41 | return NULL; |
| 42 | } | 42 | } |
| 43 | EXPORT_SYMBOL_GPL(sst_acpi_find_machine); | 43 | EXPORT_SYMBOL_GPL(sst_acpi_find_machine); |
| 44 | |||
| 45 | MODULE_LICENSE("GPL v2"); | ||
| 46 | MODULE_DESCRIPTION("Intel Common ACPI Match module"); | ||
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index de6dac496a0d..4629372d7c8e 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c | |||
| @@ -688,14 +688,14 @@ int skl_unbind_modules(struct skl_sst *ctx, | |||
| 688 | /* get src queue index */ | 688 | /* get src queue index */ |
| 689 | src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max); | 689 | src_index = skl_get_queue_index(src_mcfg->m_out_pin, dst_id, out_max); |
| 690 | if (src_index < 0) | 690 | if (src_index < 0) |
| 691 | return -EINVAL; | 691 | return 0; |
| 692 | 692 | ||
| 693 | msg.src_queue = src_index; | 693 | msg.src_queue = src_index; |
| 694 | 694 | ||
| 695 | /* get dst queue index */ | 695 | /* get dst queue index */ |
| 696 | dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max); | 696 | dst_index = skl_get_queue_index(dst_mcfg->m_in_pin, src_id, in_max); |
| 697 | if (dst_index < 0) | 697 | if (dst_index < 0) |
| 698 | return -EINVAL; | 698 | return 0; |
| 699 | 699 | ||
| 700 | msg.dst_queue = dst_index; | 700 | msg.dst_queue = dst_index; |
| 701 | 701 | ||
| @@ -747,7 +747,7 @@ int skl_bind_modules(struct skl_sst *ctx, | |||
| 747 | 747 | ||
| 748 | skl_dump_bind_info(ctx, src_mcfg, dst_mcfg); | 748 | skl_dump_bind_info(ctx, src_mcfg, dst_mcfg); |
| 749 | 749 | ||
| 750 | if (src_mcfg->m_state < SKL_MODULE_INIT_DONE && | 750 | if (src_mcfg->m_state < SKL_MODULE_INIT_DONE || |
| 751 | dst_mcfg->m_state < SKL_MODULE_INIT_DONE) | 751 | dst_mcfg->m_state < SKL_MODULE_INIT_DONE) |
| 752 | return 0; | 752 | return 0; |
| 753 | 753 | ||
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index f3553258091a..b6e6b61d10ec 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c | |||
| @@ -863,6 +863,7 @@ static int skl_get_delay_from_lpib(struct hdac_ext_bus *ebus, | |||
| 863 | else | 863 | else |
| 864 | delay += hstream->bufsize; | 864 | delay += hstream->bufsize; |
| 865 | } | 865 | } |
| 866 | delay = (hstream->bufsize == delay) ? 0 : delay; | ||
| 866 | 867 | ||
| 867 | if (delay >= hstream->period_bytes) { | 868 | if (delay >= hstream->period_bytes) { |
| 868 | dev_info(bus->dev, | 869 | dev_info(bus->dev, |
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 4624556f486d..a294fee431f0 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c | |||
| @@ -54,12 +54,9 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w) | |||
| 54 | 54 | ||
| 55 | /* | 55 | /* |
| 56 | * Each pipelines needs memory to be allocated. Check if we have free memory | 56 | * Each pipelines needs memory to be allocated. Check if we have free memory |
| 57 | * from available pool. Then only add this to pool | 57 | * from available pool. |
| 58 | * This is freed when pipe is deleted | ||
| 59 | * Note: DSP does actual memory management we only keep track for complete | ||
| 60 | * pool | ||
| 61 | */ | 58 | */ |
| 62 | static bool skl_tplg_alloc_pipe_mem(struct skl *skl, | 59 | static bool skl_is_pipe_mem_avail(struct skl *skl, |
| 63 | struct skl_module_cfg *mconfig) | 60 | struct skl_module_cfg *mconfig) |
| 64 | { | 61 | { |
| 65 | struct skl_sst *ctx = skl->skl_sst; | 62 | struct skl_sst *ctx = skl->skl_sst; |
| @@ -74,10 +71,20 @@ static bool skl_tplg_alloc_pipe_mem(struct skl *skl, | |||
| 74 | "exceeds ppl memory available %d mem %d\n", | 71 | "exceeds ppl memory available %d mem %d\n", |
| 75 | skl->resource.max_mem, skl->resource.mem); | 72 | skl->resource.max_mem, skl->resource.mem); |
| 76 | return false; | 73 | return false; |
| 74 | } else { | ||
| 75 | return true; | ||
| 77 | } | 76 | } |
| 77 | } | ||
| 78 | 78 | ||
| 79 | /* | ||
| 80 | * Add the mem to the mem pool. This is freed when pipe is deleted. | ||
| 81 | * Note: DSP does actual memory management we only keep track for complete | ||
| 82 | * pool | ||
| 83 | */ | ||
| 84 | static void skl_tplg_alloc_pipe_mem(struct skl *skl, | ||
| 85 | struct skl_module_cfg *mconfig) | ||
| 86 | { | ||
| 79 | skl->resource.mem += mconfig->pipe->memory_pages; | 87 | skl->resource.mem += mconfig->pipe->memory_pages; |
| 80 | return true; | ||
| 81 | } | 88 | } |
| 82 | 89 | ||
| 83 | /* | 90 | /* |
| @@ -85,10 +92,10 @@ static bool skl_tplg_alloc_pipe_mem(struct skl *skl, | |||
| 85 | * quantified in MCPS (Million Clocks Per Second) required for module/pipe | 92 | * quantified in MCPS (Million Clocks Per Second) required for module/pipe |
| 86 | * | 93 | * |
| 87 | * Each pipelines needs mcps to be allocated. Check if we have mcps for this | 94 | * Each pipelines needs mcps to be allocated. Check if we have mcps for this |
| 88 | * pipe. This adds the mcps to driver counter | 95 | * pipe. |
| 89 | * This is removed on pipeline delete | ||
| 90 | */ | 96 | */ |
| 91 | static bool skl_tplg_alloc_pipe_mcps(struct skl *skl, | 97 | |
| 98 | static bool skl_is_pipe_mcps_avail(struct skl *skl, | ||
| 92 | struct skl_module_cfg *mconfig) | 99 | struct skl_module_cfg *mconfig) |
| 93 | { | 100 | { |
| 94 | struct skl_sst *ctx = skl->skl_sst; | 101 | struct skl_sst *ctx = skl->skl_sst; |
| @@ -98,13 +105,18 @@ static bool skl_tplg_alloc_pipe_mcps(struct skl *skl, | |||
| 98 | "%s: module_id %d instance %d\n", __func__, | 105 | "%s: module_id %d instance %d\n", __func__, |
| 99 | mconfig->id.module_id, mconfig->id.instance_id); | 106 | mconfig->id.module_id, mconfig->id.instance_id); |
| 100 | dev_err(ctx->dev, | 107 | dev_err(ctx->dev, |
| 101 | "exceeds ppl memory available %d > mem %d\n", | 108 | "exceeds ppl mcps available %d > mem %d\n", |
| 102 | skl->resource.max_mcps, skl->resource.mcps); | 109 | skl->resource.max_mcps, skl->resource.mcps); |
| 103 | return false; | 110 | return false; |
| 111 | } else { | ||
| 112 | return true; | ||
| 104 | } | 113 | } |
| 114 | } | ||
| 105 | 115 | ||
| 116 | static void skl_tplg_alloc_pipe_mcps(struct skl *skl, | ||
| 117 | struct skl_module_cfg *mconfig) | ||
| 118 | { | ||
| 106 | skl->resource.mcps += mconfig->mcps; | 119 | skl->resource.mcps += mconfig->mcps; |
| 107 | return true; | ||
| 108 | } | 120 | } |
| 109 | 121 | ||
| 110 | /* | 122 | /* |
| @@ -411,7 +423,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) | |||
| 411 | mconfig = w->priv; | 423 | mconfig = w->priv; |
| 412 | 424 | ||
| 413 | /* check resource available */ | 425 | /* check resource available */ |
| 414 | if (!skl_tplg_alloc_pipe_mcps(skl, mconfig)) | 426 | if (!skl_is_pipe_mcps_avail(skl, mconfig)) |
| 415 | return -ENOMEM; | 427 | return -ENOMEM; |
| 416 | 428 | ||
| 417 | if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { | 429 | if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { |
| @@ -435,6 +447,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) | |||
| 435 | ret = skl_tplg_set_module_params(w, ctx); | 447 | ret = skl_tplg_set_module_params(w, ctx); |
| 436 | if (ret < 0) | 448 | if (ret < 0) |
| 437 | return ret; | 449 | return ret; |
| 450 | skl_tplg_alloc_pipe_mcps(skl, mconfig); | ||
| 438 | } | 451 | } |
| 439 | 452 | ||
| 440 | return 0; | 453 | return 0; |
| @@ -477,10 +490,10 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w, | |||
| 477 | struct skl_sst *ctx = skl->skl_sst; | 490 | struct skl_sst *ctx = skl->skl_sst; |
| 478 | 491 | ||
| 479 | /* check resource available */ | 492 | /* check resource available */ |
| 480 | if (!skl_tplg_alloc_pipe_mcps(skl, mconfig)) | 493 | if (!skl_is_pipe_mcps_avail(skl, mconfig)) |
| 481 | return -EBUSY; | 494 | return -EBUSY; |
| 482 | 495 | ||
| 483 | if (!skl_tplg_alloc_pipe_mem(skl, mconfig)) | 496 | if (!skl_is_pipe_mem_avail(skl, mconfig)) |
| 484 | return -ENOMEM; | 497 | return -ENOMEM; |
| 485 | 498 | ||
| 486 | /* | 499 | /* |
| @@ -526,11 +539,15 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w, | |||
| 526 | src_module = dst_module; | 539 | src_module = dst_module; |
| 527 | } | 540 | } |
| 528 | 541 | ||
| 542 | skl_tplg_alloc_pipe_mem(skl, mconfig); | ||
| 543 | skl_tplg_alloc_pipe_mcps(skl, mconfig); | ||
| 544 | |||
| 529 | return 0; | 545 | return 0; |
| 530 | } | 546 | } |
| 531 | 547 | ||
| 532 | static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, | 548 | static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, |
| 533 | struct skl *skl, | 549 | struct skl *skl, |
| 550 | struct snd_soc_dapm_widget *src_w, | ||
| 534 | struct skl_module_cfg *src_mconfig) | 551 | struct skl_module_cfg *src_mconfig) |
| 535 | { | 552 | { |
| 536 | struct snd_soc_dapm_path *p; | 553 | struct snd_soc_dapm_path *p; |
| @@ -547,6 +564,10 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, | |||
| 547 | dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name); | 564 | dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name); |
| 548 | 565 | ||
| 549 | next_sink = p->sink; | 566 | next_sink = p->sink; |
| 567 | |||
| 568 | if (!is_skl_dsp_widget_type(p->sink)) | ||
| 569 | return skl_tplg_bind_sinks(p->sink, skl, src_w, src_mconfig); | ||
| 570 | |||
| 550 | /* | 571 | /* |
| 551 | * here we will check widgets in sink pipelines, so that | 572 | * here we will check widgets in sink pipelines, so that |
| 552 | * can be any widgets type and we are only interested if | 573 | * can be any widgets type and we are only interested if |
| @@ -576,7 +597,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, | |||
| 576 | } | 597 | } |
| 577 | 598 | ||
| 578 | if (!sink) | 599 | if (!sink) |
| 579 | return skl_tplg_bind_sinks(next_sink, skl, src_mconfig); | 600 | return skl_tplg_bind_sinks(next_sink, skl, src_w, src_mconfig); |
| 580 | 601 | ||
| 581 | return 0; | 602 | return 0; |
| 582 | } | 603 | } |
| @@ -605,7 +626,7 @@ static int skl_tplg_pga_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w, | |||
| 605 | * if sink is not started, start sink pipe first, then start | 626 | * if sink is not started, start sink pipe first, then start |
| 606 | * this pipe | 627 | * this pipe |
| 607 | */ | 628 | */ |
| 608 | ret = skl_tplg_bind_sinks(w, skl, src_mconfig); | 629 | ret = skl_tplg_bind_sinks(w, skl, w, src_mconfig); |
| 609 | if (ret) | 630 | if (ret) |
| 610 | return ret; | 631 | return ret; |
| 611 | 632 | ||
| @@ -773,10 +794,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w, | |||
| 773 | continue; | 794 | continue; |
| 774 | } | 795 | } |
| 775 | 796 | ||
| 776 | ret = skl_unbind_modules(ctx, src_module, dst_module); | 797 | skl_unbind_modules(ctx, src_module, dst_module); |
| 777 | if (ret < 0) | ||
| 778 | return ret; | ||
| 779 | |||
| 780 | src_module = dst_module; | 798 | src_module = dst_module; |
| 781 | } | 799 | } |
| 782 | 800 | ||
| @@ -814,9 +832,6 @@ static int skl_tplg_pga_dapm_post_pmd_event(struct snd_soc_dapm_widget *w, | |||
| 814 | * This is a connecter and if path is found that means | 832 | * This is a connecter and if path is found that means |
| 815 | * unbind between source and sink has not happened yet | 833 | * unbind between source and sink has not happened yet |
| 816 | */ | 834 | */ |
| 817 | ret = skl_stop_pipe(ctx, sink_mconfig->pipe); | ||
| 818 | if (ret < 0) | ||
| 819 | return ret; | ||
| 820 | ret = skl_unbind_modules(ctx, src_mconfig, | 835 | ret = skl_unbind_modules(ctx, src_mconfig, |
| 821 | sink_mconfig); | 836 | sink_mconfig); |
| 822 | } | 837 | } |
| @@ -842,6 +857,12 @@ static int skl_tplg_vmixer_event(struct snd_soc_dapm_widget *w, | |||
| 842 | case SND_SOC_DAPM_PRE_PMU: | 857 | case SND_SOC_DAPM_PRE_PMU: |
| 843 | return skl_tplg_mixer_dapm_pre_pmu_event(w, skl); | 858 | return skl_tplg_mixer_dapm_pre_pmu_event(w, skl); |
| 844 | 859 | ||
| 860 | case SND_SOC_DAPM_POST_PMU: | ||
| 861 | return skl_tplg_mixer_dapm_post_pmu_event(w, skl); | ||
| 862 | |||
| 863 | case SND_SOC_DAPM_PRE_PMD: | ||
| 864 | return skl_tplg_mixer_dapm_pre_pmd_event(w, skl); | ||
| 865 | |||
| 845 | case SND_SOC_DAPM_POST_PMD: | 866 | case SND_SOC_DAPM_POST_PMD: |
| 846 | return skl_tplg_mixer_dapm_post_pmd_event(w, skl); | 867 | return skl_tplg_mixer_dapm_post_pmd_event(w, skl); |
| 847 | } | 868 | } |
| @@ -916,6 +937,13 @@ static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol, | |||
| 916 | skl_get_module_params(skl->skl_sst, (u32 *)bc->params, | 937 | skl_get_module_params(skl->skl_sst, (u32 *)bc->params, |
| 917 | bc->max, bc->param_id, mconfig); | 938 | bc->max, bc->param_id, mconfig); |
| 918 | 939 | ||
| 940 | /* decrement size for TLV header */ | ||
| 941 | size -= 2 * sizeof(u32); | ||
| 942 | |||
| 943 | /* check size as we don't want to send kernel data */ | ||
| 944 | if (size > bc->max) | ||
| 945 | size = bc->max; | ||
| 946 | |||
| 919 | if (bc->params) { | 947 | if (bc->params) { |
| 920 | if (copy_to_user(data, &bc->param_id, sizeof(u32))) | 948 | if (copy_to_user(data, &bc->param_id, sizeof(u32))) |
| 921 | return -EFAULT; | 949 | return -EFAULT; |
| @@ -1510,6 +1538,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) | |||
| 1510 | &skl_tplg_ops, fw, 0); | 1538 | &skl_tplg_ops, fw, 0); |
| 1511 | if (ret < 0) { | 1539 | if (ret < 0) { |
| 1512 | dev_err(bus->dev, "tplg component load failed%d\n", ret); | 1540 | dev_err(bus->dev, "tplg component load failed%d\n", ret); |
| 1541 | release_firmware(fw); | ||
| 1513 | return -EINVAL; | 1542 | return -EINVAL; |
| 1514 | } | 1543 | } |
| 1515 | 1544 | ||
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 443a15de94b5..092705e73db4 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c | |||
| @@ -614,8 +614,6 @@ static int skl_probe(struct pci_dev *pci, | |||
| 614 | goto out_unregister; | 614 | goto out_unregister; |
| 615 | 615 | ||
| 616 | /*configure PM */ | 616 | /*configure PM */ |
| 617 | pm_runtime_set_autosuspend_delay(bus->dev, SKL_SUSPEND_DELAY); | ||
| 618 | pm_runtime_use_autosuspend(bus->dev); | ||
| 619 | pm_runtime_put_noidle(bus->dev); | 617 | pm_runtime_put_noidle(bus->dev); |
| 620 | pm_runtime_allow(bus->dev); | 618 | pm_runtime_allow(bus->dev); |
| 621 | 619 | ||
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 15c04e2eae34..976967675387 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig | |||
| @@ -9,7 +9,7 @@ config SND_SOC_MEDIATEK | |||
| 9 | 9 | ||
| 10 | config SND_SOC_MT8173_MAX98090 | 10 | config SND_SOC_MT8173_MAX98090 |
| 11 | tristate "ASoC Audio driver for MT8173 with MAX98090 codec" | 11 | tristate "ASoC Audio driver for MT8173 with MAX98090 codec" |
| 12 | depends on SND_SOC_MEDIATEK | 12 | depends on SND_SOC_MEDIATEK && I2C |
| 13 | select SND_SOC_MAX98090 | 13 | select SND_SOC_MAX98090 |
| 14 | help | 14 | help |
| 15 | This adds ASoC driver for Mediatek MT8173 boards | 15 | This adds ASoC driver for Mediatek MT8173 boards |
| @@ -19,7 +19,7 @@ config SND_SOC_MT8173_MAX98090 | |||
| 19 | 19 | ||
| 20 | config SND_SOC_MT8173_RT5650_RT5676 | 20 | config SND_SOC_MT8173_RT5650_RT5676 |
| 21 | tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs" | 21 | tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs" |
| 22 | depends on SND_SOC_MEDIATEK | 22 | depends on SND_SOC_MEDIATEK && I2C |
| 23 | select SND_SOC_RT5645 | 23 | select SND_SOC_RT5645 |
| 24 | select SND_SOC_RT5677 | 24 | select SND_SOC_RT5677 |
| 25 | help | 25 | help |
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index c866ade28ad0..a6c7b8d87cd2 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
| @@ -381,9 +381,19 @@ static int mxs_saif_startup(struct snd_pcm_substream *substream, | |||
| 381 | __raw_writel(BM_SAIF_CTRL_CLKGATE, | 381 | __raw_writel(BM_SAIF_CTRL_CLKGATE, |
| 382 | saif->base + SAIF_CTRL + MXS_CLR_ADDR); | 382 | saif->base + SAIF_CTRL + MXS_CLR_ADDR); |
| 383 | 383 | ||
| 384 | clk_prepare(saif->clk); | ||
| 385 | |||
| 384 | return 0; | 386 | return 0; |
| 385 | } | 387 | } |
| 386 | 388 | ||
| 389 | static void mxs_saif_shutdown(struct snd_pcm_substream *substream, | ||
| 390 | struct snd_soc_dai *cpu_dai) | ||
| 391 | { | ||
| 392 | struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); | ||
| 393 | |||
| 394 | clk_unprepare(saif->clk); | ||
| 395 | } | ||
| 396 | |||
| 387 | /* | 397 | /* |
| 388 | * Should only be called when port is inactive. | 398 | * Should only be called when port is inactive. |
| 389 | * although can be called multiple times by upper layers. | 399 | * although can be called multiple times by upper layers. |
| @@ -424,8 +434,6 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream, | |||
| 424 | return ret; | 434 | return ret; |
| 425 | } | 435 | } |
| 426 | 436 | ||
| 427 | /* prepare clk in hw_param, enable in trigger */ | ||
| 428 | clk_prepare(saif->clk); | ||
| 429 | if (saif != master_saif) { | 437 | if (saif != master_saif) { |
| 430 | /* | 438 | /* |
| 431 | * Set an initial clock rate for the saif internal logic to work | 439 | * Set an initial clock rate for the saif internal logic to work |
| @@ -611,6 +619,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, | |||
| 611 | 619 | ||
| 612 | static const struct snd_soc_dai_ops mxs_saif_dai_ops = { | 620 | static const struct snd_soc_dai_ops mxs_saif_dai_ops = { |
| 613 | .startup = mxs_saif_startup, | 621 | .startup = mxs_saif_startup, |
| 622 | .shutdown = mxs_saif_shutdown, | ||
| 614 | .trigger = mxs_saif_trigger, | 623 | .trigger = mxs_saif_trigger, |
| 615 | .prepare = mxs_saif_prepare, | 624 | .prepare = mxs_saif_prepare, |
| 616 | .hw_params = mxs_saif_hw_params, | 625 | .hw_params = mxs_saif_hw_params, |
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 79688aa1941a..4aeb8e1a7160 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c | |||
| @@ -440,18 +440,18 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data) | |||
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, | 442 | static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, |
| 443 | struct snd_soc_pcm_runtime *soc_runtime) | 443 | struct snd_soc_pcm_runtime *rt) |
| 444 | { | 444 | { |
| 445 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 445 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
| 446 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; | 446 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; |
| 447 | 447 | ||
| 448 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | 448 | buf->dev.type = SNDRV_DMA_TYPE_DEV; |
| 449 | buf->dev.dev = soc_runtime->dev; | 449 | buf->dev.dev = rt->platform->dev; |
| 450 | buf->private_data = NULL; | 450 | buf->private_data = NULL; |
| 451 | buf->area = dma_alloc_coherent(soc_runtime->dev, size, &buf->addr, | 451 | buf->area = dma_alloc_coherent(rt->platform->dev, size, &buf->addr, |
| 452 | GFP_KERNEL); | 452 | GFP_KERNEL); |
| 453 | if (!buf->area) { | 453 | if (!buf->area) { |
| 454 | dev_err(soc_runtime->dev, "%s: Could not allocate DMA buffer\n", | 454 | dev_err(rt->platform->dev, "%s: Could not allocate DMA buffer\n", |
| 455 | __func__); | 455 | __func__); |
| 456 | return -ENOMEM; | 456 | return -ENOMEM; |
| 457 | } | 457 | } |
| @@ -461,12 +461,12 @@ static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, | |||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | static void lpass_platform_free_buffer(struct snd_pcm_substream *substream, | 463 | static void lpass_platform_free_buffer(struct snd_pcm_substream *substream, |
| 464 | struct snd_soc_pcm_runtime *soc_runtime) | 464 | struct snd_soc_pcm_runtime *rt) |
| 465 | { | 465 | { |
| 466 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 466 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
| 467 | 467 | ||
| 468 | if (buf->area) { | 468 | if (buf->area) { |
| 469 | dma_free_coherent(soc_runtime->dev, buf->bytes, buf->area, | 469 | dma_free_coherent(rt->dev, buf->bytes, buf->area, |
| 470 | buf->addr); | 470 | buf->addr); |
| 471 | } | 471 | } |
| 472 | buf->area = NULL; | 472 | buf->area = NULL; |
| @@ -499,9 +499,6 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) | |||
| 499 | 499 | ||
| 500 | snd_soc_pcm_set_drvdata(soc_runtime, data); | 500 | snd_soc_pcm_set_drvdata(soc_runtime, data); |
| 501 | 501 | ||
| 502 | soc_runtime->dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
| 503 | soc_runtime->dev->dma_mask = &soc_runtime->dev->coherent_dma_mask; | ||
| 504 | |||
| 505 | ret = lpass_platform_alloc_buffer(substream, soc_runtime); | 502 | ret = lpass_platform_alloc_buffer(substream, soc_runtime); |
| 506 | if (ret) | 503 | if (ret) |
| 507 | return ret; | 504 | return ret; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 5a2812fa8946..0d3707987900 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -310,7 +310,7 @@ struct dapm_kcontrol_data { | |||
| 310 | }; | 310 | }; |
| 311 | 311 | ||
| 312 | static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | 312 | static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, |
| 313 | struct snd_kcontrol *kcontrol) | 313 | struct snd_kcontrol *kcontrol, const char *ctrl_name) |
| 314 | { | 314 | { |
| 315 | struct dapm_kcontrol_data *data; | 315 | struct dapm_kcontrol_data *data; |
| 316 | struct soc_mixer_control *mc; | 316 | struct soc_mixer_control *mc; |
| @@ -333,7 +333,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
| 333 | if (mc->autodisable) { | 333 | if (mc->autodisable) { |
| 334 | struct snd_soc_dapm_widget template; | 334 | struct snd_soc_dapm_widget template; |
| 335 | 335 | ||
| 336 | name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, | 336 | name = kasprintf(GFP_KERNEL, "%s %s", ctrl_name, |
| 337 | "Autodisable"); | 337 | "Autodisable"); |
| 338 | if (!name) { | 338 | if (!name) { |
| 339 | ret = -ENOMEM; | 339 | ret = -ENOMEM; |
| @@ -371,7 +371,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
| 371 | if (e->autodisable) { | 371 | if (e->autodisable) { |
| 372 | struct snd_soc_dapm_widget template; | 372 | struct snd_soc_dapm_widget template; |
| 373 | 373 | ||
| 374 | name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, | 374 | name = kasprintf(GFP_KERNEL, "%s %s", ctrl_name, |
| 375 | "Autodisable"); | 375 | "Autodisable"); |
| 376 | if (!name) { | 376 | if (!name) { |
| 377 | ret = -ENOMEM; | 377 | ret = -ENOMEM; |
| @@ -871,7 +871,7 @@ static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w, | |||
| 871 | 871 | ||
| 872 | kcontrol->private_free = dapm_kcontrol_free; | 872 | kcontrol->private_free = dapm_kcontrol_free; |
| 873 | 873 | ||
| 874 | ret = dapm_kcontrol_data_alloc(w, kcontrol); | 874 | ret = dapm_kcontrol_data_alloc(w, kcontrol, name); |
| 875 | if (ret) { | 875 | if (ret) { |
| 876 | snd_ctl_free_one(kcontrol); | 876 | snd_ctl_free_one(kcontrol); |
| 877 | goto exit_free; | 877 | goto exit_free; |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index e898b427be7e..1af4f23697a7 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
| @@ -1810,7 +1810,8 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) | |||
| 1810 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && | 1810 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && |
| 1811 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && | 1811 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && |
| 1812 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && | 1812 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && |
| 1813 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) | 1813 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && |
| 1814 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) | ||
| 1814 | continue; | 1815 | continue; |
| 1815 | 1816 | ||
| 1816 | dev_dbg(be->dev, "ASoC: hw_free BE %s\n", | 1817 | dev_dbg(be->dev, "ASoC: hw_free BE %s\n", |
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index cc39f63299ef..007cf5831121 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c | |||
| @@ -2455,7 +2455,6 @@ int snd_usbmidi_create(struct snd_card *card, | |||
| 2455 | else | 2455 | else |
| 2456 | err = snd_usbmidi_create_endpoints(umidi, endpoints); | 2456 | err = snd_usbmidi_create_endpoints(umidi, endpoints); |
| 2457 | if (err < 0) { | 2457 | if (err < 0) { |
| 2458 | snd_usbmidi_free(umidi); | ||
| 2459 | return err; | 2458 | return err; |
| 2460 | } | 2459 | } |
| 2461 | 2460 | ||
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 81a2eb77ba7f..05d815851be1 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c | |||
| @@ -2068,6 +2068,15 @@ int intel_pt_process_auxtrace_info(union perf_event *event, | |||
| 2068 | err = -ENOMEM; | 2068 | err = -ENOMEM; |
| 2069 | goto err_free_queues; | 2069 | goto err_free_queues; |
| 2070 | } | 2070 | } |
| 2071 | |||
| 2072 | /* | ||
| 2073 | * Since this thread will not be kept in any rbtree not in a | ||
| 2074 | * list, initialize its list node so that at thread__put() the | ||
| 2075 | * current thread lifetime assuption is kept and we don't segfault | ||
| 2076 | * at list_del_init(). | ||
| 2077 | */ | ||
| 2078 | INIT_LIST_HEAD(&pt->unknown_thread->node); | ||
| 2079 | |||
| 2071 | err = thread__set_comm(pt->unknown_thread, "unknown", 0); | 2080 | err = thread__set_comm(pt->unknown_thread, "unknown", 0); |
| 2072 | if (err) | 2081 | if (err) |
| 2073 | goto err_delete_thread; | 2082 | goto err_delete_thread; |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 4f7b0efdde2f..813d9b272c81 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -399,6 +399,9 @@ static void tracepoint_error(struct parse_events_error *e, int err, | |||
| 399 | { | 399 | { |
| 400 | char help[BUFSIZ]; | 400 | char help[BUFSIZ]; |
| 401 | 401 | ||
| 402 | if (!e) | ||
| 403 | return; | ||
| 404 | |||
| 402 | /* | 405 | /* |
| 403 | * We get error directly from syscall errno ( > 0), | 406 | * We get error directly from syscall errno ( > 0), |
| 404 | * or from encoded pointer's error ( < 0). | 407 | * or from encoded pointer's error ( < 0). |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 2be10fb27172..4ce5c5e18f48 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
| @@ -686,8 +686,9 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf) | |||
| 686 | pf->fb_ops = NULL; | 686 | pf->fb_ops = NULL; |
| 687 | #if _ELFUTILS_PREREQ(0, 142) | 687 | #if _ELFUTILS_PREREQ(0, 142) |
| 688 | } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && | 688 | } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && |
| 689 | pf->cfi != NULL) { | 689 | (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) { |
| 690 | if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 || | 690 | if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 && |
| 691 | (dwarf_cfi_addrframe(pf->cfi_dbg, pf->addr, &frame) != 0)) || | ||
| 691 | dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { | 692 | dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { |
| 692 | pr_warning("Failed to get call frame on 0x%jx\n", | 693 | pr_warning("Failed to get call frame on 0x%jx\n", |
| 693 | (uintmax_t)pf->addr); | 694 | (uintmax_t)pf->addr); |
| @@ -1015,8 +1016,7 @@ static int pubname_search_cb(Dwarf *dbg, Dwarf_Global *gl, void *data) | |||
| 1015 | return DWARF_CB_OK; | 1016 | return DWARF_CB_OK; |
| 1016 | } | 1017 | } |
| 1017 | 1018 | ||
| 1018 | /* Find probe points from debuginfo */ | 1019 | static int debuginfo__find_probe_location(struct debuginfo *dbg, |
| 1019 | static int debuginfo__find_probes(struct debuginfo *dbg, | ||
| 1020 | struct probe_finder *pf) | 1020 | struct probe_finder *pf) |
| 1021 | { | 1021 | { |
| 1022 | struct perf_probe_point *pp = &pf->pev->point; | 1022 | struct perf_probe_point *pp = &pf->pev->point; |
| @@ -1025,27 +1025,6 @@ static int debuginfo__find_probes(struct debuginfo *dbg, | |||
| 1025 | Dwarf_Die *diep; | 1025 | Dwarf_Die *diep; |
| 1026 | int ret = 0; | 1026 | int ret = 0; |
| 1027 | 1027 | ||
| 1028 | #if _ELFUTILS_PREREQ(0, 142) | ||
| 1029 | Elf *elf; | ||
| 1030 | GElf_Ehdr ehdr; | ||
| 1031 | GElf_Shdr shdr; | ||
| 1032 | |||
| 1033 | /* Get the call frame information from this dwarf */ | ||
| 1034 | elf = dwarf_getelf(dbg->dbg); | ||
| 1035 | if (elf == NULL) | ||
| 1036 | return -EINVAL; | ||
| 1037 | |||
| 1038 | if (gelf_getehdr(elf, &ehdr) == NULL) | ||
| 1039 | return -EINVAL; | ||
| 1040 | |||
| 1041 | if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && | ||
| 1042 | shdr.sh_type == SHT_PROGBITS) { | ||
| 1043 | pf->cfi = dwarf_getcfi_elf(elf); | ||
| 1044 | } else { | ||
| 1045 | pf->cfi = dwarf_getcfi(dbg->dbg); | ||
| 1046 | } | ||
| 1047 | #endif | ||
| 1048 | |||
| 1049 | off = 0; | 1028 | off = 0; |
| 1050 | pf->lcache = intlist__new(NULL); | 1029 | pf->lcache = intlist__new(NULL); |
| 1051 | if (!pf->lcache) | 1030 | if (!pf->lcache) |
| @@ -1108,6 +1087,39 @@ found: | |||
| 1108 | return ret; | 1087 | return ret; |
| 1109 | } | 1088 | } |
| 1110 | 1089 | ||
| 1090 | /* Find probe points from debuginfo */ | ||
| 1091 | static int debuginfo__find_probes(struct debuginfo *dbg, | ||
| 1092 | struct probe_finder *pf) | ||
| 1093 | { | ||
| 1094 | int ret = 0; | ||
| 1095 | |||
| 1096 | #if _ELFUTILS_PREREQ(0, 142) | ||
| 1097 | Elf *elf; | ||
| 1098 | GElf_Ehdr ehdr; | ||
| 1099 | GElf_Shdr shdr; | ||
| 1100 | |||
| 1101 | if (pf->cfi_eh || pf->cfi_dbg) | ||
| 1102 | return debuginfo__find_probe_location(dbg, pf); | ||
| 1103 | |||
| 1104 | /* Get the call frame information from this dwarf */ | ||
| 1105 | elf = dwarf_getelf(dbg->dbg); | ||
| 1106 | if (elf == NULL) | ||
| 1107 | return -EINVAL; | ||
| 1108 | |||
| 1109 | if (gelf_getehdr(elf, &ehdr) == NULL) | ||
| 1110 | return -EINVAL; | ||
| 1111 | |||
| 1112 | if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && | ||
| 1113 | shdr.sh_type == SHT_PROGBITS) | ||
| 1114 | pf->cfi_eh = dwarf_getcfi_elf(elf); | ||
| 1115 | |||
| 1116 | pf->cfi_dbg = dwarf_getcfi(dbg->dbg); | ||
| 1117 | #endif | ||
| 1118 | |||
| 1119 | ret = debuginfo__find_probe_location(dbg, pf); | ||
| 1120 | return ret; | ||
| 1121 | } | ||
| 1122 | |||
| 1111 | struct local_vars_finder { | 1123 | struct local_vars_finder { |
| 1112 | struct probe_finder *pf; | 1124 | struct probe_finder *pf; |
| 1113 | struct perf_probe_arg *args; | 1125 | struct perf_probe_arg *args; |
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index bed82716e1b4..0aec7704e395 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
| @@ -76,7 +76,10 @@ struct probe_finder { | |||
| 76 | 76 | ||
| 77 | /* For variable searching */ | 77 | /* For variable searching */ |
| 78 | #if _ELFUTILS_PREREQ(0, 142) | 78 | #if _ELFUTILS_PREREQ(0, 142) |
| 79 | Dwarf_CFI *cfi; /* Call Frame Information */ | 79 | /* Call Frame Information from .eh_frame */ |
| 80 | Dwarf_CFI *cfi_eh; | ||
| 81 | /* Call Frame Information from .debug_frame */ | ||
| 82 | Dwarf_CFI *cfi_dbg; | ||
| 80 | #endif | 83 | #endif |
| 81 | Dwarf_Op *fb_ops; /* Frame base attribute */ | 84 | Dwarf_Op *fb_ops; /* Frame base attribute */ |
| 82 | struct perf_probe_arg *pvar; /* Current target variable */ | 85 | struct perf_probe_arg *pvar; /* Current target variable */ |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 2b58edccd56f..afb0c45eba34 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
| @@ -311,6 +311,16 @@ int perf_stat_process_counter(struct perf_stat_config *config, | |||
| 311 | 311 | ||
| 312 | aggr->val = aggr->ena = aggr->run = 0; | 312 | aggr->val = aggr->ena = aggr->run = 0; |
| 313 | 313 | ||
| 314 | /* | ||
| 315 | * We calculate counter's data every interval, | ||
| 316 | * and the display code shows ps->res_stats | ||
| 317 | * avg value. We need to zero the stats for | ||
| 318 | * interval mode, otherwise overall avg running | ||
| 319 | * averages will be shown for each interval. | ||
| 320 | */ | ||
| 321 | if (config->interval) | ||
| 322 | init_stats(ps->res_stats); | ||
| 323 | |||
| 314 | if (counter->per_pkg) | 324 | if (counter->per_pkg) |
| 315 | zero_per_pkg(counter); | 325 | zero_per_pkg(counter); |
| 316 | 326 | ||
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 69bca185c471..ea6064696fe4 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c | |||
| @@ -143,7 +143,7 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level) | |||
| 143 | * Check if there was a change in the timer state (should we raise or lower | 143 | * Check if there was a change in the timer state (should we raise or lower |
| 144 | * the line level to the GIC). | 144 | * the line level to the GIC). |
| 145 | */ | 145 | */ |
| 146 | static void kvm_timer_update_state(struct kvm_vcpu *vcpu) | 146 | static int kvm_timer_update_state(struct kvm_vcpu *vcpu) |
| 147 | { | 147 | { |
| 148 | struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; | 148 | struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; |
| 149 | 149 | ||
| @@ -154,10 +154,12 @@ static void kvm_timer_update_state(struct kvm_vcpu *vcpu) | |||
| 154 | * until we call this function from kvm_timer_flush_hwstate. | 154 | * until we call this function from kvm_timer_flush_hwstate. |
| 155 | */ | 155 | */ |
| 156 | if (!vgic_initialized(vcpu->kvm)) | 156 | if (!vgic_initialized(vcpu->kvm)) |
| 157 | return; | 157 | return -ENODEV; |
| 158 | 158 | ||
| 159 | if (kvm_timer_should_fire(vcpu) != timer->irq.level) | 159 | if (kvm_timer_should_fire(vcpu) != timer->irq.level) |
| 160 | kvm_timer_update_irq(vcpu, !timer->irq.level); | 160 | kvm_timer_update_irq(vcpu, !timer->irq.level); |
| 161 | |||
| 162 | return 0; | ||
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | /* | 165 | /* |
| @@ -218,7 +220,8 @@ void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) | |||
| 218 | bool phys_active; | 220 | bool phys_active; |
| 219 | int ret; | 221 | int ret; |
| 220 | 222 | ||
| 221 | kvm_timer_update_state(vcpu); | 223 | if (kvm_timer_update_state(vcpu)) |
| 224 | return; | ||
| 222 | 225 | ||
| 223 | /* | 226 | /* |
| 224 | * If we enter the guest with the virtual input level to the VGIC | 227 | * If we enter the guest with the virtual input level to the VGIC |
