summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-11-19 17:59:32 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2015-11-19 17:59:32 +0100
commitd792abacaf1a1a8dfea353fab699b97fa6251c2a (patch)
tree5cbadeda8d8c5f8e159b392f456154ed2094ac95 /include
parent62a193edaf90df38356e292f47a17f28e0cee3f1 (diff)
parent152e9f65d66f0a3891efc3869440becc0e7ff53f (diff)
Merge tag 'kvm-s390-master-4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-master
KVM: s390: Fixes for 4.4 1. disallow changing the SIMD mode when CPUs have been created. it allowed userspace to corrupt kernel memory 2. Fix vCPU lookup. Until now the vCPU number equals the vCPU id. Some kernel code places relied on that. This might a: cause guest failures b: allow userspace to corrupt kernel memory 3. Fencing of the PFMF instruction should use the guest facilities and not the host facilities.
Diffstat (limited to 'include')
-rw-r--r--include/linux/kvm_host.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 5706a2108f0a..c923350ca20a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -460,6 +460,17 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
(vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
idx++)
+static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id)
+{
+ struct kvm_vcpu *vcpu;
+ int i;
+
+ kvm_for_each_vcpu(i, vcpu, kvm)
+ if (vcpu->vcpu_id == id)
+ return vcpu;
+ return NULL;
+}
+
#define kvm_for_each_memslot(memslot, slots) \
for (memslot = &slots->memslots[0]; \
memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\