diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 15:00:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 15:00:22 -0400 |
commit | bf32d52c455d933cc9a459bb94af9ea8b5850af9 (patch) | |
tree | 0d6af119b141e46e120ad06c867fe82ac3c00f1c /arch/mips | |
parent | 0c375501be6e6dc23c11ebfa394434517444e62d (diff) | |
parent | 7d132055814ef17a6c7b69f342244c410a5e000f (diff) |
Merge 3.10-rc6 into tty-next
We want the changes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/mmu_context.h | 2 | ||||
-rw-r--r-- | arch/mips/include/uapi/asm/kvm.h | 81 | ||||
-rw-r--r-- | arch/mips/kernel/ftrace.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/idle.c | 13 | ||||
-rw-r--r-- | arch/mips/kvm/kvm_mips.c | 83 |
5 files changed, 105 insertions, 78 deletions
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index 820116067c10..516e6e9a5594 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
@@ -117,7 +117,7 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) | |||
117 | if (! ((asid += ASID_INC) & ASID_MASK) ) { | 117 | if (! ((asid += ASID_INC) & ASID_MASK) ) { |
118 | if (cpu_has_vtag_icache) | 118 | if (cpu_has_vtag_icache) |
119 | flush_icache_all(); | 119 | flush_icache_all(); |
120 | #ifdef CONFIG_VIRTUALIZATION | 120 | #ifdef CONFIG_KVM |
121 | kvm_local_flush_tlb_all(); /* start new asid cycle */ | 121 | kvm_local_flush_tlb_all(); /* start new asid cycle */ |
122 | #else | 122 | #else |
123 | local_flush_tlb_all(); /* start new asid cycle */ | 123 | local_flush_tlb_all(); /* start new asid cycle */ |
diff --git a/arch/mips/include/uapi/asm/kvm.h b/arch/mips/include/uapi/asm/kvm.h index 3f424f5217da..f09ff5ae2059 100644 --- a/arch/mips/include/uapi/asm/kvm.h +++ b/arch/mips/include/uapi/asm/kvm.h | |||
@@ -58,56 +58,53 @@ struct kvm_fpu { | |||
58 | * bits[2..0] - Register 'sel' index. | 58 | * bits[2..0] - Register 'sel' index. |
59 | * bits[7..3] - Register 'rd' index. | 59 | * bits[7..3] - Register 'rd' index. |
60 | * bits[15..8] - Must be zero. | 60 | * bits[15..8] - Must be zero. |
61 | * bits[63..16] - 1 -> CP0 registers. | 61 | * bits[31..16] - 1 -> CP0 registers. |
62 | * bits[51..32] - Must be zero. | ||
63 | * bits[63..52] - As per linux/kvm.h | ||
62 | * | 64 | * |
63 | * Other sets registers may be added in the future. Each set would | 65 | * Other sets registers may be added in the future. Each set would |
64 | * have its own identifier in bits[63..16]. | 66 | * have its own identifier in bits[31..16]. |
65 | * | ||
66 | * The addr field of struct kvm_one_reg must point to an aligned | ||
67 | * 64-bit wide location. For registers that are narrower than | ||
68 | * 64-bits, the value is stored in the low order bits of the location, | ||
69 | * and sign extended to 64-bits. | ||
70 | * | 67 | * |
71 | * The registers defined in struct kvm_regs are also accessible, the | 68 | * The registers defined in struct kvm_regs are also accessible, the |
72 | * id values for these are below. | 69 | * id values for these are below. |
73 | */ | 70 | */ |
74 | 71 | ||
75 | #define KVM_REG_MIPS_R0 0 | 72 | #define KVM_REG_MIPS_R0 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0) |
76 | #define KVM_REG_MIPS_R1 1 | 73 | #define KVM_REG_MIPS_R1 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 1) |
77 | #define KVM_REG_MIPS_R2 2 | 74 | #define KVM_REG_MIPS_R2 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 2) |
78 | #define KVM_REG_MIPS_R3 3 | 75 | #define KVM_REG_MIPS_R3 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 3) |
79 | #define KVM_REG_MIPS_R4 4 | 76 | #define KVM_REG_MIPS_R4 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 4) |
80 | #define KVM_REG_MIPS_R5 5 | 77 | #define KVM_REG_MIPS_R5 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 5) |
81 | #define KVM_REG_MIPS_R6 6 | 78 | #define KVM_REG_MIPS_R6 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 6) |
82 | #define KVM_REG_MIPS_R7 7 | 79 | #define KVM_REG_MIPS_R7 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 7) |
83 | #define KVM_REG_MIPS_R8 8 | 80 | #define KVM_REG_MIPS_R8 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 8) |
84 | #define KVM_REG_MIPS_R9 9 | 81 | #define KVM_REG_MIPS_R9 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 9) |
85 | #define KVM_REG_MIPS_R10 10 | 82 | #define KVM_REG_MIPS_R10 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 10) |
86 | #define KVM_REG_MIPS_R11 11 | 83 | #define KVM_REG_MIPS_R11 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 11) |
87 | #define KVM_REG_MIPS_R12 12 | 84 | #define KVM_REG_MIPS_R12 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 12) |
88 | #define KVM_REG_MIPS_R13 13 | 85 | #define KVM_REG_MIPS_R13 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 13) |
89 | #define KVM_REG_MIPS_R14 14 | 86 | #define KVM_REG_MIPS_R14 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 14) |
90 | #define KVM_REG_MIPS_R15 15 | 87 | #define KVM_REG_MIPS_R15 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 15) |
91 | #define KVM_REG_MIPS_R16 16 | 88 | #define KVM_REG_MIPS_R16 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 16) |
92 | #define KVM_REG_MIPS_R17 17 | 89 | #define KVM_REG_MIPS_R17 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 17) |
93 | #define KVM_REG_MIPS_R18 18 | 90 | #define KVM_REG_MIPS_R18 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 18) |
94 | #define KVM_REG_MIPS_R19 19 | 91 | #define KVM_REG_MIPS_R19 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 19) |
95 | #define KVM_REG_MIPS_R20 20 | 92 | #define KVM_REG_MIPS_R20 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 20) |
96 | #define KVM_REG_MIPS_R21 21 | 93 | #define KVM_REG_MIPS_R21 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 21) |
97 | #define KVM_REG_MIPS_R22 22 | 94 | #define KVM_REG_MIPS_R22 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 22) |
98 | #define KVM_REG_MIPS_R23 23 | 95 | #define KVM_REG_MIPS_R23 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 23) |
99 | #define KVM_REG_MIPS_R24 24 | 96 | #define KVM_REG_MIPS_R24 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 24) |
100 | #define KVM_REG_MIPS_R25 25 | 97 | #define KVM_REG_MIPS_R25 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 25) |
101 | #define KVM_REG_MIPS_R26 26 | 98 | #define KVM_REG_MIPS_R26 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 26) |
102 | #define KVM_REG_MIPS_R27 27 | 99 | #define KVM_REG_MIPS_R27 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 27) |
103 | #define KVM_REG_MIPS_R28 28 | 100 | #define KVM_REG_MIPS_R28 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 28) |
104 | #define KVM_REG_MIPS_R29 29 | 101 | #define KVM_REG_MIPS_R29 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 29) |
105 | #define KVM_REG_MIPS_R30 30 | 102 | #define KVM_REG_MIPS_R30 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 30) |
106 | #define KVM_REG_MIPS_R31 31 | 103 | #define KVM_REG_MIPS_R31 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 31) |
107 | 104 | ||
108 | #define KVM_REG_MIPS_HI 32 | 105 | #define KVM_REG_MIPS_HI (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 32) |
109 | #define KVM_REG_MIPS_LO 33 | 106 | #define KVM_REG_MIPS_LO (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 33) |
110 | #define KVM_REG_MIPS_PC 34 | 107 | #define KVM_REG_MIPS_PC (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 34) |
111 | 108 | ||
112 | /* | 109 | /* |
113 | * KVM MIPS specific structures and definitions | 110 | * KVM MIPS specific structures and definitions |
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index cf5509f13dd5..dba90ec0dc38 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c | |||
@@ -25,12 +25,16 @@ | |||
25 | #define MCOUNT_OFFSET_INSNS 4 | 25 | #define MCOUNT_OFFSET_INSNS 4 |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
29 | |||
28 | /* Arch override because MIPS doesn't need to run this from stop_machine() */ | 30 | /* Arch override because MIPS doesn't need to run this from stop_machine() */ |
29 | void arch_ftrace_update_code(int command) | 31 | void arch_ftrace_update_code(int command) |
30 | { | 32 | { |
31 | ftrace_modify_all_code(command); | 33 | ftrace_modify_all_code(command); |
32 | } | 34 | } |
33 | 35 | ||
36 | #endif | ||
37 | |||
34 | /* | 38 | /* |
35 | * Check if the address is in kernel space | 39 | * Check if the address is in kernel space |
36 | * | 40 | * |
diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c index 3b09b888afa9..0c655deeea4a 100644 --- a/arch/mips/kernel/idle.c +++ b/arch/mips/kernel/idle.c | |||
@@ -93,26 +93,27 @@ static void rm7k_wait_irqoff(void) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * The Au1xxx wait is available only if using 32khz counter or | 96 | * Au1 'wait' is only useful when the 32kHz counter is used as timer, |
97 | * external timer source, but specifically not CP0 Counter. | 97 | * since coreclock (and the cp0 counter) stops upon executing it. Only an |
98 | * alchemy/common/time.c may override cpu_wait! | 98 | * interrupt can wake it, so they must be enabled before entering idle modes. |
99 | */ | 99 | */ |
100 | static void au1k_wait(void) | 100 | static void au1k_wait(void) |
101 | { | 101 | { |
102 | unsigned long c0status = read_c0_status() | 1; /* irqs on */ | ||
103 | |||
102 | __asm__( | 104 | __asm__( |
103 | " .set mips3 \n" | 105 | " .set mips3 \n" |
104 | " cache 0x14, 0(%0) \n" | 106 | " cache 0x14, 0(%0) \n" |
105 | " cache 0x14, 32(%0) \n" | 107 | " cache 0x14, 32(%0) \n" |
106 | " sync \n" | 108 | " sync \n" |
107 | " nop \n" | 109 | " mtc0 %1, $12 \n" /* wr c0status */ |
108 | " wait \n" | 110 | " wait \n" |
109 | " nop \n" | 111 | " nop \n" |
110 | " nop \n" | 112 | " nop \n" |
111 | " nop \n" | 113 | " nop \n" |
112 | " nop \n" | 114 | " nop \n" |
113 | " .set mips0 \n" | 115 | " .set mips0 \n" |
114 | : : "r" (au1k_wait)); | 116 | : : "r" (au1k_wait), "r" (c0status)); |
115 | local_irq_enable(); | ||
116 | } | 117 | } |
117 | 118 | ||
118 | static int __initdata nowait; | 119 | static int __initdata nowait; |
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index d934b017f479..dd203e59e6fd 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
@@ -485,29 +485,35 @@ kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | |||
485 | return -ENOIOCTLCMD; | 485 | return -ENOIOCTLCMD; |
486 | } | 486 | } |
487 | 487 | ||
488 | #define KVM_REG_MIPS_CP0_INDEX (0x10000 + 8 * 0 + 0) | 488 | #define MIPS_CP0_32(_R, _S) \ |
489 | #define KVM_REG_MIPS_CP0_ENTRYLO0 (0x10000 + 8 * 2 + 0) | 489 | (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S))) |
490 | #define KVM_REG_MIPS_CP0_ENTRYLO1 (0x10000 + 8 * 3 + 0) | 490 | |
491 | #define KVM_REG_MIPS_CP0_CONTEXT (0x10000 + 8 * 4 + 0) | 491 | #define MIPS_CP0_64(_R, _S) \ |
492 | #define KVM_REG_MIPS_CP0_USERLOCAL (0x10000 + 8 * 4 + 2) | 492 | (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S))) |
493 | #define KVM_REG_MIPS_CP0_PAGEMASK (0x10000 + 8 * 5 + 0) | 493 | |
494 | #define KVM_REG_MIPS_CP0_PAGEGRAIN (0x10000 + 8 * 5 + 1) | 494 | #define KVM_REG_MIPS_CP0_INDEX MIPS_CP0_32(0, 0) |
495 | #define KVM_REG_MIPS_CP0_WIRED (0x10000 + 8 * 6 + 0) | 495 | #define KVM_REG_MIPS_CP0_ENTRYLO0 MIPS_CP0_64(2, 0) |
496 | #define KVM_REG_MIPS_CP0_HWRENA (0x10000 + 8 * 7 + 0) | 496 | #define KVM_REG_MIPS_CP0_ENTRYLO1 MIPS_CP0_64(3, 0) |
497 | #define KVM_REG_MIPS_CP0_BADVADDR (0x10000 + 8 * 8 + 0) | 497 | #define KVM_REG_MIPS_CP0_CONTEXT MIPS_CP0_64(4, 0) |
498 | #define KVM_REG_MIPS_CP0_COUNT (0x10000 + 8 * 9 + 0) | 498 | #define KVM_REG_MIPS_CP0_USERLOCAL MIPS_CP0_64(4, 2) |
499 | #define KVM_REG_MIPS_CP0_ENTRYHI (0x10000 + 8 * 10 + 0) | 499 | #define KVM_REG_MIPS_CP0_PAGEMASK MIPS_CP0_32(5, 0) |
500 | #define KVM_REG_MIPS_CP0_COMPARE (0x10000 + 8 * 11 + 0) | 500 | #define KVM_REG_MIPS_CP0_PAGEGRAIN MIPS_CP0_32(5, 1) |
501 | #define KVM_REG_MIPS_CP0_STATUS (0x10000 + 8 * 12 + 0) | 501 | #define KVM_REG_MIPS_CP0_WIRED MIPS_CP0_32(6, 0) |
502 | #define KVM_REG_MIPS_CP0_CAUSE (0x10000 + 8 * 13 + 0) | 502 | #define KVM_REG_MIPS_CP0_HWRENA MIPS_CP0_32(7, 0) |
503 | #define KVM_REG_MIPS_CP0_EBASE (0x10000 + 8 * 15 + 1) | 503 | #define KVM_REG_MIPS_CP0_BADVADDR MIPS_CP0_64(8, 0) |
504 | #define KVM_REG_MIPS_CP0_CONFIG (0x10000 + 8 * 16 + 0) | 504 | #define KVM_REG_MIPS_CP0_COUNT MIPS_CP0_32(9, 0) |
505 | #define KVM_REG_MIPS_CP0_CONFIG1 (0x10000 + 8 * 16 + 1) | 505 | #define KVM_REG_MIPS_CP0_ENTRYHI MIPS_CP0_64(10, 0) |
506 | #define KVM_REG_MIPS_CP0_CONFIG2 (0x10000 + 8 * 16 + 2) | 506 | #define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0) |
507 | #define KVM_REG_MIPS_CP0_CONFIG3 (0x10000 + 8 * 16 + 3) | 507 | #define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0) |
508 | #define KVM_REG_MIPS_CP0_CONFIG7 (0x10000 + 8 * 16 + 7) | 508 | #define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0) |
509 | #define KVM_REG_MIPS_CP0_XCONTEXT (0x10000 + 8 * 20 + 0) | 509 | #define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_64(15, 1) |
510 | #define KVM_REG_MIPS_CP0_ERROREPC (0x10000 + 8 * 30 + 0) | 510 | #define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0) |
511 | #define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1) | ||
512 | #define KVM_REG_MIPS_CP0_CONFIG2 MIPS_CP0_32(16, 2) | ||
513 | #define KVM_REG_MIPS_CP0_CONFIG3 MIPS_CP0_32(16, 3) | ||
514 | #define KVM_REG_MIPS_CP0_CONFIG7 MIPS_CP0_32(16, 7) | ||
515 | #define KVM_REG_MIPS_CP0_XCONTEXT MIPS_CP0_64(20, 0) | ||
516 | #define KVM_REG_MIPS_CP0_ERROREPC MIPS_CP0_64(30, 0) | ||
511 | 517 | ||
512 | static u64 kvm_mips_get_one_regs[] = { | 518 | static u64 kvm_mips_get_one_regs[] = { |
513 | KVM_REG_MIPS_R0, | 519 | KVM_REG_MIPS_R0, |
@@ -567,8 +573,6 @@ static u64 kvm_mips_get_one_regs[] = { | |||
567 | static int kvm_mips_get_reg(struct kvm_vcpu *vcpu, | 573 | static int kvm_mips_get_reg(struct kvm_vcpu *vcpu, |
568 | const struct kvm_one_reg *reg) | 574 | const struct kvm_one_reg *reg) |
569 | { | 575 | { |
570 | u64 __user *uaddr = (u64 __user *)(long)reg->addr; | ||
571 | |||
572 | struct mips_coproc *cop0 = vcpu->arch.cop0; | 576 | struct mips_coproc *cop0 = vcpu->arch.cop0; |
573 | s64 v; | 577 | s64 v; |
574 | 578 | ||
@@ -631,18 +635,39 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu, | |||
631 | default: | 635 | default: |
632 | return -EINVAL; | 636 | return -EINVAL; |
633 | } | 637 | } |
634 | return put_user(v, uaddr); | 638 | if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64) { |
639 | u64 __user *uaddr64 = (u64 __user *)(long)reg->addr; | ||
640 | return put_user(v, uaddr64); | ||
641 | } else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32) { | ||
642 | u32 __user *uaddr32 = (u32 __user *)(long)reg->addr; | ||
643 | u32 v32 = (u32)v; | ||
644 | return put_user(v32, uaddr32); | ||
645 | } else { | ||
646 | return -EINVAL; | ||
647 | } | ||
635 | } | 648 | } |
636 | 649 | ||
637 | static int kvm_mips_set_reg(struct kvm_vcpu *vcpu, | 650 | static int kvm_mips_set_reg(struct kvm_vcpu *vcpu, |
638 | const struct kvm_one_reg *reg) | 651 | const struct kvm_one_reg *reg) |
639 | { | 652 | { |
640 | u64 __user *uaddr = (u64 __user *)(long)reg->addr; | ||
641 | struct mips_coproc *cop0 = vcpu->arch.cop0; | 653 | struct mips_coproc *cop0 = vcpu->arch.cop0; |
642 | u64 v; | 654 | u64 v; |
643 | 655 | ||
644 | if (get_user(v, uaddr) != 0) | 656 | if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64) { |
645 | return -EFAULT; | 657 | u64 __user *uaddr64 = (u64 __user *)(long)reg->addr; |
658 | |||
659 | if (get_user(v, uaddr64) != 0) | ||
660 | return -EFAULT; | ||
661 | } else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32) { | ||
662 | u32 __user *uaddr32 = (u32 __user *)(long)reg->addr; | ||
663 | s32 v32; | ||
664 | |||
665 | if (get_user(v32, uaddr32) != 0) | ||
666 | return -EFAULT; | ||
667 | v = (s64)v32; | ||
668 | } else { | ||
669 | return -EINVAL; | ||
670 | } | ||
646 | 671 | ||
647 | switch (reg->id) { | 672 | switch (reg->id) { |
648 | case KVM_REG_MIPS_R0: | 673 | case KVM_REG_MIPS_R0: |