Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9938154ybi; Wed, 24 Jul 2019 12:40:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqytx8rfJHOD1OdGv3txL4wWhfx2n55bESWDlheXYoxlC7lq1DV/o4CWXy8jEtI3jauwdBPt X-Received: by 2002:a17:902:d917:: with SMTP id c23mr87388904plz.248.1563997227730; Wed, 24 Jul 2019 12:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563997227; cv=none; d=google.com; s=arc-20160816; b=vwq1Ii9woNtBkKoyF8/A6CJ6hN3IfWeMNSjyNNxKr9KkxxrobZOM9+Xc9c1Elnh3g3 qcNTl8Ix+P6vJ9h39iO2sJM8LJ1zDW6vr1KHy6y9tBL6HFA+2KY7tur+zQkD2UgwhLaA K3zJxgVIl/93/f5jQ5slF8EqJDwCw72b0qCo8ygq/V75NWbk0nGyyuN7/VX2AGlCxheW ByI7R4VCjtNSwvD1G3cD+Gd18hABQKeojmHi8pLxvk8NWH9Qh+XAcqI6+4wIIvyNTysc MVTBIRBsJnvIZmhbUDVRvm4hqEdDgFjmDGCJder8aYxcRlB6RrdKa4/dFx86OTnV0kX2 jp6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zVu8cZMN7SCUot6vzPiENbUEbZ+i6w1YdAV1NBA+gCA=; b=HH81T1MybyHzFpt0ga6obKvG2OFESy6FyTdbBTyDE5tHqPOyw3HR6LBgsTDNrKTrEW CX/0+jGsMHQ5umm7UyiXHLyJ9IFa9dhvaC5RFMT+KlWy3n4bRRviWLzn8dGpgNw58Hfd 910djsvuV7oB/YqWTdOoK5hSuvxzB0ss/ZC4H3hfTjaOhZy9b+MkbU2XkK2qsjxrdyxl OAmSqyfkyJ0qFsL4u/gIIR4VCCOISul3BmBytWPFNbt8GOnnhKEVhd9/cUDoPSerJ/Mh D9x4SdF+YR+SFAuX/DZ4l+fsliNAUUKcgFsLqqmjfEIHR6Mxt8XOgHoMSOxCwvOIBnGY 27Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dMP5qTl3; 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 207si18368065pfu.258.2019.07.24.12.40.13; Wed, 24 Jul 2019 12:40:27 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=dMP5qTl3; 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 S2389848AbfGXTjE (ORCPT + 99 others); Wed, 24 Jul 2019 15:39:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389063AbfGXTjC (ORCPT ); Wed, 24 Jul 2019 15:39:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D25822ADA; Wed, 24 Jul 2019 19:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997142; bh=ORC6eTDK2VYgx5goqOcD4F+nOhoZY/xvzPSzuNIr0xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMP5qTl3ZjK3iefyVDvo9qYqWyf020UriZPHavkiPoQ3vu+Bty23XORtbRer7cnBA HyZPzy13YQPxitRrge1Nzg1UuFGEFTqKSeEq6cb43q1uLtkrPmFj0GR5onZ6X7ULmA v9Q80f4OkI8BB8BId3MMc9uQz7upjZ3sotOCs1Ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suraj Jitindar Singh , Michael Neuling , Michael Ellerman Subject: [PATCH 5.2 334/413] KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation Date: Wed, 24 Jul 2019 21:20:25 +0200 Message-Id: <20190724191759.719826993@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Neuling commit 3fefd1cd95df04da67c83c1cb93b663f04b3324f upstream. When emulating tsr, treclaim and trechkpt, we incorrectly set CR0. The code currently sets: CR0 <- 00 || MSR[TS] but according to the ISA it should be: CR0 <- 0 || MSR[TS] || 0 This fixes the bit shift to put the bits in the correct location. This is a data integrity issue as CR0 is corrupted. Fixes: 4bb3c7a0208f ("KVM: PPC: Book3S HV: Work around transactional memory bugs in POWER9") Cc: stable@vger.kernel.org # v4.17+ Tested-by: Suraj Jitindar Singh Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_hv_tm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/powerpc/kvm/book3s_hv_tm.c +++ b/arch/powerpc/kvm/book3s_hv_tm.c @@ -128,7 +128,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp } /* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr & 0x0fffffff) | - (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 28); + (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 29); /* L=1 => tresume, L=0 => tsuspend */ if (instr & (1 << 21)) { if (MSR_TM_SUSPENDED(msr)) @@ -172,7 +172,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp /* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr & 0x0fffffff) | - (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 28); + (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 29); vcpu->arch.shregs.msr &= ~MSR_TS_MASK; return RESUME_GUEST; @@ -202,7 +202,7 @@ int kvmhv_p9_tm_emulation(struct kvm_vcp /* Set CR0 to indicate previous transactional state */ vcpu->arch.regs.ccr = (vcpu->arch.regs.ccr & 0x0fffffff) | - (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 28); + (((msr & MSR_TS_MASK) >> MSR_TS_S_LG) << 29); vcpu->arch.shregs.msr = msr | MSR_TS_S; return RESUME_GUEST; }