aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mailmap6
-rw-r--r--Documentation/ABI/testing/sysfs-class-remoteproc4
-rw-r--r--Documentation/process/kernel-enforcement-statement.rst22
-rw-r--r--MAINTAINERS15
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.S9
-rw-r--r--arch/arm/boot/dts/armada-375.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-39x.dtsi4
-rw-r--r--arch/arm/boot/dts/uniphier-ld4.dtsi9
-rw-r--r--arch/arm/boot/dts/uniphier-pro4.dtsi6
-rw-r--r--arch/arm/boot/dts/uniphier-sld8.dtsi9
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/unaligned.h27
-rw-r--r--arch/arm/kvm/emulate.c6
-rw-r--r--arch/arm/kvm/hyp/Makefile2
-rw-r--r--arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi9
-rw-r--r--arch/arm64/kvm/hyp/Makefile2
-rw-r--r--arch/arm64/kvm/inject_fault.c16
-rw-r--r--arch/mips/generic/Makefile2
-rw-r--r--arch/mips/generic/Platform2
-rw-r--r--arch/mips/generic/board-ni169445.its.S2
-rw-r--r--arch/mips/generic/board-sead3.c2
-rw-r--r--arch/mips/generic/init.c4
-rw-r--r--arch/mips/generic/irq.c2
-rw-r--r--arch/mips/generic/kexec.c2
-rw-r--r--arch/mips/generic/proc.c2
-rw-r--r--arch/mips/generic/yamon-dt.c2
-rw-r--r--arch/mips/include/asm/dsemul.h2
-rw-r--r--arch/mips/include/asm/maar.h2
-rw-r--r--arch/mips/include/asm/mach-malta/malta-dtshim.h2
-rw-r--r--arch/mips/include/asm/mach-malta/malta-pm.h2
-rw-r--r--arch/mips/include/asm/machine.h2
-rw-r--r--arch/mips/include/asm/mips-cm.h6
-rw-r--r--arch/mips/include/asm/mips-cpc.h2
-rw-r--r--arch/mips/include/asm/mips-cps.h2
-rw-r--r--arch/mips/include/asm/mips-gic.h2
-rw-r--r--arch/mips/include/asm/msa.h2
-rw-r--r--arch/mips/include/asm/pm-cps.h2
-rw-r--r--arch/mips/include/asm/smp-cps.h2
-rw-r--r--arch/mips/include/asm/stackframe.h8
-rw-r--r--arch/mips/include/asm/yamon-dt.h2
-rw-r--r--arch/mips/kernel/cmpxchg.c2
-rw-r--r--arch/mips/kernel/cps-vec-ns16550.S2
-rw-r--r--arch/mips/kernel/cps-vec.S2
-rw-r--r--arch/mips/kernel/elf.c2
-rw-r--r--arch/mips/kernel/mips-cm.c2
-rw-r--r--arch/mips/kernel/mips-cpc.c2
-rw-r--r--arch/mips/kernel/pm-cps.c2
-rw-r--r--arch/mips/kernel/probes-common.h2
-rw-r--r--arch/mips/kernel/relocate.c2
-rw-r--r--arch/mips/kernel/smp-cmp.c6
-rw-r--r--arch/mips/kernel/smp-cps.c4
-rw-r--r--arch/mips/kernel/smp.c24
-rw-r--r--arch/mips/mm/sc-debugfs.c2
-rw-r--r--arch/mips/mm/uasm-micromips.c2
-rw-r--r--arch/mips/mti-malta/malta-dt.c2
-rw-r--r--arch/mips/mti-malta/malta-dtshim.c2
-rw-r--r--arch/mips/mti-malta/malta-pm.c2
-rw-r--r--arch/mips/net/ebpf_jit.c2
-rw-r--r--arch/mips/pci/pci-generic.c2
-rwxr-xr-xarch/mips/tools/generic-board-config.sh2
-rw-r--r--arch/powerpc/include/asm/code-patching.h10
-rw-r--r--arch/powerpc/kernel/align.c2
-rw-r--r--arch/powerpc/kernel/kprobes.c7
-rw-r--r--arch/powerpc/mm/tlb-radix.c2
-rw-r--r--arch/powerpc/perf/imc-pmu.c18
-rw-r--r--arch/tile/Makefile2
-rw-r--r--arch/tile/kernel/time.c1
-rw-r--r--arch/x86/kernel/cpu/Makefile2
-rw-r--r--arch/x86/kernel/cpu/aperfmperf.c11
-rw-r--r--arch/x86/kernel/cpu/proc.c4
-rw-r--r--arch/x86/kernel/kvmclock.c2
-rw-r--r--arch/x86/kvm/lapic.c5
-rw-r--r--arch/x86/kvm/vmx.c3
-rw-r--r--drivers/auxdisplay/img-ascii-lcd.c2
-rw-r--r--drivers/clk/imgtec/clk-boston.c2
-rw-r--r--drivers/clk/ingenic/cgu.c2
-rw-r--r--drivers/clk/ingenic/cgu.h2
-rw-r--r--drivers/clk/ingenic/jz4740-cgu.c2
-rw-r--r--drivers/clk/ingenic/jz4780-cgu.c2
-rw-r--r--drivers/clk/uniphier/clk-uniphier-sys.c6
-rw-r--r--drivers/cpuidle/cpuidle-cps.c2
-rw-r--r--drivers/firmware/efi/libstub/Makefile6
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v3_0.c12
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c19
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c13
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c51
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c6
-rw-r--r--drivers/input/sparse-keymap.c1
-rw-r--r--drivers/input/touchscreen/ar1021_i2c.c1
-rw-r--r--drivers/irqchip/irq-mvebu-gicp.c1
-rw-r--r--drivers/mmc/host/dw_mmc.c107
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c10
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c16
-rw-r--r--drivers/net/vrf.c2
-rw-r--r--drivers/power/reset/piix4-poweroff.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c1
-rw-r--r--fs/hugetlbfs/inode.c5
-rw-r--r--fs/ocfs2/alloc.c24
-rw-r--r--fs/proc/task_mmu.c6
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/stmmac.h8
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/net/act_api.h6
-rw-r--r--kernel/futex.c23
-rw-r--r--kernel/watchdog_hld.c15
-rw-r--r--mm/huge_memory.c3
-rw-r--r--mm/hugetlb.c32
-rw-r--r--mm/swapfile.c23
-rw-r--r--net/ipv4/fib_semantics.c16
-rw-r--r--net/ipv4/netfilter/nf_reject_ipv4.c2
-rw-r--r--net/ipv4/tcp_nv.c2
-rw-r--r--net/ipv4/tcp_output.c9
-rw-r--r--net/netfilter/nft_set_hash.c1
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/act_bpf.c2
-rw-r--r--net/sched/act_connmark.c2
-rw-r--r--net/sched/act_csum.c2
-rw-r--r--net/sched/act_gact.c2
-rw-r--r--net/sched/act_ife.c2
-rw-r--r--net/sched/act_ipt.c4
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/act_nat.c2
-rw-r--r--net/sched/act_pedit.c2
-rw-r--r--net/sched/act_police.c2
-rw-r--r--net/sched/act_sample.c2
-rw-r--r--net/sched/act_simple.c2
-rw-r--r--net/sched/act_skbedit.c2
-rw-r--r--net/sched/act_skbmod.c2
-rw-r--r--net/sched/act_tunnel_key.c2
-rw-r--r--net/sched/act_vlan.c2
-rw-r--r--tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk1
-rw-r--r--usr/Makefile9
-rw-r--r--virt/kvm/arm/arm.c31
-rw-r--r--virt/kvm/arm/vgic/vgic-its.c73
142 files changed, 659 insertions, 318 deletions
diff --git a/.mailmap b/.mailmap
index c7b10caecc4e..4757d361fd33 100644
--- a/.mailmap
+++ b/.mailmap
@@ -15,6 +15,7 @@ Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com>
15Alan Cox <alan@lxorguk.ukuu.org.uk> 15Alan Cox <alan@lxorguk.ukuu.org.uk>
16Alan Cox <root@hraefn.swansea.linux.org.uk> 16Alan Cox <root@hraefn.swansea.linux.org.uk>
17Aleksey Gorelov <aleksey_gorelov@phoenix.com> 17Aleksey Gorelov <aleksey_gorelov@phoenix.com>
18Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com>
18Al Viro <viro@ftp.linux.org.uk> 19Al Viro <viro@ftp.linux.org.uk>
19Al Viro <viro@zenIV.linux.org.uk> 20Al Viro <viro@zenIV.linux.org.uk>
20Andreas Herrmann <aherrman@de.ibm.com> 21Andreas Herrmann <aherrman@de.ibm.com>
@@ -43,6 +44,7 @@ Corey Minyard <minyard@acm.org>
43Damian Hobson-Garcia <dhobsong@igel.co.jp> 44Damian Hobson-Garcia <dhobsong@igel.co.jp>
44David Brownell <david-b@pacbell.net> 45David Brownell <david-b@pacbell.net>
45David Woodhouse <dwmw2@shinybook.infradead.org> 46David Woodhouse <dwmw2@shinybook.infradead.org>
47Deng-Cheng Zhu <dengcheng.zhu@mips.com> <dengcheng.zhu@imgtec.com>
46Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 48Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
47Domen Puncer <domen@coderock.org> 49Domen Puncer <domen@coderock.org>
48Douglas Gilbert <dougg@torque.net> 50Douglas Gilbert <dougg@torque.net>
@@ -100,6 +102,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com>
100Linas Vepstas <linas@austin.ibm.com> 102Linas Vepstas <linas@austin.ibm.com>
101Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> 103Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
102Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> 104Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
105Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com>
103Mark Brown <broonie@sirena.org.uk> 106Mark Brown <broonie@sirena.org.uk>
104Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com> 107Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>
105Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com> 108Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com>
@@ -114,9 +117,11 @@ Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@s-opensource.com>
114Matt Ranostay <mranostay@gmail.com> Matthew Ranostay <mranostay@embeddedalley.com> 117Matt Ranostay <mranostay@gmail.com> Matthew Ranostay <mranostay@embeddedalley.com>
115Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com> 118Matt Ranostay <mranostay@gmail.com> <matt.ranostay@intel.com>
116Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting> 119Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting>
120Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com>
117Mayuresh Janorkar <mayur@ti.com> 121Mayuresh Janorkar <mayur@ti.com>
118Michael Buesch <m@bues.ch> 122Michael Buesch <m@bues.ch>
119Michel Dänzer <michel@tungstengraphics.com> 123Michel Dänzer <michel@tungstengraphics.com>
124Miodrag Dinic <miodrag.dinic@mips.com> <miodrag.dinic@imgtec.com>
120Mitesh shah <mshah@teja.com> 125Mitesh shah <mshah@teja.com>
121Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com> 126Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com>
122Morten Welinder <terra@gnome.org> 127Morten Welinder <terra@gnome.org>
@@ -127,6 +132,7 @@ Mythri P K <mythripk@ti.com>
127Nguyen Anh Quynh <aquynh@gmail.com> 132Nguyen Anh Quynh <aquynh@gmail.com>
128Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 133Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
129Patrick Mochel <mochel@digitalimplant.org> 134Patrick Mochel <mochel@digitalimplant.org>
135Paul Burton <paul.burton@mips.com> <paul.burton@imgtec.com>
130Peter A Jonsson <pj@ludd.ltu.se> 136Peter A Jonsson <pj@ludd.ltu.se>
131Peter Oruba <peter@oruba.de> 137Peter Oruba <peter@oruba.de>
132Peter Oruba <peter.oruba@amd.com> 138Peter Oruba <peter.oruba@amd.com>
diff --git a/Documentation/ABI/testing/sysfs-class-remoteproc b/Documentation/ABI/testing/sysfs-class-remoteproc
index d188afebc8ba..c3afe9fab646 100644
--- a/Documentation/ABI/testing/sysfs-class-remoteproc
+++ b/Documentation/ABI/testing/sysfs-class-remoteproc
@@ -1,6 +1,6 @@
1What: /sys/class/remoteproc/.../firmware 1What: /sys/class/remoteproc/.../firmware
2Date: October 2016 2Date: October 2016
3Contact: Matt Redfearn <matt.redfearn@imgtec.com> 3Contact: Matt Redfearn <matt.redfearn@mips.com>
4Description: Remote processor firmware 4Description: Remote processor firmware
5 5
6 Reports the name of the firmware currently loaded to the 6 Reports the name of the firmware currently loaded to the
@@ -11,7 +11,7 @@ Description: Remote processor firmware
11 11
12What: /sys/class/remoteproc/.../state 12What: /sys/class/remoteproc/.../state
13Date: October 2016 13Date: October 2016
14Contact: Matt Redfearn <matt.redfearn@imgtec.com> 14Contact: Matt Redfearn <matt.redfearn@mips.com>
15Description: Remote processor state 15Description: Remote processor state
16 16
17 Reports the state of the remote processor, which will be one of: 17 Reports the state of the remote processor, which will be one of:
diff --git a/Documentation/process/kernel-enforcement-statement.rst b/Documentation/process/kernel-enforcement-statement.rst
index 1e23d4227337..b3170671a1df 100644
--- a/Documentation/process/kernel-enforcement-statement.rst
+++ b/Documentation/process/kernel-enforcement-statement.rst
@@ -50,8 +50,9 @@ be stronger.
50Except where noted below, we speak only for ourselves, and not for any company 50Except where noted below, we speak only for ourselves, and not for any company
51we might work for today, have in the past, or will in the future. 51we might work for today, have in the past, or will in the future.
52 52
53 - Laura Abbott
53 - Bjorn Andersson (Linaro) 54 - Bjorn Andersson (Linaro)
54 - Andrea Arcangeli (Red Hat) 55 - Andrea Arcangeli
55 - Neil Armstrong 56 - Neil Armstrong
56 - Jens Axboe 57 - Jens Axboe
57 - Pablo Neira Ayuso 58 - Pablo Neira Ayuso
@@ -60,15 +61,17 @@ we might work for today, have in the past, or will in the future.
60 - Felipe Balbi 61 - Felipe Balbi
61 - Arnd Bergmann 62 - Arnd Bergmann
62 - Ard Biesheuvel 63 - Ard Biesheuvel
63 - Paolo Bonzini (Red Hat) 64 - Tim Bird
65 - Paolo Bonzini
64 - Christian Borntraeger 66 - Christian Borntraeger
65 - Mark Brown (Linaro) 67 - Mark Brown (Linaro)
66 - Paul Burton 68 - Paul Burton
67 - Javier Martinez Canillas 69 - Javier Martinez Canillas
68 - Rob Clark 70 - Rob Clark
69 - Jonathan Corbet 71 - Jonathan Corbet
72 - Dennis Dalessandro
70 - Vivien Didelot (Savoir-faire Linux) 73 - Vivien Didelot (Savoir-faire Linux)
71 - Hans de Goede (Red Hat) 74 - Hans de Goede
72 - Mel Gorman (SUSE) 75 - Mel Gorman (SUSE)
73 - Sven Eckelmann 76 - Sven Eckelmann
74 - Alex Elder (Linaro) 77 - Alex Elder (Linaro)
@@ -79,6 +82,7 @@ we might work for today, have in the past, or will in the future.
79 - Juergen Gross 82 - Juergen Gross
80 - Shawn Guo 83 - Shawn Guo
81 - Ulf Hansson 84 - Ulf Hansson
85 - Stephen Hemminger (Microsoft)
82 - Tejun Heo 86 - Tejun Heo
83 - Rob Herring 87 - Rob Herring
84 - Masami Hiramatsu 88 - Masami Hiramatsu
@@ -104,18 +108,21 @@ we might work for today, have in the past, or will in the future.
104 - Viresh Kumar 108 - Viresh Kumar
105 - Aneesh Kumar K.V 109 - Aneesh Kumar K.V
106 - Julia Lawall 110 - Julia Lawall
107 - Doug Ledford (Red Hat) 111 - Doug Ledford
108 - Chuck Lever (Oracle) 112 - Chuck Lever (Oracle)
109 - Daniel Lezcano 113 - Daniel Lezcano
110 - Shaohua Li 114 - Shaohua Li
111 - Xin Long (Red Hat) 115 - Xin Long
112 - Tony Luck 116 - Tony Luck
117 - Catalin Marinas (Arm Ltd)
113 - Mike Marshall 118 - Mike Marshall
114 - Chris Mason 119 - Chris Mason
115 - Paul E. McKenney 120 - Paul E. McKenney
116 - David S. Miller 121 - David S. Miller
117 - Ingo Molnar 122 - Ingo Molnar
118 - Kuninori Morimoto 123 - Kuninori Morimoto
124 - Trond Myklebust
125 - Martin K. Petersen (Oracle)
119 - Borislav Petkov 126 - Borislav Petkov
120 - Jiri Pirko 127 - Jiri Pirko
121 - Josh Poimboeuf 128 - Josh Poimboeuf
@@ -124,18 +131,20 @@ we might work for today, have in the past, or will in the future.
124 - Joerg Roedel 131 - Joerg Roedel
125 - Leon Romanovsky 132 - Leon Romanovsky
126 - Steven Rostedt (VMware) 133 - Steven Rostedt (VMware)
127 - Ivan Safonov 134 - Frank Rowand
128 - Ivan Safonov 135 - Ivan Safonov
129 - Anna Schumaker 136 - Anna Schumaker
130 - Jes Sorensen 137 - Jes Sorensen
131 - K.Y. Srinivasan 138 - K.Y. Srinivasan
132 - Heiko Stuebner 139 - Heiko Stuebner
133 - Jiri Kosina (SUSE) 140 - Jiri Kosina (SUSE)
141 - Willy Tarreau
134 - Dmitry Torokhov 142 - Dmitry Torokhov
135 - Linus Torvalds 143 - Linus Torvalds
136 - Thierry Reding 144 - Thierry Reding
137 - Rik van Riel 145 - Rik van Riel
138 - Geert Uytterhoeven (Glider bvba) 146 - Geert Uytterhoeven (Glider bvba)
147 - Eduardo Valentin (Amazon.com)
139 - Daniel Vetter 148 - Daniel Vetter
140 - Linus Walleij 149 - Linus Walleij
141 - Richard Weinberger 150 - Richard Weinberger
@@ -145,3 +154,4 @@ we might work for today, have in the past, or will in the future.
145 - Masahiro Yamada 154 - Masahiro Yamada
146 - Wei Yongjun 155 - Wei Yongjun
147 - Lv Zheng 156 - Lv Zheng
157 - Marc Zyngier (Arm Ltd)
diff --git a/MAINTAINERS b/MAINTAINERS
index bf1d20695cbf..2f4e462aa4a2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -873,7 +873,7 @@ F: drivers/android/
873F: drivers/staging/android/ 873F: drivers/staging/android/
874 874
875ANDROID GOLDFISH RTC DRIVER 875ANDROID GOLDFISH RTC DRIVER
876M: Miodrag Dinic <miodrag.dinic@imgtec.com> 876M: Miodrag Dinic <miodrag.dinic@mips.com>
877S: Supported 877S: Supported
878F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt 878F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt
879F: drivers/rtc/rtc-goldfish.c 879F: drivers/rtc/rtc-goldfish.c
@@ -6733,7 +6733,7 @@ S: Maintained
6733F: drivers/usb/atm/ueagle-atm.c 6733F: drivers/usb/atm/ueagle-atm.c
6734 6734
6735IMGTEC ASCII LCD DRIVER 6735IMGTEC ASCII LCD DRIVER
6736M: Paul Burton <paul.burton@imgtec.com> 6736M: Paul Burton <paul.burton@mips.com>
6737S: Maintained 6737S: Maintained
6738F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt 6738F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
6739F: drivers/auxdisplay/img-ascii-lcd.c 6739F: drivers/auxdisplay/img-ascii-lcd.c
@@ -8993,7 +8993,7 @@ F: Documentation/mips/
8993F: arch/mips/ 8993F: arch/mips/
8994 8994
8995MIPS BOSTON DEVELOPMENT BOARD 8995MIPS BOSTON DEVELOPMENT BOARD
8996M: Paul Burton <paul.burton@imgtec.com> 8996M: Paul Burton <paul.burton@mips.com>
8997L: linux-mips@linux-mips.org 8997L: linux-mips@linux-mips.org
8998S: Maintained 8998S: Maintained
8999F: Documentation/devicetree/bindings/clock/img,boston-clock.txt 8999F: Documentation/devicetree/bindings/clock/img,boston-clock.txt
@@ -9003,7 +9003,7 @@ F: drivers/clk/imgtec/clk-boston.c
9003F: include/dt-bindings/clock/boston-clock.h 9003F: include/dt-bindings/clock/boston-clock.h
9004 9004
9005MIPS GENERIC PLATFORM 9005MIPS GENERIC PLATFORM
9006M: Paul Burton <paul.burton@imgtec.com> 9006M: Paul Burton <paul.burton@mips.com>
9007L: linux-mips@linux-mips.org 9007L: linux-mips@linux-mips.org
9008S: Supported 9008S: Supported
9009F: arch/mips/generic/ 9009F: arch/mips/generic/
@@ -9019,7 +9019,7 @@ F: drivers/*/*loongson1*
9019F: drivers/*/*/*loongson1* 9019F: drivers/*/*/*loongson1*
9020 9020
9021MIPS RINT INSTRUCTION EMULATION 9021MIPS RINT INSTRUCTION EMULATION
9022M: Aleksandar Markovic <aleksandar.markovic@imgtec.com> 9022M: Aleksandar Markovic <aleksandar.markovic@mips.com>
9023L: linux-mips@linux-mips.org 9023L: linux-mips@linux-mips.org
9024S: Supported 9024S: Supported
9025F: arch/mips/math-emu/sp_rint.c 9025F: arch/mips/math-emu/sp_rint.c
@@ -10683,10 +10683,9 @@ S: Maintained
10683F: drivers/pinctrl/spear/ 10683F: drivers/pinctrl/spear/
10684 10684
10685PISTACHIO SOC SUPPORT 10685PISTACHIO SOC SUPPORT
10686M: James Hartley <james.hartley@imgtec.com> 10686M: James Hartley <james.hartley@sondrel.com>
10687M: Ionela Voinescu <ionela.voinescu@imgtec.com>
10688L: linux-mips@linux-mips.org 10687L: linux-mips@linux-mips.org
10689S: Maintained 10688S: Odd Fixes
10690F: arch/mips/pistachio/ 10689F: arch/mips/pistachio/
10691F: arch/mips/include/asm/mach-pistachio/ 10690F: arch/mips/include/asm/mach-pistachio/
10692F: arch/mips/boot/dts/img/pistachio* 10691F: arch/mips/boot/dts/img/pistachio*
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 817e5cfef83a..36ae4454554c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -44,10 +44,12 @@ endif
44 44
45ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 45ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
46KBUILD_CPPFLAGS += -mbig-endian 46KBUILD_CPPFLAGS += -mbig-endian
47CHECKFLAGS += -D__ARMEB__
47AS += -EB 48AS += -EB
48LD += -EB 49LD += -EB
49else 50else
50KBUILD_CPPFLAGS += -mlittle-endian 51KBUILD_CPPFLAGS += -mlittle-endian
52CHECKFLAGS += -D__ARMEL__
51AS += -EL 53AS += -EL
52LD += -EL 54LD += -EL
53endif 55endif
diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
index 7a4c59154361..7d06aa19c3e6 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.S
+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -85,6 +85,15 @@ SECTIONS
85 85
86 _edata = .; 86 _edata = .;
87 87
88 /*
89 * The image_end section appears after any additional loadable sections
90 * that the linker may decide to insert in the binary image. Having
91 * this symbol allows further debug in the near future.
92 */
93 .image_end (NOLOAD) : {
94 _edata_real = .;
95 }
96
88 _magic_sig = ZIMAGE_MAGIC(0x016f2818); 97 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
89 _magic_start = ZIMAGE_MAGIC(_start); 98 _magic_start = ZIMAGE_MAGIC(_start);
90 _magic_end = ZIMAGE_MAGIC(_edata); 99 _magic_end = ZIMAGE_MAGIC(_edata);
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index 7225c7ce9a8d..2cb1bcd30976 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -178,9 +178,9 @@
178 reg = <0x8000 0x1000>; 178 reg = <0x8000 0x1000>;
179 cache-unified; 179 cache-unified;
180 cache-level = <2>; 180 cache-level = <2>;
181 arm,double-linefill-incr = <1>; 181 arm,double-linefill-incr = <0>;
182 arm,double-linefill-wrap = <0>; 182 arm,double-linefill-wrap = <0>;
183 arm,double-linefill = <1>; 183 arm,double-linefill = <0>;
184 prefetch-data = <1>; 184 prefetch-data = <1>;
185 }; 185 };
186 186
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 4960722aab32..00ff549d4e39 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -143,9 +143,9 @@
143 reg = <0x8000 0x1000>; 143 reg = <0x8000 0x1000>;
144 cache-unified; 144 cache-unified;
145 cache-level = <2>; 145 cache-level = <2>;
146 arm,double-linefill-incr = <1>; 146 arm,double-linefill-incr = <0>;
147 arm,double-linefill-wrap = <0>; 147 arm,double-linefill-wrap = <0>;
148 arm,double-linefill = <1>; 148 arm,double-linefill = <0>;
149 prefetch-data = <1>; 149 prefetch-data = <1>;
150 }; 150 };
151 151
diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi
index ea657071e278..5218bd2a248d 100644
--- a/arch/arm/boot/dts/armada-39x.dtsi
+++ b/arch/arm/boot/dts/armada-39x.dtsi
@@ -111,9 +111,9 @@
111 reg = <0x8000 0x1000>; 111 reg = <0x8000 0x1000>;
112 cache-unified; 112 cache-unified;
113 cache-level = <2>; 113 cache-level = <2>;
114 arm,double-linefill-incr = <1>; 114 arm,double-linefill-incr = <0>;
115 arm,double-linefill-wrap = <0>; 115 arm,double-linefill-wrap = <0>;
116 arm,double-linefill = <1>; 116 arm,double-linefill = <0>;
117 prefetch-data = <1>; 117 prefetch-data = <1>;
118 }; 118 };
119 119
diff --git a/arch/arm/boot/dts/uniphier-ld4.dtsi b/arch/arm/boot/dts/uniphier-ld4.dtsi
index 79183db5b386..93586faf950f 100644
--- a/arch/arm/boot/dts/uniphier-ld4.dtsi
+++ b/arch/arm/boot/dts/uniphier-ld4.dtsi
@@ -209,7 +209,8 @@
209 interrupts = <0 80 4>; 209 interrupts = <0 80 4>;
210 pinctrl-names = "default"; 210 pinctrl-names = "default";
211 pinctrl-0 = <&pinctrl_usb0>; 211 pinctrl-0 = <&pinctrl_usb0>;
212 clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>; 212 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
213 <&mio_clk 12>;
213 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, 214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214 <&mio_rst 12>; 215 <&mio_rst 12>;
215 }; 216 };
@@ -221,7 +222,8 @@
221 interrupts = <0 81 4>; 222 interrupts = <0 81 4>;
222 pinctrl-names = "default"; 223 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_usb1>; 224 pinctrl-0 = <&pinctrl_usb1>;
224 clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>; 225 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
226 <&mio_clk 13>;
225 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, 227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226 <&mio_rst 13>; 228 <&mio_rst 13>;
227 }; 229 };
@@ -233,7 +235,8 @@
233 interrupts = <0 82 4>; 235 interrupts = <0 82 4>;
234 pinctrl-names = "default"; 236 pinctrl-names = "default";
235 pinctrl-0 = <&pinctrl_usb2>; 237 pinctrl-0 = <&pinctrl_usb2>;
236 clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>; 238 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
239 <&mio_clk 14>;
237 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, 240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238 <&mio_rst 14>; 241 <&mio_rst 14>;
239 }; 242 };
diff --git a/arch/arm/boot/dts/uniphier-pro4.dtsi b/arch/arm/boot/dts/uniphier-pro4.dtsi
index b3dbbd9b6e39..2a9bd7f9f5db 100644
--- a/arch/arm/boot/dts/uniphier-pro4.dtsi
+++ b/arch/arm/boot/dts/uniphier-pro4.dtsi
@@ -241,7 +241,8 @@
241 interrupts = <0 80 4>; 241 interrupts = <0 80 4>;
242 pinctrl-names = "default"; 242 pinctrl-names = "default";
243 pinctrl-0 = <&pinctrl_usb2>; 243 pinctrl-0 = <&pinctrl_usb2>;
244 clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>; 244 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
245 <&mio_clk 12>;
245 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, 246 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
246 <&mio_rst 12>; 247 <&mio_rst 12>;
247 }; 248 };
@@ -253,7 +254,8 @@
253 interrupts = <0 81 4>; 254 interrupts = <0 81 4>;
254 pinctrl-names = "default"; 255 pinctrl-names = "default";
255 pinctrl-0 = <&pinctrl_usb3>; 256 pinctrl-0 = <&pinctrl_usb3>;
256 clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>; 257 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
258 <&mio_clk 13>;
257 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, 259 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
258 <&mio_rst 13>; 260 <&mio_rst 13>;
259 }; 261 };
diff --git a/arch/arm/boot/dts/uniphier-sld8.dtsi b/arch/arm/boot/dts/uniphier-sld8.dtsi
index b08390332971..ebd0c3f63e7f 100644
--- a/arch/arm/boot/dts/uniphier-sld8.dtsi
+++ b/arch/arm/boot/dts/uniphier-sld8.dtsi
@@ -209,7 +209,8 @@
209 interrupts = <0 80 4>; 209 interrupts = <0 80 4>;
210 pinctrl-names = "default"; 210 pinctrl-names = "default";
211 pinctrl-0 = <&pinctrl_usb0>; 211 pinctrl-0 = <&pinctrl_usb0>;
212 clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>; 212 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
213 <&mio_clk 12>;
213 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, 214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214 <&mio_rst 12>; 215 <&mio_rst 12>;
215 }; 216 };
@@ -221,7 +222,8 @@
221 interrupts = <0 81 4>; 222 interrupts = <0 81 4>;
222 pinctrl-names = "default"; 223 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_usb1>; 224 pinctrl-0 = <&pinctrl_usb1>;
224 clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>; 225 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
226 <&mio_clk 13>;
225 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, 227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226 <&mio_rst 13>; 228 <&mio_rst 13>;
227 }; 229 };
@@ -233,7 +235,8 @@
233 interrupts = <0 82 4>; 235 interrupts = <0 82 4>;
234 pinctrl-names = "default"; 236 pinctrl-names = "default";
235 pinctrl-0 = <&pinctrl_usb2>; 237 pinctrl-0 = <&pinctrl_usb2>;
236 clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>; 238 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
239 <&mio_clk 14>;
237 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, 240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238 <&mio_rst 14>; 241 <&mio_rst 14>;
239 }; 242 };
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 721ab5ecfb9b..0f2c8a2a8131 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -20,7 +20,6 @@ generic-y += simd.h
20generic-y += sizes.h 20generic-y += sizes.h
21generic-y += timex.h 21generic-y += timex.h
22generic-y += trace_clock.h 22generic-y += trace_clock.h
23generic-y += unaligned.h
24 23
25generated-y += mach-types.h 24generated-y += mach-types.h
26generated-y += unistd-nr.h 25generated-y += unistd-nr.h
diff --git a/arch/arm/include/asm/unaligned.h b/arch/arm/include/asm/unaligned.h
new file mode 100644
index 000000000000..ab905ffcf193
--- /dev/null
+++ b/arch/arm/include/asm/unaligned.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_ARM_UNALIGNED_H
2#define __ASM_ARM_UNALIGNED_H
3
4/*
5 * We generally want to set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS on ARMv6+,
6 * but we don't want to use linux/unaligned/access_ok.h since that can lead
7 * to traps on unaligned stm/ldm or strd/ldrd.
8 */
9#include <asm/byteorder.h>
10
11#if defined(__LITTLE_ENDIAN)
12# include <linux/unaligned/le_struct.h>
13# include <linux/unaligned/be_byteshift.h>
14# include <linux/unaligned/generic.h>
15# define get_unaligned __get_unaligned_le
16# define put_unaligned __put_unaligned_le
17#elif defined(__BIG_ENDIAN)
18# include <linux/unaligned/be_struct.h>
19# include <linux/unaligned/le_byteshift.h>
20# include <linux/unaligned/generic.h>
21# define get_unaligned __get_unaligned_be
22# define put_unaligned __put_unaligned_be
23#else
24# error need to define endianess
25#endif
26
27#endif /* __ASM_ARM_UNALIGNED_H */
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c
index 0064b86a2c87..30a13647c54c 100644
--- a/arch/arm/kvm/emulate.c
+++ b/arch/arm/kvm/emulate.c
@@ -227,7 +227,7 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
227 u32 return_offset = (is_thumb) ? 2 : 4; 227 u32 return_offset = (is_thumb) ? 2 : 4;
228 228
229 kvm_update_psr(vcpu, UND_MODE); 229 kvm_update_psr(vcpu, UND_MODE);
230 *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) - return_offset; 230 *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
231 231
232 /* Branch to exception vector */ 232 /* Branch to exception vector */
233 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset; 233 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset;
@@ -239,10 +239,8 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
239 */ 239 */
240static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr) 240static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
241{ 241{
242 unsigned long cpsr = *vcpu_cpsr(vcpu);
243 bool is_thumb = (cpsr & PSR_T_BIT);
244 u32 vect_offset; 242 u32 vect_offset;
245 u32 return_offset = (is_thumb) ? 4 : 0; 243 u32 return_offset = (is_pabt) ? 4 : 8;
246 bool is_lpae; 244 bool is_lpae;
247 245
248 kvm_update_psr(vcpu, ABT_MODE); 246 kvm_update_psr(vcpu, ABT_MODE);
diff --git a/arch/arm/kvm/hyp/Makefile b/arch/arm/kvm/hyp/Makefile
index 5fca24d52fe6..5638ce0c9524 100644
--- a/arch/arm/kvm/hyp/Makefile
+++ b/arch/arm/kvm/hyp/Makefile
@@ -3,7 +3,7 @@
3# Makefile for Kernel-based Virtual Machine module, HYP part 3# Makefile for Kernel-based Virtual Machine module, HYP part
4# 4#
5 5
6ccflags-y += -fno-stack-protector 6ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
7 7
8KVM=../../../../virt/kvm 8KVM=../../../../virt/kvm
9 9
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
index ee4aff53a5f5..09c429cb6d61 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
@@ -299,7 +299,8 @@
299 interrupts = <0 243 4>; 299 interrupts = <0 243 4>;
300 pinctrl-names = "default"; 300 pinctrl-names = "default";
301 pinctrl-0 = <&pinctrl_usb0>; 301 pinctrl-0 = <&pinctrl_usb0>;
302 clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>; 302 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
303 <&mio_clk 12>;
303 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, 304 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
304 <&mio_rst 12>; 305 <&mio_rst 12>;
305 }; 306 };
@@ -311,7 +312,8 @@
311 interrupts = <0 244 4>; 312 interrupts = <0 244 4>;
312 pinctrl-names = "default"; 313 pinctrl-names = "default";
313 pinctrl-0 = <&pinctrl_usb1>; 314 pinctrl-0 = <&pinctrl_usb1>;
314 clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>; 315 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
316 <&mio_clk 13>;
315 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, 317 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
316 <&mio_rst 13>; 318 <&mio_rst 13>;
317 }; 319 };
@@ -323,7 +325,8 @@
323 interrupts = <0 245 4>; 325 interrupts = <0 245 4>;
324 pinctrl-names = "default"; 326 pinctrl-names = "default";
325 pinctrl-0 = <&pinctrl_usb2>; 327 pinctrl-0 = <&pinctrl_usb2>;
326 clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>; 328 clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
329 <&mio_clk 14>;
327 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, 330 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
328 <&mio_rst 14>; 331 <&mio_rst 14>;
329 }; 332 };
diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
index 7c54d8fde855..f04400d494b7 100644
--- a/arch/arm64/kvm/hyp/Makefile
+++ b/arch/arm64/kvm/hyp/Makefile
@@ -3,7 +3,7 @@
3# Makefile for Kernel-based Virtual Machine module, HYP part 3# Makefile for Kernel-based Virtual Machine module, HYP part
4# 4#
5 5
6ccflags-y += -fno-stack-protector 6ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
7 7
8KVM=../../../../virt/kvm 8KVM=../../../../virt/kvm
9 9
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index da6a8cfa54a0..3556715a774e 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -33,12 +33,26 @@
33#define LOWER_EL_AArch64_VECTOR 0x400 33#define LOWER_EL_AArch64_VECTOR 0x400
34#define LOWER_EL_AArch32_VECTOR 0x600 34#define LOWER_EL_AArch32_VECTOR 0x600
35 35
36/*
37 * Table taken from ARMv8 ARM DDI0487B-B, table G1-10.
38 */
39static const u8 return_offsets[8][2] = {
40 [0] = { 0, 0 }, /* Reset, unused */
41 [1] = { 4, 2 }, /* Undefined */
42 [2] = { 0, 0 }, /* SVC, unused */
43 [3] = { 4, 4 }, /* Prefetch abort */
44 [4] = { 8, 8 }, /* Data abort */
45 [5] = { 0, 0 }, /* HVC, unused */
46 [6] = { 4, 4 }, /* IRQ, unused */
47 [7] = { 4, 4 }, /* FIQ, unused */
48};
49
36static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) 50static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
37{ 51{
38 unsigned long cpsr; 52 unsigned long cpsr;
39 unsigned long new_spsr_value = *vcpu_cpsr(vcpu); 53 unsigned long new_spsr_value = *vcpu_cpsr(vcpu);
40 bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT); 54 bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT);
41 u32 return_offset = (is_thumb) ? 4 : 0; 55 u32 return_offset = return_offsets[vect_offset >> 2][is_thumb];
42 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR); 56 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR);
43 57
44 cpsr = mode | COMPAT_PSR_I_BIT; 58 cpsr = mode | COMPAT_PSR_I_BIT;
diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
index 56b3ea565ed9..874967363dbb 100644
--- a/arch/mips/generic/Makefile
+++ b/arch/mips/generic/Makefile
@@ -1,6 +1,6 @@
1# 1#
2# Copyright (C) 2016 Imagination Technologies 2# Copyright (C) 2016 Imagination Technologies
3# Author: Paul Burton <paul.burton@imgtec.com> 3# Author: Paul Burton <paul.burton@mips.com>
4# 4#
5# This program is free software; you can redistribute it and/or modify it 5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the 6# under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/Platform b/arch/mips/generic/Platform
index f5312dfa8184..b51432dd10b6 100644
--- a/arch/mips/generic/Platform
+++ b/arch/mips/generic/Platform
@@ -1,6 +1,6 @@
1# 1#
2# Copyright (C) 2016 Imagination Technologies 2# Copyright (C) 2016 Imagination Technologies
3# Author: Paul Burton <paul.burton@imgtec.com> 3# Author: Paul Burton <paul.burton@mips.com>
4# 4#
5# This program is free software; you can redistribute it and/or modify it 5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the 6# under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/board-ni169445.its.S b/arch/mips/generic/board-ni169445.its.S
index d12e12fe90be..e4cb4f95a8cc 100644
--- a/arch/mips/generic/board-ni169445.its.S
+++ b/arch/mips/generic/board-ni169445.its.S
@@ -1,4 +1,4 @@
1{ 1/ {
2 images { 2 images {
3 fdt@ni169445 { 3 fdt@ni169445 {
4 description = "NI 169445 device tree"; 4 description = "NI 169445 device tree";
diff --git a/arch/mips/generic/board-sead3.c b/arch/mips/generic/board-sead3.c
index f109a6b9fdd0..10cf93d97346 100644
--- a/arch/mips/generic/board-sead3.c
+++ b/arch/mips/generic/board-sead3.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
index 15a7fb8e2a2e..5ba6fcc26fa7 100644
--- a/arch/mips/generic/init.c
+++ b/arch/mips/generic/init.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -20,7 +20,7 @@
20#include <asm/fw/fw.h> 20#include <asm/fw/fw.h>
21#include <asm/irq_cpu.h> 21#include <asm/irq_cpu.h>
22#include <asm/machine.h> 22#include <asm/machine.h>
23#include <asm/mips-cpc.h> 23#include <asm/mips-cps.h>
24#include <asm/prom.h> 24#include <asm/prom.h>
25#include <asm/smp-ops.h> 25#include <asm/smp-ops.h>
26#include <asm/time.h> 26#include <asm/time.h>
diff --git a/arch/mips/generic/irq.c b/arch/mips/generic/irq.c
index 5322d09dd51b..394f8161e462 100644
--- a/arch/mips/generic/irq.c
+++ b/arch/mips/generic/irq.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/kexec.c b/arch/mips/generic/kexec.c
index e9fb735299e3..1ca409f58929 100644
--- a/arch/mips/generic/kexec.c
+++ b/arch/mips/generic/kexec.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com> 3 * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/proc.c b/arch/mips/generic/proc.c
index 42b33250a4a2..199fb2cc57ee 100644
--- a/arch/mips/generic/proc.c
+++ b/arch/mips/generic/proc.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/generic/yamon-dt.c b/arch/mips/generic/yamon-dt.c
index 6077bca9b364..b408dac722ac 100644
--- a/arch/mips/generic/yamon-dt.c
+++ b/arch/mips/generic/yamon-dt.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/dsemul.h b/arch/mips/include/asm/dsemul.h
index a6e067801f23..b47a97527673 100644
--- a/arch/mips/include/asm/dsemul.h
+++ b/arch/mips/include/asm/dsemul.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/maar.h b/arch/mips/include/asm/maar.h
index e10f78befbd9..1e0da80bba13 100644
--- a/arch/mips/include/asm/maar.h
+++ b/arch/mips/include/asm/maar.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/mach-malta/malta-dtshim.h b/arch/mips/include/asm/mach-malta/malta-dtshim.h
index cfd777663c64..d696a7598ea7 100644
--- a/arch/mips/include/asm/mach-malta/malta-dtshim.h
+++ b/arch/mips/include/asm/mach-malta/malta-dtshim.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2015 Imagination Technologies 2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/mach-malta/malta-pm.h b/arch/mips/include/asm/mach-malta/malta-pm.h
index c2c2e201013d..347b53dbc88f 100644
--- a/arch/mips/include/asm/mach-malta/malta-pm.h
+++ b/arch/mips/include/asm/mach-malta/malta-pm.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/machine.h b/arch/mips/include/asm/machine.h
index ecb6c7335484..e0d9b373d415 100644
--- a/arch/mips/include/asm/machine.h
+++ b/arch/mips/include/asm/machine.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
index f6231b91b724..8bc5df49b0e1 100644
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -142,8 +142,8 @@ GCR_ACCESSOR_RO(64, 0x000, config)
142GCR_ACCESSOR_RW(64, 0x008, base) 142GCR_ACCESSOR_RW(64, 0x008, base)
143#define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15) 143#define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15)
144#define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0) 144#define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0)
145#define CM_GCR_BASE_CMDEFTGT_DISABLED 0 145#define CM_GCR_BASE_CMDEFTGT_MEM 0
146#define CM_GCR_BASE_CMDEFTGT_MEM 1 146#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
147#define CM_GCR_BASE_CMDEFTGT_IOCU0 2 147#define CM_GCR_BASE_CMDEFTGT_IOCU0 2
148#define CM_GCR_BASE_CMDEFTGT_IOCU1 3 148#define CM_GCR_BASE_CMDEFTGT_IOCU1 3
149 149
diff --git a/arch/mips/include/asm/mips-cpc.h b/arch/mips/include/asm/mips-cpc.h
index f885051a8378..b55e335cfba4 100644
--- a/arch/mips/include/asm/mips-cpc.h
+++ b/arch/mips/include/asm/mips-cpc.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/mips-cps.h b/arch/mips/include/asm/mips-cps.h
index bf02b5070a98..8ad4a85eed0c 100644
--- a/arch/mips/include/asm/mips-cps.h
+++ b/arch/mips/include/asm/mips-cps.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2017 Imagination Technologies 2 * Copyright (C) 2017 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/mips-gic.h b/arch/mips/include/asm/mips-gic.h
index a2badf572632..558059a8f218 100644
--- a/arch/mips/include/asm/mips-gic.h
+++ b/arch/mips/include/asm/mips-gic.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2017 Imagination Technologies 2 * Copyright (C) 2017 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h
index 8967b475ab10..b1845102f8f9 100644
--- a/arch/mips/include/asm/msa.h
+++ b/arch/mips/include/asm/msa.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/pm-cps.h b/arch/mips/include/asm/pm-cps.h
index 89d58d80b77b..bb0616967342 100644
--- a/arch/mips/include/asm/pm-cps.h
+++ b/arch/mips/include/asm/pm-cps.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/smp-cps.h b/arch/mips/include/asm/smp-cps.h
index 2ae1f61a4a95..16b4ee3feb98 100644
--- a/arch/mips/include/asm/smp-cps.h
+++ b/arch/mips/include/asm/smp-cps.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index 5d3563c55e0c..2161357cc68f 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -199,6 +199,10 @@
199 sll k0, 3 /* extract cu0 bit */ 199 sll k0, 3 /* extract cu0 bit */
200 .set noreorder 200 .set noreorder
201 bltz k0, 8f 201 bltz k0, 8f
202 move k0, sp
203 .if \docfi
204 .cfi_register sp, k0
205 .endif
202#ifdef CONFIG_EVA 206#ifdef CONFIG_EVA
203 /* 207 /*
204 * Flush interAptiv's Return Prediction Stack (RPS) by writing 208 * Flush interAptiv's Return Prediction Stack (RPS) by writing
@@ -225,10 +229,6 @@
225 MTC0 k0, CP0_ENTRYHI 229 MTC0 k0, CP0_ENTRYHI
226#endif 230#endif
227 .set reorder 231 .set reorder
228 move k0, sp
229 .if \docfi
230 .cfi_register sp, k0
231 .endif
232 /* Called from user mode, new stack. */ 232 /* Called from user mode, new stack. */
233 get_saved_sp docfi=\docfi tosp=1 233 get_saved_sp docfi=\docfi tosp=1
2348: 2348:
diff --git a/arch/mips/include/asm/yamon-dt.h b/arch/mips/include/asm/yamon-dt.h
index 485cfe3e45e1..10a073e6877a 100644
--- a/arch/mips/include/asm/yamon-dt.h
+++ b/arch/mips/include/asm/yamon-dt.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/cmpxchg.c b/arch/mips/kernel/cmpxchg.c
index 7730f1d3434f..0b9535bc2c53 100644
--- a/arch/mips/kernel/cmpxchg.c
+++ b/arch/mips/kernel/cmpxchg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2017 Imagination Technologies 2 * Copyright (C) 2017 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/cps-vec-ns16550.S b/arch/mips/kernel/cps-vec-ns16550.S
index 6d246ad05638..b37af23a5358 100644
--- a/arch/mips/kernel/cps-vec-ns16550.S
+++ b/arch/mips/kernel/cps-vec-ns16550.S
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2015 Imagination Technologies 2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index d173b49f212d..c7ed26029cbb 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/elf.c b/arch/mips/kernel/elf.c
index 0828d6d963b7..731325a61a78 100644
--- a/arch/mips/kernel/elf.c
+++ b/arch/mips/kernel/elf.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c
index e91c8c4e2eb5..dd5567b1e305 100644
--- a/arch/mips/kernel/mips-cm.c
+++ b/arch/mips/kernel/mips-cm.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
index f66b05ebf637..19c88d770054 100644
--- a/arch/mips/kernel/mips-cpc.c
+++ b/arch/mips/kernel/mips-cpc.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index 4655017f2377..9dd624c2fe56 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/probes-common.h b/arch/mips/kernel/probes-common.h
index dd08e41134b6..d2bf77b18822 100644
--- a/arch/mips/kernel/probes-common.h
+++ b/arch/mips/kernel/probes-common.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com> 3 * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 2d1a0c438771..cbf4cc0b0b6c 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -6,7 +6,7 @@
6 * Support for Kernel relocation at boot time 6 * Support for Kernel relocation at boot time
7 * 7 *
8 * Copyright (C) 2015, Imagination Technologies Ltd. 8 * Copyright (C) 2015, Imagination Technologies Ltd.
9 * Authors: Matt Redfearn (matt.redfearn@imgtec.com) 9 * Authors: Matt Redfearn (matt.redfearn@mips.com)
10 */ 10 */
11#include <asm/bootinfo.h> 11#include <asm/bootinfo.h>
12#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index 05295a4909f1..a2322009cac3 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -19,7 +19,7 @@
19#undef DEBUG 19#undef DEBUG
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/sched.h> 22#include <linux/sched/task_stack.h>
23#include <linux/smp.h> 23#include <linux/smp.h>
24#include <linux/cpumask.h> 24#include <linux/cpumask.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
@@ -50,8 +50,8 @@ static void cmp_init_secondary(void)
50 50
51#ifdef CONFIG_MIPS_MT_SMP 51#ifdef CONFIG_MIPS_MT_SMP
52 if (cpu_has_mipsmt) 52 if (cpu_has_mipsmt)
53 c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & 53 cpu_set_vpe_id(c, (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
54 TCBIND_CURVPE; 54 TCBIND_CURVPE);
55#endif 55#endif
56} 56}
57 57
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 0063122c85da..ecc1a853f48d 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2013 Imagination Technologies 2 * Copyright (C) 2013 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -306,7 +306,7 @@ static int cps_boot_secondary(int cpu, struct task_struct *idle)
306 int err; 306 int err;
307 307
308 /* We don't yet support booting CPUs in other clusters */ 308 /* We don't yet support booting CPUs in other clusters */
309 if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(&current_cpu_data)) 309 if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(&raw_current_cpu_data))
310 return -ENOSYS; 310 return -ENOSYS;
311 311
312 vpe_cfg->pc = (unsigned long)&smp_bootstrap; 312 vpe_cfg->pc = (unsigned long)&smp_bootstrap;
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index bbe19b64def5..88be966d3e61 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -42,7 +42,7 @@
42#include <asm/processor.h> 42#include <asm/processor.h>
43#include <asm/idle.h> 43#include <asm/idle.h>
44#include <asm/r4k-timer.h> 44#include <asm/r4k-timer.h>
45#include <asm/mips-cpc.h> 45#include <asm/mips-cps.h>
46#include <asm/mmu_context.h> 46#include <asm/mmu_context.h>
47#include <asm/time.h> 47#include <asm/time.h>
48#include <asm/setup.h> 48#include <asm/setup.h>
@@ -66,6 +66,7 @@ EXPORT_SYMBOL(cpu_sibling_map);
66cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 66cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
67EXPORT_SYMBOL(cpu_core_map); 67EXPORT_SYMBOL(cpu_core_map);
68 68
69static DECLARE_COMPLETION(cpu_starting);
69static DECLARE_COMPLETION(cpu_running); 70static DECLARE_COMPLETION(cpu_running);
70 71
71/* 72/*
@@ -374,6 +375,12 @@ asmlinkage void start_secondary(void)
374 cpumask_set_cpu(cpu, &cpu_coherent_mask); 375 cpumask_set_cpu(cpu, &cpu_coherent_mask);
375 notify_cpu_starting(cpu); 376 notify_cpu_starting(cpu);
376 377
378 /* Notify boot CPU that we're starting & ready to sync counters */
379 complete(&cpu_starting);
380
381 synchronise_count_slave(cpu);
382
383 /* The CPU is running and counters synchronised, now mark it online */
377 set_cpu_online(cpu, true); 384 set_cpu_online(cpu, true);
378 385
379 set_cpu_sibling_map(cpu); 386 set_cpu_sibling_map(cpu);
@@ -381,8 +388,11 @@ asmlinkage void start_secondary(void)
381 388
382 calculate_cpu_foreign_map(); 389 calculate_cpu_foreign_map();
383 390
391 /*
392 * Notify boot CPU that we're up & online and it can safely return
393 * from __cpu_up
394 */
384 complete(&cpu_running); 395 complete(&cpu_running);
385 synchronise_count_slave(cpu);
386 396
387 /* 397 /*
388 * irq will be enabled in ->smp_finish(), enabling it too early 398 * irq will be enabled in ->smp_finish(), enabling it too early
@@ -445,17 +455,17 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
445 if (err) 455 if (err)
446 return err; 456 return err;
447 457
448 /* 458 /* Wait for CPU to start and be ready to sync counters */
449 * We must check for timeout here, as the CPU will not be marked 459 if (!wait_for_completion_timeout(&cpu_starting,
450 * online until the counters are synchronised.
451 */
452 if (!wait_for_completion_timeout(&cpu_running,
453 msecs_to_jiffies(1000))) { 460 msecs_to_jiffies(1000))) {
454 pr_crit("CPU%u: failed to start\n", cpu); 461 pr_crit("CPU%u: failed to start\n", cpu);
455 return -EIO; 462 return -EIO;
456 } 463 }
457 464
458 synchronise_count_master(cpu); 465 synchronise_count_master(cpu);
466
467 /* Wait for CPU to finish startup & mark itself online before return */
468 wait_for_completion(&cpu_running);
459 return 0; 469 return 0;
460} 470}
461 471
diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c
index 7e945e310b44..2e2132d3f5c7 100644
--- a/arch/mips/mm/sc-debugfs.c
+++ b/arch/mips/mm/sc-debugfs.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2015 Imagination Technologies 2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index c28ff53c8da0..cdb5a191b9d5 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -80,7 +80,7 @@ static const struct insn const insn_table_MM[insn_invalid] = {
80 [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS}, 80 [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS},
81 [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM}, 81 [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
82 [insn_ld] = {0, 0}, 82 [insn_ld] = {0, 0},
83 [insn_lh] = {M(mm_lh32_op, 0, 0, 0, 0, 0), RS | RS | SIMM}, 83 [insn_lh] = {M(mm_lh32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
84 [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM}, 84 [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM},
85 [insn_lld] = {0, 0}, 85 [insn_lld] = {0, 0},
86 [insn_lui] = {M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM}, 86 [insn_lui] = {M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM},
diff --git a/arch/mips/mti-malta/malta-dt.c b/arch/mips/mti-malta/malta-dt.c
index 4822943100f3..b397117033aa 100644
--- a/arch/mips/mti-malta/malta-dt.c
+++ b/arch/mips/mti-malta/malta-dt.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2015 Imagination Technologies 2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/mti-malta/malta-dtshim.c b/arch/mips/mti-malta/malta-dtshim.c
index a6699c15277d..7859b6e49863 100644
--- a/arch/mips/mti-malta/malta-dtshim.c
+++ b/arch/mips/mti-malta/malta-dtshim.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2015 Imagination Technologies 2 * Copyright (C) 2015 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/mti-malta/malta-pm.c b/arch/mips/mti-malta/malta-pm.c
index c1e456c01a44..efbd659fb602 100644
--- a/arch/mips/mti-malta/malta-pm.c
+++ b/arch/mips/mti-malta/malta-pm.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
index 01b7a87ea678..962b0259b4b6 100644
--- a/arch/mips/net/ebpf_jit.c
+++ b/arch/mips/net/ebpf_jit.c
@@ -1513,7 +1513,7 @@ ld_skb_common:
1513 } 1513 }
1514 src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp); 1514 src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
1515 if (src < 0) 1515 if (src < 0)
1516 return dst; 1516 return src;
1517 if (BPF_MODE(insn->code) == BPF_XADD) { 1517 if (BPF_MODE(insn->code) == BPF_XADD) {
1518 switch (BPF_SIZE(insn->code)) { 1518 switch (BPF_SIZE(insn->code)) {
1519 case BPF_W: 1519 case BPF_W:
diff --git a/arch/mips/pci/pci-generic.c b/arch/mips/pci/pci-generic.c
index dce304dc3d62..676348164027 100644
--- a/arch/mips/pci/pci-generic.c
+++ b/arch/mips/pci/pci-generic.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * pcibios_align_resource taken from arch/arm/kernel/bios32.c. 5 * pcibios_align_resource taken from arch/arm/kernel/bios32.c.
6 * 6 *
diff --git a/arch/mips/tools/generic-board-config.sh b/arch/mips/tools/generic-board-config.sh
index 654d652d7fa1..08849f83ef6c 100755
--- a/arch/mips/tools/generic-board-config.sh
+++ b/arch/mips/tools/generic-board-config.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Copyright (C) 2017 Imagination Technologies 3# Copyright (C) 2017 Imagination Technologies
4# Author: Paul Burton <paul.burton@imgtec.com> 4# Author: Paul Burton <paul.burton@mips.com>
5# 5#
6# This program is free software; you can redistribute it and/or modify it 6# This program is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License as published by the 7# under the terms of the GNU General Public License as published by the
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 5482928eea1b..abef812de7f8 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -83,16 +83,8 @@ static inline unsigned long ppc_function_entry(void *func)
83 * On PPC64 ABIv1 the function pointer actually points to the 83 * On PPC64 ABIv1 the function pointer actually points to the
84 * function's descriptor. The first entry in the descriptor is the 84 * function's descriptor. The first entry in the descriptor is the
85 * address of the function text. 85 * address of the function text.
86 *
87 * However, we may also receive pointer to an assembly symbol. To
88 * detect that, we first check if the function pointer we receive
89 * already points to kernel/module text and we only dereference it
90 * if it doesn't.
91 */ 86 */
92 if (kernel_text_address((unsigned long)func)) 87 return ((func_descr_t *)func)->entry;
93 return (unsigned long)func;
94 else
95 return ((func_descr_t *)func)->entry;
96#else 88#else
97 return (unsigned long)func; 89 return (unsigned long)func;
98#endif 90#endif
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 43ef25156480..3e6c0744c174 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -332,7 +332,7 @@ int fix_alignment(struct pt_regs *regs)
332 * when pasting to a co-processor. Furthermore, paste_last is the 332 * when pasting to a co-processor. Furthermore, paste_last is the
333 * synchronisation point for preceding copy/paste sequences. 333 * synchronisation point for preceding copy/paste sequences.
334 */ 334 */
335 if ((instr & 0xfc0006fe) == PPC_INST_COPY) 335 if ((instr & 0xfc0006fe) == (PPC_INST_COPY & 0xfc0006fe))
336 return -EIO; 336 return -EIO;
337 337
338 r = analyse_instr(&op, regs, instr); 338 r = analyse_instr(&op, regs, instr);
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 367494dc67d9..bebc3007a793 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -600,7 +600,12 @@ NOKPROBE_SYMBOL(kprobe_fault_handler);
600 600
601unsigned long arch_deref_entry_point(void *entry) 601unsigned long arch_deref_entry_point(void *entry)
602{ 602{
603 return ppc_global_function_entry(entry); 603#ifdef PPC64_ELF_ABI_v1
604 if (!kernel_text_address((unsigned long)entry))
605 return ppc_global_function_entry(entry);
606 else
607#endif
608 return (unsigned long)entry;
604} 609}
605NOKPROBE_SYMBOL(arch_deref_entry_point); 610NOKPROBE_SYMBOL(arch_deref_entry_point);
606 611
diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
index b3e849c4886e..d304028641a2 100644
--- a/arch/powerpc/mm/tlb-radix.c
+++ b/arch/powerpc/mm/tlb-radix.c
@@ -360,12 +360,14 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
360 360
361 361
362 pid = mm ? mm->context.id : 0; 362 pid = mm ? mm->context.id : 0;
363 preempt_disable();
363 if (unlikely(pid == MMU_NO_CONTEXT)) 364 if (unlikely(pid == MMU_NO_CONTEXT))
364 goto no_context; 365 goto no_context;
365 366
366 /* 4k page size, just blow the world */ 367 /* 4k page size, just blow the world */
367 if (PAGE_SIZE == 0x1000) { 368 if (PAGE_SIZE == 0x1000) {
368 radix__flush_all_mm(mm); 369 radix__flush_all_mm(mm);
370 preempt_enable();
369 return; 371 return;
370 } 372 }
371 373
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 88126245881b..36344117c680 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -607,6 +607,20 @@ static int ppc_core_imc_cpu_offline(unsigned int cpu)
607 if (!cpumask_test_and_clear_cpu(cpu, &core_imc_cpumask)) 607 if (!cpumask_test_and_clear_cpu(cpu, &core_imc_cpumask))
608 return 0; 608 return 0;
609 609
610 /*
611 * Check whether core_imc is registered. We could end up here
612 * if the cpuhotplug callback registration fails. i.e, callback
613 * invokes the offline path for all sucessfully registered cpus.
614 * At this stage, core_imc pmu will not be registered and we
615 * should return here.
616 *
617 * We return with a zero since this is not an offline failure.
618 * And cpuhp_setup_state() returns the actual failure reason
619 * to the caller, which inturn will call the cleanup routine.
620 */
621 if (!core_imc_pmu->pmu.event_init)
622 return 0;
623
610 /* Find any online cpu in that core except the current "cpu" */ 624 /* Find any online cpu in that core except the current "cpu" */
611 ncpu = cpumask_any_but(cpu_sibling_mask(cpu), cpu); 625 ncpu = cpumask_any_but(cpu_sibling_mask(cpu), cpu);
612 626
@@ -1104,7 +1118,7 @@ static int init_nest_pmu_ref(void)
1104 1118
1105static void cleanup_all_core_imc_memory(void) 1119static void cleanup_all_core_imc_memory(void)
1106{ 1120{
1107 int i, nr_cores = num_present_cpus() / threads_per_core; 1121 int i, nr_cores = DIV_ROUND_UP(num_present_cpus(), threads_per_core);
1108 struct imc_mem_info *ptr = core_imc_pmu->mem_info; 1122 struct imc_mem_info *ptr = core_imc_pmu->mem_info;
1109 int size = core_imc_pmu->counter_mem_size; 1123 int size = core_imc_pmu->counter_mem_size;
1110 1124
@@ -1212,7 +1226,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
1212 if (!pmu_ptr->pmu.name) 1226 if (!pmu_ptr->pmu.name)
1213 return -ENOMEM; 1227 return -ENOMEM;
1214 1228
1215 nr_cores = num_present_cpus() / threads_per_core; 1229 nr_cores = DIV_ROUND_UP(num_present_cpus(), threads_per_core);
1216 pmu_ptr->mem_info = kcalloc(nr_cores, sizeof(struct imc_mem_info), 1230 pmu_ptr->mem_info = kcalloc(nr_cores, sizeof(struct imc_mem_info),
1217 GFP_KERNEL); 1231 GFP_KERNEL);
1218 1232
diff --git a/arch/tile/Makefile b/arch/tile/Makefile
index 4dc380a519d4..8fa0befba32b 100644
--- a/arch/tile/Makefile
+++ b/arch/tile/Makefile
@@ -51,6 +51,8 @@ else
51BITS := 32 51BITS := 32
52endif 52endif
53 53
54CHECKFLAGS += -m$(BITS)
55
54head-y := arch/tile/kernel/head_$(BITS).o 56head-y := arch/tile/kernel/head_$(BITS).o
55 57
56libs-y += arch/tile/lib/ 58libs-y += arch/tile/lib/
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 6643ffbc0615..f95d65f3162b 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -162,6 +162,7 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = {
162 .set_next_event = tile_timer_set_next_event, 162 .set_next_event = tile_timer_set_next_event,
163 .set_state_shutdown = tile_timer_shutdown, 163 .set_state_shutdown = tile_timer_shutdown,
164 .set_state_oneshot = tile_timer_shutdown, 164 .set_state_oneshot = tile_timer_shutdown,
165 .set_state_oneshot_stopped = tile_timer_shutdown,
165 .tick_resume = tile_timer_shutdown, 166 .tick_resume = tile_timer_shutdown,
166}; 167};
167 168
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index c60922a66385..236999c54edc 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -22,7 +22,7 @@ obj-y += common.o
22obj-y += rdrand.o 22obj-y += rdrand.o
23obj-y += match.o 23obj-y += match.o
24obj-y += bugs.o 24obj-y += bugs.o
25obj-$(CONFIG_CPU_FREQ) += aperfmperf.o 25obj-y += aperfmperf.o
26 26
27obj-$(CONFIG_PROC_FS) += proc.o 27obj-$(CONFIG_PROC_FS) += proc.o
28obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o 28obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c
index 0ee83321a313..957813e0180d 100644
--- a/arch/x86/kernel/cpu/aperfmperf.c
+++ b/arch/x86/kernel/cpu/aperfmperf.c
@@ -42,10 +42,6 @@ static void aperfmperf_snapshot_khz(void *dummy)
42 s64 time_delta = ktime_ms_delta(now, s->time); 42 s64 time_delta = ktime_ms_delta(now, s->time);
43 unsigned long flags; 43 unsigned long flags;
44 44
45 /* Don't bother re-computing within the cache threshold time. */
46 if (time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
47 return;
48
49 local_irq_save(flags); 45 local_irq_save(flags);
50 rdmsrl(MSR_IA32_APERF, aperf); 46 rdmsrl(MSR_IA32_APERF, aperf);
51 rdmsrl(MSR_IA32_MPERF, mperf); 47 rdmsrl(MSR_IA32_MPERF, mperf);
@@ -74,6 +70,7 @@ static void aperfmperf_snapshot_khz(void *dummy)
74 70
75unsigned int arch_freq_get_on_cpu(int cpu) 71unsigned int arch_freq_get_on_cpu(int cpu)
76{ 72{
73 s64 time_delta;
77 unsigned int khz; 74 unsigned int khz;
78 75
79 if (!cpu_khz) 76 if (!cpu_khz)
@@ -82,6 +79,12 @@ unsigned int arch_freq_get_on_cpu(int cpu)
82 if (!static_cpu_has(X86_FEATURE_APERFMPERF)) 79 if (!static_cpu_has(X86_FEATURE_APERFMPERF))
83 return 0; 80 return 0;
84 81
82 /* Don't bother re-computing within the cache threshold time. */
83 time_delta = ktime_ms_delta(ktime_get(), per_cpu(samples.time, cpu));
84 khz = per_cpu(samples.khz, cpu);
85 if (khz && time_delta < APERFMPERF_CACHE_THRESHOLD_MS)
86 return khz;
87
85 smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1); 88 smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1);
86 khz = per_cpu(samples.khz, cpu); 89 khz = per_cpu(samples.khz, cpu);
87 if (khz) 90 if (khz)
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 6b7e17bf0b71..4378a729b933 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -78,9 +78,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
78 seq_printf(m, "microcode\t: 0x%x\n", c->microcode); 78 seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
79 79
80 if (cpu_has(c, X86_FEATURE_TSC)) { 80 if (cpu_has(c, X86_FEATURE_TSC)) {
81 unsigned int freq = cpufreq_quick_get(cpu); 81 unsigned int freq = arch_freq_get_on_cpu(cpu);
82 82
83 if (!freq) 83 if (!freq)
84 freq = cpufreq_quick_get(cpu);
85 if (!freq)
84 freq = cpu_khz; 86 freq = cpu_khz;
85 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 87 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
86 freq / 1000, (freq % 1000)); 88 freq / 1000, (freq % 1000));
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index d88967659098..5b609e28ce3f 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -79,7 +79,7 @@ static void kvm_get_wallclock(struct timespec *now)
79 79
80static int kvm_set_wallclock(const struct timespec *now) 80static int kvm_set_wallclock(const struct timespec *now)
81{ 81{
82 return -1; 82 return -ENODEV;
83} 83}
84 84
85static u64 kvm_clock_read(void) 85static u64 kvm_clock_read(void)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 69c5612be786..36c90d631096 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1992,6 +1992,11 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
1992 vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP); 1992 vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP);
1993 vcpu->arch.pv_eoi.msr_val = 0; 1993 vcpu->arch.pv_eoi.msr_val = 0;
1994 apic_update_ppr(apic); 1994 apic_update_ppr(apic);
1995 if (vcpu->arch.apicv_active) {
1996 kvm_x86_ops->apicv_post_state_restore(vcpu);
1997 kvm_x86_ops->hwapic_irr_update(vcpu, -1);
1998 kvm_x86_ops->hwapic_isr_update(vcpu, -1);
1999 }
1995 2000
1996 vcpu->arch.apic_arb_prio = 0; 2001 vcpu->arch.apic_arb_prio = 0;
1997 vcpu->arch.apic_attention = 0; 2002 vcpu->arch.apic_attention = 0;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 95a01609d7ee..a6f4f095f8f4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5619,9 +5619,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
5619 5619
5620 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu); 5620 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
5621 5621
5622 if (kvm_vcpu_apicv_active(vcpu))
5623 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
5624
5625 if (vmx->vpid != 0) 5622 if (vmx->vpid != 0)
5626 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid); 5623 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
5627 5624
diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c
index 25306fa27251..a9020f82eea7 100644
--- a/drivers/auxdisplay/img-ascii-lcd.c
+++ b/drivers/auxdisplay/img-ascii-lcd.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c
index f18f10351785..15af423cc0c9 100644
--- a/drivers/clk/imgtec/clk-boston.c
+++ b/drivers/clk/imgtec/clk-boston.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016-2017 Imagination Technologies 2 * Copyright (C) 2016-2017 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index e8248f9185f7..ab393637f7b0 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -2,7 +2,7 @@
2 * Ingenic SoC CGU driver 2 * Ingenic SoC CGU driver
3 * 3 *
4 * Copyright (c) 2013-2015 Imagination Technologies 4 * Copyright (c) 2013-2015 Imagination Technologies
5 * Author: Paul Burton <paul.burton@imgtec.com> 5 * Author: Paul Burton <paul.burton@mips.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
diff --git a/drivers/clk/ingenic/cgu.h b/drivers/clk/ingenic/cgu.h
index 09700b2c555d..e78b586536ea 100644
--- a/drivers/clk/ingenic/cgu.h
+++ b/drivers/clk/ingenic/cgu.h
@@ -2,7 +2,7 @@
2 * Ingenic SoC CGU driver 2 * Ingenic SoC CGU driver
3 * 3 *
4 * Copyright (c) 2013-2015 Imagination Technologies 4 * Copyright (c) 2013-2015 Imagination Technologies
5 * Author: Paul Burton <paul.burton@imgtec.com> 5 * Author: Paul Burton <paul.burton@mips.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c
index 510fe7e0c8f1..32fcc75f6f77 100644
--- a/drivers/clk/ingenic/jz4740-cgu.c
+++ b/drivers/clk/ingenic/jz4740-cgu.c
@@ -2,7 +2,7 @@
2 * Ingenic JZ4740 SoC CGU driver 2 * Ingenic JZ4740 SoC CGU driver
3 * 3 *
4 * Copyright (c) 2015 Imagination Technologies 4 * Copyright (c) 2015 Imagination Technologies
5 * Author: Paul Burton <paul.burton@imgtec.com> 5 * Author: Paul Burton <paul.burton@mips.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
diff --git a/drivers/clk/ingenic/jz4780-cgu.c b/drivers/clk/ingenic/jz4780-cgu.c
index b35d6d9dd5aa..ac3585ed8228 100644
--- a/drivers/clk/ingenic/jz4780-cgu.c
+++ b/drivers/clk/ingenic/jz4780-cgu.c
@@ -2,7 +2,7 @@
2 * Ingenic JZ4780 SoC CGU driver 2 * Ingenic JZ4780 SoC CGU driver
3 * 3 *
4 * Copyright (c) 2013-2015 Imagination Technologies 4 * Copyright (c) 2013-2015 Imagination Technologies
5 * Author: Paul Burton <paul.burton@imgtec.com> 5 * Author: Paul Burton <paul.burton@mips.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
diff --git a/drivers/clk/uniphier/clk-uniphier-sys.c b/drivers/clk/uniphier/clk-uniphier-sys.c
index 0e396f3da526..07f3b91a7daf 100644
--- a/drivers/clk/uniphier/clk-uniphier-sys.c
+++ b/drivers/clk/uniphier/clk-uniphier-sys.c
@@ -233,9 +233,9 @@ const struct uniphier_clk_data uniphier_pxs3_sys_clk_data[] = {
233 UNIPHIER_LD20_SYS_CLK_SD, 233 UNIPHIER_LD20_SYS_CLK_SD,
234 UNIPHIER_LD11_SYS_CLK_NAND(2), 234 UNIPHIER_LD11_SYS_CLK_NAND(2),
235 UNIPHIER_LD11_SYS_CLK_EMMC(4), 235 UNIPHIER_LD11_SYS_CLK_EMMC(4),
236 UNIPHIER_CLK_GATE("usb30", 12, NULL, 0x2104, 4), /* =GIO0 */ 236 UNIPHIER_CLK_GATE("usb30", 12, NULL, 0x210c, 4), /* =GIO0 */
237 UNIPHIER_CLK_GATE("usb31-0", 13, NULL, 0x2104, 5), /* =GIO1 */ 237 UNIPHIER_CLK_GATE("usb31-0", 13, NULL, 0x210c, 5), /* =GIO1 */
238 UNIPHIER_CLK_GATE("usb31-1", 14, NULL, 0x2104, 6), /* =GIO1-1 */ 238 UNIPHIER_CLK_GATE("usb31-1", 14, NULL, 0x210c, 6), /* =GIO1-1 */
239 UNIPHIER_CLK_GATE("usb30-phy0", 16, NULL, 0x210c, 16), 239 UNIPHIER_CLK_GATE("usb30-phy0", 16, NULL, 0x210c, 16),
240 UNIPHIER_CLK_GATE("usb30-phy1", 17, NULL, 0x210c, 18), 240 UNIPHIER_CLK_GATE("usb30-phy1", 17, NULL, 0x210c, 18),
241 UNIPHIER_CLK_GATE("usb30-phy2", 18, NULL, 0x210c, 20), 241 UNIPHIER_CLK_GATE("usb30-phy2", 18, NULL, 0x210c, 20),
diff --git a/drivers/cpuidle/cpuidle-cps.c b/drivers/cpuidle/cpuidle-cps.c
index 72b5e47286b4..dac8ff6391fa 100644
--- a/drivers/cpuidle/cpuidle-cps.c
+++ b/drivers/cpuidle/cpuidle-cps.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2014 Imagination Technologies 2 * Copyright (C) 2014 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 2371a92808be..adaa4a964f0c 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -34,13 +34,14 @@ lib-y := efi-stub-helper.o gop.o secureboot.o
34lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o 34lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o
35 35
36# include the stub's generic dependencies from lib/ when building for ARM/arm64 36# include the stub's generic dependencies from lib/ when building for ARM/arm64
37arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c 37arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c
38arm-deps-$(CONFIG_ARM64) += sort.c
38 39
39$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE 40$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
40 $(call if_changed_rule,cc_o_c) 41 $(call if_changed_rule,cc_o_c)
41 42
42lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \ 43lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \
43 $(patsubst %.c,lib-%.o,$(arm-deps)) 44 $(patsubst %.c,lib-%.o,$(arm-deps-y))
44 45
45lib-$(CONFIG_ARM) += arm32-stub.o 46lib-$(CONFIG_ARM) += arm32-stub.o
46lib-$(CONFIG_ARM64) += arm64-stub.o 47lib-$(CONFIG_ARM64) += arm64-stub.o
@@ -91,5 +92,4 @@ quiet_cmd_stubcopy = STUBCPY $@
91# explicitly by the decompressor linker script. 92# explicitly by the decompressor linker script.
92# 93#
93STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub 94STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
94STUBCOPY_RM-$(CONFIG_ARM) += -R ___ksymtab+sort -R ___kcrctab+sort
95STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS 95STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index a94601d5939e..01a9d78ee415 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -350,7 +350,9 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
350 * The easiest way to find adjacent regions is to sort the memory map 350 * The easiest way to find adjacent regions is to sort the memory map
351 * before traversing it. 351 * before traversing it.
352 */ 352 */
353 sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL); 353 if (IS_ENABLED(CONFIG_ARM64))
354 sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc,
355 NULL);
354 356
355 for (l = 0; l < map_size; l += desc_size, prev = in) { 357 for (l = 0; l < map_size; l += desc_size, prev = in) {
356 u64 paddr, size; 358 u64 paddr, size;
@@ -367,7 +369,8 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
367 * a 4k page size kernel to kexec a 64k page size kernel and 369 * a 4k page size kernel to kexec a 64k page size kernel and
368 * vice versa. 370 * vice versa.
369 */ 371 */
370 if (!regions_are_adjacent(prev, in) || 372 if ((IS_ENABLED(CONFIG_ARM64) &&
373 !regions_are_adjacent(prev, in)) ||
371 !regions_have_compatible_memory_type_attrs(prev, in)) { 374 !regions_have_compatible_memory_type_attrs(prev, in)) {
372 375
373 paddr = round_down(in->phys_addr, SZ_64K); 376 paddr = round_down(in->phys_addr, SZ_64K);
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 430a6b4dfac9..62cd16a23921 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -93,6 +93,10 @@ static int uvd_v6_0_early_init(void *handle)
93{ 93{
94 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 94 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
95 95
96 if (!(adev->flags & AMD_IS_APU) &&
97 (RREG32_SMC(ixCC_HARVEST_FUSES) & CC_HARVEST_FUSES__UVD_DISABLE_MASK))
98 return -ENOENT;
99
96 uvd_v6_0_set_ring_funcs(adev); 100 uvd_v6_0_set_ring_funcs(adev);
97 uvd_v6_0_set_irq_funcs(adev); 101 uvd_v6_0_set_irq_funcs(adev);
98 102
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 90332f55cfba..cf81065e3c5a 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -365,15 +365,10 @@ static unsigned vce_v3_0_get_harvest_config(struct amdgpu_device *adev)
365{ 365{
366 u32 tmp; 366 u32 tmp;
367 367
368 /* Fiji, Stoney, Polaris10, Polaris11, Polaris12 are single pipe */
369 if ((adev->asic_type == CHIP_FIJI) || 368 if ((adev->asic_type == CHIP_FIJI) ||
370 (adev->asic_type == CHIP_STONEY) || 369 (adev->asic_type == CHIP_STONEY))
371 (adev->asic_type == CHIP_POLARIS10) ||
372 (adev->asic_type == CHIP_POLARIS11) ||
373 (adev->asic_type == CHIP_POLARIS12))
374 return AMDGPU_VCE_HARVEST_VCE1; 370 return AMDGPU_VCE_HARVEST_VCE1;
375 371
376 /* Tonga and CZ are dual or single pipe */
377 if (adev->flags & AMD_IS_APU) 372 if (adev->flags & AMD_IS_APU)
378 tmp = (RREG32_SMC(ixVCE_HARVEST_FUSE_MACRO__ADDRESS) & 373 tmp = (RREG32_SMC(ixVCE_HARVEST_FUSE_MACRO__ADDRESS) &
379 VCE_HARVEST_FUSE_MACRO__MASK) >> 374 VCE_HARVEST_FUSE_MACRO__MASK) >>
@@ -391,6 +386,11 @@ static unsigned vce_v3_0_get_harvest_config(struct amdgpu_device *adev)
391 case 3: 386 case 3:
392 return AMDGPU_VCE_HARVEST_VCE0 | AMDGPU_VCE_HARVEST_VCE1; 387 return AMDGPU_VCE_HARVEST_VCE0 | AMDGPU_VCE_HARVEST_VCE1;
393 default: 388 default:
389 if ((adev->asic_type == CHIP_POLARIS10) ||
390 (adev->asic_type == CHIP_POLARIS11) ||
391 (adev->asic_type == CHIP_POLARIS12))
392 return AMDGPU_VCE_HARVEST_VCE1;
393
394 return 0; 394 return 0;
395 } 395 }
396} 396}
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 32e857dc507c..dc1faa49687d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2214,8 +2214,10 @@ static void __i915_gem_object_reset_page_iter(struct drm_i915_gem_object *obj)
2214 struct radix_tree_iter iter; 2214 struct radix_tree_iter iter;
2215 void __rcu **slot; 2215 void __rcu **slot;
2216 2216
2217 rcu_read_lock();
2217 radix_tree_for_each_slot(slot, &obj->mm.get_page.radix, &iter, 0) 2218 radix_tree_for_each_slot(slot, &obj->mm.get_page.radix, &iter, 0)
2218 radix_tree_delete(&obj->mm.get_page.radix, iter.index); 2219 radix_tree_delete(&obj->mm.get_page.radix, iter.index);
2220 rcu_read_unlock();
2219} 2221}
2220 2222
2221void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj, 2223void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 58a2a44f88bd..8afd2ce59b8d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -104,6 +104,7 @@ static void lut_close(struct i915_gem_context *ctx)
104 kmem_cache_free(ctx->i915->luts, lut); 104 kmem_cache_free(ctx->i915->luts, lut);
105 } 105 }
106 106
107 rcu_read_lock();
107 radix_tree_for_each_slot(slot, &ctx->handles_vma, &iter, 0) { 108 radix_tree_for_each_slot(slot, &ctx->handles_vma, &iter, 0) {
108 struct i915_vma *vma = rcu_dereference_raw(*slot); 109 struct i915_vma *vma = rcu_dereference_raw(*slot);
109 struct drm_i915_gem_object *obj = vma->obj; 110 struct drm_i915_gem_object *obj = vma->obj;
@@ -115,6 +116,7 @@ static void lut_close(struct i915_gem_context *ctx)
115 116
116 __i915_gem_object_release_unless_active(obj); 117 __i915_gem_object_release_unless_active(obj);
117 } 118 }
119 rcu_read_unlock();
118} 120}
119 121
120static void i915_gem_context_free(struct i915_gem_context *ctx) 122static void i915_gem_context_free(struct i915_gem_context *ctx)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 92437f455b43..4ac454ae54d7 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -337,6 +337,10 @@ eb_vma_misplaced(const struct drm_i915_gem_exec_object2 *entry,
337 (vma->node.start + vma->node.size - 1) >> 32) 337 (vma->node.start + vma->node.size - 1) >> 32)
338 return true; 338 return true;
339 339
340 if (flags & __EXEC_OBJECT_NEEDS_MAP &&
341 !i915_vma_is_map_and_fenceable(vma))
342 return true;
343
340 return false; 344 return false;
341} 345}
342 346
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5c7828c52d12..5ebdb63330dd 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15227,6 +15227,23 @@ void intel_connector_unregister(struct drm_connector *connector)
15227 intel_panel_destroy_backlight(connector); 15227 intel_panel_destroy_backlight(connector);
15228} 15228}
15229 15229
15230static void intel_hpd_poll_fini(struct drm_device *dev)
15231{
15232 struct intel_connector *connector;
15233 struct drm_connector_list_iter conn_iter;
15234
15235 /* First disable polling... */
15236 drm_kms_helper_poll_fini(dev);
15237
15238 /* Then kill the work that may have been queued by hpd. */
15239 drm_connector_list_iter_begin(dev, &conn_iter);
15240 for_each_intel_connector_iter(connector, &conn_iter) {
15241 if (connector->modeset_retry_work.func)
15242 cancel_work_sync(&connector->modeset_retry_work);
15243 }
15244 drm_connector_list_iter_end(&conn_iter);
15245}
15246
15230void intel_modeset_cleanup(struct drm_device *dev) 15247void intel_modeset_cleanup(struct drm_device *dev)
15231{ 15248{
15232 struct drm_i915_private *dev_priv = to_i915(dev); 15249 struct drm_i915_private *dev_priv = to_i915(dev);
@@ -15247,7 +15264,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
15247 * Due to the hpd irq storm handling the hotplug work can re-arm the 15264 * Due to the hpd irq storm handling the hotplug work can re-arm the
15248 * poll handlers. Hence disable polling after hpd handling is shut down. 15265 * poll handlers. Hence disable polling after hpd handling is shut down.
15249 */ 15266 */
15250 drm_kms_helper_poll_fini(dev); 15267 intel_hpd_poll_fini(dev);
15251 15268
15252 /* poll work can call into fbdev, hence clean that up afterwards */ 15269 /* poll work can call into fbdev, hence clean that up afterwards */
15253 intel_fbdev_fini(dev_priv); 15270 intel_fbdev_fini(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 203198659ab2..09f274419eea 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3731,9 +3731,16 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
3731 3731
3732 } 3732 }
3733 3733
3734 /* Read the eDP Display control capabilities registers */ 3734 /*
3735 if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && 3735 * Read the eDP display control registers.
3736 drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, 3736 *
3737 * Do this independent of DP_DPCD_DISPLAY_CONTROL_CAPABLE bit in
3738 * DP_EDP_CONFIGURATION_CAP, because some buggy displays do not have it
3739 * set, but require eDP 1.4+ detection (e.g. for supported link rates
3740 * method). The display control registers should read zero if they're
3741 * not supported anyway.
3742 */
3743 if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
3737 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) == 3744 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
3738 sizeof(intel_dp->edp_dpcd)) 3745 sizeof(intel_dp->edp_dpcd))
3739 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd), 3746 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index fa47285918f4..79fbaf78f604 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -496,7 +496,6 @@ struct intel_crtc_scaler_state {
496 496
497struct intel_pipe_wm { 497struct intel_pipe_wm {
498 struct intel_wm_level wm[5]; 498 struct intel_wm_level wm[5];
499 struct intel_wm_level raw_wm[5];
500 uint32_t linetime; 499 uint32_t linetime;
501 bool fbc_wm_enabled; 500 bool fbc_wm_enabled;
502 bool pipe_enabled; 501 bool pipe_enabled;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0a09f8ff6aff..cb950752c346 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2716,9 +2716,9 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,
2716 const struct intel_crtc *intel_crtc, 2716 const struct intel_crtc *intel_crtc,
2717 int level, 2717 int level,
2718 struct intel_crtc_state *cstate, 2718 struct intel_crtc_state *cstate,
2719 struct intel_plane_state *pristate, 2719 const struct intel_plane_state *pristate,
2720 struct intel_plane_state *sprstate, 2720 const struct intel_plane_state *sprstate,
2721 struct intel_plane_state *curstate, 2721 const struct intel_plane_state *curstate,
2722 struct intel_wm_level *result) 2722 struct intel_wm_level *result)
2723{ 2723{
2724 uint16_t pri_latency = dev_priv->wm.pri_latency[level]; 2724 uint16_t pri_latency = dev_priv->wm.pri_latency[level];
@@ -3038,28 +3038,24 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
3038 struct intel_pipe_wm *pipe_wm; 3038 struct intel_pipe_wm *pipe_wm;
3039 struct drm_device *dev = state->dev; 3039 struct drm_device *dev = state->dev;
3040 const struct drm_i915_private *dev_priv = to_i915(dev); 3040 const struct drm_i915_private *dev_priv = to_i915(dev);
3041 struct intel_plane *intel_plane; 3041 struct drm_plane *plane;
3042 struct intel_plane_state *pristate = NULL; 3042 const struct drm_plane_state *plane_state;
3043 struct intel_plane_state *sprstate = NULL; 3043 const struct intel_plane_state *pristate = NULL;
3044 struct intel_plane_state *curstate = NULL; 3044 const struct intel_plane_state *sprstate = NULL;
3045 const struct intel_plane_state *curstate = NULL;
3045 int level, max_level = ilk_wm_max_level(dev_priv), usable_level; 3046 int level, max_level = ilk_wm_max_level(dev_priv), usable_level;
3046 struct ilk_wm_maximums max; 3047 struct ilk_wm_maximums max;
3047 3048
3048 pipe_wm = &cstate->wm.ilk.optimal; 3049 pipe_wm = &cstate->wm.ilk.optimal;
3049 3050
3050 for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) { 3051 drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, &cstate->base) {
3051 struct intel_plane_state *ps; 3052 const struct intel_plane_state *ps = to_intel_plane_state(plane_state);
3052
3053 ps = intel_atomic_get_existing_plane_state(state,
3054 intel_plane);
3055 if (!ps)
3056 continue;
3057 3053
3058 if (intel_plane->base.type == DRM_PLANE_TYPE_PRIMARY) 3054 if (plane->type == DRM_PLANE_TYPE_PRIMARY)
3059 pristate = ps; 3055 pristate = ps;
3060 else if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY) 3056 else if (plane->type == DRM_PLANE_TYPE_OVERLAY)
3061 sprstate = ps; 3057 sprstate = ps;
3062 else if (intel_plane->base.type == DRM_PLANE_TYPE_CURSOR) 3058 else if (plane->type == DRM_PLANE_TYPE_CURSOR)
3063 curstate = ps; 3059 curstate = ps;
3064 } 3060 }
3065 3061
@@ -3081,11 +3077,9 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
3081 if (pipe_wm->sprites_scaled) 3077 if (pipe_wm->sprites_scaled)
3082 usable_level = 0; 3078 usable_level = 0;
3083 3079
3084 ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate,
3085 pristate, sprstate, curstate, &pipe_wm->raw_wm[0]);
3086
3087 memset(&pipe_wm->wm, 0, sizeof(pipe_wm->wm)); 3080 memset(&pipe_wm->wm, 0, sizeof(pipe_wm->wm));
3088 pipe_wm->wm[0] = pipe_wm->raw_wm[0]; 3081 ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate,
3082 pristate, sprstate, curstate, &pipe_wm->wm[0]);
3089 3083
3090 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 3084 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
3091 pipe_wm->linetime = hsw_compute_linetime_wm(cstate); 3085 pipe_wm->linetime = hsw_compute_linetime_wm(cstate);
@@ -3095,8 +3089,8 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
3095 3089
3096 ilk_compute_wm_reg_maximums(dev_priv, 1, &max); 3090 ilk_compute_wm_reg_maximums(dev_priv, 1, &max);
3097 3091
3098 for (level = 1; level <= max_level; level++) { 3092 for (level = 1; level <= usable_level; level++) {
3099 struct intel_wm_level *wm = &pipe_wm->raw_wm[level]; 3093 struct intel_wm_level *wm = &pipe_wm->wm[level];
3100 3094
3101 ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate, 3095 ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate,
3102 pristate, sprstate, curstate, wm); 3096 pristate, sprstate, curstate, wm);
@@ -3106,13 +3100,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *cstate)
3106 * register maximums since such watermarks are 3100 * register maximums since such watermarks are
3107 * always invalid. 3101 * always invalid.
3108 */ 3102 */
3109 if (level > usable_level) 3103 if (!ilk_validate_wm_level(level, &max, wm)) {
3110 continue; 3104 memset(wm, 0, sizeof(*wm));
3111 3105 break;
3112 if (ilk_validate_wm_level(level, &max, wm)) 3106 }
3113 pipe_wm->wm[level] = *wm;
3114 else
3115 usable_level = level;
3116 } 3107 }
3117 3108
3118 return 0; 3109 return 0;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index e4751f92b342..fb47d46050ec 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -4099,7 +4099,7 @@ nv50_disp_atomic_commit(struct drm_device *dev,
4099{ 4099{
4100 struct nouveau_drm *drm = nouveau_drm(dev); 4100 struct nouveau_drm *drm = nouveau_drm(dev);
4101 struct nv50_disp *disp = nv50_disp(dev); 4101 struct nv50_disp *disp = nv50_disp(dev);
4102 struct drm_plane_state *old_plane_state; 4102 struct drm_plane_state *new_plane_state;
4103 struct drm_plane *plane; 4103 struct drm_plane *plane;
4104 struct drm_crtc *crtc; 4104 struct drm_crtc *crtc;
4105 bool active = false; 4105 bool active = false;
@@ -4129,8 +4129,8 @@ nv50_disp_atomic_commit(struct drm_device *dev,
4129 if (ret) 4129 if (ret)
4130 goto err_cleanup; 4130 goto err_cleanup;
4131 4131
4132 for_each_old_plane_in_state(state, plane, old_plane_state, i) { 4132 for_each_new_plane_in_state(state, plane, new_plane_state, i) {
4133 struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state); 4133 struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state);
4134 struct nv50_wndw *wndw = nv50_wndw(plane); 4134 struct nv50_wndw *wndw = nv50_wndw(plane);
4135 4135
4136 if (asyw->set.image) { 4136 if (asyw->set.image) {
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index bb0349fa64bc..fd03e55768c9 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -255,6 +255,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
255 255
256 case KE_VSW: 256 case KE_VSW:
257 input_report_switch(dev, ke->sw.code, value); 257 input_report_switch(dev, ke->sw.code, value);
258 input_sync(dev);
258 break; 259 break;
259 } 260 }
260} 261}
diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c
index f9dcbd63e598..b35b640fdadf 100644
--- a/drivers/input/touchscreen/ar1021_i2c.c
+++ b/drivers/input/touchscreen/ar1021_i2c.c
@@ -117,6 +117,7 @@ static int ar1021_i2c_probe(struct i2c_client *client,
117 input->open = ar1021_i2c_open; 117 input->open = ar1021_i2c_open;
118 input->close = ar1021_i2c_close; 118 input->close = ar1021_i2c_close;
119 119
120 __set_bit(INPUT_PROP_DIRECT, input->propbit);
120 input_set_capability(input, EV_KEY, BTN_TOUCH); 121 input_set_capability(input, EV_KEY, BTN_TOUCH);
121 input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0); 122 input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0);
122 input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0); 123 input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0);
diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-gicp.c
index b283fc90be1e..17a4a7b6cdbb 100644
--- a/drivers/irqchip/irq-mvebu-gicp.c
+++ b/drivers/irqchip/irq-mvebu-gicp.c
@@ -194,6 +194,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
194 return -ENOMEM; 194 return -ENOMEM;
195 195
196 gicp->dev = &pdev->dev; 196 gicp->dev = &pdev->dev;
197 spin_lock_init(&gicp->spi_lock);
197 198
198 gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 199 gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
199 if (!gicp->res) 200 if (!gicp->res)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 860313bd952a..4f2806720c5c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -401,16 +401,37 @@ static u32 dw_mci_prep_stop_abort(struct dw_mci *host, struct mmc_command *cmd)
401static inline void dw_mci_set_cto(struct dw_mci *host) 401static inline void dw_mci_set_cto(struct dw_mci *host)
402{ 402{
403 unsigned int cto_clks; 403 unsigned int cto_clks;
404 unsigned int cto_div;
404 unsigned int cto_ms; 405 unsigned int cto_ms;
406 unsigned long irqflags;
405 407
406 cto_clks = mci_readl(host, TMOUT) & 0xff; 408 cto_clks = mci_readl(host, TMOUT) & 0xff;
407 cto_ms = DIV_ROUND_UP(cto_clks, host->bus_hz / 1000); 409 cto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
410 if (cto_div == 0)
411 cto_div = 1;
412 cto_ms = DIV_ROUND_UP(MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz);
408 413
409 /* add a bit spare time */ 414 /* add a bit spare time */
410 cto_ms += 10; 415 cto_ms += 10;
411 416
412 mod_timer(&host->cto_timer, 417 /*
413 jiffies + msecs_to_jiffies(cto_ms) + 1); 418 * The durations we're working with are fairly short so we have to be
419 * extra careful about synchronization here. Specifically in hardware a
420 * command timeout is _at most_ 5.1 ms, so that means we expect an
421 * interrupt (either command done or timeout) to come rather quickly
422 * after the mci_writel. ...but just in case we have a long interrupt
423 * latency let's add a bit of paranoia.
424 *
425 * In general we'll assume that at least an interrupt will be asserted
426 * in hardware by the time the cto_timer runs. ...and if it hasn't
427 * been asserted in hardware by that time then we'll assume it'll never
428 * come.
429 */
430 spin_lock_irqsave(&host->irq_lock, irqflags);
431 if (!test_bit(EVENT_CMD_COMPLETE, &host->pending_events))
432 mod_timer(&host->cto_timer,
433 jiffies + msecs_to_jiffies(cto_ms) + 1);
434 spin_unlock_irqrestore(&host->irq_lock, irqflags);
414} 435}
415 436
416static void dw_mci_start_command(struct dw_mci *host, 437static void dw_mci_start_command(struct dw_mci *host,
@@ -425,11 +446,11 @@ static void dw_mci_start_command(struct dw_mci *host,
425 wmb(); /* drain writebuffer */ 446 wmb(); /* drain writebuffer */
426 dw_mci_wait_while_busy(host, cmd_flags); 447 dw_mci_wait_while_busy(host, cmd_flags);
427 448
449 mci_writel(host, CMD, cmd_flags | SDMMC_CMD_START);
450
428 /* response expected command only */ 451 /* response expected command only */
429 if (cmd_flags & SDMMC_CMD_RESP_EXP) 452 if (cmd_flags & SDMMC_CMD_RESP_EXP)
430 dw_mci_set_cto(host); 453 dw_mci_set_cto(host);
431
432 mci_writel(host, CMD, cmd_flags | SDMMC_CMD_START);
433} 454}
434 455
435static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data) 456static inline void send_stop_abort(struct dw_mci *host, struct mmc_data *data)
@@ -1915,10 +1936,15 @@ static int dw_mci_data_complete(struct dw_mci *host, struct mmc_data *data)
1915static void dw_mci_set_drto(struct dw_mci *host) 1936static void dw_mci_set_drto(struct dw_mci *host)
1916{ 1937{
1917 unsigned int drto_clks; 1938 unsigned int drto_clks;
1939 unsigned int drto_div;
1918 unsigned int drto_ms; 1940 unsigned int drto_ms;
1919 1941
1920 drto_clks = mci_readl(host, TMOUT) >> 8; 1942 drto_clks = mci_readl(host, TMOUT) >> 8;
1921 drto_ms = DIV_ROUND_UP(drto_clks, host->bus_hz / 1000); 1943 drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
1944 if (drto_div == 0)
1945 drto_div = 1;
1946 drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div,
1947 host->bus_hz);
1922 1948
1923 /* add a bit spare time */ 1949 /* add a bit spare time */
1924 drto_ms += 10; 1950 drto_ms += 10;
@@ -1926,6 +1952,24 @@ static void dw_mci_set_drto(struct dw_mci *host)
1926 mod_timer(&host->dto_timer, jiffies + msecs_to_jiffies(drto_ms)); 1952 mod_timer(&host->dto_timer, jiffies + msecs_to_jiffies(drto_ms));
1927} 1953}
1928 1954
1955static bool dw_mci_clear_pending_cmd_complete(struct dw_mci *host)
1956{
1957 if (!test_bit(EVENT_CMD_COMPLETE, &host->pending_events))
1958 return false;
1959
1960 /*
1961 * Really be certain that the timer has stopped. This is a bit of
1962 * paranoia and could only really happen if we had really bad
1963 * interrupt latency and the interrupt routine and timeout were
1964 * running concurrently so that the del_timer() in the interrupt
1965 * handler couldn't run.
1966 */
1967 WARN_ON(del_timer_sync(&host->cto_timer));
1968 clear_bit(EVENT_CMD_COMPLETE, &host->pending_events);
1969
1970 return true;
1971}
1972
1929static void dw_mci_tasklet_func(unsigned long priv) 1973static void dw_mci_tasklet_func(unsigned long priv)
1930{ 1974{
1931 struct dw_mci *host = (struct dw_mci *)priv; 1975 struct dw_mci *host = (struct dw_mci *)priv;
@@ -1952,8 +1996,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
1952 1996
1953 case STATE_SENDING_CMD11: 1997 case STATE_SENDING_CMD11:
1954 case STATE_SENDING_CMD: 1998 case STATE_SENDING_CMD:
1955 if (!test_and_clear_bit(EVENT_CMD_COMPLETE, 1999 if (!dw_mci_clear_pending_cmd_complete(host))
1956 &host->pending_events))
1957 break; 2000 break;
1958 2001
1959 cmd = host->cmd; 2002 cmd = host->cmd;
@@ -2122,8 +2165,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
2122 /* fall through */ 2165 /* fall through */
2123 2166
2124 case STATE_SENDING_STOP: 2167 case STATE_SENDING_STOP:
2125 if (!test_and_clear_bit(EVENT_CMD_COMPLETE, 2168 if (!dw_mci_clear_pending_cmd_complete(host))
2126 &host->pending_events))
2127 break; 2169 break;
2128 2170
2129 /* CMD error in data command */ 2171 /* CMD error in data command */
@@ -2570,6 +2612,8 @@ done:
2570 2612
2571static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status) 2613static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)
2572{ 2614{
2615 del_timer(&host->cto_timer);
2616
2573 if (!host->cmd_status) 2617 if (!host->cmd_status)
2574 host->cmd_status = status; 2618 host->cmd_status = status;
2575 2619
@@ -2594,6 +2638,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
2594 struct dw_mci *host = dev_id; 2638 struct dw_mci *host = dev_id;
2595 u32 pending; 2639 u32 pending;
2596 struct dw_mci_slot *slot = host->slot; 2640 struct dw_mci_slot *slot = host->slot;
2641 unsigned long irqflags;
2597 2642
2598 pending = mci_readl(host, MINTSTS); /* read-only mask reg */ 2643 pending = mci_readl(host, MINTSTS); /* read-only mask reg */
2599 2644
@@ -2601,8 +2646,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
2601 /* Check volt switch first, since it can look like an error */ 2646 /* Check volt switch first, since it can look like an error */
2602 if ((host->state == STATE_SENDING_CMD11) && 2647 if ((host->state == STATE_SENDING_CMD11) &&
2603 (pending & SDMMC_INT_VOLT_SWITCH)) { 2648 (pending & SDMMC_INT_VOLT_SWITCH)) {
2604 unsigned long irqflags;
2605
2606 mci_writel(host, RINTSTS, SDMMC_INT_VOLT_SWITCH); 2649 mci_writel(host, RINTSTS, SDMMC_INT_VOLT_SWITCH);
2607 pending &= ~SDMMC_INT_VOLT_SWITCH; 2650 pending &= ~SDMMC_INT_VOLT_SWITCH;
2608 2651
@@ -2618,11 +2661,15 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
2618 } 2661 }
2619 2662
2620 if (pending & DW_MCI_CMD_ERROR_FLAGS) { 2663 if (pending & DW_MCI_CMD_ERROR_FLAGS) {
2664 spin_lock_irqsave(&host->irq_lock, irqflags);
2665
2621 del_timer(&host->cto_timer); 2666 del_timer(&host->cto_timer);
2622 mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS); 2667 mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS);
2623 host->cmd_status = pending; 2668 host->cmd_status = pending;
2624 smp_wmb(); /* drain writebuffer */ 2669 smp_wmb(); /* drain writebuffer */
2625 set_bit(EVENT_CMD_COMPLETE, &host->pending_events); 2670 set_bit(EVENT_CMD_COMPLETE, &host->pending_events);
2671
2672 spin_unlock_irqrestore(&host->irq_lock, irqflags);
2626 } 2673 }
2627 2674
2628 if (pending & DW_MCI_DATA_ERROR_FLAGS) { 2675 if (pending & DW_MCI_DATA_ERROR_FLAGS) {
@@ -2662,9 +2709,12 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
2662 } 2709 }
2663 2710
2664 if (pending & SDMMC_INT_CMD_DONE) { 2711 if (pending & SDMMC_INT_CMD_DONE) {
2665 del_timer(&host->cto_timer); 2712 spin_lock_irqsave(&host->irq_lock, irqflags);
2713
2666 mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE); 2714 mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE);
2667 dw_mci_cmd_interrupt(host, pending); 2715 dw_mci_cmd_interrupt(host, pending);
2716
2717 spin_unlock_irqrestore(&host->irq_lock, irqflags);
2668 } 2718 }
2669 2719
2670 if (pending & SDMMC_INT_CD) { 2720 if (pending & SDMMC_INT_CD) {
@@ -2938,7 +2988,35 @@ static void dw_mci_cmd11_timer(unsigned long arg)
2938static void dw_mci_cto_timer(unsigned long arg) 2988static void dw_mci_cto_timer(unsigned long arg)
2939{ 2989{
2940 struct dw_mci *host = (struct dw_mci *)arg; 2990 struct dw_mci *host = (struct dw_mci *)arg;
2991 unsigned long irqflags;
2992 u32 pending;
2941 2993
2994 spin_lock_irqsave(&host->irq_lock, irqflags);
2995
2996 /*
2997 * If somehow we have very bad interrupt latency it's remotely possible
2998 * that the timer could fire while the interrupt is still pending or
2999 * while the interrupt is midway through running. Let's be paranoid
3000 * and detect those two cases. Note that this is paranoia is somewhat
3001 * justified because in this function we don't actually cancel the
3002 * pending command in the controller--we just assume it will never come.
3003 */
3004 pending = mci_readl(host, MINTSTS); /* read-only mask reg */
3005 if (pending & (DW_MCI_CMD_ERROR_FLAGS | SDMMC_INT_CMD_DONE)) {
3006 /* The interrupt should fire; no need to act but we can warn */
3007 dev_warn(host->dev, "Unexpected interrupt latency\n");
3008 goto exit;
3009 }
3010 if (test_bit(EVENT_CMD_COMPLETE, &host->pending_events)) {
3011 /* Presumably interrupt handler couldn't delete the timer */
3012 dev_warn(host->dev, "CTO timeout when already completed\n");
3013 goto exit;
3014 }
3015
3016 /*
3017 * Continued paranoia to make sure we're in the state we expect.
3018 * This paranoia isn't really justified but it seems good to be safe.
3019 */
2942 switch (host->state) { 3020 switch (host->state) {
2943 case STATE_SENDING_CMD11: 3021 case STATE_SENDING_CMD11:
2944 case STATE_SENDING_CMD: 3022 case STATE_SENDING_CMD:
@@ -2957,6 +3035,9 @@ static void dw_mci_cto_timer(unsigned long arg)
2957 host->state); 3035 host->state);
2958 break; 3036 break;
2959 } 3037 }
3038
3039exit:
3040 spin_unlock_irqrestore(&host->irq_lock, irqflags);
2960} 3041}
2961 3042
2962static void dw_mci_dto_timer(unsigned long arg) 3043static void dw_mci_dto_timer(unsigned long arg)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 83eec9a8c275..eb441e5e2cd8 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1809,15 +1809,17 @@ static inline void bcm_sysport_mask_all_intrs(struct bcm_sysport_priv *priv)
1809 1809
1810static inline void gib_set_pad_extension(struct bcm_sysport_priv *priv) 1810static inline void gib_set_pad_extension(struct bcm_sysport_priv *priv)
1811{ 1811{
1812 u32 __maybe_unused reg; 1812 u32 reg;
1813 1813
1814 /* Include Broadcom tag in pad extension */ 1814 reg = gib_readl(priv, GIB_CONTROL);
1815 /* Include Broadcom tag in pad extension and fix up IPG_LENGTH */
1815 if (netdev_uses_dsa(priv->netdev)) { 1816 if (netdev_uses_dsa(priv->netdev)) {
1816 reg = gib_readl(priv, GIB_CONTROL);
1817 reg &= ~(GIB_PAD_EXTENSION_MASK << GIB_PAD_EXTENSION_SHIFT); 1817 reg &= ~(GIB_PAD_EXTENSION_MASK << GIB_PAD_EXTENSION_SHIFT);
1818 reg |= ENET_BRCM_TAG_LEN << GIB_PAD_EXTENSION_SHIFT; 1818 reg |= ENET_BRCM_TAG_LEN << GIB_PAD_EXTENSION_SHIFT;
1819 gib_writel(priv, reg, GIB_CONTROL);
1820 } 1819 }
1820 reg &= ~(GIB_IPG_LEN_MASK << GIB_IPG_LEN_SHIFT);
1821 reg |= 12 << GIB_IPG_LEN_SHIFT;
1822 gib_writel(priv, reg, GIB_CONTROL);
1821} 1823}
1822 1824
1823static int bcm_sysport_open(struct net_device *dev) 1825static int bcm_sysport_open(struct net_device *dev)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 6383695004a5..195eb7e71473 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -168,8 +168,8 @@ static void stmmac_mtl_setup(struct platform_device *pdev,
168 } 168 }
169 169
170 /* Processing RX queues common config */ 170 /* Processing RX queues common config */
171 if (of_property_read_u8(rx_node, "snps,rx-queues-to-use", 171 if (of_property_read_u32(rx_node, "snps,rx-queues-to-use",
172 &plat->rx_queues_to_use)) 172 &plat->rx_queues_to_use))
173 plat->rx_queues_to_use = 1; 173 plat->rx_queues_to_use = 1;
174 174
175 if (of_property_read_bool(rx_node, "snps,rx-sched-sp")) 175 if (of_property_read_bool(rx_node, "snps,rx-sched-sp"))
@@ -191,8 +191,8 @@ static void stmmac_mtl_setup(struct platform_device *pdev,
191 else 191 else
192 plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; 192 plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
193 193
194 if (of_property_read_u8(q_node, "snps,map-to-dma-channel", 194 if (of_property_read_u32(q_node, "snps,map-to-dma-channel",
195 &plat->rx_queues_cfg[queue].chan)) 195 &plat->rx_queues_cfg[queue].chan))
196 plat->rx_queues_cfg[queue].chan = queue; 196 plat->rx_queues_cfg[queue].chan = queue;
197 /* TODO: Dynamic mapping to be included in the future */ 197 /* TODO: Dynamic mapping to be included in the future */
198 198
@@ -222,8 +222,8 @@ static void stmmac_mtl_setup(struct platform_device *pdev,
222 } 222 }
223 223
224 /* Processing TX queues common config */ 224 /* Processing TX queues common config */
225 if (of_property_read_u8(tx_node, "snps,tx-queues-to-use", 225 if (of_property_read_u32(tx_node, "snps,tx-queues-to-use",
226 &plat->tx_queues_to_use)) 226 &plat->tx_queues_to_use))
227 plat->tx_queues_to_use = 1; 227 plat->tx_queues_to_use = 1;
228 228
229 if (of_property_read_bool(tx_node, "snps,tx-sched-wrr")) 229 if (of_property_read_bool(tx_node, "snps,tx-sched-wrr"))
@@ -244,8 +244,8 @@ static void stmmac_mtl_setup(struct platform_device *pdev,
244 if (queue >= plat->tx_queues_to_use) 244 if (queue >= plat->tx_queues_to_use)
245 break; 245 break;
246 246
247 if (of_property_read_u8(q_node, "snps,weight", 247 if (of_property_read_u32(q_node, "snps,weight",
248 &plat->tx_queues_cfg[queue].weight)) 248 &plat->tx_queues_cfg[queue].weight))
249 plat->tx_queues_cfg[queue].weight = 0x10 + queue; 249 plat->tx_queues_cfg[queue].weight = 0x10 + queue;
250 250
251 if (of_property_read_bool(q_node, "snps,dcb-algorithm")) { 251 if (of_property_read_bool(q_node, "snps,dcb-algorithm")) {
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 9b243e6f3008..7dc3bcac3506 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1165,7 +1165,7 @@ static int vrf_fib_rule(const struct net_device *dev, __u8 family, bool add_it)
1165 frh->family = family; 1165 frh->family = family;
1166 frh->action = FR_ACT_TO_TBL; 1166 frh->action = FR_ACT_TO_TBL;
1167 1167
1168 if (nla_put_u32(skb, FRA_L3MDEV, 1)) 1168 if (nla_put_u8(skb, FRA_L3MDEV, 1))
1169 goto nla_put_failure; 1169 goto nla_put_failure;
1170 1170
1171 if (nla_put_u32(skb, FRA_PRIORITY, FIB_RULE_PREF)) 1171 if (nla_put_u32(skb, FRA_PRIORITY, FIB_RULE_PREF))
diff --git a/drivers/power/reset/piix4-poweroff.c b/drivers/power/reset/piix4-poweroff.c
index bacfc95783f0..20ce3ff5e039 100644
--- a/drivers/power/reset/piix4-poweroff.c
+++ b/drivers/power/reset/piix4-poweroff.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2016 Imagination Technologies 2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Paul Burton <paul.burton@imgtec.com> 3 * Author: Paul Burton <paul.burton@mips.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -109,5 +109,5 @@ static struct pci_driver piix4_poweroff_driver = {
109}; 109};
110 110
111module_pci_driver(piix4_poweroff_driver); 111module_pci_driver(piix4_poweroff_driver);
112MODULE_AUTHOR("Paul Burton <paul.burton@imgtec.com>"); 112MODULE_AUTHOR("Paul Burton <paul.burton@mips.com>");
113MODULE_LICENSE("GPL"); 113MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3bd956d3bc5d..dce42a416876 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3212,6 +3212,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3212 ql_log(ql_log_fatal, base_vha, 0x00ed, 3212 ql_log(ql_log_fatal, base_vha, 0x00ed,
3213 "Failed to start DPC thread.\n"); 3213 "Failed to start DPC thread.\n");
3214 ret = PTR_ERR(ha->dpc_thread); 3214 ret = PTR_ERR(ha->dpc_thread);
3215 ha->dpc_thread = NULL;
3215 goto probe_failed; 3216 goto probe_failed;
3216 } 3217 }
3217 ql_dbg(ql_dbg_init, base_vha, 0x00ee, 3218 ql_dbg(ql_dbg_init, base_vha, 0x00ee,
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 59073e9f01a4..ed113ea17aff 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -842,9 +842,12 @@ static int hugetlbfs_error_remove_page(struct address_space *mapping,
842 struct page *page) 842 struct page *page)
843{ 843{
844 struct inode *inode = mapping->host; 844 struct inode *inode = mapping->host;
845 pgoff_t index = page->index;
845 846
846 remove_huge_page(page); 847 remove_huge_page(page);
847 hugetlb_fix_reserve_counts(inode); 848 if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1)))
849 hugetlb_fix_reserve_counts(inode);
850
848 return 0; 851 return 0;
849} 852}
850 853
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index a177eae3aa1a..addd7c5f2d3e 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -7304,13 +7304,24 @@ out:
7304 7304
7305static int ocfs2_trim_extent(struct super_block *sb, 7305static int ocfs2_trim_extent(struct super_block *sb,
7306 struct ocfs2_group_desc *gd, 7306 struct ocfs2_group_desc *gd,
7307 u32 start, u32 count) 7307 u64 group, u32 start, u32 count)
7308{ 7308{
7309 u64 discard, bcount; 7309 u64 discard, bcount;
7310 struct ocfs2_super *osb = OCFS2_SB(sb);
7310 7311
7311 bcount = ocfs2_clusters_to_blocks(sb, count); 7312 bcount = ocfs2_clusters_to_blocks(sb, count);
7312 discard = le64_to_cpu(gd->bg_blkno) + 7313 discard = ocfs2_clusters_to_blocks(sb, start);
7313 ocfs2_clusters_to_blocks(sb, start); 7314
7315 /*
7316 * For the first cluster group, the gd->bg_blkno is not at the start
7317 * of the group, but at an offset from the start. If we add it while
7318 * calculating discard for first group, we will wrongly start fstrim a
7319 * few blocks after the desried start block and the range can cross
7320 * over into the next cluster group. So, add it only if this is not
7321 * the first cluster group.
7322 */
7323 if (group != osb->first_cluster_group_blkno)
7324 discard += le64_to_cpu(gd->bg_blkno);
7314 7325
7315 trace_ocfs2_trim_extent(sb, (unsigned long long)discard, bcount); 7326 trace_ocfs2_trim_extent(sb, (unsigned long long)discard, bcount);
7316 7327
@@ -7318,7 +7329,7 @@ static int ocfs2_trim_extent(struct super_block *sb,
7318} 7329}
7319 7330
7320static int ocfs2_trim_group(struct super_block *sb, 7331static int ocfs2_trim_group(struct super_block *sb,
7321 struct ocfs2_group_desc *gd, 7332 struct ocfs2_group_desc *gd, u64 group,
7322 u32 start, u32 max, u32 minbits) 7333 u32 start, u32 max, u32 minbits)
7323{ 7334{
7324 int ret = 0, count = 0, next; 7335 int ret = 0, count = 0, next;
@@ -7337,7 +7348,7 @@ static int ocfs2_trim_group(struct super_block *sb,
7337 next = ocfs2_find_next_bit(bitmap, max, start); 7348 next = ocfs2_find_next_bit(bitmap, max, start);
7338 7349
7339 if ((next - start) >= minbits) { 7350 if ((next - start) >= minbits) {
7340 ret = ocfs2_trim_extent(sb, gd, 7351 ret = ocfs2_trim_extent(sb, gd, group,
7341 start, next - start); 7352 start, next - start);
7342 if (ret < 0) { 7353 if (ret < 0) {
7343 mlog_errno(ret); 7354 mlog_errno(ret);
@@ -7435,7 +7446,8 @@ int ocfs2_trim_fs(struct super_block *sb, struct fstrim_range *range)
7435 } 7446 }
7436 7447
7437 gd = (struct ocfs2_group_desc *)gd_bh->b_data; 7448 gd = (struct ocfs2_group_desc *)gd_bh->b_data;
7438 cnt = ocfs2_trim_group(sb, gd, first_bit, last_bit, minlen); 7449 cnt = ocfs2_trim_group(sb, gd, group,
7450 first_bit, last_bit, minlen);
7439 brelse(gd_bh); 7451 brelse(gd_bh);
7440 gd_bh = NULL; 7452 gd_bh = NULL;
7441 if (cnt < 0) { 7453 if (cnt < 0) {
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 280282b05bc7..6744bd706ecf 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1311,13 +1311,15 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
1311 pmd_t pmd = *pmdp; 1311 pmd_t pmd = *pmdp;
1312 struct page *page = NULL; 1312 struct page *page = NULL;
1313 1313
1314 if ((vma->vm_flags & VM_SOFTDIRTY) || pmd_soft_dirty(pmd)) 1314 if (vma->vm_flags & VM_SOFTDIRTY)
1315 flags |= PM_SOFT_DIRTY; 1315 flags |= PM_SOFT_DIRTY;
1316 1316
1317 if (pmd_present(pmd)) { 1317 if (pmd_present(pmd)) {
1318 page = pmd_page(pmd); 1318 page = pmd_page(pmd);
1319 1319
1320 flags |= PM_PRESENT; 1320 flags |= PM_PRESENT;
1321 if (pmd_soft_dirty(pmd))
1322 flags |= PM_SOFT_DIRTY;
1321 if (pm->show_pfn) 1323 if (pm->show_pfn)
1322 frame = pmd_pfn(pmd) + 1324 frame = pmd_pfn(pmd) +
1323 ((addr & ~PMD_MASK) >> PAGE_SHIFT); 1325 ((addr & ~PMD_MASK) >> PAGE_SHIFT);
@@ -1329,6 +1331,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
1329 frame = swp_type(entry) | 1331 frame = swp_type(entry) |
1330 (swp_offset(entry) << MAX_SWAPFILES_SHIFT); 1332 (swp_offset(entry) << MAX_SWAPFILES_SHIFT);
1331 flags |= PM_SWAP; 1333 flags |= PM_SWAP;
1334 if (pmd_swp_soft_dirty(pmd))
1335 flags |= PM_SOFT_DIRTY;
1332 VM_BUG_ON(!is_pmd_migration_entry(pmd)); 1336 VM_BUG_ON(!is_pmd_migration_entry(pmd));
1333 page = migration_entry_to_page(entry); 1337 page = migration_entry_to_page(entry);
1334 } 1338 }
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index fd8697aa4f73..202710420d6d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -191,13 +191,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
191 asm("%c0:\n\t" \ 191 asm("%c0:\n\t" \
192 ".pushsection .discard.reachable\n\t" \ 192 ".pushsection .discard.reachable\n\t" \
193 ".long %c0b - .\n\t" \ 193 ".long %c0b - .\n\t" \
194 ".popsection\n\t" : : "i" (__LINE__)); \ 194 ".popsection\n\t" : : "i" (__COUNTER__)); \
195}) 195})
196#define annotate_unreachable() ({ \ 196#define annotate_unreachable() ({ \
197 asm("%c0:\n\t" \ 197 asm("%c0:\n\t" \
198 ".pushsection .discard.unreachable\n\t" \ 198 ".pushsection .discard.unreachable\n\t" \
199 ".long %c0b - .\n\t" \ 199 ".long %c0b - .\n\t" \
200 ".popsection\n\t" : : "i" (__LINE__)); \ 200 ".popsection\n\t" : : "i" (__COUNTER__)); \
201}) 201})
202#define ASM_UNREACHABLE \ 202#define ASM_UNREACHABLE \
203 "999:\n\t" \ 203 "999:\n\t" \
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 108739ff9223..32feac5bbd75 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -126,14 +126,14 @@ struct stmmac_axi {
126 126
127struct stmmac_rxq_cfg { 127struct stmmac_rxq_cfg {
128 u8 mode_to_use; 128 u8 mode_to_use;
129 u8 chan; 129 u32 chan;
130 u8 pkt_route; 130 u8 pkt_route;
131 bool use_prio; 131 bool use_prio;
132 u32 prio; 132 u32 prio;
133}; 133};
134 134
135struct stmmac_txq_cfg { 135struct stmmac_txq_cfg {
136 u8 weight; 136 u32 weight;
137 u8 mode_to_use; 137 u8 mode_to_use;
138 /* Credit Base Shaper parameters */ 138 /* Credit Base Shaper parameters */
139 u32 send_slope; 139 u32 send_slope;
@@ -168,8 +168,8 @@ struct plat_stmmacenet_data {
168 int unicast_filter_entries; 168 int unicast_filter_entries;
169 int tx_fifo_size; 169 int tx_fifo_size;
170 int rx_fifo_size; 170 int rx_fifo_size;
171 u8 rx_queues_to_use; 171 u32 rx_queues_to_use;
172 u8 tx_queues_to_use; 172 u32 tx_queues_to_use;
173 u8 rx_sched_algorithm; 173 u8 rx_sched_algorithm;
174 u8 tx_sched_algorithm; 174 u8 tx_sched_algorithm;
175 struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES]; 175 struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
diff --git a/include/linux/swap.h b/include/linux/swap.h
index b489bd77bbdc..f02fb5db8914 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -266,6 +266,10 @@ struct swap_info_struct {
266 * both locks need hold, hold swap_lock 266 * both locks need hold, hold swap_lock
267 * first. 267 * first.
268 */ 268 */
269 spinlock_t cont_lock; /*
270 * protect swap count continuation page
271 * list.
272 */
269 struct work_struct discard_work; /* discard worker */ 273 struct work_struct discard_work; /* discard worker */
270 struct swap_cluster_list discard_clusters; /* discard clusters list */ 274 struct swap_cluster_list discard_clusters; /* discard clusters list */
271}; 275};
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 97a908ac424d..1e6df0eb058f 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -14,6 +14,7 @@
14struct tcf_idrinfo { 14struct tcf_idrinfo {
15 spinlock_t lock; 15 spinlock_t lock;
16 struct idr action_idr; 16 struct idr action_idr;
17 struct net *net;
17}; 18};
18 19
19struct tc_action_ops; 20struct tc_action_ops;
@@ -105,7 +106,7 @@ struct tc_action_net {
105 106
106static inline 107static inline
107int tc_action_net_init(struct tc_action_net *tn, 108int tc_action_net_init(struct tc_action_net *tn,
108 const struct tc_action_ops *ops) 109 const struct tc_action_ops *ops, struct net *net)
109{ 110{
110 int err = 0; 111 int err = 0;
111 112
@@ -113,6 +114,7 @@ int tc_action_net_init(struct tc_action_net *tn,
113 if (!tn->idrinfo) 114 if (!tn->idrinfo)
114 return -ENOMEM; 115 return -ENOMEM;
115 tn->ops = ops; 116 tn->ops = ops;
117 tn->idrinfo->net = net;
116 spin_lock_init(&tn->idrinfo->lock); 118 spin_lock_init(&tn->idrinfo->lock);
117 idr_init(&tn->idrinfo->action_idr); 119 idr_init(&tn->idrinfo->action_idr);
118 return err; 120 return err;
@@ -123,7 +125,9 @@ void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
123 125
124static inline void tc_action_net_exit(struct tc_action_net *tn) 126static inline void tc_action_net_exit(struct tc_action_net *tn)
125{ 127{
128 rtnl_lock();
126 tcf_idrinfo_destroy(tn->ops, tn->idrinfo); 129 tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
130 rtnl_unlock();
127 kfree(tn->idrinfo); 131 kfree(tn->idrinfo);
128} 132}
129 133
diff --git a/kernel/futex.c b/kernel/futex.c
index 0d638f008bb1..76ed5921117a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -903,11 +903,27 @@ void exit_pi_state_list(struct task_struct *curr)
903 */ 903 */
904 raw_spin_lock_irq(&curr->pi_lock); 904 raw_spin_lock_irq(&curr->pi_lock);
905 while (!list_empty(head)) { 905 while (!list_empty(head)) {
906
907 next = head->next; 906 next = head->next;
908 pi_state = list_entry(next, struct futex_pi_state, list); 907 pi_state = list_entry(next, struct futex_pi_state, list);
909 key = pi_state->key; 908 key = pi_state->key;
910 hb = hash_futex(&key); 909 hb = hash_futex(&key);
910
911 /*
912 * We can race against put_pi_state() removing itself from the
913 * list (a waiter going away). put_pi_state() will first
914 * decrement the reference count and then modify the list, so
915 * its possible to see the list entry but fail this reference
916 * acquire.
917 *
918 * In that case; drop the locks to let put_pi_state() make
919 * progress and retry the loop.
920 */
921 if (!atomic_inc_not_zero(&pi_state->refcount)) {
922 raw_spin_unlock_irq(&curr->pi_lock);
923 cpu_relax();
924 raw_spin_lock_irq(&curr->pi_lock);
925 continue;
926 }
911 raw_spin_unlock_irq(&curr->pi_lock); 927 raw_spin_unlock_irq(&curr->pi_lock);
912 928
913 spin_lock(&hb->lock); 929 spin_lock(&hb->lock);
@@ -918,8 +934,10 @@ void exit_pi_state_list(struct task_struct *curr)
918 * task still owns the PI-state: 934 * task still owns the PI-state:
919 */ 935 */
920 if (head->next != next) { 936 if (head->next != next) {
937 /* retain curr->pi_lock for the loop invariant */
921 raw_spin_unlock(&pi_state->pi_mutex.wait_lock); 938 raw_spin_unlock(&pi_state->pi_mutex.wait_lock);
922 spin_unlock(&hb->lock); 939 spin_unlock(&hb->lock);
940 put_pi_state(pi_state);
923 continue; 941 continue;
924 } 942 }
925 943
@@ -927,9 +945,8 @@ void exit_pi_state_list(struct task_struct *curr)
927 WARN_ON(list_empty(&pi_state->list)); 945 WARN_ON(list_empty(&pi_state->list));
928 list_del_init(&pi_state->list); 946 list_del_init(&pi_state->list);
929 pi_state->owner = NULL; 947 pi_state->owner = NULL;
930 raw_spin_unlock(&curr->pi_lock);
931 948
932 get_pi_state(pi_state); 949 raw_spin_unlock(&curr->pi_lock);
933 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); 950 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
934 spin_unlock(&hb->lock); 951 spin_unlock(&hb->lock);
935 952
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 4583feb66393..e449a23e9d59 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -13,6 +13,7 @@
13#define pr_fmt(fmt) "NMI watchdog: " fmt 13#define pr_fmt(fmt) "NMI watchdog: " fmt
14 14
15#include <linux/nmi.h> 15#include <linux/nmi.h>
16#include <linux/atomic.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/sched/debug.h> 18#include <linux/sched/debug.h>
18 19
@@ -22,10 +23,11 @@
22static DEFINE_PER_CPU(bool, hard_watchdog_warn); 23static DEFINE_PER_CPU(bool, hard_watchdog_warn);
23static DEFINE_PER_CPU(bool, watchdog_nmi_touch); 24static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
24static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); 25static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
26static DEFINE_PER_CPU(struct perf_event *, dead_event);
25static struct cpumask dead_events_mask; 27static struct cpumask dead_events_mask;
26 28
27static unsigned long hardlockup_allcpu_dumped; 29static unsigned long hardlockup_allcpu_dumped;
28static unsigned int watchdog_cpus; 30static atomic_t watchdog_cpus = ATOMIC_INIT(0);
29 31
30void arch_touch_nmi_watchdog(void) 32void arch_touch_nmi_watchdog(void)
31{ 33{
@@ -189,7 +191,8 @@ void hardlockup_detector_perf_enable(void)
189 if (hardlockup_detector_event_create()) 191 if (hardlockup_detector_event_create())
190 return; 192 return;
191 193
192 if (!watchdog_cpus++) 194 /* use original value for check */
195 if (!atomic_fetch_inc(&watchdog_cpus))
193 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n"); 196 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
194 197
195 perf_event_enable(this_cpu_read(watchdog_ev)); 198 perf_event_enable(this_cpu_read(watchdog_ev));
@@ -204,8 +207,10 @@ void hardlockup_detector_perf_disable(void)
204 207
205 if (event) { 208 if (event) {
206 perf_event_disable(event); 209 perf_event_disable(event);
210 this_cpu_write(watchdog_ev, NULL);
211 this_cpu_write(dead_event, event);
207 cpumask_set_cpu(smp_processor_id(), &dead_events_mask); 212 cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
208 watchdog_cpus--; 213 atomic_dec(&watchdog_cpus);
209 } 214 }
210} 215}
211 216
@@ -219,7 +224,7 @@ void hardlockup_detector_perf_cleanup(void)
219 int cpu; 224 int cpu;
220 225
221 for_each_cpu(cpu, &dead_events_mask) { 226 for_each_cpu(cpu, &dead_events_mask) {
222 struct perf_event *event = per_cpu(watchdog_ev, cpu); 227 struct perf_event *event = per_cpu(dead_event, cpu);
223 228
224 /* 229 /*
225 * Required because for_each_cpu() reports unconditionally 230 * Required because for_each_cpu() reports unconditionally
@@ -227,7 +232,7 @@ void hardlockup_detector_perf_cleanup(void)
227 */ 232 */
228 if (event) 233 if (event)
229 perf_event_release_kernel(event); 234 perf_event_release_kernel(event);
230 per_cpu(watchdog_ev, cpu) = NULL; 235 per_cpu(dead_event, cpu) = NULL;
231 } 236 }
232 cpumask_clear(&dead_events_mask); 237 cpumask_clear(&dead_events_mask);
233} 238}
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 269b5df58543..1981ed697dab 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -941,6 +941,9 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
941 pmd = pmd_swp_mksoft_dirty(pmd); 941 pmd = pmd_swp_mksoft_dirty(pmd);
942 set_pmd_at(src_mm, addr, src_pmd, pmd); 942 set_pmd_at(src_mm, addr, src_pmd, pmd);
943 } 943 }
944 add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);
945 atomic_long_inc(&dst_mm->nr_ptes);
946 pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable);
944 set_pmd_at(dst_mm, addr, dst_pmd, pmd); 947 set_pmd_at(dst_mm, addr, dst_pmd, pmd);
945 ret = 0; 948 ret = 0;
946 goto out_unlock; 949 goto out_unlock;
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 424b0ef08a60..2d2ff5e8bf2b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3984,6 +3984,9 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
3984 unsigned long src_addr, 3984 unsigned long src_addr,
3985 struct page **pagep) 3985 struct page **pagep)
3986{ 3986{
3987 struct address_space *mapping;
3988 pgoff_t idx;
3989 unsigned long size;
3987 int vm_shared = dst_vma->vm_flags & VM_SHARED; 3990 int vm_shared = dst_vma->vm_flags & VM_SHARED;
3988 struct hstate *h = hstate_vma(dst_vma); 3991 struct hstate *h = hstate_vma(dst_vma);
3989 pte_t _dst_pte; 3992 pte_t _dst_pte;
@@ -4021,13 +4024,24 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
4021 __SetPageUptodate(page); 4024 __SetPageUptodate(page);
4022 set_page_huge_active(page); 4025 set_page_huge_active(page);
4023 4026
4027 mapping = dst_vma->vm_file->f_mapping;
4028 idx = vma_hugecache_offset(h, dst_vma, dst_addr);
4029
4024 /* 4030 /*
4025 * If shared, add to page cache 4031 * If shared, add to page cache
4026 */ 4032 */
4027 if (vm_shared) { 4033 if (vm_shared) {
4028 struct address_space *mapping = dst_vma->vm_file->f_mapping; 4034 size = i_size_read(mapping->host) >> huge_page_shift(h);
4029 pgoff_t idx = vma_hugecache_offset(h, dst_vma, dst_addr); 4035 ret = -EFAULT;
4036 if (idx >= size)
4037 goto out_release_nounlock;
4030 4038
4039 /*
4040 * Serialization between remove_inode_hugepages() and
4041 * huge_add_to_page_cache() below happens through the
4042 * hugetlb_fault_mutex_table that here must be hold by
4043 * the caller.
4044 */
4031 ret = huge_add_to_page_cache(page, mapping, idx); 4045 ret = huge_add_to_page_cache(page, mapping, idx);
4032 if (ret) 4046 if (ret)
4033 goto out_release_nounlock; 4047 goto out_release_nounlock;
@@ -4036,6 +4050,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
4036 ptl = huge_pte_lockptr(h, dst_mm, dst_pte); 4050 ptl = huge_pte_lockptr(h, dst_mm, dst_pte);
4037 spin_lock(ptl); 4051 spin_lock(ptl);
4038 4052
4053 /*
4054 * Recheck the i_size after holding PT lock to make sure not
4055 * to leave any page mapped (as page_mapped()) beyond the end
4056 * of the i_size (remove_inode_hugepages() is strict about
4057 * enforcing that). If we bail out here, we'll also leave a
4058 * page in the radix tree in the vm_shared case beyond the end
4059 * of the i_size, but remove_inode_hugepages() will take care
4060 * of it as soon as we drop the hugetlb_fault_mutex_table.
4061 */
4062 size = i_size_read(mapping->host) >> huge_page_shift(h);
4063 ret = -EFAULT;
4064 if (idx >= size)
4065 goto out_release_unlock;
4066
4039 ret = -EEXIST; 4067 ret = -EEXIST;
4040 if (!huge_pte_none(huge_ptep_get(dst_pte))) 4068 if (!huge_pte_none(huge_ptep_get(dst_pte)))
4041 goto out_release_unlock; 4069 goto out_release_unlock;
diff --git a/mm/swapfile.c b/mm/swapfile.c
index bf91dc9e7a79..e47a21e64764 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2869,6 +2869,7 @@ static struct swap_info_struct *alloc_swap_info(void)
2869 p->flags = SWP_USED; 2869 p->flags = SWP_USED;
2870 spin_unlock(&swap_lock); 2870 spin_unlock(&swap_lock);
2871 spin_lock_init(&p->lock); 2871 spin_lock_init(&p->lock);
2872 spin_lock_init(&p->cont_lock);
2872 2873
2873 return p; 2874 return p;
2874} 2875}
@@ -3545,6 +3546,7 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask)
3545 head = vmalloc_to_page(si->swap_map + offset); 3546 head = vmalloc_to_page(si->swap_map + offset);
3546 offset &= ~PAGE_MASK; 3547 offset &= ~PAGE_MASK;
3547 3548
3549 spin_lock(&si->cont_lock);
3548 /* 3550 /*
3549 * Page allocation does not initialize the page's lru field, 3551 * Page allocation does not initialize the page's lru field,
3550 * but it does always reset its private field. 3552 * but it does always reset its private field.
@@ -3564,7 +3566,7 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask)
3564 * a continuation page, free our allocation and use this one. 3566 * a continuation page, free our allocation and use this one.
3565 */ 3567 */
3566 if (!(count & COUNT_CONTINUED)) 3568 if (!(count & COUNT_CONTINUED))
3567 goto out; 3569 goto out_unlock_cont;
3568 3570
3569 map = kmap_atomic(list_page) + offset; 3571 map = kmap_atomic(list_page) + offset;
3570 count = *map; 3572 count = *map;
@@ -3575,11 +3577,13 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask)
3575 * free our allocation and use this one. 3577 * free our allocation and use this one.
3576 */ 3578 */
3577 if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX) 3579 if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX)
3578 goto out; 3580 goto out_unlock_cont;
3579 } 3581 }
3580 3582
3581 list_add_tail(&page->lru, &head->lru); 3583 list_add_tail(&page->lru, &head->lru);
3582 page = NULL; /* now it's attached, don't free it */ 3584 page = NULL; /* now it's attached, don't free it */
3585out_unlock_cont:
3586 spin_unlock(&si->cont_lock);
3583out: 3587out:
3584 unlock_cluster(ci); 3588 unlock_cluster(ci);
3585 spin_unlock(&si->lock); 3589 spin_unlock(&si->lock);
@@ -3604,6 +3608,7 @@ static bool swap_count_continued(struct swap_info_struct *si,
3604 struct page *head; 3608 struct page *head;
3605 struct page *page; 3609 struct page *page;
3606 unsigned char *map; 3610 unsigned char *map;
3611 bool ret;
3607 3612
3608 head = vmalloc_to_page(si->swap_map + offset); 3613 head = vmalloc_to_page(si->swap_map + offset);
3609 if (page_private(head) != SWP_CONTINUED) { 3614 if (page_private(head) != SWP_CONTINUED) {
@@ -3611,6 +3616,7 @@ static bool swap_count_continued(struct swap_info_struct *si,
3611 return false; /* need to add count continuation */ 3616 return false; /* need to add count continuation */
3612 } 3617 }
3613 3618
3619 spin_lock(&si->cont_lock);
3614 offset &= ~PAGE_MASK; 3620 offset &= ~PAGE_MASK;
3615 page = list_entry(head->lru.next, struct page, lru); 3621 page = list_entry(head->lru.next, struct page, lru);
3616 map = kmap_atomic(page) + offset; 3622 map = kmap_atomic(page) + offset;
@@ -3631,8 +3637,10 @@ static bool swap_count_continued(struct swap_info_struct *si,
3631 if (*map == SWAP_CONT_MAX) { 3637 if (*map == SWAP_CONT_MAX) {
3632 kunmap_atomic(map); 3638 kunmap_atomic(map);
3633 page = list_entry(page->lru.next, struct page, lru); 3639 page = list_entry(page->lru.next, struct page, lru);
3634 if (page == head) 3640 if (page == head) {
3635 return false; /* add count continuation */ 3641 ret = false; /* add count continuation */
3642 goto out;
3643 }
3636 map = kmap_atomic(page) + offset; 3644 map = kmap_atomic(page) + offset;
3637init_map: *map = 0; /* we didn't zero the page */ 3645init_map: *map = 0; /* we didn't zero the page */
3638 } 3646 }
@@ -3645,7 +3653,7 @@ init_map: *map = 0; /* we didn't zero the page */
3645 kunmap_atomic(map); 3653 kunmap_atomic(map);
3646 page = list_entry(page->lru.prev, struct page, lru); 3654 page = list_entry(page->lru.prev, struct page, lru);
3647 } 3655 }
3648 return true; /* incremented */ 3656 ret = true; /* incremented */
3649 3657
3650 } else { /* decrementing */ 3658 } else { /* decrementing */
3651 /* 3659 /*
@@ -3671,8 +3679,11 @@ init_map: *map = 0; /* we didn't zero the page */
3671 kunmap_atomic(map); 3679 kunmap_atomic(map);
3672 page = list_entry(page->lru.prev, struct page, lru); 3680 page = list_entry(page->lru.prev, struct page, lru);
3673 } 3681 }
3674 return count == COUNT_CONTINUED; 3682 ret = count == COUNT_CONTINUED;
3675 } 3683 }
3684out:
3685 spin_unlock(&si->cont_lock);
3686 return ret;
3676} 3687}
3677 3688
3678/* 3689/*
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 57a5d48acee8..01ed22139ac2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1365,8 +1365,6 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
1365 nla_put_in_addr(skb, RTA_PREFSRC, fi->fib_prefsrc)) 1365 nla_put_in_addr(skb, RTA_PREFSRC, fi->fib_prefsrc))
1366 goto nla_put_failure; 1366 goto nla_put_failure;
1367 if (fi->fib_nhs == 1) { 1367 if (fi->fib_nhs == 1) {
1368 struct in_device *in_dev;
1369
1370 if (fi->fib_nh->nh_gw && 1368 if (fi->fib_nh->nh_gw &&
1371 nla_put_in_addr(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) 1369 nla_put_in_addr(skb, RTA_GATEWAY, fi->fib_nh->nh_gw))
1372 goto nla_put_failure; 1370 goto nla_put_failure;
@@ -1374,10 +1372,14 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
1374 nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) 1372 nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif))
1375 goto nla_put_failure; 1373 goto nla_put_failure;
1376 if (fi->fib_nh->nh_flags & RTNH_F_LINKDOWN) { 1374 if (fi->fib_nh->nh_flags & RTNH_F_LINKDOWN) {
1377 in_dev = __in_dev_get_rtnl(fi->fib_nh->nh_dev); 1375 struct in_device *in_dev;
1376
1377 rcu_read_lock();
1378 in_dev = __in_dev_get_rcu(fi->fib_nh->nh_dev);
1378 if (in_dev && 1379 if (in_dev &&
1379 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) 1380 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
1380 rtm->rtm_flags |= RTNH_F_DEAD; 1381 rtm->rtm_flags |= RTNH_F_DEAD;
1382 rcu_read_unlock();
1381 } 1383 }
1382 if (fi->fib_nh->nh_flags & RTNH_F_OFFLOAD) 1384 if (fi->fib_nh->nh_flags & RTNH_F_OFFLOAD)
1383 rtm->rtm_flags |= RTNH_F_OFFLOAD; 1385 rtm->rtm_flags |= RTNH_F_OFFLOAD;
@@ -1400,18 +1402,20 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
1400 goto nla_put_failure; 1402 goto nla_put_failure;
1401 1403
1402 for_nexthops(fi) { 1404 for_nexthops(fi) {
1403 struct in_device *in_dev;
1404
1405 rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); 1405 rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh));
1406 if (!rtnh) 1406 if (!rtnh)
1407 goto nla_put_failure; 1407 goto nla_put_failure;
1408 1408
1409 rtnh->rtnh_flags = nh->nh_flags & 0xFF; 1409 rtnh->rtnh_flags = nh->nh_flags & 0xFF;
1410 if (nh->nh_flags & RTNH_F_LINKDOWN) { 1410 if (nh->nh_flags & RTNH_F_LINKDOWN) {
1411 in_dev = __in_dev_get_rtnl(nh->nh_dev); 1411 struct in_device *in_dev;
1412
1413 rcu_read_lock();
1414 in_dev = __in_dev_get_rcu(nh->nh_dev);
1412 if (in_dev && 1415 if (in_dev &&
1413 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) 1416 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
1414 rtnh->rtnh_flags |= RTNH_F_DEAD; 1417 rtnh->rtnh_flags |= RTNH_F_DEAD;
1418 rcu_read_unlock();
1415 } 1419 }
1416 rtnh->rtnh_hops = nh->nh_weight - 1; 1420 rtnh->rtnh_hops = nh->nh_weight - 1;
1417 rtnh->rtnh_ifindex = nh->nh_oif; 1421 rtnh->rtnh_ifindex = nh->nh_oif;
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
index eeacbdaf7cdf..5cd06ba3535d 100644
--- a/net/ipv4/netfilter/nf_reject_ipv4.c
+++ b/net/ipv4/netfilter/nf_reject_ipv4.c
@@ -132,6 +132,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)
132 if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) 132 if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
133 goto free_nskb; 133 goto free_nskb;
134 134
135 niph = ip_hdr(nskb);
136
135 /* "Never happens" */ 137 /* "Never happens" */
136 if (nskb->len > dst_mtu(skb_dst(nskb))) 138 if (nskb->len > dst_mtu(skb_dst(nskb)))
137 goto free_nskb; 139 goto free_nskb;
diff --git a/net/ipv4/tcp_nv.c b/net/ipv4/tcp_nv.c
index 1ff73982e28c..125fc1450b01 100644
--- a/net/ipv4/tcp_nv.c
+++ b/net/ipv4/tcp_nv.c
@@ -252,7 +252,7 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample)
252 252
253 /* rate in 100's bits per second */ 253 /* rate in 100's bits per second */
254 rate64 = ((u64)sample->in_flight) * 8000000; 254 rate64 = ((u64)sample->in_flight) * 8000000;
255 rate = (u32)div64_u64(rate64, (u64)(avg_rtt * 100)); 255 rate = (u32)div64_u64(rate64, (u64)(avg_rtt ?: 1) * 100);
256 256
257 /* Remember the maximum rate seen during this RTT 257 /* Remember the maximum rate seen during this RTT
258 * Note: It may be more than one RTT. This function should be 258 * Note: It may be more than one RTT. This function should be
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 823003eef3a2..478909f4694d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3180,13 +3180,8 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
3180 th->source = htons(ireq->ir_num); 3180 th->source = htons(ireq->ir_num);
3181 th->dest = ireq->ir_rmt_port; 3181 th->dest = ireq->ir_rmt_port;
3182 skb->mark = ireq->ir_mark; 3182 skb->mark = ireq->ir_mark;
3183 /* Setting of flags are superfluous here for callers (and ECE is 3183 skb->ip_summed = CHECKSUM_PARTIAL;
3184 * not even correctly set) 3184 th->seq = htonl(tcp_rsk(req)->snt_isn);
3185 */
3186 tcp_init_nondata_skb(skb, tcp_rsk(req)->snt_isn,
3187 TCPHDR_SYN | TCPHDR_ACK);
3188
3189 th->seq = htonl(TCP_SKB_CB(skb)->seq);
3190 /* XXX data is queued and acked as is. No buffer/window check */ 3185 /* XXX data is queued and acked as is. No buffer/window check */
3191 th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt); 3186 th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt);
3192 3187
diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c
index 0fa01d772c5e..9c0d5a7ce5f9 100644
--- a/net/netfilter/nft_set_hash.c
+++ b/net/netfilter/nft_set_hash.c
@@ -643,7 +643,6 @@ nft_hash_select_ops(const struct nft_ctx *ctx, const struct nft_set_desc *desc,
643{ 643{
644 if (desc->size) { 644 if (desc->size) {
645 switch (desc->klen) { 645 switch (desc->klen) {
646 case 2:
647 case 4: 646 case 4:
648 return &nft_hash_fast_ops; 647 return &nft_hash_fast_ops;
649 default: 648 default:
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index da6fa82c98a8..ca2ff0b3123f 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -78,6 +78,7 @@ static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p)
78 spin_lock_bh(&idrinfo->lock); 78 spin_lock_bh(&idrinfo->lock);
79 idr_remove_ext(&idrinfo->action_idr, p->tcfa_index); 79 idr_remove_ext(&idrinfo->action_idr, p->tcfa_index);
80 spin_unlock_bh(&idrinfo->lock); 80 spin_unlock_bh(&idrinfo->lock);
81 put_net(idrinfo->net);
81 gen_kill_estimator(&p->tcfa_rate_est); 82 gen_kill_estimator(&p->tcfa_rate_est);
82 free_tcf(p); 83 free_tcf(p);
83} 84}
@@ -86,6 +87,8 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict)
86{ 87{
87 int ret = 0; 88 int ret = 0;
88 89
90 ASSERT_RTNL();
91
89 if (p) { 92 if (p) {
90 if (bind) 93 if (bind)
91 p->tcfa_bindcnt--; 94 p->tcfa_bindcnt--;
@@ -334,6 +337,7 @@ err3:
334 p->idrinfo = idrinfo; 337 p->idrinfo = idrinfo;
335 p->ops = ops; 338 p->ops = ops;
336 INIT_LIST_HEAD(&p->list); 339 INIT_LIST_HEAD(&p->list);
340 get_net(idrinfo->net);
337 *a = p; 341 *a = p;
338 return 0; 342 return 0;
339} 343}
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
index c0c707eb2c96..9bce8cc84cbb 100644
--- a/net/sched/act_bpf.c
+++ b/net/sched/act_bpf.c
@@ -398,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net)
398{ 398{
399 struct tc_action_net *tn = net_generic(net, bpf_net_id); 399 struct tc_action_net *tn = net_generic(net, bpf_net_id);
400 400
401 return tc_action_net_init(tn, &act_bpf_ops); 401 return tc_action_net_init(tn, &act_bpf_ops, net);
402} 402}
403 403
404static void __net_exit bpf_exit_net(struct net *net) 404static void __net_exit bpf_exit_net(struct net *net)
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c
index 10b7a8855a6c..34e52d01a5dd 100644
--- a/net/sched/act_connmark.c
+++ b/net/sched/act_connmark.c
@@ -206,7 +206,7 @@ static __net_init int connmark_init_net(struct net *net)
206{ 206{
207 struct tc_action_net *tn = net_generic(net, connmark_net_id); 207 struct tc_action_net *tn = net_generic(net, connmark_net_id);
208 208
209 return tc_action_net_init(tn, &act_connmark_ops); 209 return tc_action_net_init(tn, &act_connmark_ops, net);
210} 210}
211 211
212static void __net_exit connmark_exit_net(struct net *net) 212static void __net_exit connmark_exit_net(struct net *net)
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 1c40caadcff9..35171df2ebef 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -626,7 +626,7 @@ static __net_init int csum_init_net(struct net *net)
626{ 626{
627 struct tc_action_net *tn = net_generic(net, csum_net_id); 627 struct tc_action_net *tn = net_generic(net, csum_net_id);
628 628
629 return tc_action_net_init(tn, &act_csum_ops); 629 return tc_action_net_init(tn, &act_csum_ops, net);
630} 630}
631 631
632static void __net_exit csum_exit_net(struct net *net) 632static void __net_exit csum_exit_net(struct net *net)
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index e29a48ef7fc3..ef7f7f39d26d 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -232,7 +232,7 @@ static __net_init int gact_init_net(struct net *net)
232{ 232{
233 struct tc_action_net *tn = net_generic(net, gact_net_id); 233 struct tc_action_net *tn = net_generic(net, gact_net_id);
234 234
235 return tc_action_net_init(tn, &act_gact_ops); 235 return tc_action_net_init(tn, &act_gact_ops, net);
236} 236}
237 237
238static void __net_exit gact_exit_net(struct net *net) 238static void __net_exit gact_exit_net(struct net *net)
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 8ccd35825b6b..f65e4b5058e0 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -818,7 +818,7 @@ static __net_init int ife_init_net(struct net *net)
818{ 818{
819 struct tc_action_net *tn = net_generic(net, ife_net_id); 819 struct tc_action_net *tn = net_generic(net, ife_net_id);
820 820
821 return tc_action_net_init(tn, &act_ife_ops); 821 return tc_action_net_init(tn, &act_ife_ops, net);
822} 822}
823 823
824static void __net_exit ife_exit_net(struct net *net) 824static void __net_exit ife_exit_net(struct net *net)
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index d9e399a7e3d5..dbdf3b2470d5 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -334,7 +334,7 @@ static __net_init int ipt_init_net(struct net *net)
334{ 334{
335 struct tc_action_net *tn = net_generic(net, ipt_net_id); 335 struct tc_action_net *tn = net_generic(net, ipt_net_id);
336 336
337 return tc_action_net_init(tn, &act_ipt_ops); 337 return tc_action_net_init(tn, &act_ipt_ops, net);
338} 338}
339 339
340static void __net_exit ipt_exit_net(struct net *net) 340static void __net_exit ipt_exit_net(struct net *net)
@@ -384,7 +384,7 @@ static __net_init int xt_init_net(struct net *net)
384{ 384{
385 struct tc_action_net *tn = net_generic(net, xt_net_id); 385 struct tc_action_net *tn = net_generic(net, xt_net_id);
386 386
387 return tc_action_net_init(tn, &act_xt_ops); 387 return tc_action_net_init(tn, &act_xt_ops, net);
388} 388}
389 389
390static void __net_exit xt_exit_net(struct net *net) 390static void __net_exit xt_exit_net(struct net *net)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 416627c66f08..84759cfd5a33 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -343,7 +343,7 @@ static __net_init int mirred_init_net(struct net *net)
343{ 343{
344 struct tc_action_net *tn = net_generic(net, mirred_net_id); 344 struct tc_action_net *tn = net_generic(net, mirred_net_id);
345 345
346 return tc_action_net_init(tn, &act_mirred_ops); 346 return tc_action_net_init(tn, &act_mirred_ops, net);
347} 347}
348 348
349static void __net_exit mirred_exit_net(struct net *net) 349static void __net_exit mirred_exit_net(struct net *net)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index c365d01b99c8..7eeaaf9217b6 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -307,7 +307,7 @@ static __net_init int nat_init_net(struct net *net)
307{ 307{
308 struct tc_action_net *tn = net_generic(net, nat_net_id); 308 struct tc_action_net *tn = net_generic(net, nat_net_id);
309 309
310 return tc_action_net_init(tn, &act_nat_ops); 310 return tc_action_net_init(tn, &act_nat_ops, net);
311} 311}
312 312
313static void __net_exit nat_exit_net(struct net *net) 313static void __net_exit nat_exit_net(struct net *net)
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 491fe5deb09e..b3d82c334a5f 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -450,7 +450,7 @@ static __net_init int pedit_init_net(struct net *net)
450{ 450{
451 struct tc_action_net *tn = net_generic(net, pedit_net_id); 451 struct tc_action_net *tn = net_generic(net, pedit_net_id);
452 452
453 return tc_action_net_init(tn, &act_pedit_ops); 453 return tc_action_net_init(tn, &act_pedit_ops, net);
454} 454}
455 455
456static void __net_exit pedit_exit_net(struct net *net) 456static void __net_exit pedit_exit_net(struct net *net)
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 3bb2ebf9e9ae..9ec42b26e4b9 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -331,7 +331,7 @@ static __net_init int police_init_net(struct net *net)
331{ 331{
332 struct tc_action_net *tn = net_generic(net, police_net_id); 332 struct tc_action_net *tn = net_generic(net, police_net_id);
333 333
334 return tc_action_net_init(tn, &act_police_ops); 334 return tc_action_net_init(tn, &act_police_ops, net);
335} 335}
336 336
337static void __net_exit police_exit_net(struct net *net) 337static void __net_exit police_exit_net(struct net *net)
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 8b5abcd2f32f..e69a1e3a39bf 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -240,7 +240,7 @@ static __net_init int sample_init_net(struct net *net)
240{ 240{
241 struct tc_action_net *tn = net_generic(net, sample_net_id); 241 struct tc_action_net *tn = net_generic(net, sample_net_id);
242 242
243 return tc_action_net_init(tn, &act_sample_ops); 243 return tc_action_net_init(tn, &act_sample_ops, net);
244} 244}
245 245
246static void __net_exit sample_exit_net(struct net *net) 246static void __net_exit sample_exit_net(struct net *net)
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index e7b57e5071a3..a8d0ea95f894 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -201,7 +201,7 @@ static __net_init int simp_init_net(struct net *net)
201{ 201{
202 struct tc_action_net *tn = net_generic(net, simp_net_id); 202 struct tc_action_net *tn = net_generic(net, simp_net_id);
203 203
204 return tc_action_net_init(tn, &act_simp_ops); 204 return tc_action_net_init(tn, &act_simp_ops, net);
205} 205}
206 206
207static void __net_exit simp_exit_net(struct net *net) 207static void __net_exit simp_exit_net(struct net *net)
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 59949d61f20d..fbac62472e09 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -238,7 +238,7 @@ static __net_init int skbedit_init_net(struct net *net)
238{ 238{
239 struct tc_action_net *tn = net_generic(net, skbedit_net_id); 239 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
240 240
241 return tc_action_net_init(tn, &act_skbedit_ops); 241 return tc_action_net_init(tn, &act_skbedit_ops, net);
242} 242}
243 243
244static void __net_exit skbedit_exit_net(struct net *net) 244static void __net_exit skbedit_exit_net(struct net *net)
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index b642ad3d39dd..8e12d8897d2f 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -263,7 +263,7 @@ static __net_init int skbmod_init_net(struct net *net)
263{ 263{
264 struct tc_action_net *tn = net_generic(net, skbmod_net_id); 264 struct tc_action_net *tn = net_generic(net, skbmod_net_id);
265 265
266 return tc_action_net_init(tn, &act_skbmod_ops); 266 return tc_action_net_init(tn, &act_skbmod_ops, net);
267} 267}
268 268
269static void __net_exit skbmod_exit_net(struct net *net) 269static void __net_exit skbmod_exit_net(struct net *net)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 30c96274c638..c33faa373cf2 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -322,7 +322,7 @@ static __net_init int tunnel_key_init_net(struct net *net)
322{ 322{
323 struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); 323 struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
324 324
325 return tc_action_net_init(tn, &act_tunnel_key_ops); 325 return tc_action_net_init(tn, &act_tunnel_key_ops, net);
326} 326}
327 327
328static void __net_exit tunnel_key_exit_net(struct net *net) 328static void __net_exit tunnel_key_exit_net(struct net *net)
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 16eb067a8d8f..115fc33cc6d8 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -269,7 +269,7 @@ static __net_init int vlan_init_net(struct net *net)
269{ 269{
270 struct tc_action_net *tn = net_generic(net, vlan_net_id); 270 struct tc_action_net *tn = net_generic(net, vlan_net_id);
271 271
272 return tc_action_net_init(tn, &act_vlan_ops); 272 return tc_action_net_init(tn, &act_vlan_ops, net);
273} 273}
274 274
275static void __net_exit vlan_exit_net(struct net *net) 275static void __net_exit vlan_exit_net(struct net *net)
diff --git a/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk b/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
index a3d2c62fd805..b02a36b2c14f 100644
--- a/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
+++ b/tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
@@ -1,4 +1,5 @@
1#!/bin/awk -f 1#!/bin/awk -f
2# SPDX-License-Identifier: GPL-2.0
2# gen-insn-attr-x86.awk: Instruction attribute table generator 3# gen-insn-attr-x86.awk: Instruction attribute table generator
3# Written by Masami Hiramatsu <mhiramat@redhat.com> 4# Written by Masami Hiramatsu <mhiramat@redhat.com>
4# 5#
diff --git a/usr/Makefile b/usr/Makefile
index 34a9fcd0f537..237a028693ce 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -8,6 +8,7 @@ PHONY += klibcdirs
8 8
9suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) 9suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
10datafile_y = initramfs_data.cpio$(suffix_y) 10datafile_y = initramfs_data.cpio$(suffix_y)
11datafile_d_y = .$(datafile_y).d
11AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" 12AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
12 13
13 14
@@ -30,12 +31,12 @@ ramfs-args := \
30 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ 31 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
31 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) 32 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
32 33
33# .initramfs_data.cpio.d is used to identify all files included 34# $(datafile_d_y) is used to identify all files included
34# in initramfs and to detect if any files are added/removed. 35# in initramfs and to detect if any files are added/removed.
35# Removed files are identified by directory timestamp being updated 36# Removed files are identified by directory timestamp being updated
36# The dependency list is generated by gen_initramfs.sh -l 37# The dependency list is generated by gen_initramfs.sh -l
37ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),) 38ifneq ($(wildcard $(obj)/$(datafile_d_y)),)
38 include $(obj)/.initramfs_data.cpio.d 39 include $(obj)/$(datafile_d_y)
39endif 40endif
40 41
41quiet_cmd_initfs = GEN $@ 42quiet_cmd_initfs = GEN $@
@@ -53,5 +54,5 @@ $(deps_initramfs): klibcdirs
53# 3) If gen_init_cpio are newer than initramfs_data.cpio 54# 3) If gen_init_cpio are newer than initramfs_data.cpio
54# 4) arguments to gen_initramfs.sh changes 55# 4) arguments to gen_initramfs.sh changes
55$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs 56$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
56 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d 57 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y)
57 $(call if_changed,initfs) 58 $(call if_changed,initfs)
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index b9f68e4add71..95cba0799828 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1326,21 +1326,12 @@ static void teardown_hyp_mode(void)
1326{ 1326{
1327 int cpu; 1327 int cpu;
1328 1328
1329 if (is_kernel_in_hyp_mode())
1330 return;
1331
1332 free_hyp_pgds(); 1329 free_hyp_pgds();
1333 for_each_possible_cpu(cpu) 1330 for_each_possible_cpu(cpu)
1334 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); 1331 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
1335 hyp_cpu_pm_exit(); 1332 hyp_cpu_pm_exit();
1336} 1333}
1337 1334
1338static int init_vhe_mode(void)
1339{
1340 kvm_info("VHE mode initialized successfully\n");
1341 return 0;
1342}
1343
1344/** 1335/**
1345 * Inits Hyp-mode on all online CPUs 1336 * Inits Hyp-mode on all online CPUs
1346 */ 1337 */
@@ -1421,8 +1412,6 @@ static int init_hyp_mode(void)
1421 } 1412 }
1422 } 1413 }
1423 1414
1424 kvm_info("Hyp mode initialized successfully\n");
1425
1426 return 0; 1415 return 0;
1427 1416
1428out_err: 1417out_err:
@@ -1456,6 +1445,7 @@ int kvm_arch_init(void *opaque)
1456{ 1445{
1457 int err; 1446 int err;
1458 int ret, cpu; 1447 int ret, cpu;
1448 bool in_hyp_mode;
1459 1449
1460 if (!is_hyp_mode_available()) { 1450 if (!is_hyp_mode_available()) {
1461 kvm_err("HYP mode not available\n"); 1451 kvm_err("HYP mode not available\n");
@@ -1474,21 +1464,28 @@ int kvm_arch_init(void *opaque)
1474 if (err) 1464 if (err)
1475 return err; 1465 return err;
1476 1466
1477 if (is_kernel_in_hyp_mode()) 1467 in_hyp_mode = is_kernel_in_hyp_mode();
1478 err = init_vhe_mode(); 1468
1479 else 1469 if (!in_hyp_mode) {
1480 err = init_hyp_mode(); 1470 err = init_hyp_mode();
1481 if (err) 1471 if (err)
1482 goto out_err; 1472 goto out_err;
1473 }
1483 1474
1484 err = init_subsystems(); 1475 err = init_subsystems();
1485 if (err) 1476 if (err)
1486 goto out_hyp; 1477 goto out_hyp;
1487 1478
1479 if (in_hyp_mode)
1480 kvm_info("VHE mode initialized successfully\n");
1481 else
1482 kvm_info("Hyp mode initialized successfully\n");
1483
1488 return 0; 1484 return 0;
1489 1485
1490out_hyp: 1486out_hyp:
1491 teardown_hyp_mode(); 1487 if (!in_hyp_mode)
1488 teardown_hyp_mode();
1492out_err: 1489out_err:
1493 teardown_common_resources(); 1490 teardown_common_resources();
1494 return err; 1491 return err;
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index f51c1e1b3f70..547f12dc4d54 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -1466,6 +1466,16 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
1466{ 1466{
1467 mutex_lock(&its->cmd_lock); 1467 mutex_lock(&its->cmd_lock);
1468 1468
1469 /*
1470 * It is UNPREDICTABLE to enable the ITS if any of the CBASER or
1471 * device/collection BASER are invalid
1472 */
1473 if (!its->enabled && (val & GITS_CTLR_ENABLE) &&
1474 (!(its->baser_device_table & GITS_BASER_VALID) ||
1475 !(its->baser_coll_table & GITS_BASER_VALID) ||
1476 !(its->cbaser & GITS_CBASER_VALID)))
1477 goto out;
1478
1469 its->enabled = !!(val & GITS_CTLR_ENABLE); 1479 its->enabled = !!(val & GITS_CTLR_ENABLE);
1470 1480
1471 /* 1481 /*
@@ -1474,6 +1484,7 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
1474 */ 1484 */
1475 vgic_its_process_commands(kvm, its); 1485 vgic_its_process_commands(kvm, its);
1476 1486
1487out:
1477 mutex_unlock(&its->cmd_lock); 1488 mutex_unlock(&its->cmd_lock);
1478} 1489}
1479 1490
@@ -1801,37 +1812,33 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry,
1801static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz, 1812static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz,
1802 int start_id, entry_fn_t fn, void *opaque) 1813 int start_id, entry_fn_t fn, void *opaque)
1803{ 1814{
1804 void *entry = kzalloc(esz, GFP_KERNEL);
1805 struct kvm *kvm = its->dev->kvm; 1815 struct kvm *kvm = its->dev->kvm;
1806 unsigned long len = size; 1816 unsigned long len = size;
1807 int id = start_id; 1817 int id = start_id;
1808 gpa_t gpa = base; 1818 gpa_t gpa = base;
1819 char entry[esz];
1809 int ret; 1820 int ret;
1810 1821
1822 memset(entry, 0, esz);
1823
1811 while (len > 0) { 1824 while (len > 0) {
1812 int next_offset; 1825 int next_offset;
1813 size_t byte_offset; 1826 size_t byte_offset;
1814 1827
1815 ret = kvm_read_guest(kvm, gpa, entry, esz); 1828 ret = kvm_read_guest(kvm, gpa, entry, esz);
1816 if (ret) 1829 if (ret)
1817 goto out; 1830 return ret;
1818 1831
1819 next_offset = fn(its, id, entry, opaque); 1832 next_offset = fn(its, id, entry, opaque);
1820 if (next_offset <= 0) { 1833 if (next_offset <= 0)
1821 ret = next_offset; 1834 return next_offset;
1822 goto out;
1823 }
1824 1835
1825 byte_offset = next_offset * esz; 1836 byte_offset = next_offset * esz;
1826 id += next_offset; 1837 id += next_offset;
1827 gpa += byte_offset; 1838 gpa += byte_offset;
1828 len -= byte_offset; 1839 len -= byte_offset;
1829 } 1840 }
1830 ret = 1; 1841 return 1;
1831
1832out:
1833 kfree(entry);
1834 return ret;
1835} 1842}
1836 1843
1837/** 1844/**
@@ -1940,6 +1947,14 @@ static int vgic_its_save_itt(struct vgic_its *its, struct its_device *device)
1940 return 0; 1947 return 0;
1941} 1948}
1942 1949
1950/**
1951 * vgic_its_restore_itt - restore the ITT of a device
1952 *
1953 * @its: its handle
1954 * @dev: device handle
1955 *
1956 * Return 0 on success, < 0 on error
1957 */
1943static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev) 1958static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)
1944{ 1959{
1945 const struct vgic_its_abi *abi = vgic_its_get_abi(its); 1960 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
@@ -1951,6 +1966,10 @@ static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)
1951 ret = scan_its_table(its, base, max_size, ite_esz, 0, 1966 ret = scan_its_table(its, base, max_size, ite_esz, 0,
1952 vgic_its_restore_ite, dev); 1967 vgic_its_restore_ite, dev);
1953 1968
1969 /* scan_its_table returns +1 if all ITEs are invalid */
1970 if (ret > 0)
1971 ret = 0;
1972
1954 return ret; 1973 return ret;
1955} 1974}
1956 1975
@@ -2048,11 +2067,12 @@ static int vgic_its_device_cmp(void *priv, struct list_head *a,
2048static int vgic_its_save_device_tables(struct vgic_its *its) 2067static int vgic_its_save_device_tables(struct vgic_its *its)
2049{ 2068{
2050 const struct vgic_its_abi *abi = vgic_its_get_abi(its); 2069 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2070 u64 baser = its->baser_device_table;
2051 struct its_device *dev; 2071 struct its_device *dev;
2052 int dte_esz = abi->dte_esz; 2072 int dte_esz = abi->dte_esz;
2053 u64 baser;
2054 2073
2055 baser = its->baser_device_table; 2074 if (!(baser & GITS_BASER_VALID))
2075 return 0;
2056 2076
2057 list_sort(NULL, &its->device_list, vgic_its_device_cmp); 2077 list_sort(NULL, &its->device_list, vgic_its_device_cmp);
2058 2078
@@ -2107,10 +2127,7 @@ static int handle_l1_dte(struct vgic_its *its, u32 id, void *addr,
2107 ret = scan_its_table(its, gpa, SZ_64K, dte_esz, 2127 ret = scan_its_table(its, gpa, SZ_64K, dte_esz,
2108 l2_start_id, vgic_its_restore_dte, NULL); 2128 l2_start_id, vgic_its_restore_dte, NULL);
2109 2129
2110 if (ret <= 0) 2130 return ret;
2111 return ret;
2112
2113 return 1;
2114} 2131}
2115 2132
2116/** 2133/**
@@ -2140,8 +2157,9 @@ static int vgic_its_restore_device_tables(struct vgic_its *its)
2140 vgic_its_restore_dte, NULL); 2157 vgic_its_restore_dte, NULL);
2141 } 2158 }
2142 2159
2160 /* scan_its_table returns +1 if all entries are invalid */
2143 if (ret > 0) 2161 if (ret > 0)
2144 ret = -EINVAL; 2162 ret = 0;
2145 2163
2146 return ret; 2164 return ret;
2147} 2165}
@@ -2198,17 +2216,17 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz)
2198static int vgic_its_save_collection_table(struct vgic_its *its) 2216static int vgic_its_save_collection_table(struct vgic_its *its)
2199{ 2217{
2200 const struct vgic_its_abi *abi = vgic_its_get_abi(its); 2218 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2219 u64 baser = its->baser_coll_table;
2220 gpa_t gpa = BASER_ADDRESS(baser);
2201 struct its_collection *collection; 2221 struct its_collection *collection;
2202 u64 val; 2222 u64 val;
2203 gpa_t gpa;
2204 size_t max_size, filled = 0; 2223 size_t max_size, filled = 0;
2205 int ret, cte_esz = abi->cte_esz; 2224 int ret, cte_esz = abi->cte_esz;
2206 2225
2207 gpa = BASER_ADDRESS(its->baser_coll_table); 2226 if (!(baser & GITS_BASER_VALID))
2208 if (!gpa)
2209 return 0; 2227 return 0;
2210 2228
2211 max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K; 2229 max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
2212 2230
2213 list_for_each_entry(collection, &its->collection_list, coll_list) { 2231 list_for_each_entry(collection, &its->collection_list, coll_list) {
2214 ret = vgic_its_save_cte(its, collection, gpa, cte_esz); 2232 ret = vgic_its_save_cte(its, collection, gpa, cte_esz);
@@ -2239,17 +2257,18 @@ static int vgic_its_save_collection_table(struct vgic_its *its)
2239static int vgic_its_restore_collection_table(struct vgic_its *its) 2257static int vgic_its_restore_collection_table(struct vgic_its *its)
2240{ 2258{
2241 const struct vgic_its_abi *abi = vgic_its_get_abi(its); 2259 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2260 u64 baser = its->baser_coll_table;
2242 int cte_esz = abi->cte_esz; 2261 int cte_esz = abi->cte_esz;
2243 size_t max_size, read = 0; 2262 size_t max_size, read = 0;
2244 gpa_t gpa; 2263 gpa_t gpa;
2245 int ret; 2264 int ret;
2246 2265
2247 if (!(its->baser_coll_table & GITS_BASER_VALID)) 2266 if (!(baser & GITS_BASER_VALID))
2248 return 0; 2267 return 0;
2249 2268
2250 gpa = BASER_ADDRESS(its->baser_coll_table); 2269 gpa = BASER_ADDRESS(baser);
2251 2270
2252 max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K; 2271 max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
2253 2272
2254 while (read < max_size) { 2273 while (read < max_size) {
2255 ret = vgic_its_restore_cte(its, gpa, cte_esz); 2274 ret = vgic_its_restore_cte(its, gpa, cte_esz);
@@ -2258,6 +2277,10 @@ static int vgic_its_restore_collection_table(struct vgic_its *its)
2258 gpa += cte_esz; 2277 gpa += cte_esz;
2259 read += cte_esz; 2278 read += cte_esz;
2260 } 2279 }
2280
2281 if (ret > 0)
2282 return 0;
2283
2261 return ret; 2284 return ret;
2262} 2285}
2263 2286