Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10489735ybi; Thu, 25 Jul 2019 00:13:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkRlxbMoNu8SzeLvbLnZzeI0KW75+RjVZirmScuNaWfdc/7UfgJiTTIzDlqt9+fkPsQFQm X-Received: by 2002:a17:90a:e38f:: with SMTP id b15mr93253112pjz.85.1564038798937; Thu, 25 Jul 2019 00:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564038798; cv=none; d=google.com; s=arc-20160816; b=cUVIycNFRViKN64JlU9c8ja+y3o37umw1bpTYKJiaS1zCFp0elGokCH5kIFPAop0mI oCNDy4RbYTHfVrK6HAUb0HtTi50bYllmZV0/2TeBfRn+pZCL/qyWwBSWUwCF7KQqFN6i dMdZVDXDCZuU1KVhiQvqRNSUbHHmSpMQEhv6rHLwumMYiRgayolyU7lDWps15+2CGp8U EMKgT8ZTsK3lUtqCOpKgi3kUkiUiZ0ArhR4GVE8m2vvBttdCdafEfnTbV9wYH2On1nx6 13Zk+g9xxnNRH4XY6EfCIA17oekH2N0ce/5si1OWlLWGQbblC/LuQbYwLNPmIcuVvL6c 0StQ== 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=c19IxkIakredfXQoD3AdWDwdJoTE9uPS4Ormveuw7EY=; b=bAt24WjMdDYszWzpGuHzWj/eg1XhgVTsmUHGaLS0cie79ohzB1b7BHQZ9ohqkbaMhS 5jV80pMhCH5FGHWmUZ8gxOrq/pGibYaFQQmgLD0JFO+lMt79mjUPe8YxeU1oGFnyUqTO qyL3u7x9OEUr878R6q2LmEuq9san+exruyYV2Pf/cqAUUA/1qiVJsK4LqRfF01F2fzR8 zM8YlTt/1M5KBIdWlToEBZ7VhmLlAbZHOGgaX6K5vCFpsuozpgga0fgve2wOGxkodZZS hGw0KYLaOoCWS0yshEm3Ka7v0FmqTvFQ07TNfabQWnA/sIDUOllCgMvCtJsMxE5Lpshy vCjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DZUI9LHZ; 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 p44si16825166pjp.0.2019.07.25.00.13.04; Thu, 25 Jul 2019 00:13:18 -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=DZUI9LHZ; 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 S2405015AbfGXT7n (ORCPT + 99 others); Wed, 24 Jul 2019 15:59:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:47084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405016AbfGXT7l (ORCPT ); Wed, 24 Jul 2019 15:59:41 -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 BF80820665; Wed, 24 Jul 2019 19:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998380; bh=Ngj/6pvjKZW/raTWO60ugt8+TssqU8ljcYQSAYAJuHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZUI9LHZzkWTTHINUdc6vu3f9yFm1Qw8e1pW21NgBZoiShFYMomzfShUjdMhJtHFj fxZr7LTVWnpK6ZMP5Ywgc0vYYp12Zx/IRA0zYQtyAYP9WzPOnTmnBPoAilAFW7j3j1 NzPx9ijk5wk0/Kd75rtu/p2DW6R5MF7IO6oCDmM4= 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.1 304/371] KVM: PPC: Book3S HV: Fix CR0 setting in TM emulation Date: Wed, 24 Jul 2019 21:20:56 +0200 Message-Id: <20190724191747.099345936@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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 @@ -131,7 +131,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)) @@ -175,7 +175,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; @@ -205,7 +205,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; }