Skip to content

Commit 5497d2d

Browse files
author
Alex Shi
committed
Merge remote-tracking branch 'lts/linux-4.4.y' into linux-linaro-lsk-v4.4
Conflicts: keep check_object_size in copy_from_user in arch/sparc/include/asm/uaccess_64.h
2 parents 063181a + 4eb9a81 commit 5497d2d

93 files changed

Lines changed: 1766 additions & 966 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION = 4
22
PATCHLEVEL = 4
3-
SUBLEVEL = 32
3+
SUBLEVEL = 34
44
EXTRAVERSION =
55
NAME = Blurry Fish Butt
66

arch/arc/kernel/time.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,17 @@ static cycle_t arc_counter_read(struct clocksource *cs)
130130
cycle_t full;
131131
} stamp;
132132

133-
134-
__asm__ __volatile(
135-
"1: \n"
136-
" lr %0, [AUX_RTC_LOW] \n"
137-
" lr %1, [AUX_RTC_HIGH] \n"
138-
" lr %2, [AUX_RTC_CTRL] \n"
139-
" bbit0.nt %2, 31, 1b \n"
140-
: "=r" (stamp.low), "=r" (stamp.high), "=r" (status));
133+
/*
134+
* hardware has an internal state machine which tracks readout of
135+
* low/high and updates the CTRL.status if
136+
* - interrupt/exception taken between the two reads
137+
* - high increments after low has been read
138+
*/
139+
do {
140+
stamp.low = read_aux_reg(AUX_RTC_LOW);
141+
stamp.high = read_aux_reg(AUX_RTC_HIGH);
142+
status = read_aux_reg(AUX_RTC_CTRL);
143+
} while (!(status & _BITUL(31)));
141144

142145
return stamp.full;
143146
}

