From patchwork Mon Nov 25 12:02:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 21733 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 134232400B for ; Mon, 25 Nov 2013 12:03:15 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oy12sf10131133veb.1 for ; Mon, 25 Nov 2013 04:03:14 -0800 (PST) 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: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=U+ra+GegwEq25jyaBWhlZCQ9ZJP6uHr3BLcvMnPSxUQ=; b=e2KrtyAKc0136WJRZxAnRNbjKyUn7VNvkVnsN8+6/a17481xfwwNsfLJnURltbzvJk O53gj7Y54v6suVHqkgQ4vSfPAMpIRcnJjr2EG6UtlN/5l2IBpRUbFEAgpizhgH/bcMBH O9jXzv9y5UJCHNJqiLkXJqABnwf8Wl8OcbfGjcRDx9IIKkYR9DnAOv3ndc+OskK4Yzhk No8L4VXa+rMaCLx9E+TQMKDv2UI2K0jPVkOXAq1goPKBqvAmVlIZCoi2cmATLjHS8eo9 pATrk0LZ7FuTsvrTeHIgpc61kJI4MNiW/oprYSdUxIQ3LZ3ogILD1FtG1HXWFbHCUm3B u5pw== X-Gm-Message-State: ALoCoQlBaipcIFxseHLa11CYHJXjc9wzMf7eQ3fIXa7sDK57DhCi3JLygoZV/l/W4WFp/DeAaV4x X-Received: by 10.236.87.194 with SMTP id y42mr13375559yhe.0.1385380994451; Mon, 25 Nov 2013 04:03:14 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.129.166 with SMTP id nx6ls2004826qeb.12.gmail; Mon, 25 Nov 2013 04:03:14 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr2748095vcn.21.1385380994336; Mon, 25 Nov 2013 04:03:14 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id lu1si17757152vcb.88.2013.11.25.04.03.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 04:03:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so2767739veb.18 for ; Mon, 25 Nov 2013 04:03:14 -0800 (PST) X-Received: by 10.58.210.66 with SMTP id ms2mr26567605vec.10.1385380994010; Mon, 25 Nov 2013 04:03:14 -0800 (PST) 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 u4csp128114vcz; Mon, 25 Nov 2013 04:03:13 -0800 (PST) X-Received: by 10.50.23.103 with SMTP id l7mr12451376igf.3.1385380993243; Mon, 25 Nov 2013 04:03:13 -0800 (PST) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by mx.google.com with ESMTPS id ff17si18366175igb.66.2013.11.25.04.03.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Nov 2013 04:03:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of andre.przywara@linaro.org) client-ip=209.85.223.177; Received: by mail-ie0-f177.google.com with SMTP id tp5so6652109ieb.36 for ; Mon, 25 Nov 2013 04:03:13 -0800 (PST) X-Received: by 10.50.98.10 with SMTP id ee10mr12508324igb.30.1385380992876; Mon, 25 Nov 2013 04:03:12 -0800 (PST) Received: from slackpad.drs.calxeda.com (f053083004.adsl.alicedsl.de. [78.53.83.4]) by mx.google.com with ESMTPSA id p14sm25270238igr.7.2013.11.25.04.03.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Nov 2013 04:03:12 -0800 (PST) From: Andre Przywara To: Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com Cc: julien.grall@linaro.org, xen-devel@lists.xen.org, patches@linaro.org, Andre Przywara Subject: [PATCH 1/4] arm: parse PSCI node from the host device-tree Date: Mon, 25 Nov 2013 13:02:41 +0100 Message-Id: <1385380964-22230-2-git-send-email-andre.przywara@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1385380964-22230-1-git-send-email-andre.przywara@linaro.org> References: <1385380964-22230-1-git-send-email-andre.przywara@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: andre.przywara@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 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: , The availability of a PSCI handler is advertised in the DTB. Find and parse the node (described in the Linux device-tree binding) and save the function number for bringing up a CPU for later usage. We do some sanity checks, especially we deny using HVC as a callling method, as it does not make much sense currently under Xen. Signed-off-by: Andre Przywara --- xen/arch/arm/smpboot.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index 6c90fa6..97bd414 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -89,6 +89,44 @@ smp_clear_cpu_maps (void) cpu_logical_map(0) = READ_SYSREG(MPIDR_EL1) & MPIDR_HWID_MASK; } +uint32_t psci_host_cpu_on_nr; + +static int __init psci_host_init(void) +{ + struct dt_device_node *psci; + int ret; + const char *prop_str; + + psci = dt_find_compatible_node(NULL, NULL, "arm,psci"); + if ( !psci ) + return 1; + + ret = dt_property_read_string(psci, "method", &prop_str); + if ( ret ) + { + printk("/psci node does not provide a method (%d)\n", ret); + return 2; + } + + /* Since Xen runs in HYP all of the time, it does not make sense to + * let it call into HYP for PSCI handling, since the handler won't + * just be there. So bail out with an error if "smc" is not used. + */ + if ( strcmp(prop_str, "smc") ) + { + printk("/psci method must be smc, but is: \"%s\"\n", prop_str); + return 3; + } + + if ( !dt_property_read_u32(psci, "cpu_on", &psci_host_cpu_on_nr) ) + { + printk("/psci node is missing the \"cpu_on\" property\n"); + return 4; + } + + return 0; +} + /* Parse the device tree and build the logical map array containing * MPIDR values related to logical cpus * Code base on Linux arch/arm/kernel/devtree.c @@ -107,6 +145,11 @@ void __init smp_init_cpus(void) bool_t bootcpu_valid = 0; int rc; + if ( psci_host_init() == 0 ) + { + printk(XENLOG_INFO "Using PSCI for SMP bringup\n"); + } + if ( (rc = arch_smp_init()) < 0 ) { printk(XENLOG_WARNING "SMP init failed (%d)\n"