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 6DD29CCA464 for ; Fri, 16 Oct 2026 10:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8lC+3QuyhSeSDfWPg49wFSQP1WWmXzv+SO1bTfVf9QQ=; b=vG4MAPUon68iS+tb28jla/7vKe frPRrMfGPkAPbP7kdMsHfPDTjvHzyo0b7n+BKLwRfGIW1PbZhSwVjrBgxmJk/UOMTjFjw8T/Omef5 kFMM0DQ2B1EEkvAyYIkETPl5mZdOVDG6ugXa5px49NRplWaUkc4gf8SAG3LOuFB63QxUii+pVArci ozagLmrCMkmu1HUFOTQiT4MO7Lh7RNI0tuvzlQOncZOqwk5d8lTlmV3dODQMGu1qlsuECehShJkf8 HxwjlEDdeM8Onz24Ts4D3P2VkHeSiTRzAUwhpaxb74X7ruJn3PYmwW1EtTvFx45ElwaoHg+aLqYFn r7Gz9RKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xHetV-00000002ZoR-1Uip; Fri, 16 Oct 2026 10:10:33 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xHetU-00000002ZoF-1Jzg for linux-arm-kernel@lists.infradead.org; Fri, 16 Oct 2026 10:10:32 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 65111601FE; Fri, 16 Oct 2026 10:10:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A9831F000C4; Fri, 16 Oct 2026 10:10:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792145431; bh=8lC+3QuyhSeSDfWPg49wFSQP1WWmXzv+SO1bTfVf9QQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=PCkV+VjPEAbPVnwsmhUyCGHvwkW9is05IsSldUUc0jyYvVlhvfueTj7fa8oB2keil xAzKBOW7NtS/qJyh1VEZSe8eHpzwBlo/GTt2WfF0TI49xl37eMTM3sxJ2sPOSxP6vv +ONFn+3vDxPlE2dqlmwmp7VWkFeIfLCtQ9DpvFpaqoZRoNhDzb8gyS4N5zLQJsiiqj d547wc0OYXsILmkfaG/RbPg2RxHCBNXk5hRLogXTDMuRAweLjS16vt1Sev4BDT69bT rtZNhWB80fByfnfn6bW8o9bk1db6ubyJ6kcDL9vynE3Bz9LIzMNqDhCQZsxAfm3OPZ KSJMQ0FE9lQjw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHetQ-00000003hIw-3TGV; Fri, 16 Oct 2026 10:10:28 +0000 Date: Fri, 16 Oct 2026 11:10:28 +0100 Message-ID: <86cxta0xd7.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Steffen Eiden , Catalin Marinas , Will Deacon , Mark Rutland , Fuad Tabba , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Set HCR_EL2.BSU to Inner Shareable for guests In-Reply-To: <20261016081558.805411-1-fuad.tabba@linux.dev> References: <20261016081558.805411-1-fuad.tabba@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: fuad.tabba@linux.dev, oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, seiden@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 16 Oct 2026 09:15:58 +0100, Fuad Tabba wrote: > > KVM sets HCR_EL2.BSU to Inner Shareable for guests, so that a guest's > barriers cover the TLB and I-cache invalidations that HCR_EL2.FB > broadcasts. However, since HCR_BSU_IS became an alias of the generated > HCR_EL2_BSU_IS, it is the unshifted field value 0b01, which sets bit > 0 (VM, already set) and leaves BSU at 0b00. A guest's DSB NSH is then > not required to wait for a broadcast TLBI to complete on other CPUs. > > Build the field with SYS_FIELD_PREP_ENUM(). > > Fixes: d0f39259eff4 ("arm64: sysreg: Add layout for HCR_EL2") > Signed-off-by: Fuad Tabba > --- > Found while testing Marc's HCR cleanup [1]. Its patch 1 carries this > line over as HCR_EL2_BSU_IS, so on top of this fix that hunk would > keep SYS_FIELD_PREP_ENUM() instead. I can also rebase this on top of > the series if that's easier. > > [1] https://lore.kernel.org/r/20261015173605.1072963-1-maz@kernel.org > > arch/arm64/include/asm/kvm_arm.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index 4bfbd827c5aa7..b3e9dd302730e 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -98,7 +98,7 @@ > * TID1: Trap REVIDR_EL1, AIDR_EL1, and SMIDR_EL1 > */ > #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \ > - HCR_BSU_IS | HCR_FB | HCR_TACR | \ > + SYS_FIELD_PREP_ENUM(HCR_EL2, BSU, IS) | HCR_EL2_FB | HCR_EL2_TACR | \ > HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ > HCR_FMO | HCR_IMO | HCR_PTW | HCR_TID3 | HCR_TID1) > #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK) Huh. That's a bad one. I've added a Cc: stable to that, and queued it as a prefix of the cleanup series. Thanks, M. -- Without deviation from the norm, progress is not possible.