From patchwork Tue Nov 24 10:37:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 62413 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAOAfQpq031921 for ; Tue, 24 Nov 2009 10:41:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932699AbZKXKks (ORCPT ); Tue, 24 Nov 2009 05:40:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932709AbZKXKks (ORCPT ); Tue, 24 Nov 2009 05:40:48 -0500 Received: from smtp.nokia.com ([192.100.105.134]:34510 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932708AbZKXKkr (ORCPT ); Tue, 24 Nov 2009 05:40:47 -0500 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAOAeiHW018295; Tue, 24 Nov 2009 04:40:48 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 24 Nov 2009 12:38:48 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 24 Nov 2009 12:38:40 +0200 Received: from localhost.localdomain (sokoban.ntc.nokia.com [172.22.144.95]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAOAcckE025719; Tue, 24 Nov 2009 12:38:39 +0200 From: Tero Kristo To: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Subject: [PATCH 1/2] ARM: Implemented support for VFP PM context saving Date: Tue, 24 Nov 2009 12:37:03 +0200 Message-Id: <1259059024-23719-2-git-send-email-tero.kristo@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1259059024-23719-1-git-send-email-tero.kristo@nokia.com> References: <> <1259059024-23719-1-git-send-email-tero.kristo@nokia.com> X-OriginalArrivalTime: 24 Nov 2009 10:38:40.0712 (UTC) FILETIME=[49A81C80:01CA6CF2] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 2d7423a..80a08bd 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -329,6 +329,31 @@ static void vfp_enable(void *unused) #ifdef CONFIG_PM #include +void vfp_pm_save_context(void) +{ + struct thread_info *thread = current_thread_info(); + u32 fpexc = fmrx(FPEXC); + __u32 cpu = thread->cpu; + + if (last_VFP_context[cpu]) { + if (!(fpexc & FPEXC_EN)) { + /* enable vfp now to save context */ + vfp_enable(NULL); + fmxr(FPEXC, fmrx(FPEXC) | FPEXC_EN); + } + vfp_save_state(last_VFP_context[cpu], fpexc); + + /* Disable vfp. The next inst traps an exception and restores*/ + fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); + + /* + * This is needed else the restore might fail if it sees + * last_VFP_context if same as the current threads vfp_state. + */ + last_VFP_context[cpu] = NULL; + } +} + static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state) { struct thread_info *ti = current_thread_info();