Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp44461lqj; Wed, 10 Apr 2024 03:33:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4ww3+jfkXk65SVQLpyErWIarGSFTG6Jbu2h0+uJBJzOrjmjgqZOIRrHPyL3I5q2RJXW1Kk9vdS+AYVebHyGQ5SXlPwyCc+91kdXYttw== X-Google-Smtp-Source: AGHT+IEkGMOaTCHTac6LBF+WDSsO6nwwoj5B8+skyHBa1ioOuGR/W2AZDQltERD2nsen32Bw8xG9 X-Received: by 2002:a17:90a:428a:b0:2a4:ca45:ded1 with SMTP id p10-20020a17090a428a00b002a4ca45ded1mr1964376pjg.28.1712745187525; Wed, 10 Apr 2024 03:33:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712745187; cv=pass; d=google.com; s=arc-20160816; b=X1OPhbK/BCQIfVVJV1t+YN0dzkZS4Z2meGOXlXI1NwXfqkz892yjgu2Bc+eUobLWgd cCQOsz4aRK1q6/tHkrw4pK7+WTBbbp40P9fqQD3B2bo8DTppGpUDoSVM5Z0vjf2So0Wf RCtixBsouCl3eOdic+lcXWG5FMSHb8cXjMVlNqz4FPRwJ1+ek6dsJyUUmsjWCSsh81fB DKOkQ3A0DXUEznRI3mKLx8Ogdpy8tHsDf0CNWYus0a+HOZrHifz6f1FmgKlJWIC1dpDH leblWeySnXdpCX9d9bDDaHYf3FPndLenxPNQn7LVBh6L8dLOySVrU3zN2pGWpQPMilIz K/ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=jvpeRCk3oTmqvWeHl/RAT996P/VbebkrnC0KgJ7aoRg=; fh=kMCeI7b2dYY7R2wKmvevC0PFz2MMN2cSikVkL3i1HJE=; b=dReDudEMSPPCsp900VGlcez5LRNsGDmwrBdp0YuDlIQLrexHduuWjuYcHepLy54LAE vEznhFjC+a1BMTpWIEHsG2s4lnaMJVr4sS9dKw3btIKVKqCCwU5RMQOEddFmffwfSAoE MUfmtbkMtWqFb0wiRJN9/q6Y9o37F23HiRv2uj2RqygKMPoTfQE3OlbJv76JLUS0GYds 1cTBDV2LFCL3q74mxwoNaHYChbdOVp/sYt6KBJQpkp2BYS3o/cAlhp+dVxRpHEAZBOCZ XlFu6cEhATAZ0lo/ilYdHB9xOdMnYe3Zb+fEPI36TiGH7wesL42s59YzGn8MBbxTnLmD lLTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KzalsUOm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f24-20020a17090ac29800b002a25c7509d6si1296620pjt.18.2024.04.10.03.33.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 03:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KzalsUOm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-138330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B5ABBB22F75 for ; Wed, 10 Apr 2024 10:32:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A739C13D60C; Wed, 10 Apr 2024 10:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KzalsUOm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5DC8C157; Wed, 10 Apr 2024 10:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745125; cv=none; b=ZmKKzlG500g2ZsSrP94U/Va4UL+nuToYgUC0nRO/26hP7wHG7qKXLaeRlF3vIIUuci92GjEeltOxy8iHpMjYTIuQ8NSHvWrnxp7fveKi8XqJ0t6tIelxQ/8ZYtALFtQVEtoI4IcpYG1LXb7PRAWfxjBknJxcBRpDELVya8Uv6W0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712745125; c=relaxed/simple; bh=OzNxKoT6rtjavH+sSKdTA2aMIU0990lfBRRYYlSp7XA=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=feKDrXhCCL6T2+UqZkQfZgeLH8Kmhaj4bifMXew/8xX5wRmwRpWhV1RvE8M25+evx6Gejpb5LI5+aVchC9n0mEkGhtMDo/X2vncczQTn7M86EqfvZJ33KFnvU3biKrdOk/BScaSNmWAYy4Ul3uMky5jVYD7zSJP1J7tyYazyupc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KzalsUOm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0D0C433F1; Wed, 10 Apr 2024 10:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712745125; bh=OzNxKoT6rtjavH+sSKdTA2aMIU0990lfBRRYYlSp7XA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KzalsUOmcblbIZ97GurA1rdPl9SC/8tq1vtLK++nVmvjVqR9HNbhdulCsgNlNpZUj NhO4HaeutbcfxdSMSiqUGFVU9mek+M+PfbLiaK11UZ2O3Pcm1Mc6zY7XAj8g8UbSaE 6lkkhGnAxVFqTDIIrcjTnF3NVdW+jFwkEWP5fqybV7kidLwDueM6sPMB+OgxKrRLvV 10I2eCvh2td9EFeowCycDH7ErIUGJUsVYaVx/+/g6ilmIJedkvHTmHYxFyRHGtKmvh hLtqtr2WwFmFYoQtdoA/57HlbU1WoYW7Bi6w8Te9JxTp9jOoVuF78A9vuezWC0U/rN DW7g6eiwYTL1A== 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 1ruVFK-0036qE-TU; Wed, 10 Apr 2024 11:32:02 +0100 Date: Wed, 10 Apr 2024 11:32:02 +0100 Message-ID: <86ttk9se3h.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Oliver Upton , James Morse , Suzuki K Poulose , Jonathan Corbet , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Martin , kvmarm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v6 2/5] KVM: arm64: Add newly allocated ID registers to register descriptions In-Reply-To: <73c6012f-adb0-470b-bd47-6093d28aea97@sirena.org.uk> References: <20240329-arm64-2023-dpisa-v6-0-ba42db6c27f3@kernel.org> <20240329-arm64-2023-dpisa-v6-2-ba42db6c27f3@kernel.org> <87le5ysm4l.wl-maz@kernel.org> <73c6012f-adb0-470b-bd47-6093d28aea97@sirena.org.uk> 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/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, corbet@lwn.net, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave.Martin@arm.com, kvmarm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@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 On Tue, 02 Apr 2024 18:21:55 +0100, Mark Brown wrote: > > On Sun, Mar 31, 2024 at 11:59:06AM +0100, Marc Zyngier wrote: > > Mark Brown wrote: > > > > The 2023 architecture extensions have allocated some new ID registers, add > > > them to the KVM system register descriptions so that they are visible to > > > guests. > > > > We make the newly introduced dpISA features writeable, as well as > > > allowing writes to ID_AA64ISAR3_EL1.CPA for FEAT_CPA which only > > > introduces straigforward new instructions with no additional > > > architectural state or traps. > > > FPMR actively gets trapped by HCRX_EL2. > > Sure, I'm not clear what you're trying to say here? I'm saying (and not trying to say) that there are traps implied by the features that you are adding. > The "no additional" bit is referring to FEAT_CPA. Well, that wasn't clear to me. And when it comes to CPA, there are additional controls in SCTLR2_ELx, which doesn't even gets context switched for EL1. What could possibly go wrong? > > > > - ID_UNALLOCATED(6,3), > > > + ID_WRITABLE(ID_AA64ISAR3_EL1, ~(ID_AA64ISAR2_EL1_RES0 | > > > + ID_AA64ISAR3_EL1_PACM | > > > + ID_AA64ISAR3_EL1_TLBIW)), > > > ID_UNALLOCATED(6,4), > > > ID_UNALLOCATED(6,5), > > > ID_UNALLOCATED(6,6), > > > Where is the code that enforces the lack of support for MTEFAR, > > MTESTOREONLY, and MTEPERM for SCTLR_ELx, EnPACM and EnFPM in HCRX_EL2? > > Could you please be more explicit regarding what you're expecting to see > here? I'm expecting you to add all the required masking and fine-grained disabling of features that are not explicitly advertised to the guest. This should translate into additional init code in kvm_init_sysreg(), kvm_init_nv_sysregs() and limit_nv_id_reg(). You also should update the exception triaging infrastructure in emulate-nested.c. > Other than the writeability mask for the ID register I would have > expected to need explicit code to enable new features rather than > explicit code to keep currently unsupported features unsupported. I'm > sure what you're referencing will be obvious once I see it but I'm > drawing a blank. > > > And I haven't checked whether TLBI VMALLWS2 can be trapped. > > I didn't see anything but I might not be aware of where to look, there > doesn't seem to be anything for that specifically in HFGITR_EL2 or > HFGITR2_EL2 which would be the main places I'd expect to find > something. That's a really odd place to look. This is a S2 invalidation primitive, which by definition is under the sole control of EL2, and therefore cannot be trapped by any of the FGT registers, as they only affect lesser-privileged ELs. The instruction is described in the XML: https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Instructions/TLBI-VMALLWS2E1--TLB-Invalidate-stage-2-dirty-state-by-VMID--EL1-0 M. -- Without deviation from the norm, progress is not possible.