From patchwork Fri May 23 02:30:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 30669 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4071220671 for ; Fri, 23 May 2014 02:35:14 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf20532079iec.4 for ; Thu, 22 May 2014 19:35:13 -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=8qkMlx/odUKpDZOIlXN9lnbY7Z9DW6sVc3jyI4rzdMo=; b=nJ9I6lg+yxthrUT/unhOxbWmTsds4ee3i7vtZaHDew7/UuP4lT5P5QKoHJtDLiVftW glGucNKDyIAwLgYFEUcXUpWZ9VMEvP30+9NbJh4bjD2ZVvkRs18VNKdItt2lGeixCRxM S8/tw+IeO1MSuEgJ8JhFuFASP3QIUZjdjwJ1y9w7NjV6cL8M3/JzoiQ/TgvUVpq/39ag 10E38rXeZmq6k99uMVt7ZURX7BniyoQXysml55XOasSjRuDcDYowiOS6Nbu2gPtayjxe inA3PP+4+aM2C4HvdA9WMGaMVhBckDXrxUlTOvtHR4gNuVyDSvu/9lINPxBm5bBofZQ0 qibg== X-Gm-Message-State: ALoCoQmUm5iQ55XE8PI6poVrT82MZpyeSdu9YIkzaBGTRYeg9lNowVuuElWYKSu+/ulKNsr6vI0o X-Received: by 10.42.185.1 with SMTP id cm1mr909826icb.10.1400812513371; Thu, 22 May 2014 19:35:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.247 with SMTP id u110ls1601624qge.79.gmail; Thu, 22 May 2014 19:35:13 -0700 (PDT) X-Received: by 10.220.95.204 with SMTP id e12mr1445652vcn.37.1400812513281; Thu, 22 May 2014 19:35:13 -0700 (PDT) Received: from mail-vc0-x233.google.com (mail-vc0-x233.google.com [2607:f8b0:400c:c03::233]) by mx.google.com with ESMTPS id u6si919393ven.33.2014.05.22.19.35.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 19:35:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::233 as permitted sender) client-ip=2607:f8b0:400c:c03::233; Received: by mail-vc0-f179.google.com with SMTP id im17so5506015vcb.38 for ; Thu, 22 May 2014 19:35:13 -0700 (PDT) X-Received: by 10.52.184.164 with SMTP id ev4mr1227384vdc.15.1400812513151; Thu, 22 May 2014 19:35:13 -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 ib8csp247978vcb; Thu, 22 May 2014 19:35:12 -0700 (PDT) X-Received: by 10.140.96.68 with SMTP id j62mr2159032qge.5.1400812512579; Thu, 22 May 2014 19:35:12 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z4si1969512qaz.110.2014.05.22.19.35.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 19:35:12 -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]:40655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnfKC-0001Ry-3K for patch@linaro.org; Thu, 22 May 2014 22:35:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnfG2-000497-64 for qemu-devel@nongnu.org; Thu, 22 May 2014 22:31:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnfFd-0003or-Jg for qemu-devel@nongnu.org; Thu, 22 May 2014 22:30:54 -0400 Received: from mail-oa0-x230.google.com ([2607:f8b0:4003:c02::230]:39468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnfFd-0003oi-DY for qemu-devel@nongnu.org; Thu, 22 May 2014 22:30:29 -0400 Received: by mail-oa0-f48.google.com with SMTP id i4so4925489oah.21 for ; Thu, 22 May 2014 19:30:29 -0700 (PDT) X-Received: by 10.182.29.195 with SMTP id m3mr1523843obh.33.1400812228923; Thu, 22 May 2014 19:30:28 -0700 (PDT) Received: from localhost.localdomain (66-90-144-10.dyn.grandenetworks.net. [66.90.144.10]) by mx.google.com with ESMTPSA id fm8sm5542727oeb.10.2014.05.22.19.30.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 May 2014 19:30:28 -0700 (PDT) From: Rob Herring To: Peter Maydell Date: Thu, 22 May 2014 21:30:08 -0500 Message-Id: <1400812209-26743-6-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400812209-26743-1-git-send-email-robherring2@gmail.com> References: <1400812209-26743-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::230 Cc: Rob Herring , Peter Crosthwaite , qemu-devel@nongnu.org, Christoffer Dall Subject: [Qemu-devel] [PATCH v2 5/6] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::233 as permitted sender) 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 Reviewed-by: Peter Maydell --- v2: - Rebased. Mostly a whitespace change removing the kvm_enabled() check. hw/arm/virt.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) -- 1.9.1 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 442363c..e58a07a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -187,23 +187,19 @@ static void fdt_add_psci_node(const VirtBoardInfo *vbi) void *fdt = vbi->fdt; ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); - /* No PSCI for TCG yet */ - if (kvm_enabled()) { - qemu_fdt_add_subnode(fdt, "/psci"); - if (armcpu->psci_version == 2) { - const char comp[] = "arm,psci-0.2\0arm,psci"; - qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp)); - } else { - 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); + qemu_fdt_add_subnode(fdt, "/psci"); + if (armcpu->psci_version == 2) { + const char comp[] = "arm,psci-0.2\0arm,psci"; + qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp)); + } else { + 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); } static void fdt_add_timer_nodes(const VirtBoardInfo *vbi) @@ -418,16 +414,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); @@ -446,6 +432,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);