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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C2AFC61DA4 for ; Thu, 16 Feb 2023 16:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbjBPQf4 (ORCPT ); Thu, 16 Feb 2023 11:35:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjBPQfy (ORCPT ); Thu, 16 Feb 2023 11:35:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B697DC for ; Thu, 16 Feb 2023 08:35:53 -0800 (PST) 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 F14316203C for ; Thu, 16 Feb 2023 16:35:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47307C4339C; Thu, 16 Feb 2023 16:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676565352; bh=Qxa1eIcx4irxEB4fjy/cbkmrThFmrL93q4MPJFK62FY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Wn1sMiOTS08/gBE+cnuh+Ca6SyjESr537QA9m1OwMVbGZ6/Cek5ujv21tUiN8V8sb v6ZaXU418adcTr6+lDVNhZsWgPBYW/RpYST07IN2XB52pK459RhKCeXZzv/MgOUZW2 fR2bYWofeymC1W9RH4FS6/ORBjrGYpdDHC2KwDAKgfs5VTIqxzOzI3lu5hWibNwyP9 C6seZT8iM4m8sZAbviqqb0WlQRWn2Ly0l7Dxov6zfjoYumKFPZri3HOqy79lE/PQI7 CwvtDRU4VepEZ3L3bJub3OR6BKv/PUGBAa22r9u05Iz8BxRMdWoX4reeFow08vN6k3 +pet1O+sNaZ8A== 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.95) (envelope-from ) id 1pShEb-00AxpV-R5; Thu, 16 Feb 2023 16:35:49 +0000 Date: Thu, 16 Feb 2023 16:35:49 +0000 Message-ID: <86o7pty3dm.wl-maz@kernel.org> From: Marc Zyngier To: Kristina Martsenko Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, Catalin Marinas , Will Deacon , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Mark Rutland , Mark Brown , Luis Machado , Vladimir Murzin , linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/10] KVM: arm64: switch HCRX_EL2 between host and guest In-Reply-To: <20230216160012.272345-4-kristina.martsenko@arm.com> References: <20230216160012.272345-1-kristina.martsenko@arm.com> <20230216160012.272345-4-kristina.martsenko@arm.com> 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/28.2 (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: kristina.martsenko@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, mark.rutland@arm.com, broonie@kernel.org, luis.machado@arm.com, vladimir.murzin@arm.com, 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Feb 2023 16:00:05 +0000, Kristina Martsenko wrote: > > Switch the HCRX_EL2 register between host and guest configurations, in > order to enable different features in the host and guest. > > Note that the guest flags are only set if all CPUs have HCRX_EL2. > Asymmetric systems where only some CPUs have HCRX_EL2 are not supported > and will result in guests running with the host flags set (and a "SANITY > CHECK" warning printed for the host). > > After this change, SMPME is no longer set for guests, which should have > no effect as SME is currently disabled for guests. Why not preserve the behaviour by propagating the flag into the guest setup? > > Signed-off-by: Kristina Martsenko > --- > > I wasn't sure what to do about asymmetric systems. It seems a bit > fragile, maybe someone has a better idea? I would simply prevent these CPUs from booting if they come after a primary CPU that has the feature. These hypothetical asymmetric setups put a huge complexity on the kernel, and I'm worried that we're just giving implementers too much freedom. If someone comes up with that sort of stuff, they can write the patches themselves... Or do you know of any braindead setup involving an asymmetric FEAT_HCX implementation? Thanks, M. -- Without deviation from the norm, progress is not possible.