From patchwork Thu Apr 10 11:46:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 28161 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6311D20671 for ; Thu, 10 Apr 2014 11:50:42 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id il7sf11192301vcb.5 for ; Thu, 10 Apr 2014 04:50:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=XH49jGv3tkgVkLE5yV+NZ6qch1rnwXh/o9wFOt+5v8k=; b=CwfjO6JpfS7nsOvblWeSNGO8G65Y0js5e/ogNJwL1GX7Pg6mrDG5EqJYsgtJw90a2R 7Zp1edTL5kPGWfh5vr0YAyXnvOwrH8j8+346ufsaDv3dBLOWx/zeexdpxR0p7XujWGdr ntqH2UmctpC53cvQvUP0dx6jqS5db4tQMpDeE8Sj1rRFCHL12fQjRRQCkNnrBse5Bj8z x4fcntT4F8wR2q+nadiwsL5NhaVeAbArEuZChMqXMl/RLBq/gbiS3PV4HilGsRjt/roA axWeLruVyKgZT18VOpjkUvX+19D7SjrkZs6kw9DHyz3iFRquCNfOy6hxV2D7SVxrElaS k4fQ== X-Gm-Message-State: ALoCoQkEwsMWlomuDC5TrcMig2rWG8BW6OWkOXngZ7CqKqQ7RtkOuJcSp/7VOnnfy7Ju1Amb9ldd X-Received: by 10.236.39.99 with SMTP id c63mr7428013yhb.31.1397130642030; Thu, 10 Apr 2014 04:50:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.197 with SMTP id j63ls1096914qgf.89.gmail; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr14066567vcb.2.1397130641906; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id fn10si643096vdc.171.2014.04.10.04.50.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:50:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so3411953veb.30 for ; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr185912vcb.28.1397130641844; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp52660vcb; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) X-Received: by 10.224.22.65 with SMTP id m1mr1420287qab.103.1397130641526; Thu, 10 Apr 2014 04:50:41 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k4si1753432qci.49.2014.04.10.04.50.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:50:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:50436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDVB-0008Db-53 for patch@linaro.org; Thu, 10 Apr 2014 07:50:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDSi-0002zi-FJ for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYDSc-0002Uf-Ha for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:48:08 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:40416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYDSc-0002Ua-Cq for qemu-devel@nongnu.org; Thu, 10 Apr 2014 07:48:02 -0400 Received: by mail-pa0-f47.google.com with SMTP id lj1so3870505pab.34 for ; Thu, 10 Apr 2014 04:48:01 -0700 (PDT) X-Received: by 10.68.249.100 with SMTP id yt4mr18891508pbc.165.1397130481713; Thu, 10 Apr 2014 04:48:01 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id kt8sm19638002pab.7.2014.04.10.04.47.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 04:48:00 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Thu, 10 Apr 2014 17:16:52 +0530 Message-Id: <1397130414-5551-6-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397130414-5551-1-git-send-email-pranavkumar@linaro.org> References: <1397130414-5551-1-git-send-email-pranavkumar@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.47 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V3 5/7] hw/arm/virt: Use PSCI v0.2 function IDs when kernel supports it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Signed-off-by: Anup Patel --- 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); + } } }