From patchwork Mon May 5 16:00:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 29657 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 026002055D for ; Mon, 5 May 2014 16:05:32 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id w8sf13155495qac.2 for ; Mon, 05 May 2014 09:05:32 -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=JVZsbGafA5Wxj0SNgDaBJCB4ZPUrrEj60LY0U6G2xbg=; b=EYi59kPjAju8AcEQ9/0zwkbVodvsqu+BP02dWVVc08NYyahyWvkWNbaQ0PzLCu2r18 RtC3i1Sa9DTr+e2cF0Aw2z+yqWnk7EsWWK6c42TiQpLS7vrDu58CPJbcMsGG1ef/e0iu iBNgJrDZMsCY0LV0odTh2fFjb0/jrbPnWG3qgumaKSt/RspTSfDMvO2rqrOJck6KbLuY xdwsIS/nZ1qyshihX6vidTsCVdw/9gNSrjowq3D7qVNsZo709KeXh6G3SUsPAeaZ8+qr H3Xej5q5OCq6Fv4XhMGGtTMtIcGRDnHaGMnsjAw9aVkLboWEdC93tSQi5e3iU3HMov/f tgdQ== X-Gm-Message-State: ALoCoQl/jFTeT4/4Vr8aOa0aY+9KnVFnKbcYyzNmYtTzAAHPtQOfKip+KHRULQUsK3Uac/RRQa6q X-Received: by 10.236.127.35 with SMTP id c23mr14460663yhi.51.1399305932368; Mon, 05 May 2014 09:05:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls2503129qga.86.gmail; Mon, 05 May 2014 09:05:32 -0700 (PDT) X-Received: by 10.58.74.38 with SMTP id q6mr28129244vev.7.1399305932247; Mon, 05 May 2014 09:05:32 -0700 (PDT) Received: from mail-vc0-x22a.google.com (mail-vc0-x22a.google.com [2607:f8b0:400c:c03::22a]) by mx.google.com with ESMTPS id sn5si1694077vdc.65.2014.05.05.09.05.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 09:05:32 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=2607:f8b0:400c:c03::22a; Received: by mail-vc0-f170.google.com with SMTP id lf12so1301930vcb.1 for ; Mon, 05 May 2014 09:05:32 -0700 (PDT) X-Received: by 10.52.181.132 with SMTP id dw4mr686835vdc.86.1399305932121; Mon, 05 May 2014 09:05:32 -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 ib8csp152086vcb; Mon, 5 May 2014 09:05:31 -0700 (PDT) X-Received: by 10.140.106.3 with SMTP id d3mr16211123qgf.44.1399305931580; Mon, 05 May 2014 09:05:31 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z14si3689733qge.107.2014.05.05.09.05.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 05 May 2014 09:05:31 -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]:58303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhLOV-0004jL-4c for patch@linaro.org; Mon, 05 May 2014 12:05:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhLJz-0006uq-E4 for qemu-devel@nongnu.org; Mon, 05 May 2014 12:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhLJr-0000wx-LQ for qemu-devel@nongnu.org; Mon, 05 May 2014 12:00:51 -0400 Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:45410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhLJq-0000s7-KC for qemu-devel@nongnu.org; Mon, 05 May 2014 12:00:43 -0400 Received: by mail-oa0-f41.google.com with SMTP id m1so6206972oag.28 for ; Mon, 05 May 2014 09:00:41 -0700 (PDT) X-Received: by 10.60.155.35 with SMTP id vt3mr34591660oeb.32.1399305641777; Mon, 05 May 2014 09:00:41 -0700 (PDT) Received: from localhost.localdomain (72-48-77-163.dyn.grandenetworks.net. [72.48.77.163]) by mx.google.com with ESMTPSA id dw5sm20133189obb.0.2014.05.05.09.00.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 May 2014 09:00:41 -0700 (PDT) From: Rob Herring To: Peter Maydell Date: Mon, 5 May 2014 11:00:22 -0500 Message-Id: <1399305623-22016-7-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399305623-22016-1-git-send-email-robherring2@gmail.com> References: <1399305623-22016-1-git-send-email-robherring2@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::229 Cc: Rob Herring , qemu-devel@nongnu.org, Christoffer Dall Subject: [Qemu-devel] [PATCH 6/7] arm/virt: enable PSCI emulation support for system emulation 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-Original-Sender: robherring2@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=fail header.i=@gmail.com; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Rob Herring Now that we have PSCI emulation, enable it for the virt platform. This simplifies the virt machine a bit now that PSCI and SMP no longer need to be KVM only features. Signed-off-by: Rob Herring --- Note: This will need to be rebased as comments on KVM PSCI 0.2 support are addressed. This patch effectively includes my comments. hw/arm/virt.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9f28c12..d8ab88d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -181,21 +181,22 @@ static void create_fdt(VirtBoardInfo *vbi) "clk24mhz"); qemu_fdt_setprop_cell(fdt, "/apb-pclk", "phandle", vbi->clock_phandle); - /* No PSCI for TCG yet */ - if (kvm_enabled()) { - qemu_fdt_add_subnode(fdt, "/psci"); - if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) { - qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci-0.2"); - } else { - qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci"); - 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); - } - qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc"); + qemu_fdt_add_subnode(fdt, "/psci"); + qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc"); + if (kvm_enabled() && !kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) { + qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci"); + } else { + const char compat[] = "arm,psci-0.2\0arm,psci"; + qemu_fdt_setprop(fdt, "/psci", "compatible", compat, sizeof(compat)); } + 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); } static void fdt_add_timer_nodes(const VirtBoardInfo *vbi) @@ -410,16 +411,6 @@ static void machvirt_init(QEMUMachineInitArgs *args) vbi->smp_cpus = smp_cpus; - /* - * Only supported method of starting secondary CPUs is PSCI and - * PSCI is not yet supported with TCG, so limit smp_cpus to 1 - * if we're not using KVM. - */ - if (!kvm_enabled() && smp_cpus > 1) { - error_report("mach-virt: must enable KVM to use multiple CPUs"); - exit(1); - } - if (args->ram_size > vbi->memmap[VIRT_MEM].size) { error_report("mach-virt: cannot model more than 30GB RAM"); exit(1); @@ -438,6 +429,9 @@ static void machvirt_init(QEMUMachineInitArgs *args) } cpuobj = object_new(object_class_get_name(oc)); + object_property_set_int(cpuobj, QEMU_PSCI_METHOD_HVC, "psci-method", + NULL); + /* Secondary CPUs start in PSCI powered-down state */ if (n > 0) { object_property_set_bool(cpuobj, true, "start-powered-off", NULL);