Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3714120pxv; Mon, 26 Jul 2021 10:03:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKltnWNDZSWKSOxi5tdrYv9KzrAK0vfKz4IJWvbI9xNR/l/XEPvXErAjRHPO0l3+gxZ/7q X-Received: by 2002:a05:6602:26d2:: with SMTP id g18mr15252323ioo.194.1627319024216; Mon, 26 Jul 2021 10:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627319024; cv=none; d=google.com; s=arc-20160816; b=LB+h7OTCG74NeCZdhvcFOy5UWHVrIC5NbDsyFLIJNClRqI7S6QAvEAAMMX1k1dfDzM GuwOSD2GaOD/Mbi8M+6mdBv7yHWvfHW2L04Dnyu5b9x11PpBtzrxvb0DYTWSMEoFIrKq x0S6DrrTayZJmY0jNwb0CJ06g/SliDSPeBZNnyIyKncWcrqtjGoXPaJ6mYLEzrJcbBzk 7tzCPRFc3rYqw9sx5qTbCGwQ01Ya9ivN80E1TXFRvbLDpRfXf2r5AXfTyPAjS5KHrWKi 2ienT1jVfa69d7URSUYkArcKCcI1K6zf0/A35wE96ZpyJ5PUIYi7fjP1PE64AOF1jvIZ +eNg== 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=EAN7EMhmVIKQokA3xb5ZxrI2PE//C2gh+m9VTMRbBIM=; b=J7l9RxAZg6EdC9/OVhn/VSyyk+3Xd/kmekDCzIQHpMv62lkD6+RMrt4ZLXvkvFs6bH MMogPCW5M14NoxQ+Y0vnDZXVMrfgxRMRDAaRICX/CPsDf+lXVJnEbVjQC+40F7MIJOld Fc5h50QKKrUVPGBL4tuNDM3FTrrhM7dBuN29idUkleD86f9E3C45cy5497QaSUmYCnwM Jjwcdcwdf7MPk5J9PK5bFnJxOutxTeBwDEYA3J0vHCUOz3A9Y3kGtgEA1fsAhu+PAkIQ Bk14tloGzqscQj2mqK0eonSyzAQQ6wQgftv3cNg/xwcU9+YF/nO+2YYrXiM4heQbS98O okLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eOymTWMi; 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 7si412714ilx.20.2021.07.26.10.03.31; Mon, 26 Jul 2021 10:03:44 -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=eOymTWMi; 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 S238294AbhGZPlT (ORCPT + 99 others); Mon, 26 Jul 2021 11:41:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:38674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237586AbhGZPXd (ORCPT ); Mon, 26 Jul 2021 11:23:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E06E60EB2; Mon, 26 Jul 2021 16:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315439; bh=1POvb3q8sXkM5MUEqr3DtHZxdsmMcT+D4Rk9QP51dZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOymTWMiJNNU9CyXBgeRPXcey8d3aEKmHL905W20DUl3gsTcHbvOuQxWVVBqEdwTy 90kMJ0MWeb+m3g4+OJ41nk1QYst5+rGrVhKt0fD4nbY4vwpApnUGuOqw9eVGuRC9Cv lToflRQend8NuCFI3i5XHjLhe1a2qHXijtENs2GA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 070/167] KVM: PPC: Book3S: Fix CONFIG_TRANSACTIONAL_MEM=n crash Date: Mon, 26 Jul 2021 17:38:23 +0200 Message-Id: <20210726153841.750285864@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153839.371771838@linuxfoundation.org> References: <20210726153839.371771838@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 [ Upstream commit bd31ecf44b8e18ccb1e5f6b50f85de6922a60de3 ] When running CPU_FTR_P9_TM_HV_ASSIST, HFSCR[TM] is set for the guest even if the host has CONFIG_TRANSACTIONAL_MEM=n, which causes it to be unprepared to handle guest exits while transactional. Normal guests don't have a problem because the HTM capability will not be advertised, but a rogue or buggy one could crash the host. Fixes: 4bb3c7a0208f ("KVM: PPC: Book3S HV: Work around transactional memory bugs in POWER9") Reported-by: Alexey Kardashevskiy Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210716024310.164448-1-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 2325b7a6e95f..bd7350a608d4 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -2366,8 +2366,10 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; if (cpu_has_feature(CPU_FTR_HVMODE)) { vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) vcpu->arch.hfscr |= HFSCR_TM; +#endif } if (cpu_has_feature(CPU_FTR_TM_COMP)) vcpu->arch.hfscr |= HFSCR_TM; -- 2.30.2