From patchwork Tue Feb 27 17:37:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: simon X-Patchwork-Id: 10245867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3173260384 for ; Tue, 27 Feb 2018 17:38:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 219772879B for ; Tue, 27 Feb 2018 17:38:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1605A28A1D; Tue, 27 Feb 2018 17:38:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBECB2879B for ; Tue, 27 Feb 2018 17:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbeB0Ril (ORCPT ); Tue, 27 Feb 2018 12:38:41 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43220 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbeB0Rij (ORCPT ); Tue, 27 Feb 2018 12:38:39 -0500 Received: by mail-pl0-f66.google.com with SMTP id f23so11795801plr.10; Tue, 27 Feb 2018 09:38:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EX0SeHmFIT/poYp1Yi7Yh+2Mh0DOXWVhb6fupbNkcmY=; b=FiWqL8abze+g81ycRjzZI/YQ7Jem279hHvpKyY8tvmZuGoLYEbHCzLe8zIDF8is2I+ feI+hnAZMuLe8zzcOJQa7c83GEhqAgjaZfvhqZSuhmAPax4nCISneMX0J4DnsGaRxwzO x6zNGbMgGX7oS98WYbw3wq7N5vpqdwM9358WKLfsmHaN8Hvcuql86AzDMlx5OhCZ258U QOfhOysZrAg3lR9W1cCKXpNw6fhGwDWrvjhe4wyI+QtqT3AiGCzqzIg/WIK9uREF/yn9 xIt1W1u7XVv+7d9qu3CBAxh12cnhY7aLTsXka3MlLo0+4AfvYy4PiwpvhYV5MSGVWx7L gszw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EX0SeHmFIT/poYp1Yi7Yh+2Mh0DOXWVhb6fupbNkcmY=; b=Yc5i/uA6vVJQbndTEo7SlPoB3CoidM35kAlQr/PidoeiSO6Bj2DNHlkQzYJIZVuGXN RFez2Us4Ha7BeM2VMJxBfnNsz1/XGUHGsArdXdBYHWYENl7LlHpxNb0nam5CwVL77Im8 S8IjQ9tQ6vVic7Cy/4rnQlW/a34pzLzvjzGqUpDDpv2etJSjI0/OfQeU30pDordlL69S 75BLVVbSFplEuzd0G1VnwA35IgAsWZQH0QHaDXU7UmYaM652Mo1YhpSDDILMu/uAK+YJ F5GMIV7dFeQsUcpdibg5Ww1FJ5XvAAwlbG7I4u0yHo5Ach3aVW8m6yw0Mdaw+rIW3IiV 9jOw== X-Gm-Message-State: APf1xPB+1MrS2w0opwkj5oWXKvqTNaYDOGJxoumBSp8skxIFl2FFoezx grWgHKQhXL8ROfOFyrbKhtVrvw== X-Google-Smtp-Source: AH8x224B3TT/7yi2jpMeemgsZseZAN2+L8RUHdc5jyCoZy7NsOm0QbfMdAs+dsC0OHW/jw2FbYdsRQ== X-Received: by 2002:a17:902:6bc6:: with SMTP id m6-v6mr15305495plt.100.1519753118870; Tue, 27 Feb 2018 09:38:38 -0800 (PST) Received: from simonLocalRHEL7.x64 ([101.80.181.226]) by smtp.gmail.com with ESMTPSA id q87sm14734143pfa.29.2018.02.27.09.38.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Feb 2018 09:38:38 -0800 (PST) From: wei.guo.simon@gmail.com To: linuxppc-dev@lists.ozlabs.org Cc: Paul Mackerras , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Simon Guo Subject: [PATCH v2 09/30] KVM: PPC: Book3S PR: PR KVM pass through MSR TM/TS bits to shadow_msr. Date: Wed, 28 Feb 2018 01:37:16 +0800 Message-Id: <1519753057-11059-10-git-send-email-wei.guo.simon@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1519753057-11059-1-git-send-email-wei.guo.simon@gmail.com> References: <1519753057-11059-1-git-send-email-wei.guo.simon@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Simon Guo PowerPC TM functionality needs MSR TM/TS bits support in hardware level. Guest TM functionality can not be emulated with "fake" MSR (msr in magic page) TS bits. This patch syncs TM/TS bits in shadow_msr with the MSR value in magic page, so that the MSR TS value which guest sees is consistent with actual MSR bits running in guest. Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras --- arch/powerpc/kvm/book3s_pr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 7deaeeb..5c9e43f 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c @@ -323,7 +323,12 @@ static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu) ulong smsr = guest_msr; /* Guest MSR values */ +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM + smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_LE | + MSR_TM | MSR_TS_MASK; +#else smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_LE; +#endif /* Process MSR values */ smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE; /* External providers the guest reserved */