qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Anup Patel <anup.patel@linaro.org>,
	patches@apm.com, kvmarm@lists.cs.columbia.edu,
	christoffer.dall@linaro.org,
	Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Subject: [Qemu-devel] [RFC PATCH V3 5/7] hw/arm/virt: Use PSCI v0.2 function IDs when kernel supports it
Date: Thu, 10 Apr 2014 17:16:52 +0530	[thread overview]
Message-ID: <1397130414-5551-6-git-send-email-pranavkumar@linaro.org> (raw)
In-Reply-To: <1397130414-5551-1-git-send-email-pranavkumar@linaro.org>

If we have in-kernel emulation of PSCI v0.2 for KVM ARM/ARM64 then
we enable PSCI v0.2 for each VCPU at the time of VCPU init hence we
need to provide PSCI v0.2 function IDs via generated DTB.

This patch updates generated DTB to have PSCI v0.2 function IDs when
we have in-kernel emulation PSCI v0.2 for KVM ARM/ARM64.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
---
 hw/arm/virt.c |   28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 2bbc931..cf6a774 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -187,11 +187,29 @@ static void create_fdt(VirtBoardInfo *vbi)
         qemu_fdt_add_subnode(fdt, "/psci");
         qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
         qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
-                                  PSCI_FN_CPU_SUSPEND);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", PSCI_FN_CPU_OFF);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", PSCI_FN_CPU_ON);
-        qemu_fdt_setprop_cell(fdt, "/psci", "migrate", PSCI_FN_MIGRATE);
+        if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
+                                      QEMU_PSCI_0_2_FN_CPU_SUSPEND);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off",
+                                      QEMU_PSCI_0_2_FN_CPU_OFF);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on",
+                                      QEMU_PSCI_0_2_FN_CPU_ON);
+            qemu_fdt_setprop_cell(fdt, "/psci", "migrate",
+                                      QEMU_PSCI_0_2_FN_MIGRATE);
+            qemu_fdt_setprop_cell(fdt, "/psci", "system_off",
+                                      QEMU_PSCI_0_2_FN_SYSTEM_OFF);
+            qemu_fdt_setprop_cell(fdt, "/psci", "system_reset",
+                                      QEMU_PSCI_0_2_FN_SYSTEM_RESET);
+        } else {
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
+                                      QEMU_PSCI_FN_CPU_SUSPEND);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off",
+                                      QEMU_PSCI_FN_CPU_OFF);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on",
+                                      QEMU_PSCI_FN_CPU_ON);
+            qemu_fdt_setprop_cell(fdt, "/psci", "migrate",
+                                      QEMU_PSCI_FN_MIGRATE);
+        }
     }
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2014-04-10 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 11:46 [Qemu-devel] [RFC PATCH V3 0/7] PSCI v0.2 support for KVM ARM/ARM64 Pranavkumar Sawargaonkar
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 1/7] linux-headers: Update KVM headers from v3.15 Pranavkumar Sawargaonkar
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 2/7] kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT Pranavkumar Sawargaonkar
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 3/7] target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible Pranavkumar Sawargaonkar
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 4/7] target-arm: Provide PSCI v0.2 constants to generic QEMU code Pranavkumar Sawargaonkar
2014-04-10 11:46 ` Pranavkumar Sawargaonkar [this message]
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 6/7] target-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64 Pranavkumar Sawargaonkar
2014-04-10 11:46 ` [Qemu-devel] [RFC PATCH V3 7/7] target-arm: Implement kvm_arch_reset_vcpu() for " Pranavkumar Sawargaonkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397130414-5551-6-git-send-email-pranavkumar@linaro.org \
    --to=pranavkumar@linaro.org \
    --cc=anup.patel@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=patches@apm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).