From patchwork Fri Oct 3 14:31:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 38322 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 7EFB72057C for ; Fri, 3 Oct 2014 14:33:15 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf769798lbv.0 for ; Fri, 03 Oct 2014 07:33:14 -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=/WL6O/XWKGAA+jfvpknm54x4EM6g4MuH0NZ3MR+wrYY=; b=R/jVB17HaCdFTSMVpP+SWP6a5PA9Tcd07ma74LuKDIRb7/3S35Rg0IhgDhgIbWu8sV xo+nLm7QjsDAHIoHfAnkEnQ6XZvb7CiCanMIPHxgyXDNoARLPGXtJkmvhaULyZ63EiB7 RQISsMD09aSk4NEKzmuphmyxElTYRvHH/hhzyavWl4/0JmKupyx7UZkeppENNntSxb9T hk5JTiTB/H01sRe8tW5pAsPH4D79nALB130V4QNTGWS28XY9fyMVH+n7hWwjt9vSBGeV 9YL9c3l+iHHv2GqbFhf10S6wo99+dlfpBJBmzGojrccAXrBdi/C6rUBuMM2pu0oOble9 qKtQ== X-Gm-Message-State: ALoCoQkO79tlbayxRML160nqbXAVj+1HK9zJtEj8V6tYuBZUWrB5KXQol74jC9XpFEzz00nz0m8T X-Received: by 10.152.37.229 with SMTP id b5mr6025lak.9.1412346794260; Fri, 03 Oct 2014 07:33:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.101 with SMTP id l5ls350786lam.103.gmail; Fri, 03 Oct 2014 07:33:14 -0700 (PDT) X-Received: by 10.112.52.165 with SMTP id u5mr441229lbo.80.1412346794093; Fri, 03 Oct 2014 07:33:14 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by mx.google.com with ESMTPS id we4si11527401lbb.40.2014.10.03.07.33.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Oct 2014 07:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so1114967lbv.33 for ; Fri, 03 Oct 2014 07:33:13 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr5966828lbb.73.1412346793886; Fri, 03 Oct 2014 07:33: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.112.130.169 with SMTP id of9csp237923lbb; Fri, 3 Oct 2014 07:33:13 -0700 (PDT) X-Received: by 10.52.74.99 with SMTP id s3mr671134vdv.75.1412346792579; Fri, 03 Oct 2014 07:33:12 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id se3si4518935vdc.52.2014.10.03.07.33.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Oct 2014 07:33:12 -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 1Xa3tK-0001Rr-C5; Fri, 03 Oct 2014 14:31:30 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xa3tI-0001RX-TE for xen-devel@lists.xen.org; Fri, 03 Oct 2014 14:31:29 +0000 Received: from [85.158.137.68:34733] by server-12.bemta-3.messagelabs.com id C0/80-01574-043BE245; Fri, 03 Oct 2014 14:31:28 +0000 X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1412346686!11298874!1 X-Originating-IP: [65.55.169.107] 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 6868 invoked from network); 3 Oct 2014 14:31:27 -0000 Received: from mail-bl2on0107.outbound.protection.outlook.com (HELO na01-bl2-obe.outbound.protection.outlook.com) (65.55.169.107) by server-12.tower-31.messagelabs.com with AES256-SHA encrypted SMTP; 3 Oct 2014 14:31:27 -0000 Received: from BLUPR02CA028.namprd02.prod.outlook.com (25.160.23.146) by CO1PR02MB207.namprd02.prod.outlook.com (10.242.165.145) with Microsoft SMTP Server (TLS) id 15.0.1039.15; Fri, 3 Oct 2014 14:31:24 +0000 Received: from BL2FFO11FD025.protection.gbl (2a01:111:f400:7c09::186) by BLUPR02CA028.outlook.office365.com (2a01:111:e400:8ad::18) with Microsoft SMTP Server (TLS) id 15.0.1044.10 via Frontend Transport; Fri, 3 Oct 2014 14:31:23 +0000 Received: from atltwp01.amd.com (165.204.84.221) by BL2FFO11FD025.mail.protection.outlook.com (10.173.161.104) with Microsoft SMTP Server id 15.0.1029.15 via Frontend Transport; Fri, 3 Oct 2014 14:31:23 +0000 X-WSS-ID: 0NCVHO9-07-BDF-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 2B2C012C000C; Fri, 3 Oct 2014 09:31:20 -0500 (CDT) Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 3 Oct 2014 09:31:47 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server id 14.3.195.1; Fri, 3 Oct 2014 10:31:20 -0400 From: To: , , , Date: Fri, 3 Oct 2014 09:31:11 -0500 Message-ID: <1412346671-10974-3-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1412346671-10974-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1412346671-10974-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)(48376002)(50986999)(36756003)(77156001)(4396001)(106466001)(229853001)(104166001)(97736003)(2201001)(86152002)(92566001)(80022003)(92726001)(76482002)(105586002)(76176999)(85852003)(85306004)(95666004)(87936001)(101416001)(102836001)(68736004)(88136002)(89996001)(87286001)(62966002)(50466002)(21056001)(31966008)(53416004)(84676001)(86362001)(20776003)(19580395003)(44976005)(99396003)(120916001)(19580405001)(77096002)(46102003)(10300001)(107046002)(64706001)(93916002)(47776003)(33646002); 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: 0353563E2B 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 V3 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.174 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. Also, machine_halt() is modified to add 10ms delay to make sure all auxiliary CPUs are offlined before calling the shutdown. 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); } }