arch/mips/include/asm/kvm_host.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,10 @@ struct kvm_vcpu_arch {
400400
/* Host KSEG0 address of the EI/DI offset */
401401
void *kseg0_commpage;
402402

403-
u32 io_gpr; /* GPR used as IO source/target */
403+
/* Resume PC after MMIO completion */
404+
unsigned long io_pc;
405+
/* GPR used as IO source/target */
406+
u32 io_gpr;
404407

405408
struct hrtimer comparecount_timer;
406409
/* Count timer control KVM register */
@@ -422,8 +425,6 @@ struct kvm_vcpu_arch {
422425
/* Bitmask of pending exceptions to be cleared */
423426
unsigned long pending_exceptions_clr;
424427

425-
unsigned long pending_load_cause;
426-
427428
/* Save/Restore the entryhi register when are are preempted/scheduled back in */
428429
unsigned long preempt_entryhi;
429430

arch/mips/kvm/emulate.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,7 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause,
14731473
struct kvm_vcpu *vcpu)
14741474
{
14751475
enum emulation_result er = EMULATE_DO_MMIO;
1476+
unsigned long curr_pc;
14761477
int32_t op, base, rt, offset;
14771478
uint32_t bytes;
14781479

@@ -1481,7 +1482,18 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause,
14811482
offset = inst & 0xffff;
14821483
op = (inst >> 26) & 0x3f;
14831484

1484-
vcpu->arch.pending_load_cause = cause;
1485+
/*
1486+
* Find the resume PC now while we have safe and easy access to the
1487+
* prior branch instruction, and save it for
1488+
* kvm_mips_complete_mmio_load() to restore later.
1489+
*/
1490+
curr_pc = vcpu->arch.pc;
1491+
er = update_pc(vcpu, cause);
1492+
if (er == EMULATE_FAIL)
1493+
return er;
1494+
vcpu->arch.io_pc = vcpu->arch.pc;
1495+
vcpu->arch.pc = curr_pc;
1496+
14851497
vcpu->arch.io_gpr = rt;
14861498

14871499
switch (op) {
@@ -2461,9 +2473,8 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu,
24612473
goto done;
24622474
}
24632475

2464-
er = update_pc(vcpu, vcpu->arch.pending_load_cause);
2465-
if (er == EMULATE_FAIL)
2466-
return er;
2476+
/* Restore saved resume PC */
2477+
vcpu->arch.pc = vcpu->arch.io_pc;
24672478

24682479
switch (run->mmio.len) {
24692480
case 4:
@@ -2485,11 +2496,6 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu,
24852496
break;
24862497
}
24872498

2488-
if (vcpu->arch.pending_load_cause & CAUSEF_BD)
2489-
kvm_debug("[%#lx] Completing %d byte BD Load to gpr %d (0x%08lx) type %d\n",
2490-
vcpu->arch.pc, run->mmio.len, vcpu->arch.io_gpr, *gpr,
2491-
vcpu->mmio_needed);
2492-
24932499
done:
24942500
return er;
24952501
}

arch/s390/hypfs/hypfs_diag.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,11 @@ static int diag224(void *ptr)
525525
static int diag224_get_name_table(void)
526526
{
527527
/* memory must be below 2GB */
528-
diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
528+
diag224_cpu_names = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
529529
if (!diag224_cpu_names)
530530
return -ENOMEM;
531531
if (diag224(diag224_cpu_names)) {
532-
kfree(diag224_cpu_names);
532+
free_page((unsigned long) diag224_cpu_names);
533533
return -EOPNOTSUPP;
534534
}
535535
EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
@@ -538,7 +538,7 @@ static int diag224_get_name_table(void)
538538

539539
static void diag224_delete_name_table(void)
540540
{
541-
kfree(diag224_cpu_names);
541+
free_page((unsigned long) diag224_cpu_names);
542542
}
543543

544544
static int diag224_idx2name(int index, char *name)

arch/sparc/include/asm/mmu_64.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ struct tsb_config {
9292
typedef struct {
9393
spinlock_t lock;
9494
unsigned long sparc64_ctx_val;
95-
unsigned long huge_pte_count;
95+
unsigned long hugetlb_pte_count;
96+
unsigned long thp_pte_count;
9697
struct tsb_config tsb_block[MM_NUM_TSBS];
9798
struct hv_tsb_descr tsb_descr[MM_NUM_TSBS];
9899
} mm_context_t;

arch/sparc/include/asm/uaccess_64.h

Lines changed: 3 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ struct exception_table_entry {
9898
unsigned int insn, fixup;
9999
};
100100

101-
void __ret_efault(void);
102101
void __retl_efault(void);
103102

104103
/* Uh, these should become the main single-value transfer routines..
@@ -179,20 +178,6 @@ int __put_user_bad(void);
179178
__gu_ret; \
180179
})
181180

182-
#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \
183-
register unsigned long __gu_val __asm__ ("l1"); \
184-
switch (size) { \
185-
case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \
186-
case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \
187-
case 4: __get_user_asm_ret(__gu_val, uw, addr, retval); break; \
188-
case 8: __get_user_asm_ret(__gu_val, x, addr, retval); break; \
189-
default: \
190-
if (__get_user_bad()) \
191-
return retval; \
192-
} \
193-
data = (__force type) __gu_val; \
194-
})
195-
196181
#define __get_user_asm(x, size, addr, ret) \
197182
__asm__ __volatile__( \
198183
"/* Get user asm, inline. */\n" \
@@ -214,86 +199,39 @@ __asm__ __volatile__( \
214199
: "=r" (ret), "=r" (x) : "r" (__m(addr)), \
215200
"i" (-EFAULT))
216201

217-
#define __get_user_asm_ret(x, size, addr, retval) \
218-
if (__builtin_constant_p(retval) && retval == -EFAULT) \
219-
__asm__ __volatile__( \
220-
"/* Get user asm ret, inline. */\n" \
221-
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
222-
".section __ex_table,\"a\"\n\t" \
223-
".align 4\n\t" \
224-
".word 1b,__ret_efault\n\n\t" \
225-
".previous\n\t" \
226-
: "=r" (x) : "r" (__m(addr))); \
227-
else \
228-
__asm__ __volatile__( \
229-
"/* Get user asm ret, inline. */\n" \
230-
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
231-
".section .fixup,#alloc,#execinstr\n\t" \
232-
".align 4\n" \
233-
"3:\n\t" \
234-
"ret\n\t" \
235-
" restore %%g0, %2, %%o0\n\n\t" \
236-
".previous\n\t" \
237-
".section __ex_table,\"a\"\n\t" \
238-
".align 4\n\t" \
239-
".word 1b, 3b\n\n\t" \
240-
".previous\n\t" \
241-
: "=r" (x) : "r" (__m(addr)), "i" (retval))
242-
243202
int __get_user_bad(void);
244203

245204
unsigned long __must_check ___copy_from_user(void *to,
246205
const void __user *from,
247206
unsigned long size);
248-
unsigned long copy_from_user_fixup(void *to, const void __user *from,
249-
unsigned long size);
250207
static inline unsigned long __must_check
251208
copy_from_user(void *to, const void __user *from, unsigned long size)
252209
{
253-
unsigned long ret;
254-
255210
check_object_size(to, size, false);
256211

257-
ret = ___copy_from_user(to, from, size);
258-
if (unlikely(ret))
259-
ret = copy_from_user_fixup(to, from, size);
260-
261-
return ret;
212+
return ___copy_from_user(to, from, size);
262213
}
263214
#define __copy_from_user copy_from_user
264215

265216
unsigned long __must_check ___copy_to_user(void __user *to,
266217
const void *from,
267218
unsigned long size);
268-
unsigned long copy_to_user_fixup(void __user *to, const void *from,
269-
unsigned long size);
270219
static inline unsigned long __must_check
271220
copy_to_user(void __user *to, const void *from, unsigned long size)
272221
{
273-
unsigned long ret;
274-
275222
check_object_size(from, size, true);
276223

277-
ret = ___copy_to_user(to, from, size);
278-
if (unlikely(ret))
279-
ret = copy_to_user_fixup(to, from, size);
280-
return ret;
224+
return ___copy_to_user(to, from, size);
281225
}
282226
#define __copy_to_user copy_to_user
283227

284228
unsigned long __must_check ___copy_in_user(void __user *to,
285229
const void __user *from,
286230
unsigned long size);
287-
unsigned long copy_in_user_fixup(void __user *to, void __user *from,
288-
unsigned long size);
289231
static inline unsigned long __must_check
290232
copy_in_user(void __user *to, void __user *from, unsigned long size)
291233
{
292-
unsigned long ret = ___copy_in_user(to, from, size);
293-
294-
if (unlikely(ret))
295-
ret = copy_in_user_fixup(to, from, size);
296-
return ret;
234+
return ___copy_in_user(to, from, size);
297235
}
298236
#define __copy_in_user copy_in_user
299237

arch/sparc/kernel/dtlb_prot.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
/* PROT ** ICACHE line 2: More real fault processing */
2727
ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5
28+
srlx %g5, PAGE_SHIFT, %g5
29+
sllx %g5, PAGE_SHIFT, %g5 ! Clear context ID bits
2830
bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup
2931
mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
3032
ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault
3133
nop
3234
nop
33-
nop
34-
nop
3535

3636
/* PROT ** ICACHE line 3: Unused... */
3737
nop

arch/sparc/kernel/head_64.S

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -922,47 +922,11 @@ prom_tba: .xword 0
922922
tlb_type: .word 0 /* Must NOT end up in BSS */
923923
.section ".fixup",#alloc,#execinstr
924924

925-
.globl __ret_efault, __retl_efault, __ret_one, __retl_one
926-
ENTRY(__ret_efault)
927-
ret
928-
restore %g0, -EFAULT, %o0
929-
ENDPROC(__ret_efault)
930-
931925
ENTRY(__retl_efault)
932926
retl
933927
mov -EFAULT, %o0
934928
ENDPROC(__retl_efault)
935929

936-
ENTRY(__retl_one)
937-
retl
938-
mov 1, %o0
939-
ENDPROC(__retl_one)
940-
941-
ENTRY(__retl_one_fp)
942-
VISExitHalf
943-
retl
944-
mov 1, %o0
945-
ENDPROC(__retl_one_fp)
946-
947-
ENTRY(__ret_one_asi)
948-
wr %g0, ASI_AIUS, %asi
949-
ret
950-
restore %g0, 1, %o0
951-
ENDPROC(__ret_one_asi)
952-
953-
ENTRY(__retl_one_asi)
954-
wr %g0, ASI_AIUS, %asi
955-
retl
956-
mov 1, %o0
957-
ENDPROC(__retl_one_asi)
958-
959-
ENTRY(__retl_one_asi_fp)
960-
wr %g0, ASI_AIUS, %asi
961-
VISExitHalf
962-
retl
963-
mov 1, %o0
964-
ENDPROC(__retl_one_asi_fp)
965-
966930
ENTRY(__retl_o1)
967931
retl
968932
mov %o1, %o0

arch/sparc/kernel/jump_label.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,30 @@
1313
void arch_jump_label_transform(struct jump_entry *entry,
1414
enum jump_label_type type)
1515
{
16-
u32 val;
1716
u32 *insn = (u32 *) (unsigned long) entry->code;
17+
u32 val;
1818

1919
if (type == JUMP_LABEL_JMP) {
2020
s32 off = (s32)entry->target - (s32)entry->code;
21+
bool use_v9_branch = false;
22+
23+
BUG_ON(off & 3);
2124

2225
#ifdef CONFIG_SPARC64
23-
/* ba,pt %xcc, . + (off << 2) */
24-
val = 0x10680000 | ((u32) off >> 2);
25-
#else
26-
/* ba . + (off << 2) */
27-
val = 0x10800000 | ((u32) off >> 2);
26+
if (off <= 0xfffff && off >= -0x100000)
27+
use_v9_branch = true;
2828
#endif
29+
if (use_v9_branch) {
30+
/* WDISP19 - target is . + immed << 2 */
31+
/* ba,pt %xcc, . + off */
32+
val = 0x10680000 | (((u32) off >> 2) & 0x7ffff);
33+
} else {
34+
/* WDISP22 - target is . + immed << 2 */
35+
BUG_ON(off > 0x7fffff);
36+
BUG_ON(off < -0x800000);
37+
/* ba . + off */
38+
val = 0x10800000 | (((u32) off >> 2) & 0x3fffff);
39+
}
2940
} else {
3041
val = 0x01000000;
3142
}

0 commit comments

Comments
 (0)