Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp404980pxu; Tue, 1 Dec 2020 14:25:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhX68em1ceV9XF1svjJWGKIK4PwCny/Yrrynl0kUUHmiPYiKu9T4jZe6rF5G0ReChXRq9f X-Received: by 2002:a17:906:2e16:: with SMTP id n22mr5305239eji.477.1606861539821; Tue, 01 Dec 2020 14:25:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861539; cv=none; d=google.com; s=arc-20160816; b=qd8Sw/jEQ6vD4rmTpczCfS7S5whmv2h4umQ/axfnBea9R9dnQ8pf9kVZAYYKxcgR5R Bioi/h4KZviP3gcLZw/sLb+4qTyM92/m+02bdPrPV4DD2rr6yr1mYESbnLEvOrs9Hpr3 sHvb4dRwicvR1z1mJnFEyoGSjV3F0/6E52yCNWLrIiHqKXomhbCCCNd51LIQQtbCbquI oi50Z+sJFLOOTbYM3qKc2bDhFMJ+xZP6bBlV91uXTMCTorDVZUCd0FMx+FtExVdxyh5g nb0JxR4URhF3PQPL5RlTTgDaHyk4n/WtjfLr20V1DoSUtDgC3y9vzHTrBG12p9PSdPSU pCgw== 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=zQVgCbhdCrfAEEFXLlTL0W7eSkwsqFxuXipMoE9y//Y=; b=sg7MjOSB7+FYF8YQ9LuXM+MY5xt9hwOD4GI4Av49ev6T5bok45g+rcNXKgWELciyjr K1ZgAUz730BuqMMUav8YO2HftN5zJDw9Y6hsX0m4MWssbWQGSxU4JTU7ZHBU3+ZrCE8/ LtspMbos/fc7pxQTjU7JtAM5au3exSqwUg4xFE2CC30WOKSVCVuYZ74NrmoCwO2mTkRZ /2l3R1EHEp1W/rk5zVsBFYfMiKURDfyvbuni1S3rdr9M2ogi405CVMZys4R95DNvYFtB x4NrvVmTudF2jSijid54oiVr5a9SThZLU8TTZ9xu2yg3lIKmeERAlICzWddShVa0AjCW bmWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rGpOLu8V; 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 ck15si796434edb.37.2020.12.01.14.25.17; Tue, 01 Dec 2020 14:25:39 -0800 (PST) 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=rGpOLu8V; 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 S2389511AbgLAJJd (ORCPT + 99 others); Tue, 1 Dec 2020 04:09:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:46058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389266AbgLAJIg (ORCPT ); Tue, 1 Dec 2020 04:08:36 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 BDE2D22245; Tue, 1 Dec 2020 09:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813675; bh=OIl2PaLR6m+mUydIo7T59Uy4mlHqDn+kQDtyLPEktvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGpOLu8VQqTynyZLFGZkUaUiJHkgcZo8T8r2iJUqVsyMGsfeXRCSmzLBmjmLJ9WCw Yvwz7XY73iQhAwgQUiSrdZJfoLUbLooaNY6QuhfKILZrqw1kXfpsU8BSlHsmq/Ugfy LJizv9BpRIZ+KF8XRzNPewUiT9+xLgGQPyKcKHe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman Subject: [PATCH 5.9 021/152] powerpc/64s/exception: KVM Fix for host DSI being taken in HPT guest MMU context Date: Tue, 1 Dec 2020 09:52:16 +0100 Message-Id: <20201201084714.627633394@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@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 commit cd81acc600a9684ea4b4d25a47900d38a3890eab upstream. Commit 2284ffea8f0c ("powerpc/64s/exception: Only test KVM in SRR interrupts when PR KVM is supported") removed KVM guest tests from interrupts that do not set HV=1, when PR-KVM is not configured. This is wrong for HV-KVM HPT guest MMIO emulation case which attempts to load the faulting instruction word with MSR[DR]=1 and MSR[HV]=1 with the guest MMU context loaded. This can cause host DSI, DSLB interrupts which must test for KVM guest. Restore this and add a comment. Fixes: 2284ffea8f0c ("powerpc/64s/exception: Only test KVM in SRR interrupts when PR KVM is supported") Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20201117135617.3521127-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/exceptions-64s.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -1410,6 +1410,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) * If none is found, do a Linux page fault. Linux page faults can happen in * kernel mode due to user copy operations of course. * + * KVM: The KVM HDSI handler may perform a load with MSR[DR]=1 in guest + * MMU context, which may cause a DSI in the host, which must go to the + * KVM handler. MSR[IR] is not enabled, so the real-mode handler will + * always be used regardless of AIL setting. + * * - Radix MMU * The hardware loads from the Linux page table directly, so a fault goes * immediately to Linux page fault. @@ -1420,10 +1425,8 @@ INT_DEFINE_BEGIN(data_access) IVEC=0x300 IDAR=1 IDSISR=1 -#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE IKVM_SKIP=1 IKVM_REAL=1 -#endif INT_DEFINE_END(data_access) EXC_REAL_BEGIN(data_access, 0x300, 0x80) @@ -1462,6 +1465,8 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TY * ppc64_bolted_size (first segment). The kernel handler must avoid stomping * on user-handler data structures. * + * KVM: Same as 0x300, DSLB must test for KVM guest. + * * A dedicated save area EXSLB is used (XXX: but it actually need not be * these days, we could use EXGEN). */ @@ -1470,10 +1475,8 @@ INT_DEFINE_BEGIN(data_access_slb) IAREA=PACA_EXSLB IRECONCILE=0 IDAR=1 -#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE IKVM_SKIP=1 IKVM_REAL=1 -#endif INT_DEFINE_END(data_access_slb) EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80)