From patchwork Sun Jun 22 10:15:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4395911 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 9521FBEEAA for ; Sun, 22 Jun 2014 10:20:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AF2A20274 for ; Sun, 22 Jun 2014 10:20:23 +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 3A2BC20265 for ; Sun, 22 Jun 2014 10:20:22 +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 1Wyeob-0007EG-R3; Sun, 22 Jun 2014 10:16:01 +0000 Received: from mail-by2lp0242.outbound.protection.outlook.com ([207.46.163.242] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WyeoW-0007CK-PU for linux-arm-kernel@lists.infradead.org; Sun, 22 Jun 2014 10:15:57 +0000 Received: from BY2PR03CA037.namprd03.prod.outlook.com (10.242.234.158) by BY2PR03MB347.namprd03.prod.outlook.com (10.141.139.16) with Microsoft SMTP Server (TLS) id 15.0.969.15; Sun, 22 Jun 2014 10:15:33 +0000 Received: from BL2FFO11FD019.protection.gbl (2a01:111:f400:7c09::107) by BY2PR03CA037.outlook.office365.com (2a01:111:e400:2c2c::30) with Microsoft SMTP Server (TLS) id 15.0.969.15 via Frontend Transport; Sun, 22 Jun 2014 10:15:32 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD019.mail.protection.outlook.com (10.173.161.37) with Microsoft SMTP Server (TLS) id 15.0.969.12 via Frontend Transport; Sun, 22 Jun 2014 10:15:31 +0000 Received: from dragon.ap.freescale.net ([10.192.185.192]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s5MAFOvE003608; Sun, 22 Jun 2014 03:15:25 -0700 From: Shawn Guo To: Russell King Subject: [PATCH v2] ARM: save/restore diagnostic register on Cortex-A9 suspend/resume Date: Sun, 22 Jun 2014 18:15:19 +0800 Message-ID: <1403432119-1409-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)(46102001)(87286001)(95666004)(20776003)(47776003)(81156004)(68736004)(4396001)(31966008)(88136002)(21056001)(74662001)(74502001)(50986999)(87936001)(84676001)(81542001)(81342001)(97736001)(575784001)(86362001)(44976005)(83322001)(99396002)(19580395003)(77156001)(93916002)(19580405001)(69596002)(6806004)(102836001)(85306003)(92726001)(92566001)(50226001)(64706001)(104016002)(77982001)(106466001)(80022001)(36756003)(76482001)(89996001)(105606002)(104166001)(83072002)(85852003)(62966002)(79102001)(26826002)(33646001)(50466002)(48376002); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB347; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0250B840C1 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-20140622_031556_840398_60FE6A26 X-CRM114-Status: GOOD ( 10.12 ) X-Spam-Score: -0.7 (/) Cc: Nicolas Pitre , Catalin Marinas , Will Deacon , Shawn Guo , linux-arm-kernel@lists.infradead.org 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 Cortex-A9, 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. The patch adds a couple of Cortex-A9 specific suspend and resume functions to handle the diagnostic register across suspend/resume cycle. Signed-off-by: Shawn Guo --- Changes since v1: - Add Cortex-A9 specific processor function for suspend and resume to handle diagnostic register across suspend/resume cycle arch/arm/include/asm/glue-proc.h | 18 +++++++++--------- arch/arm/mm/proc-v7.S | 31 ++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/arch/arm/include/asm/glue-proc.h b/arch/arm/include/asm/glue-proc.h index 74a8b84f3cb1..74be7c22035a 100644 --- a/arch/arm/include/asm/glue-proc.h +++ b/arch/arm/include/asm/glue-proc.h @@ -221,15 +221,6 @@ # endif #endif -#ifdef CONFIG_CPU_V7 -# ifdef CPU_NAME -# undef MULTI_CPU -# define MULTI_CPU -# else -# define CPU_NAME cpu_v7 -# endif -#endif - #ifdef CONFIG_CPU_V7M # ifdef CPU_NAME # undef MULTI_CPU @@ -248,6 +239,15 @@ # endif #endif +#ifdef CONFIG_CPU_V7 +/* + * Cortex-A9 needs a different suspend/resume function, so we need + * multiple CPU support for ARMv7 anyway. + */ +# undef MULTI_CPU +# define MULTI_CPU +#endif + #ifndef MULTI_CPU #define cpu_proc_init __glue(CPU_NAME,_proc_init) #define cpu_proc_fin __glue(CPU_NAME,_proc_fin) diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 3db2c2f04a30..e26bfaa419ee 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -152,6 +152,34 @@ ENTRY(cpu_v7_do_resume) ENDPROC(cpu_v7_do_resume) #endif +/* + * Cortex-A9 processor functions + */ + globl_equ cpu_ca9mp_proc_init, cpu_v7_proc_init + globl_equ cpu_ca9mp_proc_fin, cpu_v7_proc_fin + globl_equ cpu_ca9mp_reset, cpu_v7_reset + globl_equ cpu_ca9mp_do_idle, cpu_v7_do_idle + globl_equ cpu_ca9mp_dcache_clean_area, cpu_v7_dcache_clean_area + globl_equ cpu_ca9mp_switch_mm, cpu_v7_switch_mm + globl_equ cpu_ca9mp_set_pte_ext, cpu_v7_set_pte_ext +.globl cpu_ca9mp_suspend_size +.equ cpu_ca9mp_suspend_size, cpu_v7_suspend_size + 1 * 4 +#ifdef CONFIG_ARM_CPU_SUSPEND +ENTRY(cpu_ca9mp_do_suspend) + stmfd sp!, {r4} + mrc p15, 0, r4, c15, c0, 1 @ Diagnostic register + stmia r0!, {r4} + ldmfd sp!, {r4} + b cpu_v7_do_suspend +ENDPROC(cpu_ca9mp_do_suspend) + +ENTRY(cpu_ca9mp_do_resume) + ldmia r0!, {r4} + mcr p15, 0, r4, c15, c0, 1 @ Diagnostic register + b cpu_v7_do_resume +ENDPROC(cpu_ca9mp_do_resume) +#endif + #ifdef CONFIG_CPU_PJ4B globl_equ cpu_pj4b_switch_mm, cpu_v7_switch_mm globl_equ cpu_pj4b_set_pte_ext, cpu_v7_set_pte_ext @@ -418,6 +446,7 @@ __v7_setup_stack: @ define struct processor (see and proc-macros.S) define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 + define_processor_functions ca9mp, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 #ifdef CONFIG_CPU_PJ4B define_processor_functions pj4b, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 #endif @@ -470,7 +499,7 @@ __v7_ca5mp_proc_info: __v7_ca9mp_proc_info: .long 0x410fc090 .long 0xff0ffff0 - __v7_proc __v7_ca9mp_setup + __v7_proc __v7_ca9mp_setup, proc_fns = ca9mp_processor_functions .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info #endif /* CONFIG_ARM_LPAE */