From patchwork Wed Jun 18 08:49:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4374011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 634E1BEEAA for ; Wed, 18 Jun 2014 08:53:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5664320218 for ; Wed, 18 Jun 2014 08:53:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34DF1201C7 for ; Wed, 18 Jun 2014 08:53:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxBZp-0000HT-LD; Wed, 18 Jun 2014 08:50:41 +0000 Received: from mail-bn1blp0187.outbound.protection.outlook.com ([207.46.163.187] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxBZk-0000Ap-JJ for linux-arm-kernel@lists.infradead.org; Wed, 18 Jun 2014 08:50:37 +0000 Received: from DM2PR03CA007.namprd03.prod.outlook.com (10.141.52.155) by DM2PR03MB349.namprd03.prod.outlook.com (10.141.54.11) with Microsoft SMTP Server (TLS) id 15.0.954.9; Wed, 18 Jun 2014 08:50:12 +0000 Received: from BN1BFFO11FD035.protection.gbl (2a01:111:f400:7c10::1:122) by DM2PR03CA007.outlook.office365.com (2a01:111:e400:2414::27) with Microsoft SMTP Server (TLS) id 15.0.959.24 via Frontend Transport; Wed, 18 Jun 2014 08:50:12 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD035.mail.protection.outlook.com (10.58.144.98) with Microsoft SMTP Server (TLS) id 15.0.959.15 via Frontend Transport; Wed, 18 Jun 2014 08:50:12 +0000 Received: from dragon.ap.freescale.net ([10.192.185.156]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s5I8o66C003746; Wed, 18 Jun 2014 01:50:07 -0700 From: Shawn Guo To: Russell King Subject: [PATCH] ARM: save/restore diagnostic register on ARMv7 suspend/resume Date: Wed, 18 Jun 2014 16:49:58 +0800 Message-ID: <1403081398-32116-1-git-send-email-shawn.guo@freescale.com> X-Mailer: git-send-email 1.8.3.2 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(81542001)(88136002)(95666004)(33646001)(104016002)(36756003)(21056001)(81342001)(26826002)(104166001)(89996001)(6806004)(44976005)(64706001)(79102001)(87286001)(47776003)(80022001)(20776003)(19580405001)(87936001)(85852003)(76482001)(102836001)(81156003)(85306003)(83322001)(74502001)(31966008)(62966002)(19580395003)(83072002)(74662001)(46102001)(84676001)(92566001)(92726001)(97736001)(93916002)(86362001)(48376002)(68736004)(77982001)(4396001)(99396002)(50466002)(69596002)(50986999)(50226001)(77156001)(105606002); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR03MB349; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BL:0; ACTION:Default; RISK:Low; SCL:0; SPMLVL:NotSpam; PCL:0; RULEID: X-Forefront-PRVS: 02462830BE Received-SPF: Fail (: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Shawn.Guo@freescale.com; X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140618_015036_827275_96A7C6E8 X-CRM114-Status: UNSURE ( 7.00 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) Cc: Catalin Marinas , Will Deacon , Shawn Guo , linux-arm-kernel@lists.infradead.org, Nicolas Pitre X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The CP15 diagnostic register holds ARM errata bits on ARMv7, so it needs to be saved/restored on suspend/resume. Otherwise, the effectiveness of errata workaround gets lost together with diagnostic register bit across suspend/resume cycle. Signed-off-by: Shawn Guo --- arch/arm/mm/proc-v7.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 3db2c2f04a30..4de98a65a4ea 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -92,13 +92,14 @@ ENDPROC(cpu_v7_dcache_clean_area) /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ .globl cpu_v7_suspend_size -.equ cpu_v7_suspend_size, 4 * 9 +.equ cpu_v7_suspend_size, 4 * 10 #ifdef CONFIG_ARM_CPU_SUSPEND ENTRY(cpu_v7_do_suspend) stmfd sp!, {r4 - r10, lr} mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID stmia r0!, {r4 - r5} + mrc p15, 0, r4, c15, c0, 1 @ Diagnostic register #ifdef CONFIG_MMU mrc p15, 0, r6, c3, c0, 0 @ Domain ID #ifdef CONFIG_ARM_LPAE @@ -111,7 +112,7 @@ ENTRY(cpu_v7_do_suspend) mrc p15, 0, r8, c1, c0, 0 @ Control register mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control - stmia r0, {r5 - r11} + stmia r0, {r4 - r11} ldmfd sp!, {r4 - r10, pc} ENDPROC(cpu_v7_do_suspend) @@ -122,7 +123,8 @@ ENTRY(cpu_v7_do_resume) ldmia r0!, {r4 - r5} mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID - ldmia r0, {r5 - r11} + ldmia r0, {r4 - r11} + mcr p15, 0, r4, c15, c0, 1 @ Diagnostic register #ifdef CONFIG_MMU mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs mcr p15, 0, r6, c3, c0, 0 @ Domain ID