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 3A8D5C47073 for ; Thu, 4 Jan 2024 18:23:01 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PyIeseVEhflGHpvjm/QJPbvlu8oeQ8X6yDXh23P+qw4=; b=ZltyYC1ECaoMjR ijAdz6fapRnHMZNqyeTzR78TqYDGIyiYwCfY2TPHSqL+54l5SxRs+K7/kRygp9ikCbK3jwDXV0prk do+rPheEEfE0WgzsENRTfqqfjHyHyJBXDdIXPFojq/tY+e6AeexQ3cazGuxGWvGrH6R1LoV5T9Fcr cZhHFfeedbVypYokaGisr26CzgB6BWfTqW6x+neujixWHyXn2uOwHH0CIYPHmL4e30vn6s+PmseTO q9/SLs2T5pQxMsDlrqZyYM8pi3JCkwmmYJ+HhSohKSbBSpd1+sDWf5kARG68qoe/Ef2NUnDevgpAo X2CUZpzK1Ku6pxfxIvjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLSMU-00Ewvi-08; Thu, 04 Jan 2024 18:22:34 +0000 Received: from out-174.mta1.migadu.com ([95.215.58.174]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLSMQ-00EwuE-1m for linux-arm-kernel@lists.infradead.org; Thu, 04 Jan 2024 18:22:32 +0000 Date: Thu, 4 Jan 2024 18:22:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1704392543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y6mU88UU7RwuIYuMbDb5yDn0rYv6PefHxXdYDrc9VLI=; b=EgDKCdZE20v9OExzVNdXTQ+9FPo7gxMtUmhFXzPE09LkTPYSwarsZGWvGfDJmHvCqE1gt2 w6D7B8Mdkl0/RnB/gsmZxzxCVkPwwKpXTIpZVRRe0NDLTg5nBI0DndLsm+EQMChmijdnJE fXbEFcwX4/qNEemgMFBwlT0kWk1nggs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Will Deacon Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org, keirf@google.com, Quentin Perret Subject: Re: [PATCH] KVM: arm64: Add missing memory barriers when switching to pKVM's hyp pgd Message-ID: References: <20240104164220.7968-1-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240104164220.7968-1-will@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_102231_084303_6427C45A X-CRM114-Status: GOOD ( 16.86 ) 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 On Thu, Jan 04, 2024 at 04:42:20PM +0000, Will Deacon wrote: > In commit f320bc742bc23 ("KVM: arm64: Prepare the creation of s1 > mappings at EL2"), pKVM switches from a temporary host-provided > page-table to its own page-table at EL2. Since there is only a single > TTBR for the nVHE hypervisor, this involves disabling and re-enabling > the MMU in __pkvm_init_switch_pgd(). > > Unfortunately, the memory barriers here are not quite correct. > Specifically: > > - A DSB is required to complete the TLB invalidation executed while > the MMU is disabled. > > - An ISB is required to make the new TTBR value visible to the > page-table walker before the MMU is enabled in the SCTLR. > > An earlier version of the patch actually got this correct: > > https://lore.kernel.org/lkml/20210304184717.GB21795@willie-the-truck/ > > but thanks to some badly worded review comments from yours truly, these > were dropped for the version that was eventually merged. > > Bring back the barriers and fix the potential issue (but note that this > was found by code inspection). > > Cc: Quentin Perret > Fixes: f320bc742bc23 ("KVM: arm64: Prepare the creation of s1 mappings at EL2") > Signed-off-by: Will Deacon +1 to Marc's suggestion about folding the appropriate barriers into the macro, but fine with this as is: Reviewed-by: Oliver Upton -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel