From patchwork Thu Nov 19 17:06:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 61373 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 nAJFCpdo015581 for ; Thu, 19 Nov 2009 15:13:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754760AbZKSPM5 (ORCPT ); Thu, 19 Nov 2009 10:12:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754392AbZKSPM5 (ORCPT ); Thu, 19 Nov 2009 10:12:57 -0500 Received: from smtp.nokia.com ([192.100.122.233]:19454 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754015AbZKSPM5 (ORCPT ); Thu, 19 Nov 2009 10:12:57 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAJFCd3u017381 for ; Thu, 19 Nov 2009 17:13:01 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 17:12:44 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 17:12:43 +0200 Received: from localhost.localdomain (sokoban.ntc.nokia.com [172.22.144.95]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAJFCd3Q010273 for ; Thu, 19 Nov 2009 17:12:41 +0200 From: Tero Kristo To: linux-omap@vger.kernel.org Subject: [PATCH 1/2] ARM: Implemented support for VFP PM context saving Date: Thu, 19 Nov 2009 19:06:14 +0200 Message-Id: <1258650375-9793-2-git-send-email-tero.kristo@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1258650375-9793-1-git-send-email-tero.kristo@nokia.com> References: <> <1258650375-9793-1-git-send-email-tero.kristo@nokia.com> X-OriginalArrivalTime: 19 Nov 2009 15:12:44.0057 (UTC) FILETIME=[BE96B090:01CA692A] 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();