From patchwork Mon Aug 6 13:27:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 1279201 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C9C46E00F0 for ; Mon, 6 Aug 2012 13:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755910Ab2HFN1h (ORCPT ); Mon, 6 Aug 2012 09:27:37 -0400 Received: from co1ehsobe004.messaging.microsoft.com ([216.32.180.187]:38338 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755901Ab2HFN1f (ORCPT ); Mon, 6 Aug 2012 09:27:35 -0400 Received: from mail59-co1-R.bigfish.com (10.243.78.231) by CO1EHSOBE015.bigfish.com (10.243.66.78) with Microsoft SMTP Server id 14.1.225.23; Mon, 6 Aug 2012 13:27:33 +0000 Received: from mail59-co1 (localhost [127.0.0.1]) by mail59-co1-R.bigfish.com (Postfix) with ESMTP id 5B66188023D; Mon, 6 Aug 2012 13:27:33 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839hd24he5bhf0ah) Received: from mail59-co1 (localhost.localdomain [127.0.0.1]) by mail59-co1 (MessageSwitch) id 1344259651504722_27655; Mon, 6 Aug 2012 13:27:31 +0000 (UTC) Received: from CO1EHSMHS016.bigfish.com (unknown [10.243.78.232]) by mail59-co1.bigfish.com (Postfix) with ESMTP id 674FF400044; Mon, 6 Aug 2012 13:27:31 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS016.bigfish.com (10.243.66.26) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 6 Aug 2012 13:27:29 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.298.5; Mon, 6 Aug 2012 08:27:22 -0500 Received: from mcaraman-VirtualBox.ea.freescale.net ([10.213.130.145]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q76DRLqR012102; Mon, 6 Aug 2012 06:27:21 -0700 Received: from mcaraman-VirtualBox.ea.freescale.net (localhost [127.0.0.1]) by mcaraman-VirtualBox.ea.freescale.net (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q76DRIgL031227; Mon, 6 Aug 2012 16:27:18 +0300 Received: (from mcaraman@localhost) by mcaraman-VirtualBox.ea.freescale.net (8.14.4/8.14.4/Submit) id q76DRIMp031226; Mon, 6 Aug 2012 16:27:18 +0300 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH 6/6] powerpc/booke64: restore VDSO information on critical exception Date: Mon, 6 Aug 2012 16:27:08 +0300 Message-ID: <1344259628-31161-7-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1344259628-31161-1-git-send-email-mihai.caraman@freescale.com> References: <1344259628-31161-1-git-send-email-mihai.caraman@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Critical exception handler on 64-bit booke uses user-visible SPRG3 as scratch. Restore VDSO information in SPRG3 on exception prolog. Signed-off-by: Mihai Caraman --- arch/powerpc/include/asm/paca.h | 3 +++ arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/exceptions-64e.S | 4 +++- arch/powerpc/kernel/vdso.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index daf813f..6b98ad4 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -118,6 +118,9 @@ struct paca_struct { void *mc_kstack; void *crit_kstack; void *dbg_kstack; + + /* User-visible sprg information */ + ulong sprg3; #endif /* CONFIG_PPC_BOOK3E */ mm_context_t context; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 85b05c4..8ca338d 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -168,6 +168,7 @@ int main(void) DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack)); DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack)); DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack)); + DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3)); #endif /* CONFIG_PPC_BOOK3E */ #ifdef CONFIG_PPC_STD_MMU_64 diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S index 7476b0a..87a82fb 100644 --- a/arch/powerpc/kernel/exceptions-64e.S +++ b/arch/powerpc/kernel/exceptions-64e.S @@ -110,7 +110,9 @@ #define PROLOG_STORE_RESTORE_SCRATCH_CRIT \ mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \ - std r10,PACA_EXCRIT+EX_R13(r13) + std r10,PACA_EXCRIT+EX_R13(r13); \ + ld r11,PACA_SPRG3(r13); \ + mtspr SPRN_SPRG_CRIT_SCRATCH,r11; /* Variants of the "addition" argument for the prolog */ diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index b67db22..a0b0d08 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c @@ -725,6 +725,8 @@ int __cpuinit vdso_getcpu_init(void) mtspr(SPRN_SPRG3, val); #ifdef CONFIG_KVM_BOOK3S_HANDLER get_paca()->kvm_hstate.sprg3 = val; +#elif CONFIG_PPC_BOOK3E + get_paca()->sprg3 = val; #endif put_cpu();