aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS20
-rw-r--r--Documentation/admin-guide/README.rst32
-rw-r--r--Documentation/process/applying-patches.rst117
-rw-r--r--Documentation/translations/it_IT/admin-guide/README.rst2
-rw-r--r--MAINTAINERS5
-rw-r--r--arch/arc/Kconfig20
-rw-r--r--arch/arc/configs/nps_defconfig1
-rw-r--r--arch/arc/configs/vdk_hs38_defconfig1
-rw-r--r--arch/arc/configs/vdk_hs38_smp_defconfig2
-rw-r--r--arch/arc/include/asm/arcregs.h8
-rw-r--r--arch/arc/include/asm/cache.h11
-rw-r--r--arch/arc/include/asm/entry-arcv2.h54
-rw-r--r--arch/arc/include/asm/uaccess.h8
-rw-r--r--arch/arc/kernel/entry-arcv2.S4
-rw-r--r--arch/arc/kernel/head.S16
-rw-r--r--arch/arc/kernel/intc-arcv2.c2
-rw-r--r--arch/arc/kernel/setup.c119
-rw-r--r--arch/arc/lib/memcpy-archs.S14
-rw-r--r--arch/arc/plat-hsdk/Kconfig1
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts2
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts4
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts46
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts13
-rw-r--r--arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts85
-rw-r--r--arch/arm/boot/dts/tegra124-nyan.dtsi17
-rw-r--r--arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts2
-rw-r--r--arch/arm64/include/asm/neon-intrinsics.h4
-rw-r--r--arch/arm64/kernel/head.S3
-rw-r--r--arch/arm64/kernel/ptrace.c15
-rw-r--r--arch/arm64/kernel/setup.c3
-rw-r--r--arch/arm64/mm/kasan_init.c2
-rw-r--r--arch/parisc/kernel/ptrace.c29
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c2
-rw-r--r--arch/powerpc/platforms/powernv/pci.c2
-rw-r--r--arch/sh/boot/dts/Makefile2
-rw-r--r--drivers/base/power/runtime.c2
-rw-r--r--drivers/clk/at91/at91sam9x5.c5
-rw-r--r--drivers/clk/at91/sama5d2.c4
-rw-r--r--drivers/clk/at91/sama5d4.c2
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun6i-a31.c4
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun8i-v3s.c2
-rw-r--r--drivers/cpufreq/scmi-cpufreq.c2
-rw-r--r--drivers/gpio/gpio-mt7621.c20
-rw-r--r--drivers/gpio/gpio-pxa.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c4
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c5
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c11
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h4
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c19
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c4
-rw-r--r--drivers/gpu/drm/i915/intel_fbdev.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c1
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c15
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c10
-rw-r--r--drivers/mtd/devices/powernv_flash.c2
-rw-r--r--drivers/mtd/mtdcore.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h1
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson8b.c2
-rw-r--r--drivers/pinctrl/qcom/pinctrl-qcs404.c2
-rw-r--r--drivers/scsi/libiscsi.c6
-rw-r--r--drivers/scsi/libsas/sas_expander.c2
-rw-r--r--drivers/scsi/scsi_lib.c1
-rw-r--r--drivers/scsi/sd_zbc.c8
-rw-r--r--fs/ceph/snap.c3
-rw-r--r--fs/nfs/nfs4idmap.c31
-rw-r--r--fs/proc/base.c4
-rw-r--r--include/keys/request_key_auth-type.h36
-rw-r--r--include/keys/user-type.h2
-rw-r--r--include/linux/key-type.h22
-rw-r--r--init/initramfs.c6
-rw-r--r--kernel/sched/psi.c2
-rw-r--r--lib/assoc_array.c8
-rw-r--r--mm/debug.c4
-rw-r--r--mm/kasan/Makefile2
-rw-r--r--mm/kasan/common.c29
-rw-r--r--mm/kasan/tags.c2
-rw-r--r--mm/kmemleak.c10
-rw-r--r--mm/memory_hotplug.c27
-rw-r--r--mm/mempolicy.c6
-rw-r--r--mm/page_alloc.c12
-rw-r--r--mm/shmem.c10
-rw-r--r--mm/slab.c15
-rw-r--r--mm/slab.h7
-rw-r--r--mm/slab_common.c3
-rw-r--r--mm/slub.c59
-rw-r--r--mm/swap.c17
-rw-r--r--mm/util.c2
-rw-r--r--net/ceph/messenger.c15
-rw-r--r--scripts/kallsyms.c4
-rw-r--r--security/keys/internal.h13
-rw-r--r--security/keys/key.c5
-rw-r--r--security/keys/keyctl.c1
-rw-r--r--security/keys/keyring.c4
-rw-r--r--security/keys/proc.c3
-rw-r--r--security/keys/process_keys.c1
-rw-r--r--security/keys/request_key.c73
-rw-r--r--security/keys/request_key_auth.c18
-rw-r--r--sound/pci/hda/patch_realtek.c42
-rw-r--r--sound/soc/generic/simple-card.c2
-rw-r--r--sound/soc/samsung/i2s.c8
-rw-r--r--sound/soc/soc-topology.c8
105 files changed, 835 insertions, 507 deletions
diff --git a/CREDITS b/CREDITS
index e818eb6a3e71..0175098d4776 100644
--- a/CREDITS
+++ b/CREDITS
@@ -842,10 +842,9 @@ D: ax25-utils maintainer.
842 842
843N: Helge Deller 843N: Helge Deller
844E: deller@gmx.de 844E: deller@gmx.de
845E: hdeller@redhat.de 845W: http://www.parisc-linux.org/
846D: PA-RISC Linux hacker, LASI-, ASP-, WAX-, LCD/LED-driver 846D: PA-RISC Linux architecture maintainer
847S: Schimmelsrain 1 847D: LASI-, ASP-, WAX-, LCD/LED-driver
848S: D-69231 Rauenberg
849S: Germany 848S: Germany
850 849
851N: Jean Delvare 850N: Jean Delvare
@@ -1361,7 +1360,7 @@ S: Stellenbosch, Western Cape
1361S: South Africa 1360S: South Africa
1362 1361
1363N: Grant Grundler 1362N: Grant Grundler
1364E: grundler@parisc-linux.org 1363E: grantgrundler@gmail.com
1365W: http://obmouse.sourceforge.net/ 1364W: http://obmouse.sourceforge.net/
1366W: http://www.parisc-linux.org/ 1365W: http://www.parisc-linux.org/
1367D: obmouse - rewrote Olivier Florent's Omnibook 600 "pop-up" mouse driver 1366D: obmouse - rewrote Olivier Florent's Omnibook 600 "pop-up" mouse driver
@@ -2492,7 +2491,7 @@ S: Syracuse, New York 13206
2492S: USA 2491S: USA
2493 2492
2494N: Kyle McMartin 2493N: Kyle McMartin
2495E: kyle@parisc-linux.org 2494E: kyle@mcmartin.ca
2496D: Linux/PARISC hacker 2495D: Linux/PARISC hacker
2497D: AD1889 sound driver 2496D: AD1889 sound driver
2498S: Ottawa, Canada 2497S: Ottawa, Canada
@@ -3780,14 +3779,13 @@ S: 21513 Conradia Ct
3780S: Cupertino, CA 95014 3779S: Cupertino, CA 95014
3781S: USA 3780S: USA
3782 3781
3783N: Thibaut Varene 3782N: Thibaut Varène
3784E: T-Bone@parisc-linux.org 3783E: hacks+kernel@slashdirt.org
3785W: http://www.parisc-linux.org/~varenet/ 3784W: http://hacks.slashdirt.org/
3786P: 1024D/B7D2F063 E67C 0D43 A75E 12A5 BB1C FA2F 1E32 C3DA B7D2 F063
3787D: PA-RISC port minion, PDC and GSCPS2 drivers, debuglocks and other bits 3785D: PA-RISC port minion, PDC and GSCPS2 drivers, debuglocks and other bits
3788D: Some ARM at91rm9200 bits, S1D13XXX FB driver, random patches here and there 3786D: Some ARM at91rm9200 bits, S1D13XXX FB driver, random patches here and there
3789D: AD1889 sound driver 3787D: AD1889 sound driver
3790S: Paris, France 3788S: France
3791 3789
3792N: Heikki Vatiainen 3790N: Heikki Vatiainen
3793E: hessu@cs.tut.fi 3791E: hessu@cs.tut.fi
diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index 0797eec76be1..47e577264198 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -1,9 +1,9 @@
1.. _readme: 1.. _readme:
2 2
3Linux kernel release 4.x <http://kernel.org/> 3Linux kernel release 5.x <http://kernel.org/>
4============================================= 4=============================================
5 5
6These are the release notes for Linux version 4. Read them carefully, 6These are the release notes for Linux version 5. Read them carefully,
7as they tell you what this is all about, explain how to install the 7as they tell you what this is all about, explain how to install the
8kernel, and what to do if something goes wrong. 8kernel, and what to do if something goes wrong.
9 9
@@ -63,7 +63,7 @@ Installing the kernel source
63 directory where you have permissions (e.g. your home directory) and 63 directory where you have permissions (e.g. your home directory) and
64 unpack it:: 64 unpack it::
65 65
66 xz -cd linux-4.X.tar.xz | tar xvf - 66 xz -cd linux-5.x.tar.xz | tar xvf -
67 67
68 Replace "X" with the version number of the latest kernel. 68 Replace "X" with the version number of the latest kernel.
69 69
@@ -72,26 +72,26 @@ Installing the kernel source
72 files. They should match the library, and not get messed up by 72 files. They should match the library, and not get messed up by
73 whatever the kernel-du-jour happens to be. 73 whatever the kernel-du-jour happens to be.
74 74
75 - You can also upgrade between 4.x releases by patching. Patches are 75 - You can also upgrade between 5.x releases by patching. Patches are
76 distributed in the xz format. To install by patching, get all the 76 distributed in the xz format. To install by patching, get all the
77 newer patch files, enter the top level directory of the kernel source 77 newer patch files, enter the top level directory of the kernel source
78 (linux-4.X) and execute:: 78 (linux-5.x) and execute::
79 79
80 xz -cd ../patch-4.x.xz | patch -p1 80 xz -cd ../patch-5.x.xz | patch -p1
81 81
82 Replace "x" for all versions bigger than the version "X" of your current 82 Replace "x" for all versions bigger than the version "x" of your current
83 source tree, **in_order**, and you should be ok. You may want to remove 83 source tree, **in_order**, and you should be ok. You may want to remove
84 the backup files (some-file-name~ or some-file-name.orig), and make sure 84 the backup files (some-file-name~ or some-file-name.orig), and make sure
85 that there are no failed patches (some-file-name# or some-file-name.rej). 85 that there are no failed patches (some-file-name# or some-file-name.rej).
86 If there are, either you or I have made a mistake. 86 If there are, either you or I have made a mistake.
87 87
88 Unlike patches for the 4.x kernels, patches for the 4.x.y kernels 88 Unlike patches for the 5.x kernels, patches for the 5.x.y kernels
89 (also known as the -stable kernels) are not incremental but instead apply 89 (also known as the -stable kernels) are not incremental but instead apply
90 directly to the base 4.x kernel. For example, if your base kernel is 4.0 90 directly to the base 5.x kernel. For example, if your base kernel is 5.0
91 and you want to apply the 4.0.3 patch, you must not first apply the 4.0.1 91 and you want to apply the 5.0.3 patch, you must not first apply the 5.0.1
92 and 4.0.2 patches. Similarly, if you are running kernel version 4.0.2 and 92 and 5.0.2 patches. Similarly, if you are running kernel version 5.0.2 and
93 want to jump to 4.0.3, you must first reverse the 4.0.2 patch (that is, 93 want to jump to 5.0.3, you must first reverse the 5.0.2 patch (that is,
94 patch -R) **before** applying the 4.0.3 patch. You can read more on this in 94 patch -R) **before** applying the 5.0.3 patch. You can read more on this in
95 :ref:`Documentation/process/applying-patches.rst <applying_patches>`. 95 :ref:`Documentation/process/applying-patches.rst <applying_patches>`.
96 96
97 Alternatively, the script patch-kernel can be used to automate this 97 Alternatively, the script patch-kernel can be used to automate this
@@ -114,7 +114,7 @@ Installing the kernel source
114Software requirements 114Software requirements
115--------------------- 115---------------------
116 116
117 Compiling and running the 4.x kernels requires up-to-date 117 Compiling and running the 5.x kernels requires up-to-date
118 versions of various software packages. Consult 118 versions of various software packages. Consult
119 :ref:`Documentation/process/changes.rst <changes>` for the minimum version numbers 119 :ref:`Documentation/process/changes.rst <changes>` for the minimum version numbers
120 required and how to get updates for these packages. Beware that using 120 required and how to get updates for these packages. Beware that using
@@ -132,12 +132,12 @@ Build directory for the kernel
132 place for the output files (including .config). 132 place for the output files (including .config).
133 Example:: 133 Example::
134 134
135 kernel source code: /usr/src/linux-4.X 135 kernel source code: /usr/src/linux-5.x
136 build directory: /home/name/build/kernel 136 build directory: /home/name/build/kernel
137 137
138 To configure and build the kernel, use:: 138 To configure and build the kernel, use::
139 139
140 cd /usr/src/linux-4.X 140 cd /usr/src/linux-5.x
141 make O=/home/name/build/kernel menuconfig 141 make O=/home/name/build/kernel menuconfig
142 make O=/home/name/build/kernel 142 make O=/home/name/build/kernel
143 sudo make O=/home/name/build/kernel modules_install install 143 sudo make O=/home/name/build/kernel modules_install install
diff --git a/Documentation/process/applying-patches.rst b/Documentation/process/applying-patches.rst
index dc2ddc345044..fbb9297e6360 100644
--- a/Documentation/process/applying-patches.rst
+++ b/Documentation/process/applying-patches.rst
@@ -216,14 +216,14 @@ You can use the ``interdiff`` program (http://cyberelk.net/tim/patchutils/) to
216generate a patch representing the differences between two patches and then 216generate a patch representing the differences between two patches and then
217apply the result. 217apply the result.
218 218
219This will let you move from something like 4.7.2 to 4.7.3 in a single 219This will let you move from something like 5.7.2 to 5.7.3 in a single
220step. The -z flag to interdiff will even let you feed it patches in gzip or 220step. The -z flag to interdiff will even let you feed it patches in gzip or
221bzip2 compressed form directly without the use of zcat or bzcat or manual 221bzip2 compressed form directly without the use of zcat or bzcat or manual
222decompression. 222decompression.
223 223
224Here's how you'd go from 4.7.2 to 4.7.3 in a single step:: 224Here's how you'd go from 5.7.2 to 5.7.3 in a single step::
225 225
226 interdiff -z ../patch-4.7.2.gz ../patch-4.7.3.gz | patch -p1 226 interdiff -z ../patch-5.7.2.gz ../patch-5.7.3.gz | patch -p1
227 227
228Although interdiff may save you a step or two you are generally advised to 228Although interdiff may save you a step or two you are generally advised to
229do the additional steps since interdiff can get things wrong in some cases. 229do the additional steps since interdiff can get things wrong in some cases.
@@ -245,62 +245,67 @@ The patches are available at http://kernel.org/
245Most recent patches are linked from the front page, but they also have 245Most recent patches are linked from the front page, but they also have
246specific homes. 246specific homes.
247 247
248The 4.x.y (-stable) and 4.x patches live at 248The 5.x.y (-stable) and 5.x patches live at
249 249
250 https://www.kernel.org/pub/linux/kernel/v4.x/ 250 https://www.kernel.org/pub/linux/kernel/v5.x/
251 251
252The -rc patches live at 252The -rc patches are not stored on the webserver but are generated on
253demand from git tags such as
253 254
254 https://www.kernel.org/pub/linux/kernel/v4.x/testing/ 255 https://git.kernel.org/torvalds/p/v5.1-rc1/v5.0
255 256
257The stable -rc patches live at
256 258
257The 4.x kernels 259 https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/
260
261
262The 5.x kernels
258=============== 263===============
259 264
260These are the base stable releases released by Linus. The highest numbered 265These are the base stable releases released by Linus. The highest numbered
261release is the most recent. 266release is the most recent.
262 267
263If regressions or other serious flaws are found, then a -stable fix patch 268If regressions or other serious flaws are found, then a -stable fix patch
264will be released (see below) on top of this base. Once a new 4.x base 269will be released (see below) on top of this base. Once a new 5.x base
265kernel is released, a patch is made available that is a delta between the 270kernel is released, a patch is made available that is a delta between the
266previous 4.x kernel and the new one. 271previous 5.x kernel and the new one.
267 272
268To apply a patch moving from 4.6 to 4.7, you'd do the following (note 273To apply a patch moving from 5.6 to 5.7, you'd do the following (note
269that such patches do **NOT** apply on top of 4.x.y kernels but on top of the 274that such patches do **NOT** apply on top of 5.x.y kernels but on top of the
270base 4.x kernel -- if you need to move from 4.x.y to 4.x+1 you need to 275base 5.x kernel -- if you need to move from 5.x.y to 5.x+1 you need to
271first revert the 4.x.y patch). 276first revert the 5.x.y patch).
272 277
273Here are some examples:: 278Here are some examples::
274 279
275 # moving from 4.6 to 4.7 280 # moving from 5.6 to 5.7
276 281
277 $ cd ~/linux-4.6 # change to kernel source dir 282 $ cd ~/linux-5.6 # change to kernel source dir
278 $ patch -p1 < ../patch-4.7 # apply the 4.7 patch 283 $ patch -p1 < ../patch-5.7 # apply the 5.7 patch
279 $ cd .. 284 $ cd ..
280 $ mv linux-4.6 linux-4.7 # rename source dir 285 $ mv linux-5.6 linux-5.7 # rename source dir
281 286
282 # moving from 4.6.1 to 4.7 287 # moving from 5.6.1 to 5.7
283 288
284 $ cd ~/linux-4.6.1 # change to kernel source dir 289 $ cd ~/linux-5.6.1 # change to kernel source dir
285 $ patch -p1 -R < ../patch-4.6.1 # revert the 4.6.1 patch 290 $ patch -p1 -R < ../patch-5.6.1 # revert the 5.6.1 patch
286 # source dir is now 4.6 291 # source dir is now 5.6
287 $ patch -p1 < ../patch-4.7 # apply new 4.7 patch 292 $ patch -p1 < ../patch-5.7 # apply new 5.7 patch
288 $ cd .. 293 $ cd ..
289 $ mv linux-4.6.1 linux-4.7 # rename source dir 294 $ mv linux-5.6.1 linux-5.7 # rename source dir
290 295
291 296
292The 4.x.y kernels 297The 5.x.y kernels
293================= 298=================
294 299
295Kernels with 3-digit versions are -stable kernels. They contain small(ish) 300Kernels with 3-digit versions are -stable kernels. They contain small(ish)
296critical fixes for security problems or significant regressions discovered 301critical fixes for security problems or significant regressions discovered
297in a given 4.x kernel. 302in a given 5.x kernel.
298 303
299This is the recommended branch for users who want the most recent stable 304This is the recommended branch for users who want the most recent stable
300kernel and are not interested in helping test development/experimental 305kernel and are not interested in helping test development/experimental
301versions. 306versions.
302 307
303If no 4.x.y kernel is available, then the highest numbered 4.x kernel is 308If no 5.x.y kernel is available, then the highest numbered 5.x kernel is
304the current stable kernel. 309the current stable kernel.
305 310
306.. note:: 311.. note::
@@ -308,23 +313,23 @@ the current stable kernel.
308 The -stable team usually do make incremental patches available as well 313 The -stable team usually do make incremental patches available as well
309 as patches against the latest mainline release, but I only cover the 314 as patches against the latest mainline release, but I only cover the
310 non-incremental ones below. The incremental ones can be found at 315 non-incremental ones below. The incremental ones can be found at
311 https://www.kernel.org/pub/linux/kernel/v4.x/incr/ 316 https://www.kernel.org/pub/linux/kernel/v5.x/incr/
312 317
313These patches are not incremental, meaning that for example the 4.7.3 318These patches are not incremental, meaning that for example the 5.7.3
314patch does not apply on top of the 4.7.2 kernel source, but rather on top 319patch does not apply on top of the 5.7.2 kernel source, but rather on top
315of the base 4.7 kernel source. 320of the base 5.7 kernel source.
316 321
317So, in order to apply the 4.7.3 patch to your existing 4.7.2 kernel 322So, in order to apply the 5.7.3 patch to your existing 5.7.2 kernel
318source you have to first back out the 4.7.2 patch (so you are left with a 323source you have to first back out the 5.7.2 patch (so you are left with a
319base 4.7 kernel source) and then apply the new 4.7.3 patch. 324base 5.7 kernel source) and then apply the new 5.7.3 patch.
320 325
321Here's a small example:: 326Here's a small example::
322 327
323 $ cd ~/linux-4.7.2 # change to the kernel source dir 328 $ cd ~/linux-5.7.2 # change to the kernel source dir
324 $ patch -p1 -R < ../patch-4.7.2 # revert the 4.7.2 patch 329 $ patch -p1 -R < ../patch-5.7.2 # revert the 5.7.2 patch
325 $ patch -p1 < ../patch-4.7.3 # apply the new 4.7.3 patch 330 $ patch -p1 < ../patch-5.7.3 # apply the new 5.7.3 patch
326 $ cd .. 331 $ cd ..
327 $ mv linux-4.7.2 linux-4.7.3 # rename the kernel source dir 332 $ mv linux-5.7.2 linux-5.7.3 # rename the kernel source dir
328 333
329The -rc kernels 334The -rc kernels
330=============== 335===============
@@ -343,38 +348,38 @@ This is a good branch to run for people who want to help out testing
343development kernels but do not want to run some of the really experimental 348development kernels but do not want to run some of the really experimental
344stuff (such people should see the sections about -next and -mm kernels below). 349stuff (such people should see the sections about -next and -mm kernels below).
345 350
346The -rc patches are not incremental, they apply to a base 4.x kernel, just 351The -rc patches are not incremental, they apply to a base 5.x kernel, just
347like the 4.x.y patches described above. The kernel version before the -rcN 352like the 5.x.y patches described above. The kernel version before the -rcN
348suffix denotes the version of the kernel that this -rc kernel will eventually 353suffix denotes the version of the kernel that this -rc kernel will eventually
349turn into. 354turn into.
350 355
351So, 4.8-rc5 means that this is the fifth release candidate for the 4.8 356So, 5.8-rc5 means that this is the fifth release candidate for the 5.8
352kernel and the patch should be applied on top of the 4.7 kernel source. 357kernel and the patch should be applied on top of the 5.7 kernel source.
353 358
354Here are 3 examples of how to apply these patches:: 359Here are 3 examples of how to apply these patches::
355 360
356 # first an example of moving from 4.7 to 4.8-rc3 361 # first an example of moving from 5.7 to 5.8-rc3
357 362
358 $ cd ~/linux-4.7 # change to the 4.7 source dir 363 $ cd ~/linux-5.7 # change to the 5.7 source dir
359 $ patch -p1 < ../patch-4.8-rc3 # apply the 4.8-rc3 patch 364 $ patch -p1 < ../patch-5.8-rc3 # apply the 5.8-rc3 patch
360 $ cd .. 365 $ cd ..
361 $ mv linux-4.7 linux-4.8-rc3 # rename the source dir 366 $ mv linux-5.7 linux-5.8-rc3 # rename the source dir
362 367
363 # now let's move from 4.8-rc3 to 4.8-rc5 368 # now let's move from 5.8-rc3 to 5.8-rc5
364 369
365 $ cd ~/linux-4.8-rc3 # change to the 4.8-rc3 dir 370 $ cd ~/linux-5.8-rc3 # change to the 5.8-rc3 dir
366 $ patch -p1 -R < ../patch-4.8-rc3 # revert the 4.8-rc3 patch 371 $ patch -p1 -R < ../patch-5.8-rc3 # revert the 5.8-rc3 patch
367 $ patch -p1 < ../patch-4.8-rc5 # apply the new 4.8-rc5 patch 372 $ patch -p1 < ../patch-5.8-rc5 # apply the new 5.8-rc5 patch
368 $ cd .. 373 $ cd ..
369 $ mv linux-4.8-rc3 linux-4.8-rc5 # rename the source dir 374 $ mv linux-5.8-rc3 linux-5.8-rc5 # rename the source dir
370 375
371 # finally let's try and move from 4.7.3 to 4.8-rc5 376 # finally let's try and move from 5.7.3 to 5.8-rc5
372 377
373 $ cd ~/linux-4.7.3 # change to the kernel source dir 378 $ cd ~/linux-5.7.3 # change to the kernel source dir
374 $ patch -p1 -R < ../patch-4.7.3 # revert the 4.7.3 patch 379 $ patch -p1 -R < ../patch-5.7.3 # revert the 5.7.3 patch
375 $ patch -p1 < ../patch-4.8-rc5 # apply new 4.8-rc5 patch 380 $ patch -p1 < ../patch-5.8-rc5 # apply new 5.8-rc5 patch
376 $ cd .. 381 $ cd ..
377 $ mv linux-4.7.3 linux-4.8-rc5 # rename the kernel source dir 382 $ mv linux-5.7.3 linux-5.8-rc5 # rename the kernel source dir
378 383
379 384
380The -mm patches and the linux-next tree 385The -mm patches and the linux-next tree
diff --git a/Documentation/translations/it_IT/admin-guide/README.rst b/Documentation/translations/it_IT/admin-guide/README.rst
index 80f5ffc94a9e..b37166817842 100644
--- a/Documentation/translations/it_IT/admin-guide/README.rst
+++ b/Documentation/translations/it_IT/admin-guide/README.rst
@@ -4,7 +4,7 @@
4 4
5.. _it_readme: 5.. _it_readme:
6 6
7Rilascio del kernel Linux 4.x <http://kernel.org/> 7Rilascio del kernel Linux 5.x <http://kernel.org/>
8=================================================== 8===================================================
9 9
10.. warning:: 10.. warning::
diff --git a/MAINTAINERS b/MAINTAINERS
index 65eb7207fcc3..dce5c099f43c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -409,8 +409,7 @@ F: drivers/platform/x86/wmi.c
409F: include/uapi/linux/wmi.h 409F: include/uapi/linux/wmi.h
410 410
411AD1889 ALSA SOUND DRIVER 411AD1889 ALSA SOUND DRIVER
412M: Thibaut Varene <T-Bone@parisc-linux.org> 412W: https://parisc.wiki.kernel.org/index.php/AD1889
413W: http://wiki.parisc-linux.org/AD1889
414L: linux-parisc@vger.kernel.org 413L: linux-parisc@vger.kernel.org
415S: Maintained 414S: Maintained
416F: sound/pci/ad1889.* 415F: sound/pci/ad1889.*
@@ -11497,7 +11496,7 @@ F: Documentation/blockdev/paride.txt
11497F: drivers/block/paride/ 11496F: drivers/block/paride/
11498 11497
11499PARISC ARCHITECTURE 11498PARISC ARCHITECTURE
11500M: "James E.J. Bottomley" <jejb@parisc-linux.org> 11499M: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
11501M: Helge Deller <deller@gmx.de> 11500M: Helge Deller <deller@gmx.de>
11502L: linux-parisc@vger.kernel.org 11501L: linux-parisc@vger.kernel.org
11503W: http://www.parisc-linux.org/ 11502W: http://www.parisc-linux.org/
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 376366a7db81..d750b302d5ab 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -191,7 +191,6 @@ config NR_CPUS
191 191
192config ARC_SMP_HALT_ON_RESET 192config ARC_SMP_HALT_ON_RESET
193 bool "Enable Halt-on-reset boot mode" 193 bool "Enable Halt-on-reset boot mode"
194 default y if ARC_UBOOT_SUPPORT
195 help 194 help
196 In SMP configuration cores can be configured as Halt-on-reset 195 In SMP configuration cores can be configured as Halt-on-reset
197 or they could all start at same time. For Halt-on-reset, non 196 or they could all start at same time. For Halt-on-reset, non
@@ -407,6 +406,14 @@ config ARC_HAS_ACCL_REGS
407 (also referred to as r58:r59). These can also be used by gcc as GPR so 406 (also referred to as r58:r59). These can also be used by gcc as GPR so
408 kernel needs to save/restore per process 407 kernel needs to save/restore per process
409 408
409config ARC_IRQ_NO_AUTOSAVE
410 bool "Disable hardware autosave regfile on interrupts"
411 default n
412 help
413 On HS cores, taken interrupt auto saves the regfile on stack.
414 This is programmable and can be optionally disabled in which case
415 software INTERRUPT_PROLOGUE/EPILGUE do the needed work
416
410endif # ISA_ARCV2 417endif # ISA_ARCV2
411 418
412endmenu # "ARC CPU Configuration" 419endmenu # "ARC CPU Configuration"
@@ -515,17 +522,6 @@ config ARC_DBG_TLB_PARANOIA
515 522
516endif 523endif
517 524
518config ARC_UBOOT_SUPPORT
519 bool "Support uboot arg Handling"
520 help
521 ARC Linux by default checks for uboot provided args as pointers to
522 external cmdline or DTB. This however breaks in absence of uboot,
523 when booting from Metaware debugger directly, as the registers are
524 not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus
525 registers look like uboot args to kernel which then chokes.
526 So only enable the uboot arg checking/processing if users are sure
527 of uboot being in play.
528
529config ARC_BUILTIN_DTB_NAME 525config ARC_BUILTIN_DTB_NAME
530 string "Built in DTB" 526 string "Built in DTB"
531 help 527 help
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig
index 6e84060e7c90..621f59407d76 100644
--- a/arch/arc/configs/nps_defconfig
+++ b/arch/arc/configs/nps_defconfig
@@ -31,7 +31,6 @@ CONFIG_ARC_CACHE_LINE_SHIFT=5
31# CONFIG_ARC_HAS_LLSC is not set 31# CONFIG_ARC_HAS_LLSC is not set
32CONFIG_ARC_KVADDR_SIZE=402 32CONFIG_ARC_KVADDR_SIZE=402
33CONFIG_ARC_EMUL_UNALIGNED=y 33CONFIG_ARC_EMUL_UNALIGNED=y
34CONFIG_ARC_UBOOT_SUPPORT=y
35CONFIG_PREEMPT=y 34CONFIG_PREEMPT=y
36CONFIG_NET=y 35CONFIG_NET=y
37CONFIG_UNIX=y 36CONFIG_UNIX=y
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig
index 1e59a2e9c602..e447ace6fa1c 100644
--- a/arch/arc/configs/vdk_hs38_defconfig
+++ b/arch/arc/configs/vdk_hs38_defconfig
@@ -13,7 +13,6 @@ CONFIG_PARTITION_ADVANCED=y
13CONFIG_ARC_PLAT_AXS10X=y 13CONFIG_ARC_PLAT_AXS10X=y
14CONFIG_AXS103=y 14CONFIG_AXS103=y
15CONFIG_ISA_ARCV2=y 15CONFIG_ISA_ARCV2=y
16CONFIG_ARC_UBOOT_SUPPORT=y
17CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" 16CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38"
18CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
19CONFIG_NET=y 18CONFIG_NET=y
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig
index b5c3f6c54b03..c82cdb10aaf4 100644
--- a/arch/arc/configs/vdk_hs38_smp_defconfig
+++ b/arch/arc/configs/vdk_hs38_smp_defconfig
@@ -15,8 +15,6 @@ CONFIG_AXS103=y
15CONFIG_ISA_ARCV2=y 15CONFIG_ISA_ARCV2=y
16CONFIG_SMP=y 16CONFIG_SMP=y
17# CONFIG_ARC_TIMERS_64BIT is not set 17# CONFIG_ARC_TIMERS_64BIT is not set
18# CONFIG_ARC_SMP_HALT_ON_RESET is not set
19CONFIG_ARC_UBOOT_SUPPORT=y
20CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" 18CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp"
21CONFIG_PREEMPT=y 19CONFIG_PREEMPT=y
22CONFIG_NET=y 20CONFIG_NET=y
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index f1b86cef0905..a27eafdc8260 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -151,6 +151,14 @@ struct bcr_isa_arcv2 {
151#endif 151#endif
152}; 152};
153 153
154struct bcr_uarch_build_arcv2 {
155#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, prod:8, maj:8, min:8;
157#else
158 unsigned int min:8, maj:8, prod:8, pad:8;
159#endif
160};
161
154struct bcr_mpy { 162struct bcr_mpy {
155#ifdef CONFIG_CPU_BIG_ENDIAN 163#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; 164 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8;
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index f393b663413e..2ad77fb43639 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -52,6 +52,17 @@
52#define cache_line_size() SMP_CACHE_BYTES 52#define cache_line_size() SMP_CACHE_BYTES
53#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES 53#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES
54 54
55/*
56 * Make sure slab-allocated buffers are 64-bit aligned when atomic64_t uses
57 * ARCv2 64-bit atomics (LLOCKD/SCONDD). This guarantess runtime 64-bit
58 * alignment for any atomic64_t embedded in buffer.
59 * Default ARCH_SLAB_MINALIGN is __alignof__(long long) which has a relaxed
60 * value of 4 (and not 8) in ARC ABI.
61 */
62#if defined(CONFIG_ARC_HAS_LL64) && defined(CONFIG_ARC_HAS_LLSC)
63#define ARCH_SLAB_MINALIGN 8
64#endif
65
55extern void arc_cache_init(void); 66extern void arc_cache_init(void);
56extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 67extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
57extern void read_decode_cache_bcr(void); 68extern void read_decode_cache_bcr(void);
diff --git a/arch/arc/include/asm/entry-arcv2.h b/arch/arc/include/asm/entry-arcv2.h
index 309f4e6721b3..225e7df2d8ed 100644
--- a/arch/arc/include/asm/entry-arcv2.h
+++ b/arch/arc/include/asm/entry-arcv2.h
@@ -17,6 +17,33 @@
17 ; 17 ;
18 ; Now manually save: r12, sp, fp, gp, r25 18 ; Now manually save: r12, sp, fp, gp, r25
19 19
20#ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE
21.ifnc \called_from, exception
22 st.as r9, [sp, -10] ; save r9 in it's final stack slot
23 sub sp, sp, 12 ; skip JLI, LDI, EI
24
25 PUSH lp_count
26 PUSHAX lp_start
27 PUSHAX lp_end
28 PUSH blink
29
30 PUSH r11
31 PUSH r10
32
33 sub sp, sp, 4 ; skip r9
34
35 PUSH r8
36 PUSH r7
37 PUSH r6
38 PUSH r5
39 PUSH r4
40 PUSH r3
41 PUSH r2
42 PUSH r1
43 PUSH r0
44.endif
45#endif
46
20#ifdef CONFIG_ARC_HAS_ACCL_REGS 47#ifdef CONFIG_ARC_HAS_ACCL_REGS
21 PUSH r59 48 PUSH r59
22 PUSH r58 49 PUSH r58
@@ -86,6 +113,33 @@
86 POP r59 113 POP r59
87#endif 114#endif
88 115
116#ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE
117.ifnc \called_from, exception
118 POP r0
119 POP r1
120 POP r2
121 POP r3
122 POP r4
123 POP r5
124 POP r6
125 POP r7
126 POP r8
127 POP r9
128 POP r10
129 POP r11
130
131 POP blink
132 POPAX lp_end
133 POPAX lp_start
134
135 POP r9
136 mov lp_count, r9
137
138 add sp, sp, 12 ; skip JLI, LDI, EI
139 ld.as r9, [sp, -10] ; reload r9 which got clobbered
140.endif
141#endif
142
89.endm 143.endm
90 144
91/*------------------------------------------------------------------------*/ 145/*------------------------------------------------------------------------*/
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index c9173c02081c..eabc3efa6c6d 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -207,7 +207,7 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
207 */ 207 */
208 "=&r" (tmp), "+r" (to), "+r" (from) 208 "=&r" (tmp), "+r" (to), "+r" (from)
209 : 209 :
210 : "lp_count", "lp_start", "lp_end", "memory"); 210 : "lp_count", "memory");
211 211
212 return n; 212 return n;
213 } 213 }
@@ -433,7 +433,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
433 */ 433 */
434 "=&r" (tmp), "+r" (to), "+r" (from) 434 "=&r" (tmp), "+r" (to), "+r" (from)
435 : 435 :
436 : "lp_count", "lp_start", "lp_end", "memory"); 436 : "lp_count", "memory");
437 437
438 return n; 438 return n;
439 } 439 }
@@ -653,7 +653,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n)
653 " .previous \n" 653 " .previous \n"
654 : "+r"(d_char), "+r"(res) 654 : "+r"(d_char), "+r"(res)
655 : "i"(0) 655 : "i"(0)
656 : "lp_count", "lp_start", "lp_end", "memory"); 656 : "lp_count", "memory");
657 657
658 return res; 658 return res;
659} 659}
@@ -686,7 +686,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count)
686 " .previous \n" 686 " .previous \n"
687 : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) 687 : "+r"(res), "+r"(dst), "+r"(src), "=r"(val)
688 : "g"(-EFAULT), "r"(count) 688 : "g"(-EFAULT), "r"(count)
689 : "lp_count", "lp_start", "lp_end", "memory"); 689 : "lp_count", "memory");
690 690
691 return res; 691 return res;
692} 692}
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S
index cc558a25b8fa..562089d62d9d 100644
--- a/arch/arc/kernel/entry-arcv2.S
+++ b/arch/arc/kernel/entry-arcv2.S
@@ -209,7 +209,9 @@ restore_regs:
209;####### Return from Intr ####### 209;####### Return from Intr #######
210 210
211debug_marker_l1: 211debug_marker_l1:
212 bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot 212 ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot
213 btst r0, STATUS_DE_BIT ; Z flag set if bit clear
214 bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set
213 215
214.Lisr_ret_fast_path: 216.Lisr_ret_fast_path:
215 ; Handle special case #1: (Entry via Exception, Return via IRQ) 217 ; Handle special case #1: (Entry via Exception, Return via IRQ)
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 8b90d25a15cc..30e090625916 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -17,6 +17,7 @@
17#include <asm/entry.h> 17#include <asm/entry.h>
18#include <asm/arcregs.h> 18#include <asm/arcregs.h>
19#include <asm/cache.h> 19#include <asm/cache.h>
20#include <asm/irqflags.h>
20 21
21.macro CPU_EARLY_SETUP 22.macro CPU_EARLY_SETUP
22 23
@@ -47,6 +48,15 @@
47 sr r5, [ARC_REG_DC_CTRL] 48 sr r5, [ARC_REG_DC_CTRL]
48 49
491: 501:
51
52#ifdef CONFIG_ISA_ARCV2
53 ; Unaligned access is disabled at reset, so re-enable early as
54 ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access
55 ; by default
56 lr r5, [status32]
57 bset r5, r5, STATUS_AD_BIT
58 kflag r5
59#endif
50.endm 60.endm
51 61
52 .section .init.text, "ax",@progbits 62 .section .init.text, "ax",@progbits
@@ -90,15 +100,13 @@ ENTRY(stext)
90 st.ab 0, [r5, 4] 100 st.ab 0, [r5, 4]
911: 1011:
92 102
93#ifdef CONFIG_ARC_UBOOT_SUPPORT
94 ; Uboot - kernel ABI 103 ; Uboot - kernel ABI
95 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 104 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
96 ; r1 = magic number (board identity, unused as of now 105 ; r1 = magic number (always zero as of now)
97 ; r2 = pointer to uboot provided cmdline or external DTB in mem 106 ; r2 = pointer to uboot provided cmdline or external DTB in mem
98 ; These are handled later in setup_arch() 107 ; These are handled later in handle_uboot_args()
99 st r0, [@uboot_tag] 108 st r0, [@uboot_tag]
100 st r2, [@uboot_arg] 109 st r2, [@uboot_arg]
101#endif
102 110
103 ; setup "current" tsk and optionally cache it in dedicated r25 111 ; setup "current" tsk and optionally cache it in dedicated r25
104 mov r9, @init_task 112 mov r9, @init_task
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
index 067ea362fb3e..cf18b3e5a934 100644
--- a/arch/arc/kernel/intc-arcv2.c
+++ b/arch/arc/kernel/intc-arcv2.c
@@ -49,11 +49,13 @@ void arc_init_IRQ(void)
49 49
50 *(unsigned int *)&ictrl = 0; 50 *(unsigned int *)&ictrl = 0;
51 51
52#ifndef CONFIG_ARC_IRQ_NO_AUTOSAVE
52 ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ 53 ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */
53 ictrl.save_blink = 1; 54 ictrl.save_blink = 1;
54 ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ 55 ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */
55 ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ 56 ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */
56 ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ 57 ictrl.save_idx_regs = 1; /* JLI, LDI, EI */
58#endif
57 59
58 WRITE_AUX(AUX_IRQ_CTRL, ictrl); 60 WRITE_AUX(AUX_IRQ_CTRL, ictrl);
59 61
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index feb90093e6b1..7b2340996cf8 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -199,20 +199,36 @@ static void read_arc_build_cfg_regs(void)
199 cpu->bpu.ret_stk = 4 << bpu.rse; 199 cpu->bpu.ret_stk = 4 << bpu.rse;
200 200
201 if (cpu->core.family >= 0x54) { 201 if (cpu->core.family >= 0x54) {
202 unsigned int exec_ctrl;
203 202
204 READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 203 struct bcr_uarch_build_arcv2 uarch;
205 cpu->extn.dual_enb = !(exec_ctrl & 1);
206 204
207 /* dual issue always present for this core */ 205 /*
208 cpu->extn.dual = 1; 206 * The first 0x54 core (uarch maj:min 0:1 or 0:2) was
207 * dual issue only (HS4x). But next uarch rev (1:0)
208 * allows it be configured for single issue (HS3x)
209 * Ensure we fiddle with dual issue only on HS4x
210 */
211 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
212
213 if (uarch.prod == 4) {
214 unsigned int exec_ctrl;
215
216 /* dual issue hardware always present */
217 cpu->extn.dual = 1;
218
219 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
220
221 /* dual issue hardware enabled ? */
222 cpu->extn.dual_enb = !(exec_ctrl & 1);
223
224 }
209 } 225 }
210 } 226 }
211 227
212 READ_BCR(ARC_REG_AP_BCR, ap); 228 READ_BCR(ARC_REG_AP_BCR, ap);
213 if (ap.ver) { 229 if (ap.ver) {
214 cpu->extn.ap_num = 2 << ap.num; 230 cpu->extn.ap_num = 2 << ap.num;
215 cpu->extn.ap_full = !!ap.min; 231 cpu->extn.ap_full = !ap.min;
216 } 232 }
217 233
218 READ_BCR(ARC_REG_SMART_BCR, bcr); 234 READ_BCR(ARC_REG_SMART_BCR, bcr);
@@ -462,43 +478,78 @@ void setup_processor(void)
462 arc_chk_core_config(); 478 arc_chk_core_config();
463} 479}
464 480
465static inline int is_kernel(unsigned long addr) 481static inline bool uboot_arg_invalid(unsigned long addr)
466{ 482{
467 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) 483 /*
468 return 1; 484 * Check that it is a untranslated address (although MMU is not enabled
469 return 0; 485 * yet, it being a high address ensures this is not by fluke)
486 */
487 if (addr < PAGE_OFFSET)
488 return true;
489
490 /* Check that address doesn't clobber resident kernel image */
491 return addr >= (unsigned long)_stext && addr <= (unsigned long)_end;
470} 492}
471 493
472void __init setup_arch(char **cmdline_p) 494#define IGNORE_ARGS "Ignore U-boot args: "
495
496/* uboot_tag values for U-boot - kernel ABI revision 0; see head.S */
497#define UBOOT_TAG_NONE 0
498#define UBOOT_TAG_CMDLINE 1
499#define UBOOT_TAG_DTB 2
500
501void __init handle_uboot_args(void)
473{ 502{
474#ifdef CONFIG_ARC_UBOOT_SUPPORT 503 bool use_embedded_dtb = true;
475 /* make sure that uboot passed pointer to cmdline/dtb is valid */ 504 bool append_cmdline = false;
476 if (uboot_tag && is_kernel((unsigned long)uboot_arg)) 505
477 panic("Invalid uboot arg\n"); 506 /* check that we know this tag */
478 507 if (uboot_tag != UBOOT_TAG_NONE &&
479 /* See if u-boot passed an external Device Tree blob */ 508 uboot_tag != UBOOT_TAG_CMDLINE &&
480 machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */ 509 uboot_tag != UBOOT_TAG_DTB) {
481 if (!machine_desc) 510 pr_warn(IGNORE_ARGS "invalid uboot tag: '%08x'\n", uboot_tag);
482#endif 511 goto ignore_uboot_args;
483 { 512 }
484 /* No, so try the embedded one */ 513
514 if (uboot_tag != UBOOT_TAG_NONE &&
515 uboot_arg_invalid((unsigned long)uboot_arg)) {
516 pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg);
517 goto ignore_uboot_args;
518 }
519
520 /* see if U-boot passed an external Device Tree blob */
521 if (uboot_tag == UBOOT_TAG_DTB) {
522 machine_desc = setup_machine_fdt((void *)uboot_arg);
523
524 /* external Device Tree blob is invalid - use embedded one */
525 use_embedded_dtb = !machine_desc;
526 }
527
528 if (uboot_tag == UBOOT_TAG_CMDLINE)
529 append_cmdline = true;
530
531ignore_uboot_args:
532
533 if (use_embedded_dtb) {
485 machine_desc = setup_machine_fdt(__dtb_start); 534 machine_desc = setup_machine_fdt(__dtb_start);
486 if (!machine_desc) 535 if (!machine_desc)
487 panic("Embedded DT invalid\n"); 536 panic("Embedded DT invalid\n");
537 }
488 538
489 /* 539 /*
490 * If we are here, it is established that @uboot_arg didn't 540 * NOTE: @boot_command_line is populated by setup_machine_fdt() so this
491 * point to DT blob. Instead if u-boot says it is cmdline, 541 * append processing can only happen after.
492 * append to embedded DT cmdline. 542 */
493 * setup_machine_fdt() would have populated @boot_command_line 543 if (append_cmdline) {
494 */ 544 /* Ensure a whitespace between the 2 cmdlines */
495 if (uboot_tag == 1) { 545 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
496 /* Ensure a whitespace between the 2 cmdlines */ 546 strlcat(boot_command_line, uboot_arg, COMMAND_LINE_SIZE);
497 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
498 strlcat(boot_command_line, uboot_arg,
499 COMMAND_LINE_SIZE);
500 }
501 } 547 }
548}
549
550void __init setup_arch(char **cmdline_p)
551{
552 handle_uboot_args();
502 553
503 /* Save unparsed command line copy for /proc/cmdline */ 554 /* Save unparsed command line copy for /proc/cmdline */
504 *cmdline_p = boot_command_line; 555 *cmdline_p = boot_command_line;
diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S
index d61044dd8b58..ea14b0bf3116 100644
--- a/arch/arc/lib/memcpy-archs.S
+++ b/arch/arc/lib/memcpy-archs.S
@@ -25,15 +25,11 @@
25#endif 25#endif
26 26
27#ifdef CONFIG_ARC_HAS_LL64 27#ifdef CONFIG_ARC_HAS_LL64
28# define PREFETCH_READ(RX) prefetch [RX, 56]
29# define PREFETCH_WRITE(RX) prefetchw [RX, 64]
30# define LOADX(DST,RX) ldd.ab DST, [RX, 8] 28# define LOADX(DST,RX) ldd.ab DST, [RX, 8]
31# define STOREX(SRC,RX) std.ab SRC, [RX, 8] 29# define STOREX(SRC,RX) std.ab SRC, [RX, 8]
32# define ZOLSHFT 5 30# define ZOLSHFT 5
33# define ZOLAND 0x1F 31# define ZOLAND 0x1F
34#else 32#else
35# define PREFETCH_READ(RX) prefetch [RX, 28]
36# define PREFETCH_WRITE(RX) prefetchw [RX, 32]
37# define LOADX(DST,RX) ld.ab DST, [RX, 4] 33# define LOADX(DST,RX) ld.ab DST, [RX, 4]
38# define STOREX(SRC,RX) st.ab SRC, [RX, 4] 34# define STOREX(SRC,RX) st.ab SRC, [RX, 4]
39# define ZOLSHFT 4 35# define ZOLSHFT 4
@@ -41,8 +37,6 @@
41#endif 37#endif
42 38
43ENTRY_CFI(memcpy) 39ENTRY_CFI(memcpy)
44 prefetch [r1] ; Prefetch the read location
45 prefetchw [r0] ; Prefetch the write location
46 mov.f 0, r2 40 mov.f 0, r2
47;;; if size is zero 41;;; if size is zero
48 jz.d [blink] 42 jz.d [blink]
@@ -72,8 +66,6 @@ ENTRY_CFI(memcpy)
72 lpnz @.Lcopy32_64bytes 66 lpnz @.Lcopy32_64bytes
73 ;; LOOP START 67 ;; LOOP START
74 LOADX (r6, r1) 68 LOADX (r6, r1)
75 PREFETCH_READ (r1)
76 PREFETCH_WRITE (r3)
77 LOADX (r8, r1) 69 LOADX (r8, r1)
78 LOADX (r10, r1) 70 LOADX (r10, r1)
79 LOADX (r4, r1) 71 LOADX (r4, r1)
@@ -117,9 +109,7 @@ ENTRY_CFI(memcpy)
117 lpnz @.Lcopy8bytes_1 109 lpnz @.Lcopy8bytes_1
118 ;; LOOP START 110 ;; LOOP START
119 ld.ab r6, [r1, 4] 111 ld.ab r6, [r1, 4]
120 prefetch [r1, 28] ;Prefetch the next read location
121 ld.ab r8, [r1,4] 112 ld.ab r8, [r1,4]
122 prefetchw [r3, 32] ;Prefetch the next write location
123 113
124 SHIFT_1 (r7, r6, 24) 114 SHIFT_1 (r7, r6, 24)
125 or r7, r7, r5 115 or r7, r7, r5
@@ -162,9 +152,7 @@ ENTRY_CFI(memcpy)
162 lpnz @.Lcopy8bytes_2 152 lpnz @.Lcopy8bytes_2
163 ;; LOOP START 153 ;; LOOP START
164 ld.ab r6, [r1, 4] 154 ld.ab r6, [r1, 4]
165 prefetch [r1, 28] ;Prefetch the next read location
166 ld.ab r8, [r1,4] 155 ld.ab r8, [r1,4]
167 prefetchw [r3, 32] ;Prefetch the next write location
168 156
169 SHIFT_1 (r7, r6, 16) 157 SHIFT_1 (r7, r6, 16)
170 or r7, r7, r5 158 or r7, r7, r5
@@ -204,9 +192,7 @@ ENTRY_CFI(memcpy)
204 lpnz @.Lcopy8bytes_3 192 lpnz @.Lcopy8bytes_3
205 ;; LOOP START 193 ;; LOOP START
206 ld.ab r6, [r1, 4] 194 ld.ab r6, [r1, 4]
207 prefetch [r1, 28] ;Prefetch the next read location
208 ld.ab r8, [r1,4] 195 ld.ab r8, [r1,4]
209 prefetchw [r3, 32] ;Prefetch the next write location
210 196
211 SHIFT_1 (r7, r6, 8) 197 SHIFT_1 (r7, r6, 8)
212 or r7, r7, r5 198 or r7, r7, r5
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig
index f25c085b9874..23e00216e5a5 100644
--- a/arch/arc/plat-hsdk/Kconfig
+++ b/arch/arc/plat-hsdk/Kconfig
@@ -9,6 +9,7 @@ menuconfig ARC_SOC_HSDK
9 bool "ARC HS Development Kit SOC" 9 bool "ARC HS Development Kit SOC"
10 depends on ISA_ARCV2 10 depends on ISA_ARCV2
11 select ARC_HAS_ACCL_REGS 11 select ARC_HAS_ACCL_REGS
12 select ARC_IRQ_NO_AUTOSAVE
12 select CLK_HSDK 13 select CLK_HSDK
13 select RESET_HSDK 14 select RESET_HSDK
14 select HAVE_PCI 15 select HAVE_PCI
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index b67f5fee1469..dce5be5df97b 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -729,7 +729,7 @@
729 729
730&cpsw_emac0 { 730&cpsw_emac0 {
731 phy-handle = <&ethphy0>; 731 phy-handle = <&ethphy0>;
732 phy-mode = "rgmii-txid"; 732 phy-mode = "rgmii-id";
733}; 733};
734 734
735&tscadc { 735&tscadc {
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 172c0224e7f6..b128998097ce 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -651,13 +651,13 @@
651 651
652&cpsw_emac0 { 652&cpsw_emac0 {
653 phy-handle = <&ethphy0>; 653 phy-handle = <&ethphy0>;
654 phy-mode = "rgmii-txid"; 654 phy-mode = "rgmii-id";
655 dual_emac_res_vlan = <1>; 655 dual_emac_res_vlan = <1>;
656}; 656};
657 657
658&cpsw_emac1 { 658&cpsw_emac1 {
659 phy-handle = <&ethphy1>; 659 phy-handle = <&ethphy1>;
660 phy-mode = "rgmii-txid"; 660 phy-mode = "rgmii-id";
661 dual_emac_res_vlan = <2>; 661 dual_emac_res_vlan = <2>;
662}; 662};
663 663
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index f3ac7483afed..5d04dc68cf57 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -144,30 +144,32 @@
144 status = "okay"; 144 status = "okay";
145 }; 145 };
146 146
147 nand@d0000 { 147 nand-controller@d0000 {
148 status = "okay"; 148 status = "okay";
149 label = "pxa3xx_nand-0";
150 num-cs = <1>;
151 marvell,nand-keep-config;
152 nand-on-flash-bbt;
153
154 partitions {
155 compatible = "fixed-partitions";
156 #address-cells = <1>;
157 #size-cells = <1>;
158
159 partition@0 {
160 label = "U-Boot";
161 reg = <0 0x800000>;
162 };
163 partition@800000 {
164 label = "Linux";
165 reg = <0x800000 0x800000>;
166 };
167 partition@1000000 {
168 label = "Filesystem";
169 reg = <0x1000000 0x3f000000>;
170 149
150 nand@0 {
151 reg = <0>;
152 label = "pxa3xx_nand-0";
153 nand-rb = <0>;
154 nand-on-flash-bbt;
155
156 partitions {
157 compatible = "fixed-partitions";
158 #address-cells = <1>;
159 #size-cells = <1>;
160
161 partition@0 {
162 label = "U-Boot";
163 reg = <0 0x800000>;
164 };
165 partition@800000 {
166 label = "Linux";
167 reg = <0x800000 0x800000>;
168 };
169 partition@1000000 {
170 label = "Filesystem";
171 reg = <0x1000000 0x3f000000>;
172 };
171 }; 173 };
172 }; 174 };
173 }; 175 };
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 1139e9469a83..b4cca507cf13 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -160,12 +160,15 @@
160 status = "okay"; 160 status = "okay";
161 }; 161 };
162 162
163 nand@d0000 { 163 nand-controller@d0000 {
164 status = "okay"; 164 status = "okay";
165 label = "pxa3xx_nand-0"; 165
166 num-cs = <1>; 166 nand@0 {
167 marvell,nand-keep-config; 167 reg = <0>;
168 nand-on-flash-bbt; 168 label = "pxa3xx_nand-0";
169 nand-rb = <0>;
170 nand-on-flash-bbt;
171 };
169 }; 172 };
170 }; 173 };
171 174
diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
index bbbb38888bb8..87dcb502f72d 100644
--- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
+++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
@@ -81,49 +81,52 @@
81 81
82 }; 82 };
83 83
84 nand@d0000 { 84 nand-controller@d0000 {
85 status = "okay"; 85 status = "okay";
86 label = "pxa3xx_nand-0";
87 num-cs = <1>;
88 marvell,nand-keep-config;
89 nand-on-flash-bbt;
90
91 partitions {
92 compatible = "fixed-partitions";
93 #address-cells = <1>;
94 #size-cells = <1>;
95
96 partition@0 {
97 label = "u-boot";
98 reg = <0x00000000 0x000e0000>;
99 read-only;
100 };
101
102 partition@e0000 {
103 label = "u-boot-env";
104 reg = <0x000e0000 0x00020000>;
105 read-only;
106 };
107
108 partition@100000 {
109 label = "u-boot-env2";
110 reg = <0x00100000 0x00020000>;
111 read-only;
112 };
113
114 partition@120000 {
115 label = "zImage";
116 reg = <0x00120000 0x00400000>;
117 };
118
119 partition@520000 {
120 label = "initrd";
121 reg = <0x00520000 0x00400000>;
122 };
123 86
124 partition@e00000 { 87 nand@0 {
125 label = "boot"; 88 reg = <0>;
126 reg = <0x00e00000 0x3f200000>; 89 label = "pxa3xx_nand-0";
90 nand-rb = <0>;
91 nand-on-flash-bbt;
92
93 partitions {
94 compatible = "fixed-partitions";
95 #address-cells = <1>;
96 #size-cells = <1>;
97
98 partition@0 {
99 label = "u-boot";
100 reg = <0x00000000 0x000e0000>;
101 read-only;
102 };
103
104 partition@e0000 {
105 label = "u-boot-env";
106 reg = <0x000e0000 0x00020000>;
107 read-only;
108 };
109
110 partition@100000 {
111 label = "u-boot-env2";
112 reg = <0x00100000 0x00020000>;
113 read-only;
114 };
115
116 partition@120000 {
117 label = "zImage";
118 reg = <0x00120000 0x00400000>;
119 };
120
121 partition@520000 {
122 label = "initrd";
123 reg = <0x00520000 0x00400000>;
124 };
125
126 partition@e00000 {
127 label = "boot";
128 reg = <0x00e00000 0x3f200000>;
129 };
127 }; 130 };
128 }; 131 };
129 }; 132 };
diff --git a/arch/arm/boot/dts/tegra124-nyan.dtsi b/arch/arm/boot/dts/tegra124-nyan.dtsi
index d5f11d6d987e..bc85b6a166c7 100644
--- a/arch/arm/boot/dts/tegra124-nyan.dtsi
+++ b/arch/arm/boot/dts/tegra124-nyan.dtsi
@@ -13,10 +13,25 @@
13 stdout-path = "serial0:115200n8"; 13 stdout-path = "serial0:115200n8";
14 }; 14 };
15 15
16 memory@80000000 { 16 /*
17 * Note that recent version of the device tree compiler (starting with
18 * version 1.4.2) warn about this node containing a reg property, but
19 * missing a unit-address. However, the bootloader on these Chromebook
20 * devices relies on the full name of this node to be exactly /memory.
21 * Adding the unit-address causes the bootloader to create a /memory
22 * node and write the memory bank configuration to that node, which in
23 * turn leads the kernel to believe that the device has 2 GiB of
24 * memory instead of the amount detected by the bootloader.
25 *
26 * The name of this node is effectively ABI and must not be changed.
27 */
28 memory {
29 device_type = "memory";
17 reg = <0x0 0x80000000 0x0 0x80000000>; 30 reg = <0x0 0x80000000 0x0 0x80000000>;
18 }; 31 };
19 32
33 /delete-node/ memory@80000000;
34
20 host1x@50000000 { 35 host1x@50000000 {
21 hdmi@54280000 { 36 hdmi@54280000 {
22 status = "okay"; 37 status = "okay";
diff --git a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
index 5b4a9609e31f..2468762283a5 100644
--- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
+++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
@@ -351,7 +351,7 @@
351 reg = <0>; 351 reg = <0>;
352 pinctrl-names = "default"; 352 pinctrl-names = "default";
353 pinctrl-0 = <&cp0_copper_eth_phy_reset>; 353 pinctrl-0 = <&cp0_copper_eth_phy_reset>;
354 reset-gpios = <&cp1_gpio1 11 GPIO_ACTIVE_LOW>; 354 reset-gpios = <&cp0_gpio2 11 GPIO_ACTIVE_LOW>;
355 reset-assert-us = <10000>; 355 reset-assert-us = <10000>;
356 }; 356 };
357 357
diff --git a/arch/arm64/include/asm/neon-intrinsics.h b/arch/arm64/include/asm/neon-intrinsics.h
index 2ba6c6b9541f..71abfc7612b2 100644
--- a/arch/arm64/include/asm/neon-intrinsics.h
+++ b/arch/arm64/include/asm/neon-intrinsics.h
@@ -36,4 +36,8 @@
36#include <arm_neon.h> 36#include <arm_neon.h>
37#endif 37#endif
38 38
39#ifdef CONFIG_CC_IS_CLANG
40#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
41#endif
42
39#endif /* __ASM_NEON_INTRINSICS_H */ 43#endif /* __ASM_NEON_INTRINSICS_H */
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 15d79a8e5e5e..eecf7927dab0 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -539,8 +539,7 @@ set_hcr:
539 /* GICv3 system register access */ 539 /* GICv3 system register access */
540 mrs x0, id_aa64pfr0_el1 540 mrs x0, id_aa64pfr0_el1
541 ubfx x0, x0, #24, #4 541 ubfx x0, x0, #24, #4
542 cmp x0, #1 542 cbz x0, 3f
543 b.ne 3f
544 543
545 mrs_s x0, SYS_ICC_SRE_EL2 544 mrs_s x0, SYS_ICC_SRE_EL2
546 orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1 545 orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 9dce33b0e260..ddaea0fd2fa4 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1702,19 +1702,20 @@ void syscall_trace_exit(struct pt_regs *regs)
1702} 1702}
1703 1703
1704/* 1704/*
1705 * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487C.a 1705 * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a.
1706 * We also take into account DIT (bit 24), which is not yet documented, and 1706 * We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is
1707 * treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may be 1707 * not described in ARM DDI 0487D.a.
1708 * allocated an EL0 meaning in future. 1708 * We treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may
1709 * be allocated an EL0 meaning in future.
1709 * Userspace cannot use these until they have an architectural meaning. 1710 * Userspace cannot use these until they have an architectural meaning.
1710 * Note that this follows the SPSR_ELx format, not the AArch32 PSR format. 1711 * Note that this follows the SPSR_ELx format, not the AArch32 PSR format.
1711 * We also reserve IL for the kernel; SS is handled dynamically. 1712 * We also reserve IL for the kernel; SS is handled dynamically.
1712 */ 1713 */
1713#define SPSR_EL1_AARCH64_RES0_BITS \ 1714#define SPSR_EL1_AARCH64_RES0_BITS \
1714 (GENMASK_ULL(63,32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ 1715 (GENMASK_ULL(63, 32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \
1715 GENMASK_ULL(20, 10) | GENMASK_ULL(5, 5)) 1716 GENMASK_ULL(20, 13) | GENMASK_ULL(11, 10) | GENMASK_ULL(5, 5))
1716#define SPSR_EL1_AARCH32_RES0_BITS \ 1717#define SPSR_EL1_AARCH32_RES0_BITS \
1717 (GENMASK_ULL(63,32) | GENMASK_ULL(23, 22) | GENMASK_ULL(20,20)) 1718 (GENMASK_ULL(63, 32) | GENMASK_ULL(22, 22) | GENMASK_ULL(20, 20))
1718 1719
1719static int valid_compat_regs(struct user_pt_regs *regs) 1720static int valid_compat_regs(struct user_pt_regs *regs)
1720{ 1721{
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index d09ec76f08cf..009849328289 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -339,6 +339,9 @@ void __init setup_arch(char **cmdline_p)
339 smp_init_cpus(); 339 smp_init_cpus();
340 smp_build_mpidr_hash(); 340 smp_build_mpidr_hash();
341 341
342 /* Init percpu seeds for random tags after cpus are set up. */
343 kasan_init_tags();
344
342#ifdef CONFIG_ARM64_SW_TTBR0_PAN 345#ifdef CONFIG_ARM64_SW_TTBR0_PAN
343 /* 346 /*
344 * Make sure init_thread_info.ttbr0 always generates translation 347 * Make sure init_thread_info.ttbr0 always generates translation
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index 4b55b15707a3..f37a86d2a69d 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -252,8 +252,6 @@ void __init kasan_init(void)
252 memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); 252 memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE);
253 cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); 253 cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
254 254
255 kasan_init_tags();
256
257 /* At this point kasan is fully initialized. Enable error messages */ 255 /* At this point kasan is fully initialized. Enable error messages */
258 init_task.kasan_depth = 0; 256 init_task.kasan_depth = 0;
259 pr_info("KernelAddressSanitizer initialized\n"); 257 pr_info("KernelAddressSanitizer initialized\n");
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 2582df1c529b..0964c236e3e5 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -308,15 +308,29 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
308 308
309long do_syscall_trace_enter(struct pt_regs *regs) 309long do_syscall_trace_enter(struct pt_regs *regs)
310{ 310{
311 if (test_thread_flag(TIF_SYSCALL_TRACE) && 311 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
312 tracehook_report_syscall_entry(regs)) { 312 int rc = tracehook_report_syscall_entry(regs);
313
313 /* 314 /*
314 * Tracing decided this syscall should not happen or the 315 * As tracesys_next does not set %r28 to -ENOSYS
315 * debugger stored an invalid system call number. Skip 316 * when %r20 is set to -1, initialize it here.
316 * the system call and the system call restart handling.
317 */ 317 */
318 regs->gr[20] = -1UL; 318 regs->gr[28] = -ENOSYS;
319 goto out; 319
320 if (rc) {
321 /*
322 * A nonzero return code from
323 * tracehook_report_syscall_entry() tells us
324 * to prevent the syscall execution. Skip
325 * the syscall call and the syscall restart handling.
326 *
327 * Note that the tracer may also just change
328 * regs->gr[20] to an invalid syscall number,
329 * that is handled by tracesys_next.
330 */
331 regs->gr[20] = -1UL;
332 return -1;
333 }
320 } 334 }
321 335
322 /* Do the secure computing check after ptrace. */ 336 /* Do the secure computing check after ptrace. */
@@ -340,7 +354,6 @@ long do_syscall_trace_enter(struct pt_regs *regs)
340 regs->gr[24] & 0xffffffff, 354 regs->gr[24] & 0xffffffff,
341 regs->gr[23] & 0xffffffff); 355 regs->gr[23] & 0xffffffff);
342 356
343out:
344 /* 357 /*
345 * Sign extend the syscall number to 64bit since it may have been 358 * Sign extend the syscall number to 64bit since it may have been
346 * modified by a compat ptrace call 359 * modified by a compat ptrace call
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 7db3119f8a5b..145373f0e5dc 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1593,6 +1593,8 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs)
1593 1593
1594 pnv_pci_ioda2_setup_dma_pe(phb, pe); 1594 pnv_pci_ioda2_setup_dma_pe(phb, pe);
1595#ifdef CONFIG_IOMMU_API 1595#ifdef CONFIG_IOMMU_API
1596 iommu_register_group(&pe->table_group,
1597 pe->phb->hose->global_number, pe->pe_number);
1596 pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL); 1598 pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL);
1597#endif 1599#endif
1598 } 1600 }
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 45fb70b4bfa7..ef9448a907c6 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -1147,6 +1147,8 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
1147 return 0; 1147 return 0;
1148 1148
1149 pe = &phb->ioda.pe_array[pdn->pe_number]; 1149 pe = &phb->ioda.pe_array[pdn->pe_number];
1150 if (!pe->table_group.group)
1151 return 0;
1150 iommu_add_device(&pe->table_group, dev); 1152 iommu_add_device(&pe->table_group, dev);
1151 return 0; 1153 return 0;
1152 case BUS_NOTIFY_DEL_DEVICE: 1154 case BUS_NOTIFY_DEL_DEVICE:
diff --git a/arch/sh/boot/dts/Makefile b/arch/sh/boot/dts/Makefile
index 01d0f7fb14cc..2563d1e532e2 100644
--- a/arch/sh/boot/dts/Makefile
+++ b/arch/sh/boot/dts/Makefile
@@ -1,3 +1,3 @@
1ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") 1ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
2obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o 2obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
3endif 3endif
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 0ea2139c50d8..ccd296dbb95c 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -95,7 +95,7 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status)
95static void pm_runtime_deactivate_timer(struct device *dev) 95static void pm_runtime_deactivate_timer(struct device *dev)
96{ 96{
97 if (dev->power.timer_expires > 0) { 97 if (dev->power.timer_expires > 0) {
98 hrtimer_cancel(&dev->power.suspend_timer); 98 hrtimer_try_to_cancel(&dev->power.suspend_timer);
99 dev->power.timer_expires = 0; 99 dev->power.timer_expires = 0;
100 } 100 }
101} 101}
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 2fe225a697df..3487e03d4bc6 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
144 return; 144 return;
145 145
146 at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1, 146 at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
147 nck(at91sam9x5_systemck), 147 nck(at91sam9x5_systemck), 31, 0);
148 nck(at91sam9x35_periphck), 0);
149 if (!at91sam9x5_pmc) 148 if (!at91sam9x5_pmc)
150 return; 149 return;
151 150
@@ -210,7 +209,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
210 parent_names[1] = "mainck"; 209 parent_names[1] = "mainck";
211 parent_names[2] = "plladivck"; 210 parent_names[2] = "plladivck";
212 parent_names[3] = "utmick"; 211 parent_names[3] = "utmick";
213 parent_names[4] = "mck"; 212 parent_names[4] = "masterck";
214 for (i = 0; i < 2; i++) { 213 for (i = 0; i < 2; i++) {
215 char name[6]; 214 char name[6];
216 215
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index d69ad96fe988..cd0ef7274fdb 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -240,7 +240,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
240 parent_names[1] = "mainck"; 240 parent_names[1] = "mainck";
241 parent_names[2] = "plladivck"; 241 parent_names[2] = "plladivck";
242 parent_names[3] = "utmick"; 242 parent_names[3] = "utmick";
243 parent_names[4] = "mck"; 243 parent_names[4] = "masterck";
244 for (i = 0; i < 3; i++) { 244 for (i = 0; i < 3; i++) {
245 char name[6]; 245 char name[6];
246 246
@@ -291,7 +291,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
291 parent_names[1] = "mainck"; 291 parent_names[1] = "mainck";
292 parent_names[2] = "plladivck"; 292 parent_names[2] = "plladivck";
293 parent_names[3] = "utmick"; 293 parent_names[3] = "utmick";
294 parent_names[4] = "mck"; 294 parent_names[4] = "masterck";
295 parent_names[5] = "audiopll_pmcck"; 295 parent_names[5] = "audiopll_pmcck";
296 for (i = 0; i < ARRAY_SIZE(sama5d2_gck); i++) { 296 for (i = 0; i < ARRAY_SIZE(sama5d2_gck); i++) {
297 hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, 297 hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index e358be7f6c8d..b645a9d59cdb 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -207,7 +207,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
207 parent_names[1] = "mainck"; 207 parent_names[1] = "mainck";
208 parent_names[2] = "plladivck"; 208 parent_names[2] = "plladivck";
209 parent_names[3] = "utmick"; 209 parent_names[3] = "utmick";
210 parent_names[4] = "mck"; 210 parent_names[4] = "masterck";
211 for (i = 0; i < 3; i++) { 211 for (i = 0; i < 3; i++) {
212 char name[6]; 212 char name[6];
213 213
diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
index 3b97f60540ad..609970c0b666 100644
--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
+++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
@@ -264,9 +264,9 @@ static SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1",
264static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1", 264static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1",
265 0x060, BIT(10), 0); 265 0x060, BIT(10), 0);
266static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1", 266static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1",
267 0x060, BIT(12), 0); 267 0x060, BIT(11), 0);
268static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1", 268static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1",
269 0x060, BIT(13), 0); 269 0x060, BIT(12), 0);
270static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1", 270static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1",
271 0x060, BIT(13), 0); 271 0x060, BIT(13), 0);
272static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1", 272static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1",
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
index 621b1cd996db..ac12f261f8ca 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
@@ -542,7 +542,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
542 [RST_BUS_OHCI0] = { 0x2c0, BIT(29) }, 542 [RST_BUS_OHCI0] = { 0x2c0, BIT(29) },
543 543
544 [RST_BUS_VE] = { 0x2c4, BIT(0) }, 544 [RST_BUS_VE] = { 0x2c4, BIT(0) },
545 [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, 545 [RST_BUS_TCON0] = { 0x2c4, BIT(4) },
546 [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 546 [RST_BUS_CSI] = { 0x2c4, BIT(8) },
547 [RST_BUS_DE] = { 0x2c4, BIT(12) }, 547 [RST_BUS_DE] = { 0x2c4, BIT(12) },
548 [RST_BUS_DBG] = { 0x2c4, BIT(31) }, 548 [RST_BUS_DBG] = { 0x2c4, BIT(31) },
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 242c3370544e..9ed46d188cb5 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -187,8 +187,8 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy)
187 187
188 cpufreq_cooling_unregister(priv->cdev); 188 cpufreq_cooling_unregister(priv->cdev);
189 dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); 189 dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
190 kfree(priv);
191 dev_pm_opp_remove_all_dynamic(priv->cpu_dev); 190 dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
191 kfree(priv);
192 192
193 return 0; 193 return 0;
194} 194}
diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c
index 00e954f22bc9..74401e0adb29 100644
--- a/drivers/gpio/gpio-mt7621.c
+++ b/drivers/gpio/gpio-mt7621.c
@@ -30,6 +30,7 @@
30#define GPIO_REG_EDGE 0xA0 30#define GPIO_REG_EDGE 0xA0
31 31
32struct mtk_gc { 32struct mtk_gc {
33 struct irq_chip irq_chip;
33 struct gpio_chip chip; 34 struct gpio_chip chip;
34 spinlock_t lock; 35 spinlock_t lock;
35 int bank; 36 int bank;
@@ -189,13 +190,6 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type)
189 return 0; 190 return 0;
190} 191}
191 192
192static struct irq_chip mediatek_gpio_irq_chip = {
193 .irq_unmask = mediatek_gpio_irq_unmask,
194 .irq_mask = mediatek_gpio_irq_mask,
195 .irq_mask_ack = mediatek_gpio_irq_mask,
196 .irq_set_type = mediatek_gpio_irq_type,
197};
198
199static int 193static int
200mediatek_gpio_xlate(struct gpio_chip *chip, 194mediatek_gpio_xlate(struct gpio_chip *chip,
201 const struct of_phandle_args *spec, u32 *flags) 195 const struct of_phandle_args *spec, u32 *flags)
@@ -254,6 +248,13 @@ mediatek_gpio_bank_probe(struct device *dev,
254 return ret; 248 return ret;
255 } 249 }
256 250
251 rg->irq_chip.name = dev_name(dev);
252 rg->irq_chip.parent_device = dev;
253 rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
254 rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
255 rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;
256 rg->irq_chip.irq_set_type = mediatek_gpio_irq_type;
257
257 if (mtk->gpio_irq) { 258 if (mtk->gpio_irq) {
258 /* 259 /*
259 * Manually request the irq here instead of passing 260 * Manually request the irq here instead of passing
@@ -270,14 +271,14 @@ mediatek_gpio_bank_probe(struct device *dev,
270 return ret; 271 return ret;
271 } 272 }
272 273
273 ret = gpiochip_irqchip_add(&rg->chip, &mediatek_gpio_irq_chip, 274 ret = gpiochip_irqchip_add(&rg->chip, &rg->irq_chip,
274 0, handle_simple_irq, IRQ_TYPE_NONE); 275 0, handle_simple_irq, IRQ_TYPE_NONE);
275 if (ret) { 276 if (ret) {
276 dev_err(dev, "failed to add gpiochip_irqchip\n"); 277 dev_err(dev, "failed to add gpiochip_irqchip\n");
277 return ret; 278 return ret;
278 } 279 }
279 280
280 gpiochip_set_chained_irqchip(&rg->chip, &mediatek_gpio_irq_chip, 281 gpiochip_set_chained_irqchip(&rg->chip, &rg->irq_chip,
281 mtk->gpio_irq, NULL); 282 mtk->gpio_irq, NULL);
282 } 283 }
283 284
@@ -310,7 +311,6 @@ mediatek_gpio_probe(struct platform_device *pdev)
310 mtk->gpio_irq = irq_of_parse_and_map(np, 0); 311 mtk->gpio_irq = irq_of_parse_and_map(np, 0);
311 mtk->dev = dev; 312 mtk->dev = dev;
312 platform_set_drvdata(pdev, mtk); 313 platform_set_drvdata(pdev, mtk);
313 mediatek_gpio_irq_chip.name = dev_name(dev);
314 314
315 for (i = 0; i < MTK_BANK_CNT; i++) { 315 for (i = 0; i < MTK_BANK_CNT; i++) {
316 ret = mediatek_gpio_bank_probe(dev, np, i); 316 ret = mediatek_gpio_bank_probe(dev, np, i);
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index e9600b556f39..bcc6be4a5cb2 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -245,6 +245,7 @@ static bool pxa_gpio_has_pinctrl(void)
245{ 245{
246 switch (gpio_type) { 246 switch (gpio_type) {
247 case PXA3XX_GPIO: 247 case PXA3XX_GPIO:
248 case MMP2_GPIO:
248 return false; 249 return false;
249 250
250 default: 251 default:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index bc62bf41b7e9..5dc349173e4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -212,6 +212,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
212 } 212 }
213 213
214 if (amdgpu_device_is_px(dev)) { 214 if (amdgpu_device_is_px(dev)) {
215 dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
215 pm_runtime_use_autosuspend(dev->dev); 216 pm_runtime_use_autosuspend(dev->dev);
216 pm_runtime_set_autosuspend_delay(dev->dev, 5000); 217 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
217 pm_runtime_set_active(dev->dev); 218 pm_runtime_set_active(dev->dev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 7c108e687683..698bcb8ce61d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -638,12 +638,14 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev,
638 struct ttm_bo_global *glob = adev->mman.bdev.glob; 638 struct ttm_bo_global *glob = adev->mman.bdev.glob;
639 struct amdgpu_vm_bo_base *bo_base; 639 struct amdgpu_vm_bo_base *bo_base;
640 640
641#if 0
641 if (vm->bulk_moveable) { 642 if (vm->bulk_moveable) {
642 spin_lock(&glob->lru_lock); 643 spin_lock(&glob->lru_lock);
643 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); 644 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move);
644 spin_unlock(&glob->lru_lock); 645 spin_unlock(&glob->lru_lock);
645 return; 646 return;
646 } 647 }
648#endif
647 649
648 memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); 650 memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move));
649 651
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 6811a5d05b27..aa2f71cc1eba 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -128,7 +128,7 @@ static const struct soc15_reg_golden golden_settings_sdma0_4_2_init[] = {
128 128
129static const struct soc15_reg_golden golden_settings_sdma0_4_2[] = 129static const struct soc15_reg_golden golden_settings_sdma0_4_2[] =
130{ 130{
131 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CHICKEN_BITS, 0xfe931f07, 0x02831d07), 131 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
132 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CLK_CTRL, 0xffffffff, 0x3f000100), 132 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CLK_CTRL, 0xffffffff, 0x3f000100),
133 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0000773f, 0x00004002), 133 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0000773f, 0x00004002),
134 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002), 134 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002),
@@ -158,7 +158,7 @@ static const struct soc15_reg_golden golden_settings_sdma0_4_2[] =
158}; 158};
159 159
160static const struct soc15_reg_golden golden_settings_sdma1_4_2[] = { 160static const struct soc15_reg_golden golden_settings_sdma1_4_2[] = {
161 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), 161 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
162 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), 162 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100),
163 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0000773f, 0x00004002), 163 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0000773f, 0x00004002),
164 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002), 164 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002),
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0b392bfca284..5296b8f3e0ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -786,12 +786,13 @@ static int dm_suspend(void *handle)
786 struct amdgpu_display_manager *dm = &adev->dm; 786 struct amdgpu_display_manager *dm = &adev->dm;
787 int ret = 0; 787 int ret = 0;
788 788
789 WARN_ON(adev->dm.cached_state);
790 adev->dm.cached_state = drm_atomic_helper_suspend(adev->ddev);
791
789 s3_handle_mst(adev->ddev, true); 792 s3_handle_mst(adev->ddev, true);
790 793
791 amdgpu_dm_irq_suspend(adev); 794 amdgpu_dm_irq_suspend(adev);
792 795
793 WARN_ON(adev->dm.cached_state);
794 adev->dm.cached_state = drm_atomic_helper_suspend(adev->ddev);
795 796
796 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3); 797 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
797 798
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
index 19801bdba0d2..7a72ee46f14b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
@@ -662,6 +662,11 @@ static void dce11_update_clocks(struct clk_mgr *clk_mgr,
662{ 662{
663 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 663 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr);
664 struct dm_pp_power_level_change_request level_change_req; 664 struct dm_pp_power_level_change_request level_change_req;
665 int patched_disp_clk = context->bw.dce.dispclk_khz;
666
667 /*TODO: W/A for dal3 linux, investigate why this works */
668 if (!clk_mgr_dce->dfs_bypass_active)
669 patched_disp_clk = patched_disp_clk * 115 / 100;
665 670
666 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr, context); 671 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr, context);
667 /* get max clock state from PPLIB */ 672 /* get max clock state from PPLIB */
@@ -671,9 +676,9 @@ static void dce11_update_clocks(struct clk_mgr *clk_mgr,
671 clk_mgr_dce->cur_min_clks_state = level_change_req.power_level; 676 clk_mgr_dce->cur_min_clks_state = level_change_req.power_level;
672 } 677 }
673 678
674 if (should_set_clock(safe_to_lower, context->bw.dce.dispclk_khz, clk_mgr->clks.dispclk_khz)) { 679 if (should_set_clock(safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) {
675 context->bw.dce.dispclk_khz = dce_set_clock(clk_mgr, context->bw.dce.dispclk_khz); 680 context->bw.dce.dispclk_khz = dce_set_clock(clk_mgr, patched_disp_clk);
676 clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; 681 clk_mgr->clks.dispclk_khz = patched_disp_clk;
677 } 682 }
678 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context); 683 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context);
679} 684}
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
index acd418515346..a6b80fdaa666 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
@@ -37,6 +37,10 @@ void dce100_prepare_bandwidth(
37 struct dc *dc, 37 struct dc *dc,
38 struct dc_state *context); 38 struct dc_state *context);
39 39
40void dce100_optimize_bandwidth(
41 struct dc *dc,
42 struct dc_state *context);
43
40bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id, 44bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id,
41 struct dc_bios *dcb, 45 struct dc_bios *dcb,
42 enum pipe_gating_control power_gating); 46 enum pipe_gating_control power_gating);
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
index a60a90e68d91..c4543178ba20 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
@@ -77,6 +77,6 @@ void dce80_hw_sequencer_construct(struct dc *dc)
77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating; 77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating;
78 dc->hwss.pipe_control_lock = dce_pipe_control_lock; 78 dc->hwss.pipe_control_lock = dce_pipe_control_lock;
79 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth; 79 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
80 dc->hwss.optimize_bandwidth = dce100_prepare_bandwidth; 80 dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth;
81} 81}
82 82
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index cdd1d6b7b9f2..4e9ea50141bd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -790,9 +790,22 @@ bool dce80_validate_bandwidth(
790 struct dc *dc, 790 struct dc *dc,
791 struct dc_state *context) 791 struct dc_state *context)
792{ 792{
793 /* TODO implement when needed but for now hardcode max value*/ 793 int i;
794 context->bw.dce.dispclk_khz = 681000; 794 bool at_least_one_pipe = false;
795 context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 795
796 for (i = 0; i < dc->res_pool->pipe_count; i++) {
797 if (context->res_ctx.pipe_ctx[i].stream)
798 at_least_one_pipe = true;
799 }
800
801 if (at_least_one_pipe) {
802 /* TODO implement when needed but for now hardcode max value*/
803 context->bw.dce.dispclk_khz = 681000;
804 context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ;
805 } else {
806 context->bw.dce.dispclk_khz = 0;
807 context->bw.dce.yclk_khz = 0;
808 }
796 809
797 return true; 810 return true;
798} 811}
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index 58a12ddf12f3..41883c981789 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2658,8 +2658,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
2658 .mirror = pipe_ctx->plane_state->horizontal_mirror 2658 .mirror = pipe_ctx->plane_state->horizontal_mirror
2659 }; 2659 };
2660 2660
2661 pos_cpy.x -= pipe_ctx->plane_state->dst_rect.x; 2661 pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x;
2662 pos_cpy.y -= pipe_ctx->plane_state->dst_rect.y; 2662 pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y;
2663 2663
2664 if (pipe_ctx->plane_state->address.type 2664 if (pipe_ctx->plane_state->address.type
2665 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) 2665 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 7f365ac0b549..4ee16b264dbe 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -336,8 +336,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
336 bool *enabled, int width, int height) 336 bool *enabled, int width, int height)
337{ 337{
338 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); 338 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
339 unsigned long conn_configured, conn_seq, mask;
340 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); 339 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
340 unsigned long conn_configured, conn_seq;
341 int i, j; 341 int i, j;
342 bool *save_enabled; 342 bool *save_enabled;
343 bool fallback = true, ret = true; 343 bool fallback = true, ret = true;
@@ -355,10 +355,9 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
355 drm_modeset_backoff(&ctx); 355 drm_modeset_backoff(&ctx);
356 356
357 memcpy(save_enabled, enabled, count); 357 memcpy(save_enabled, enabled, count);
358 mask = GENMASK(count - 1, 0); 358 conn_seq = GENMASK(count - 1, 0);
359 conn_configured = 0; 359 conn_configured = 0;
360retry: 360retry:
361 conn_seq = conn_configured;
362 for (i = 0; i < count; i++) { 361 for (i = 0; i < count; i++) {
363 struct drm_fb_helper_connector *fb_conn; 362 struct drm_fb_helper_connector *fb_conn;
364 struct drm_connector *connector; 363 struct drm_connector *connector;
@@ -371,7 +370,8 @@ retry:
371 if (conn_configured & BIT(i)) 370 if (conn_configured & BIT(i))
372 continue; 371 continue;
373 372
374 if (conn_seq == 0 && !connector->has_tile) 373 /* First pass, only consider tiled connectors */
374 if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile)
375 continue; 375 continue;
376 376
377 if (connector->status == connector_status_connected) 377 if (connector->status == connector_status_connected)
@@ -475,8 +475,10 @@ retry:
475 conn_configured |= BIT(i); 475 conn_configured |= BIT(i);
476 } 476 }
477 477
478 if ((conn_configured & mask) != mask && conn_configured != conn_seq) 478 if (conn_configured != conn_seq) { /* repeat until no more are found */
479 conn_seq = conn_configured;
479 goto retry; 480 goto retry;
481 }
480 482
481 /* 483 /*
482 * If the BIOS didn't enable everything it could, fall back to have the 484 * If the BIOS didn't enable everything it could, fall back to have the
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index dec1e081f529..6a8fb6fd183c 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -172,6 +172,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
172 } 172 }
173 173
174 if (radeon_is_px(dev)) { 174 if (radeon_is_px(dev)) {
175 dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
175 pm_runtime_use_autosuspend(dev->dev); 176 pm_runtime_use_autosuspend(dev->dev);
176 pm_runtime_set_autosuspend_delay(dev->dev, 5000); 177 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
177 pm_runtime_set_active(dev->dev); 178 pm_runtime_set_active(dev->dev);
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index c13c0ba30f63..d499cd61c0e8 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -783,6 +783,7 @@ void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev,
783static int c4iw_rdev_open(struct c4iw_rdev *rdev) 783static int c4iw_rdev_open(struct c4iw_rdev *rdev)
784{ 784{
785 int err; 785 int err;
786 unsigned int factor;
786 787
787 c4iw_init_dev_ucontext(rdev, &rdev->uctx); 788 c4iw_init_dev_ucontext(rdev, &rdev->uctx);
788 789
@@ -806,8 +807,18 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
806 return -EINVAL; 807 return -EINVAL;
807 } 808 }
808 809
809 rdev->qpmask = rdev->lldi.udb_density - 1; 810 /* This implementation requires a sge_host_page_size <= PAGE_SIZE. */
810 rdev->cqmask = rdev->lldi.ucq_density - 1; 811 if (rdev->lldi.sge_host_page_size > PAGE_SIZE) {
812 pr_err("%s: unsupported sge host page size %u\n",
813 pci_name(rdev->lldi.pdev),
814 rdev->lldi.sge_host_page_size);
815 return -EINVAL;
816 }
817
818 factor = PAGE_SIZE / rdev->lldi.sge_host_page_size;
819 rdev->qpmask = (rdev->lldi.udb_density * factor) - 1;
820 rdev->cqmask = (rdev->lldi.ucq_density * factor) - 1;
821
811 pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n", 822 pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n",
812 pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start, 823 pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start,
813 rdev->lldi.vr->stag.size, c4iw_num_stags(rdev), 824 rdev->lldi.vr->stag.size, c4iw_num_stags(rdev),
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 31d91538bbf4..694324b37480 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3032,7 +3032,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
3032{ 3032{
3033 struct srp_target_port *target = host_to_target(scmnd->device->host); 3033 struct srp_target_port *target = host_to_target(scmnd->device->host);
3034 struct srp_rdma_ch *ch; 3034 struct srp_rdma_ch *ch;
3035 int i, j;
3036 u8 status; 3035 u8 status;
3037 3036
3038 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); 3037 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
@@ -3044,15 +3043,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
3044 if (status) 3043 if (status)
3045 return FAILED; 3044 return FAILED;
3046 3045
3047 for (i = 0; i < target->ch_count; i++) {
3048 ch = &target->ch[i];
3049 for (j = 0; j < target->req_ring_size; ++j) {
3050 struct srp_request *req = &ch->req_ring[j];
3051
3052 srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
3053 }
3054 }
3055
3056 return SUCCESS; 3046 return SUCCESS;
3057} 3047}
3058 3048
diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 22f753e555ac..83f88b8b5d9f 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -212,7 +212,7 @@ static int powernv_flash_set_driver_info(struct device *dev,
212 * Going to have to check what details I need to set and how to 212 * Going to have to check what details I need to set and how to
213 * get them 213 * get them
214 */ 214 */
215 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); 215 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
216 mtd->type = MTD_NORFLASH; 216 mtd->type = MTD_NORFLASH;
217 mtd->flags = MTD_WRITEABLE; 217 mtd->flags = MTD_WRITEABLE;
218 mtd->size = size; 218 mtd->size = size;
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 999b705769a8..3ef01baef9b6 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -507,6 +507,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
507{ 507{
508 struct nvmem_config config = {}; 508 struct nvmem_config config = {};
509 509
510 config.id = -1;
510 config.dev = &mtd->dev; 511 config.dev = &mtd->dev;
511 config.name = mtd->name; 512 config.name = mtd->name;
512 config.owner = THIS_MODULE; 513 config.owner = THIS_MODULE;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index c041f44324db..b3654598a2d5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -660,6 +660,7 @@ static void uld_init(struct adapter *adap, struct cxgb4_lld_info *lld)
660 lld->cclk_ps = 1000000000 / adap->params.vpd.cclk; 660 lld->cclk_ps = 1000000000 / adap->params.vpd.cclk;
661 lld->udb_density = 1 << adap->params.sge.eq_qpp; 661 lld->udb_density = 1 << adap->params.sge.eq_qpp;
662 lld->ucq_density = 1 << adap->params.sge.iq_qpp; 662 lld->ucq_density = 1 << adap->params.sge.iq_qpp;
663 lld->sge_host_page_size = 1 << (adap->params.sge.hps + 10);
663 lld->filt_mode = adap->params.tp.vlan_pri_map; 664 lld->filt_mode = adap->params.tp.vlan_pri_map;
664 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */ 665 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */
665 for (i = 0; i < NCHAN; i++) 666 for (i = 0; i < NCHAN; i++)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index 5fa9a2d5fc4b..21da34a4ca24 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -336,6 +336,7 @@ struct cxgb4_lld_info {
336 unsigned int cclk_ps; /* Core clock period in psec */ 336 unsigned int cclk_ps; /* Core clock period in psec */
337 unsigned short udb_density; /* # of user DB/page */ 337 unsigned short udb_density; /* # of user DB/page */
338 unsigned short ucq_density; /* # of user CQs/page */ 338 unsigned short ucq_density; /* # of user CQs/page */
339 unsigned int sge_host_page_size; /* SGE host page size */
339 unsigned short filt_mode; /* filter optional components */ 340 unsigned short filt_mode; /* filter optional components */
340 unsigned short tx_modq[NCHAN]; /* maps each tx channel to a */ 341 unsigned short tx_modq[NCHAN]; /* maps each tx channel to a */
341 /* scheduler queue */ 342 /* scheduler queue */
diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c
index c69ca95b1ad5..0f140a802137 100644
--- a/drivers/pinctrl/meson/pinctrl-meson8b.c
+++ b/drivers/pinctrl/meson/pinctrl-meson8b.c
@@ -693,7 +693,7 @@ static const char * const sd_a_groups[] = {
693 693
694static const char * const sdxc_a_groups[] = { 694static const char * const sdxc_a_groups[] = {
695 "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a", 695 "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a",
696 "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d0_13_1_a" 696 "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d13_1_a"
697}; 697};
698 698
699static const char * const pcm_a_groups[] = { 699static const char * const pcm_a_groups[] = {
diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c
index 7aae52a09ff0..4ffd56ff809e 100644
--- a/drivers/pinctrl/qcom/pinctrl-qcs404.c
+++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c
@@ -79,7 +79,7 @@ enum {
79 .intr_cfg_reg = 0, \ 79 .intr_cfg_reg = 0, \
80 .intr_status_reg = 0, \ 80 .intr_status_reg = 0, \
81 .intr_target_reg = 0, \ 81 .intr_target_reg = 0, \
82 .tile = NORTH, \ 82 .tile = SOUTH, \
83 .mux_bit = -1, \ 83 .mux_bit = -1, \
84 .pull_bit = pull, \ 84 .pull_bit = pull, \
85 .drv_bit = drv, \ 85 .drv_bit = drv, \
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index b8d325ce8754..120fc520f27a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1459,7 +1459,13 @@ static int iscsi_xmit_task(struct iscsi_conn *conn)
1459 if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) 1459 if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx))
1460 return -ENODATA; 1460 return -ENODATA;
1461 1461
1462 spin_lock_bh(&conn->session->back_lock);
1463 if (conn->task == NULL) {
1464 spin_unlock_bh(&conn->session->back_lock);
1465 return -ENODATA;
1466 }
1462 __iscsi_get_task(task); 1467 __iscsi_get_task(task);
1468 spin_unlock_bh(&conn->session->back_lock);
1463 spin_unlock_bh(&conn->session->frwd_lock); 1469 spin_unlock_bh(&conn->session->frwd_lock);
1464 rc = conn->session->tt->xmit_task(task); 1470 rc = conn->session->tt->xmit_task(task);
1465 spin_lock_bh(&conn->session->frwd_lock); 1471 spin_lock_bh(&conn->session->frwd_lock);
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 17eb4185f29d..f21c93bbb35c 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -828,6 +828,7 @@ static struct domain_device *sas_ex_discover_end_dev(
828 rphy = sas_end_device_alloc(phy->port); 828 rphy = sas_end_device_alloc(phy->port);
829 if (!rphy) 829 if (!rphy)
830 goto out_free; 830 goto out_free;
831 rphy->identify.phy_identifier = phy_id;
831 832
832 child->rphy = rphy; 833 child->rphy = rphy;
833 get_device(&rphy->dev); 834 get_device(&rphy->dev);
@@ -854,6 +855,7 @@ static struct domain_device *sas_ex_discover_end_dev(
854 855
855 child->rphy = rphy; 856 child->rphy = rphy;
856 get_device(&rphy->dev); 857 get_device(&rphy->dev);
858 rphy->identify.phy_identifier = phy_id;
857 sas_fill_in_rphy(child, rphy); 859 sas_fill_in_rphy(child, rphy);
858 860
859 list_add_tail(&child->disco_list_node, &parent->port->disco_list); 861 list_add_tail(&child->disco_list_node, &parent->port->disco_list);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6d65ac584eba..f8d51c3d5582 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -655,6 +655,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
655 set_host_byte(cmd, DID_OK); 655 set_host_byte(cmd, DID_OK);
656 return BLK_STS_TARGET; 656 return BLK_STS_TARGET;
657 case DID_NEXUS_FAILURE: 657 case DID_NEXUS_FAILURE:
658 set_host_byte(cmd, DID_OK);
658 return BLK_STS_NEXUS; 659 return BLK_STS_NEXUS;
659 case DID_ALLOC_FAILURE: 660 case DID_ALLOC_FAILURE:
660 set_host_byte(cmd, DID_OK); 661 set_host_byte(cmd, DID_OK);
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index fff86940388b..a340af797a85 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -142,10 +142,12 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
142 return -EOPNOTSUPP; 142 return -EOPNOTSUPP;
143 143
144 /* 144 /*
145 * Get a reply buffer for the number of requested zones plus a header. 145 * Get a reply buffer for the number of requested zones plus a header,
146 * For ATA, buffers must be aligned to 512B. 146 * without exceeding the device maximum command size. For ATA disks,
147 * buffers must be aligned to 512B.
147 */ 148 */
148 buflen = roundup((nrz + 1) * 64, 512); 149 buflen = min(queue_max_hw_sectors(disk->queue) << 9,
150 roundup((nrz + 1) * 64, 512));
149 buf = kmalloc(buflen, gfp_mask); 151 buf = kmalloc(buflen, gfp_mask);
150 if (!buf) 152 if (!buf)
151 return -ENOMEM; 153 return -ENOMEM;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 041c27ea8de1..f74193da0e09 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -616,7 +616,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
616 capsnap->size); 616 capsnap->size);
617 617
618 spin_lock(&mdsc->snap_flush_lock); 618 spin_lock(&mdsc->snap_flush_lock);
619 list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); 619 if (list_empty(&ci->i_snap_flush_item))
620 list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list);
620 spin_unlock(&mdsc->snap_flush_lock); 621 spin_unlock(&mdsc->snap_flush_lock);
621 return 1; /* caller may want to ceph_flush_snaps */ 622 return 1; /* caller may want to ceph_flush_snaps */
622} 623}
diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index 3f23b6840547..bf34ddaa2ad7 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -44,6 +44,7 @@
44#include <linux/keyctl.h> 44#include <linux/keyctl.h>
45#include <linux/key-type.h> 45#include <linux/key-type.h>
46#include <keys/user-type.h> 46#include <keys/user-type.h>
47#include <keys/request_key_auth-type.h>
47#include <linux/module.h> 48#include <linux/module.h>
48 49
49#include "internal.h" 50#include "internal.h"
@@ -59,7 +60,7 @@ static struct key_type key_type_id_resolver_legacy;
59struct idmap_legacy_upcalldata { 60struct idmap_legacy_upcalldata {
60 struct rpc_pipe_msg pipe_msg; 61 struct rpc_pipe_msg pipe_msg;
61 struct idmap_msg idmap_msg; 62 struct idmap_msg idmap_msg;
62 struct key_construction *key_cons; 63 struct key *authkey;
63 struct idmap *idmap; 64 struct idmap *idmap;
64}; 65};
65 66
@@ -384,7 +385,7 @@ static const match_table_t nfs_idmap_tokens = {
384 { Opt_find_err, NULL } 385 { Opt_find_err, NULL }
385}; 386};
386 387
387static int nfs_idmap_legacy_upcall(struct key_construction *, const char *, void *); 388static int nfs_idmap_legacy_upcall(struct key *, void *);
388static ssize_t idmap_pipe_downcall(struct file *, const char __user *, 389static ssize_t idmap_pipe_downcall(struct file *, const char __user *,
389 size_t); 390 size_t);
390static void idmap_release_pipe(struct inode *); 391static void idmap_release_pipe(struct inode *);
@@ -549,11 +550,12 @@ nfs_idmap_prepare_pipe_upcall(struct idmap *idmap,
549static void 550static void
550nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret) 551nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret)
551{ 552{
552 struct key_construction *cons = idmap->idmap_upcall_data->key_cons; 553 struct key *authkey = idmap->idmap_upcall_data->authkey;
553 554
554 kfree(idmap->idmap_upcall_data); 555 kfree(idmap->idmap_upcall_data);
555 idmap->idmap_upcall_data = NULL; 556 idmap->idmap_upcall_data = NULL;
556 complete_request_key(cons, ret); 557 complete_request_key(authkey, ret);
558 key_put(authkey);
557} 559}
558 560
559static void 561static void
@@ -563,15 +565,14 @@ nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret)
563 nfs_idmap_complete_pipe_upcall_locked(idmap, ret); 565 nfs_idmap_complete_pipe_upcall_locked(idmap, ret);
564} 566}
565 567
566static int nfs_idmap_legacy_upcall(struct key_construction *cons, 568static int nfs_idmap_legacy_upcall(struct key *authkey, void *aux)
567 const char *op,
568 void *aux)
569{ 569{
570 struct idmap_legacy_upcalldata *data; 570 struct idmap_legacy_upcalldata *data;
571 struct request_key_auth *rka = get_request_key_auth(authkey);
571 struct rpc_pipe_msg *msg; 572 struct rpc_pipe_msg *msg;
572 struct idmap_msg *im; 573 struct idmap_msg *im;
573 struct idmap *idmap = (struct idmap *)aux; 574 struct idmap *idmap = (struct idmap *)aux;
574 struct key *key = cons->key; 575 struct key *key = rka->target_key;
575 int ret = -ENOKEY; 576 int ret = -ENOKEY;
576 577
577 if (!aux) 578 if (!aux)
@@ -586,7 +587,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
586 msg = &data->pipe_msg; 587 msg = &data->pipe_msg;
587 im = &data->idmap_msg; 588 im = &data->idmap_msg;
588 data->idmap = idmap; 589 data->idmap = idmap;
589 data->key_cons = cons; 590 data->authkey = key_get(authkey);
590 591
591 ret = nfs_idmap_prepare_message(key->description, idmap, im, msg); 592 ret = nfs_idmap_prepare_message(key->description, idmap, im, msg);
592 if (ret < 0) 593 if (ret < 0)
@@ -604,7 +605,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
604out2: 605out2:
605 kfree(data); 606 kfree(data);
606out1: 607out1:
607 complete_request_key(cons, ret); 608 complete_request_key(authkey, ret);
608 return ret; 609 return ret;
609} 610}
610 611
@@ -651,9 +652,10 @@ out:
651static ssize_t 652static ssize_t
652idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) 653idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
653{ 654{
655 struct request_key_auth *rka;
654 struct rpc_inode *rpci = RPC_I(file_inode(filp)); 656 struct rpc_inode *rpci = RPC_I(file_inode(filp));
655 struct idmap *idmap = (struct idmap *)rpci->private; 657 struct idmap *idmap = (struct idmap *)rpci->private;
656 struct key_construction *cons; 658 struct key *authkey;
657 struct idmap_msg im; 659 struct idmap_msg im;
658 size_t namelen_in; 660 size_t namelen_in;
659 int ret = -ENOKEY; 661 int ret = -ENOKEY;
@@ -665,7 +667,8 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
665 if (idmap->idmap_upcall_data == NULL) 667 if (idmap->idmap_upcall_data == NULL)
666 goto out_noupcall; 668 goto out_noupcall;
667 669
668 cons = idmap->idmap_upcall_data->key_cons; 670 authkey = idmap->idmap_upcall_data->authkey;
671 rka = get_request_key_auth(authkey);
669 672
670 if (mlen != sizeof(im)) { 673 if (mlen != sizeof(im)) {
671 ret = -ENOSPC; 674 ret = -ENOSPC;
@@ -690,9 +693,9 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
690 693
691 ret = nfs_idmap_read_and_verify_message(&im, 694 ret = nfs_idmap_read_and_verify_message(&im,
692 &idmap->idmap_upcall_data->idmap_msg, 695 &idmap->idmap_upcall_data->idmap_msg,
693 cons->key, cons->authkey); 696 rka->target_key, authkey);
694 if (ret >= 0) { 697 if (ret >= 0) {
695 key_set_timeout(cons->key, nfs_idmap_cache_timeout); 698 key_set_timeout(rka->target_key, nfs_idmap_cache_timeout);
696 ret = mlen; 699 ret = mlen;
697 } 700 }
698 701
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 633a63462573..f5ed9512d193 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1086,10 +1086,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
1086 1086
1087 task_lock(p); 1087 task_lock(p);
1088 if (!p->vfork_done && process_shares_mm(p, mm)) { 1088 if (!p->vfork_done && process_shares_mm(p, mm)) {
1089 pr_info("updating oom_score_adj for %d (%s) from %d to %d because it shares mm with %d (%s). Report if this is unexpected.\n",
1090 task_pid_nr(p), p->comm,
1091 p->signal->oom_score_adj, oom_adj,
1092 task_pid_nr(task), task->comm);
1093 p->signal->oom_score_adj = oom_adj; 1089 p->signal->oom_score_adj = oom_adj;
1094 if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE)) 1090 if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE))
1095 p->signal->oom_score_adj_min = (short)oom_adj; 1091 p->signal->oom_score_adj_min = (short)oom_adj;
diff --git a/include/keys/request_key_auth-type.h b/include/keys/request_key_auth-type.h
new file mode 100644
index 000000000000..a726dd3f1dc6
--- /dev/null
+++ b/include/keys/request_key_auth-type.h
@@ -0,0 +1,36 @@
1/* request_key authorisation token key type
2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_REQUEST_KEY_AUTH_TYPE_H
13#define _KEYS_REQUEST_KEY_AUTH_TYPE_H
14
15#include <linux/key.h>
16
17/*
18 * Authorisation record for request_key().
19 */
20struct request_key_auth {
21 struct key *target_key;
22 struct key *dest_keyring;
23 const struct cred *cred;
24 void *callout_info;
25 size_t callout_len;
26 pid_t pid;
27 char op[8];
28} __randomize_layout;
29
30static inline struct request_key_auth *get_request_key_auth(const struct key *key)
31{
32 return key->payload.data[0];
33}
34
35
36#endif /* _KEYS_REQUEST_KEY_AUTH_TYPE_H */
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index e098cbe27db5..12babe991594 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -31,7 +31,7 @@
31struct user_key_payload { 31struct user_key_payload {
32 struct rcu_head rcu; /* RCU destructor */ 32 struct rcu_head rcu; /* RCU destructor */
33 unsigned short datalen; /* length of this data */ 33 unsigned short datalen; /* length of this data */
34 char data[0]; /* actual data */ 34 char data[0] __aligned(__alignof__(u64)); /* actual data */
35}; 35};
36 36
37extern struct key_type key_type_user; 37extern struct key_type key_type_user;
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index bc9af551fc83..e49d1de0614e 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -21,15 +21,6 @@ struct kernel_pkey_query;
21struct kernel_pkey_params; 21struct kernel_pkey_params;
22 22
23/* 23/*
24 * key under-construction record
25 * - passed to the request_key actor if supplied
26 */
27struct key_construction {
28 struct key *key; /* key being constructed */
29 struct key *authkey;/* authorisation for key being constructed */
30};
31
32/*
33 * Pre-parsed payload, used by key add, update and instantiate. 24 * Pre-parsed payload, used by key add, update and instantiate.
34 * 25 *
35 * This struct will be cleared and data and datalen will be set with the data 26 * This struct will be cleared and data and datalen will be set with the data
@@ -50,8 +41,7 @@ struct key_preparsed_payload {
50 time64_t expiry; /* Expiry time of key */ 41 time64_t expiry; /* Expiry time of key */
51} __randomize_layout; 42} __randomize_layout;
52 43
53typedef int (*request_key_actor_t)(struct key_construction *key, 44typedef int (*request_key_actor_t)(struct key *auth_key, void *aux);
54 const char *op, void *aux);
55 45
56/* 46/*
57 * Preparsed matching criterion. 47 * Preparsed matching criterion.
@@ -181,20 +171,20 @@ extern int key_instantiate_and_link(struct key *key,
181 const void *data, 171 const void *data,
182 size_t datalen, 172 size_t datalen,
183 struct key *keyring, 173 struct key *keyring,
184 struct key *instkey); 174 struct key *authkey);
185extern int key_reject_and_link(struct key *key, 175extern int key_reject_and_link(struct key *key,
186 unsigned timeout, 176 unsigned timeout,
187 unsigned error, 177 unsigned error,
188 struct key *keyring, 178 struct key *keyring,
189 struct key *instkey); 179 struct key *authkey);
190extern void complete_request_key(struct key_construction *cons, int error); 180extern void complete_request_key(struct key *authkey, int error);
191 181
192static inline int key_negate_and_link(struct key *key, 182static inline int key_negate_and_link(struct key *key,
193 unsigned timeout, 183 unsigned timeout,
194 struct key *keyring, 184 struct key *keyring,
195 struct key *instkey) 185 struct key *authkey)
196{ 186{
197 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); 187 return key_reject_and_link(key, timeout, ENOKEY, keyring, authkey);
198} 188}
199 189
200extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); 190extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
diff --git a/init/initramfs.c b/init/initramfs.c
index 7cea802d00ef..fca899622937 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -550,6 +550,7 @@ skip:
550 initrd_end = 0; 550 initrd_end = 0;
551} 551}
552 552
553#ifdef CONFIG_BLK_DEV_RAM
553#define BUF_SIZE 1024 554#define BUF_SIZE 1024
554static void __init clean_rootfs(void) 555static void __init clean_rootfs(void)
555{ 556{
@@ -596,6 +597,7 @@ static void __init clean_rootfs(void)
596 ksys_close(fd); 597 ksys_close(fd);
597 kfree(buf); 598 kfree(buf);
598} 599}
600#endif
599 601
600static int __init populate_rootfs(void) 602static int __init populate_rootfs(void)
601{ 603{
@@ -638,10 +640,8 @@ static int __init populate_rootfs(void)
638 printk(KERN_INFO "Unpacking initramfs...\n"); 640 printk(KERN_INFO "Unpacking initramfs...\n");
639 err = unpack_to_rootfs((char *)initrd_start, 641 err = unpack_to_rootfs((char *)initrd_start,
640 initrd_end - initrd_start); 642 initrd_end - initrd_start);
641 if (err) { 643 if (err)
642 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); 644 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
643 clean_rootfs();
644 }
645 free_initrd(); 645 free_initrd();
646#endif 646#endif
647 } 647 }
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index c3484785b179..0e97ca9306ef 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -322,7 +322,7 @@ static bool update_stats(struct psi_group *group)
322 expires = group->next_update; 322 expires = group->next_update;
323 if (now < expires) 323 if (now < expires)
324 goto out; 324 goto out;
325 if (now - expires > psi_period) 325 if (now - expires >= psi_period)
326 missed_periods = div_u64(now - expires, psi_period); 326 missed_periods = div_u64(now - expires, psi_period);
327 327
328 /* 328 /*
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index c6659cb37033..59875eb278ea 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -768,9 +768,11 @@ all_leaves_cluster_together:
768 new_s0->index_key[i] = 768 new_s0->index_key[i] =
769 ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE); 769 ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);
770 770
771 blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK); 771 if (level & ASSOC_ARRAY_KEY_CHUNK_MASK) {
772 pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank); 772 blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
773 new_s0->index_key[keylen - 1] &= ~blank; 773 pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
774 new_s0->index_key[keylen - 1] &= ~blank;
775 }
774 776
775 /* This now reduces to a node splitting exercise for which we'll need 777 /* This now reduces to a node splitting exercise for which we'll need
776 * to regenerate the disparity table. 778 * to regenerate the disparity table.
diff --git a/mm/debug.c b/mm/debug.c
index 0abb987dad9b..1611cf00a137 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -44,7 +44,7 @@ const struct trace_print_flags vmaflag_names[] = {
44 44
45void __dump_page(struct page *page, const char *reason) 45void __dump_page(struct page *page, const char *reason)
46{ 46{
47 struct address_space *mapping = page_mapping(page); 47 struct address_space *mapping;
48 bool page_poisoned = PagePoisoned(page); 48 bool page_poisoned = PagePoisoned(page);
49 int mapcount; 49 int mapcount;
50 50
@@ -58,6 +58,8 @@ void __dump_page(struct page *page, const char *reason)
58 goto hex_only; 58 goto hex_only;
59 } 59 }
60 60
61 mapping = page_mapping(page);
62
61 /* 63 /*
62 * Avoid VM_BUG_ON() in page_mapcount(). 64 * Avoid VM_BUG_ON() in page_mapcount().
63 * page->_mapcount space in struct page is used by sl[aou]b pages to 65 * page->_mapcount space in struct page is used by sl[aou]b pages to
diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
index e2bb06c1b45e..5d1065efbd47 100644
--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -7,6 +7,8 @@ KCOV_INSTRUMENT := n
7 7
8CFLAGS_REMOVE_common.o = -pg 8CFLAGS_REMOVE_common.o = -pg
9CFLAGS_REMOVE_generic.o = -pg 9CFLAGS_REMOVE_generic.o = -pg
10CFLAGS_REMOVE_tags.o = -pg
11
10# Function splitter causes unnecessary splits in __asan_load1/__asan_store1 12# Function splitter causes unnecessary splits in __asan_load1/__asan_store1
11# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 13# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
12 14
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 73c9cbfdedf4..09b534fbba17 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -361,10 +361,15 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object)
361 * get different tags. 361 * get different tags.
362 */ 362 */
363static u8 assign_tag(struct kmem_cache *cache, const void *object, 363static u8 assign_tag(struct kmem_cache *cache, const void *object,
364 bool init, bool krealloc) 364 bool init, bool keep_tag)
365{ 365{
366 /* Reuse the same tag for krealloc'ed objects. */ 366 /*
367 if (krealloc) 367 * 1. When an object is kmalloc()'ed, two hooks are called:
368 * kasan_slab_alloc() and kasan_kmalloc(). We assign the
369 * tag only in the first one.
370 * 2. We reuse the same tag for krealloc'ed objects.
371 */
372 if (keep_tag)
368 return get_tag(object); 373 return get_tag(object);
369 374
370 /* 375 /*
@@ -405,12 +410,6 @@ void * __must_check kasan_init_slab_obj(struct kmem_cache *cache,
405 return (void *)object; 410 return (void *)object;
406} 411}
407 412
408void * __must_check kasan_slab_alloc(struct kmem_cache *cache, void *object,
409 gfp_t flags)
410{
411 return kasan_kmalloc(cache, object, cache->object_size, flags);
412}
413
414static inline bool shadow_invalid(u8 tag, s8 shadow_byte) 413static inline bool shadow_invalid(u8 tag, s8 shadow_byte)
415{ 414{
416 if (IS_ENABLED(CONFIG_KASAN_GENERIC)) 415 if (IS_ENABLED(CONFIG_KASAN_GENERIC))
@@ -467,7 +466,7 @@ bool kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip)
467} 466}
468 467
469static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, 468static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
470 size_t size, gfp_t flags, bool krealloc) 469 size_t size, gfp_t flags, bool keep_tag)
471{ 470{
472 unsigned long redzone_start; 471 unsigned long redzone_start;
473 unsigned long redzone_end; 472 unsigned long redzone_end;
@@ -485,7 +484,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
485 KASAN_SHADOW_SCALE_SIZE); 484 KASAN_SHADOW_SCALE_SIZE);
486 485
487 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS)) 486 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS))
488 tag = assign_tag(cache, object, false, krealloc); 487 tag = assign_tag(cache, object, false, keep_tag);
489 488
490 /* Tag is ignored in set_tag without CONFIG_KASAN_SW_TAGS */ 489 /* Tag is ignored in set_tag without CONFIG_KASAN_SW_TAGS */
491 kasan_unpoison_shadow(set_tag(object, tag), size); 490 kasan_unpoison_shadow(set_tag(object, tag), size);
@@ -498,10 +497,16 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
498 return set_tag(object, tag); 497 return set_tag(object, tag);
499} 498}
500 499
500void * __must_check kasan_slab_alloc(struct kmem_cache *cache, void *object,
501 gfp_t flags)
502{
503 return __kasan_kmalloc(cache, object, cache->object_size, flags, false);
504}
505
501void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object, 506void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
502 size_t size, gfp_t flags) 507 size_t size, gfp_t flags)
503{ 508{
504 return __kasan_kmalloc(cache, object, size, flags, false); 509 return __kasan_kmalloc(cache, object, size, flags, true);
505} 510}
506EXPORT_SYMBOL(kasan_kmalloc); 511EXPORT_SYMBOL(kasan_kmalloc);
507 512
diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index 0777649e07c4..63fca3172659 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -46,7 +46,7 @@ void kasan_init_tags(void)
46 int cpu; 46 int cpu;
47 47
48 for_each_possible_cpu(cpu) 48 for_each_possible_cpu(cpu)
49 per_cpu(prng_state, cpu) = get_random_u32(); 49 per_cpu(prng_state, cpu) = (u32)get_cycles();
50} 50}
51 51
52/* 52/*
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index f9d9dc250428..707fa5579f66 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -574,6 +574,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
574 unsigned long flags; 574 unsigned long flags;
575 struct kmemleak_object *object, *parent; 575 struct kmemleak_object *object, *parent;
576 struct rb_node **link, *rb_parent; 576 struct rb_node **link, *rb_parent;
577 unsigned long untagged_ptr;
577 578
578 object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp)); 579 object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
579 if (!object) { 580 if (!object) {
@@ -619,8 +620,9 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
619 620
620 write_lock_irqsave(&kmemleak_lock, flags); 621 write_lock_irqsave(&kmemleak_lock, flags);
621 622
622 min_addr = min(min_addr, ptr); 623 untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr);
623 max_addr = max(max_addr, ptr + size); 624 min_addr = min(min_addr, untagged_ptr);
625 max_addr = max(max_addr, untagged_ptr + size);
624 link = &object_tree_root.rb_node; 626 link = &object_tree_root.rb_node;
625 rb_parent = NULL; 627 rb_parent = NULL;
626 while (*link) { 628 while (*link) {
@@ -1333,6 +1335,7 @@ static void scan_block(void *_start, void *_end,
1333 unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER); 1335 unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER);
1334 unsigned long *end = _end - (BYTES_PER_POINTER - 1); 1336 unsigned long *end = _end - (BYTES_PER_POINTER - 1);
1335 unsigned long flags; 1337 unsigned long flags;
1338 unsigned long untagged_ptr;
1336 1339
1337 read_lock_irqsave(&kmemleak_lock, flags); 1340 read_lock_irqsave(&kmemleak_lock, flags);
1338 for (ptr = start; ptr < end; ptr++) { 1341 for (ptr = start; ptr < end; ptr++) {
@@ -1347,7 +1350,8 @@ static void scan_block(void *_start, void *_end,
1347 pointer = *ptr; 1350 pointer = *ptr;
1348 kasan_enable_current(); 1351 kasan_enable_current();
1349 1352
1350 if (pointer < min_addr || pointer >= max_addr) 1353 untagged_ptr = (unsigned long)kasan_reset_tag((void *)pointer);
1354 if (untagged_ptr < min_addr || untagged_ptr >= max_addr)
1351 continue; 1355 continue;
1352 1356
1353 /* 1357 /*
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 124e794867c5..1ad28323fb9f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1188,11 +1188,13 @@ static inline int pageblock_free(struct page *page)
1188 return PageBuddy(page) && page_order(page) >= pageblock_order; 1188 return PageBuddy(page) && page_order(page) >= pageblock_order;
1189} 1189}
1190 1190
1191/* Return the start of the next active pageblock after a given page */ 1191/* Return the pfn of the start of the next active pageblock after a given pfn */
1192static struct page *next_active_pageblock(struct page *page) 1192static unsigned long next_active_pageblock(unsigned long pfn)
1193{ 1193{
1194 struct page *page = pfn_to_page(pfn);
1195
1194 /* Ensure the starting page is pageblock-aligned */ 1196 /* Ensure the starting page is pageblock-aligned */
1195 BUG_ON(page_to_pfn(page) & (pageblock_nr_pages - 1)); 1197 BUG_ON(pfn & (pageblock_nr_pages - 1));
1196 1198
1197 /* If the entire pageblock is free, move to the end of free page */ 1199 /* If the entire pageblock is free, move to the end of free page */
1198 if (pageblock_free(page)) { 1200 if (pageblock_free(page)) {
@@ -1200,16 +1202,16 @@ static struct page *next_active_pageblock(struct page *page)
1200 /* be careful. we don't have locks, page_order can be changed.*/ 1202 /* be careful. we don't have locks, page_order can be changed.*/
1201 order = page_order(page); 1203 order = page_order(page);
1202 if ((order < MAX_ORDER) && (order >= pageblock_order)) 1204 if ((order < MAX_ORDER) && (order >= pageblock_order))
1203 return page + (1 << order); 1205 return pfn + (1 << order);
1204 } 1206 }
1205 1207
1206 return page + pageblock_nr_pages; 1208 return pfn + pageblock_nr_pages;
1207} 1209}
1208 1210
1209static bool is_pageblock_removable_nolock(struct page *page) 1211static bool is_pageblock_removable_nolock(unsigned long pfn)
1210{ 1212{
1213 struct page *page = pfn_to_page(pfn);
1211 struct zone *zone; 1214 struct zone *zone;
1212 unsigned long pfn;
1213 1215
1214 /* 1216 /*
1215 * We have to be careful here because we are iterating over memory 1217 * We have to be careful here because we are iterating over memory
@@ -1232,13 +1234,14 @@ static bool is_pageblock_removable_nolock(struct page *page)
1232/* Checks if this range of memory is likely to be hot-removable. */ 1234/* Checks if this range of memory is likely to be hot-removable. */
1233bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) 1235bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
1234{ 1236{
1235 struct page *page = pfn_to_page(start_pfn); 1237 unsigned long end_pfn, pfn;
1236 unsigned long end_pfn = min(start_pfn + nr_pages, zone_end_pfn(page_zone(page))); 1238
1237 struct page *end_page = pfn_to_page(end_pfn); 1239 end_pfn = min(start_pfn + nr_pages,
1240 zone_end_pfn(page_zone(pfn_to_page(start_pfn))));
1238 1241
1239 /* Check the starting page of each pageblock within the range */ 1242 /* Check the starting page of each pageblock within the range */
1240 for (; page < end_page; page = next_active_pageblock(page)) { 1243 for (pfn = start_pfn; pfn < end_pfn; pfn = next_active_pageblock(pfn)) {
1241 if (!is_pageblock_removable_nolock(page)) 1244 if (!is_pageblock_removable_nolock(pfn))
1242 return false; 1245 return false;
1243 cond_resched(); 1246 cond_resched();
1244 } 1247 }
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d4496d9d34f5..ee2bce59d2bf 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1314,7 +1314,7 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
1314 nodemask_t *nodes) 1314 nodemask_t *nodes)
1315{ 1315{
1316 unsigned long copy = ALIGN(maxnode-1, 64) / 8; 1316 unsigned long copy = ALIGN(maxnode-1, 64) / 8;
1317 const int nbytes = BITS_TO_LONGS(MAX_NUMNODES) * sizeof(long); 1317 unsigned int nbytes = BITS_TO_LONGS(nr_node_ids) * sizeof(long);
1318 1318
1319 if (copy > nbytes) { 1319 if (copy > nbytes) {
1320 if (copy > PAGE_SIZE) 1320 if (copy > PAGE_SIZE)
@@ -1491,7 +1491,7 @@ static int kernel_get_mempolicy(int __user *policy,
1491 int uninitialized_var(pval); 1491 int uninitialized_var(pval);
1492 nodemask_t nodes; 1492 nodemask_t nodes;
1493 1493
1494 if (nmask != NULL && maxnode < MAX_NUMNODES) 1494 if (nmask != NULL && maxnode < nr_node_ids)
1495 return -EINVAL; 1495 return -EINVAL;
1496 1496
1497 err = do_get_mempolicy(&pval, &nodes, addr, flags); 1497 err = do_get_mempolicy(&pval, &nodes, addr, flags);
@@ -1527,7 +1527,7 @@ COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1527 unsigned long nr_bits, alloc_size; 1527 unsigned long nr_bits, alloc_size;
1528 DECLARE_BITMAP(bm, MAX_NUMNODES); 1528 DECLARE_BITMAP(bm, MAX_NUMNODES);
1529 1529
1530 nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES); 1530 nr_bits = min_t(unsigned long, maxnode-1, nr_node_ids);
1531 alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8; 1531 alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
1532 1532
1533 if (nmask) 1533 if (nmask)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7f79b78bc829..0b9f577b1a2a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2170,6 +2170,18 @@ static inline void boost_watermark(struct zone *zone)
2170 2170
2171 max_boost = mult_frac(zone->_watermark[WMARK_HIGH], 2171 max_boost = mult_frac(zone->_watermark[WMARK_HIGH],
2172 watermark_boost_factor, 10000); 2172 watermark_boost_factor, 10000);
2173
2174 /*
2175 * high watermark may be uninitialised if fragmentation occurs
2176 * very early in boot so do not boost. We do not fall
2177 * through and boost by pageblock_nr_pages as failing
2178 * allocations that early means that reclaim is not going
2179 * to help and it may even be impossible to reclaim the
2180 * boosted watermark resulting in a hang.
2181 */
2182 if (!max_boost)
2183 return;
2184
2173 max_boost = max(pageblock_nr_pages, max_boost); 2185 max_boost = max(pageblock_nr_pages, max_boost);
2174 2186
2175 zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages, 2187 zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages,
diff --git a/mm/shmem.c b/mm/shmem.c
index 6ece1e2fe76e..0905215fb016 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2854,10 +2854,14 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
2854 * No ordinary (disk based) filesystem counts links as inodes; 2854 * No ordinary (disk based) filesystem counts links as inodes;
2855 * but each new link needs a new dentry, pinning lowmem, and 2855 * but each new link needs a new dentry, pinning lowmem, and
2856 * tmpfs dentries cannot be pruned until they are unlinked. 2856 * tmpfs dentries cannot be pruned until they are unlinked.
2857 * But if an O_TMPFILE file is linked into the tmpfs, the
2858 * first link must skip that, to get the accounting right.
2857 */ 2859 */
2858 ret = shmem_reserve_inode(inode->i_sb); 2860 if (inode->i_nlink) {
2859 if (ret) 2861 ret = shmem_reserve_inode(inode->i_sb);
2860 goto out; 2862 if (ret)
2863 goto out;
2864 }
2861 2865
2862 dir->i_size += BOGO_DIRENT_SIZE; 2866 dir->i_size += BOGO_DIRENT_SIZE;
2863 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 2867 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
diff --git a/mm/slab.c b/mm/slab.c
index 78eb8c5bf4e4..91c1863df93d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2359,7 +2359,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
2359 void *freelist; 2359 void *freelist;
2360 void *addr = page_address(page); 2360 void *addr = page_address(page);
2361 2361
2362 page->s_mem = kasan_reset_tag(addr) + colour_off; 2362 page->s_mem = addr + colour_off;
2363 page->active = 0; 2363 page->active = 0;
2364 2364
2365 if (OBJFREELIST_SLAB(cachep)) 2365 if (OBJFREELIST_SLAB(cachep))
@@ -2368,6 +2368,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
2368 /* Slab management obj is off-slab. */ 2368 /* Slab management obj is off-slab. */
2369 freelist = kmem_cache_alloc_node(cachep->freelist_cache, 2369 freelist = kmem_cache_alloc_node(cachep->freelist_cache,
2370 local_flags, nodeid); 2370 local_flags, nodeid);
2371 freelist = kasan_reset_tag(freelist);
2371 if (!freelist) 2372 if (!freelist)
2372 return NULL; 2373 return NULL;
2373 } else { 2374 } else {
@@ -2681,6 +2682,13 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
2681 2682
2682 offset *= cachep->colour_off; 2683 offset *= cachep->colour_off;
2683 2684
2685 /*
2686 * Call kasan_poison_slab() before calling alloc_slabmgmt(), so
2687 * page_address() in the latter returns a non-tagged pointer,
2688 * as it should be for slab pages.
2689 */
2690 kasan_poison_slab(page);
2691
2684 /* Get slab management. */ 2692 /* Get slab management. */
2685 freelist = alloc_slabmgmt(cachep, page, offset, 2693 freelist = alloc_slabmgmt(cachep, page, offset,
2686 local_flags & ~GFP_CONSTRAINT_MASK, page_node); 2694 local_flags & ~GFP_CONSTRAINT_MASK, page_node);
@@ -2689,7 +2697,6 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
2689 2697
2690 slab_map_pages(cachep, page, freelist); 2698 slab_map_pages(cachep, page, freelist);
2691 2699
2692 kasan_poison_slab(page);
2693 cache_init_objs(cachep, page); 2700 cache_init_objs(cachep, page);
2694 2701
2695 if (gfpflags_allow_blocking(local_flags)) 2702 if (gfpflags_allow_blocking(local_flags))
@@ -3540,7 +3547,6 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
3540{ 3547{
3541 void *ret = slab_alloc(cachep, flags, _RET_IP_); 3548 void *ret = slab_alloc(cachep, flags, _RET_IP_);
3542 3549
3543 ret = kasan_slab_alloc(cachep, ret, flags);
3544 trace_kmem_cache_alloc(_RET_IP_, ret, 3550 trace_kmem_cache_alloc(_RET_IP_, ret,
3545 cachep->object_size, cachep->size, flags); 3551 cachep->object_size, cachep->size, flags);
3546 3552
@@ -3630,7 +3636,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
3630{ 3636{
3631 void *ret = slab_alloc_node(cachep, flags, nodeid, _RET_IP_); 3637 void *ret = slab_alloc_node(cachep, flags, nodeid, _RET_IP_);
3632 3638
3633 ret = kasan_slab_alloc(cachep, ret, flags);
3634 trace_kmem_cache_alloc_node(_RET_IP_, ret, 3639 trace_kmem_cache_alloc_node(_RET_IP_, ret,
3635 cachep->object_size, cachep->size, 3640 cachep->object_size, cachep->size,
3636 flags, nodeid); 3641 flags, nodeid);
@@ -4408,6 +4413,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page,
4408 unsigned int objnr; 4413 unsigned int objnr;
4409 unsigned long offset; 4414 unsigned long offset;
4410 4415
4416 ptr = kasan_reset_tag(ptr);
4417
4411 /* Find and validate object. */ 4418 /* Find and validate object. */
4412 cachep = page->slab_cache; 4419 cachep = page->slab_cache;
4413 objnr = obj_to_index(cachep, page, (void *)ptr); 4420 objnr = obj_to_index(cachep, page, (void *)ptr);
diff --git a/mm/slab.h b/mm/slab.h
index 4190c24ef0e9..384105318779 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -437,11 +437,10 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags,
437 437
438 flags &= gfp_allowed_mask; 438 flags &= gfp_allowed_mask;
439 for (i = 0; i < size; i++) { 439 for (i = 0; i < size; i++) {
440 void *object = p[i]; 440 p[i] = kasan_slab_alloc(s, p[i], flags);
441 441 /* As p[i] might get tagged, call kmemleak hook after KASAN. */
442 kmemleak_alloc_recursive(object, s->object_size, 1, 442 kmemleak_alloc_recursive(p[i], s->object_size, 1,
443 s->flags, flags); 443 s->flags, flags);
444 p[i] = kasan_slab_alloc(s, object, flags);
445 } 444 }
446 445
447 if (memcg_kmem_enabled()) 446 if (memcg_kmem_enabled())
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 81732d05e74a..f9d89c1b5977 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1228,8 +1228,9 @@ void *kmalloc_order(size_t size, gfp_t flags, unsigned int order)
1228 flags |= __GFP_COMP; 1228 flags |= __GFP_COMP;
1229 page = alloc_pages(flags, order); 1229 page = alloc_pages(flags, order);
1230 ret = page ? page_address(page) : NULL; 1230 ret = page ? page_address(page) : NULL;
1231 kmemleak_alloc(ret, size, 1, flags);
1232 ret = kasan_kmalloc_large(ret, size, flags); 1231 ret = kasan_kmalloc_large(ret, size, flags);
1232 /* As ret might get tagged, call kmemleak hook after KASAN. */
1233 kmemleak_alloc(ret, size, 1, flags);
1233 return ret; 1234 return ret;
1234} 1235}
1235EXPORT_SYMBOL(kmalloc_order); 1236EXPORT_SYMBOL(kmalloc_order);
diff --git a/mm/slub.c b/mm/slub.c
index 1e3d0ec4e200..dc777761b6b7 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -249,7 +249,18 @@ static inline void *freelist_ptr(const struct kmem_cache *s, void *ptr,
249 unsigned long ptr_addr) 249 unsigned long ptr_addr)
250{ 250{
251#ifdef CONFIG_SLAB_FREELIST_HARDENED 251#ifdef CONFIG_SLAB_FREELIST_HARDENED
252 return (void *)((unsigned long)ptr ^ s->random ^ ptr_addr); 252 /*
253 * When CONFIG_KASAN_SW_TAGS is enabled, ptr_addr might be tagged.
254 * Normally, this doesn't cause any issues, as both set_freepointer()
255 * and get_freepointer() are called with a pointer with the same tag.
256 * However, there are some issues with CONFIG_SLUB_DEBUG code. For
257 * example, when __free_slub() iterates over objects in a cache, it
258 * passes untagged pointers to check_object(). check_object() in turns
259 * calls get_freepointer() with an untagged pointer, which causes the
260 * freepointer to be restored incorrectly.
261 */
262 return (void *)((unsigned long)ptr ^ s->random ^
263 (unsigned long)kasan_reset_tag((void *)ptr_addr));
253#else 264#else
254 return ptr; 265 return ptr;
255#endif 266#endif
@@ -303,15 +314,10 @@ static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp)
303 __p < (__addr) + (__objects) * (__s)->size; \ 314 __p < (__addr) + (__objects) * (__s)->size; \
304 __p += (__s)->size) 315 __p += (__s)->size)
305 316
306#define for_each_object_idx(__p, __idx, __s, __addr, __objects) \
307 for (__p = fixup_red_left(__s, __addr), __idx = 1; \
308 __idx <= __objects; \
309 __p += (__s)->size, __idx++)
310
311/* Determine object index from a given position */ 317/* Determine object index from a given position */
312static inline unsigned int slab_index(void *p, struct kmem_cache *s, void *addr) 318static inline unsigned int slab_index(void *p, struct kmem_cache *s, void *addr)
313{ 319{
314 return (p - addr) / s->size; 320 return (kasan_reset_tag(p) - addr) / s->size;
315} 321}
316 322
317static inline unsigned int order_objects(unsigned int order, unsigned int size) 323static inline unsigned int order_objects(unsigned int order, unsigned int size)
@@ -507,6 +513,7 @@ static inline int check_valid_pointer(struct kmem_cache *s,
507 return 1; 513 return 1;
508 514
509 base = page_address(page); 515 base = page_address(page);
516 object = kasan_reset_tag(object);
510 object = restore_red_left(s, object); 517 object = restore_red_left(s, object);
511 if (object < base || object >= base + page->objects * s->size || 518 if (object < base || object >= base + page->objects * s->size ||
512 (object - base) % s->size) { 519 (object - base) % s->size) {
@@ -1075,6 +1082,16 @@ static void setup_object_debug(struct kmem_cache *s, struct page *page,
1075 init_tracking(s, object); 1082 init_tracking(s, object);
1076} 1083}
1077 1084
1085static void setup_page_debug(struct kmem_cache *s, void *addr, int order)
1086{
1087 if (!(s->flags & SLAB_POISON))
1088 return;
1089
1090 metadata_access_enable();
1091 memset(addr, POISON_INUSE, PAGE_SIZE << order);
1092 metadata_access_disable();
1093}
1094
1078static inline int alloc_consistency_checks(struct kmem_cache *s, 1095static inline int alloc_consistency_checks(struct kmem_cache *s,
1079 struct page *page, 1096 struct page *page,
1080 void *object, unsigned long addr) 1097 void *object, unsigned long addr)
@@ -1330,6 +1347,8 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,
1330#else /* !CONFIG_SLUB_DEBUG */ 1347#else /* !CONFIG_SLUB_DEBUG */
1331static inline void setup_object_debug(struct kmem_cache *s, 1348static inline void setup_object_debug(struct kmem_cache *s,
1332 struct page *page, void *object) {} 1349 struct page *page, void *object) {}
1350static inline void setup_page_debug(struct kmem_cache *s,
1351 void *addr, int order) {}
1333 1352
1334static inline int alloc_debug_processing(struct kmem_cache *s, 1353static inline int alloc_debug_processing(struct kmem_cache *s,
1335 struct page *page, void *object, unsigned long addr) { return 0; } 1354 struct page *page, void *object, unsigned long addr) { return 0; }
@@ -1374,8 +1393,10 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node,
1374 */ 1393 */
1375static inline void *kmalloc_large_node_hook(void *ptr, size_t size, gfp_t flags) 1394static inline void *kmalloc_large_node_hook(void *ptr, size_t size, gfp_t flags)
1376{ 1395{
1396 ptr = kasan_kmalloc_large(ptr, size, flags);
1397 /* As ptr might get tagged, call kmemleak hook after KASAN. */
1377 kmemleak_alloc(ptr, size, 1, flags); 1398 kmemleak_alloc(ptr, size, 1, flags);
1378 return kasan_kmalloc_large(ptr, size, flags); 1399 return ptr;
1379} 1400}
1380 1401
1381static __always_inline void kfree_hook(void *x) 1402static __always_inline void kfree_hook(void *x)
@@ -1641,27 +1662,25 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
1641 if (page_is_pfmemalloc(page)) 1662 if (page_is_pfmemalloc(page))
1642 SetPageSlabPfmemalloc(page); 1663 SetPageSlabPfmemalloc(page);
1643 1664
1665 kasan_poison_slab(page);
1666
1644 start = page_address(page); 1667 start = page_address(page);
1645 1668
1646 if (unlikely(s->flags & SLAB_POISON)) 1669 setup_page_debug(s, start, order);
1647 memset(start, POISON_INUSE, PAGE_SIZE << order);
1648
1649 kasan_poison_slab(page);
1650 1670
1651 shuffle = shuffle_freelist(s, page); 1671 shuffle = shuffle_freelist(s, page);
1652 1672
1653 if (!shuffle) { 1673 if (!shuffle) {
1654 for_each_object_idx(p, idx, s, start, page->objects) {
1655 if (likely(idx < page->objects)) {
1656 next = p + s->size;
1657 next = setup_object(s, page, next);
1658 set_freepointer(s, p, next);
1659 } else
1660 set_freepointer(s, p, NULL);
1661 }
1662 start = fixup_red_left(s, start); 1674 start = fixup_red_left(s, start);
1663 start = setup_object(s, page, start); 1675 start = setup_object(s, page, start);
1664 page->freelist = start; 1676 page->freelist = start;
1677 for (idx = 0, p = start; idx < page->objects - 1; idx++) {
1678 next = p + s->size;
1679 next = setup_object(s, page, next);
1680 set_freepointer(s, p, next);
1681 p = next;
1682 }
1683 set_freepointer(s, p, NULL);
1665 } 1684 }
1666 1685
1667 page->inuse = page->objects; 1686 page->inuse = page->objects;
diff --git a/mm/swap.c b/mm/swap.c
index 4929bc1be60e..4d7d37eb3c40 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -320,11 +320,6 @@ static inline void activate_page_drain(int cpu)
320{ 320{
321} 321}
322 322
323static bool need_activate_page_drain(int cpu)
324{
325 return false;
326}
327
328void activate_page(struct page *page) 323void activate_page(struct page *page)
329{ 324{
330 struct zone *zone = page_zone(page); 325 struct zone *zone = page_zone(page);
@@ -653,13 +648,15 @@ void lru_add_drain(void)
653 put_cpu(); 648 put_cpu();
654} 649}
655 650
651#ifdef CONFIG_SMP
652
653static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
654
656static void lru_add_drain_per_cpu(struct work_struct *dummy) 655static void lru_add_drain_per_cpu(struct work_struct *dummy)
657{ 656{
658 lru_add_drain(); 657 lru_add_drain();
659} 658}
660 659
661static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
662
663/* 660/*
664 * Doesn't need any cpu hotplug locking because we do rely on per-cpu 661 * Doesn't need any cpu hotplug locking because we do rely on per-cpu
665 * kworkers being shut down before our page_alloc_cpu_dead callback is 662 * kworkers being shut down before our page_alloc_cpu_dead callback is
@@ -702,6 +699,12 @@ void lru_add_drain_all(void)
702 699
703 mutex_unlock(&lock); 700 mutex_unlock(&lock);
704} 701}
702#else
703void lru_add_drain_all(void)
704{
705 lru_add_drain();
706}
707#endif
705 708
706/** 709/**
707 * release_pages - batched put_page() 710 * release_pages - batched put_page()
diff --git a/mm/util.c b/mm/util.c
index 1ea055138043..379319b1bcfd 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -150,7 +150,7 @@ void *memdup_user(const void __user *src, size_t len)
150{ 150{
151 void *p; 151 void *p;
152 152
153 p = kmalloc_track_caller(len, GFP_USER); 153 p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN);
154 if (!p) 154 if (!p)
155 return ERR_PTR(-ENOMEM); 155 return ERR_PTR(-ENOMEM);
156 156
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 3661cdd927f1..7e71b0df1fbc 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2058,6 +2058,8 @@ static int process_connect(struct ceph_connection *con)
2058 dout("process_connect on %p tag %d\n", con, (int)con->in_tag); 2058 dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
2059 2059
2060 if (con->auth) { 2060 if (con->auth) {
2061 int len = le32_to_cpu(con->in_reply.authorizer_len);
2062
2061 /* 2063 /*
2062 * Any connection that defines ->get_authorizer() 2064 * Any connection that defines ->get_authorizer()
2063 * should also define ->add_authorizer_challenge() and 2065 * should also define ->add_authorizer_challenge() and
@@ -2067,8 +2069,7 @@ static int process_connect(struct ceph_connection *con)
2067 */ 2069 */
2068 if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) { 2070 if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) {
2069 ret = con->ops->add_authorizer_challenge( 2071 ret = con->ops->add_authorizer_challenge(
2070 con, con->auth->authorizer_reply_buf, 2072 con, con->auth->authorizer_reply_buf, len);
2071 le32_to_cpu(con->in_reply.authorizer_len));
2072 if (ret < 0) 2073 if (ret < 0)
2073 return ret; 2074 return ret;
2074 2075
@@ -2078,10 +2079,12 @@ static int process_connect(struct ceph_connection *con)
2078 return 0; 2079 return 0;
2079 } 2080 }
2080 2081
2081 ret = con->ops->verify_authorizer_reply(con); 2082 if (len) {
2082 if (ret < 0) { 2083 ret = con->ops->verify_authorizer_reply(con);
2083 con->error_msg = "bad authorize reply"; 2084 if (ret < 0) {
2084 return ret; 2085 con->error_msg = "bad authorize reply";
2086 return ret;
2087 }
2085 } 2088 }
2086 } 2089 }
2087 2090
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 77cebad0474e..f75e7bda4889 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -118,8 +118,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
118 fprintf(stderr, "Read error or end of file.\n"); 118 fprintf(stderr, "Read error or end of file.\n");
119 return -1; 119 return -1;
120 } 120 }
121 if (strlen(sym) > KSYM_NAME_LEN) { 121 if (strlen(sym) >= KSYM_NAME_LEN) {
122 fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" 122 fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n"
123 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", 123 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
124 sym, strlen(sym), KSYM_NAME_LEN); 124 sym, strlen(sym), KSYM_NAME_LEN);
125 return -1; 125 return -1;
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 479909b858c7..8f533c81aa8d 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -186,20 +186,9 @@ static inline int key_permission(const key_ref_t key_ref, unsigned perm)
186 return key_task_permission(key_ref, current_cred(), perm); 186 return key_task_permission(key_ref, current_cred(), perm);
187} 187}
188 188
189/*
190 * Authorisation record for request_key().
191 */
192struct request_key_auth {
193 struct key *target_key;
194 struct key *dest_keyring;
195 const struct cred *cred;
196 void *callout_info;
197 size_t callout_len;
198 pid_t pid;
199} __randomize_layout;
200
201extern struct key_type key_type_request_key_auth; 189extern struct key_type key_type_request_key_auth;
202extern struct key *request_key_auth_new(struct key *target, 190extern struct key *request_key_auth_new(struct key *target,
191 const char *op,
203 const void *callout_info, 192 const void *callout_info,
204 size_t callout_len, 193 size_t callout_len,
205 struct key *dest_keyring); 194 struct key *dest_keyring);
diff --git a/security/keys/key.c b/security/keys/key.c
index 44a80d6741a1..696f1c092c50 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -265,8 +265,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
265 265
266 spin_lock(&user->lock); 266 spin_lock(&user->lock);
267 if (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) { 267 if (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) {
268 if (user->qnkeys + 1 >= maxkeys || 268 if (user->qnkeys + 1 > maxkeys ||
269 user->qnbytes + quotalen >= maxbytes || 269 user->qnbytes + quotalen > maxbytes ||
270 user->qnbytes + quotalen < user->qnbytes) 270 user->qnbytes + quotalen < user->qnbytes)
271 goto no_quota; 271 goto no_quota;
272 } 272 }
@@ -297,6 +297,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
297 key->gid = gid; 297 key->gid = gid;
298 key->perm = perm; 298 key->perm = perm;
299 key->restrict_link = restrict_link; 299 key->restrict_link = restrict_link;
300 key->last_used_at = ktime_get_real_seconds();
300 301
301 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) 302 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
302 key->flags |= 1 << KEY_FLAG_IN_QUOTA; 303 key->flags |= 1 << KEY_FLAG_IN_QUOTA;
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index e8093d025966..7bbe03593e58 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -25,6 +25,7 @@
25#include <linux/security.h> 25#include <linux/security.h>
26#include <linux/uio.h> 26#include <linux/uio.h>
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <keys/request_key_auth-type.h>
28#include "internal.h" 29#include "internal.h"
29 30
30#define KEY_MAX_DESC_SIZE 4096 31#define KEY_MAX_DESC_SIZE 4096
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index eadebb92986a..f81372f53dd7 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -661,9 +661,6 @@ static bool search_nested_keyrings(struct key *keyring,
661 BUG_ON((ctx->flags & STATE_CHECKS) == 0 || 661 BUG_ON((ctx->flags & STATE_CHECKS) == 0 ||
662 (ctx->flags & STATE_CHECKS) == STATE_CHECKS); 662 (ctx->flags & STATE_CHECKS) == STATE_CHECKS);
663 663
664 if (ctx->index_key.description)
665 ctx->index_key.desc_len = strlen(ctx->index_key.description);
666
667 /* Check to see if this top-level keyring is what we are looking for 664 /* Check to see if this top-level keyring is what we are looking for
668 * and whether it is valid or not. 665 * and whether it is valid or not.
669 */ 666 */
@@ -914,6 +911,7 @@ key_ref_t keyring_search(key_ref_t keyring,
914 struct keyring_search_context ctx = { 911 struct keyring_search_context ctx = {
915 .index_key.type = type, 912 .index_key.type = type,
916 .index_key.description = description, 913 .index_key.description = description,
914 .index_key.desc_len = strlen(description),
917 .cred = current_cred(), 915 .cred = current_cred(),
918 .match_data.cmp = key_default_cmp, 916 .match_data.cmp = key_default_cmp,
919 .match_data.raw_data = description, 917 .match_data.raw_data = description,
diff --git a/security/keys/proc.c b/security/keys/proc.c
index d2b802072693..78ac305d715e 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -165,8 +165,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
165 int rc; 165 int rc;
166 166
167 struct keyring_search_context ctx = { 167 struct keyring_search_context ctx = {
168 .index_key.type = key->type, 168 .index_key = key->index_key,
169 .index_key.description = key->description,
170 .cred = m->file->f_cred, 169 .cred = m->file->f_cred,
171 .match_data.cmp = lookup_user_key_possessed, 170 .match_data.cmp = lookup_user_key_possessed,
172 .match_data.raw_data = key, 171 .match_data.raw_data = key,
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 02c77e928f68..0e0b9ccad2f8 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -19,6 +19,7 @@
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/user_namespace.h> 20#include <linux/user_namespace.h>
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <keys/request_key_auth-type.h>
22#include "internal.h" 23#include "internal.h"
23 24
24/* Session keyring create vs join semaphore */ 25/* Session keyring create vs join semaphore */
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 301f0e300dbd..7a0c6b666ff0 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -18,31 +18,30 @@
18#include <linux/keyctl.h> 18#include <linux/keyctl.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "internal.h" 20#include "internal.h"
21#include <keys/request_key_auth-type.h>
21 22
22#define key_negative_timeout 60 /* default timeout on a negative key's existence */ 23#define key_negative_timeout 60 /* default timeout on a negative key's existence */
23 24
24/** 25/**
25 * complete_request_key - Complete the construction of a key. 26 * complete_request_key - Complete the construction of a key.
26 * @cons: The key construction record. 27 * @auth_key: The authorisation key.
27 * @error: The success or failute of the construction. 28 * @error: The success or failute of the construction.
28 * 29 *
29 * Complete the attempt to construct a key. The key will be negated 30 * Complete the attempt to construct a key. The key will be negated
30 * if an error is indicated. The authorisation key will be revoked 31 * if an error is indicated. The authorisation key will be revoked
31 * unconditionally. 32 * unconditionally.
32 */ 33 */
33void complete_request_key(struct key_construction *cons, int error) 34void complete_request_key(struct key *authkey, int error)
34{ 35{
35 kenter("{%d,%d},%d", cons->key->serial, cons->authkey->serial, error); 36 struct request_key_auth *rka = get_request_key_auth(authkey);
37 struct key *key = rka->target_key;
38
39 kenter("%d{%d},%d", authkey->serial, key->serial, error);
36 40
37 if (error < 0) 41 if (error < 0)
38 key_negate_and_link(cons->key, key_negative_timeout, NULL, 42 key_negate_and_link(key, key_negative_timeout, NULL, authkey);
39 cons->authkey);
40 else 43 else
41 key_revoke(cons->authkey); 44 key_revoke(authkey);
42
43 key_put(cons->key);
44 key_put(cons->authkey);
45 kfree(cons);
46} 45}
47EXPORT_SYMBOL(complete_request_key); 46EXPORT_SYMBOL(complete_request_key);
48 47
@@ -91,21 +90,19 @@ static int call_usermodehelper_keys(const char *path, char **argv, char **envp,
91 * Request userspace finish the construction of a key 90 * Request userspace finish the construction of a key
92 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>" 91 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>"
93 */ 92 */
94static int call_sbin_request_key(struct key_construction *cons, 93static int call_sbin_request_key(struct key *authkey, void *aux)
95 const char *op,
96 void *aux)
97{ 94{
98 static char const request_key[] = "/sbin/request-key"; 95 static char const request_key[] = "/sbin/request-key";
96 struct request_key_auth *rka = get_request_key_auth(authkey);
99 const struct cred *cred = current_cred(); 97 const struct cred *cred = current_cred();
100 key_serial_t prkey, sskey; 98 key_serial_t prkey, sskey;
101 struct key *key = cons->key, *authkey = cons->authkey, *keyring, 99 struct key *key = rka->target_key, *keyring, *session;
102 *session;
103 char *argv[9], *envp[3], uid_str[12], gid_str[12]; 100 char *argv[9], *envp[3], uid_str[12], gid_str[12];
104 char key_str[12], keyring_str[3][12]; 101 char key_str[12], keyring_str[3][12];
105 char desc[20]; 102 char desc[20];
106 int ret, i; 103 int ret, i;
107 104
108 kenter("{%d},{%d},%s", key->serial, authkey->serial, op); 105 kenter("{%d},{%d},%s", key->serial, authkey->serial, rka->op);
109 106
110 ret = install_user_keyrings(); 107 ret = install_user_keyrings();
111 if (ret < 0) 108 if (ret < 0)
@@ -163,7 +160,7 @@ static int call_sbin_request_key(struct key_construction *cons,
163 /* set up the argument list */ 160 /* set up the argument list */
164 i = 0; 161 i = 0;
165 argv[i++] = (char *)request_key; 162 argv[i++] = (char *)request_key;
166 argv[i++] = (char *) op; 163 argv[i++] = (char *)rka->op;
167 argv[i++] = key_str; 164 argv[i++] = key_str;
168 argv[i++] = uid_str; 165 argv[i++] = uid_str;
169 argv[i++] = gid_str; 166 argv[i++] = gid_str;
@@ -191,7 +188,7 @@ error_link:
191 key_put(keyring); 188 key_put(keyring);
192 189
193error_alloc: 190error_alloc:
194 complete_request_key(cons, ret); 191 complete_request_key(authkey, ret);
195 kleave(" = %d", ret); 192 kleave(" = %d", ret);
196 return ret; 193 return ret;
197} 194}
@@ -205,42 +202,31 @@ static int construct_key(struct key *key, const void *callout_info,
205 size_t callout_len, void *aux, 202 size_t callout_len, void *aux,
206 struct key *dest_keyring) 203 struct key *dest_keyring)
207{ 204{
208 struct key_construction *cons;
209 request_key_actor_t actor; 205 request_key_actor_t actor;
210 struct key *authkey; 206 struct key *authkey;
211 int ret; 207 int ret;
212 208
213 kenter("%d,%p,%zu,%p", key->serial, callout_info, callout_len, aux); 209 kenter("%d,%p,%zu,%p", key->serial, callout_info, callout_len, aux);
214 210
215 cons = kmalloc(sizeof(*cons), GFP_KERNEL);
216 if (!cons)
217 return -ENOMEM;
218
219 /* allocate an authorisation key */ 211 /* allocate an authorisation key */
220 authkey = request_key_auth_new(key, callout_info, callout_len, 212 authkey = request_key_auth_new(key, "create", callout_info, callout_len,
221 dest_keyring); 213 dest_keyring);
222 if (IS_ERR(authkey)) { 214 if (IS_ERR(authkey))
223 kfree(cons); 215 return PTR_ERR(authkey);
224 ret = PTR_ERR(authkey);
225 authkey = NULL;
226 } else {
227 cons->authkey = key_get(authkey);
228 cons->key = key_get(key);
229 216
230 /* make the call */ 217 /* Make the call */
231 actor = call_sbin_request_key; 218 actor = call_sbin_request_key;
232 if (key->type->request_key) 219 if (key->type->request_key)
233 actor = key->type->request_key; 220 actor = key->type->request_key;
234 221
235 ret = actor(cons, "create", aux); 222 ret = actor(authkey, aux);
236 223
237 /* check that the actor called complete_request_key() prior to 224 /* check that the actor called complete_request_key() prior to
238 * returning an error */ 225 * returning an error */
239 WARN_ON(ret < 0 && 226 WARN_ON(ret < 0 &&
240 !test_bit(KEY_FLAG_REVOKED, &authkey->flags)); 227 !test_bit(KEY_FLAG_REVOKED, &authkey->flags));
241 key_put(authkey);
242 }
243 228
229 key_put(authkey);
244 kleave(" = %d", ret); 230 kleave(" = %d", ret);
245 return ret; 231 return ret;
246} 232}
@@ -275,7 +261,7 @@ static int construct_get_dest_keyring(struct key **_dest_keyring)
275 if (cred->request_key_auth) { 261 if (cred->request_key_auth) {
276 authkey = cred->request_key_auth; 262 authkey = cred->request_key_auth;
277 down_read(&authkey->sem); 263 down_read(&authkey->sem);
278 rka = authkey->payload.data[0]; 264 rka = get_request_key_auth(authkey);
279 if (!test_bit(KEY_FLAG_REVOKED, 265 if (!test_bit(KEY_FLAG_REVOKED,
280 &authkey->flags)) 266 &authkey->flags))
281 dest_keyring = 267 dest_keyring =
@@ -545,6 +531,7 @@ struct key *request_key_and_link(struct key_type *type,
545 struct keyring_search_context ctx = { 531 struct keyring_search_context ctx = {
546 .index_key.type = type, 532 .index_key.type = type,
547 .index_key.description = description, 533 .index_key.description = description,
534 .index_key.desc_len = strlen(description),
548 .cred = current_cred(), 535 .cred = current_cred(),
549 .match_data.cmp = key_default_cmp, 536 .match_data.cmp = key_default_cmp,
550 .match_data.raw_data = description, 537 .match_data.raw_data = description,
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index 87ea2f54dedc..bda6201c6c45 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -17,7 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/uaccess.h> 18#include <linux/uaccess.h>
19#include "internal.h" 19#include "internal.h"
20#include <keys/user-type.h> 20#include <keys/request_key_auth-type.h>
21 21
22static int request_key_auth_preparse(struct key_preparsed_payload *); 22static int request_key_auth_preparse(struct key_preparsed_payload *);
23static void request_key_auth_free_preparse(struct key_preparsed_payload *); 23static void request_key_auth_free_preparse(struct key_preparsed_payload *);
@@ -68,7 +68,7 @@ static int request_key_auth_instantiate(struct key *key,
68static void request_key_auth_describe(const struct key *key, 68static void request_key_auth_describe(const struct key *key,
69 struct seq_file *m) 69 struct seq_file *m)
70{ 70{
71 struct request_key_auth *rka = key->payload.data[0]; 71 struct request_key_auth *rka = get_request_key_auth(key);
72 72
73 seq_puts(m, "key:"); 73 seq_puts(m, "key:");
74 seq_puts(m, key->description); 74 seq_puts(m, key->description);
@@ -83,7 +83,7 @@ static void request_key_auth_describe(const struct key *key,
83static long request_key_auth_read(const struct key *key, 83static long request_key_auth_read(const struct key *key,
84 char __user *buffer, size_t buflen) 84 char __user *buffer, size_t buflen)
85{ 85{
86 struct request_key_auth *rka = key->payload.data[0]; 86 struct request_key_auth *rka = get_request_key_auth(key);
87 size_t datalen; 87 size_t datalen;
88 long ret; 88 long ret;
89 89
@@ -109,7 +109,7 @@ static long request_key_auth_read(const struct key *key,
109 */ 109 */
110static void request_key_auth_revoke(struct key *key) 110static void request_key_auth_revoke(struct key *key)
111{ 111{
112 struct request_key_auth *rka = key->payload.data[0]; 112 struct request_key_auth *rka = get_request_key_auth(key);
113 113
114 kenter("{%d}", key->serial); 114 kenter("{%d}", key->serial);
115 115
@@ -136,7 +136,7 @@ static void free_request_key_auth(struct request_key_auth *rka)
136 */ 136 */
137static void request_key_auth_destroy(struct key *key) 137static void request_key_auth_destroy(struct key *key)
138{ 138{
139 struct request_key_auth *rka = key->payload.data[0]; 139 struct request_key_auth *rka = get_request_key_auth(key);
140 140
141 kenter("{%d}", key->serial); 141 kenter("{%d}", key->serial);
142 142
@@ -147,8 +147,9 @@ static void request_key_auth_destroy(struct key *key)
147 * Create an authorisation token for /sbin/request-key or whoever to gain 147 * Create an authorisation token for /sbin/request-key or whoever to gain
148 * access to the caller's security data. 148 * access to the caller's security data.
149 */ 149 */
150struct key *request_key_auth_new(struct key *target, const void *callout_info, 150struct key *request_key_auth_new(struct key *target, const char *op,
151 size_t callout_len, struct key *dest_keyring) 151 const void *callout_info, size_t callout_len,
152 struct key *dest_keyring)
152{ 153{
153 struct request_key_auth *rka, *irka; 154 struct request_key_auth *rka, *irka;
154 const struct cred *cred = current->cred; 155 const struct cred *cred = current->cred;
@@ -166,6 +167,7 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info,
166 if (!rka->callout_info) 167 if (!rka->callout_info)
167 goto error_free_rka; 168 goto error_free_rka;
168 rka->callout_len = callout_len; 169 rka->callout_len = callout_len;
170 strlcpy(rka->op, op, sizeof(rka->op));
169 171
170 /* see if the calling process is already servicing the key request of 172 /* see if the calling process is already servicing the key request of
171 * another process */ 173 * another process */
@@ -245,7 +247,7 @@ struct key *key_get_instantiation_authkey(key_serial_t target_id)
245 struct key *authkey; 247 struct key *authkey;
246 key_ref_t authkey_ref; 248 key_ref_t authkey_ref;
247 249
248 sprintf(description, "%x", target_id); 250 ctx.index_key.desc_len = sprintf(description, "%x", target_id);
249 251
250 authkey_ref = search_process_keyrings(&ctx); 252 authkey_ref = search_process_keyrings(&ctx);
251 253
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6df758adff84..1ffa36e987b4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1855,6 +1855,8 @@ enum {
1855 ALC887_FIXUP_BASS_CHMAP, 1855 ALC887_FIXUP_BASS_CHMAP,
1856 ALC1220_FIXUP_GB_DUAL_CODECS, 1856 ALC1220_FIXUP_GB_DUAL_CODECS,
1857 ALC1220_FIXUP_CLEVO_P950, 1857 ALC1220_FIXUP_CLEVO_P950,
1858 ALC1220_FIXUP_SYSTEM76_ORYP5,
1859 ALC1220_FIXUP_SYSTEM76_ORYP5_PINS,
1858}; 1860};
1859 1861
1860static void alc889_fixup_coef(struct hda_codec *codec, 1862static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2056,6 +2058,17 @@ static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2056 snd_hda_override_conn_list(codec, 0x1b, 1, conn1); 2058 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2057} 2059}
2058 2060
2061static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action);
2063
2064static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
2065 const struct hda_fixup *fix,
2066 int action)
2067{
2068 alc1220_fixup_clevo_p950(codec, fix, action);
2069 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2070}
2071
2059static const struct hda_fixup alc882_fixups[] = { 2072static const struct hda_fixup alc882_fixups[] = {
2060 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 2073 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2061 .type = HDA_FIXUP_PINS, 2074 .type = HDA_FIXUP_PINS,
@@ -2300,6 +2313,19 @@ static const struct hda_fixup alc882_fixups[] = {
2300 .type = HDA_FIXUP_FUNC, 2313 .type = HDA_FIXUP_FUNC,
2301 .v.func = alc1220_fixup_clevo_p950, 2314 .v.func = alc1220_fixup_clevo_p950,
2302 }, 2315 },
2316 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2317 .type = HDA_FIXUP_FUNC,
2318 .v.func = alc1220_fixup_system76_oryp5,
2319 },
2320 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
2321 .type = HDA_FIXUP_PINS,
2322 .v.pins = (const struct hda_pintbl[]) {
2323 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2324 {}
2325 },
2326 .chained = true,
2327 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
2328 },
2303}; 2329};
2304 2330
2305static const struct snd_pci_quirk alc882_fixup_tbl[] = { 2331static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2376,6 +2402,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2376 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), 2402 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2377 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), 2403 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2378 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), 2404 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2405 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2406 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2379 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2407 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2380 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2408 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2381 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), 2409 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
@@ -5632,6 +5660,7 @@ enum {
5632 ALC294_FIXUP_ASUS_SPK, 5660 ALC294_FIXUP_ASUS_SPK,
5633 ALC225_FIXUP_HEADSET_JACK, 5661 ALC225_FIXUP_HEADSET_JACK,
5634 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, 5662 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
5663 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
5635}; 5664};
5636 5665
5637static const struct hda_fixup alc269_fixups[] = { 5666static const struct hda_fixup alc269_fixups[] = {
@@ -6587,6 +6616,17 @@ static const struct hda_fixup alc269_fixups[] = {
6587 .chained = true, 6616 .chained = true,
6588 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC 6617 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6589 }, 6618 },
6619 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6620 .type = HDA_FIXUP_VERBS,
6621 .v.verbs = (const struct hda_verb[]) {
6622 /* Disable PCBEEP-IN passthrough */
6623 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6624 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6625 { }
6626 },
6627 .chained = true,
6628 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6629 },
6590}; 6630};
6591 6631
6592static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6632static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7272,7 +7312,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7272 {0x12, 0x90a60130}, 7312 {0x12, 0x90a60130},
7273 {0x19, 0x03a11020}, 7313 {0x19, 0x03a11020},
7274 {0x21, 0x0321101f}), 7314 {0x21, 0x0321101f}),
7275 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE, 7315 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7276 {0x12, 0x90a60130}, 7316 {0x12, 0x90a60130},
7277 {0x14, 0x90170110}, 7317 {0x14, 0x90170110},
7278 {0x19, 0x04a11040}, 7318 {0x19, 0x04a11040},
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 37e001cf9cd1..3fe34417ec89 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -462,7 +462,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
462 conf_idx = 0; 462 conf_idx = 0;
463 node = of_get_child_by_name(top, PREFIX "dai-link"); 463 node = of_get_child_by_name(top, PREFIX "dai-link");
464 if (!node) { 464 if (!node) {
465 node = dev->of_node; 465 node = of_node_get(top);
466 loop = 0; 466 loop = 0;
467 } 467 }
468 468
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index ce00fe2f6aae..d4bde4834ce5 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
604 unsigned int fmt) 604 unsigned int fmt)
605{ 605{
606 struct i2s_dai *i2s = to_info(dai); 606 struct i2s_dai *i2s = to_info(dai);
607 struct i2s_dai *other = get_other_dai(i2s);
607 int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; 608 int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave;
608 u32 mod, tmp = 0; 609 u32 mod, tmp = 0;
609 unsigned long flags; 610 unsigned long flags;
@@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
661 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any 662 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
662 * clock configuration assigned in DT is not overwritten. 663 * clock configuration assigned in DT is not overwritten.
663 */ 664 */
664 if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) 665 if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL &&
666 other->clk_data.clks == NULL)
665 i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 667 i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
666 0, SND_SOC_CLOCK_IN); 668 0, SND_SOC_CLOCK_IN);
667 break; 669 break;
@@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
699 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 701 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
700{ 702{
701 struct i2s_dai *i2s = to_info(dai); 703 struct i2s_dai *i2s = to_info(dai);
704 struct i2s_dai *other = get_other_dai(i2s);
702 u32 mod, mask = 0, val = 0; 705 u32 mod, mask = 0, val = 0;
703 struct clk *rclksrc; 706 struct clk *rclksrc;
704 unsigned long flags; 707 unsigned long flags;
@@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
784 i2s->frmclk = params_rate(params); 787 i2s->frmclk = params_rate(params);
785 788
786 rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; 789 rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
790 if (!rclksrc || IS_ERR(rclksrc))
791 rclksrc = other->clk_table[CLK_I2S_RCLK_SRC];
792
787 if (rclksrc && !IS_ERR(rclksrc)) 793 if (rclksrc && !IS_ERR(rclksrc))
788 i2s->rclk_srcrate = clk_get_rate(rclksrc); 794 i2s->rclk_srcrate = clk_get_rate(rclksrc);
789 795
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index fc79ec6927e3..731b963b6995 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2487,6 +2487,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
2487 struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id) 2487 struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id)
2488{ 2488{
2489 struct soc_tplg tplg; 2489 struct soc_tplg tplg;
2490 int ret;
2490 2491
2491 /* setup parsing context */ 2492 /* setup parsing context */
2492 memset(&tplg, 0, sizeof(tplg)); 2493 memset(&tplg, 0, sizeof(tplg));
@@ -2500,7 +2501,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
2500 tplg.bytes_ext_ops = ops->bytes_ext_ops; 2501 tplg.bytes_ext_ops = ops->bytes_ext_ops;
2501 tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count; 2502 tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count;
2502 2503
2503 return soc_tplg_load(&tplg); 2504 ret = soc_tplg_load(&tplg);
2505 /* free the created components if fail to load topology */
2506 if (ret)
2507 snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL);
2508
2509 return ret;
2504} 2510}
2505EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load); 2511EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
2506 2512