diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2016-09-29 10:19:29 -0400 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2016-09-29 10:19:29 -0400 |
commit | 40a6d2208481b1d57c80b33110dbf78f271be5a6 (patch) | |
tree | 0ff66109e16049c1b328bcae31995750085a3cda | |
parent | 45ca877ad0519a02c22aaff2e2cdf333a1421a0a (diff) | |
parent | fa73c3b25bd8d0d393dc6109a1dba3c2aef0451e (diff) |
Merge branch 'kvm-ppc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into next
PPC KVM updates for 4.9.
- Fix for the bug that Thomas Huth found which caused guests to falsely
report soft lockups,
- other minor fixes from Thomas Huth and Dan Carpenter,
- and a small optimization from Balbir Singh.
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s_64.h | 3 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 6 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_emulate.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_hv.c | 132 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 14 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_pr.c | 10 | ||||
-rw-r--r-- | arch/powerpc/kvm/booke.c | 2 |
11 files changed, 34 insertions, 143 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index cef2b892245c..5cf306ae0ac3 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -101,6 +101,7 @@ struct kvmppc_vcore { | |||
101 | u32 arch_compat; | 101 | u32 arch_compat; |
102 | ulong pcr; | 102 | ulong pcr; |
103 | ulong dpdes; /* doorbell state (POWER8) */ | 103 | ulong dpdes; /* doorbell state (POWER8) */ |
104 | ulong vtb; /* virtual timebase */ | ||
104 | ulong conferring_threads; | 105 | ulong conferring_threads; |
105 | unsigned int halt_poll_ns; | 106 | unsigned int halt_poll_ns; |
106 | }; | 107 | }; |
@@ -119,6 +120,7 @@ struct kvmppc_vcpu_book3s { | |||
119 | u64 sdr1; | 120 | u64 sdr1; |
120 | u64 hior; | 121 | u64 hior; |
121 | u64 msr_mask; | 122 | u64 msr_mask; |
123 | u64 vtb; | ||
122 | #ifdef CONFIG_PPC_BOOK3S_32 | 124 | #ifdef CONFIG_PPC_BOOK3S_32 |
123 | u32 vsid_pool[VSID_POOL_SIZE]; | 125 | u32 vsid_pool[VSID_POOL_SIZE]; |
124 | u32 vsid_next; | 126 | u32 vsid_next; |
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 4ffd5a1e788d..848292176908 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
@@ -125,7 +125,6 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | |||
125 | /* This covers 14..54 bits of va*/ | 125 | /* This covers 14..54 bits of va*/ |
126 | rb = (v & ~0x7fUL) << 16; /* AVA field */ | 126 | rb = (v & ~0x7fUL) << 16; /* AVA field */ |
127 | 127 | ||
128 | rb |= (v >> HPTE_V_SSIZE_SHIFT) << 8; /* B field */ | ||
129 | /* | 128 | /* |
130 | * AVA in v had cleared lower 23 bits. We need to derive | 129 | * AVA in v had cleared lower 23 bits. We need to derive |
131 | * that from pteg index | 130 | * that from pteg index |
@@ -177,7 +176,7 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | |||
177 | break; | 176 | break; |
178 | } | 177 | } |
179 | } | 178 | } |
180 | rb |= (v >> 54) & 0x300; /* B field */ | 179 | rb |= (v >> HPTE_V_SSIZE_SHIFT) << 8; /* B field */ |
181 | return rb; | 180 | return rb; |
182 | } | 181 | } |
183 | 182 | ||
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index ed30d2ea21b7..28350a294b1e 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -475,7 +475,6 @@ struct kvm_vcpu_arch { | |||
475 | ulong purr; | 475 | ulong purr; |
476 | ulong spurr; | 476 | ulong spurr; |
477 | ulong ic; | 477 | ulong ic; |
478 | ulong vtb; | ||
479 | ulong dscr; | 478 | ulong dscr; |
480 | ulong amr; | 479 | ulong amr; |
481 | ulong uamor; | 480 | ulong uamor; |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index f69f40f1519a..978dada662ae 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -737,6 +737,7 @@ | |||
737 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ | 737 | #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ |
738 | #define SPRN_MMCR1 798 | 738 | #define SPRN_MMCR1 798 |
739 | #define SPRN_MMCR2 785 | 739 | #define SPRN_MMCR2 785 |
740 | #define SPRN_UMMCR2 769 | ||
740 | #define SPRN_MMCRA 0x312 | 741 | #define SPRN_MMCRA 0x312 |
741 | #define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ | 742 | #define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ |
742 | #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL | 743 | #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index b89d14c0352c..a51ae9b165e0 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -506,7 +506,6 @@ int main(void) | |||
506 | DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); | 506 | DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); |
507 | DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr)); | 507 | DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr)); |
508 | DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic)); | 508 | DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic)); |
509 | DEFINE(VCPU_VTB, offsetof(struct kvm_vcpu, arch.vtb)); | ||
510 | DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr)); | 509 | DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr)); |
511 | DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr)); | 510 | DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr)); |
512 | DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor)); | 511 | DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor)); |
@@ -557,6 +556,7 @@ int main(void) | |||
557 | DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr)); | 556 | DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr)); |
558 | DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr)); | 557 | DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr)); |
559 | DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes)); | 558 | DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes)); |
559 | DEFINE(VCORE_VTB, offsetof(struct kvmppc_vcore, vtb)); | ||
560 | DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige)); | 560 | DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige)); |
561 | DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv)); | 561 | DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv)); |
562 | DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb)); | 562 | DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb)); |
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index ba231a1d43d4..b6952dd23152 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -599,9 +599,6 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id, | |||
599 | case KVM_REG_PPC_BESCR: | 599 | case KVM_REG_PPC_BESCR: |
600 | *val = get_reg_val(id, vcpu->arch.bescr); | 600 | *val = get_reg_val(id, vcpu->arch.bescr); |
601 | break; | 601 | break; |
602 | case KVM_REG_PPC_VTB: | ||
603 | *val = get_reg_val(id, vcpu->arch.vtb); | ||
604 | break; | ||
605 | case KVM_REG_PPC_IC: | 602 | case KVM_REG_PPC_IC: |
606 | *val = get_reg_val(id, vcpu->arch.ic); | 603 | *val = get_reg_val(id, vcpu->arch.ic); |
607 | break; | 604 | break; |
@@ -673,9 +670,6 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, | |||
673 | case KVM_REG_PPC_BESCR: | 670 | case KVM_REG_PPC_BESCR: |
674 | vcpu->arch.bescr = set_reg_val(id, *val); | 671 | vcpu->arch.bescr = set_reg_val(id, *val); |
675 | break; | 672 | break; |
676 | case KVM_REG_PPC_VTB: | ||
677 | vcpu->arch.vtb = set_reg_val(id, *val); | ||
678 | break; | ||
679 | case KVM_REG_PPC_IC: | 673 | case KVM_REG_PPC_IC: |
680 | vcpu->arch.ic = set_reg_val(id, *val); | 674 | vcpu->arch.ic = set_reg_val(id, *val); |
681 | break; | 675 | break; |
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c index 2afdb9c0937d..8359752b3efc 100644 --- a/arch/powerpc/kvm/book3s_emulate.c +++ b/arch/powerpc/kvm/book3s_emulate.c | |||
@@ -498,6 +498,7 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val) | |||
498 | case SPRN_MMCR0: | 498 | case SPRN_MMCR0: |
499 | case SPRN_MMCR1: | 499 | case SPRN_MMCR1: |
500 | case SPRN_MMCR2: | 500 | case SPRN_MMCR2: |
501 | case SPRN_UMMCR2: | ||
501 | #endif | 502 | #endif |
502 | break; | 503 | break; |
503 | unprivileged: | 504 | unprivileged: |
@@ -579,7 +580,7 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val | |||
579 | *spr_val = vcpu->arch.spurr; | 580 | *spr_val = vcpu->arch.spurr; |
580 | break; | 581 | break; |
581 | case SPRN_VTB: | 582 | case SPRN_VTB: |
582 | *spr_val = vcpu->arch.vtb; | 583 | *spr_val = to_book3s(vcpu)->vtb; |
583 | break; | 584 | break; |
584 | case SPRN_IC: | 585 | case SPRN_IC: |
585 | *spr_val = vcpu->arch.ic; | 586 | *spr_val = vcpu->arch.ic; |
@@ -640,6 +641,7 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val | |||
640 | case SPRN_MMCR0: | 641 | case SPRN_MMCR0: |
641 | case SPRN_MMCR1: | 642 | case SPRN_MMCR1: |
642 | case SPRN_MMCR2: | 643 | case SPRN_MMCR2: |
644 | case SPRN_UMMCR2: | ||
643 | case SPRN_TIR: | 645 | case SPRN_TIR: |
644 | #endif | 646 | #endif |
645 | *spr_val = 0; | 647 | *spr_val = 0; |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 9b3bba643b43..3686471be32b 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -1199,6 +1199,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, | |||
1199 | case KVM_REG_PPC_DPDES: | 1199 | case KVM_REG_PPC_DPDES: |
1200 | *val = get_reg_val(id, vcpu->arch.vcore->dpdes); | 1200 | *val = get_reg_val(id, vcpu->arch.vcore->dpdes); |
1201 | break; | 1201 | break; |
1202 | case KVM_REG_PPC_VTB: | ||
1203 | *val = get_reg_val(id, vcpu->arch.vcore->vtb); | ||
1204 | break; | ||
1202 | case KVM_REG_PPC_DAWR: | 1205 | case KVM_REG_PPC_DAWR: |
1203 | *val = get_reg_val(id, vcpu->arch.dawr); | 1206 | *val = get_reg_val(id, vcpu->arch.dawr); |
1204 | break; | 1207 | break; |
@@ -1391,6 +1394,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, | |||
1391 | case KVM_REG_PPC_DPDES: | 1394 | case KVM_REG_PPC_DPDES: |
1392 | vcpu->arch.vcore->dpdes = set_reg_val(id, *val); | 1395 | vcpu->arch.vcore->dpdes = set_reg_val(id, *val); |
1393 | break; | 1396 | break; |
1397 | case KVM_REG_PPC_VTB: | ||
1398 | vcpu->arch.vcore->vtb = set_reg_val(id, *val); | ||
1399 | break; | ||
1394 | case KVM_REG_PPC_DAWR: | 1400 | case KVM_REG_PPC_DAWR: |
1395 | vcpu->arch.dawr = set_reg_val(id, *val); | 1401 | vcpu->arch.dawr = set_reg_val(id, *val); |
1396 | break; | 1402 | break; |
@@ -2097,66 +2103,6 @@ static void init_master_vcore(struct kvmppc_vcore *vc) | |||
2097 | vc->conferring_threads = 0; | 2103 | vc->conferring_threads = 0; |
2098 | } | 2104 | } |
2099 | 2105 | ||
2100 | /* | ||
2101 | * See if the existing subcores can be split into 3 (or fewer) subcores | ||
2102 | * of at most two threads each, so we can fit in another vcore. This | ||
2103 | * assumes there are at most two subcores and at most 6 threads in total. | ||
2104 | */ | ||
2105 | static bool can_split_piggybacked_subcores(struct core_info *cip) | ||
2106 | { | ||
2107 | int sub, new_sub; | ||
2108 | int large_sub = -1; | ||
2109 | int thr; | ||
2110 | int n_subcores = cip->n_subcores; | ||
2111 | struct kvmppc_vcore *vc, *vcnext; | ||
2112 | struct kvmppc_vcore *master_vc = NULL; | ||
2113 | |||
2114 | for (sub = 0; sub < cip->n_subcores; ++sub) { | ||
2115 | if (cip->subcore_threads[sub] <= 2) | ||
2116 | continue; | ||
2117 | if (large_sub >= 0) | ||
2118 | return false; | ||
2119 | large_sub = sub; | ||
2120 | vc = list_first_entry(&cip->vcs[sub], struct kvmppc_vcore, | ||
2121 | preempt_list); | ||
2122 | if (vc->num_threads > 2) | ||
2123 | return false; | ||
2124 | n_subcores += (cip->subcore_threads[sub] - 1) >> 1; | ||
2125 | } | ||
2126 | if (large_sub < 0 || !subcore_config_ok(n_subcores + 1, 2)) | ||
2127 | return false; | ||
2128 | |||
2129 | /* | ||
2130 | * Seems feasible, so go through and move vcores to new subcores. | ||
2131 | * Note that when we have two or more vcores in one subcore, | ||
2132 | * all those vcores must have only one thread each. | ||
2133 | */ | ||
2134 | new_sub = cip->n_subcores; | ||
2135 | thr = 0; | ||
2136 | sub = large_sub; | ||
2137 | list_for_each_entry_safe(vc, vcnext, &cip->vcs[sub], preempt_list) { | ||
2138 | if (thr >= 2) { | ||
2139 | list_del(&vc->preempt_list); | ||
2140 | list_add_tail(&vc->preempt_list, &cip->vcs[new_sub]); | ||
2141 | /* vc->num_threads must be 1 */ | ||
2142 | if (++cip->subcore_threads[new_sub] == 1) { | ||
2143 | cip->subcore_vm[new_sub] = vc->kvm; | ||
2144 | init_master_vcore(vc); | ||
2145 | master_vc = vc; | ||
2146 | ++cip->n_subcores; | ||
2147 | } else { | ||
2148 | vc->master_vcore = master_vc; | ||
2149 | ++new_sub; | ||
2150 | } | ||
2151 | } | ||
2152 | thr += vc->num_threads; | ||
2153 | } | ||
2154 | cip->subcore_threads[large_sub] = 2; | ||
2155 | cip->max_subcore_threads = 2; | ||
2156 | |||
2157 | return true; | ||
2158 | } | ||
2159 | |||
2160 | static bool can_dynamic_split(struct kvmppc_vcore *vc, struct core_info *cip) | 2106 | static bool can_dynamic_split(struct kvmppc_vcore *vc, struct core_info *cip) |
2161 | { | 2107 | { |
2162 | int n_threads = vc->num_threads; | 2108 | int n_threads = vc->num_threads; |
@@ -2167,23 +2113,9 @@ static bool can_dynamic_split(struct kvmppc_vcore *vc, struct core_info *cip) | |||
2167 | 2113 | ||
2168 | if (n_threads < cip->max_subcore_threads) | 2114 | if (n_threads < cip->max_subcore_threads) |
2169 | n_threads = cip->max_subcore_threads; | 2115 | n_threads = cip->max_subcore_threads; |
2170 | if (subcore_config_ok(cip->n_subcores + 1, n_threads)) { | 2116 | if (!subcore_config_ok(cip->n_subcores + 1, n_threads)) |
2171 | cip->max_subcore_threads = n_threads; | ||
2172 | } else if (cip->n_subcores <= 2 && cip->total_threads <= 6 && | ||
2173 | vc->num_threads <= 2) { | ||
2174 | /* | ||
2175 | * We may be able to fit another subcore in by | ||
2176 | * splitting an existing subcore with 3 or 4 | ||
2177 | * threads into two 2-thread subcores, or one | ||
2178 | * with 5 or 6 threads into three subcores. | ||
2179 | * We can only do this if those subcores have | ||
2180 | * piggybacked virtual cores. | ||
2181 | */ | ||
2182 | if (!can_split_piggybacked_subcores(cip)) | ||
2183 | return false; | ||
2184 | } else { | ||
2185 | return false; | 2117 | return false; |
2186 | } | 2118 | cip->max_subcore_threads = n_threads; |
2187 | 2119 | ||
2188 | sub = cip->n_subcores; | 2120 | sub = cip->n_subcores; |
2189 | ++cip->n_subcores; | 2121 | ++cip->n_subcores; |
@@ -2197,43 +2129,6 @@ static bool can_dynamic_split(struct kvmppc_vcore *vc, struct core_info *cip) | |||
2197 | return true; | 2129 | return true; |
2198 | } | 2130 | } |
2199 | 2131 | ||
2200 | static bool can_piggyback_subcore(struct kvmppc_vcore *pvc, | ||
2201 | struct core_info *cip, int sub) | ||
2202 | { | ||
2203 | struct kvmppc_vcore *vc; | ||
2204 | int n_thr; | ||
2205 | |||
2206 | vc = list_first_entry(&cip->vcs[sub], struct kvmppc_vcore, | ||
2207 | preempt_list); | ||
2208 | |||
2209 | /* require same VM and same per-core reg values */ | ||
2210 | if (pvc->kvm != vc->kvm || | ||
2211 | pvc->tb_offset != vc->tb_offset || | ||
2212 | pvc->pcr != vc->pcr || | ||
2213 | pvc->lpcr != vc->lpcr) | ||
2214 | return false; | ||
2215 | |||
2216 | /* P8 guest with > 1 thread per core would see wrong TIR value */ | ||
2217 | if (cpu_has_feature(CPU_FTR_ARCH_207S) && | ||
2218 | (vc->num_threads > 1 || pvc->num_threads > 1)) | ||
2219 | return false; | ||
2220 | |||
2221 | n_thr = cip->subcore_threads[sub] + pvc->num_threads; | ||
2222 | if (n_thr > cip->max_subcore_threads) { | ||
2223 | if (!subcore_config_ok(cip->n_subcores, n_thr)) | ||
2224 | return false; | ||
2225 | cip->max_subcore_threads = n_thr; | ||
2226 | } | ||
2227 | |||
2228 | cip->total_threads += pvc->num_threads; | ||
2229 | cip->subcore_threads[sub] = n_thr; | ||
2230 | pvc->master_vcore = vc; | ||
2231 | list_del(&pvc->preempt_list); | ||
2232 | list_add_tail(&pvc->preempt_list, &cip->vcs[sub]); | ||
2233 | |||
2234 | return true; | ||
2235 | } | ||
2236 | |||
2237 | /* | 2132 | /* |
2238 | * Work out whether it is possible to piggyback the execution of | 2133 | * Work out whether it is possible to piggyback the execution of |
2239 | * vcore *pvc onto the execution of the other vcores described in *cip. | 2134 | * vcore *pvc onto the execution of the other vcores described in *cip. |
@@ -2241,19 +2136,10 @@ static bool can_piggyback_subcore(struct kvmppc_vcore *pvc, | |||
2241 | static bool can_piggyback(struct kvmppc_vcore *pvc, struct core_info *cip, | 2136 | static bool can_piggyback(struct kvmppc_vcore *pvc, struct core_info *cip, |
2242 | int target_threads) | 2137 | int target_threads) |
2243 | { | 2138 | { |
2244 | int sub; | ||
2245 | |||
2246 | if (cip->total_threads + pvc->num_threads > target_threads) | 2139 | if (cip->total_threads + pvc->num_threads > target_threads) |
2247 | return false; | 2140 | return false; |
2248 | for (sub = 0; sub < cip->n_subcores; ++sub) | ||
2249 | if (cip->subcore_threads[sub] && | ||
2250 | can_piggyback_subcore(pvc, cip, sub)) | ||
2251 | return true; | ||
2252 | 2141 | ||
2253 | if (can_dynamic_split(pvc, cip)) | 2142 | return can_dynamic_split(pvc, cip); |
2254 | return true; | ||
2255 | |||
2256 | return false; | ||
2257 | } | 2143 | } |
2258 | 2144 | ||
2259 | static void prepare_threads(struct kvmppc_vcore *vc) | 2145 | static void prepare_threads(struct kvmppc_vcore *vc) |
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 7cc924b5eea2..c3c1d1bcfc67 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -644,9 +644,11 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_207S) | |||
644 | 38: | 644 | 38: |
645 | 645 | ||
646 | BEGIN_FTR_SECTION | 646 | BEGIN_FTR_SECTION |
647 | /* DPDES is shared between threads */ | 647 | /* DPDES and VTB are shared between threads */ |
648 | ld r8, VCORE_DPDES(r5) | 648 | ld r8, VCORE_DPDES(r5) |
649 | ld r7, VCORE_VTB(r5) | ||
649 | mtspr SPRN_DPDES, r8 | 650 | mtspr SPRN_DPDES, r8 |
651 | mtspr SPRN_VTB, r7 | ||
650 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 652 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
651 | 653 | ||
652 | /* Mark the subcore state as inside guest */ | 654 | /* Mark the subcore state as inside guest */ |
@@ -806,10 +808,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) | |||
806 | mtspr SPRN_CIABR, r7 | 808 | mtspr SPRN_CIABR, r7 |
807 | mtspr SPRN_TAR, r8 | 809 | mtspr SPRN_TAR, r8 |
808 | ld r5, VCPU_IC(r4) | 810 | ld r5, VCPU_IC(r4) |
809 | ld r6, VCPU_VTB(r4) | ||
810 | mtspr SPRN_IC, r5 | ||
811 | mtspr SPRN_VTB, r6 | ||
812 | ld r8, VCPU_EBBHR(r4) | 811 | ld r8, VCPU_EBBHR(r4) |
812 | mtspr SPRN_IC, r5 | ||
813 | mtspr SPRN_EBBHR, r8 | 813 | mtspr SPRN_EBBHR, r8 |
814 | ld r5, VCPU_EBBRR(r4) | 814 | ld r5, VCPU_EBBRR(r4) |
815 | ld r6, VCPU_BESCR(r4) | 815 | ld r6, VCPU_BESCR(r4) |
@@ -1334,10 +1334,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) | |||
1334 | stw r6, VCPU_PSPB(r9) | 1334 | stw r6, VCPU_PSPB(r9) |
1335 | std r7, VCPU_FSCR(r9) | 1335 | std r7, VCPU_FSCR(r9) |
1336 | mfspr r5, SPRN_IC | 1336 | mfspr r5, SPRN_IC |
1337 | mfspr r6, SPRN_VTB | ||
1338 | mfspr r7, SPRN_TAR | 1337 | mfspr r7, SPRN_TAR |
1339 | std r5, VCPU_IC(r9) | 1338 | std r5, VCPU_IC(r9) |
1340 | std r6, VCPU_VTB(r9) | ||
1341 | std r7, VCPU_TAR(r9) | 1339 | std r7, VCPU_TAR(r9) |
1342 | mfspr r8, SPRN_EBBHR | 1340 | mfspr r8, SPRN_EBBHR |
1343 | std r8, VCPU_EBBHR(r9) | 1341 | std r8, VCPU_EBBHR(r9) |
@@ -1564,9 +1562,11 @@ kvmhv_switch_to_host: | |||
1564 | isync | 1562 | isync |
1565 | 1563 | ||
1566 | BEGIN_FTR_SECTION | 1564 | BEGIN_FTR_SECTION |
1567 | /* DPDES is shared between threads */ | 1565 | /* DPDES and VTB are shared between threads */ |
1568 | mfspr r7, SPRN_DPDES | 1566 | mfspr r7, SPRN_DPDES |
1567 | mfspr r8, SPRN_VTB | ||
1569 | std r7, VCORE_DPDES(r5) | 1568 | std r7, VCORE_DPDES(r5) |
1569 | std r8, VCORE_VTB(r5) | ||
1570 | /* clear DPDES so we don't get guest doorbells in the host */ | 1570 | /* clear DPDES so we don't get guest doorbells in the host */ |
1571 | li r8, 0 | 1571 | li r8, 0 |
1572 | mtspr SPRN_DPDES, r8 | 1572 | mtspr SPRN_DPDES, r8 |
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index e76f79a45988..826c541a12af 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -226,7 +226,7 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu, | |||
226 | */ | 226 | */ |
227 | vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb; | 227 | vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb; |
228 | vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb; | 228 | vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb; |
229 | vcpu->arch.vtb += get_vtb() - vcpu->arch.entry_vtb; | 229 | to_book3s(vcpu)->vtb += get_vtb() - vcpu->arch.entry_vtb; |
230 | if (cpu_has_feature(CPU_FTR_ARCH_207S)) | 230 | if (cpu_has_feature(CPU_FTR_ARCH_207S)) |
231 | vcpu->arch.ic += mfspr(SPRN_IC) - vcpu->arch.entry_ic; | 231 | vcpu->arch.ic += mfspr(SPRN_IC) - vcpu->arch.entry_ic; |
232 | svcpu->in_use = false; | 232 | svcpu->in_use = false; |
@@ -448,6 +448,8 @@ void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr) | |||
448 | case PVR_POWER7: | 448 | case PVR_POWER7: |
449 | case PVR_POWER7p: | 449 | case PVR_POWER7p: |
450 | case PVR_POWER8: | 450 | case PVR_POWER8: |
451 | case PVR_POWER8E: | ||
452 | case PVR_POWER8NVL: | ||
451 | vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE | | 453 | vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE | |
452 | BOOK3S_HFLAG_NEW_TLBIE; | 454 | BOOK3S_HFLAG_NEW_TLBIE; |
453 | break; | 455 | break; |
@@ -1361,6 +1363,9 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id, | |||
1361 | case KVM_REG_PPC_HIOR: | 1363 | case KVM_REG_PPC_HIOR: |
1362 | *val = get_reg_val(id, to_book3s(vcpu)->hior); | 1364 | *val = get_reg_val(id, to_book3s(vcpu)->hior); |
1363 | break; | 1365 | break; |
1366 | case KVM_REG_PPC_VTB: | ||
1367 | *val = get_reg_val(id, to_book3s(vcpu)->vtb); | ||
1368 | break; | ||
1364 | case KVM_REG_PPC_LPCR: | 1369 | case KVM_REG_PPC_LPCR: |
1365 | case KVM_REG_PPC_LPCR_64: | 1370 | case KVM_REG_PPC_LPCR_64: |
1366 | /* | 1371 | /* |
@@ -1397,6 +1402,9 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id, | |||
1397 | to_book3s(vcpu)->hior = set_reg_val(id, *val); | 1402 | to_book3s(vcpu)->hior = set_reg_val(id, *val); |
1398 | to_book3s(vcpu)->hior_explicit = true; | 1403 | to_book3s(vcpu)->hior_explicit = true; |
1399 | break; | 1404 | break; |
1405 | case KVM_REG_PPC_VTB: | ||
1406 | to_book3s(vcpu)->vtb = set_reg_val(id, *val); | ||
1407 | break; | ||
1400 | case KVM_REG_PPC_LPCR: | 1408 | case KVM_REG_PPC_LPCR: |
1401 | case KVM_REG_PPC_LPCR_64: | 1409 | case KVM_REG_PPC_LPCR_64: |
1402 | kvmppc_set_lpcr_pr(vcpu, set_reg_val(id, *val)); | 1410 | kvmppc_set_lpcr_pr(vcpu, set_reg_val(id, *val)); |
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 02b4672f7347..df3f2706d3e5 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
@@ -2038,7 +2038,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, | |||
2038 | if (type == KVMPPC_DEBUG_NONE) | 2038 | if (type == KVMPPC_DEBUG_NONE) |
2039 | continue; | 2039 | continue; |
2040 | 2040 | ||
2041 | if (type & !(KVMPPC_DEBUG_WATCH_READ | | 2041 | if (type & ~(KVMPPC_DEBUG_WATCH_READ | |
2042 | KVMPPC_DEBUG_WATCH_WRITE | | 2042 | KVMPPC_DEBUG_WATCH_WRITE | |
2043 | KVMPPC_DEBUG_BREAKPOINT)) | 2043 | KVMPPC_DEBUG_BREAKPOINT)) |
2044 | return -EINVAL; | 2044 | return -EINVAL; |