Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3675499pxv; Mon, 26 Jul 2021 09:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1ObsxyxrlvnslpNAYin9Mqz/QUKo/pVsKEU+tvpSwj5kO7Snnn1FYobW0WksOTEVsPw09 X-Received: by 2002:a17:906:144e:: with SMTP id q14mr17788736ejc.19.1627315862760; Mon, 26 Jul 2021 09:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627315862; cv=none; d=google.com; s=arc-20160816; b=QI4rXMbJ1tiqogV/SqBQw24lJbLzBXUMwi8DBhf5zssB58fx2n1JWMgJ34iF2FxM5i 51eif2qr+6ULnjLORnEhB4VX15yc9OtuxiGLtZcBlJR1zl2cHn3VFMzqIPzDlUgQSAQn 3TeUANUFelqhEqaYhF7bsQ7RXi5/3voSrvXvlOSex30gweLu6KXDxmKkFD8GINLXg6hJ T5QRryYAHndBJG6htYndeTAn7tk59J8Dhd5vU2ptEXzfmRq/uI2IjZ+/P4/l/+WZqSN9 LlKIx6861uDxTCQUJpiwx+wHzzmf3cBArgJM8EYTICViXFFpVu+h5/QndGzluINZtN0a BpDQ== 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=5ufT68CuDQCR/fG0v9pgET0a1Ljse3+VFIeJELz7rqY=; b=c0qsQ51TLYBS74N607TVa2SuQRfW3wYnjRVJuwwtIF0HpHj4Snz8pJxAgM29qp2+Xz lehNiOW1lrnp9LUwwkRxfRKerkUrW62dEvdfeLUbReIvakDgDwZ9+nmp92g1h1O04ces wJd3YJNkHZAcOsCXuDUI6Py4rwKZCWkfpMVXOra491NqNLMIyMBP8yqkLlEGJ3ZWwUmz XC25LbFSWxllyt40w9aevnMGd3P3AEKacuEjpJ7bmaiV7mvk6f70ohbVlatorR8h9TsI 6MLbD0sw42wU2ooSc8XUtbg7puxxijDmBROrZfpat3QRa2MyO81Tqtf/SaFah1uIjMgb 67zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=we3brTP4; 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 i5si284533edt.602.2021.07.26.09.10.39; Mon, 26 Jul 2021 09:11:02 -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=we3brTP4; 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 S232390AbhGZP2c (ORCPT + 99 others); Mon, 26 Jul 2021 11:28:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:55604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237533AbhGZPQB (ORCPT ); Mon, 26 Jul 2021 11:16:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE53D6056C; Mon, 26 Jul 2021 15:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627314989; bh=tiFFVu6cjKJ+hbq+PXJmlBpBZ4swHxEAWrxiHdbUY5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=we3brTP4DGNtT0HEC+WA1ZFzDYwUtmDCIa1/wnX3OfLlx1mns2NzOXQxq+51PqYGx vG7fTwNh/asEcDSfEhjPTa0BGzAd5pAVkfvSL0djy6IlTggF/A9N70cX94fkAEi2HH 4elefsgVxvTC6lgcD9QAQPxtqa/1Ry99Qg6fL9fA= 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.4 044/108] KVM: PPC: Book3S: Fix CONFIG_TRANSACTIONAL_MEM=n crash Date: Mon, 26 Jul 2021 17:38:45 +0200 Message-Id: <20210726153833.101099140@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153831.696295003@linuxfoundation.org> References: <20210726153831.696295003@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 9011857c0434..bba358f13471 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -2306,8 +2306,10 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm, HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; 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