Contents of /trunk/kernel-magellan/patches-4.8/0101-4.8.2-all-fixes.patch
Parent Directory | Revision Log
Revision 2841 -
(show annotations)
(download)
Tue Nov 22 13:19:19 2016 UTC (7 years, 10 months ago) by niro
File size: 64777 byte(s)
Tue Nov 22 13:19:19 2016 UTC (7 years, 10 months ago) by niro
File size: 64777 byte(s)
-linux-4.8.2
1 | diff --git a/Documentation/virtual/kvm/devices/vcpu.txt b/Documentation/virtual/kvm/devices/vcpu.txt |
2 | index c04165868faf..02f50686c418 100644 |
3 | --- a/Documentation/virtual/kvm/devices/vcpu.txt |
4 | +++ b/Documentation/virtual/kvm/devices/vcpu.txt |
5 | @@ -30,4 +30,6 @@ Returns: -ENODEV: PMUv3 not supported |
6 | attribute |
7 | -EBUSY: PMUv3 already initialized |
8 | |
9 | -Request the initialization of the PMUv3. |
10 | +Request the initialization of the PMUv3. This must be done after creating the |
11 | +in-kernel irqchip. Creating a PMU with a userspace irqchip is currently not |
12 | +supported. |
13 | diff --git a/Makefile b/Makefile |
14 | index 75db9f3988f3..bf6e44a421df 100644 |
15 | --- a/Makefile |
16 | +++ b/Makefile |
17 | @@ -1,6 +1,6 @@ |
18 | VERSION = 4 |
19 | PATCHLEVEL = 8 |
20 | -SUBLEVEL = 1 |
21 | +SUBLEVEL = 2 |
22 | EXTRAVERSION = |
23 | NAME = Psychotic Stoned Sheep |
24 | |
25 | diff --git a/arch/arm/boot/dts/armada-390.dtsi b/arch/arm/boot/dts/armada-390.dtsi |
26 | index 094e39c66039..6cd18d8aaac7 100644 |
27 | --- a/arch/arm/boot/dts/armada-390.dtsi |
28 | +++ b/arch/arm/boot/dts/armada-390.dtsi |
29 | @@ -47,6 +47,8 @@ |
30 | #include "armada-39x.dtsi" |
31 | |
32 | / { |
33 | + compatible = "marvell,armada390"; |
34 | + |
35 | soc { |
36 | internal-regs { |
37 | pinctrl@18000 { |
38 | @@ -54,4 +56,5 @@ |
39 | reg = <0x18000 0x20>; |
40 | }; |
41 | }; |
42 | + }; |
43 | }; |
44 | diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi |
45 | index 74a9b6c394f5..9dc83b09d987 100644 |
46 | --- a/arch/arm/boot/dts/qcom-apq8064.dtsi |
47 | +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi |
48 | @@ -5,6 +5,7 @@ |
49 | #include <dt-bindings/reset/qcom,gcc-msm8960.h> |
50 | #include <dt-bindings/clock/qcom,mmcc-msm8960.h> |
51 | #include <dt-bindings/soc/qcom,gsbi.h> |
52 | +#include <dt-bindings/interrupt-controller/irq.h> |
53 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
54 | / { |
55 | model = "Qualcomm APQ8064"; |
56 | @@ -559,22 +560,50 @@ |
57 | compatible = "qcom,pm8921-gpio", |
58 | "qcom,ssbi-gpio"; |
59 | reg = <0x150>; |
60 | - interrupts = <192 1>, <193 1>, <194 1>, |
61 | - <195 1>, <196 1>, <197 1>, |
62 | - <198 1>, <199 1>, <200 1>, |
63 | - <201 1>, <202 1>, <203 1>, |
64 | - <204 1>, <205 1>, <206 1>, |
65 | - <207 1>, <208 1>, <209 1>, |
66 | - <210 1>, <211 1>, <212 1>, |
67 | - <213 1>, <214 1>, <215 1>, |
68 | - <216 1>, <217 1>, <218 1>, |
69 | - <219 1>, <220 1>, <221 1>, |
70 | - <222 1>, <223 1>, <224 1>, |
71 | - <225 1>, <226 1>, <227 1>, |
72 | - <228 1>, <229 1>, <230 1>, |
73 | - <231 1>, <232 1>, <233 1>, |
74 | - <234 1>, <235 1>; |
75 | - |
76 | + interrupts = <192 IRQ_TYPE_NONE>, |
77 | + <193 IRQ_TYPE_NONE>, |
78 | + <194 IRQ_TYPE_NONE>, |
79 | + <195 IRQ_TYPE_NONE>, |
80 | + <196 IRQ_TYPE_NONE>, |
81 | + <197 IRQ_TYPE_NONE>, |
82 | + <198 IRQ_TYPE_NONE>, |
83 | + <199 IRQ_TYPE_NONE>, |
84 | + <200 IRQ_TYPE_NONE>, |
85 | + <201 IRQ_TYPE_NONE>, |
86 | + <202 IRQ_TYPE_NONE>, |
87 | + <203 IRQ_TYPE_NONE>, |
88 | + <204 IRQ_TYPE_NONE>, |
89 | + <205 IRQ_TYPE_NONE>, |
90 | + <206 IRQ_TYPE_NONE>, |
91 | + <207 IRQ_TYPE_NONE>, |
92 | + <208 IRQ_TYPE_NONE>, |
93 | + <209 IRQ_TYPE_NONE>, |
94 | + <210 IRQ_TYPE_NONE>, |
95 | + <211 IRQ_TYPE_NONE>, |
96 | + <212 IRQ_TYPE_NONE>, |
97 | + <213 IRQ_TYPE_NONE>, |
98 | + <214 IRQ_TYPE_NONE>, |
99 | + <215 IRQ_TYPE_NONE>, |
100 | + <216 IRQ_TYPE_NONE>, |
101 | + <217 IRQ_TYPE_NONE>, |
102 | + <218 IRQ_TYPE_NONE>, |
103 | + <219 IRQ_TYPE_NONE>, |
104 | + <220 IRQ_TYPE_NONE>, |
105 | + <221 IRQ_TYPE_NONE>, |
106 | + <222 IRQ_TYPE_NONE>, |
107 | + <223 IRQ_TYPE_NONE>, |
108 | + <224 IRQ_TYPE_NONE>, |
109 | + <225 IRQ_TYPE_NONE>, |
110 | + <226 IRQ_TYPE_NONE>, |
111 | + <227 IRQ_TYPE_NONE>, |
112 | + <228 IRQ_TYPE_NONE>, |
113 | + <229 IRQ_TYPE_NONE>, |
114 | + <230 IRQ_TYPE_NONE>, |
115 | + <231 IRQ_TYPE_NONE>, |
116 | + <232 IRQ_TYPE_NONE>, |
117 | + <233 IRQ_TYPE_NONE>, |
118 | + <234 IRQ_TYPE_NONE>, |
119 | + <235 IRQ_TYPE_NONE>; |
120 | gpio-controller; |
121 | #gpio-cells = <2>; |
122 | |
123 | @@ -587,9 +616,18 @@ |
124 | gpio-controller; |
125 | #gpio-cells = <2>; |
126 | interrupts = |
127 | - <128 1>, <129 1>, <130 1>, <131 1>, |
128 | - <132 1>, <133 1>, <134 1>, <135 1>, |
129 | - <136 1>, <137 1>, <138 1>, <139 1>; |
130 | + <128 IRQ_TYPE_NONE>, |
131 | + <129 IRQ_TYPE_NONE>, |
132 | + <130 IRQ_TYPE_NONE>, |
133 | + <131 IRQ_TYPE_NONE>, |
134 | + <132 IRQ_TYPE_NONE>, |
135 | + <133 IRQ_TYPE_NONE>, |
136 | + <134 IRQ_TYPE_NONE>, |
137 | + <135 IRQ_TYPE_NONE>, |
138 | + <136 IRQ_TYPE_NONE>, |
139 | + <137 IRQ_TYPE_NONE>, |
140 | + <138 IRQ_TYPE_NONE>, |
141 | + <139 IRQ_TYPE_NONE>; |
142 | }; |
143 | |
144 | rtc@11d { |
145 | diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi |
146 | index acbe71febe13..8c65e0d82559 100644 |
147 | --- a/arch/arm/boot/dts/qcom-msm8660.dtsi |
148 | +++ b/arch/arm/boot/dts/qcom-msm8660.dtsi |
149 | @@ -2,6 +2,7 @@ |
150 | |
151 | /include/ "skeleton.dtsi" |
152 | |
153 | +#include <dt-bindings/interrupt-controller/irq.h> |
154 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
155 | #include <dt-bindings/clock/qcom,gcc-msm8660.h> |
156 | #include <dt-bindings/soc/qcom,gsbi.h> |
157 | @@ -159,21 +160,50 @@ |
158 | "qcom,ssbi-gpio"; |
159 | reg = <0x150>; |
160 | interrupt-parent = <&pmicintc>; |
161 | - interrupts = <192 1>, <193 1>, <194 1>, |
162 | - <195 1>, <196 1>, <197 1>, |
163 | - <198 1>, <199 1>, <200 1>, |
164 | - <201 1>, <202 1>, <203 1>, |
165 | - <204 1>, <205 1>, <206 1>, |
166 | - <207 1>, <208 1>, <209 1>, |
167 | - <210 1>, <211 1>, <212 1>, |
168 | - <213 1>, <214 1>, <215 1>, |
169 | - <216 1>, <217 1>, <218 1>, |
170 | - <219 1>, <220 1>, <221 1>, |
171 | - <222 1>, <223 1>, <224 1>, |
172 | - <225 1>, <226 1>, <227 1>, |
173 | - <228 1>, <229 1>, <230 1>, |
174 | - <231 1>, <232 1>, <233 1>, |
175 | - <234 1>, <235 1>; |
176 | + interrupts = <192 IRQ_TYPE_NONE>, |
177 | + <193 IRQ_TYPE_NONE>, |
178 | + <194 IRQ_TYPE_NONE>, |
179 | + <195 IRQ_TYPE_NONE>, |
180 | + <196 IRQ_TYPE_NONE>, |
181 | + <197 IRQ_TYPE_NONE>, |
182 | + <198 IRQ_TYPE_NONE>, |
183 | + <199 IRQ_TYPE_NONE>, |
184 | + <200 IRQ_TYPE_NONE>, |
185 | + <201 IRQ_TYPE_NONE>, |
186 | + <202 IRQ_TYPE_NONE>, |
187 | + <203 IRQ_TYPE_NONE>, |
188 | + <204 IRQ_TYPE_NONE>, |
189 | + <205 IRQ_TYPE_NONE>, |
190 | + <206 IRQ_TYPE_NONE>, |
191 | + <207 IRQ_TYPE_NONE>, |
192 | + <208 IRQ_TYPE_NONE>, |
193 | + <209 IRQ_TYPE_NONE>, |
194 | + <210 IRQ_TYPE_NONE>, |
195 | + <211 IRQ_TYPE_NONE>, |
196 | + <212 IRQ_TYPE_NONE>, |
197 | + <213 IRQ_TYPE_NONE>, |
198 | + <214 IRQ_TYPE_NONE>, |
199 | + <215 IRQ_TYPE_NONE>, |
200 | + <216 IRQ_TYPE_NONE>, |
201 | + <217 IRQ_TYPE_NONE>, |
202 | + <218 IRQ_TYPE_NONE>, |
203 | + <219 IRQ_TYPE_NONE>, |
204 | + <220 IRQ_TYPE_NONE>, |
205 | + <221 IRQ_TYPE_NONE>, |
206 | + <222 IRQ_TYPE_NONE>, |
207 | + <223 IRQ_TYPE_NONE>, |
208 | + <224 IRQ_TYPE_NONE>, |
209 | + <225 IRQ_TYPE_NONE>, |
210 | + <226 IRQ_TYPE_NONE>, |
211 | + <227 IRQ_TYPE_NONE>, |
212 | + <228 IRQ_TYPE_NONE>, |
213 | + <229 IRQ_TYPE_NONE>, |
214 | + <230 IRQ_TYPE_NONE>, |
215 | + <231 IRQ_TYPE_NONE>, |
216 | + <232 IRQ_TYPE_NONE>, |
217 | + <233 IRQ_TYPE_NONE>, |
218 | + <234 IRQ_TYPE_NONE>, |
219 | + <235 IRQ_TYPE_NONE>; |
220 | gpio-controller; |
221 | #gpio-cells = <2>; |
222 | |
223 | @@ -187,9 +217,18 @@ |
224 | #gpio-cells = <2>; |
225 | interrupt-parent = <&pmicintc>; |
226 | interrupts = |
227 | - <128 1>, <129 1>, <130 1>, <131 1>, |
228 | - <132 1>, <133 1>, <134 1>, <135 1>, |
229 | - <136 1>, <137 1>, <138 1>, <139 1>; |
230 | + <128 IRQ_TYPE_NONE>, |
231 | + <129 IRQ_TYPE_NONE>, |
232 | + <130 IRQ_TYPE_NONE>, |
233 | + <131 IRQ_TYPE_NONE>, |
234 | + <132 IRQ_TYPE_NONE>, |
235 | + <133 IRQ_TYPE_NONE>, |
236 | + <134 IRQ_TYPE_NONE>, |
237 | + <135 IRQ_TYPE_NONE>, |
238 | + <136 IRQ_TYPE_NONE>, |
239 | + <137 IRQ_TYPE_NONE>, |
240 | + <138 IRQ_TYPE_NONE>, |
241 | + <139 IRQ_TYPE_NONE>; |
242 | }; |
243 | |
244 | pwrkey@1c { |
245 | diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h |
246 | index b7a428154355..b1ce037e4380 100644 |
247 | --- a/arch/arm/include/asm/delay.h |
248 | +++ b/arch/arm/include/asm/delay.h |
249 | @@ -10,7 +10,7 @@ |
250 | #include <asm/param.h> /* HZ */ |
251 | |
252 | #define MAX_UDELAY_MS 2 |
253 | -#define UDELAY_MULT UL(2047 * HZ + 483648 * HZ / 1000000) |
254 | +#define UDELAY_MULT UL(2147 * HZ + 483648 * HZ / 1000000) |
255 | #define UDELAY_SHIFT 31 |
256 | |
257 | #ifndef __ASSEMBLY__ |
258 | diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c |
259 | index d9751a4769e7..d34fd72172b6 100644 |
260 | --- a/arch/arm64/kernel/stacktrace.c |
261 | +++ b/arch/arm64/kernel/stacktrace.c |
262 | @@ -43,6 +43,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) |
263 | unsigned long fp = frame->fp; |
264 | unsigned long irq_stack_ptr; |
265 | |
266 | + if (!tsk) |
267 | + tsk = current; |
268 | + |
269 | /* |
270 | * Switching between stacks is valid when tracing current and in |
271 | * non-preemptible context. |
272 | @@ -67,7 +70,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) |
273 | frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); |
274 | |
275 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
276 | - if (tsk && tsk->ret_stack && |
277 | + if (tsk->ret_stack && |
278 | (frame->pc == (unsigned long)return_to_handler)) { |
279 | /* |
280 | * This is a case where function graph tracer has |
281 | diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c |
282 | index e04f83873af7..df06750846de 100644 |
283 | --- a/arch/arm64/kernel/traps.c |
284 | +++ b/arch/arm64/kernel/traps.c |
285 | @@ -142,6 +142,11 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) |
286 | unsigned long irq_stack_ptr; |
287 | int skip; |
288 | |
289 | + pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); |
290 | + |
291 | + if (!tsk) |
292 | + tsk = current; |
293 | + |
294 | /* |
295 | * Switching between stacks is valid when tracing current and in |
296 | * non-preemptible context. |
297 | @@ -151,11 +156,6 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) |
298 | else |
299 | irq_stack_ptr = 0; |
300 | |
301 | - pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); |
302 | - |
303 | - if (!tsk) |
304 | - tsk = current; |
305 | - |
306 | if (tsk == current) { |
307 | frame.fp = (unsigned long)__builtin_frame_address(0); |
308 | frame.sp = current_stack_pointer; |
309 | diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c |
310 | index e788515f766b..43853ec6e160 100644 |
311 | --- a/arch/mips/kvm/emulate.c |
312 | +++ b/arch/mips/kvm/emulate.c |
313 | @@ -846,6 +846,47 @@ enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu) |
314 | return EMULATE_FAIL; |
315 | } |
316 | |
317 | +/** |
318 | + * kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map. |
319 | + * @vcpu: VCPU with changed mappings. |
320 | + * @tlb: TLB entry being removed. |
321 | + * |
322 | + * This is called to indicate a single change in guest MMU mappings, so that we |
323 | + * can arrange TLB flushes on this and other CPUs. |
324 | + */ |
325 | +static void kvm_mips_invalidate_guest_tlb(struct kvm_vcpu *vcpu, |
326 | + struct kvm_mips_tlb *tlb) |
327 | +{ |
328 | + int cpu, i; |
329 | + bool user; |
330 | + |
331 | + /* No need to flush for entries which are already invalid */ |
332 | + if (!((tlb->tlb_lo[0] | tlb->tlb_lo[1]) & ENTRYLO_V)) |
333 | + return; |
334 | + /* User address space doesn't need flushing for KSeg2/3 changes */ |
335 | + user = tlb->tlb_hi < KVM_GUEST_KSEG0; |
336 | + |
337 | + preempt_disable(); |
338 | + |
339 | + /* |
340 | + * Probe the shadow host TLB for the entry being overwritten, if one |
341 | + * matches, invalidate it |
342 | + */ |
343 | + kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); |
344 | + |
345 | + /* Invalidate the whole ASID on other CPUs */ |
346 | + cpu = smp_processor_id(); |
347 | + for_each_possible_cpu(i) { |
348 | + if (i == cpu) |
349 | + continue; |
350 | + if (user) |
351 | + vcpu->arch.guest_user_asid[i] = 0; |
352 | + vcpu->arch.guest_kernel_asid[i] = 0; |
353 | + } |
354 | + |
355 | + preempt_enable(); |
356 | +} |
357 | + |
358 | /* Write Guest TLB Entry @ Index */ |
359 | enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu) |
360 | { |
361 | @@ -865,11 +906,8 @@ enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu) |
362 | } |
363 | |
364 | tlb = &vcpu->arch.guest_tlb[index]; |
365 | - /* |
366 | - * Probe the shadow host TLB for the entry being overwritten, if one |
367 | - * matches, invalidate it |
368 | - */ |
369 | - kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); |
370 | + |
371 | + kvm_mips_invalidate_guest_tlb(vcpu, tlb); |
372 | |
373 | tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0); |
374 | tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0); |
375 | @@ -898,11 +936,7 @@ enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu) |
376 | |
377 | tlb = &vcpu->arch.guest_tlb[index]; |
378 | |
379 | - /* |
380 | - * Probe the shadow host TLB for the entry being overwritten, if one |
381 | - * matches, invalidate it |
382 | - */ |
383 | - kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); |
384 | + kvm_mips_invalidate_guest_tlb(vcpu, tlb); |
385 | |
386 | tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0); |
387 | tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0); |
388 | @@ -1026,6 +1060,7 @@ enum emulation_result kvm_mips_emulate_CP0(union mips_instruction inst, |
389 | enum emulation_result er = EMULATE_DONE; |
390 | u32 rt, rd, sel; |
391 | unsigned long curr_pc; |
392 | + int cpu, i; |
393 | |
394 | /* |
395 | * Update PC and hold onto current PC in case there is |
396 | @@ -1135,8 +1170,16 @@ enum emulation_result kvm_mips_emulate_CP0(union mips_instruction inst, |
397 | & KVM_ENTRYHI_ASID, |
398 | nasid); |
399 | |
400 | + preempt_disable(); |
401 | /* Blow away the shadow host TLBs */ |
402 | kvm_mips_flush_host_tlb(1); |
403 | + cpu = smp_processor_id(); |
404 | + for_each_possible_cpu(i) |
405 | + if (i != cpu) { |
406 | + vcpu->arch.guest_user_asid[i] = 0; |
407 | + vcpu->arch.guest_kernel_asid[i] = 0; |
408 | + } |
409 | + preempt_enable(); |
410 | } |
411 | kvm_write_c0_guest_entryhi(cop0, |
412 | vcpu->arch.gprs[rt]); |
413 | diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h |
414 | index f69f40f1519a..978dada662ae 100644 |
415 | --- a/arch/powerpc/include/asm/reg.h |
416 | +++ b/arch/powerpc/include/asm/reg.h |
417 | @@ -737,6 +737,7 @@ |
418 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ |
419 | #define SPRN_MMCR1 798 |
420 | #define SPRN_MMCR2 785 |
421 | +#define SPRN_UMMCR2 769 |
422 | #define SPRN_MMCRA 0x312 |
423 | #define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ |
424 | #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL |
425 | diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c |
426 | index 2afdb9c0937d..729f8faa95c5 100644 |
427 | --- a/arch/powerpc/kvm/book3s_emulate.c |
428 | +++ b/arch/powerpc/kvm/book3s_emulate.c |
429 | @@ -498,6 +498,7 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) |
430 | case SPRN_MMCR0: |
431 | case SPRN_MMCR1: |
432 | case SPRN_MMCR2: |
433 | + case SPRN_UMMCR2: |
434 | #endif |
435 | break; |
436 | unprivileged: |
437 | @@ -640,6 +641,7 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val |
438 | case SPRN_MMCR0: |
439 | case SPRN_MMCR1: |
440 | case SPRN_MMCR2: |
441 | + case SPRN_UMMCR2: |
442 | case SPRN_TIR: |
443 | #endif |
444 | *spr_val = 0; |
445 | diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c |
446 | index 02b4672f7347..df3f2706d3e5 100644 |
447 | --- a/arch/powerpc/kvm/booke.c |
448 | +++ b/arch/powerpc/kvm/booke.c |
449 | @@ -2038,7 +2038,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, |
450 | if (type == KVMPPC_DEBUG_NONE) |
451 | continue; |
452 | |
453 | - if (type & !(KVMPPC_DEBUG_WATCH_READ | |
454 | + if (type & ~(KVMPPC_DEBUG_WATCH_READ | |
455 | KVMPPC_DEBUG_WATCH_WRITE | |
456 | KVMPPC_DEBUG_BREAKPOINT)) |
457 | return -EINVAL; |
458 | diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h |
459 | index ae55a43e09c0..19f30a814f54 100644 |
460 | --- a/arch/x86/include/asm/fpu/xstate.h |
461 | +++ b/arch/x86/include/asm/fpu/xstate.h |
462 | @@ -27,11 +27,12 @@ |
463 | XFEATURE_MASK_YMM | \ |
464 | XFEATURE_MASK_OPMASK | \ |
465 | XFEATURE_MASK_ZMM_Hi256 | \ |
466 | - XFEATURE_MASK_Hi16_ZMM | \ |
467 | - XFEATURE_MASK_PKRU) |
468 | + XFEATURE_MASK_Hi16_ZMM) |
469 | |
470 | /* Supported features which require eager state saving */ |
471 | -#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR) |
472 | +#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | \ |
473 | + XFEATURE_MASK_BNDCSR | \ |
474 | + XFEATURE_MASK_PKRU) |
475 | |
476 | /* All currently supported features */ |
477 | #define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER) |
478 | diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h |
479 | index 627719475457..9ae5ab80a497 100644 |
480 | --- a/arch/x86/include/asm/intel-family.h |
481 | +++ b/arch/x86/include/asm/intel-family.h |
482 | @@ -56,8 +56,8 @@ |
483 | #define INTEL_FAM6_ATOM_SILVERMONT1 0x37 /* BayTrail/BYT / Valleyview */ |
484 | #define INTEL_FAM6_ATOM_SILVERMONT2 0x4D /* Avaton/Rangely */ |
485 | #define INTEL_FAM6_ATOM_AIRMONT 0x4C /* CherryTrail / Braswell */ |
486 | -#define INTEL_FAM6_ATOM_MERRIFIELD1 0x4A /* Tangier */ |
487 | -#define INTEL_FAM6_ATOM_MERRIFIELD2 0x5A /* Annidale */ |
488 | +#define INTEL_FAM6_ATOM_MERRIFIELD 0x4A /* Tangier */ |
489 | +#define INTEL_FAM6_ATOM_MOOREFIELD 0x5A /* Annidale */ |
490 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C |
491 | #define INTEL_FAM6_ATOM_DENVERTON 0x5F /* Goldmont Microserver */ |
492 | |
493 | diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h |
494 | index b07233b64578..c2f94dcc92ce 100644 |
495 | --- a/arch/x86/include/asm/mpspec.h |
496 | +++ b/arch/x86/include/asm/mpspec.h |
497 | @@ -6,7 +6,6 @@ |
498 | #include <asm/x86_init.h> |
499 | #include <asm/apicdef.h> |
500 | |
501 | -extern int apic_version[]; |
502 | extern int pic_mode; |
503 | |
504 | #ifdef CONFIG_X86_32 |
505 | @@ -40,6 +39,7 @@ extern int mp_bus_id_to_type[MAX_MP_BUSSES]; |
506 | extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); |
507 | |
508 | extern unsigned int boot_cpu_physical_apicid; |
509 | +extern u8 boot_cpu_apic_version; |
510 | extern unsigned long mp_lapic_addr; |
511 | |
512 | #ifdef CONFIG_X86_LOCAL_APIC |
513 | diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c |
514 | index 90d84c3eee53..fbd19444403f 100644 |
515 | --- a/arch/x86/kernel/acpi/boot.c |
516 | +++ b/arch/x86/kernel/acpi/boot.c |
517 | @@ -182,7 +182,7 @@ static int acpi_register_lapic(int id, u32 acpiid, u8 enabled) |
518 | } |
519 | |
520 | if (boot_cpu_physical_apicid != -1U) |
521 | - ver = apic_version[boot_cpu_physical_apicid]; |
522 | + ver = boot_cpu_apic_version; |
523 | |
524 | cpu = generic_processor_info(id, ver); |
525 | if (cpu >= 0) |
526 | diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
527 | index f3e9b2df4b16..076c315cdf18 100644 |
528 | --- a/arch/x86/kernel/apic/apic.c |
529 | +++ b/arch/x86/kernel/apic/apic.c |
530 | @@ -64,6 +64,8 @@ unsigned disabled_cpus; |
531 | unsigned int boot_cpu_physical_apicid = -1U; |
532 | EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid); |
533 | |
534 | +u8 boot_cpu_apic_version; |
535 | + |
536 | /* |
537 | * The highest APIC ID seen during enumeration. |
538 | */ |
539 | @@ -1816,8 +1818,7 @@ void __init init_apic_mappings(void) |
540 | * since smp_sanity_check is prepared for such a case |
541 | * and disable smp mode |
542 | */ |
543 | - apic_version[new_apicid] = |
544 | - GET_APIC_VERSION(apic_read(APIC_LVR)); |
545 | + boot_cpu_apic_version = GET_APIC_VERSION(apic_read(APIC_LVR)); |
546 | } |
547 | } |
548 | |
549 | @@ -1832,13 +1833,10 @@ void __init register_lapic_address(unsigned long address) |
550 | } |
551 | if (boot_cpu_physical_apicid == -1U) { |
552 | boot_cpu_physical_apicid = read_apic_id(); |
553 | - apic_version[boot_cpu_physical_apicid] = |
554 | - GET_APIC_VERSION(apic_read(APIC_LVR)); |
555 | + boot_cpu_apic_version = GET_APIC_VERSION(apic_read(APIC_LVR)); |
556 | } |
557 | } |
558 | |
559 | -int apic_version[MAX_LOCAL_APIC]; |
560 | - |
561 | /* |
562 | * Local APIC interrupts |
563 | */ |
564 | @@ -2130,11 +2128,10 @@ int generic_processor_info(int apicid, int version) |
565 | cpu, apicid); |
566 | version = 0x10; |
567 | } |
568 | - apic_version[apicid] = version; |
569 | |
570 | - if (version != apic_version[boot_cpu_physical_apicid]) { |
571 | + if (version != boot_cpu_apic_version) { |
572 | pr_warning("BIOS bug: APIC version mismatch, boot CPU: %x, CPU %d: version %x\n", |
573 | - apic_version[boot_cpu_physical_apicid], cpu, version); |
574 | + boot_cpu_apic_version, cpu, version); |
575 | } |
576 | |
577 | physid_set(apicid, phys_cpu_present_map); |
578 | @@ -2277,7 +2274,7 @@ int __init APIC_init_uniprocessor(void) |
579 | * Complain if the BIOS pretends there is one. |
580 | */ |
581 | if (!boot_cpu_has(X86_FEATURE_APIC) && |
582 | - APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { |
583 | + APIC_INTEGRATED(boot_cpu_apic_version)) { |
584 | pr_err("BIOS bug, local APIC 0x%x not detected!...\n", |
585 | boot_cpu_physical_apicid); |
586 | return -1; |
587 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
588 | index 7491f417a8e4..48e6d84f173e 100644 |
589 | --- a/arch/x86/kernel/apic/io_apic.c |
590 | +++ b/arch/x86/kernel/apic/io_apic.c |
591 | @@ -1593,7 +1593,7 @@ void __init setup_ioapic_ids_from_mpc(void) |
592 | * no meaning without the serial APIC bus. |
593 | */ |
594 | if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) |
595 | - || APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) |
596 | + || APIC_XAPIC(boot_cpu_apic_version)) |
597 | return; |
598 | setup_ioapic_ids_from_mpc_nocheck(); |
599 | } |
600 | @@ -2423,7 +2423,7 @@ static int io_apic_get_unique_id(int ioapic, int apic_id) |
601 | static u8 io_apic_unique_id(int idx, u8 id) |
602 | { |
603 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && |
604 | - !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) |
605 | + !APIC_XAPIC(boot_cpu_apic_version)) |
606 | return io_apic_get_unique_id(idx, id); |
607 | else |
608 | return id; |
609 | diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c |
610 | index 7c43e716c158..563096267ca2 100644 |
611 | --- a/arch/x86/kernel/apic/probe_32.c |
612 | +++ b/arch/x86/kernel/apic/probe_32.c |
613 | @@ -152,7 +152,7 @@ early_param("apic", parse_apic); |
614 | |
615 | void __init default_setup_apic_routing(void) |
616 | { |
617 | - int version = apic_version[boot_cpu_physical_apicid]; |
618 | + int version = boot_cpu_apic_version; |
619 | |
620 | if (num_possible_cpus() > 8) { |
621 | switch (boot_cpu_data.x86_vendor) { |
622 | diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c |
623 | index 6066d945c40e..5d30c5e42bb1 100644 |
624 | --- a/arch/x86/kernel/apic/vector.c |
625 | +++ b/arch/x86/kernel/apic/vector.c |
626 | @@ -661,11 +661,28 @@ void irq_complete_move(struct irq_cfg *cfg) |
627 | */ |
628 | void irq_force_complete_move(struct irq_desc *desc) |
629 | { |
630 | - struct irq_data *irqdata = irq_desc_get_irq_data(desc); |
631 | - struct apic_chip_data *data = apic_chip_data(irqdata); |
632 | - struct irq_cfg *cfg = data ? &data->cfg : NULL; |
633 | + struct irq_data *irqdata; |
634 | + struct apic_chip_data *data; |
635 | + struct irq_cfg *cfg; |
636 | unsigned int cpu; |
637 | |
638 | + /* |
639 | + * The function is called for all descriptors regardless of which |
640 | + * irqdomain they belong to. For example if an IRQ is provided by |
641 | + * an irq_chip as part of a GPIO driver, the chip data for that |
642 | + * descriptor is specific to the irq_chip in question. |
643 | + * |
644 | + * Check first that the chip_data is what we expect |
645 | + * (apic_chip_data) before touching it any further. |
646 | + */ |
647 | + irqdata = irq_domain_get_irq_data(x86_vector_domain, |
648 | + irq_desc_get_irq(desc)); |
649 | + if (!irqdata) |
650 | + return; |
651 | + |
652 | + data = apic_chip_data(irqdata); |
653 | + cfg = data ? &data->cfg : NULL; |
654 | + |
655 | if (!cfg) |
656 | return; |
657 | |
658 | diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c |
659 | index 621b501f8935..8a90f1517837 100644 |
660 | --- a/arch/x86/kernel/e820.c |
661 | +++ b/arch/x86/kernel/e820.c |
662 | @@ -348,7 +348,7 @@ int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, |
663 | * continue building up new bios map based on this |
664 | * information |
665 | */ |
666 | - if (current_type != last_type || current_type == E820_PRAM) { |
667 | + if (current_type != last_type) { |
668 | if (last_type != 0) { |
669 | new_bios[new_bios_entry].size = |
670 | change_point[chgidx]->addr - last_addr; |
671 | @@ -754,7 +754,7 @@ u64 __init early_reserve_e820(u64 size, u64 align) |
672 | /* |
673 | * Find the highest page frame number we have available |
674 | */ |
675 | -static unsigned long __init e820_end_pfn(unsigned long limit_pfn) |
676 | +static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) |
677 | { |
678 | int i; |
679 | unsigned long last_pfn = 0; |
680 | @@ -765,11 +765,7 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn) |
681 | unsigned long start_pfn; |
682 | unsigned long end_pfn; |
683 | |
684 | - /* |
685 | - * Persistent memory is accounted as ram for purposes of |
686 | - * establishing max_pfn and mem_map. |
687 | - */ |
688 | - if (ei->type != E820_RAM && ei->type != E820_PRAM) |
689 | + if (ei->type != type) |
690 | continue; |
691 | |
692 | start_pfn = ei->addr >> PAGE_SHIFT; |
693 | @@ -794,12 +790,12 @@ static unsigned long __init e820_end_pfn(unsigned long limit_pfn) |
694 | } |
695 | unsigned long __init e820_end_of_ram_pfn(void) |
696 | { |
697 | - return e820_end_pfn(MAX_ARCH_PFN); |
698 | + return e820_end_pfn(MAX_ARCH_PFN, E820_RAM); |
699 | } |
700 | |
701 | unsigned long __init e820_end_of_low_ram_pfn(void) |
702 | { |
703 | - return e820_end_pfn(1UL << (32-PAGE_SHIFT)); |
704 | + return e820_end_pfn(1UL << (32 - PAGE_SHIFT), E820_RAM); |
705 | } |
706 | |
707 | static void early_panic(char *msg) |
708 | diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c |
709 | index 63236d8f84bf..a21068e49dac 100644 |
710 | --- a/arch/x86/kernel/process_64.c |
711 | +++ b/arch/x86/kernel/process_64.c |
712 | @@ -110,12 +110,13 @@ void __show_regs(struct pt_regs *regs, int all) |
713 | get_debugreg(d7, 7); |
714 | |
715 | /* Only print out debug registers if they are in their non-default state. */ |
716 | - if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && |
717 | - (d6 == DR6_RESERVED) && (d7 == 0x400)) |
718 | - return; |
719 | - |
720 | - printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); |
721 | - printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); |
722 | + if (!((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && |
723 | + (d6 == DR6_RESERVED) && (d7 == 0x400))) { |
724 | + printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", |
725 | + d0, d1, d2); |
726 | + printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", |
727 | + d3, d6, d7); |
728 | + } |
729 | |
730 | if (boot_cpu_has(X86_FEATURE_OSPKE)) |
731 | printk(KERN_DEFAULT "PKRU: %08x\n", read_pkru()); |
732 | diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c |
733 | index f79576a541ff..a1606eadd9ce 100644 |
734 | --- a/arch/x86/kernel/ptrace.c |
735 | +++ b/arch/x86/kernel/ptrace.c |
736 | @@ -173,8 +173,8 @@ unsigned long kernel_stack_pointer(struct pt_regs *regs) |
737 | return sp; |
738 | |
739 | prev_esp = (u32 *)(context); |
740 | - if (prev_esp) |
741 | - return (unsigned long)prev_esp; |
742 | + if (*prev_esp) |
743 | + return (unsigned long)*prev_esp; |
744 | |
745 | return (unsigned long)regs; |
746 | } |
747 | diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c |
748 | index 4296beb8fdd3..82b17373b66a 100644 |
749 | --- a/arch/x86/kernel/smpboot.c |
750 | +++ b/arch/x86/kernel/smpboot.c |
751 | @@ -690,7 +690,7 @@ wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip) |
752 | * Give the other CPU some time to accept the IPI. |
753 | */ |
754 | udelay(200); |
755 | - if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { |
756 | + if (APIC_INTEGRATED(boot_cpu_apic_version)) { |
757 | maxlvt = lapic_get_maxlvt(); |
758 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ |
759 | apic_write(APIC_ESR, 0); |
760 | @@ -717,7 +717,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) |
761 | /* |
762 | * Be paranoid about clearing APIC errors. |
763 | */ |
764 | - if (APIC_INTEGRATED(apic_version[phys_apicid])) { |
765 | + if (APIC_INTEGRATED(boot_cpu_apic_version)) { |
766 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ |
767 | apic_write(APIC_ESR, 0); |
768 | apic_read(APIC_ESR); |
769 | @@ -756,7 +756,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) |
770 | * Determine this based on the APIC version. |
771 | * If we don't have an integrated APIC, don't send the STARTUP IPIs. |
772 | */ |
773 | - if (APIC_INTEGRATED(apic_version[phys_apicid])) |
774 | + if (APIC_INTEGRATED(boot_cpu_apic_version)) |
775 | num_starts = 2; |
776 | else |
777 | num_starts = 0; |
778 | @@ -994,7 +994,7 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle) |
779 | /* |
780 | * Be paranoid about clearing APIC errors. |
781 | */ |
782 | - if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { |
783 | + if (APIC_INTEGRATED(boot_cpu_apic_version)) { |
784 | apic_write(APIC_ESR, 0); |
785 | apic_read(APIC_ESR); |
786 | } |
787 | @@ -1249,7 +1249,7 @@ static int __init smp_sanity_check(unsigned max_cpus) |
788 | /* |
789 | * If we couldn't find a local APIC, then get out of here now! |
790 | */ |
791 | - if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && |
792 | + if (APIC_INTEGRATED(boot_cpu_apic_version) && |
793 | !boot_cpu_has(X86_FEATURE_APIC)) { |
794 | if (!disable_apic) { |
795 | pr_err("BIOS bug, local APIC #%d not detected!...\n", |
796 | @@ -1406,9 +1406,21 @@ __init void prefill_possible_map(void) |
797 | { |
798 | int i, possible; |
799 | |
800 | - /* no processor from mptable or madt */ |
801 | - if (!num_processors) |
802 | - num_processors = 1; |
803 | + /* No boot processor was found in mptable or ACPI MADT */ |
804 | + if (!num_processors) { |
805 | + int apicid = boot_cpu_physical_apicid; |
806 | + int cpu = hard_smp_processor_id(); |
807 | + |
808 | + pr_warn("Boot CPU (id %d) not listed by BIOS\n", cpu); |
809 | + |
810 | + /* Make sure boot cpu is enumerated */ |
811 | + if (apic->cpu_present_to_apicid(0) == BAD_APICID && |
812 | + apic->apic_id_valid(apicid)) |
813 | + generic_processor_info(apicid, boot_cpu_apic_version); |
814 | + |
815 | + if (!num_processors) |
816 | + num_processors = 1; |
817 | + } |
818 | |
819 | i = setup_max_cpus ?: 1; |
820 | if (setup_possible_cpus == -1) { |
821 | diff --git a/arch/x86/platform/atom/punit_atom_debug.c b/arch/x86/platform/atom/punit_atom_debug.c |
822 | index 8ff7b9355416..d49d3be81953 100644 |
823 | --- a/arch/x86/platform/atom/punit_atom_debug.c |
824 | +++ b/arch/x86/platform/atom/punit_atom_debug.c |
825 | @@ -155,7 +155,7 @@ static void punit_dbgfs_unregister(void) |
826 | |
827 | static const struct x86_cpu_id intel_punit_cpu_ids[] = { |
828 | ICPU(INTEL_FAM6_ATOM_SILVERMONT1, punit_device_byt), |
829 | - ICPU(INTEL_FAM6_ATOM_MERRIFIELD1, punit_device_tng), |
830 | + ICPU(INTEL_FAM6_ATOM_MERRIFIELD, punit_device_tng), |
831 | ICPU(INTEL_FAM6_ATOM_AIRMONT, punit_device_cht), |
832 | {} |
833 | }; |
834 | diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c |
835 | index c901a3423772..6eca0f6fe57d 100644 |
836 | --- a/arch/x86/platform/intel-mid/pwr.c |
837 | +++ b/arch/x86/platform/intel-mid/pwr.c |
838 | @@ -354,7 +354,7 @@ static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
839 | return 0; |
840 | } |
841 | |
842 | -static int mid_set_initial_state(struct mid_pwr *pwr) |
843 | +static int mid_set_initial_state(struct mid_pwr *pwr, const u32 *states) |
844 | { |
845 | unsigned int i, j; |
846 | int ret; |
847 | @@ -379,10 +379,10 @@ static int mid_set_initial_state(struct mid_pwr *pwr) |
848 | * NOTE: The actual device mapping is provided by a platform at run |
849 | * time using vendor capability of PCI configuration space. |
850 | */ |
851 | - mid_pwr_set_state(pwr, 0, 0xffffffff); |
852 | - mid_pwr_set_state(pwr, 1, 0xffffffff); |
853 | - mid_pwr_set_state(pwr, 2, 0xffffffff); |
854 | - mid_pwr_set_state(pwr, 3, 0xffffffff); |
855 | + mid_pwr_set_state(pwr, 0, states[0]); |
856 | + mid_pwr_set_state(pwr, 1, states[1]); |
857 | + mid_pwr_set_state(pwr, 2, states[2]); |
858 | + mid_pwr_set_state(pwr, 3, states[3]); |
859 | |
860 | /* Send command to SCU */ |
861 | ret = mid_pwr_wait_for_cmd(pwr, CMD_SET_CFG); |
862 | @@ -397,13 +397,41 @@ static int mid_set_initial_state(struct mid_pwr *pwr) |
863 | return 0; |
864 | } |
865 | |
866 | -static const struct mid_pwr_device_info mid_info = { |
867 | - .set_initial_state = mid_set_initial_state, |
868 | +static int pnw_set_initial_state(struct mid_pwr *pwr) |
869 | +{ |
870 | + /* On Penwell SRAM must stay powered on */ |
871 | + const u32 states[] = { |
872 | + 0xf00fffff, /* PM_SSC(0) */ |
873 | + 0xffffffff, /* PM_SSC(1) */ |
874 | + 0xffffffff, /* PM_SSC(2) */ |
875 | + 0xffffffff, /* PM_SSC(3) */ |
876 | + }; |
877 | + return mid_set_initial_state(pwr, states); |
878 | +} |
879 | + |
880 | +static int tng_set_initial_state(struct mid_pwr *pwr) |
881 | +{ |
882 | + const u32 states[] = { |
883 | + 0xffffffff, /* PM_SSC(0) */ |
884 | + 0xffffffff, /* PM_SSC(1) */ |
885 | + 0xffffffff, /* PM_SSC(2) */ |
886 | + 0xffffffff, /* PM_SSC(3) */ |
887 | + }; |
888 | + return mid_set_initial_state(pwr, states); |
889 | +} |
890 | + |
891 | +static const struct mid_pwr_device_info pnw_info = { |
892 | + .set_initial_state = pnw_set_initial_state, |
893 | +}; |
894 | + |
895 | +static const struct mid_pwr_device_info tng_info = { |
896 | + .set_initial_state = tng_set_initial_state, |
897 | }; |
898 | |
899 | +/* This table should be in sync with the one in drivers/pci/pci-mid.c */ |
900 | static const struct pci_device_id mid_pwr_pci_ids[] = { |
901 | - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&mid_info }, |
902 | - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&mid_info }, |
903 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&pnw_info }, |
904 | + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&tng_info }, |
905 | {} |
906 | }; |
907 | |
908 | diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c |
909 | index 0b4d04c8ab4d..62284035be84 100644 |
910 | --- a/arch/x86/xen/smp.c |
911 | +++ b/arch/x86/xen/smp.c |
912 | @@ -87,6 +87,12 @@ static void cpu_bringup(void) |
913 | cpu_data(cpu).x86_max_cores = 1; |
914 | set_cpu_sibling_map(cpu); |
915 | |
916 | + /* |
917 | + * identify_cpu() may have set logical_pkg_id to -1 due |
918 | + * to incorrect phys_proc_id. Let's re-comupte it. |
919 | + */ |
920 | + topology_update_package_map(apic->cpu_present_to_apicid(cpu), cpu); |
921 | + |
922 | xen_setup_cpu_clockevents(); |
923 | |
924 | notify_cpu_starting(cpu); |
925 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
926 | index 811f9b97e360..d4d55f60cd81 100644 |
927 | --- a/drivers/bluetooth/btusb.c |
928 | +++ b/drivers/bluetooth/btusb.c |
929 | @@ -251,6 +251,7 @@ static const struct usb_device_id blacklist_table[] = { |
930 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, |
931 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, |
932 | { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME }, |
933 | + { USB_DEVICE(0x04ca, 0x3011), .driver_info = BTUSB_QCA_ROME }, |
934 | |
935 | /* Broadcom BCM2035 */ |
936 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 }, |
937 | diff --git a/drivers/char/tpm/tpm-dev.c b/drivers/char/tpm/tpm-dev.c |
938 | index f5d452151c6b..912ad30be585 100644 |
939 | --- a/drivers/char/tpm/tpm-dev.c |
940 | +++ b/drivers/char/tpm/tpm-dev.c |
941 | @@ -145,7 +145,7 @@ static ssize_t tpm_write(struct file *file, const char __user *buf, |
942 | return -EPIPE; |
943 | } |
944 | out_size = tpm_transmit(priv->chip, priv->data_buffer, |
945 | - sizeof(priv->data_buffer)); |
946 | + sizeof(priv->data_buffer), 0); |
947 | |
948 | tpm_put_ops(priv->chip); |
949 | if (out_size < 0) { |
950 | diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c |
951 | index 1abe2d7a2610..aef20ee2331a 100644 |
952 | --- a/drivers/char/tpm/tpm-interface.c |
953 | +++ b/drivers/char/tpm/tpm-interface.c |
954 | @@ -330,8 +330,8 @@ EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
955 | /* |
956 | * Internal kernel interface to transmit TPM commands |
957 | */ |
958 | -ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, |
959 | - size_t bufsiz) |
960 | +ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz, |
961 | + unsigned int flags) |
962 | { |
963 | ssize_t rc; |
964 | u32 count, ordinal; |
965 | @@ -350,7 +350,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, |
966 | return -E2BIG; |
967 | } |
968 | |
969 | - mutex_lock(&chip->tpm_mutex); |
970 | + if (!(flags & TPM_TRANSMIT_UNLOCKED)) |
971 | + mutex_lock(&chip->tpm_mutex); |
972 | |
973 | rc = chip->ops->send(chip, (u8 *) buf, count); |
974 | if (rc < 0) { |
975 | @@ -393,20 +394,21 @@ out_recv: |
976 | dev_err(&chip->dev, |
977 | "tpm_transmit: tpm_recv: error %zd\n", rc); |
978 | out: |
979 | - mutex_unlock(&chip->tpm_mutex); |
980 | + if (!(flags & TPM_TRANSMIT_UNLOCKED)) |
981 | + mutex_unlock(&chip->tpm_mutex); |
982 | return rc; |
983 | } |
984 | |
985 | #define TPM_DIGEST_SIZE 20 |
986 | #define TPM_RET_CODE_IDX 6 |
987 | |
988 | -ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, |
989 | - int len, const char *desc) |
990 | +ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd, |
991 | + int len, unsigned int flags, const char *desc) |
992 | { |
993 | - struct tpm_output_header *header; |
994 | + const struct tpm_output_header *header; |
995 | int err; |
996 | |
997 | - len = tpm_transmit(chip, (u8 *) cmd, len); |
998 | + len = tpm_transmit(chip, (const u8 *)cmd, len, flags); |
999 | if (len < 0) |
1000 | return len; |
1001 | else if (len < TPM_HEADER_SIZE) |
1002 | @@ -453,7 +455,8 @@ ssize_t tpm_getcap(struct tpm_chip *chip, __be32 subcap_id, cap_t *cap, |
1003 | tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4); |
1004 | tpm_cmd.params.getcap_in.subcap = subcap_id; |
1005 | } |
1006 | - rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, desc); |
1007 | + rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, 0, |
1008 | + desc); |
1009 | if (!rc) |
1010 | *cap = tpm_cmd.params.getcap_out.cap; |
1011 | return rc; |
1012 | @@ -469,7 +472,7 @@ void tpm_gen_interrupt(struct tpm_chip *chip) |
1013 | tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4); |
1014 | tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT; |
1015 | |
1016 | - rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, |
1017 | + rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, 0, |
1018 | "attempting to determine the timeouts"); |
1019 | } |
1020 | EXPORT_SYMBOL_GPL(tpm_gen_interrupt); |
1021 | @@ -490,7 +493,7 @@ static int tpm_startup(struct tpm_chip *chip, __be16 startup_type) |
1022 | start_cmd.header.in = tpm_startup_header; |
1023 | |
1024 | start_cmd.params.startup_in.startup_type = startup_type; |
1025 | - return tpm_transmit_cmd(chip, &start_cmd, TPM_INTERNAL_RESULT_SIZE, |
1026 | + return tpm_transmit_cmd(chip, &start_cmd, TPM_INTERNAL_RESULT_SIZE, 0, |
1027 | "attempting to start the TPM"); |
1028 | } |
1029 | |
1030 | @@ -521,7 +524,8 @@ int tpm_get_timeouts(struct tpm_chip *chip) |
1031 | tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP; |
1032 | tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4); |
1033 | tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT; |
1034 | - rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, NULL); |
1035 | + rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, 0, |
1036 | + NULL); |
1037 | |
1038 | if (rc == TPM_ERR_INVALID_POSTINIT) { |
1039 | /* The TPM is not started, we are the first to talk to it. |
1040 | @@ -535,7 +539,7 @@ int tpm_get_timeouts(struct tpm_chip *chip) |
1041 | tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4); |
1042 | tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT; |
1043 | rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, |
1044 | - NULL); |
1045 | + 0, NULL); |
1046 | } |
1047 | if (rc) { |
1048 | dev_err(&chip->dev, |
1049 | @@ -596,7 +600,7 @@ duration: |
1050 | tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4); |
1051 | tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_DURATION; |
1052 | |
1053 | - rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, |
1054 | + rc = tpm_transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, 0, |
1055 | "attempting to determine the durations"); |
1056 | if (rc) |
1057 | return rc; |
1058 | @@ -652,7 +656,7 @@ static int tpm_continue_selftest(struct tpm_chip *chip) |
1059 | struct tpm_cmd_t cmd; |
1060 | |
1061 | cmd.header.in = continue_selftest_header; |
1062 | - rc = tpm_transmit_cmd(chip, &cmd, CONTINUE_SELFTEST_RESULT_SIZE, |
1063 | + rc = tpm_transmit_cmd(chip, &cmd, CONTINUE_SELFTEST_RESULT_SIZE, 0, |
1064 | "continue selftest"); |
1065 | return rc; |
1066 | } |
1067 | @@ -672,7 +676,7 @@ int tpm_pcr_read_dev(struct tpm_chip *chip, int pcr_idx, u8 *res_buf) |
1068 | |
1069 | cmd.header.in = pcrread_header; |
1070 | cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx); |
1071 | - rc = tpm_transmit_cmd(chip, &cmd, READ_PCR_RESULT_SIZE, |
1072 | + rc = tpm_transmit_cmd(chip, &cmd, READ_PCR_RESULT_SIZE, 0, |
1073 | "attempting to read a pcr value"); |
1074 | |
1075 | if (rc == 0) |
1076 | @@ -770,7 +774,7 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) |
1077 | cmd.header.in = pcrextend_header; |
1078 | cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx); |
1079 | memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE); |
1080 | - rc = tpm_transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, |
1081 | + rc = tpm_transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, 0, |
1082 | "attempting extend a PCR value"); |
1083 | |
1084 | tpm_put_ops(chip); |
1085 | @@ -809,7 +813,7 @@ int tpm_do_selftest(struct tpm_chip *chip) |
1086 | /* Attempt to read a PCR value */ |
1087 | cmd.header.in = pcrread_header; |
1088 | cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0); |
1089 | - rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE); |
1090 | + rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE, 0); |
1091 | /* Some buggy TPMs will not respond to tpm_tis_ready() for |
1092 | * around 300ms while the self test is ongoing, keep trying |
1093 | * until the self test duration expires. */ |
1094 | @@ -879,7 +883,7 @@ int tpm_send(u32 chip_num, void *cmd, size_t buflen) |
1095 | if (chip == NULL) |
1096 | return -ENODEV; |
1097 | |
1098 | - rc = tpm_transmit_cmd(chip, cmd, buflen, "attempting tpm_cmd"); |
1099 | + rc = tpm_transmit_cmd(chip, cmd, buflen, 0, "attempting tpm_cmd"); |
1100 | |
1101 | tpm_put_ops(chip); |
1102 | return rc; |
1103 | @@ -981,14 +985,15 @@ int tpm_pm_suspend(struct device *dev) |
1104 | cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(tpm_suspend_pcr); |
1105 | memcpy(cmd.params.pcrextend_in.hash, dummy_hash, |
1106 | TPM_DIGEST_SIZE); |
1107 | - rc = tpm_transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, |
1108 | + rc = tpm_transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, 0, |
1109 | "extending dummy pcr before suspend"); |
1110 | } |
1111 | |
1112 | /* now do the actual savestate */ |
1113 | for (try = 0; try < TPM_RETRY; try++) { |
1114 | cmd.header.in = savestate_header; |
1115 | - rc = tpm_transmit_cmd(chip, &cmd, SAVESTATE_RESULT_SIZE, NULL); |
1116 | + rc = tpm_transmit_cmd(chip, &cmd, SAVESTATE_RESULT_SIZE, 0, |
1117 | + NULL); |
1118 | |
1119 | /* |
1120 | * If the TPM indicates that it is too busy to respond to |
1121 | @@ -1072,8 +1077,8 @@ int tpm_get_random(u32 chip_num, u8 *out, size_t max) |
1122 | tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes); |
1123 | |
1124 | err = tpm_transmit_cmd(chip, &tpm_cmd, |
1125 | - TPM_GETRANDOM_RESULT_SIZE + num_bytes, |
1126 | - "attempting get random"); |
1127 | + TPM_GETRANDOM_RESULT_SIZE + num_bytes, |
1128 | + 0, "attempting get random"); |
1129 | if (err) |
1130 | break; |
1131 | |
1132 | diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c |
1133 | index b46cf70c8b16..e1f7236c115c 100644 |
1134 | --- a/drivers/char/tpm/tpm-sysfs.c |
1135 | +++ b/drivers/char/tpm/tpm-sysfs.c |
1136 | @@ -39,7 +39,7 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, |
1137 | struct tpm_chip *chip = to_tpm_chip(dev); |
1138 | |
1139 | tpm_cmd.header.in = tpm_readpubek_header; |
1140 | - err = tpm_transmit_cmd(chip, &tpm_cmd, READ_PUBEK_RESULT_SIZE, |
1141 | + err = tpm_transmit_cmd(chip, &tpm_cmd, READ_PUBEK_RESULT_SIZE, 0, |
1142 | "attempting to read the PUBEK"); |
1143 | if (err) |
1144 | goto out; |
1145 | diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h |
1146 | index 3e32d5bd2dc6..b0585e99da49 100644 |
1147 | --- a/drivers/char/tpm/tpm.h |
1148 | +++ b/drivers/char/tpm/tpm.h |
1149 | @@ -476,12 +476,16 @@ extern dev_t tpm_devt; |
1150 | extern const struct file_operations tpm_fops; |
1151 | extern struct idr dev_nums_idr; |
1152 | |
1153 | +enum tpm_transmit_flags { |
1154 | + TPM_TRANSMIT_UNLOCKED = BIT(0), |
1155 | +}; |
1156 | + |
1157 | +ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz, |
1158 | + unsigned int flags); |
1159 | +ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd, int len, |
1160 | + unsigned int flags, const char *desc); |
1161 | ssize_t tpm_getcap(struct tpm_chip *chip, __be32 subcap_id, cap_t *cap, |
1162 | const char *desc); |
1163 | -ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, |
1164 | - size_t bufsiz); |
1165 | -ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, int len, |
1166 | - const char *desc); |
1167 | extern int tpm_get_timeouts(struct tpm_chip *); |
1168 | extern void tpm_gen_interrupt(struct tpm_chip *); |
1169 | int tpm1_auto_startup(struct tpm_chip *chip); |
1170 | diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c |
1171 | index 0c75c3f1689f..ef5a58b986f6 100644 |
1172 | --- a/drivers/char/tpm/tpm2-cmd.c |
1173 | +++ b/drivers/char/tpm/tpm2-cmd.c |
1174 | @@ -282,7 +282,7 @@ int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf) |
1175 | sizeof(cmd.params.pcrread_in.pcr_select)); |
1176 | cmd.params.pcrread_in.pcr_select[pcr_idx >> 3] = 1 << (pcr_idx & 0x7); |
1177 | |
1178 | - rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), |
1179 | + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, |
1180 | "attempting to read a pcr value"); |
1181 | if (rc == 0) { |
1182 | buf = cmd.params.pcrread_out.digest; |
1183 | @@ -330,7 +330,7 @@ int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash) |
1184 | cmd.params.pcrextend_in.hash_alg = cpu_to_be16(TPM2_ALG_SHA1); |
1185 | memcpy(cmd.params.pcrextend_in.digest, hash, TPM_DIGEST_SIZE); |
1186 | |
1187 | - rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), |
1188 | + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, |
1189 | "attempting extend a PCR value"); |
1190 | |
1191 | return rc; |
1192 | @@ -376,7 +376,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *out, size_t max) |
1193 | cmd.header.in = tpm2_getrandom_header; |
1194 | cmd.params.getrandom_in.size = cpu_to_be16(num_bytes); |
1195 | |
1196 | - err = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), |
1197 | + err = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, |
1198 | "attempting get random"); |
1199 | if (err) |
1200 | break; |
1201 | @@ -434,12 +434,12 @@ static void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle, |
1202 | } |
1203 | |
1204 | /** |
1205 | - * tpm2_seal_trusted() - seal a trusted key |
1206 | - * @chip_num: A specific chip number for the request or TPM_ANY_NUM |
1207 | - * @options: authentication values and other options |
1208 | + * tpm2_seal_trusted() - seal the payload of a trusted key |
1209 | + * @chip_num: TPM chip to use |
1210 | * @payload: the key data in clear and encrypted form |
1211 | + * @options: authentication values and other options |
1212 | * |
1213 | - * Returns < 0 on error and 0 on success. |
1214 | + * Return: < 0 on error and 0 on success. |
1215 | */ |
1216 | int tpm2_seal_trusted(struct tpm_chip *chip, |
1217 | struct trusted_key_payload *payload, |
1218 | @@ -512,7 +512,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, |
1219 | goto out; |
1220 | } |
1221 | |
1222 | - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "sealing data"); |
1223 | + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, 0, "sealing data"); |
1224 | if (rc) |
1225 | goto out; |
1226 | |
1227 | @@ -538,10 +538,18 @@ out: |
1228 | return rc; |
1229 | } |
1230 | |
1231 | -static int tpm2_load(struct tpm_chip *chip, |
1232 | - struct trusted_key_payload *payload, |
1233 | - struct trusted_key_options *options, |
1234 | - u32 *blob_handle) |
1235 | +/** |
1236 | + * tpm2_load_cmd() - execute a TPM2_Load command |
1237 | + * @chip_num: TPM chip to use |
1238 | + * @payload: the key data in clear and encrypted form |
1239 | + * @options: authentication values and other options |
1240 | + * |
1241 | + * Return: same as with tpm_transmit_cmd |
1242 | + */ |
1243 | +static int tpm2_load_cmd(struct tpm_chip *chip, |
1244 | + struct trusted_key_payload *payload, |
1245 | + struct trusted_key_options *options, |
1246 | + u32 *blob_handle, unsigned int flags) |
1247 | { |
1248 | struct tpm_buf buf; |
1249 | unsigned int private_len; |
1250 | @@ -576,7 +584,7 @@ static int tpm2_load(struct tpm_chip *chip, |
1251 | goto out; |
1252 | } |
1253 | |
1254 | - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "loading blob"); |
1255 | + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, flags, "loading blob"); |
1256 | if (!rc) |
1257 | *blob_handle = be32_to_cpup( |
1258 | (__be32 *) &buf.data[TPM_HEADER_SIZE]); |
1259 | @@ -590,7 +598,16 @@ out: |
1260 | return rc; |
1261 | } |
1262 | |
1263 | -static void tpm2_flush_context(struct tpm_chip *chip, u32 handle) |
1264 | +/** |
1265 | + * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command |
1266 | + * @chip_num: TPM chip to use |
1267 | + * @payload: the key data in clear and encrypted form |
1268 | + * @options: authentication values and other options |
1269 | + * |
1270 | + * Return: same as with tpm_transmit_cmd |
1271 | + */ |
1272 | +static void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, |
1273 | + unsigned int flags) |
1274 | { |
1275 | struct tpm_buf buf; |
1276 | int rc; |
1277 | @@ -604,7 +621,8 @@ static void tpm2_flush_context(struct tpm_chip *chip, u32 handle) |
1278 | |
1279 | tpm_buf_append_u32(&buf, handle); |
1280 | |
1281 | - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "flushing context"); |
1282 | + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, flags, |
1283 | + "flushing context"); |
1284 | if (rc) |
1285 | dev_warn(&chip->dev, "0x%08x was not flushed, rc=%d\n", handle, |
1286 | rc); |
1287 | @@ -612,10 +630,18 @@ static void tpm2_flush_context(struct tpm_chip *chip, u32 handle) |
1288 | tpm_buf_destroy(&buf); |
1289 | } |
1290 | |
1291 | -static int tpm2_unseal(struct tpm_chip *chip, |
1292 | - struct trusted_key_payload *payload, |
1293 | - struct trusted_key_options *options, |
1294 | - u32 blob_handle) |
1295 | +/** |
1296 | + * tpm2_unseal_cmd() - execute a TPM2_Unload command |
1297 | + * @chip_num: TPM chip to use |
1298 | + * @payload: the key data in clear and encrypted form |
1299 | + * @options: authentication values and other options |
1300 | + * |
1301 | + * Return: same as with tpm_transmit_cmd |
1302 | + */ |
1303 | +static int tpm2_unseal_cmd(struct tpm_chip *chip, |
1304 | + struct trusted_key_payload *payload, |
1305 | + struct trusted_key_options *options, |
1306 | + u32 blob_handle, unsigned int flags) |
1307 | { |
1308 | struct tpm_buf buf; |
1309 | u16 data_len; |
1310 | @@ -635,7 +661,7 @@ static int tpm2_unseal(struct tpm_chip *chip, |
1311 | options->blobauth /* hmac */, |
1312 | TPM_DIGEST_SIZE); |
1313 | |
1314 | - rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "unsealing"); |
1315 | + rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, flags, "unsealing"); |
1316 | if (rc > 0) |
1317 | rc = -EPERM; |
1318 | |
1319 | @@ -654,12 +680,12 @@ static int tpm2_unseal(struct tpm_chip *chip, |
1320 | } |
1321 | |
1322 | /** |
1323 | - * tpm_unseal_trusted() - unseal a trusted key |
1324 | - * @chip_num: A specific chip number for the request or TPM_ANY_NUM |
1325 | - * @options: authentication values and other options |
1326 | + * tpm_unseal_trusted() - unseal the payload of a trusted key |
1327 | + * @chip_num: TPM chip to use |
1328 | * @payload: the key data in clear and encrypted form |
1329 | + * @options: authentication values and other options |
1330 | * |
1331 | - * Returns < 0 on error and 0 on success. |
1332 | + * Return: < 0 on error and 0 on success. |
1333 | */ |
1334 | int tpm2_unseal_trusted(struct tpm_chip *chip, |
1335 | struct trusted_key_payload *payload, |
1336 | @@ -668,14 +694,17 @@ int tpm2_unseal_trusted(struct tpm_chip *chip, |
1337 | u32 blob_handle; |
1338 | int rc; |
1339 | |
1340 | - rc = tpm2_load(chip, payload, options, &blob_handle); |
1341 | + mutex_lock(&chip->tpm_mutex); |
1342 | + rc = tpm2_load_cmd(chip, payload, options, &blob_handle, |
1343 | + TPM_TRANSMIT_UNLOCKED); |
1344 | if (rc) |
1345 | - return rc; |
1346 | - |
1347 | - rc = tpm2_unseal(chip, payload, options, blob_handle); |
1348 | - |
1349 | - tpm2_flush_context(chip, blob_handle); |
1350 | + goto out; |
1351 | |
1352 | + rc = tpm2_unseal_cmd(chip, payload, options, blob_handle, |
1353 | + TPM_TRANSMIT_UNLOCKED); |
1354 | + tpm2_flush_context_cmd(chip, blob_handle, TPM_TRANSMIT_UNLOCKED); |
1355 | +out: |
1356 | + mutex_unlock(&chip->tpm_mutex); |
1357 | return rc; |
1358 | } |
1359 | |
1360 | @@ -701,7 +730,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, |
1361 | cmd.params.get_tpm_pt_in.property_id = cpu_to_be32(property_id); |
1362 | cmd.params.get_tpm_pt_in.property_cnt = cpu_to_be32(1); |
1363 | |
1364 | - rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); |
1365 | + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, desc); |
1366 | if (!rc) |
1367 | *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); |
1368 | |
1369 | @@ -735,7 +764,7 @@ static int tpm2_startup(struct tpm_chip *chip, u16 startup_type) |
1370 | cmd.header.in = tpm2_startup_header; |
1371 | |
1372 | cmd.params.startup_in.startup_type = cpu_to_be16(startup_type); |
1373 | - return tpm_transmit_cmd(chip, &cmd, sizeof(cmd), |
1374 | + return tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, |
1375 | "attempting to start the TPM"); |
1376 | } |
1377 | |
1378 | @@ -763,7 +792,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) |
1379 | cmd.header.in = tpm2_shutdown_header; |
1380 | cmd.params.startup_in.startup_type = cpu_to_be16(shutdown_type); |
1381 | |
1382 | - rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), "stopping the TPM"); |
1383 | + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, "stopping the TPM"); |
1384 | |
1385 | /* In places where shutdown command is sent there's no much we can do |
1386 | * except print the error code on a system failure. |
1387 | @@ -828,7 +857,7 @@ static int tpm2_start_selftest(struct tpm_chip *chip, bool full) |
1388 | cmd.header.in = tpm2_selftest_header; |
1389 | cmd.params.selftest_in.full_test = full; |
1390 | |
1391 | - rc = tpm_transmit_cmd(chip, &cmd, TPM2_SELF_TEST_IN_SIZE, |
1392 | + rc = tpm_transmit_cmd(chip, &cmd, TPM2_SELF_TEST_IN_SIZE, 0, |
1393 | "continue selftest"); |
1394 | |
1395 | /* At least some prototype chips seem to give RC_TESTING error |
1396 | @@ -880,7 +909,7 @@ static int tpm2_do_selftest(struct tpm_chip *chip) |
1397 | cmd.params.pcrread_in.pcr_select[1] = 0x00; |
1398 | cmd.params.pcrread_in.pcr_select[2] = 0x00; |
1399 | |
1400 | - rc = tpm_transmit_cmd(chip, (u8 *) &cmd, sizeof(cmd), NULL); |
1401 | + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), 0, NULL); |
1402 | if (rc < 0) |
1403 | break; |
1404 | |
1405 | @@ -928,7 +957,7 @@ int tpm2_probe(struct tpm_chip *chip) |
1406 | cmd.params.get_tpm_pt_in.property_id = cpu_to_be32(0x100); |
1407 | cmd.params.get_tpm_pt_in.property_cnt = cpu_to_be32(1); |
1408 | |
1409 | - rc = tpm_transmit(chip, (const char *) &cmd, sizeof(cmd)); |
1410 | + rc = tpm_transmit(chip, (const u8 *)&cmd, sizeof(cmd), 0); |
1411 | if (rc < 0) |
1412 | return rc; |
1413 | else if (rc < TPM_HEADER_SIZE) |
1414 | diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c |
1415 | index 018c382554ba..1801f382377e 100644 |
1416 | --- a/drivers/char/tpm/tpm_crb.c |
1417 | +++ b/drivers/char/tpm/tpm_crb.c |
1418 | @@ -142,6 +142,11 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len) |
1419 | struct crb_priv *priv = dev_get_drvdata(&chip->dev); |
1420 | int rc = 0; |
1421 | |
1422 | + /* Zero the cancel register so that the next command will not get |
1423 | + * canceled. |
1424 | + */ |
1425 | + iowrite32(0, &priv->cca->cancel); |
1426 | + |
1427 | if (len > ioread32(&priv->cca->cmd_size)) { |
1428 | dev_err(&chip->dev, |
1429 | "invalid command count value %x %zx\n", |
1430 | @@ -175,8 +180,6 @@ static void crb_cancel(struct tpm_chip *chip) |
1431 | |
1432 | if ((priv->flags & CRB_FL_ACPI_START) && crb_do_acpi_start(chip)) |
1433 | dev_err(&chip->dev, "ACPI Start failed\n"); |
1434 | - |
1435 | - iowrite32(0, &priv->cca->cancel); |
1436 | } |
1437 | |
1438 | static bool crb_req_canceled(struct tpm_chip *chip, u8 status) |
1439 | diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c |
1440 | index 4ba3d3fe142f..f440d385ed34 100644 |
1441 | --- a/drivers/cpuidle/cpuidle-arm.c |
1442 | +++ b/drivers/cpuidle/cpuidle-arm.c |
1443 | @@ -121,6 +121,7 @@ static int __init arm_idle_init(void) |
1444 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
1445 | if (!dev) { |
1446 | pr_err("Failed to allocate cpuidle device\n"); |
1447 | + ret = -ENOMEM; |
1448 | goto out_fail; |
1449 | } |
1450 | dev->cpu = cpu; |
1451 | diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig |
1452 | index 2d1fb6420592..580f4f280d6b 100644 |
1453 | --- a/drivers/mfd/Kconfig |
1454 | +++ b/drivers/mfd/Kconfig |
1455 | @@ -1549,6 +1549,7 @@ config MFD_WM8350 |
1456 | config MFD_WM8350_I2C |
1457 | bool "Wolfson Microelectronics WM8350 with I2C" |
1458 | select MFD_WM8350 |
1459 | + select REGMAP_I2C |
1460 | depends on I2C=y |
1461 | help |
1462 | The WM8350 is an integrated audio and power management |
1463 | diff --git a/drivers/mfd/atmel-hlcdc.c b/drivers/mfd/atmel-hlcdc.c |
1464 | index eca7ea69b81c..4b15b0840f16 100644 |
1465 | --- a/drivers/mfd/atmel-hlcdc.c |
1466 | +++ b/drivers/mfd/atmel-hlcdc.c |
1467 | @@ -50,8 +50,9 @@ static int regmap_atmel_hlcdc_reg_write(void *context, unsigned int reg, |
1468 | if (reg <= ATMEL_HLCDC_DIS) { |
1469 | u32 status; |
1470 | |
1471 | - readl_poll_timeout(hregmap->regs + ATMEL_HLCDC_SR, status, |
1472 | - !(status & ATMEL_HLCDC_SIP), 1, 100); |
1473 | + readl_poll_timeout_atomic(hregmap->regs + ATMEL_HLCDC_SR, |
1474 | + status, !(status & ATMEL_HLCDC_SIP), |
1475 | + 1, 100); |
1476 | } |
1477 | |
1478 | writel(val, hregmap->regs + reg); |
1479 | diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c |
1480 | index dbd907d7170e..691dab791f7a 100644 |
1481 | --- a/drivers/mfd/rtsx_usb.c |
1482 | +++ b/drivers/mfd/rtsx_usb.c |
1483 | @@ -46,9 +46,6 @@ static void rtsx_usb_sg_timed_out(unsigned long data) |
1484 | |
1485 | dev_dbg(&ucr->pusb_intf->dev, "%s: sg transfer timed out", __func__); |
1486 | usb_sg_cancel(&ucr->current_sg); |
1487 | - |
1488 | - /* we know the cancellation is caused by time-out */ |
1489 | - ucr->current_sg.status = -ETIMEDOUT; |
1490 | } |
1491 | |
1492 | static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr, |
1493 | @@ -67,12 +64,15 @@ static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr, |
1494 | ucr->sg_timer.expires = jiffies + msecs_to_jiffies(timeout); |
1495 | add_timer(&ucr->sg_timer); |
1496 | usb_sg_wait(&ucr->current_sg); |
1497 | - del_timer_sync(&ucr->sg_timer); |
1498 | + if (!del_timer_sync(&ucr->sg_timer)) |
1499 | + ret = -ETIMEDOUT; |
1500 | + else |
1501 | + ret = ucr->current_sg.status; |
1502 | |
1503 | if (act_len) |
1504 | *act_len = ucr->current_sg.bytes; |
1505 | |
1506 | - return ucr->current_sg.status; |
1507 | + return ret; |
1508 | } |
1509 | |
1510 | int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe, |
1511 | diff --git a/drivers/pci/pci-mid.c b/drivers/pci/pci-mid.c |
1512 | index c878aa71173b..55f453de562e 100644 |
1513 | --- a/drivers/pci/pci-mid.c |
1514 | +++ b/drivers/pci/pci-mid.c |
1515 | @@ -60,8 +60,13 @@ static struct pci_platform_pm_ops mid_pci_platform_pm = { |
1516 | |
1517 | #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } |
1518 | |
1519 | +/* |
1520 | + * This table should be in sync with the one in |
1521 | + * arch/x86/platform/intel-mid/pwr.c. |
1522 | + */ |
1523 | static const struct x86_cpu_id lpss_cpu_ids[] = { |
1524 | - ICPU(INTEL_FAM6_ATOM_MERRIFIELD1), |
1525 | + ICPU(INTEL_FAM6_ATOM_PENWELL), |
1526 | + ICPU(INTEL_FAM6_ATOM_MERRIFIELD), |
1527 | {} |
1528 | }; |
1529 | |
1530 | diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c |
1531 | index 8c7eb335622e..4d74ca9186c7 100644 |
1532 | --- a/drivers/phy/phy-sun4i-usb.c |
1533 | +++ b/drivers/phy/phy-sun4i-usb.c |
1534 | @@ -40,6 +40,7 @@ |
1535 | #include <linux/power_supply.h> |
1536 | #include <linux/regulator/consumer.h> |
1537 | #include <linux/reset.h> |
1538 | +#include <linux/spinlock.h> |
1539 | #include <linux/usb/of.h> |
1540 | #include <linux/workqueue.h> |
1541 | |
1542 | @@ -112,7 +113,7 @@ struct sun4i_usb_phy_data { |
1543 | void __iomem *base; |
1544 | const struct sun4i_usb_phy_cfg *cfg; |
1545 | enum usb_dr_mode dr_mode; |
1546 | - struct mutex mutex; |
1547 | + spinlock_t reg_lock; /* guard access to phyctl reg */ |
1548 | struct sun4i_usb_phy { |
1549 | struct phy *phy; |
1550 | void __iomem *pmu; |
1551 | @@ -179,9 +180,10 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data, |
1552 | struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); |
1553 | u32 temp, usbc_bit = BIT(phy->index * 2); |
1554 | void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; |
1555 | + unsigned long flags; |
1556 | int i; |
1557 | |
1558 | - mutex_lock(&phy_data->mutex); |
1559 | + spin_lock_irqsave(&phy_data->reg_lock, flags); |
1560 | |
1561 | if (phy_data->cfg->type == sun8i_a33_phy) { |
1562 | /* A33 needs us to set phyctl to 0 explicitly */ |
1563 | @@ -218,7 +220,8 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data, |
1564 | |
1565 | data >>= 1; |
1566 | } |
1567 | - mutex_unlock(&phy_data->mutex); |
1568 | + |
1569 | + spin_unlock_irqrestore(&phy_data->reg_lock, flags); |
1570 | } |
1571 | |
1572 | static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable) |
1573 | @@ -577,7 +580,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) |
1574 | if (!data) |
1575 | return -ENOMEM; |
1576 | |
1577 | - mutex_init(&data->mutex); |
1578 | + spin_lock_init(&data->reg_lock); |
1579 | INIT_DELAYED_WORK(&data->detect, sun4i_usb_phy0_id_vbus_det_scan); |
1580 | dev_set_drvdata(dev, data); |
1581 | data->cfg = of_device_get_match_data(dev); |
1582 | diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c |
1583 | index fbab29dfa793..243b233ff31b 100644 |
1584 | --- a/drivers/powercap/intel_rapl.c |
1585 | +++ b/drivers/powercap/intel_rapl.c |
1586 | @@ -1154,8 +1154,8 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { |
1587 | |
1588 | RAPL_CPU(INTEL_FAM6_ATOM_SILVERMONT1, rapl_defaults_byt), |
1589 | RAPL_CPU(INTEL_FAM6_ATOM_AIRMONT, rapl_defaults_cht), |
1590 | - RAPL_CPU(INTEL_FAM6_ATOM_MERRIFIELD1, rapl_defaults_tng), |
1591 | - RAPL_CPU(INTEL_FAM6_ATOM_MERRIFIELD2, rapl_defaults_ann), |
1592 | + RAPL_CPU(INTEL_FAM6_ATOM_MERRIFIELD, rapl_defaults_tng), |
1593 | + RAPL_CPU(INTEL_FAM6_ATOM_MOOREFIELD, rapl_defaults_ann), |
1594 | RAPL_CPU(INTEL_FAM6_ATOM_GOLDMONT, rapl_defaults_core), |
1595 | RAPL_CPU(INTEL_FAM6_ATOM_DENVERTON, rapl_defaults_core), |
1596 | |
1597 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1598 | index 122e64df2f4d..68544618982e 100644 |
1599 | --- a/drivers/usb/dwc3/gadget.c |
1600 | +++ b/drivers/usb/dwc3/gadget.c |
1601 | @@ -348,7 +348,8 @@ static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep) |
1602 | * IN transfers due to a mishandled error condition. Synopsys |
1603 | * STAR 9000614252. |
1604 | */ |
1605 | - if (dep->direction && (dwc->revision >= DWC3_REVISION_260A)) |
1606 | + if (dep->direction && (dwc->revision >= DWC3_REVISION_260A) && |
1607 | + (dwc->gadget.speed >= USB_SPEED_SUPER)) |
1608 | cmd |= DWC3_DEPCMD_CLEARPENDIN; |
1609 | |
1610 | memset(¶ms, 0, sizeof(params)); |
1611 | diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c |
1612 | index ef2d8cde6ef7..8c5f0115166a 100644 |
1613 | --- a/drivers/usb/storage/usb.c |
1614 | +++ b/drivers/usb/storage/usb.c |
1615 | @@ -1070,17 +1070,17 @@ int usb_stor_probe2(struct us_data *us) |
1616 | result = usb_stor_acquire_resources(us); |
1617 | if (result) |
1618 | goto BadDevice; |
1619 | + usb_autopm_get_interface_no_resume(us->pusb_intf); |
1620 | snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", |
1621 | dev_name(&us->pusb_intf->dev)); |
1622 | result = scsi_add_host(us_to_host(us), dev); |
1623 | if (result) { |
1624 | dev_warn(dev, |
1625 | "Unable to add the scsi host\n"); |
1626 | - goto BadDevice; |
1627 | + goto HostAddErr; |
1628 | } |
1629 | |
1630 | /* Submit the delayed_work for SCSI-device scanning */ |
1631 | - usb_autopm_get_interface_no_resume(us->pusb_intf); |
1632 | set_bit(US_FLIDX_SCAN_PENDING, &us->dflags); |
1633 | |
1634 | if (delay_use > 0) |
1635 | @@ -1090,6 +1090,8 @@ int usb_stor_probe2(struct us_data *us) |
1636 | return 0; |
1637 | |
1638 | /* We come here if there are any problems */ |
1639 | +HostAddErr: |
1640 | + usb_autopm_put_interface_no_suspend(us->pusb_intf); |
1641 | BadDevice: |
1642 | usb_stor_dbg(us, "storage_probe() failed\n"); |
1643 | release_everything(us); |
1644 | diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h |
1645 | index d409ceb2231e..c118a7ec94d6 100644 |
1646 | --- a/include/linux/mfd/88pm80x.h |
1647 | +++ b/include/linux/mfd/88pm80x.h |
1648 | @@ -350,7 +350,7 @@ static inline int pm80x_dev_suspend(struct device *dev) |
1649 | int irq = platform_get_irq(pdev, 0); |
1650 | |
1651 | if (device_may_wakeup(dev)) |
1652 | - set_bit((1 << irq), &chip->wu_flag); |
1653 | + set_bit(irq, &chip->wu_flag); |
1654 | |
1655 | return 0; |
1656 | } |
1657 | @@ -362,7 +362,7 @@ static inline int pm80x_dev_resume(struct device *dev) |
1658 | int irq = platform_get_irq(pdev, 0); |
1659 | |
1660 | if (device_may_wakeup(dev)) |
1661 | - clear_bit((1 << irq), &chip->wu_flag); |
1662 | + clear_bit(irq, &chip->wu_flag); |
1663 | |
1664 | return 0; |
1665 | } |
1666 | diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
1667 | index e07fb093f819..37dec7e3db43 100644 |
1668 | --- a/kernel/time/timekeeping.c |
1669 | +++ b/kernel/time/timekeeping.c |
1670 | @@ -403,8 +403,11 @@ static __always_inline u64 __ktime_get_fast_ns(struct tk_fast *tkf) |
1671 | tkr = tkf->base + (seq & 0x01); |
1672 | now = ktime_to_ns(tkr->base); |
1673 | |
1674 | - now += clocksource_delta(tkr->read(tkr->clock), |
1675 | - tkr->cycle_last, tkr->mask); |
1676 | + now += timekeeping_delta_to_ns(tkr, |
1677 | + clocksource_delta( |
1678 | + tkr->read(tkr->clock), |
1679 | + tkr->cycle_last, |
1680 | + tkr->mask)); |
1681 | } while (read_seqcount_retry(&tkf->seq, seq)); |
1682 | |
1683 | return now; |
1684 | diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c |
1685 | index 4b9b4a4e1b89..ef1e4e701780 100644 |
1686 | --- a/security/integrity/ima/ima_appraise.c |
1687 | +++ b/security/integrity/ima/ima_appraise.c |
1688 | @@ -190,7 +190,7 @@ int ima_appraise_measurement(enum ima_hooks func, |
1689 | { |
1690 | static const char op[] = "appraise_data"; |
1691 | char *cause = "unknown"; |
1692 | - struct dentry *dentry = file->f_path.dentry; |
1693 | + struct dentry *dentry = file_dentry(file); |
1694 | struct inode *inode = d_backing_inode(dentry); |
1695 | enum integrity_status status = INTEGRITY_UNKNOWN; |
1696 | int rc = xattr_len, hash_start = 0; |
1697 | @@ -295,7 +295,7 @@ out: |
1698 | */ |
1699 | void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) |
1700 | { |
1701 | - struct dentry *dentry = file->f_path.dentry; |
1702 | + struct dentry *dentry = file_dentry(file); |
1703 | int rc = 0; |
1704 | |
1705 | /* do not collect and update hash for digital signatures */ |
1706 | diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c |
1707 | index 596ef616ac21..423d111b3b94 100644 |
1708 | --- a/security/integrity/ima/ima_main.c |
1709 | +++ b/security/integrity/ima/ima_main.c |
1710 | @@ -228,7 +228,7 @@ static int process_measurement(struct file *file, char *buf, loff_t size, |
1711 | if ((action & IMA_APPRAISE_SUBMASK) || |
1712 | strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) != 0) |
1713 | /* read 'security.ima' */ |
1714 | - xattr_len = ima_read_xattr(file->f_path.dentry, &xattr_value); |
1715 | + xattr_len = ima_read_xattr(file_dentry(file), &xattr_value); |
1716 | |
1717 | hash_algo = ima_get_hash_algo(xattr_value, xattr_len); |
1718 | |
1719 | diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c |
1720 | index 36470af7eda7..92b819e4f729 100644 |
1721 | --- a/sound/pci/ali5451/ali5451.c |
1722 | +++ b/sound/pci/ali5451/ali5451.c |
1723 | @@ -1408,6 +1408,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream) |
1724 | spin_unlock(&codec->reg_lock); |
1725 | dev_dbg(codec->card->dev, "playback pointer returned cso=%xh.\n", cso); |
1726 | |
1727 | + cso %= runtime->buffer_size; |
1728 | return cso; |
1729 | } |
1730 | |
1731 | @@ -1428,6 +1429,7 @@ static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream) |
1732 | cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)); |
1733 | spin_unlock(&codec->reg_lock); |
1734 | |
1735 | + cso %= runtime->buffer_size; |
1736 | return cso; |
1737 | } |
1738 | |
1739 | diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c |
1740 | index 81b7da8e56d3..183311cb849e 100644 |
1741 | --- a/sound/usb/line6/driver.c |
1742 | +++ b/sound/usb/line6/driver.c |
1743 | @@ -29,7 +29,7 @@ |
1744 | /* |
1745 | This is Line 6's MIDI manufacturer ID. |
1746 | */ |
1747 | -const unsigned char line6_midi_id[] = { |
1748 | +const unsigned char line6_midi_id[3] = { |
1749 | 0x00, 0x01, 0x0c |
1750 | }; |
1751 | EXPORT_SYMBOL_GPL(line6_midi_id); |
1752 | diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
1753 | index f6c3bf79af9a..04991b009132 100644 |
1754 | --- a/sound/usb/mixer_quirks.c |
1755 | +++ b/sound/usb/mixer_quirks.c |
1756 | @@ -1831,6 +1831,7 @@ void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface *mixer, |
1757 | } |
1758 | |
1759 | static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer, |
1760 | + struct usb_mixer_elem_info *cval, |
1761 | struct snd_kcontrol *kctl) |
1762 | { |
1763 | /* Approximation using 10 ranges based on output measurement on hw v1.2. |
1764 | @@ -1848,10 +1849,19 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer, |
1765 | 41, 50, TLV_DB_MINMAX_ITEM(-441, 0), |
1766 | ); |
1767 | |
1768 | - usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk\n"); |
1769 | - kctl->tlv.p = scale; |
1770 | - kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; |
1771 | - kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; |
1772 | + if (cval->min == 0 && cval->max == 50) { |
1773 | + usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk (0-50 variant)\n"); |
1774 | + kctl->tlv.p = scale; |
1775 | + kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; |
1776 | + kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; |
1777 | + |
1778 | + } else if (cval->min == 0 && cval->max <= 1000) { |
1779 | + /* Some other clearly broken DragonFly variant. |
1780 | + * At least a 0..53 variant (hw v1.0) exists. |
1781 | + */ |
1782 | + usb_audio_info(mixer->chip, "ignoring too narrow dB range on a DragonFly device"); |
1783 | + kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; |
1784 | + } |
1785 | } |
1786 | |
1787 | void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, |
1788 | @@ -1860,8 +1870,8 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, |
1789 | { |
1790 | switch (mixer->chip->usb_id) { |
1791 | case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ |
1792 | - if (unitid == 7 && cval->min == 0 && cval->max == 50) |
1793 | - snd_dragonfly_quirk_db_scale(mixer, kctl); |
1794 | + if (unitid == 7 && cval->control == UAC_FU_VOLUME) |
1795 | + snd_dragonfly_quirk_db_scale(mixer, cval, kctl); |
1796 | break; |
1797 | } |
1798 | } |
1799 | diff --git a/virt/kvm/arm/pmu.c b/virt/kvm/arm/pmu.c |
1800 | index a027569facfa..6e9c40eea208 100644 |
1801 | --- a/virt/kvm/arm/pmu.c |
1802 | +++ b/virt/kvm/arm/pmu.c |
1803 | @@ -423,6 +423,14 @@ static int kvm_arm_pmu_v3_init(struct kvm_vcpu *vcpu) |
1804 | if (!kvm_arm_support_pmu_v3()) |
1805 | return -ENODEV; |
1806 | |
1807 | + /* |
1808 | + * We currently require an in-kernel VGIC to use the PMU emulation, |
1809 | + * because we do not support forwarding PMU overflow interrupts to |
1810 | + * userspace yet. |
1811 | + */ |
1812 | + if (!irqchip_in_kernel(vcpu->kvm) || !vgic_initialized(vcpu->kvm)) |
1813 | + return -ENODEV; |
1814 | + |
1815 | if (!test_bit(KVM_ARM_VCPU_PMU_V3, vcpu->arch.features) || |
1816 | !kvm_arm_pmu_irq_initialized(vcpu)) |
1817 | return -ENXIO; |
1818 | diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c |
1819 | index e83b7fe4baae..b465ac6d5d48 100644 |
1820 | --- a/virt/kvm/arm/vgic/vgic.c |
1821 | +++ b/virt/kvm/arm/vgic/vgic.c |
1822 | @@ -645,6 +645,9 @@ next: |
1823 | /* Sync back the hardware VGIC state into our emulation after a guest's run. */ |
1824 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) |
1825 | { |
1826 | + if (unlikely(!vgic_initialized(vcpu->kvm))) |
1827 | + return; |
1828 | + |
1829 | vgic_process_maintenance_interrupt(vcpu); |
1830 | vgic_fold_lr_state(vcpu); |
1831 | vgic_prune_ap_list(vcpu); |
1832 | @@ -653,6 +656,9 @@ void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) |
1833 | /* Flush our emulation state into the GIC hardware before entering the guest. */ |
1834 | void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) |
1835 | { |
1836 | + if (unlikely(!vgic_initialized(vcpu->kvm))) |
1837 | + return; |
1838 | + |
1839 | spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock); |
1840 | vgic_flush_lr_state(vcpu); |
1841 | spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); |