From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76D8CC4332F for ; Tue, 20 Dec 2022 20:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Bd+cZCD0GaKNW+Cm+t0rpJyILRSCGP+fBnWmUS7lN1Q=; b=O3nXkzD3dzljXI ef8RvGMEQkjCeloUpNqabaR+zCQ2zyI9FiJa4U1Lp7HtCv5O5yBpWdUytlwi9TSLKABY+fcGEwkD4 1R7wG9XghmeSHVp3iQMo3Us4LnK1K5qQeaiZXbXZrPfw8jSUU+8iGP3ov78nU5aouQLCk8tECe8TH VzwCQ0jPjVyPkaELwTJbkyy5TMNXuSyb9cFSPzBTV148poIe0hRxxARNQY62ZhZMvdUhBYt+/d+i6 haJM7eiv8k6tWrPndO0ZON1xuDHk0PbAyzE+Qosnrt5k0XTFt5s2sAxp216hJlFOMnjuH1Zt36u7U dvU/9K8mXq07uGTDWxSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7iw4-003iV6-TQ; Tue, 20 Dec 2022 20:10:01 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7ivd-003iMD-LF for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 20:09:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 38F7B615A0; Tue, 20 Dec 2022 20:09:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 973E4C433F1; Tue, 20 Dec 2022 20:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671566971; bh=aejWCEP1Ig9CRiir1tLF+G/2ScDfsu7H9JTlto5/gDA=; h=From:To:Cc:Subject:Date:From; b=cgoL9l7oRHWxhVS0Y9LeBDv5/kXb27c3pcperwcn7+YbNfvyzu2E+PfU+mVUB1Qoc T/DKtxSUkyhDMODvew+mnkqFJJ9OChUygfQR+3PiHLJdNBYiLJ74X7qiWncaRZvQZI nU9XVULhkYEIaWbTPAhw7LsfDDRWLJjM0U7aRk3qVh9faJePTbnBI0MwDOkQ27odOB Cr0rV0D3H3Z3mS4ne3tlXY7G/5vEY3LwIKEIRcjFjIh4FFlZSCpcYifvshZ7WvhbhK KBdLnZbxflIJUzzdKL3nSUlm7iPbEA7xGz5g8w8Eff3KMTaalGw+TJFEy9n0ovI+cE j3KioqWzKN57Q== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p7ivZ-00Dzct-9E; Tue, 20 Dec 2022 20:09:29 +0000 From: Marc Zyngier To: , , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Ard Biesheuvel , Will Deacon , Quentin Perret Subject: [PATCH 0/3] KVM: arm64: Fix handling of S1PTW S2 fault on RO memslots Date: Tue, 20 Dec 2022 20:09:20 +0000 Message-Id: <20221220200923.1532710-1-maz@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, oliver.upton@linux.dev, ardb@kernel.org, will@kernel.org, qperret@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221220_120933_841604_E577575D X-CRM114-Status: GOOD ( 16.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Recent developments on the EFI front have resulted in guests that simply won't boot if the page tables are in a read-only memslot and that you're a bit unlucky in the way S2 gets paged in... The core issue is related to the fact that we treat a S1PTW as a write, which is close enough to what needs to be done. Until to get to RO memslots. The first patch fixes this and is definitely a stable candidate. It splits the faulting of page tables in two steps (RO translation fault, followed by a writable permission fault -- should it even happen). The second one is a potential optimisation. I'm not even sure it is worth it. The last patch is totally optional, only tangentially related, and randomly repainting stuff (maybe that's contagious, who knows). The whole thing is on top of Linus' tree as of today. The reason for this very random choice is that there is a patch in v6.1-rc7 that hides the problem, and that patch is reverted in rc8 (see commit 0ba09b1733878afe838fe35c310715fda3d46428). I also wanted to avoid conflicts with kvmarm/next, so here you go. I've tested the series on A55, M1 and M2. The original issue seems to trigger best with 16kB pages, so please test with *other* page sizes! M. Marc Zyngier (3): KVM: arm64: Fix S1PTW handling on RO memslots KVM: arm64: Handle S1PTW translation with TCR_HA set as a write KVM: arm64: Convert FSC_* over to ESR_ELx_FSC_* arch/arm64/include/asm/esr.h | 9 ++++ arch/arm64/include/asm/kvm_arm.h | 15 ------- arch/arm64/include/asm/kvm_emulate.h | 60 ++++++++++++++++++++----- arch/arm64/kvm/hyp/include/hyp/fault.h | 2 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +- arch/arm64/kvm/mmu.c | 21 +++++---- 6 files changed, 71 insertions(+), 38 deletions(-) -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel