From patchwork Tue Apr 1 11:53:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 27535 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D19ED20341 for ; Tue, 1 Apr 2014 11:57:20 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf34265651oag.1 for ; Tue, 01 Apr 2014 04:57:20 -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=EqimNDALODCX7hIvxhmnZNKxBuHaMAH0oavdvtSFXuDplM72K8nhURQrs8XPWcHsaT 1fCt9eyhFP5csiL6b2/aiErrAjUOz+g3UGeHhNvHCdBBTmhuVA1K3vRQwpHlZuGfSjEg qvul+eQPt5Sf+aoAOmEZlt8dIujGEGzCv0PfMSjAsBCAPZyYkVhTpRn6xyv3CF2RhG16 YWe16ymLtSbHhCVxyO2dQyQVTysyJ9bVBldavE+v8nHq+zlHrH/6tPN6+wJcezBbn6Z3 4y7OIUp70mjcI7K4ekpuFZ1vdTtNZ5CAEtPoR7RNfiqzQMkgmMBUhXzFW0ORnTDZB612 8ToA== X-Gm-Message-State: ALoCoQlYBOpVxbUH9QnoC9m2VRANFg/ezr92OL8OhembpK4kwFNem6oN4OSAcncjHid4PE4Fr/i9 X-Received: by 10.182.87.2 with SMTP id t2mr13234437obz.2.1396353440247; Tue, 01 Apr 2014 04:57:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.225 with SMTP id r88ls3028212qgr.2.gmail; Tue, 01 Apr 2014 04:57:20 -0700 (PDT) X-Received: by 10.52.25.202 with SMTP id e10mr788053vdg.30.1396353440124; Tue, 01 Apr 2014 04:57:20 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id b2si3568345vcy.10.2014.04.01.04.57.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:57:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so9584371vcb.33 for ; Tue, 01 Apr 2014 04:57:20 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr789043vdx.28.1396353440033; Tue, 01 Apr 2014 04:57:20 -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.12.8 with SMTP id v8csp229956vcv; Tue, 1 Apr 2014 04:57:19 -0700 (PDT) X-Received: by 10.140.21.164 with SMTP id 33mr13354286qgl.78.1396353438973; Tue, 01 Apr 2014 04:57:18 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j30si5182885qge.8.2014.04.01.04.57.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:57:18 -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]:59761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxJe-0002uR-Hh for patch@linaro.org; Tue, 01 Apr 2014 07:57:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxHB-0007Iq-NZ for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUxH4-0007c2-Qb for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:45 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUxH4-0007bj-LO for qemu-devel@nongnu.org; Tue, 01 Apr 2014 07:54:38 -0400 Received: by mail-pa0-f42.google.com with SMTP id fb1so9807042pad.1 for ; Tue, 01 Apr 2014 04:54:38 -0700 (PDT) X-Received: by 10.68.135.137 with SMTP id ps9mr1511376pbb.160.1396353277948; Tue, 01 Apr 2014 04:54:37 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id ix2sm49532958pbc.45.2014.04.01.04.54.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Apr 2014 04:54:37 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Tue, 1 Apr 2014 17:23:52 +0530 Message-Id: <1396353232-3835-7-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1396353232-3835-1-git-send-email-pranavkumar@linaro.org> References: <1396353232-3835-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.42 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, kvmarm@list.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V2 6/6] hw/arm/virt: Use PSCI v0.2 function IDs when kernel supports its 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.220.174 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); + } } }