From patchwork Fri Aug 16 21:05:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19267 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E82825E72 for ; Fri, 16 Aug 2013 21:06:37 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id i72sf1018605yha.5 for ; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=gzzFNMAt/stJYJfnpCe1gu4MWuXI9KJ48VXLue8n9Xg=; b=Gyuqw/Te75B8qjx0HnwapBE57JjKaKKpBxug+RuSKfpWiR1jZ8SP6D2zTGE08zPLCZ uoxtTguYpf7+loxX1UnwU/lKw8JGWu+IUrrE8EYIQjIsIxlRLYwU1sd7/e+4Aw7YTPZz 2iEiohWwRco/Vg2i3SgIpYyawSbaV1XF+5KS7CkTtD7cXQShenQqXqWQEpgBASj40q4S XwenQXfAOsl1GubBMCMJkQSndHW9EVoCadRKWd4FPzsg7tKMoFBzHkag4GaO6VjuVa+8 tcvOvnfASSFDuTfjwuHN7f+v0KNpl3trJNz/mlPP/wIjT/JtUCUVHxZ/YAf/VfAal5CZ Y/2g== X-Received: by 10.236.193.6 with SMTP id j6mr1238918yhn.44.1376687197167; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.118.136 with SMTP id km8ls926422qeb.32.gmail; Fri, 16 Aug 2013 14:06:37 -0700 (PDT) X-Received: by 10.52.170.111 with SMTP id al15mr13107vdc.43.1376687196872; Fri, 16 Aug 2013 14:06:36 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id aa5si775344vdc.104.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id hf12so1857126vcb.27 for ; Fri, 16 Aug 2013 14:06:36 -0700 (PDT) X-Gm-Message-State: ALoCoQlYTaGCmQJ4YmFM+bp3TGGHhvPDUDllCLpTeuhIIqCF0OzCpGfvrO6eM+a4pEhsf3VzUO3u X-Received: by 10.52.164.102 with SMTP id yp6mr2516935vdb.14.1376687196787; Fri, 16 Aug 2013 14:06:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp89465vcz; Fri, 16 Aug 2013 14:06:36 -0700 (PDT) X-Received: by 10.180.92.98 with SMTP id cl2mr633258wib.15.1376687195910; Fri, 16 Aug 2013 14:06:35 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx.google.com with ESMTPS id k9si1296666wjf.39.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.169 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id f14so2004696wiw.4 for ; Fri, 16 Aug 2013 14:06:35 -0700 (PDT) X-Received: by 10.180.188.132 with SMTP id ga4mr538456wic.53.1376687195450; Fri, 16 Aug 2013 14:06:35 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id b13sm797327wic.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:34 -0700 (PDT) From: Julien Grall To: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com Cc: patches@linaro.org, andre.przywara@linaro.org, xen-devel@lists.xen.org, Julien Grall Subject: [RFC 19/24] xen/arm: Create a fake PSCI node in dom0 device tree Date: Fri, 16 Aug 2013 22:05:51 +0100 Message-Id: <1376687156-6737-20-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> References: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Xen uses PSCI to bring up secondary cpus for the guest. Signed-off-by: Julien Grall --- xen/arch/arm/domain_build.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 567b1fe..d8d67a6 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -283,6 +284,44 @@ static int make_hypervisor_node(void *fdt, const struct dt_device_node *parent) return res; } +static int make_psci_node(void *fdt, const struct dt_device_node *parent) +{ + int res; + __be32 reg[0]; + __be32 *cells; + + DPRINT("Create PSCI node\n"); + + /* See linux Documentation/devicetree/bindings/arm/psci.txt */ + res = fdt_begin_node(fdt, "psci"); + if ( res ) + return res; + + res = fdt_property_string(fdt, "compatible", "arm,psci"); + if ( res ) + return res; + + res = fdt_property_string(fdt, "method", "hvc"); + if ( res ) + return res; + + cells = ®[0]; + dt_set_cell(&cells, 1, __PSCI_cpu_off); + res = fdt_property(fdt, "cpu_off", reg, sizeof(reg[0])); + if ( res ) + return res; + + cells = ®[0]; + dt_set_cell(&cells, 1, __PSCI_cpu_on); + res = fdt_property(fdt, "cpu_on", reg, sizeof(reg[0])); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} + /* Map the device in the domain */ static int map_device(struct domain *d, const struct dt_device_node *dev) { @@ -367,6 +406,7 @@ static const struct dt_device_match skip_matches[] __initconst = { DT_MATCH_COMPATIBLE("xen,xen"), DT_MATCH_COMPATIBLE("xen,multiboot-module"), + DT_MATCH_COMPATIBLE("arm,psci"), { /* sentinel */ }, }; @@ -412,6 +452,10 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, res = make_hypervisor_node(kinfo->fdt, np); if ( res ) return res; + + res = make_psci_node(kinfo->fdt, np); + if ( res ) + return res; } res = fdt_end_node(kinfo->fdt);