diff options
| -rw-r--r-- | arch/powerpc/include/asm/kvm_book3s_64.h | 19 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/ppc_asm.h | 2 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_hv_rm_mmu.c | 7 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_interrupts.S | 4 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_rmhandlers.S | 6 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_rtas.c | 65 | ||||
| -rw-r--r-- | arch/powerpc/kvm/e500_mmu_host.c | 3 |
9 files changed, 52 insertions, 58 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index fddb72b48ce9..d645428a65a4 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
| @@ -198,8 +198,10 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | |||
| 198 | return rb; | 198 | return rb; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | 201 | static inline unsigned long __hpte_page_size(unsigned long h, unsigned long l, |
| 202 | bool is_base_size) | ||
| 202 | { | 203 | { |
| 204 | |||
| 203 | int size, a_psize; | 205 | int size, a_psize; |
| 204 | /* Look at the 8 bit LP value */ | 206 | /* Look at the 8 bit LP value */ |
| 205 | unsigned int lp = (l >> LP_SHIFT) & ((1 << LP_BITS) - 1); | 207 | unsigned int lp = (l >> LP_SHIFT) & ((1 << LP_BITS) - 1); |
| @@ -214,14 +216,27 @@ static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | |||
| 214 | continue; | 216 | continue; |
| 215 | 217 | ||
| 216 | a_psize = __hpte_actual_psize(lp, size); | 218 | a_psize = __hpte_actual_psize(lp, size); |
| 217 | if (a_psize != -1) | 219 | if (a_psize != -1) { |
| 220 | if (is_base_size) | ||
| 221 | return 1ul << mmu_psize_defs[size].shift; | ||
| 218 | return 1ul << mmu_psize_defs[a_psize].shift; | 222 | return 1ul << mmu_psize_defs[a_psize].shift; |
| 223 | } | ||
| 219 | } | 224 | } |
| 220 | 225 | ||
| 221 | } | 226 | } |
| 222 | return 0; | 227 | return 0; |
| 223 | } | 228 | } |
| 224 | 229 | ||
| 230 | static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | ||
| 231 | { | ||
| 232 | return __hpte_page_size(h, l, 0); | ||
| 233 | } | ||
| 234 | |||
| 235 | static inline unsigned long hpte_base_page_size(unsigned long h, unsigned long l) | ||
| 236 | { | ||
| 237 | return __hpte_page_size(h, l, 1); | ||
| 238 | } | ||
| 239 | |||
| 225 | static inline unsigned long hpte_rpn(unsigned long ptel, unsigned long psize) | 240 | static inline unsigned long hpte_rpn(unsigned long ptel, unsigned long psize) |
| 226 | { | 241 | { |
| 227 | return ((ptel & HPTE_R_RPN) & ~(psize - 1)) >> PAGE_SHIFT; | 242 | return ((ptel & HPTE_R_RPN) & ~(psize - 1)) >> PAGE_SHIFT; |
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 9ea266eae33e..7e4612528546 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
| @@ -277,6 +277,8 @@ n: | |||
| 277 | .globl n; \ | 277 | .globl n; \ |
| 278 | n: | 278 | n: |
| 279 | 279 | ||
| 280 | #define _GLOBAL_TOC(name) _GLOBAL(name) | ||
| 281 | |||
| 280 | #define _KPROBE(n) \ | 282 | #define _KPROBE(n) \ |
| 281 | .section ".kprobes.text","a"; \ | 283 | .section ".kprobes.text","a"; \ |
| 282 | .globl n; \ | 284 | .globl n; \ |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 80561074078d..68468d695f12 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
| @@ -1562,7 +1562,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf, | |||
| 1562 | goto out; | 1562 | goto out; |
| 1563 | } | 1563 | } |
| 1564 | if (!rma_setup && is_vrma_hpte(v)) { | 1564 | if (!rma_setup && is_vrma_hpte(v)) { |
| 1565 | unsigned long psize = hpte_page_size(v, r); | 1565 | unsigned long psize = hpte_base_page_size(v, r); |
| 1566 | unsigned long senc = slb_pgsize_encoding(psize); | 1566 | unsigned long senc = slb_pgsize_encoding(psize); |
| 1567 | unsigned long lpcr; | 1567 | unsigned long lpcr; |
| 1568 | 1568 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index 6e6224318c36..5a24d3c2b6b8 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c | |||
| @@ -814,13 +814,10 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v, | |||
| 814 | r = hpte[i+1]; | 814 | r = hpte[i+1]; |
| 815 | 815 | ||
| 816 | /* | 816 | /* |
| 817 | * Check the HPTE again, including large page size | 817 | * Check the HPTE again, including base page size |
| 818 | * Since we don't currently allow any MPSS (mixed | ||
| 819 | * page-size segment) page sizes, it is sufficient | ||
| 820 | * to check against the actual page size. | ||
| 821 | */ | 818 | */ |
| 822 | if ((v & valid) && (v & mask) == val && | 819 | if ((v & valid) && (v & mask) == val && |
| 823 | hpte_page_size(v, r) == (1ul << pshift)) | 820 | hpte_base_page_size(v, r) == (1ul << pshift)) |
| 824 | /* Return with the HPTE still locked */ | 821 | /* Return with the HPTE still locked */ |
| 825 | return (hash << 3) + (i >> 1); | 822 | return (hash << 3) + (i >> 1); |
| 826 | 823 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 868347ef09fd..558a67df8126 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | * | 48 | * |
| 49 | * LR = return address to continue at after eventually re-enabling MMU | 49 | * LR = return address to continue at after eventually re-enabling MMU |
| 50 | */ | 50 | */ |
| 51 | _GLOBAL(kvmppc_hv_entry_trampoline) | 51 | _GLOBAL_TOC(kvmppc_hv_entry_trampoline) |
| 52 | mflr r0 | 52 | mflr r0 |
| 53 | std r0, PPC_LR_STKOFF(r1) | 53 | std r0, PPC_LR_STKOFF(r1) |
| 54 | stdu r1, -112(r1) | 54 | stdu r1, -112(r1) |
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S index e2c29e381dc7..d044b8b7c69d 100644 --- a/arch/powerpc/kvm/book3s_interrupts.S +++ b/arch/powerpc/kvm/book3s_interrupts.S | |||
| @@ -25,7 +25,11 @@ | |||
| 25 | #include <asm/exception-64s.h> | 25 | #include <asm/exception-64s.h> |
| 26 | 26 | ||
| 27 | #if defined(CONFIG_PPC_BOOK3S_64) | 27 | #if defined(CONFIG_PPC_BOOK3S_64) |
| 28 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
| 29 | #define FUNC(name) name | ||
| 30 | #else | ||
| 28 | #define FUNC(name) GLUE(.,name) | 31 | #define FUNC(name) GLUE(.,name) |
| 32 | #endif | ||
| 29 | #define GET_SHADOW_VCPU(reg) addi reg, r13, PACA_SVCPU | 33 | #define GET_SHADOW_VCPU(reg) addi reg, r13, PACA_SVCPU |
| 30 | 34 | ||
| 31 | #elif defined(CONFIG_PPC_BOOK3S_32) | 35 | #elif defined(CONFIG_PPC_BOOK3S_32) |
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S index 9eec675220e6..16c4d88ba27d 100644 --- a/arch/powerpc/kvm/book3s_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_rmhandlers.S | |||
| @@ -36,7 +36,11 @@ | |||
| 36 | 36 | ||
| 37 | #if defined(CONFIG_PPC_BOOK3S_64) | 37 | #if defined(CONFIG_PPC_BOOK3S_64) |
| 38 | 38 | ||
| 39 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
| 40 | #define FUNC(name) name | ||
| 41 | #else | ||
| 39 | #define FUNC(name) GLUE(.,name) | 42 | #define FUNC(name) GLUE(.,name) |
| 43 | #endif | ||
| 40 | 44 | ||
| 41 | #elif defined(CONFIG_PPC_BOOK3S_32) | 45 | #elif defined(CONFIG_PPC_BOOK3S_32) |
| 42 | 46 | ||
| @@ -146,7 +150,7 @@ kvmppc_handler_skip_ins: | |||
| 146 | * On entry, r4 contains the guest shadow MSR | 150 | * On entry, r4 contains the guest shadow MSR |
| 147 | * MSR.EE has to be 0 when calling this function | 151 | * MSR.EE has to be 0 when calling this function |
| 148 | */ | 152 | */ |
| 149 | _GLOBAL(kvmppc_entry_trampoline) | 153 | _GLOBAL_TOC(kvmppc_entry_trampoline) |
| 150 | mfmsr r5 | 154 | mfmsr r5 |
| 151 | LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) | 155 | LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) |
| 152 | toreal(r7) | 156 | toreal(r7) |
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c index edb14ba992b3..ef27fbd5d9c5 100644 --- a/arch/powerpc/kvm/book3s_rtas.c +++ b/arch/powerpc/kvm/book3s_rtas.c | |||
| @@ -23,20 +23,20 @@ static void kvm_rtas_set_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
| 23 | u32 irq, server, priority; | 23 | u32 irq, server, priority; |
| 24 | int rc; | 24 | int rc; |
| 25 | 25 | ||
| 26 | if (args->nargs != 3 || args->nret != 1) { | 26 | if (be32_to_cpu(args->nargs) != 3 || be32_to_cpu(args->nret) != 1) { |
| 27 | rc = -3; | 27 | rc = -3; |
| 28 | goto out; | 28 | goto out; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | irq = args->args[0]; | 31 | irq = be32_to_cpu(args->args[0]); |
| 32 | server = args->args[1]; | 32 | server = be32_to_cpu(args->args[1]); |
| 33 | priority = args->args[2]; | ||
