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 67083C64EC7 for ; Tue, 21 Feb 2023 17:42:57 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n7NkyT7Fb8F9gVlln+a3H8BZWl+az1kQeZhBy54gysk=; b=attU5/1PilGxnH OwIUmBL3hp6I1m3ocNngfE28qfogOQOo3w1JMRiW3t0U5iv0Rsm38SGIqUaYVgYzQZ2ABU0+ORGDk t+FIPnaZL0PNaHIDYxIHr94JLF1F0c9NtWS33tarK6eWGy2ehZ8xVRQXid2HIWc85XyTO0LBZWbGm Esl0gnihualBouWE9nMJF4nT/8pnvH4xs+ZSR3l68SvxbYby/qRIToH415BV9L9PAINNyvxLryRbU Jp0uqiDOi5M3eQuxxfrbDD36AzGhGiGad5d0gGcisVmWqzhtKJpxNidKCiiZc5mUpTN8MiVseLc4c 3aY8axshbLit3dg3NFVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUWeR-009Bby-Ao; Tue, 21 Feb 2023 17:42:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pUWeL-009BbR-IH for linux-arm-kernel@lists.infradead.org; Tue, 21 Feb 2023 17:41:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B42A1650; Tue, 21 Feb 2023 09:42:37 -0800 (PST) Received: from [10.1.196.177] (eglon.cambridge.arm.com [10.1.196.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C92CB3F703; Tue, 21 Feb 2023 09:41:52 -0800 (PST) Message-ID: <0fbdc641-35ed-9859-e6dd-12a38285d164@arm.com> Date: Tue, 21 Feb 2023 17:41:45 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [RFC PATCH 0/3] arm64: errata: Disable FWB on parts with non-ARM interconnects Content-Language: en-GB To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Oliver Upton References: <20230216182201.1705406-1-james.morse@arm.com> From: James Morse In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230221_094157_691902_BE3FF583 X-CRM114-Status: GOOD ( 16.51 ) 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 Hi Ard, On 21/02/2023 14:38, Ard Biesheuvel wrote: > On Thu, 16 Feb 2023 at 19:23, James Morse wrote: >> When stage1 translation is disabled, the SCTRL_E1.I bit controls the >> attributes used for instruction fetch, one of the options results in a >> non-cacheable access. A whole host of CPUs missed the FWB override >> in this case, meaning a KVM guest could fetch stale/junk data instead of >> instructions. >> >> The workaround is to disable FWB, and do the required cache maintenance >> instead. > So the system should behave as if SCTLR_EL1.I==1 when FWB is enabled, > but it doesn't, right? Couldn't we just force SCTLR_EL1.I to 1 when > FWB is enabled? I.e., trap writes and override the I bit - and if we > want to pretend it is 0 we could trap reads and lie to the guest as > well, but I doubt we'd even need that. The affected parts don't have fine-grained traps, so we'd need to set HCR_EL2.TVM, which traps loads of things. We'd only need it while the guest has the MMU disabled, and KVM already has code that uses this trap to try and spot this ... ... but it only works until the first time you enable SCTRL_EL1.M as the trap is too costly to leave enabled. If you put the workaround in there, it would work the first time a guest booted, but a subsequent kexec, or any other reason to turn the MMU off is exposed. Its an incomplete fix, I'd hate to have to debug it! Thanks, James _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel