From patchwork Wed Aug 10 10:48:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 657663 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s8Sdb3mBDz9sDf for ; Wed, 10 Aug 2016 20:52:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=h4MpLFYJ; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s8Sdb2cNWzDr3S for ; Wed, 10 Aug 2016 20:52:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=h4MpLFYJ; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3s8SZj0N0RzDr1r for ; Wed, 10 Aug 2016 20:49:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=h4MpLFYJ; dkim-atps=neutral Received: by ozlabs.org (Postfix) id 3s8SZh6j2Bz9t1Q; Wed, 10 Aug 2016 20:49:32 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-pa0-x241.google.com (mail-pa0-x241.google.com [IPv6:2607:f8b0:400e:c03::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s8SZh34MTz9sR9 for ; Wed, 10 Aug 2016 20:49:32 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=h4MpLFYJ; dkim-atps=neutral Received: by mail-pa0-x241.google.com with SMTP id ez1so2666695pab.3 for ; Wed, 10 Aug 2016 03:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fQtYzZn2TLV28HXc8WtJdIsxeKN1RidQ4CwPt0lPRhk=; b=h4MpLFYJ7geUN3Nwog0EdHf/mpwwmpq+g8sDV1puwOVDV2Nbchwn6GCNsYwGNKe6po ueFvOc0a5FP8G8fp8ixsONq+fR+awJkoO/eK58V1CRSVSed46JbHESD6ODQX3znAZ9gb h4VR2E6JbepOPheneyIV/Rm0RNEOBTmnqM+IqdplxaBZRjqIAuTF7BRtbFKtCdnRkYWA 1aFBaD1fQdnFccSk71afiiIJbP+qLb9EJwVcRWXeLVAIHEcd6wIVDUVzRsdc/fvUfs/t vrivooTkaK5siH1B9i49XqCEU+7b9jIayf3qKgTnt49eCPGnh1WwIC4/kfBI1Hza0yVN jKqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fQtYzZn2TLV28HXc8WtJdIsxeKN1RidQ4CwPt0lPRhk=; b=VSca05pQcuwm8mKJj8q9/sgpJgCYAIQieXAiEOu6lVDvnC1xf4vPdHyqEcqBfr59gQ Vl80SsDaEitKil4P5IhO4UTzel6MHLD8ryWs8PgsOnNQ0rTJQRtkS8pipj6xegpJyCv5 nm/Aw2zdZuYRDLqX+OjRDydKDehpi39GRU4KQIVs4QOen0PMuzea9W72P5ke+GJZOHd1 SbkN4Z6OW/7XwNzbeI6hTIy0+E7ja53M6n8gECcCHL1s8oEoORqAk9bTpBi4IbWRz28r 6qQ3J3O/pTnmedVrQe1qxMgroUjS77+Rl3sUHzLO82fIWKiIqRHn9BLGsNqtD7one2P1 Hohg== X-Gm-Message-State: AEkoouuBIqCHLPErNPfl7Gd6CRYqDLqknMXu9n72/6fq54Zs+RYnBYmgPeovVl1776t3kg== X-Received: by 10.66.88.131 with SMTP id bg3mr5929966pab.43.1470826151396; Wed, 10 Aug 2016 03:49:11 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id os8sm47808783pab.6.2016.08.10.03.49.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 03:49:10 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@ozlabs.org Subject: [PATCH 2/2] powerpc/pseries: PACA save area fix for MCE vs MCE Date: Wed, 10 Aug 2016 20:48:43 +1000 Message-Id: <1470826123-14699-3-git-send-email-npiggin@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470826005-14520-1-git-send-email-npiggin@gmail.com> References: <1470826005-14520-1-git-send-email-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stewart Smith , Mahesh Salgaonkar , Nicholas Piggin , "Shreyas B . Prabhu" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" MCE must not enable MSR_RI until PACA_EXMC is no longer being used. --- arch/powerpc/kernel/exceptions-64s.S | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 4174c4e..e20ad27 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -500,7 +500,23 @@ machine_check_fwnmi: EXCEPTION_PROLOG_0(PACA_EXMC) machine_check_pSeries_0: EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200) - EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD) + /* + * The following is essentially EXCEPTION_PROLOG_PSERIES_1 with the + * difference that MSR_RI is not enabled, because PACA_EXMC is being + * used, so nested machine check corrupts it. machine_check_common + * enables MSR_RI. + */ + ld r12,PACAKBASE(r13) + ld r10,PACAKMSR(r13) + xori r10,r10,MSR_RI + mfspr r11,SPRN_SRR0 + LOAD_HANDLER(r12, machine_check_common) + mtspr SPRN_SRR0,r12 + mfspr r12,SPRN_SRR1 + mtspr SPRN_SRR1,r10 + rfid + b . /* prevent speculative execution */ + KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200) KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300) KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380) @@ -992,6 +1008,9 @@ machine_check_common: RECONCILE_IRQ_STATE(r10, r11) ld r3,PACA_EXMC+EX_DAR(r13) lwz r4,PACA_EXMC+EX_DSISR(r13) + /* Enable MSR_RI when finished with PACA_EXMC */ + li r10,MSR_RI + mtmsrd r10,1 std r3,_DAR(r1) std r4,_DSISR(r1) bl save_nvgprs