diff options
author | Alexander Graf <agraf@suse.de> | 2011-04-16 02:00:36 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2011-05-09 22:31:38 +0200 |
commit | 64e07be544ee9c5fb5b741175262fd34726ec431 (patch) | |
tree | 77b4b2606b970d920f53ed0c89a4a8b165135b90 /target-ppc/kvm.c | |
parent | 90dc8812229a1d3f31bc08ccf0aa50e10282faef (diff) | |
download | qemu-64e07be544ee9c5fb5b741175262fd34726ec431.zip |
kvm: ppc: detect old headers
When compiling Qemu with older kernel headers, the PVR setting
mechanism isn't available yet. Unfortunately, back then I didn't add
a capability we could check against, so all we can do is add a configure
test to see if we support PVR setting. For BookE, we don't care yet.
This fixes compilation errors with KVM enabled on older kernel headers
(like 2.6.32).
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/kvm.c')
-rw-r--r-- | target-ppc/kvm.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 5a1b6cbdcc..ccf4668f28 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -94,19 +94,33 @@ static int kvm_arch_sync_sregs(CPUState *cenv) int ret; if (cenv->excp_model == POWERPC_EXCP_BOOKE) { + /* What we're really trying to say is "if we're on BookE, we use + the native PVR for now". This is the only sane way to check + it though, so we potentially confuse users that they can run + BookE guests on BookS. Let's hope nobody dares enough :) */ return 0; } else { if (!cap_segstate) { - return 0; + fprintf(stderr, "kvm error: missing PVR setting capability\n"); + return -ENOSYS; } } +#if !defined(CONFIG_KVM_PPC_PVR) + if (1) { + fprintf(stderr, "kvm error: missing PVR setting capability\n"); + return -ENOSYS; + } +#endif + ret = kvm_vcpu_ioctl(cenv, KVM_GET_SREGS, &sregs); if (ret) { return ret; } +#ifdef CONFIG_KVM_PPC_PVR sregs.pvr = cenv->spr[SPR_PVR]; +#endif return kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs); } |