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>
This commit is contained in:
parent
90dc881222
commit
64e07be544
|
@ -1771,6 +1771,21 @@ recent kvm-kmod from http://sourceforge.net/projects/kvm."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# test for ppc kvm pvr setting
|
||||||
|
|
||||||
|
if test "$kvm" = "yes" && test "$cpu" = "ppc" -o "$cpu" = "ppc64"; then
|
||||||
|
cat > $TMPC <<EOF
|
||||||
|
#include <asm/kvm.h>
|
||||||
|
int main(void) { struct kvm_sregs s; s.pvr = 0; return 0; }
|
||||||
|
EOF
|
||||||
|
if compile_prog "$kvm_cflags" "" ; then
|
||||||
|
kvm_ppc_pvr=yes
|
||||||
|
else
|
||||||
|
kvm_ppc_pvr=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# test for vhost net
|
# test for vhost net
|
||||||
|
|
||||||
|
@ -3257,6 +3272,9 @@ case "$target_arch2" in
|
||||||
if test $vhost_net = "yes" ; then
|
if test $vhost_net = "yes" ; then
|
||||||
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
|
echo "CONFIG_VHOST_NET=y" >> $config_target_mak
|
||||||
fi
|
fi
|
||||||
|
if test $kvm_ppc_pvr = "yes" ; then
|
||||||
|
echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
if test "$target_bigendian" = "yes" ; then
|
if test "$target_bigendian" = "yes" ; then
|
||||||
|
|
|
@ -94,19 +94,33 @@ static int kvm_arch_sync_sregs(CPUState *cenv)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (cenv->excp_model == POWERPC_EXCP_BOOKE) {
|
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;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
if (!cap_segstate) {
|
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);
|
ret = kvm_vcpu_ioctl(cenv, KVM_GET_SREGS, &sregs);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_KVM_PPC_PVR
|
||||||
sregs.pvr = cenv->spr[SPR_PVR];
|
sregs.pvr = cenv->spr[SPR_PVR];
|
||||||
|
#endif
|
||||||
return kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs);
|
return kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue