Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.10 commit in: /
Date: Fri, 23 Sep 2022 12:40:14
Message-Id: 1663936797.ecbe39ac61f676205b3c89ec43cbffbfd3f77c90.mpagano@gentoo
1 commit: ecbe39ac61f676205b3c89ec43cbffbfd3f77c90
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 23 12:39:57 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 23 12:39:57 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ecbe39ac
7
8 Linux patch 5.10.145
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1144_linux-5.10.145.patch | 1878 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1882 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 7aedc075..0670d018 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -619,6 +619,10 @@ Patch: 1143_linux-5.10.144.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.10.144
23
24 +Patch: 1144_linux-5.10.145.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.10.145
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1144_linux-5.10.145.patch b/1144_linux-5.10.145.patch
33 new file mode 100644
34 index 00000000..c4117822
35 --- /dev/null
36 +++ b/1144_linux-5.10.145.patch
37 @@ -0,0 +1,1878 @@
38 +diff --git a/Makefile b/Makefile
39 +index 21aa9b04164d1..76c85e40beea3 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 10
46 +-SUBLEVEL = 144
47 ++SUBLEVEL = 145
48 + EXTRAVERSION =
49 + NAME = Dare mighty things
50 +
51 +diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
52 +index 6501a842c41a5..191bcaf565138 100644
53 +--- a/arch/mips/cavium-octeon/octeon-irq.c
54 ++++ b/arch/mips/cavium-octeon/octeon-irq.c
55 +@@ -127,6 +127,16 @@ static void octeon_irq_free_cd(struct irq_domain *d, unsigned int irq)
56 + static int octeon_irq_force_ciu_mapping(struct irq_domain *domain,
57 + int irq, int line, int bit)
58 + {
59 ++ struct device_node *of_node;
60 ++ int ret;
61 ++
62 ++ of_node = irq_domain_get_of_node(domain);
63 ++ if (!of_node)
64 ++ return -EINVAL;
65 ++ ret = irq_alloc_desc_at(irq, of_node_to_nid(of_node));
66 ++ if (ret < 0)
67 ++ return ret;
68 ++
69 + return irq_domain_associate(domain, irq, line << 6 | bit);
70 + }
71 +
72 +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
73 +index 2d89f79f460cb..07a4d4badd697 100644
74 +--- a/arch/parisc/Kconfig
75 ++++ b/arch/parisc/Kconfig
76 +@@ -315,6 +315,16 @@ config IRQSTACKS
77 + for handling hard and soft interrupts. This can help avoid
78 + overflowing the process kernel stacks.
79 +
80 ++config TLB_PTLOCK
81 ++ bool "Use page table locks in TLB fault handler"
82 ++ depends on SMP
83 ++ default n
84 ++ help
85 ++ Select this option to enable page table locking in the TLB
86 ++ fault handler. This ensures that page table entries are
87 ++ updated consistently on SMP machines at the expense of some
88 ++ loss in performance.
89 ++
90 + config HOTPLUG_CPU
91 + bool
92 + default y if SMP
93 +diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h
94 +index cb5f2f7304213..aba69ff79e8c1 100644
95 +--- a/arch/parisc/include/asm/mmu_context.h
96 ++++ b/arch/parisc/include/asm/mmu_context.h
97 +@@ -5,6 +5,7 @@
98 + #include <linux/mm.h>
99 + #include <linux/sched.h>
100 + #include <linux/atomic.h>
101 ++#include <linux/spinlock.h>
102 + #include <asm-generic/mm_hooks.h>
103 +
104 + static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
105 +@@ -52,6 +53,12 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
106 + struct mm_struct *next, struct task_struct *tsk)
107 + {
108 + if (prev != next) {
109 ++#ifdef CONFIG_TLB_PTLOCK
110 ++ /* put physical address of page_table_lock in cr28 (tr4)
111 ++ for TLB faults */
112 ++ spinlock_t *pgd_lock = &next->page_table_lock;
113 ++ mtctl(__pa(__ldcw_align(&pgd_lock->rlock.raw_lock)), 28);
114 ++#endif
115 + mtctl(__pa(next->pgd), 25);
116 + load_context(next->context);
117 + }
118 +diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
119 +index 8802ce651a3af..0561568f7b489 100644
120 +--- a/arch/parisc/include/asm/page.h
121 ++++ b/arch/parisc/include/asm/page.h
122 +@@ -112,7 +112,7 @@ extern int npmem_ranges;
123 + #else
124 + #define BITS_PER_PTE_ENTRY 2
125 + #define BITS_PER_PMD_ENTRY 2
126 +-#define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY
127 ++#define BITS_PER_PGD_ENTRY 2
128 + #endif
129 + #define PGD_ENTRY_SIZE (1UL << BITS_PER_PGD_ENTRY)
130 + #define PMD_ENTRY_SIZE (1UL << BITS_PER_PMD_ENTRY)
131 +diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
132 +index a6482b2ce0eab..dda5570853116 100644
133 +--- a/arch/parisc/include/asm/pgalloc.h
134 ++++ b/arch/parisc/include/asm/pgalloc.h
135 +@@ -15,47 +15,23 @@
136 + #define __HAVE_ARCH_PGD_FREE
137 + #include <asm-generic/pgalloc.h>
138 +
139 +-/* Allocate the top level pgd (page directory)
140 +- *
141 +- * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we
142 +- * allocate the first pmd adjacent to the pgd. This means that we can
143 +- * subtract a constant offset to get to it. The pmd and pgd sizes are
144 +- * arranged so that a single pmd covers 4GB (giving a full 64-bit
145 +- * process access to 8TB) so our lookups are effectively L2 for the
146 +- * first 4GB of the kernel (i.e. for all ILP32 processes and all the
147 +- * kernel for machines with under 4GB of memory) */
148 ++/* Allocate the top level pgd (page directory) */
149 + static inline pgd_t *pgd_alloc(struct mm_struct *mm)
150 + {
151 +- pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL,
152 +- PGD_ALLOC_ORDER);
153 +- pgd_t *actual_pgd = pgd;
154 ++ pgd_t *pgd;
155 +
156 +- if (likely(pgd != NULL)) {
157 +- memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
158 +-#if CONFIG_PGTABLE_LEVELS == 3
159 +- actual_pgd += PTRS_PER_PGD;
160 +- /* Populate first pmd with allocated memory. We mark it
161 +- * with PxD_FLAG_ATTACHED as a signal to the system that this
162 +- * pmd entry may not be cleared. */
163 +- set_pgd(actual_pgd, __pgd((PxD_FLAG_PRESENT |
164 +- PxD_FLAG_VALID |
165 +- PxD_FLAG_ATTACHED)
166 +- + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT)));
167 +- /* The first pmd entry also is marked with PxD_FLAG_ATTACHED as
168 +- * a signal that this pmd may not be freed */
169 +- set_pgd(pgd, __pgd(PxD_FLAG_ATTACHED));
170 +-#endif
171 +- }
172 +- spin_lock_init(pgd_spinlock(actual_pgd));
173 +- return actual_pgd;
174 ++ pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER);
175 ++ if (unlikely(pgd == NULL))
176 ++ return NULL;
177 ++
178 ++ memset(pgd, 0, PAGE_SIZE << PGD_ORDER);
179 ++
180 ++ return pgd;
181 + }
182 +
183 + static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
184 + {
185 +-#if CONFIG_PGTABLE_LEVELS == 3
186 +- pgd -= PTRS_PER_PGD;
187 +-#endif
188 +- free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
189 ++ free_pages((unsigned long)pgd, PGD_ORDER);
190 + }
191 +
192 + #if CONFIG_PGTABLE_LEVELS == 3
193 +@@ -70,41 +46,25 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
194 +
195 + static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
196 + {
197 +- return (pmd_t *)__get_free_pages(GFP_PGTABLE_KERNEL, PMD_ORDER);
198 ++ pmd_t *pmd;
199 ++
200 ++ pmd = (pmd_t *)__get_free_pages(GFP_PGTABLE_KERNEL, PMD_ORDER);
201 ++ if (likely(pmd))
202 ++ memset ((void *)pmd, 0, PAGE_SIZE << PMD_ORDER);
203 ++ return pmd;
204 + }
205 +
206 + static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
207 + {
208 +- if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
209 +- /*
210 +- * This is the permanent pmd attached to the pgd;
211 +- * cannot free it.
212 +- * Increment the counter to compensate for the decrement
213 +- * done by generic mm code.
214 +- */
215 +- mm_inc_nr_pmds(mm);
216 +- return;
217 +- }
218 + free_pages((unsigned long)pmd, PMD_ORDER);
219 + }
220 +-
221 + #endif
222 +
223 + static inline void
224 + pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
225 + {
226 +-#if CONFIG_PGTABLE_LEVELS == 3
227 +- /* preserve the gateway marker if this is the beginning of
228 +- * the permanent pmd */
229 +- if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
230 +- set_pmd(pmd, __pmd((PxD_FLAG_PRESENT |
231 +- PxD_FLAG_VALID |
232 +- PxD_FLAG_ATTACHED)
233 +- + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT)));
234 +- else
235 +-#endif
236 +- set_pmd(pmd, __pmd((PxD_FLAG_PRESENT | PxD_FLAG_VALID)
237 +- + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT)));
238 ++ set_pmd(pmd, __pmd((PxD_FLAG_PRESENT | PxD_FLAG_VALID)
239 ++ + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT)));
240 + }
241 +
242 + #define pmd_populate(mm, pmd, pte_page) \
243 +diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
244 +index 75cf84070fc91..8964798b8274e 100644
245 +--- a/arch/parisc/include/asm/pgtable.h
246 ++++ b/arch/parisc/include/asm/pgtable.h
247 +@@ -23,8 +23,6 @@
248 + #include <asm/processor.h>
249 + #include <asm/cache.h>
250 +
251 +-static inline spinlock_t *pgd_spinlock(pgd_t *);
252 +-
253 + /*
254 + * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
255 + * memory. For the return value to be meaningful, ADDR must be >=
256 +@@ -42,12 +40,8 @@ static inline spinlock_t *pgd_spinlock(pgd_t *);
257 +
258 + /* This is for the serialization of PxTLB broadcasts. At least on the N class
259 + * systems, only one PxTLB inter processor broadcast can be active at any one
260 +- * time on the Merced bus.
261 +-
262 +- * PTE updates are protected by locks in the PMD.
263 +- */
264 ++ * time on the Merced bus. */
265 + extern spinlock_t pa_tlb_flush_lock;
266 +-extern spinlock_t pa_swapper_pg_lock;
267 + #if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
268 + extern int pa_serialize_tlb_flushes;
269 + #else
270 +@@ -82,22 +76,25 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
271 + purge_tlb_end(flags);
272 + }
273 +
274 ++extern void __update_cache(pte_t pte);
275 ++
276 + /* Certain architectures need to do special things when PTEs
277 + * within a page table are directly modified. Thus, the following
278 + * hook is made available.
279 + */
280 +-#define set_pte(pteptr, pteval) \
281 +- do{ \
282 +- *(pteptr) = (pteval); \
283 +- } while(0)
284 +-
285 +-#define set_pte_at(mm, addr, ptep, pteval) \
286 +- do { \
287 +- unsigned long flags; \
288 +- spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);\
289 +- set_pte(ptep, pteval); \
290 +- purge_tlb_entries(mm, addr); \
291 +- spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);\
292 ++#define set_pte(pteptr, pteval) \
293 ++ do { \
294 ++ *(pteptr) = (pteval); \
295 ++ mb(); \
296 ++ } while(0)
297 ++
298 ++#define set_pte_at(mm, addr, pteptr, pteval) \
299 ++ do { \
300 ++ if (pte_present(pteval) && \
301 ++ pte_user(pteval)) \
302 ++ __update_cache(pteval); \
303 ++ *(pteptr) = (pteval); \
304 ++ purge_tlb_entries(mm, addr); \
305 + } while (0)
306 +
307 + #endif /* !__ASSEMBLY__ */
308 +@@ -120,12 +117,10 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
309 + #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
310 +
311 + #if CONFIG_PGTABLE_LEVELS == 3
312 +-#define PGD_ORDER 1 /* Number of pages per pgd */
313 +-#define PMD_ORDER 1 /* Number of pages per pmd */
314 +-#define PGD_ALLOC_ORDER (2 + 1) /* first pgd contains pmd */
315 ++#define PMD_ORDER 1
316 ++#define PGD_ORDER 0
317 + #else
318 +-#define PGD_ORDER 1 /* Number of pages per pgd */
319 +-#define PGD_ALLOC_ORDER (PGD_ORDER + 1)
320 ++#define PGD_ORDER 1
321 + #endif
322 +
323 + /* Definitions for 3rd level (we use PLD here for Page Lower directory
324 +@@ -240,11 +235,9 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
325 + * able to effectively address 40/42/44-bits of physical address space
326 + * depending on 4k/16k/64k PAGE_SIZE */
327 + #define _PxD_PRESENT_BIT 31
328 +-#define _PxD_ATTACHED_BIT 30
329 +-#define _PxD_VALID_BIT 29
330 ++#define _PxD_VALID_BIT 30
331 +
332 + #define PxD_FLAG_PRESENT (1 << xlate_pabit(_PxD_PRESENT_BIT))
333 +-#define PxD_FLAG_ATTACHED (1 << xlate_pabit(_PxD_ATTACHED_BIT))
334 + #define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))
335 + #define PxD_FLAG_MASK (0xf)
336 + #define PxD_FLAG_SHIFT (4)
337 +@@ -317,6 +310,7 @@ extern unsigned long *empty_zero_page;
338 +
339 + #define pte_none(x) (pte_val(x) == 0)
340 + #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
341 ++#define pte_user(x) (pte_val(x) & _PAGE_USER)
342 + #define pte_clear(mm, addr, xp) set_pte_at(mm, addr, xp, __pte(0))
343 +
344 + #define pmd_flag(x) (pmd_val(x) & PxD_FLAG_MASK)
345 +@@ -326,23 +320,10 @@ extern unsigned long *empty_zero_page;
346 + #define pgd_flag(x) (pgd_val(x) & PxD_FLAG_MASK)
347 + #define pgd_address(x) ((unsigned long)(pgd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
348 +
349 +-#if CONFIG_PGTABLE_LEVELS == 3
350 +-/* The first entry of the permanent pmd is not there if it contains
351 +- * the gateway marker */
352 +-#define pmd_none(x) (!pmd_val(x) || pmd_flag(x) == PxD_FLAG_ATTACHED)
353 +-#else
354 + #define pmd_none(x) (!pmd_val(x))
355 +-#endif
356 + #define pmd_bad(x) (!(pmd_flag(x) & PxD_FLAG_VALID))
357 + #define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT)
358 + static inline void pmd_clear(pmd_t *pmd) {
359 +-#if CONFIG_PGTABLE_LEVELS == 3
360 +- if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
361 +- /* This is the entry pointing to the permanent pmd
362 +- * attached to the pgd; cannot clear it */
363 +- set_pmd(pmd, __pmd(PxD_FLAG_ATTACHED));
364 +- else
365 +-#endif
366 + set_pmd(pmd, __pmd(0));
367 + }
368 +
369 +@@ -358,12 +339,6 @@ static inline void pmd_clear(pmd_t *pmd) {
370 + #define pud_bad(x) (!(pud_flag(x) & PxD_FLAG_VALID))
371 + #define pud_present(x) (pud_flag(x) & PxD_FLAG_PRESENT)
372 + static inline void pud_clear(pud_t *pud) {
373 +-#if CONFIG_PGTABLE_LEVELS == 3
374 +- if(pud_flag(*pud) & PxD_FLAG_ATTACHED)
375 +- /* This is the permanent pmd attached to the pud; cannot
376 +- * free it */
377 +- return;
378 +-#endif
379 + set_pud(pud, __pud(0));
380 + }
381 + #endif
382 +@@ -443,7 +418,7 @@ extern void paging_init (void);
383 +
384 + #define PG_dcache_dirty PG_arch_1
385 +
386 +-extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
387 ++#define update_mmu_cache(vms,addr,ptep) __update_cache(*ptep)
388 +
389 + /* Encode and de-code a swap entry */
390 +
391 +@@ -456,32 +431,18 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
392 + #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
393 + #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
394 +
395 +-
396 +-static inline spinlock_t *pgd_spinlock(pgd_t *pgd)
397 +-{
398 +- if (unlikely(pgd == swapper_pg_dir))
399 +- return &pa_swapper_pg_lock;
400 +- return (spinlock_t *)((char *)pgd + (PAGE_SIZE << (PGD_ALLOC_ORDER - 1)));
401 +-}
402 +-
403 +-
404 + static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
405 + {
406 + pte_t pte;
407 +- unsigned long flags;
408 +
409 + if (!pte_young(*ptep))
410 + return 0;
411 +
412 +- spin_lock_irqsave(pgd_spinlock(vma->vm_mm->pgd), flags);
413 + pte = *ptep;
414 + if (!pte_young(pte)) {
415 +- spin_unlock_irqrestore(pgd_spinlock(vma->vm_mm->pgd), flags);
416 + return 0;
417 + }
418 +- set_pte(ptep, pte_mkold(pte));
419 +- purge_tlb_entries(vma->vm_mm, addr);
420 +- spin_unlock_irqrestore(pgd_spinlock(vma->vm_mm->pgd), flags);
421 ++ set_pte_at(vma->vm_mm, addr, ptep, pte_mkold(pte));
422 + return 1;
423 + }
424 +
425 +@@ -489,24 +450,16 @@ struct mm_struct;
426 + static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
427 + {
428 + pte_t old_pte;
429 +- unsigned long flags;
430 +
431 +- spin_lock_irqsave(pgd_spinlock(mm->pgd), flags);
432 + old_pte = *ptep;
433 +- set_pte(ptep, __pte(0));
434 +- purge_tlb_entries(mm, addr);
435 +- spin_unlock_irqrestore(pgd_spinlock(mm->pgd), flags);
436 ++ set_pte_at(mm, addr, ptep, __pte(0));
437 +
438 + return old_pte;
439 + }
440 +
441 + static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
442 + {
443 +- unsigned long flags;
444 +- spin_lock_irqsave(pgd_spinlock(mm->pgd), flags);
445 +- set_pte(ptep, pte_wrprotect(*ptep));
446 +- purge_tlb_entries(mm, addr);
447 +- spin_unlock_irqrestore(pgd_spinlock(mm->pgd), flags);
448 ++ set_pte_at(mm, addr, ptep, pte_wrprotect(*ptep));
449 + }
450 +
451 + #define pte_same(A,B) (pte_val(A) == pte_val(B))
452 +diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c
453 +index 305768a40773f..cd2cc1b1648c0 100644
454 +--- a/arch/parisc/kernel/asm-offsets.c
455 ++++ b/arch/parisc/kernel/asm-offsets.c
456 +@@ -268,7 +268,6 @@ int main(void)
457 + DEFINE(ASM_BITS_PER_PGD, BITS_PER_PGD);
458 + DEFINE(ASM_BITS_PER_PMD, BITS_PER_PMD);
459 + DEFINE(ASM_BITS_PER_PTE, BITS_PER_PTE);
460 +- DEFINE(ASM_PGD_PMD_OFFSET, -(PAGE_SIZE << PGD_ORDER));
461 + DEFINE(ASM_PMD_ENTRY, ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT));
462 + DEFINE(ASM_PGD_ENTRY, PAGE_OFFSET >> PGDIR_SHIFT);
463 + DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_SIZE);
464 +diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
465 +index 86a1a63563fd5..c81ab0cb89255 100644
466 +--- a/arch/parisc/kernel/cache.c
467 ++++ b/arch/parisc/kernel/cache.c
468 +@@ -83,9 +83,9 @@ EXPORT_SYMBOL(flush_cache_all_local);
469 + #define pfn_va(pfn) __va(PFN_PHYS(pfn))
470 +
471 + void
472 +-update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
473 ++__update_cache(pte_t pte)
474 + {
475 +- unsigned long pfn = pte_pfn(*ptep);
476 ++ unsigned long pfn = pte_pfn(pte);
477 + struct page *page;
478 +
479 + /* We don't have pte special. As a result, we can be called with
480 +diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
481 +index 3da39140babcf..05bed27eef859 100644
482 +--- a/arch/parisc/kernel/entry.S
483 ++++ b/arch/parisc/kernel/entry.S
484 +@@ -35,10 +35,9 @@
485 + .level 2.0
486 + #endif
487 +
488 +- .import pa_tlb_lock,data
489 +- .macro load_pa_tlb_lock reg
490 +- mfctl %cr25,\reg
491 +- addil L%(PAGE_SIZE << (PGD_ALLOC_ORDER - 1)),\reg
492 ++ /* Get aligned page_table_lock address for this mm from cr28/tr4 */
493 ++ .macro get_ptl reg
494 ++ mfctl %cr28,\reg
495 + .endm
496 +
497 + /* space_to_prot macro creates a prot id from a space id */
498 +@@ -407,7 +406,9 @@
499 + # endif
500 + #endif
501 + dep %r0,31,PAGE_SHIFT,\pmd /* clear offset */
502 ++#if CONFIG_PGTABLE_LEVELS < 3
503 + copy %r0,\pte
504 ++#endif
505 + ldw,s \index(\pmd),\pmd
506 + bb,>=,n \pmd,_PxD_PRESENT_BIT,\fault
507 + dep %r0,31,PxD_FLAG_SHIFT,\pmd /* clear flags */
508 +@@ -417,38 +418,23 @@
509 + shladd \index,BITS_PER_PTE_ENTRY,\pmd,\pmd /* pmd is now pte */
510 + .endm
511 +
512 +- /* Look up PTE in a 3-Level scheme.
513 +- *
514 +- * Here we implement a Hybrid L2/L3 scheme: we allocate the
515 +- * first pmd adjacent to the pgd. This means that we can
516 +- * subtract a constant offset to get to it. The pmd and pgd
517 +- * sizes are arranged so that a single pmd covers 4GB (giving
518 +- * a full LP64 process access to 8TB) so our lookups are
519 +- * effectively L2 for the first 4GB of the kernel (i.e. for
520 +- * all ILP32 processes and all the kernel for machines with
521 +- * under 4GB of memory) */
522 ++ /* Look up PTE in a 3-Level scheme. */
523 + .macro L3_ptep pgd,pte,index,va,fault
524 +-#if CONFIG_PGTABLE_LEVELS == 3 /* we might have a 2-Level scheme, e.g. with 16kb page size */
525 ++#if CONFIG_PGTABLE_LEVELS == 3
526 ++ copy %r0,\pte
527 + extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
528 +- extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
529 + ldw,s \index(\pgd),\pgd
530 +- extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
531 + bb,>=,n \pgd,_PxD_PRESENT_BIT,\fault
532 +- extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
533 +- shld \pgd,PxD_VALUE_SHIFT,\index
534 +- extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
535 +- copy \index,\pgd
536 +- extrd,u,*<> \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0
537 +- ldo ASM_PGD_PMD_OFFSET(\pgd),\pgd
538 ++ shld \pgd,PxD_VALUE_SHIFT,\pgd
539 + #endif
540 + L2_ptep \pgd,\pte,\index,\va,\fault
541 + .endm
542 +
543 +- /* Acquire pa_tlb_lock lock and check page is present. */
544 +- .macro tlb_lock spc,ptp,pte,tmp,tmp1,fault
545 +-#ifdef CONFIG_SMP
546 ++ /* Acquire page_table_lock and check page is present. */
547 ++ .macro ptl_lock spc,ptp,pte,tmp,tmp1,fault
548 ++#ifdef CONFIG_TLB_PTLOCK
549 + 98: cmpib,COND(=),n 0,\spc,2f
550 +- load_pa_tlb_lock \tmp
551 ++ get_ptl \tmp
552 + 1: LDCW 0(\tmp),\tmp1
553 + cmpib,COND(=) 0,\tmp1,1b
554 + nop
555 +@@ -463,26 +449,26 @@
556 + 3:
557 + .endm
558 +
559 +- /* Release pa_tlb_lock lock without reloading lock address.
560 ++ /* Release page_table_lock without reloading lock address.
561 + Note that the values in the register spc are limited to
562 + NR_SPACE_IDS (262144). Thus, the stw instruction always
563 + stores a nonzero value even when register spc is 64 bits.
564 + We use an ordered store to ensure all prior accesses are
565 + performed prior to releasing the lock. */
566 +- .macro tlb_unlock0 spc,tmp
567 +-#ifdef CONFIG_SMP
568 ++ .macro ptl_unlock0 spc,tmp
569 ++#ifdef CONFIG_TLB_PTLOCK
570 + 98: or,COND(=) %r0,\spc,%r0
571 + stw,ma \spc,0(\tmp)
572 + 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP)
573 + #endif
574 + .endm
575 +
576 +- /* Release pa_tlb_lock lock. */
577 +- .macro tlb_unlock1 spc,tmp
578 +-#ifdef CONFIG_SMP
579 +-98: load_pa_tlb_lock \tmp
580 ++ /* Release page_table_lock. */
581 ++ .macro ptl_unlock1 spc,tmp
582 ++#ifdef CONFIG_TLB_PTLOCK
583 ++98: get_ptl \tmp
584 ++ ptl_unlock0 \spc,\tmp
585 + 99: ALTERNATIVE(98b, 99b, ALT_COND_NO_SMP, INSN_NOP)
586 +- tlb_unlock0 \spc,\tmp
587 + #endif
588 + .endm
589 +
590 +@@ -1165,14 +1151,14 @@ dtlb_miss_20w:
591 +
592 + L3_ptep ptp,pte,t0,va,dtlb_check_alias_20w
593 +
594 +- tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w
595 ++ ptl_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20w
596 + update_accessed ptp,pte,t0,t1
597 +
598 + make_insert_tlb spc,pte,prot,t1
599 +
600 + idtlbt pte,prot
601 +
602 +- tlb_unlock1 spc,t0
603 ++ ptl_unlock1 spc,t0
604 + rfir
605 + nop
606 +
607 +@@ -1191,14 +1177,14 @@ nadtlb_miss_20w:
608 +
609 + L3_ptep ptp,pte,t0,va,nadtlb_check_alias_20w
610 +
611 +- tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w
612 ++ ptl_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20w
613 + update_accessed ptp,pte,t0,t1
614 +
615 + make_insert_tlb spc,pte,prot,t1
616 +
617 + idtlbt pte,prot
618 +
619 +- tlb_unlock1 spc,t0
620 ++ ptl_unlock1 spc,t0
621 + rfir
622 + nop
623 +
624 +@@ -1219,7 +1205,7 @@ dtlb_miss_11:
625 +
626 + L2_ptep ptp,pte,t0,va,dtlb_check_alias_11
627 +
628 +- tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_11
629 ++ ptl_lock spc,ptp,pte,t0,t1,dtlb_check_alias_11
630 + update_accessed ptp,pte,t0,t1
631 +
632 + make_insert_tlb_11 spc,pte,prot
633 +@@ -1232,7 +1218,7 @@ dtlb_miss_11:
634 +
635 + mtsp t1, %sr1 /* Restore sr1 */
636 +
637 +- tlb_unlock1 spc,t0
638 ++ ptl_unlock1 spc,t0
639 + rfir
640 + nop
641 +
642 +@@ -1252,7 +1238,7 @@ nadtlb_miss_11:
643 +
644 + L2_ptep ptp,pte,t0,va,nadtlb_check_alias_11
645 +
646 +- tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_11
647 ++ ptl_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_11
648 + update_accessed ptp,pte,t0,t1
649 +
650 + make_insert_tlb_11 spc,pte,prot
651 +@@ -1265,7 +1251,7 @@ nadtlb_miss_11:
652 +
653 + mtsp t1, %sr1 /* Restore sr1 */
654 +
655 +- tlb_unlock1 spc,t0
656 ++ ptl_unlock1 spc,t0
657 + rfir
658 + nop
659 +
660 +@@ -1285,7 +1271,7 @@ dtlb_miss_20:
661 +
662 + L2_ptep ptp,pte,t0,va,dtlb_check_alias_20
663 +
664 +- tlb_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20
665 ++ ptl_lock spc,ptp,pte,t0,t1,dtlb_check_alias_20
666 + update_accessed ptp,pte,t0,t1
667 +
668 + make_insert_tlb spc,pte,prot,t1
669 +@@ -1294,7 +1280,7 @@ dtlb_miss_20:
670 +
671 + idtlbt pte,prot
672 +
673 +- tlb_unlock1 spc,t0
674 ++ ptl_unlock1 spc,t0
675 + rfir
676 + nop
677 +
678 +@@ -1313,7 +1299,7 @@ nadtlb_miss_20:
679 +
680 + L2_ptep ptp,pte,t0,va,nadtlb_check_alias_20
681 +
682 +- tlb_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20
683 ++ ptl_lock spc,ptp,pte,t0,t1,nadtlb_check_alias_20
684 + update_accessed ptp,pte,t0,t1
685 +
686 + make_insert_tlb spc,pte,prot,t1
687 +@@ -1322,7 +1308,7 @@ nadtlb_miss_20:
688 +
689 + idtlbt pte,prot
690 +
691 +- tlb_unlock1 spc,t0
692 ++ ptl_unlock1 spc,t0
693 + rfir
694 + nop
695 +
696 +@@ -1422,14 +1408,14 @@ itlb_miss_20w:
697 +
698 + L3_ptep ptp,pte,t0,va,itlb_fault
699 +
700 +- tlb_lock spc,ptp,pte,t0,t1,itlb_fault
701 ++ ptl_lock spc,ptp,pte,t0,t1,itlb_fault
702 + update_accessed ptp,pte,t0,t1
703 +
704 + make_insert_tlb spc,pte,prot,t1
705 +
706 + iitlbt pte,prot
707 +
708 +- tlb_unlock1 spc,t0
709 ++ ptl_unlock1 spc,t0
710 + rfir
711 + nop
712 +
713 +@@ -1446,14 +1432,14 @@ naitlb_miss_20w:
714 +
715 + L3_ptep ptp,pte,t0,va,naitlb_check_alias_20w
716 +
717 +- tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w
718 ++ ptl_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20w
719 + update_accessed ptp,pte,t0,t1
720 +
721 + make_insert_tlb spc,pte,prot,t1
722 +
723 + iitlbt pte,prot
724 +
725 +- tlb_unlock1 spc,t0
726 ++ ptl_unlock1 spc,t0
727 + rfir
728 + nop
729 +
730 +@@ -1474,7 +1460,7 @@ itlb_miss_11:
731 +
732 + L2_ptep ptp,pte,t0,va,itlb_fault
733 +
734 +- tlb_lock spc,ptp,pte,t0,t1,itlb_fault
735 ++ ptl_lock spc,ptp,pte,t0,t1,itlb_fault
736 + update_accessed ptp,pte,t0,t1
737 +
738 + make_insert_tlb_11 spc,pte,prot
739 +@@ -1487,7 +1473,7 @@ itlb_miss_11:
740 +
741 + mtsp t1, %sr1 /* Restore sr1 */
742 +
743 +- tlb_unlock1 spc,t0
744 ++ ptl_unlock1 spc,t0
745 + rfir
746 + nop
747 +
748 +@@ -1498,7 +1484,7 @@ naitlb_miss_11:
749 +
750 + L2_ptep ptp,pte,t0,va,naitlb_check_alias_11
751 +
752 +- tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_11
753 ++ ptl_lock spc,ptp,pte,t0,t1,naitlb_check_alias_11
754 + update_accessed ptp,pte,t0,t1
755 +
756 + make_insert_tlb_11 spc,pte,prot
757 +@@ -1511,7 +1497,7 @@ naitlb_miss_11:
758 +
759 + mtsp t1, %sr1 /* Restore sr1 */
760 +
761 +- tlb_unlock1 spc,t0
762 ++ ptl_unlock1 spc,t0
763 + rfir
764 + nop
765 +
766 +@@ -1532,7 +1518,7 @@ itlb_miss_20:
767 +
768 + L2_ptep ptp,pte,t0,va,itlb_fault
769 +
770 +- tlb_lock spc,ptp,pte,t0,t1,itlb_fault
771 ++ ptl_lock spc,ptp,pte,t0,t1,itlb_fault
772 + update_accessed ptp,pte,t0,t1
773 +
774 + make_insert_tlb spc,pte,prot,t1
775 +@@ -1541,7 +1527,7 @@ itlb_miss_20:
776 +
777 + iitlbt pte,prot
778 +
779 +- tlb_unlock1 spc,t0
780 ++ ptl_unlock1 spc,t0
781 + rfir
782 + nop
783 +
784 +@@ -1552,7 +1538,7 @@ naitlb_miss_20:
785 +
786 + L2_ptep ptp,pte,t0,va,naitlb_check_alias_20
787 +
788 +- tlb_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20
789 ++ ptl_lock spc,ptp,pte,t0,t1,naitlb_check_alias_20
790 + update_accessed ptp,pte,t0,t1
791 +
792 + make_insert_tlb spc,pte,prot,t1
793 +@@ -1561,7 +1547,7 @@ naitlb_miss_20:
794 +
795 + iitlbt pte,prot
796 +
797 +- tlb_unlock1 spc,t0
798 ++ ptl_unlock1 spc,t0
799 + rfir
800 + nop
801 +
802 +@@ -1584,14 +1570,14 @@ dbit_trap_20w:
803 +
804 + L3_ptep ptp,pte,t0,va,dbit_fault
805 +
806 +- tlb_lock spc,ptp,pte,t0,t1,dbit_fault
807 ++ ptl_lock spc,ptp,pte,t0,t1,dbit_fault
808 + update_dirty ptp,pte,t1
809 +
810 + make_insert_tlb spc,pte,prot,t1
811 +
812 + idtlbt pte,prot
813 +
814 +- tlb_unlock0 spc,t0
815 ++ ptl_unlock0 spc,t0
816 + rfir
817 + nop
818 + #else
819 +@@ -1604,7 +1590,7 @@ dbit_trap_11:
820 +
821 + L2_ptep ptp,pte,t0,va,dbit_fault
822 +
823 +- tlb_lock spc,ptp,pte,t0,t1,dbit_fault
824 ++ ptl_lock spc,ptp,pte,t0,t1,dbit_fault
825 + update_dirty ptp,pte,t1
826 +
827 + make_insert_tlb_11 spc,pte,prot
828 +@@ -1617,7 +1603,7 @@ dbit_trap_11:
829 +
830 + mtsp t1, %sr1 /* Restore sr1 */
831 +
832 +- tlb_unlock0 spc,t0
833 ++ ptl_unlock0 spc,t0
834 + rfir
835 + nop
836 +
837 +@@ -1628,7 +1614,7 @@ dbit_trap_20:
838 +
839 + L2_ptep ptp,pte,t0,va,dbit_fault
840 +
841 +- tlb_lock spc,ptp,pte,t0,t1,dbit_fault
842 ++ ptl_lock spc,ptp,pte,t0,t1,dbit_fault
843 + update_dirty ptp,pte,t1
844 +
845 + make_insert_tlb spc,pte,prot,t1
846 +@@ -1637,7 +1623,7 @@ dbit_trap_20:
847 +
848 + idtlbt pte,prot
849 +
850 +- tlb_unlock0 spc,t0
851 ++ ptl_unlock0 spc,t0
852 + rfir
853 + nop
854 + #endif
855 +diff --git a/arch/parisc/mm/hugetlbpage.c b/arch/parisc/mm/hugetlbpage.c
856 +index d7ba014a7fbb5..43652de5f139f 100644
857 +--- a/arch/parisc/mm/hugetlbpage.c
858 ++++ b/arch/parisc/mm/hugetlbpage.c
859 +@@ -142,24 +142,17 @@ static void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
860 + void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
861 + pte_t *ptep, pte_t entry)
862 + {
863 +- unsigned long flags;
864 +-
865 +- spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);
866 + __set_huge_pte_at(mm, addr, ptep, entry);
867 +- spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);
868 + }
869 +
870 +
871 + pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
872 + pte_t *ptep)
873 + {
874 +- unsigned long flags;
875 + pte_t entry;
876 +
877 +- spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);
878 + entry = *ptep;
879 + __set_huge_pte_at(mm, addr, ptep, __pte(0));
880 +- spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);
881 +
882 + return entry;
883 + }
884 +@@ -168,29 +161,23 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
885 + void huge_ptep_set_wrprotect(struct mm_struct *mm,
886 + unsigned long addr, pte_t *ptep)
887 + {
888 +- unsigned long flags;
889 + pte_t old_pte;
890 +
891 +- spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);
892 + old_pte = *ptep;
893 + __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
894 +- spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);
895 + }
896 +
897 + int huge_ptep_set_access_flags(struct vm_area_struct *vma,
898 + unsigned long addr, pte_t *ptep,
899 + pte_t pte, int dirty)
900 + {
901 +- unsigned long flags;
902 + int changed;
903 + struct mm_struct *mm = vma->vm_mm;
904 +
905 +- spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);
906 + changed = !pte_same(*ptep, pte);
907 + if (changed) {
908 + __set_huge_pte_at(mm, addr, ptep, pte);
909 + }
910 +- spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);
911 + return changed;
912 + }
913 +
914 +diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
915 +index 319afa00cdf7b..6a083fc87a038 100644
916 +--- a/arch/parisc/mm/init.c
917 ++++ b/arch/parisc/mm/init.c
918 +@@ -37,11 +37,6 @@ extern int data_start;
919 + extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
920 +
921 + #if CONFIG_PGTABLE_LEVELS == 3
922 +-/* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
923 +- * with the first pmd adjacent to the pgd and below it. gcc doesn't actually
924 +- * guarantee that global objects will be laid out in memory in the same order
925 +- * as the order of declaration, so put these in different sections and use
926 +- * the linker script to order them. */
927 + pmd_t pmd0[PTRS_PER_PMD] __section(".data..vm0.pmd") __attribute__ ((aligned(PAGE_SIZE)));
928 + #endif
929 +
930 +@@ -558,6 +553,11 @@ void __init mem_init(void)
931 + BUILD_BUG_ON(PGD_ENTRY_SIZE != sizeof(pgd_t));
932 + BUILD_BUG_ON(PAGE_SHIFT + BITS_PER_PTE + BITS_PER_PMD + BITS_PER_PGD
933 + > BITS_PER_LONG);
934 ++#if CONFIG_PGTABLE_LEVELS == 3
935 ++ BUILD_BUG_ON(PT_INITIAL > PTRS_PER_PMD);
936 ++#else
937 ++ BUILD_BUG_ON(PT_INITIAL > PTRS_PER_PGD);
938 ++#endif
939 +
940 + high_memory = __va((max_pfn << PAGE_SHIFT));
941 + set_max_mapnr(max_low_pfn);
942 +diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
943 +index 38b7a3491aac0..1d25932389951 100644
944 +--- a/arch/powerpc/kvm/book3s_hv.c
945 ++++ b/arch/powerpc/kvm/book3s_hv.c
946 +@@ -3399,8 +3399,22 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
947 +
948 + kvmppc_set_host_core(pcpu);
949 +
950 ++ context_tracking_guest_exit();
951 ++ if (!vtime_accounting_enabled_this_cpu()) {
952 ++ local_irq_enable();
953 ++ /*
954 ++ * Service IRQs here before vtime_account_guest_exit() so any
955 ++ * ticks that occurred while running the guest are accounted to
956 ++ * the guest. If vtime accounting is enabled, accounting uses
957 ++ * TB rather than ticks, so it can be done without enabling
958 ++ * interrupts here, which has the problem that it accounts
959 ++ * interrupt processing overhead to the host.
960 ++ */
961 ++ local_irq_disable();
962 ++ }
963 ++ vtime_account_guest_exit();
964 ++
965 + local_irq_enable();
966 +- guest_exit();
967 +
968 + /* Let secondaries go back to the offline loop */
969 + for (i = 0; i < controlled_threads; ++i) {
970 +@@ -4235,8 +4249,22 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
971 +
972 + kvmppc_set_host_core(pcpu);
973 +
974 ++ context_tracking_guest_exit();
975 ++ if (!vtime_accounting_enabled_this_cpu()) {
976 ++ local_irq_enable();
977 ++ /*
978 ++ * Service IRQs here before vtime_account_guest_exit() so any
979 ++ * ticks that occurred while running the guest are accounted to
980 ++ * the guest. If vtime accounting is enabled, accounting uses
981 ++ * TB rather than ticks, so it can be done without enabling
982 ++ * interrupts here, which has the problem that it accounts
983 ++ * interrupt processing overhead to the host.
984 ++ */
985 ++ local_irq_disable();
986 ++ }
987 ++ vtime_account_guest_exit();
988 ++
989 + local_irq_enable();
990 +- guest_exit();
991 +
992 + cpumask_clear_cpu(pcpu, &kvm->arch.cpu_in_guest);
993 +
994 +diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
995 +index b1abcb8164397..75381beb7514a 100644
996 +--- a/arch/powerpc/kvm/booke.c
997 ++++ b/arch/powerpc/kvm/booke.c
998 +@@ -1016,7 +1016,21 @@ int kvmppc_handle_exit(struct kvm_vcpu *vcpu, unsigned int exit_nr)
999 + }
1000 +
1001 + trace_kvm_exit(exit_nr, vcpu);
1002 +- guest_exit_irqoff();
1003 ++
1004 ++ context_tracking_guest_exit();
1005 ++ if (!vtime_accounting_enabled_this_cpu()) {
1006 ++ local_irq_enable();
1007 ++ /*
1008 ++ * Service IRQs here before vtime_account_guest_exit() so any
1009 ++ * ticks that occurred while running the guest are accounted to
1010 ++ * the guest. If vtime accounting is enabled, accounting uses
1011 ++ * TB rather than ticks, so it can be done without enabling
1012 ++ * interrupts here, which has the problem that it accounts
1013 ++ * interrupt processing overhead to the host.
1014 ++ */
1015 ++ local_irq_disable();
1016 ++ }
1017 ++ vtime_account_guest_exit();
1018 +
1019 + local_irq_enable();
1020 +
1021 +diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
1022 +index 2f73cb5bf12d5..f386a7bc38114 100644
1023 +--- a/arch/powerpc/platforms/pseries/mobility.c
1024 ++++ b/arch/powerpc/platforms/pseries/mobility.c
1025 +@@ -59,18 +59,31 @@ static int mobility_rtas_call(int token, char *buf, s32 scope)
1026 + return rc;
1027 + }
1028 +
1029 +-static int delete_dt_node(__be32 phandle)
1030 ++static int delete_dt_node(struct device_node *dn)
1031 + {
1032 +- struct device_node *dn;
1033 ++ struct device_node *pdn;
1034 ++ bool is_platfac;
1035 +
1036 +- dn = of_find_node_by_phandle(be32_to_cpu(phandle));
1037 +- if (!dn)
1038 +- return -ENOENT;
1039 ++ pdn = of_get_parent(dn);
1040 ++ is_platfac = of_node_is_type(dn, "ibm,platform-facilities") ||
1041 ++ of_node_is_type(pdn, "ibm,platform-facilities");
1042 ++ of_node_put(pdn);
1043 +
1044 +- pr_debug("removing node %pOFfp\n", dn);
1045 ++ /*
1046 ++ * The drivers that bind to nodes in the platform-facilities
1047 ++ * hierarchy don't support node removal, and the removal directive
1048 ++ * from firmware is always followed by an add of an equivalent
1049 ++ * node. The capability (e.g. RNG, encryption, compression)
1050 ++ * represented by the node is never interrupted by the migration.
1051 ++ * So ignore changes to this part of the tree.
1052 ++ */
1053 ++ if (is_platfac) {
1054 ++ pr_notice("ignoring remove operation for %pOFfp\n", dn);
1055 ++ return 0;
1056 ++ }
1057 +
1058 ++ pr_debug("removing node %pOFfp\n", dn);
1059 + dlpar_detach_node(dn);
1060 +- of_node_put(dn);
1061 + return 0;
1062 + }
1063 +
1064 +@@ -135,10 +148,9 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
1065 + return 0;
1066 + }
1067 +
1068 +-static int update_dt_node(__be32 phandle, s32 scope)
1069 ++static int update_dt_node(struct device_node *dn, s32 scope)
1070 + {
1071 + struct update_props_workarea *upwa;
1072 +- struct device_node *dn;
1073 + struct property *prop = NULL;
1074 + int i, rc, rtas_rc;
1075 + char *prop_data;
1076 +@@ -155,14 +167,8 @@ static int update_dt_node(__be32 phandle, s32 scope)
1077 + if (!rtas_buf)
1078 + return -ENOMEM;
1079 +
1080 +- dn = of_find_node_by_phandle(be32_to_cpu(phandle));
1081 +- if (!dn) {
1082 +- kfree(rtas_buf);
1083 +- return -ENOENT;
1084 +- }
1085 +-
1086 + upwa = (struct update_props_workarea *)&rtas_buf[0];
1087 +- upwa->phandle = phandle;
1088 ++ upwa->phandle = cpu_to_be32(dn->phandle);
1089 +
1090 + do {
1091 + rtas_rc = mobility_rtas_call(update_properties_token, rtas_buf,
1092 +@@ -221,25 +227,30 @@ static int update_dt_node(__be32 phandle, s32 scope)
1093 + cond_resched();
1094 + } while (rtas_rc == 1);
1095 +
1096 +- of_node_put(dn);
1097 + kfree(rtas_buf);
1098 + return 0;
1099 + }
1100 +
1101 +-static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
1102 ++static int add_dt_node(struct device_node *parent_dn, __be32 drc_index)
1103 + {
1104 + struct device_node *dn;
1105 +- struct device_node *parent_dn;
1106 + int rc;
1107 +
1108 +- parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle));
1109 +- if (!parent_dn)
1110 +- return -ENOENT;
1111 +-
1112 + dn = dlpar_configure_connector(drc_index, parent_dn);
1113 +- if (!dn) {
1114 +- of_node_put(parent_dn);
1115 ++ if (!dn)
1116 + return -ENOENT;
1117 ++
1118 ++ /*
1119 ++ * Since delete_dt_node() ignores this node type, this is the
1120 ++ * necessary counterpart. We also know that a platform-facilities
1121 ++ * node returned from dlpar_configure_connector() has children
1122 ++ * attached, and dlpar_attach_node() only adds the parent, leaking
1123 ++ * the children. So ignore these on the add side for now.
1124 ++ */
1125 ++ if (of_node_is_type(dn, "ibm,platform-facilities")) {
1126 ++ pr_notice("ignoring add operation for %pOF\n", dn);
1127 ++ dlpar_free_cc_nodes(dn);
1128 ++ return 0;
1129 + }
1130 +
1131 + rc = dlpar_attach_node(dn, parent_dn);
1132 +@@ -248,7 +259,6 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
1133 +
1134 + pr_debug("added node %pOFfp\n", dn);
1135 +
1136 +- of_node_put(parent_dn);
1137 + return rc;
1138 + }
1139 +
1140 +@@ -281,22 +291,31 @@ int pseries_devicetree_update(s32 scope)
1141 + data++;
1142 +
1143 + for (i = 0; i < node_count; i++) {
1144 ++ struct device_node *np;
1145 + __be32 phandle = *data++;
1146 + __be32 drc_index;
1147 +
1148 ++ np = of_find_node_by_phandle(be32_to_cpu(phandle));
1149 ++ if (!np) {
1150 ++ pr_warn("Failed lookup: phandle 0x%x for action 0x%x\n",
1151 ++ be32_to_cpu(phandle), action);
1152 ++ continue;
1153 ++ }
1154 ++
1155 + switch (action) {
1156 + case DELETE_DT_NODE:
1157 +- delete_dt_node(phandle);
1158 ++ delete_dt_node(np);
1159 + break;
1160 + case UPDATE_DT_NODE:
1161 +- update_dt_node(phandle, scope);
1162 ++ update_dt_node(np, scope);
1163 + break;
1164 + case ADD_DT_NODE:
1165 + drc_index = *data++;
1166 +- add_dt_node(phandle, drc_index);
1167 ++ add_dt_node(np, drc_index);
1168 + break;
1169 + }
1170 +
1171 ++ of_node_put(np);
1172 + cond_resched();
1173 + }
1174 + }
1175 +diff --git a/drivers/dma/bestcomm/ata.c b/drivers/dma/bestcomm/ata.c
1176 +index 2fd87f83cf90b..e169f18da551f 100644
1177 +--- a/drivers/dma/bestcomm/ata.c
1178 ++++ b/drivers/dma/bestcomm/ata.c
1179 +@@ -133,7 +133,7 @@ void bcom_ata_reset_bd(struct bcom_task *tsk)
1180 + struct bcom_ata_var *var;
1181 +
1182 + /* Reset all BD */
1183 +- memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1184 ++ memset_io(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1185 +
1186 + tsk->index = 0;
1187 + tsk->outdex = 0;
1188 +diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
1189 +index d91cbbe7a48fb..8c42e5ca00a99 100644
1190 +--- a/drivers/dma/bestcomm/bestcomm.c
1191 ++++ b/drivers/dma/bestcomm/bestcomm.c
1192 +@@ -95,7 +95,7 @@ bcom_task_alloc(int bd_count, int bd_size, int priv_size)
1193 + tsk->bd = bcom_sram_alloc(bd_count * bd_size, 4, &tsk->bd_pa);
1194 + if (!tsk->bd)
1195 + goto error;
1196 +- memset(tsk->bd, 0x00, bd_count * bd_size);
1197 ++ memset_io(tsk->bd, 0x00, bd_count * bd_size);
1198 +
1199 + tsk->num_bd = bd_count;
1200 + tsk->bd_size = bd_size;
1201 +@@ -186,16 +186,16 @@ bcom_load_image(int task, u32 *task_image)
1202 + inc = bcom_task_inc(task);
1203 +
1204 + /* Clear & copy */
1205 +- memset(var, 0x00, BCOM_VAR_SIZE);
1206 +- memset(inc, 0x00, BCOM_INC_SIZE);
1207 ++ memset_io(var, 0x00, BCOM_VAR_SIZE);
1208 ++ memset_io(inc, 0x00, BCOM_INC_SIZE);
1209 +
1210 + desc_src = (u32 *)(hdr + 1);
1211 + var_src = desc_src + hdr->desc_size;
1212 + inc_src = var_src + hdr->var_size;
1213 +
1214 +- memcpy(desc, desc_src, hdr->desc_size * sizeof(u32));
1215 +- memcpy(var + hdr->first_var, var_src, hdr->var_size * sizeof(u32));
1216 +- memcpy(inc, inc_src, hdr->inc_size * sizeof(u32));
1217 ++ memcpy_toio(desc, desc_src, hdr->desc_size * sizeof(u32));
1218 ++ memcpy_toio(var + hdr->first_var, var_src, hdr->var_size * sizeof(u32));
1219 ++ memcpy_toio(inc, inc_src, hdr->inc_size * sizeof(u32));
1220 +
1221 + return 0;
1222 + }
1223 +@@ -302,13 +302,13 @@ static int bcom_engine_init(void)
1224 + return -ENOMEM;
1225 + }
1226 +
1227 +- memset(bcom_eng->tdt, 0x00, tdt_size);
1228 +- memset(bcom_eng->ctx, 0x00, ctx_size);
1229 +- memset(bcom_eng->var, 0x00, var_size);
1230 +- memset(bcom_eng->fdt, 0x00, fdt_size);
1231 ++ memset_io(bcom_eng->tdt, 0x00, tdt_size);
1232 ++ memset_io(bcom_eng->ctx, 0x00, ctx_size);
1233 ++ memset_io(bcom_eng->var, 0x00, var_size);
1234 ++ memset_io(bcom_eng->fdt, 0x00, fdt_size);
1235 +
1236 + /* Copy the FDT for the EU#3 */
1237 +- memcpy(&bcom_eng->fdt[48], fdt_ops, sizeof(fdt_ops));
1238 ++ memcpy_toio(&bcom_eng->fdt[48], fdt_ops, sizeof(fdt_ops));
1239 +
1240 + /* Initialize Task base structure */
1241 + for (task=0; task<BCOM_MAX_TASKS; task++)
1242 +diff --git a/drivers/dma/bestcomm/fec.c b/drivers/dma/bestcomm/fec.c
1243 +index 7f1fb1c999e43..d203618ac11fe 100644
1244 +--- a/drivers/dma/bestcomm/fec.c
1245 ++++ b/drivers/dma/bestcomm/fec.c
1246 +@@ -140,7 +140,7 @@ bcom_fec_rx_reset(struct bcom_task *tsk)
1247 + tsk->index = 0;
1248 + tsk->outdex = 0;
1249 +
1250 +- memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1251 ++ memset_io(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1252 +
1253 + /* Configure some stuff */
1254 + bcom_set_task_pragma(tsk->tasknum, BCOM_FEC_RX_BD_PRAGMA);
1255 +@@ -241,7 +241,7 @@ bcom_fec_tx_reset(struct bcom_task *tsk)
1256 + tsk->index = 0;
1257 + tsk->outdex = 0;
1258 +
1259 +- memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1260 ++ memset_io(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1261 +
1262 + /* Configure some stuff */
1263 + bcom_set_task_pragma(tsk->tasknum, BCOM_FEC_TX_BD_PRAGMA);
1264 +diff --git a/drivers/dma/bestcomm/gen_bd.c b/drivers/dma/bestcomm/gen_bd.c
1265 +index 906ddba6a6f5d..8a24a5cbc2633 100644
1266 +--- a/drivers/dma/bestcomm/gen_bd.c
1267 ++++ b/drivers/dma/bestcomm/gen_bd.c
1268 +@@ -142,7 +142,7 @@ bcom_gen_bd_rx_reset(struct bcom_task *tsk)
1269 + tsk->index = 0;
1270 + tsk->outdex = 0;
1271 +
1272 +- memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1273 ++ memset_io(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1274 +
1275 + /* Configure some stuff */
1276 + bcom_set_task_pragma(tsk->tasknum, BCOM_GEN_RX_BD_PRAGMA);
1277 +@@ -226,7 +226,7 @@ bcom_gen_bd_tx_reset(struct bcom_task *tsk)
1278 + tsk->index = 0;
1279 + tsk->outdex = 0;
1280 +
1281 +- memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1282 ++ memset_io(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
1283 +
1284 + /* Configure some stuff */
1285 + bcom_set_task_pragma(tsk->tasknum, BCOM_GEN_TX_BD_PRAGMA);
1286 +diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
1287 +index d60d5520707dc..60c2533a39a5f 100644
1288 +--- a/drivers/gpio/gpio-mpc8xxx.c
1289 ++++ b/drivers/gpio/gpio-mpc8xxx.c
1290 +@@ -169,6 +169,7 @@ static int mpc8xxx_irq_set_type(struct irq_data *d, unsigned int flow_type)
1291 +
1292 + switch (flow_type) {
1293 + case IRQ_TYPE_EDGE_FALLING:
1294 ++ case IRQ_TYPE_LEVEL_LOW:
1295 + raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
1296 + gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR,
1297 + gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR)
1298 +diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
1299 +index 35338ed182099..255c6b863f8d2 100644
1300 +--- a/drivers/gpu/drm/meson/meson_plane.c
1301 ++++ b/drivers/gpu/drm/meson/meson_plane.c
1302 +@@ -163,7 +163,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
1303 +
1304 + /* Enable OSD and BLK0, set max global alpha */
1305 + priv->viu.osd1_ctrl_stat = OSD_ENABLE |
1306 +- (0xFF << OSD_GLOBAL_ALPHA_SHIFT) |
1307 ++ (0x100 << OSD_GLOBAL_ALPHA_SHIFT) |
1308 + OSD_BLK0_ENABLE;
1309 +
1310 + priv->viu.osd1_ctrl_stat2 = readl(priv->io_base +
1311 +diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c
1312 +index bb7e109534de1..d4b907889a21d 100644
1313 +--- a/drivers/gpu/drm/meson/meson_viu.c
1314 ++++ b/drivers/gpu/drm/meson/meson_viu.c
1315 +@@ -94,7 +94,7 @@ static void meson_viu_set_g12a_osd1_matrix(struct meson_drm *priv,
1316 + priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12));
1317 + writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff),
1318 + priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21));
1319 +- writel((m[11] & 0x1fff) << 16,
1320 ++ writel((m[11] & 0x1fff),
1321 + priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22));
1322 +
1323 + writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff),
1324 +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
1325 +index 7b7a8a74405df..371b345635e62 100644
1326 +--- a/drivers/net/dsa/mv88e6xxx/chip.c
1327 ++++ b/drivers/net/dsa/mv88e6xxx/chip.c
1328 +@@ -666,44 +666,48 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
1329 + {
1330 + struct mv88e6xxx_chip *chip = ds->priv;
1331 + struct mv88e6xxx_port *p;
1332 +- int err;
1333 ++ int err = 0;
1334 +
1335 + p = &chip->ports[port];
1336 +
1337 +- /* FIXME: is this the correct test? If we're in fixed mode on an
1338 +- * internal port, why should we process this any different from
1339 +- * PHY mode? On the other hand, the port may be automedia between
1340 +- * an internal PHY and the serdes...
1341 +- */
1342 +- if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port))
1343 +- return;
1344 +-
1345 + mv88e6xxx_reg_lock(chip);
1346 +- /* In inband mode, the link may come up at any time while the link
1347 +- * is not forced down. Force the link down while we reconfigure the
1348 +- * interface mode.
1349 +- */
1350 +- if (mode == MLO_AN_INBAND && p->interface != state->interface &&
1351 +- chip->info->ops->port_set_link)
1352 +- chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN);
1353 +-
1354 +- err = mv88e6xxx_port_config_interface(chip, port, state->interface);
1355 +- if (err && err != -EOPNOTSUPP)
1356 +- goto err_unlock;
1357 +
1358 +- err = mv88e6xxx_serdes_pcs_config(chip, port, mode, state->interface,
1359 +- state->advertising);
1360 +- /* FIXME: we should restart negotiation if something changed - which
1361 +- * is something we get if we convert to using phylinks PCS operations.
1362 +- */
1363 +- if (err > 0)
1364 +- err = 0;
1365 ++ if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) {
1366 ++ /* In inband mode, the link may come up at any time while the
1367 ++ * link is not forced down. Force the link down while we
1368 ++ * reconfigure the interface mode.
1369 ++ */
1370 ++ if (mode == MLO_AN_INBAND &&
1371 ++ p->interface != state->interface &&
1372 ++ chip->info->ops->port_set_link)
1373 ++ chip->info->ops->port_set_link(chip, port,
1374 ++ LINK_FORCED_DOWN);
1375 ++
1376 ++ err = mv88e6xxx_port_config_interface(chip, port,
1377 ++ state->interface);
1378 ++ if (err && err != -EOPNOTSUPP)
1379 ++ goto err_unlock;
1380 ++
1381 ++ err = mv88e6xxx_serdes_pcs_config(chip, port, mode,
1382 ++ state->interface,
1383 ++ state->advertising);
1384 ++ /* FIXME: we should restart negotiation if something changed -
1385 ++ * which is something we get if we convert to using phylinks
1386 ++ * PCS operations.
1387 ++ */
1388 ++ if (err > 0)
1389 ++ err = 0;
1390 ++ }
1391 +
1392 + /* Undo the forced down state above after completing configuration
1393 +- * irrespective of its state on entry, which allows the link to come up.
1394 ++ * irrespective of its state on entry, which allows the link to come
1395 ++ * up in the in-band case where there is no separate SERDES. Also
1396 ++ * ensure that the link can come up if the PPU is in use and we are
1397 ++ * in PHY mode (we treat the PPU as an effective in-band mechanism.)
1398 + */
1399 +- if (mode == MLO_AN_INBAND && p->interface != state->interface &&
1400 +- chip->info->ops->port_set_link)
1401 ++ if (chip->info->ops->port_set_link &&
1402 ++ ((mode == MLO_AN_INBAND && p->interface != state->interface) ||
1403 ++ (mode == MLO_AN_PHY && mv88e6xxx_port_ppu_updates(chip, port))))
1404 + chip->info->ops->port_set_link(chip, port, LINK_UNFORCED);
1405 +
1406 + p->interface = state->interface;
1407 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1408 +index 48e8b94e4a7c5..1502069f3a4e2 100644
1409 +--- a/drivers/net/usb/qmi_wwan.c
1410 ++++ b/drivers/net/usb/qmi_wwan.c
1411 +@@ -1024,6 +1024,7 @@ static const struct usb_device_id products[] = {
1412 + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */
1413 + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */
1414 + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */
1415 ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */
1416 +
1417 + /* 3. Combined interface devices matching on interface number */
1418 + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
1419 +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
1420 +index 8e412125a49c1..50190ded7edc7 100644
1421 +--- a/drivers/net/wireless/mac80211_hwsim.c
1422 ++++ b/drivers/net/wireless/mac80211_hwsim.c
1423 +@@ -4209,6 +4209,10 @@ static int hwsim_virtio_handle_cmd(struct sk_buff *skb)
1424 +
1425 + nlh = nlmsg_hdr(skb);
1426 + gnlh = nlmsg_data(nlh);
1427 ++
1428 ++ if (skb->len < nlh->nlmsg_len)
1429 ++ return -EINVAL;
1430 ++
1431 + err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX,
1432 + hwsim_genl_policy, NULL);
1433 + if (err) {
1434 +@@ -4251,7 +4255,8 @@ static void hwsim_virtio_rx_work(struct work_struct *work)
1435 + spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
1436 +
1437 + skb->data = skb->head;
1438 +- skb_set_tail_pointer(skb, len);
1439 ++ skb_reset_tail_pointer(skb);
1440 ++ skb_put(skb, len);
1441 + hwsim_virtio_handle_cmd(skb);
1442 +
1443 + spin_lock_irqsave(&hwsim_virtio_lock, flags);
1444 +diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
1445 +index 57ff31b6b1e47..5a1b8688b4605 100644
1446 +--- a/drivers/of/fdt.c
1447 ++++ b/drivers/of/fdt.c
1448 +@@ -315,7 +315,7 @@ static int unflatten_dt_nodes(const void *blob,
1449 + for (offset = 0;
1450 + offset >= 0 && depth >= initial_depth;
1451 + offset = fdt_next_node(blob, offset, &depth)) {
1452 +- if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH))
1453 ++ if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH - 1))
1454 + continue;
1455 +
1456 + if (!IS_ENABLED(CONFIG_OF_KOBJ) &&
1457 +diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
1458 +index ffd5000c23d39..be81b765858be 100644
1459 +--- a/drivers/parisc/ccio-dma.c
1460 ++++ b/drivers/parisc/ccio-dma.c
1461 +@@ -1546,6 +1546,7 @@ static int __init ccio_probe(struct parisc_device *dev)
1462 + }
1463 + ccio_ioc_init(ioc);
1464 + if (ccio_init_resources(ioc)) {
1465 ++ iounmap(ioc->ioc_regs);
1466 + kfree(ioc);
1467 + return -ENOMEM;
1468 + }
1469 +diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c
1470 +index 21054fcacd345..18088f6f44b23 100644
1471 +--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c
1472 ++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c
1473 +@@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(of, a100_r_pinctrl_match);
1474 + static struct platform_driver a100_r_pinctrl_driver = {
1475 + .probe = a100_r_pinctrl_probe,
1476 + .driver = {
1477 +- .name = "sun50iw10p1-r-pinctrl",
1478 ++ .name = "sun50i-a100-r-pinctrl",
1479 + .of_match_table = a100_r_pinctrl_match,
1480 + },
1481 + };
1482 +diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
1483 +index 8a0cd5bf00657..cebddefba2f42 100644
1484 +--- a/drivers/platform/x86/intel-hid.c
1485 ++++ b/drivers/platform/x86/intel-hid.c
1486 +@@ -93,6 +93,13 @@ static const struct dmi_system_id button_array_table[] = {
1487 + DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"),
1488 + },
1489 + },
1490 ++ {
1491 ++ .ident = "Microsoft Surface Go 3",
1492 ++ .matches = {
1493 ++ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
1494 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"),
1495 ++ },
1496 ++ },
1497 + { }
1498 + };
1499 +
1500 +diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
1501 +index 0a19500d3725e..44a8e500fb304 100644
1502 +--- a/drivers/regulator/pfuze100-regulator.c
1503 ++++ b/drivers/regulator/pfuze100-regulator.c
1504 +@@ -791,7 +791,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
1505 + ((pfuze_chip->chip_id == PFUZE3000) ? "3000" : "3001"))));
1506 +
1507 + memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators,
1508 +- sizeof(pfuze_chip->regulator_descs));
1509 ++ regulator_num * sizeof(struct pfuze_regulator));
1510 +
1511 + ret = pfuze_parse_regulators_dt(pfuze_chip);
1512 + if (ret)
1513 +diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
1514 +index a37ea946459cc..c6fc14b169dac 100644
1515 +--- a/drivers/usb/cdns3/gadget.c
1516 ++++ b/drivers/usb/cdns3/gadget.c
1517 +@@ -352,19 +352,6 @@ static void cdns3_ep_inc_deq(struct cdns3_endpoint *priv_ep)
1518 + cdns3_ep_inc_trb(&priv_ep->dequeue, &priv_ep->ccs, priv_ep->num_trbs);
1519 + }
1520 +
1521 +-static void cdns3_move_deq_to_next_trb(struct cdns3_request *priv_req)
1522 +-{
1523 +- struct cdns3_endpoint *priv_ep = priv_req->priv_ep;
1524 +- int current_trb = priv_req->start_trb;
1525 +-
1526 +- while (current_trb != priv_req->end_trb) {
1527 +- cdns3_ep_inc_deq(priv_ep);
1528 +- current_trb = priv_ep->dequeue;
1529 +- }
1530 +-
1531 +- cdns3_ep_inc_deq(priv_ep);
1532 +-}
1533 +-
1534 + /**
1535 + * cdns3_allow_enable_l1 - enable/disable permits to transition to L1.
1536 + * @priv_dev: Extended gadget object
1537 +@@ -1518,10 +1505,11 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev,
1538 +
1539 + trb = priv_ep->trb_pool + priv_ep->dequeue;
1540 +
1541 +- /* Request was dequeued and TRB was changed to TRB_LINK. */
1542 +- if (TRB_FIELD_TO_TYPE(le32_to_cpu(trb->control)) == TRB_LINK) {
1543 ++ /* The TRB was changed as link TRB, and the request was handled at ep_dequeue */
1544 ++ while (TRB_FIELD_TO_TYPE(le32_to_cpu(trb->control)) == TRB_LINK) {
1545 + trace_cdns3_complete_trb(priv_ep, trb);
1546 +- cdns3_move_deq_to_next_trb(priv_req);
1547 ++ cdns3_ep_inc_deq(priv_ep);
1548 ++ trb = priv_ep->trb_pool + priv_ep->dequeue;
1549 + }
1550 +
1551 + if (!request->stream_id) {
1552 +diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c
1553 +index ad5ced4ef972d..8fb4e01e1943f 100644
1554 +--- a/drivers/video/fbdev/i740fb.c
1555 ++++ b/drivers/video/fbdev/i740fb.c
1556 +@@ -662,6 +662,9 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,
1557 +
1558 + static int i740fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1559 + {
1560 ++ if (!var->pixclock)
1561 ++ return -EINVAL;
1562 ++
1563 + switch (var->bits_per_pixel) {
1564 + case 8:
1565 + var->red.offset = var->green.offset = var->blue.offset = 0;
1566 +diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
1567 +index 9421d14d0eb02..9e9888e40c573 100644
1568 +--- a/drivers/video/fbdev/pxa3xx-gcu.c
1569 ++++ b/drivers/video/fbdev/pxa3xx-gcu.c
1570 +@@ -381,7 +381,7 @@ pxa3xx_gcu_write(struct file *file, const char *buff,
1571 + struct pxa3xx_gcu_batch *buffer;
1572 + struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
1573 +
1574 +- int words = count / 4;
1575 ++ size_t words = count / 4;
1576 +
1577 + /* Does not need to be atomic. There's a lock in user space,
1578 + * but anyhow, this is just for statistics. */
1579 +diff --git a/fs/afs/misc.c b/fs/afs/misc.c
1580 +index 1d1a8debe4723..f1dc2162900a4 100644
1581 +--- a/fs/afs/misc.c
1582 ++++ b/fs/afs/misc.c
1583 +@@ -69,6 +69,7 @@ int afs_abort_to_error(u32 abort_code)
1584 + /* Unified AFS error table */
1585 + case UAEPERM: return -EPERM;
1586 + case UAENOENT: return -ENOENT;
1587 ++ case UAEAGAIN: return -EAGAIN;
1588 + case UAEACCES: return -EACCES;
1589 + case UAEBUSY: return -EBUSY;
1590 + case UAEEXIST: return -EEXIST;
1591 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1592 +index 6c06870f90184..fafb69d338c26 100644
1593 +--- a/fs/cifs/file.c
1594 ++++ b/fs/cifs/file.c
1595 +@@ -3244,6 +3244,9 @@ static ssize_t __cifs_writev(
1596 +
1597 + ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from)
1598 + {
1599 ++ struct file *file = iocb->ki_filp;
1600 ++
1601 ++ cifs_revalidate_mapping(file->f_inode);
1602 + return __cifs_writev(iocb, from, true);
1603 + }
1604 +
1605 +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
1606 +index 503a0056b60f2..383ae8744c337 100644
1607 +--- a/fs/cifs/transport.c
1608 ++++ b/fs/cifs/transport.c
1609 +@@ -209,8 +209,8 @@ smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg,
1610 +
1611 + *sent = 0;
1612 +
1613 +- smb_msg->msg_name = (struct sockaddr *) &server->dstaddr;
1614 +- smb_msg->msg_namelen = sizeof(struct sockaddr);
1615 ++ smb_msg->msg_name = NULL;
1616 ++ smb_msg->msg_namelen = 0;
1617 + smb_msg->msg_control = NULL;
1618 + smb_msg->msg_controllen = 0;
1619 + if (server->noblocksnd)
1620 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
1621 +index 4034102010f05..b3fcc27b95648 100644
1622 +--- a/fs/nfs/super.c
1623 ++++ b/fs/nfs/super.c
1624 +@@ -1029,22 +1029,31 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
1625 + if (ctx && ctx->bsize)
1626 + sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
1627 +
1628 +- if (server->nfs_client->rpc_ops->version != 2) {
1629 +- /* The VFS shouldn't apply the umask to mode bits. We will do
1630 +- * so ourselves when necessary.
1631 ++ switch (server->nfs_client->rpc_ops->version) {
1632 ++ case 2:
1633 ++ sb->s_time_gran = 1000;
1634 ++ sb->s_time_min = 0;
1635 ++ sb->s_time_max = U32_MAX;
1636 ++ break;
1637 ++ case 3:
1638 ++ /*
1639 ++ * The VFS shouldn't apply the umask to mode bits.
1640 ++ * We will do so ourselves when necessary.
1641 + */
1642 + sb->s_flags |= SB_POSIXACL;
1643 + sb->s_time_gran = 1;
1644 +- sb->s_export_op = &nfs_export_ops;
1645 +- } else
1646 +- sb->s_time_gran = 1000;
1647 +-
1648 +- if (server->nfs_client->rpc_ops->version != 4) {
1649 + sb->s_time_min = 0;
1650 + sb->s_time_max = U32_MAX;
1651 +- } else {
1652 ++ sb->s_export_op = &nfs_export_ops;
1653 ++ break;
1654 ++ case 4:
1655 ++ sb->s_flags |= SB_POSIXACL;
1656 ++ sb->s_time_gran = 1;
1657 + sb->s_time_min = S64_MIN;
1658 + sb->s_time_max = S64_MAX;
1659 ++ if (server->caps & NFS_CAP_ATOMIC_OPEN_V1)
1660 ++ sb->s_export_op = &nfs_export_ops;
1661 ++ break;
1662 + }
1663 +
1664 + sb->s_magic = NFS_SUPER_MAGIC;
1665 +diff --git a/include/linux/of_device.h b/include/linux/of_device.h
1666 +index 07ca187fc5e44..fe339106e02c4 100644
1667 +--- a/include/linux/of_device.h
1668 ++++ b/include/linux/of_device.h
1669 +@@ -113,8 +113,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
1670 + }
1671 +
1672 + static inline int of_dma_configure_id(struct device *dev,
1673 +- struct device_node *np,
1674 +- bool force_dma)
1675 ++ struct device_node *np,
1676 ++ bool force_dma,
1677 ++ const u32 *id)
1678 + {
1679 + return 0;
1680 + }
1681 +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
1682 +index 1a0a9f820c69b..433b9e840b387 100644
1683 +--- a/kernel/cgroup/cgroup-v1.c
1684 ++++ b/kernel/cgroup/cgroup-v1.c
1685 +@@ -57,6 +57,7 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
1686 + int retval = 0;
1687 +
1688 + mutex_lock(&cgroup_mutex);
1689 ++ cpus_read_lock();
1690 + percpu_down_write(&cgroup_threadgroup_rwsem);
1691 + for_each_root(root) {
1692 + struct cgroup *from_cgrp;
1693 +@@ -73,6 +74,7 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk)
1694 + break;
1695 + }
1696 + percpu_up_write(&cgroup_threadgroup_rwsem);
1697 ++ cpus_read_unlock();
1698 + mutex_unlock(&cgroup_mutex);
1699 +
1700 + return retval;
1701 +diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
1702 +index f4938040c2286..3aa55b8075608 100644
1703 +--- a/kernel/trace/trace_preemptirq.c
1704 ++++ b/kernel/trace/trace_preemptirq.c
1705 +@@ -94,15 +94,15 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
1706 + this_cpu_write(tracing_irq_cpu, 0);
1707 + }
1708 +
1709 +- lockdep_hardirqs_on_prepare(CALLER_ADDR0);
1710 +- lockdep_hardirqs_on(CALLER_ADDR0);
1711 ++ lockdep_hardirqs_on_prepare(caller_addr);
1712 ++ lockdep_hardirqs_on(caller_addr);
1713 + }
1714 + EXPORT_SYMBOL(trace_hardirqs_on_caller);
1715 + NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
1716 +
1717 + __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
1718 + {
1719 +- lockdep_hardirqs_off(CALLER_ADDR0);
1720 ++ lockdep_hardirqs_off(caller_addr);
1721 +
1722 + if (!this_cpu_read(tracing_irq_cpu)) {
1723 + this_cpu_write(tracing_irq_cpu, 1);
1724 +diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
1725 +index f8ecad2b730e8..2a93e7b5fbd05 100644
1726 +--- a/net/rxrpc/call_event.c
1727 ++++ b/net/rxrpc/call_event.c
1728 +@@ -166,7 +166,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
1729 + _enter("{%d,%d}", call->tx_hard_ack, call->tx_top);
1730 +
1731 + now = ktime_get_real();
1732 +- max_age = ktime_sub(now, jiffies_to_usecs(call->peer->rto_j));
1733 ++ max_age = ktime_sub_us(now, jiffies_to_usecs(call->peer->rto_j));
1734 +
1735 + spin_lock_bh(&call->lock);
1736 +
1737 +diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
1738 +index 8c2881054266d..ebbf1b03b62cf 100644
1739 +--- a/net/rxrpc/local_object.c
1740 ++++ b/net/rxrpc/local_object.c
1741 +@@ -424,6 +424,9 @@ static void rxrpc_local_processor(struct work_struct *work)
1742 + container_of(work, struct rxrpc_local, processor);
1743 + bool again;
1744 +
1745 ++ if (local->dead)
1746 ++ return;
1747 ++
1748 + trace_rxrpc_local(local->debug_id, rxrpc_local_processing,
1749 + atomic_read(&local->usage), NULL);
1750 +
1751 +diff --git a/scripts/mksysmap b/scripts/mksysmap
1752 +index 9aa23d15862a0..ad8bbc52267d0 100755
1753 +--- a/scripts/mksysmap
1754 ++++ b/scripts/mksysmap
1755 +@@ -41,4 +41,4 @@
1756 + # so we just ignore them to let readprofile continue to work.
1757 + # (At least sparc64 has __crc_ in the middle).
1758 +
1759 +-$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2
1760 ++$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)\|\( L0\)' > $2
1761 +diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
1762 +index 07787698b9738..1e44e337986e8 100644
1763 +--- a/sound/pci/hda/hda_tegra.c
1764 ++++ b/sound/pci/hda/hda_tegra.c
1765 +@@ -479,7 +479,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match);
1766 + static int hda_tegra_probe(struct platform_device *pdev)
1767 + {
1768 + const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR |
1769 +- AZX_DCAPS_PM_RUNTIME;
1770 ++ AZX_DCAPS_PM_RUNTIME |
1771 ++ AZX_DCAPS_4K_BDLE_BOUNDARY;
1772 + struct snd_card *card;
1773 + struct azx *chip;
1774 + struct hda_tegra *hda;
1775 +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
1776 +index c662431bf13a5..b848e435b93fd 100644
1777 +--- a/sound/pci/hda/patch_sigmatel.c
1778 ++++ b/sound/pci/hda/patch_sigmatel.c
1779 +@@ -209,6 +209,7 @@ struct sigmatel_spec {
1780 +
1781 + /* beep widgets */
1782 + hda_nid_t anabeep_nid;
1783 ++ bool beep_power_on;
1784 +
1785 + /* SPDIF-out mux */
1786 + const char * const *spdif_labels;
1787 +@@ -4447,6 +4448,28 @@ static int stac_suspend(struct hda_codec *codec)
1788 + stac_shutup(codec);
1789 + return 0;
1790 + }
1791 ++
1792 ++static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid)
1793 ++{
1794 ++#ifdef CONFIG_SND_HDA_INPUT_BEEP
1795 ++ struct sigmatel_spec *spec = codec->spec;
1796 ++#endif
1797 ++ int ret = snd_hda_gen_check_power_status(codec, nid);
1798 ++
1799 ++#ifdef CONFIG_SND_HDA_INPUT_BEEP
1800 ++ if (nid == spec->gen.beep_nid && codec->beep) {
1801 ++ if (codec->beep->enabled != spec->beep_power_on) {
1802 ++ spec->beep_power_on = codec->beep->enabled;
1803 ++ if (spec->beep_power_on)
1804 ++ snd_hda_power_up_pm(codec);
1805 ++ else
1806 ++ snd_hda_power_down_pm(codec);
1807 ++ }
1808 ++ ret |= spec->beep_power_on;
1809 ++ }
1810 ++#endif
1811 ++ return ret;
1812 ++}
1813 + #else
1814 + #define stac_suspend NULL
1815 + #endif /* CONFIG_PM */
1816 +@@ -4459,6 +4482,7 @@ static const struct hda_codec_ops stac_patch_ops = {
1817 + .unsol_event = snd_hda_jack_unsol_event,
1818 + #ifdef CONFIG_PM
1819 + .suspend = stac_suspend,
1820 ++ .check_power_status = stac_check_power_status,
1821 + #endif
1822 + .reboot_notify = stac_shutup,
1823 + };
1824 +diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c
1825 +index c8ccfa2fff848..a95fe3fff1db8 100644
1826 +--- a/sound/soc/codecs/nau8824.c
1827 ++++ b/sound/soc/codecs/nau8824.c
1828 +@@ -1072,6 +1072,7 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
1829 + struct snd_soc_component *component = dai->component;
1830 + struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
1831 + unsigned int val_len = 0, osr, ctrl_val, bclk_fs, bclk_div;
1832 ++ int err = -EINVAL;
1833 +
1834 + nau8824_sema_acquire(nau8824, HZ);
1835 +
1836 +@@ -1088,7 +1089,7 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
1837 + osr &= NAU8824_DAC_OVERSAMPLE_MASK;
1838 + if (nau8824_clock_check(nau8824, substream->stream,
1839 + nau8824->fs, osr))
1840 +- return -EINVAL;
1841 ++ goto error;
1842 + regmap_update_bits(nau8824->regmap, NAU8824_REG_CLK_DIVIDER,
1843 + NAU8824_CLK_DAC_SRC_MASK,
1844 + osr_dac_sel[osr].clk_src << NAU8824_CLK_DAC_SRC_SFT);
1845 +@@ -1098,7 +1099,7 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
1846 + osr &= NAU8824_ADC_SYNC_DOWN_MASK;
1847 + if (nau8824_clock_check(nau8824, substream->stream,
1848 + nau8824->fs, osr))
1849 +- return -EINVAL;
1850 ++ goto error;
1851 + regmap_update_bits(nau8824->regmap, NAU8824_REG_CLK_DIVIDER,
1852 + NAU8824_CLK_ADC_SRC_MASK,
1853 + osr_adc_sel[osr].clk_src << NAU8824_CLK_ADC_SRC_SFT);
1854 +@@ -1119,7 +1120,7 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
1855 + else if (bclk_fs <= 256)
1856 + bclk_div = 0;
1857 + else
1858 +- return -EINVAL;
1859 ++ goto error;
1860 + regmap_update_bits(nau8824->regmap,
1861 + NAU8824_REG_PORT0_I2S_PCM_CTRL_2,
1862 + NAU8824_I2S_LRC_DIV_MASK | NAU8824_I2S_BLK_DIV_MASK,
1863 +@@ -1140,15 +1141,17 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
1864 + val_len |= NAU8824_I2S_DL_32;
1865 + break;
1866 + default:
1867 +- return -EINVAL;
1868 ++ goto error;
1869 + }
1870 +
1871 + regmap_update_bits(nau8824->regmap, NAU8824_REG_PORT0_I2S_PCM_CTRL_1,
1872 + NAU8824_I2S_DL_MASK, val_len);
1873 ++ err = 0;
1874 +
1875 ++ error:
1876 + nau8824_sema_release(nau8824);
1877 +
1878 +- return 0;
1879 ++ return err;
1880 + }
1881 +
1882 + static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1883 +@@ -1157,8 +1160,6 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1884 + struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
1885 + unsigned int ctrl1_val = 0, ctrl2_val = 0;
1886 +
1887 +- nau8824_sema_acquire(nau8824, HZ);
1888 +-
1889 + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1890 + case SND_SOC_DAIFMT_CBM_CFM:
1891 + ctrl2_val |= NAU8824_I2S_MS_MASTER;
1892 +@@ -1200,6 +1201,8 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1893 + return -EINVAL;
1894 + }
1895 +
1896 ++ nau8824_sema_acquire(nau8824, HZ);
1897 ++
1898 + regmap_update_bits(nau8824->regmap, NAU8824_REG_PORT0_I2S_PCM_CTRL_1,
1899 + NAU8824_I2S_DF_MASK | NAU8824_I2S_BP_MASK |
1900 + NAU8824_I2S_PCMB_EN, ctrl1_val);
1901 +diff --git a/tools/include/uapi/asm/errno.h b/tools/include/uapi/asm/errno.h
1902 +index d30439b4b8ab4..869379f91fe48 100644
1903 +--- a/tools/include/uapi/asm/errno.h
1904 ++++ b/tools/include/uapi/asm/errno.h
1905 +@@ -9,8 +9,8 @@
1906 + #include "../../../arch/alpha/include/uapi/asm/errno.h"
1907 + #elif defined(__mips__)
1908 + #include "../../../arch/mips/include/uapi/asm/errno.h"
1909 +-#elif defined(__xtensa__)
1910 +-#include "../../../arch/xtensa/include/uapi/asm/errno.h"
1911 ++#elif defined(__hppa__)
1912 ++#include "../../../arch/parisc/include/uapi/asm/errno.h"
1913 + #else
1914 + #include <asm-generic/errno.h>
1915 + #endif