From patchwork Thu Oct 2 21:29:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 38309 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0B8D920972 for ; Thu, 2 Oct 2014 21:31:39 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf1741783lbv.4 for ; Thu, 02 Oct 2014 14:31:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=LVnwE03Bpfpr1kIyv3FGHRsp+O3XuXRBvDy0pb+PUEM=; b=i3QxyXkzkpLmvzwxsqjhUGfpQWZQ5HLfbGVlpahPuWJD1G4+yJwytuu8r/kB9a7sj2 mHj95MB7nXkS1ldsCGZRyPAM7+Jc72ulucr9b62d0+BLOVOaS+jpnFAksmsodcFlKc7d cZsARnIW2gzcJk4EvfvoG7aBknK9EpGnyfb5QmJ0+8ELbmAAj6mEl1wK+8zeyU7OZZeh lEdAHYwZfmwWWOAeHY80N8OQPyXZNgR6b6gbzOrz0bTxFaZ1mBtbe80usBvr/wYF8F/U qXa8AmqSjd2/KRCrkkDR0tZYNxiya3A4EQyiQpx/7t1ENVhEvn8/ZPYx9Gpo1hQKmvRL nNCg== X-Gm-Message-State: ALoCoQkLzLw4W9KSqFgjx0hNanjLqnyXhev2Yi8qukDOx57OoAsxsnyVMna/5HjT7tW9+ZsM8uQQ X-Received: by 10.180.101.194 with SMTP id fi2mr1104158wib.2.1412285498397; Thu, 02 Oct 2014 14:31:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.68 with SMTP id p4ls275521laa.52.gmail; Thu, 02 Oct 2014 14:31:38 -0700 (PDT) X-Received: by 10.112.161.234 with SMTP id xv10mr1355480lbb.96.1412285498113; Thu, 02 Oct 2014 14:31:38 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id tj4si8340032lbb.74.2014.10.02.14.31.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Oct 2014 14:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id q1so2435lam.4 for ; Thu, 02 Oct 2014 14:31:37 -0700 (PDT) X-Received: by 10.112.4.33 with SMTP id h1mr1191378lbh.67.1412285497723; Thu, 02 Oct 2014 14:31:37 -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.112.130.169 with SMTP id of9csp133108lbb; Thu, 2 Oct 2014 14:31:37 -0700 (PDT) X-Received: by 10.52.188.131 with SMTP id ga3mr672415vdc.45.1412285495751; Thu, 02 Oct 2014 14:31:35 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id m9si3507787vcl.104.2014.10.02.14.31.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 02 Oct 2014 14:31:35 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XZnwl-0000Bg-Uu; Thu, 02 Oct 2014 21:29:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XZnwl-0000BL-7b for xen-devel@lists.xen.org; Thu, 02 Oct 2014 21:29:59 +0000 Received: from [85.158.139.211:59365] by server-4.bemta-5.messagelabs.com id 8B/4F-10551-6D3CD245; Thu, 02 Oct 2014 21:29:58 +0000 X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1412285396!11684071!1 X-Originating-IP: [207.46.100.101] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5424 invoked from network); 2 Oct 2014 21:29:57 -0000 Received: from mail-by2on0101.outbound.protection.outlook.com (HELO na01-by2-obe.outbound.protection.outlook.com) (207.46.100.101) by server-5.tower-206.messagelabs.com with AES256-SHA encrypted SMTP; 2 Oct 2014 21:29:57 -0000 Received: from BN1PR02CA0032.namprd02.prod.outlook.com (10.141.56.32) by BY2PR02MB201.namprd02.prod.outlook.com (10.242.232.12) with Microsoft SMTP Server (TLS) id 15.0.1039.15; Thu, 2 Oct 2014 21:29:54 +0000 Received: from BL2FFO11FD013.protection.gbl (2a01:111:f400:7c09::136) by BN1PR02CA0032.outlook.office365.com (2a01:111:e400:2a::32) with Microsoft SMTP Server (TLS) id 15.0.1044.10 via Frontend Transport; Thu, 2 Oct 2014 21:29:53 +0000 Received: from atltwp01.amd.com (165.204.84.221) by BL2FFO11FD013.mail.protection.outlook.com (10.173.160.221) with Microsoft SMTP Server id 15.0.1029.15 via Frontend Transport; Thu, 2 Oct 2014 21:29:53 +0000 X-WSS-ID: 0NCU6DR-07-6P3-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2BFD7CAE7FE; Thu, 2 Oct 2014 16:29:50 -0500 (CDT) Received: from SATLEXDAG05.amd.com (10.181.40.11) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 2 Oct 2014 16:30:17 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag05.amd.com (10.181.40.11) with Microsoft SMTP Server id 14.3.195.1; Thu, 2 Oct 2014 17:29:50 -0400 From: To: , , Date: Thu, 2 Oct 2014 16:29:43 -0500 Message-ID: <1412285383-25735-3-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1412285383-25735-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1412285383-25735-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(428002)(199003)(189002)(44976005)(19580405001)(19580395003)(48376002)(229853001)(31966008)(84676001)(20776003)(101416001)(76482002)(85852003)(47776003)(97736003)(50466002)(64706001)(102836001)(10300001)(99396003)(89996001)(120916001)(21056001)(93916002)(85306004)(4396001)(50226001)(86362001)(62966002)(68736004)(76176999)(87286001)(50986999)(87936001)(88136002)(92566001)(2201001)(92726001)(86152002)(80022003)(46102003)(53416004)(106466001)(77096002)(105586002)(33646002)(107046002)(104166001)(36756003)(95666004)(77156001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR02MB201; H:atltwp01.amd.com; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB201; X-Forefront-PRVS: 03524FBD26 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-OriginatorOrg: amd4.onmicrosoft.com Cc: Suravee Suthikulpanit , xen-devel@lists.xen.org Subject: [Xen-devel] [V2 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: suravee.suthikulpanit@amd.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) 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 List-Archive: From: Suravee Suthikulpanit "machine_halt()" and "machine_restart()" are modified to use PSCI interface by default if PSCI-0.2 is supported. The "raw_machine_reset()" is also removed since this is unnecessary. For non-PSCI, platform_poweroff() and platform_reset() are used instead. Signed-off-by: Suravee Suthikulpanit --- xen/arch/arm/shutdown.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index adc0529..4988b03 100644 --- a/xen/arch/arm/shutdown.c +++ b/xen/arch/arm/shutdown.c @@ -5,11 +5,7 @@ #include #include #include - -static void raw_machine_reset(void) -{ - platform_reset(); -} +#include static void noreturn halt_this_cpu(void *arg) { @@ -18,10 +14,23 @@ static void noreturn halt_this_cpu(void *arg) void machine_halt(void) { + int timeout = 10; + watchdog_disable(); console_start_sync(); local_irq_enable(); smp_call_function(halt_this_cpu, NULL, 0); + local_irq_disable(); + + /* Wait at most another 10ms for all other CPUs to go offline. */ + while ( (num_online_cpus() > 1) && (timeout-- > 0) ) + mdelay(1); + + /* This is mainly for PSCI-0.2, which does not return if success. */ + call_psci_system_off(); + + /* Alternative halt procedure */ + platform_poweroff(); halt_this_cpu(NULL); } @@ -39,9 +48,13 @@ void machine_restart(unsigned int delay_millisecs) while ( (num_online_cpus() > 1) && (timeout-- > 0) ) mdelay(1); + /* This is mainly for PSCI-0.2, which does not return if success. */ + call_psci_system_reset(); + + /* Alternative reset procedure */ while ( 1 ) { - raw_machine_reset(); + platform_reset(); mdelay(100); } }