Skip to content

Commit a26d553

Browse files
committed
Merge branch 'kvm-ppc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into HEAD
Paul Mackerras writes: "Please do a pull from my kvm-ppc-next branch to get some fixes which I would like to have in 4.11. There are four small commits there; two are fixes for potential host crashes in the new HPT resizing code, and the other two are changes to printks to make KVM on PPC a little less noisy."
2 parents 843574a + bcd3bb6 commit a26d553

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

arch/powerpc/kvm/book3s_32_mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
224224
ptem = kvmppc_mmu_book3s_32_get_ptem(sre, eaddr, primary);
225225

226226
if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
227-
printk(KERN_ERR "KVM: Can't copy data from 0x%lx!\n", ptegp);
227+
printk_ratelimited(KERN_ERR
228+
"KVM: Can't copy data from 0x%lx!\n", ptegp);
228229
goto no_page_found;
229230
}
230231

arch/powerpc/kvm/book3s_64_mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
265265
goto no_page_found;
266266

267267
if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
268-
printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp);
268+
printk_ratelimited(KERN_ERR
269+
"KVM: Can't copy data from 0x%lx!\n", ptegp);
269270
goto no_page_found;
270271
}
271272

arch/powerpc/kvm/book3s_64_mmu_hv.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ void kvmppc_set_hpt(struct kvm *kvm, struct kvm_hpt_info *info)
127127
kvm->arch.hpt = *info;
128128
kvm->arch.sdr1 = __pa(info->virt) | (info->order - 18);
129129

130-
pr_info("KVM guest htab at %lx (order %ld), LPID %x\n",
131-
info->virt, (long)info->order, kvm->arch.lpid);
130+
pr_debug("KVM guest htab at %lx (order %ld), LPID %x\n",
131+
info->virt, (long)info->order, kvm->arch.lpid);
132132
}
133133

134134
long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order)
@@ -1370,6 +1370,12 @@ static int resize_hpt_rehash(struct kvm_resize_hpt *resize)
13701370
unsigned long i;
13711371
int rc;
13721372

1373+
/*
1374+
* resize_hpt_rehash_hpte() doesn't handle the new-format HPTEs
1375+
* that POWER9 uses, and could well hit a BUG_ON on POWER9.
1376+
*/
1377+
if (cpu_has_feature(CPU_FTR_ARCH_300))
1378+
return -EIO;
13731379
for (i = 0; i < kvmppc_hpt_npte(&kvm->arch.hpt); i++) {
13741380
rc = resize_hpt_rehash_hpte(resize, i);
13751381
if (rc != 0)
@@ -1407,6 +1413,9 @@ static void resize_hpt_release(struct kvm *kvm, struct kvm_resize_hpt *resize)
14071413
{
14081414
BUG_ON(kvm->arch.resize_hpt != resize);
14091415

1416+
if (!resize)
1417+
return;
1418+
14101419
if (resize->hpt.virt)
14111420
kvmppc_free_hpt(&resize->hpt);
14121421

arch/powerpc/kvm/powerpc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
614614
r = 1;
615615
break;
616616
case KVM_CAP_SPAPR_RESIZE_HPT:
617-
r = !!hv_enabled;
617+
/* Disable this on POWER9 until code handles new HPTE format */
618+
r = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);
618619
break;
619620
#endif
620621
case KVM_CAP_PPC_HTM:

0 commit comments

Comments
 (0)