From patchwork Wed Oct 1 20:02:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 38257 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D26CE202E7 for ; Wed, 1 Oct 2014 20:04:58 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf303888lam.4 for ; Wed, 01 Oct 2014 13:04:57 -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=T2XYpAOTqR/JvEgWGWWsJWnMiYz7hHQu7AtzgvRBaAg=; b=fPM65M66jzu2q8QuaiJzN1UdLFGkhwbV5d4mlH8/4XEqUs29anhf25dNSrT7KaF0RC bXkFmjfLO6lYbKnhdq7bZcraPlE4Kj4jXMS249HYFlgzK3SX7Q1G1F0wSNBkuHzbhwts cv43Ypv7MV+lRoURQp2bVwimQexP/ZV5mkSHDWfzF1xXOBQVdIk666TT15inN5a+Otut lo6egm70TTIDkDDOOgZc01+WqMZFFxvv8Pvc+O4P3reCEnsCW13dVEC/7dHigf04igxz d0bJZHJNOHMWic5hIScMF1A709zlYcxNbOJQhKRwRUw0tngIqgyW8RAZem+bvalYpdjX WRLw== X-Gm-Message-State: ALoCoQmBKMGMzcEcm1HH1PvGBpkEbwK5Nzk06WUfoX7VEo7ME/y6oCpjqRwZejNvzpX6kFm8DWrx X-Received: by 10.194.57.237 with SMTP id l13mr13334wjq.7.1412193897578; Wed, 01 Oct 2014 13:04:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.132 with SMTP id c4ls194657lac.88.gmail; Wed, 01 Oct 2014 13:04:57 -0700 (PDT) X-Received: by 10.152.45.42 with SMTP id j10mr22203503lam.91.1412193897405; Wed, 01 Oct 2014 13:04:57 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id tj4si3404411lbb.74.2014.10.01.13.04.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 13:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so1024267lbi.22 for ; Wed, 01 Oct 2014 13:04:57 -0700 (PDT) X-Received: by 10.152.5.168 with SMTP id t8mr57419550lat.67.1412193897152; Wed, 01 Oct 2014 13:04:57 -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 of9csp603637lbb; Wed, 1 Oct 2014 13:04:56 -0700 (PDT) X-Received: by 10.221.20.4 with SMTP id qm4mr3979687vcb.58.1412193896012; Wed, 01 Oct 2014 13:04:56 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id l2si1938437vdx.44.2014.10.01.13.04.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 01 Oct 2014 13:04:56 -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 1XZQ78-00031a-Vj; Wed, 01 Oct 2014 20:03:06 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XZQ77-00031A-CG for xen-devel@lists.xen.org; Wed, 01 Oct 2014 20:03:05 +0000 Received: from [85.158.139.211:38430] by server-1.bemta-5.messagelabs.com id 88/9B-17892-8FD5C245; Wed, 01 Oct 2014 20:03:04 +0000 X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1412193782!6058563!1 X-Originating-IP: [65.55.169.108] 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 31869 invoked from network); 1 Oct 2014 20:03:03 -0000 Received: from mail-bl2on0108.outbound.protection.outlook.com (HELO na01-bl2-obe.outbound.protection.outlook.com) (65.55.169.108) by server-14.tower-206.messagelabs.com with AES256-SHA encrypted SMTP; 1 Oct 2014 20:03:03 -0000 Received: from BN1PR02CA0015.namprd02.prod.outlook.com (10.141.56.15) by CO1PR02MB207.namprd02.prod.outlook.com (10.242.165.145) with Microsoft SMTP Server (TLS) id 15.0.1039.15; Wed, 1 Oct 2014 20:03:00 +0000 Received: from BN1BFFO11FD055.protection.gbl (2a01:111:f400:7c10::1:198) by BN1PR02CA0015.outlook.office365.com (2a01:111:e400:2a::15) with Microsoft SMTP Server (TLS) id 15.0.1044.10 via Frontend Transport; Wed, 1 Oct 2014 20:02:59 +0000 Received: from atltwp01.amd.com (165.204.84.221) by BN1BFFO11FD055.mail.protection.outlook.com (10.58.145.10) with Microsoft SMTP Server id 15.0.1029.15 via Frontend Transport; Wed, 1 Oct 2014 20:02:59 +0000 X-WSS-ID: 0NCS7OX-07-TWY-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (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 26464CAE639; Wed, 1 Oct 2014 15:02:56 -0500 (CDT) Received: from SATLEXDAG03.amd.com (10.181.40.7) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 1 Oct 2014 15:03:20 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server id 14.3.195.1; Wed, 1 Oct 2014 16:02:58 -0400 From: To: , , Date: Wed, 1 Oct 2014 15:02:53 -0500 Message-ID: <1412193773-31042-3-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1412193773-31042-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1412193773-31042-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)(189002)(199003)(4396001)(36756003)(76482002)(92566001)(50226001)(92726001)(97736003)(48376002)(77156001)(50986999)(80022003)(2201001)(50466002)(46102003)(86152002)(88136002)(102836001)(76176999)(87936001)(105586002)(95666004)(68736004)(85306004)(85852003)(104166001)(87286001)(106466001)(229853001)(89996001)(101416001)(62966002)(21056001)(84676001)(31966008)(53416004)(99396003)(86362001)(20776003)(19580395003)(44976005)(120916001)(33646002)(64706001)(107046002)(77096002)(10300001)(19580405001)(47776003)(93916002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO1PR02MB207; H:atltwp01.amd.com; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:CO1PR02MB207; X-Forefront-PRVS: 0351D213B3 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] [PATCH 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.217.177 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 Acked-by: Stefano Stabellini --- xen/arch/arm/shutdown.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index adc0529..2289ad1 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,22 @@ 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); + + /* Not return if success */ + call_psci_system_off(); + + platform_poweroff(); halt_this_cpu(NULL); } @@ -39,9 +47,12 @@ void machine_restart(unsigned int delay_millisecs) while ( (num_online_cpus() > 1) && (timeout-- > 0) ) mdelay(1); + /* Not return if success */ + call_psci_system_reset(); + while ( 1 ) { - raw_machine_reset(); + platform_reset(); mdelay(100); } }