Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4366567pxj; Tue, 8 Jun 2021 12:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVpw2NM7u+G7zOnxqfW2BC6QuU6shQ4+U7YufranB70JdObunO/QqRx1CZfQMjXd1C4ahm X-Received: by 2002:a17:906:c42:: with SMTP id t2mr25357286ejf.68.1623180734863; Tue, 08 Jun 2021 12:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623180734; cv=none; d=google.com; s=arc-20160816; b=wm1g2/nzSFz8fsuLsiYwxtRNaABkb3v0S701fVKPlnNpJ0p8ZKtKyNNYkhe2FQjPLt wW1Cm1a9+dsi4Wna4S05Tvba7reaEaANWjfBPQ3CduZ8IaTh4VfD07V1oKSkAgPtRD2w 7fZLxRLIWmAodphgE3B98iJVfCySIVXMAooPRtmkJHDdc/Ryj93QHJLFNFBHqA0MLoIm isv4uh+dznkvmUhcUnJMNZBr7iJ+gpE2NwzhQ9j7fpdJRaBA3KKLNZBqYEY9lkXdB4/M IkKH8m6bosVfbJIsLVOt0sflgJq50X/3JI0zHoNtiHKFElfSe28XEjQ+5UL/SK/jV3Dm gCiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wRrpRD96mNaBkheCdXZupmIUga3pagVgEoaNaNJ6Qm8=; b=Kpqx7PkWodDz3RK/F9XnNzdDxfToNw0ix81BAedfqpxECLKxAxLCa006vv36/eABDQ qf9VWPIri/6ocDAh55p6qGOek3SY4UrYK5fG7+DYQyRBEEqIQR+z6IvyzGMLRqCw/WgG MmfDFpfi8zBguIRZQwoQa3YsKlo3dj6Ds5Xtvw4Od16cK5D1a8Fx9NzrxRyOZprYhXtX bHIAmXEtEGeqSixMmT05nIp/2Aj4RAJcUJmAGaaMtkAw5bcOKw7MLoGeuuAA5UFyjZ8o d+Yu80LlSaMRO/F1aY3CJ7i9Yvz+JZtncw+3AcAmOZeDZi0VJqdthswFu3hcGNBhuHQe pfoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1yp1P40y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si410233ejg.401.2021.06.08.12.31.51; Tue, 08 Jun 2021 12:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1yp1P40y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237692AbhFHT2x (ORCPT + 99 others); Tue, 8 Jun 2021 15:28:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237413AbhFHTP4 (ORCPT ); Tue, 8 Jun 2021 15:15:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A35461961; Tue, 8 Jun 2021 18:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623178250; bh=4ddSBV52IP3ArNMigX3kU2VUXDvUeF9NBjityjzBDeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1yp1P40ys2WJqJAIRLgGhTab56gdB1mlkYzMr+7eqUIi/UNUEEnfGXqAWHFULgpS6 zNNdzD4klkDWhQimMl1DFIdWYVqsZk+MjkgvvdBa+qzRAjW54LAGByNnjHirrytqpd oEVXEtDuII91ZASyP7CpHxZy6XaCxHPDAMD5Jhdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Fabiano Rosas , Michael Ellerman Subject: [PATCH 5.12 133/161] KVM: PPC: Book3S HV: Save host FSCR in the P7/8 path Date: Tue, 8 Jun 2021 20:27:43 +0200 Message-Id: <20210608175949.943194998@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175945.476074951@linuxfoundation.org> References: <20210608175945.476074951@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Piggin commit 1438709e6328925ef496dafd467dbd0353137434 upstream. Similar to commit 25edcc50d76c ("KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path"), ensure the P7/8 path saves and restores the host FSCR. The logic explained in that patch actually applies there to the old path well: a context switch can be made before kvmppc_vcpu_run_hv restores the host FSCR and returns. Now both the p9 and the p7/8 paths now save and restore their FSCR, it no longer needs to be restored at the end of kvmppc_vcpu_run_hv Fixes: b005255e12a3 ("KVM: PPC: Book3S HV: Context-switch new POWER8 SPRs") Cc: stable@vger.kernel.org # v3.14+ Signed-off-by: Nicholas Piggin Reviewed-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210526125851.3436735-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_hv.c | 1 - arch/powerpc/kvm/book3s_hv_rmhandlers.S | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -4418,7 +4418,6 @@ static int kvmppc_vcpu_run_hv(struct kvm mtspr(SPRN_EBBRR, ebb_regs[1]); mtspr(SPRN_BESCR, ebb_regs[2]); mtspr(SPRN_TAR, user_tar); - mtspr(SPRN_FSCR, current->thread.fscr); } mtspr(SPRN_VRSAVE, user_vrsave); --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -59,6 +59,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) #define STACK_SLOT_UAMOR (SFS-88) #define STACK_SLOT_DAWR1 (SFS-96) #define STACK_SLOT_DAWRX1 (SFS-104) +#define STACK_SLOT_FSCR (SFS-112) /* the following is used by the P9 short path */ #define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */ @@ -686,6 +687,8 @@ BEGIN_FTR_SECTION std r6, STACK_SLOT_DAWR0(r1) std r7, STACK_SLOT_DAWRX0(r1) std r8, STACK_SLOT_IAMR(r1) + mfspr r5, SPRN_FSCR + std r5, STACK_SLOT_FSCR(r1) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) BEGIN_FTR_SECTION mfspr r6, SPRN_DAWR1 @@ -1663,6 +1666,10 @@ FTR_SECTION_ELSE ld r7, STACK_SLOT_HFSCR(r1) mtspr SPRN_HFSCR, r7 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) +BEGIN_FTR_SECTION + ld r5, STACK_SLOT_FSCR(r1) + mtspr SPRN_FSCR, r5 +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) /* * Restore various registers to 0, where non-zero values * set by the guest could disrupt the host.