Received: by 10.223.176.5 with SMTP id f5csp726299wra; Fri, 9 Feb 2018 06:17:34 -0800 (PST) X-Google-Smtp-Source: AH8x225MAiug47mLTtLS89neq599kbfrYDDleDwgbt35xYedg762D7elOM5xR0tnnxzoiIvfaRe/ X-Received: by 2002:a17:902:25ab:: with SMTP id y40-v6mr2834044pla.140.1518185854042; Fri, 09 Feb 2018 06:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185854; cv=none; d=google.com; s=arc-20160816; b=ReiAZIgd/eLwWsdB6pxtl3/u0pxDDy7SZSvyVKBDDulZLrj1Srenu3KFL4Rct+RYri KlrEeCMbcUAvcpOYNBcOVhQhFX88+j+9qoGsdn9Fo+M458cqtKP7ZtMEX+BCnopib816 P+oi7lU3kqVQ8dbrysU3VqvEJbHLYROVOHdqFXa9LLglLm3TZCKl+Kdz0hGIUgb1UMlb 1CeHIQtAHbg2yGwcSfNke5bnOMHCSboGCwHdhzTij1/+YemhqqBVHZ5OGhApxPqvesF6 ensJ582mGlnsO95vwAm+zU7EOmOVvEnLIeB1/4Goh4llrgRhbwjU7c04gX4cwmIZd1Ay kqAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tUf098qNjlY/u8w9/O4D+a0pME8C9bIEMUjbbRzyCZU=; b=ZlbpWyi62DR0ZibwNcUE6diaigDyaRxMg742f3YBkyamaUF5TcnwyNo0ya5Z++D/z9 g6ve4aUR6q2SYGqE6OBs/tgm9wmb4WfVyn/E88x4V1whK+hwOmtgm39THUQ3sl2JRkRo n387WdrJoFwM2EAGT9I5L3pOmD3AL25vC2jhMs0gBMFqcyd9MAbm0CjlYDmPsShBlYnv HIVfE72mkxV5DtjLbaAO8i4EeCzlqxmSycM9Sg/sG5wZr9zULtKaOcTMmfGAegyEOlI6 GMaY9wJnOTNJRIgahhisDkd1GP+jV5Ykyt94+q7w+QKE63Ynrg5wgWBJesghvdFDxmBP s0Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si1576720plo.798.2018.02.09.06.17.19; Fri, 09 Feb 2018 06:17:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbeBINks (ORCPT + 99 others); Fri, 9 Feb 2018 08:40:48 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48258 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbeBINkq (ORCPT ); Fri, 9 Feb 2018 08:40:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3A90D1051; Fri, 9 Feb 2018 13:40:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 4.9 05/92] powerpc/64s: Convert slb_miss_common to use RFI_TO_USER/KERNEL Date: Fri, 9 Feb 2018 14:38:34 +0100 Message-Id: <20180209133931.683041548@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin commit c7305645eb0c1621351cfc104038831ae87c0053 upstream. In the SLB miss handler we may be returning to user or kernel. We need to add a check early on and save the result in the cr4 register, and then we bifurcate the return path based on that. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Nicholas Piggin [mpe: Backport to 4.4 based on patch from Balbir] Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/exceptions-64s.S | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -655,6 +655,8 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_R andi. r10,r12,MSR_RI /* check for unrecoverable exception */ beq- 2f + andi. r10,r12,MSR_PR /* check for user mode (PR != 0) */ + bne 1f /* All done -- return from exception. */ @@ -671,7 +673,23 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_R ld r11,PACA_EXSLB+EX_R11(r13) ld r12,PACA_EXSLB+EX_R12(r13) ld r13,PACA_EXSLB+EX_R13(r13) - rfid + RFI_TO_KERNEL + b . /* prevent speculative execution */ + +1: +.machine push +.machine "power4" + mtcrf 0x80,r9 + mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ +.machine pop + + RESTORE_PPR_PACA(PACA_EXSLB, r9) + ld r9,PACA_EXSLB+EX_R9(r13) + ld r10,PACA_EXSLB+EX_R10(r13) + ld r11,PACA_EXSLB+EX_R11(r13) + ld r12,PACA_EXSLB+EX_R12(r13) + ld r13,PACA_EXSLB+EX_R13(r13) + RFI_TO_USER b . /* prevent speculative execution */ 2: mfspr r11,SPRN_SRR0 @@ -679,7 +697,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_R mtspr SPRN_SRR0,r10 ld r10,PACAKMSR(r13) mtspr SPRN_SRR1,r10 - rfid + RFI_TO_KERNEL b . 8: mfspr r11,SPRN_SRR0