Commit 708da3ff authored by Michael Ellerman's avatar Michael Ellerman

Merge branch 'topic/ppc-kvm' into next

Bring in some more KVM commits from our KVM topic branch.
parents b149d5d4 63fa47ba
...@@ -4442,6 +4442,7 @@ static int kvmppc_run_vcpu(struct kvm_vcpu *vcpu) ...@@ -4442,6 +4442,7 @@ static int kvmppc_run_vcpu(struct kvm_vcpu *vcpu)
int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
unsigned long lpcr) unsigned long lpcr)
{ {
struct rcuwait *wait = kvm_arch_vcpu_get_wait(vcpu);
struct kvm_run *run = vcpu->run; struct kvm_run *run = vcpu->run;
int trap, r, pcpu; int trap, r, pcpu;
int srcu_idx; int srcu_idx;
...@@ -4588,7 +4589,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, ...@@ -4588,7 +4589,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
if (is_kvmppc_resume_guest(r) && !kvmppc_vcpu_check_block(vcpu)) { if (is_kvmppc_resume_guest(r) && !kvmppc_vcpu_check_block(vcpu)) {
kvmppc_set_timer(vcpu); kvmppc_set_timer(vcpu);
prepare_to_rcuwait(&vcpu->wait); prepare_to_rcuwait(wait);
for (;;) { for (;;) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -4605,7 +4606,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit, ...@@ -4605,7 +4606,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
schedule(); schedule();
trace_kvmppc_vcore_blocked(vc, 1); trace_kvmppc_vcore_blocked(vc, 1);
} }
finish_rcuwait(&vcpu->wait); finish_rcuwait(wait);
} }
vcpu->arch.ceded = 0; vcpu->arch.ceded = 0;
...@@ -4872,8 +4873,12 @@ static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm, ...@@ -4872,8 +4873,12 @@ static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
unsigned long npages = mem->memory_size >> PAGE_SHIFT; unsigned long npages = mem->memory_size >> PAGE_SHIFT;
if (change == KVM_MR_CREATE) { if (change == KVM_MR_CREATE) {
slot->arch.rmap = vzalloc(array_size(npages, unsigned long size = array_size(npages, sizeof(*slot->arch.rmap));
sizeof(*slot->arch.rmap)));
if ((size >> PAGE_SHIFT) > totalram_pages())
return -ENOMEM;
slot->arch.rmap = vzalloc(size);
if (!slot->arch.rmap) if (!slot->arch.rmap)
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -580,7 +580,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vcpu) ...@@ -580,7 +580,7 @@ long kvmhv_copy_tofrom_guest_nested(struct kvm_vcpu *vcpu)
if (eaddr & (0xFFFUL << 52)) if (eaddr & (0xFFFUL << 52))
return H_PARAMETER; return H_PARAMETER;
buf = kzalloc(n, GFP_KERNEL); buf = kzalloc(n, GFP_KERNEL | __GFP_NOWARN);
if (!buf) if (!buf)
return H_NO_MEM; return H_NO_MEM;
......
...@@ -768,7 +768,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc ...@@ -768,7 +768,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
s64 hdec, dec; s64 hdec, dec;
u64 purr, spurr; u64 purr, spurr;
u64 *exsave; u64 *exsave;
bool ri_set;
int trap; int trap;
unsigned long msr; unsigned long msr;
unsigned long host_hfscr; unsigned long host_hfscr;
...@@ -968,18 +967,12 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc ...@@ -968,18 +967,12 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
/* 0x2 bit for HSRR is only used by PR and P7/8 HV paths, clear it */ /* 0x2 bit for HSRR is only used by PR and P7/8 HV paths, clear it */
trap = local_paca->kvm_hstate.scratch0 & ~0x2; trap = local_paca->kvm_hstate.scratch0 & ~0x2;
/* HSRR interrupts leave MSR[RI] unchanged, SRR interrupts clear it. */ if (likely(trap > BOOK3S_INTERRUPT_MACHINE_CHECK))
ri_set = false;
if (likely(trap > BOOK3S_INTERRUPT_MACHINE_CHECK)) {
if (trap != BOOK3S_INTERRUPT_SYSCALL &&
(vcpu->arch.shregs.msr & MSR_RI))
ri_set = true;
exsave = local_paca->exgen; exsave = local_paca->exgen;
} else if (trap == BOOK3S_INTERRUPT_SYSTEM_RESET) { else if (trap == BOOK3S_INTERRUPT_SYSTEM_RESET)
exsave = local_paca->exnmi; exsave = local_paca->exnmi;
} else { /* trap == 0x200 */ else /* trap == 0x200 */
exsave = local_paca->exmc; exsave = local_paca->exmc;
}
vcpu->arch.regs.gpr[1] = local_paca->kvm_hstate.scratch1; vcpu->arch.regs.gpr[1] = local_paca->kvm_hstate.scratch1;
vcpu->arch.regs.gpr[3] = local_paca->kvm_hstate.scratch2; vcpu->arch.regs.gpr[3] = local_paca->kvm_hstate.scratch2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment