diff mbox

QEMU: PPC: set has-idle in guest device tree

Message ID 1357252622-15209-1-git-send-email-stuart.yoder@freescale.com
State New
Headers show

Commit Message

Stuart Yoder Jan. 3, 2013, 10:37 p.m. UTC
From: Stuart Yoder <stuart.yoder@freescale.com>

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---

-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(-)

Comments

Alexander Graf Jan. 4, 2013, 9:14 a.m. UTC | #1
On 03.01.2013, at 23:37, Stuart Yoder wrote:

> From: Stuart Yoder <stuart.yoder@freescale.com>
> 
> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>

Thanks, adjusted the patch slightly (fix to apply, add patch description) and applied it to ppc-next.


Alex
Anthony Liguori Jan. 4, 2013, 8:21 p.m. UTC | #2
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.

Nacked-by: QEMU Patches <aliguori@us.ibm.com>

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".
Alexander Graf Jan. 4, 2013, 8:46 p.m. UTC | #3
Am 04.01.2013 um 21:21 schrieb Anthony Liguori <aliguori@us.ibm.com>:

> 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

> 
> 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 <aliguori@us.ibm.com>
> 
> 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".
>
Gerd Hoffmann Jan. 7, 2013, 9:46 a.m. UTC | #4
On 01/04/13 21:46, Alexander Graf wrote:
> 
> 
> Am 04.01.2013 um 21:21 schrieb Anthony Liguori <aliguori@us.ibm.com>:
> 
>> 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? :)

>>  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
diff mbox

Patch

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index aa54fd8..a19f094 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -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 */
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 88650d4..10adf26 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -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;
     }
 
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 83f9872..b1f096f 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -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);