QEMU: PPC: set has-idle in guest device tree
PATCH 1/1 QEMU: PPC: set has-idle in guest device tree
From: Stuart Yoder <[email protected]>
---
-note: this patch requires a kernel headers update
for the pvinfo idle flag. See Bharat Bhushan's recent patch "Synchronized the linux headers"
--- hw/ppc/e500.c | 4 ++++ target-ppc/kvm.c | 29 ++++++++++++++++++++++++++--- target-ppc/kvm_ppc.h | 1 + 3 files changed, 31 insertions(+), 3 deletions(-)
hw/ppc/e500.c +4 -0
@@ -225,6 +225,10 @@ static int ppce500_load_device_tree(CPUPPCState *env,kvmppc_get_hypercall (env, hypercall,sizeof (hypercall));qemu_devtree_setprop (fdt,"/hypervisor" ,"hcall-instructions" , hypercall,sizeof (hypercall)); +/* if KVM supports the idle hcall, set property indicating this */ +if (kvmppc_get_hasidle (env)) { +qemu_devtree_setprop (fdt,"/hypervisor" ,"has-idle" ,NULL ,0 ); + } }/* Create CPU nodes */
target-ppc/kvm.c +26 -3
@@ -967,16 +967,39 @@ uint32_t kvmppc_get_dfp(void)return kvmppc_read_int_cpu_dt ("ibm,dfp" ); } +static int kvmppc_get_pvinfo (CPUPPCState *env,struct kvm_ppc_pvinfo *pvinfo) + { +PowerPCCPU *cpu =ppc_env_get_cpu (env); +CPUState *cs =CPU (cpu); + +if (kvm_check_extension (cs->kvm_state,KVM_CAP_PPC_GET_PVINFO ) && + !kvm_vm_ioctl (cs->kvm_state,KVM_PPC_GET_PVINFO , pvinfo)) { +return 0 ; + } + +return 1 ; +} + +int kvmppc_get_hasidle (CPUPPCState *env) +{ +struct kvm_ppc_pvinfo pvinfo; + +if (!kvmppc_get_pvinfo (env, &pvinfo) && + (pvinfo.flags &KVM_PPC_PVINFO_FLAGS_EV_IDLE )) { +return 1 ; + } + +return 0 ; +} +int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len) {uint32_t *hc = (uint32_t *)buf;struct kvm_ppc_pvinfo pvinfo; -if (kvm_check_extension (env->kvm_state,KVM_CAP_PPC_GET_PVINFO ) && - !kvm_vm_ioctl (env->kvm_state,KVM_PPC_GET_PVINFO , &pvinfo)) { +if (!kvmppc_get_pvinfo (env, &pvinfo)) {memcpy (buf, pvinfo.hcall, buf_len); -return 0 ; }
target-ppc/kvm_ppc.h +1 -0
@@ -19,6 +19,7 @@ uint32_t kvmppc_get_tbfreq(void);uint64_t kvmppc_get_clockfreq (void );uint32_t kvmppc_get_vmx (void );uint32_t kvmppc_get_dfp (void ); +int kvmppc_get_hasidle (CPUPPCState *env);int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len);int kvmppc_set_interrupt (CPUPPCState *env,int irq,int level);void kvmppc_set_papr (CPUPPCState *env);
Signature · 1 line
1.7.9.7
Quoted 3 lines · Stuart Yoder
From: Stuart Yoder <[email protected]>
Signed-off-by Stuart Yoder <[email protected]>
Thanks, adjusted the patch slightly (fix to apply, add patch description) and applied it to ppc-next.
Alex
Hi,
This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.
This may have occurred due to:
1) Changes in mainline requiring your patch to be rebased and re-tested.
2) Sending the mail using a tool other than git-send-email. Please use git-send-email to send patches to QEMU.
3) Basing this patch off of a branch that isn't tracking the QEMU master branch. If that was done purposefully, please include the name of the tree in the subject line in the future to prevent this message.
For instance: "[PATCH block-next 1/10] qcow3: add fancy new feature"
4) You no longer wish for this patch to be applied to QEMU. No additional action is required on your part.
Below is the output from git-am:
Applying: QEMU: PPC: set has-idle in guest device tree Using index info to reconstruct a base tree...
M hw/ppc/e500.c
M target-ppc/kvm.c
M target-ppc/kvm_ppc.h
Falling back to patching base and 3-way merge... Auto-merging target-ppc/kvm_ppc.h
Auto-merging target-ppc/kvm.c
CONFLICT (content): Merge conflict in target-ppc/kvm.c Auto-merging hw/ppc/e500.c
Failed to merge in the changes.
Patch failed at 0001 QEMU: PPC: set has-idle in guest device tree The copy of the patch that failed is found in:
/home/aliguori/.patches/qemu-working/.git/rebase-apply/patch
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".
Am 04.01.2013 um 21:21 schrieb Anthony Liguori <[email protected]>:
Quoted 4 lines
Hi,
This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.
Great idea, but not patricularly useful for ppc patches :). Could you please just omit patches that have a CC on qemu-ppc? :)
Alex
Quoted 39 lines
This may have occurred due to:
1) Changes in mainline requiring your patch to be rebased and re-tested.
2) Sending the mail using a tool other than git-send-email. Please use git-send-email to send patches to QEMU.
3) Basing this patch off of a branch that isn't tracking the QEMU master branch. If that was done purposefully, please include the name of the tree in the subject line in the future to prevent this message.
For instance: "[PATCH block-next 1/10] qcow3: add fancy new feature"
4) You no longer wish for this patch to be applied to QEMU. No additional action is required on your part.
Nacked-by QEMU Patches <[email protected]>Below is the output from git-am:
Applying: QEMU: PPC: set has-idle in guest device tree Using index info to reconstruct a base tree...
M hw/ppc/e500.c M target-ppc/kvm.c M target-ppc/kvm_ppc.hFalling back to patching base and 3-way merge... Auto-merging
target-ppc/kvm_ppc.h
Auto-mergingtarget-ppc/kvm.c
CONFLICT (content): Merge conflict intarget-ppc/kvm.cAuto-merginghw/ppc/e500.c
Failed to merge in the changes.
Patch failed at 0001 QEMU: PPC: set has-idle in guest device tree The copy of the patch that failed is found in:
/home/aliguori/.patches/qemu-working/.git/rebase-apply/patch
When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort".
Quoted 16 lines · Alexander Graf
Am 04.01.2013 um 21:21 schrieb Anthony Liguori <[email protected]>:
Quoted 4 lines
Hi,
This is an automated message generated from the QEMU Patches. Thank you for submitting this patch. This patch no longer applies to qemu.git.
Great idea, but not patricularly useful for ppc patches :). Could you please just omit patches that have a CC on qemu-ppc? :)
Quoted 5 lines
3) Basing this patch off of a branch that isn't tracking the QEMU master branch. If that was done purposefully, please include the name of the tree in the subject line in the future to prevent this message.
For instance: "[PATCH block-next 1/10] qcow3: add fancy new feature"
[PATCH ppc-next ...] ?
cheers,
Gerd