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 8C4A3C77B6E for ; Thu, 13 Apr 2023 08:16:13 +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:References:In-Reply-To: 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: List-Owner; bh=P5Fr4kVzmOS5i0AbI6HDyD0bpS1QtU/SFRKYal97mek=; b=R/egzjJ+lFyY/u e3yjPtyFq1lWCAne59Yvbhkc6QPzyOqnAJu9ZU1aO4dygiDTZd71yfRKGQrezodGfAfMVfhKR63Wm AeiD3/mt0uJH6boi0NVxiA68sSvxf7eJ77S/vnJeoiK395gkbRkRDrKlW48O6KUnBFbjmAkSQpME6 kXSchqglv2RscI9kEcFWtvE1zJ17Cl1ieA6Q+XKgM7gRz/nyvzuCvmXUL534fpwt7DYo9mp7NzSEc 0KBqUNWpPgMfF0qL9wUqQaImH2Oyl+9/mrSOZyT30bcaB//IUip/SIH1SRCpTR5SDDFSfoVLfZpv4 ALotn4xT8wr8T2ywvUSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pms6h-005NF9-08; Thu, 13 Apr 2023 08:15:03 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pms6W-005NB1-0i for linux-arm-kernel@lists.infradead.org; Thu, 13 Apr 2023 08:14:54 +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 8B0FD614CB; Thu, 13 Apr 2023 08:14:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E049FC433A7; Thu, 13 Apr 2023 08:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681373690; bh=rwmmXpw7HzvlcwZFWNqSFO/o0tH4qlAkLiVY1MwzDMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hM+Rhk0Zau1RZ9pXacqypToa2pX0j8u9m7YuXb5ACT3nw7Xz5SSVPBeJBK4fZS7f0 ymL26T8VT37UX/zNl8x5NE8VY89v2OcF/mHpMb2LubGg4cwyIY6y6QQFVRi+3g+uo+ EC2SIknQ+tK3dvdqbU/gh4qu5xlQ50Dwwc+tznCvDOttJUcFgtTq5Ece/dm0ZbNdJF 9rl9/BnVdsy2jkA6VxIiQCSeVhsnbj7nm28SR8ovxyPhc/b5MCaN4d9vLzJEBrtioF vmbR9JlIeqsSmabWT74tNZME7MtjSozG2SvGewqsikuTHeiw7bIXMj+0BveAiRyTFI PCtlm08PxuTMw== 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 1pms6S-0082qd-TM; Thu, 13 Apr 2023 09:14:48 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Will Deacon , Ricardo Koller Subject: [PATCH v3 3/5] KVM: arm64: pkvm: Document the side effects of kvm_flush_dcache_to_poc() Date: Thu, 13 Apr 2023 09:14:39 +0100 Message-Id: <20230413081441.165134-4-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230413081441.165134-1-maz@kernel.org> References: <20230413081441.165134-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, will@kernel.org, ricarkol@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-20230413_011452_295824_97DA59A3 X-CRM114-Status: GOOD ( 12.92 ) 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 We rely on the presence of a DSB at the end of kvm_flush_dcache_to_poc() that, on top of ensuring completion of the cache clean, also covers the speculative page table walk started from EL1. Document this dependency. Signed-off-by: Marc Zyngier Reviewed-by: Oliver Upton --- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 552653fa18be..2e9ec4a2a4a3 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -297,6 +297,13 @@ int __pkvm_prot_finalize(void) params->vttbr = kvm_get_vttbr(mmu); params->vtcr = host_mmu.arch.vtcr; params->hcr_el2 |= HCR_VM; + + /* + * The CMO below not only cleans the updated params to the + * PoC, but also provides the DSB that ensures ongoing + * page-table walks that have started before we trapped to EL2 + * have completed. + */ kvm_flush_dcache_to_poc(params, sizeof(*params)); write_sysreg(params->hcr_el2, hcr_el2); -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel