KVM: PPC: Rework wqp conditional code

Message ID 1331673043-9649-1-git-send-email-agraf@suse.de
State New, archived
Headers show

Commit Message

Alexander Graf March 13, 2012, 9:10 p.m.
On PowerPC, we sometimes use a waitqueue per core, not per thread,
so we can't always use the vcpu internal waitqueue.

This code has been generalized by Christoffer Dall recently, but
unfortunately broke compilation for PowerPC. At the time the helper
function is defined, struct kvm_vcpu is not declared yet, so we can't
dereference it.

This patch moves all logic into the generic inline function, at which
time we have all information necessary.

Signed-off-by: Alexander Graf <agraf@suse.de>
 arch/powerpc/include/asm/kvm_host.h |    6 +-----
 include/linux/kvm_host.h            |    6 ++++--
 2 files changed, 5 insertions(+), 7 deletions(-)


diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index a91d6fd..15a1ad5 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -538,10 +538,6 @@  struct kvm_vcpu_arch {
 #define KVM_MMIO_REG_QPR	0x0040
 #define KVM_MMIO_REG_FQPR	0x0060
-static inline wait_queue_head *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
-	return vcpu->arch.wqp;
+#define __KVM_HAVE_ARCH_WQ
 #endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 50d4b4a..b18ae78 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -523,12 +523,14 @@  static inline void kvm_arch_free_vm(struct kvm *kvm)
 static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
+	return vcpu->arch.wqp;
 	return &vcpu->wq;
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
 void kvm_arch_destroy_vm(struct kvm *kvm);