diff options
Diffstat (limited to 'target-ppc/kvm.c')
-rw-r--r-- | target-ppc/kvm.c | 25 |
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, ®); + 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; |