summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf2011-09-14 21:38:45 +0200
committerAlexander Graf2011-10-06 09:48:08 +0200
commit94135e813c14bac3f967e6b5aa35b9d617737e68 (patch)
treed928774802ab2301ded670656b41f6d8ec4cdcda
parentKVM: Update kernel headers (diff)
downloadqemu-94135e813c14bac3f967e6b5aa35b9d617737e68.tar.gz
qemu-94135e813c14bac3f967e6b5aa35b9d617737e68.tar.xz
qemu-94135e813c14bac3f967e6b5aa35b9d617737e68.zip
KVM: PPC: Use HIOR setting for -M pseries with PR KVM
When running with PR KVM, we need to set HIOR directly. Thankfully there is now a new interface to set registers individually so we can just use that and poke HIOR into the guest vcpu's HIOR register. While at it, this also sets SDR1 because -M pseries requires it to run. With this patch, -M pseries works properly with PR KVM. Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--target-ppc/kvm.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 35a6f1086e..75832d83b8 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -705,10 +705,11 @@ int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
void kvmppc_set_papr(CPUState *env)
{
- struct kvm_enable_cap cap;
+ struct kvm_enable_cap cap = {};
+ struct kvm_one_reg reg = {};
+ struct kvm_sregs sregs = {};
int ret;
- memset(&cap, 0, sizeof(cap));
cap.cap = KVM_CAP_PPC_PAPR;
ret = kvm_vcpu_ioctl(env, KVM_ENABLE_CAP, &cap);
@@ -723,7 +724,25 @@ void kvmppc_set_papr(CPUState *env)
* Once we have qdev CPUs, move HIOR to a qdev property and
* remove this chunk.
*/
- /* XXX Set HIOR using new ioctl */
+ reg.id = KVM_ONE_REG_PPC_HIOR;
+ reg.u.reg64 = env->spr[SPR_HIOR];
+ ret = kvm_vcpu_ioctl(env, KVM_SET_ONE_REG, &reg);
+ if (ret) {
+ goto fail;
+ }
+
+ /* Set SDR1 so kernel space finds the HTAB */
+ ret = kvm_vcpu_ioctl(env, KVM_GET_SREGS, &sregs);
+ if (ret) {
+ goto fail;
+ }
+
+ sregs.u.s.sdr1 = env->spr[SPR_SDR1];
+
+ ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
+ if (ret) {
+ goto fail;
+ }
return;