From mboxrd@z Thu Jan 1 00:00:00 1970 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 506142D7D2F; Thu, 27 Nov 2025 16:35:04 +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=1764261306; cv=none; b=F8O6MAZ+BFqqz7iBLBVvUj+qGkYD/weNG3h2FIEe38j3qQR3hQgfWYdmKnhQh7FCnvnha1HpJYvQHBgZQfAtlBB/gHPJtcTF7iV2IfwbLpC1NJ9FAF5luYsT7yVDuWu+4QULLoSFcBevjOGlj+GYCX/ooNHjq7Odau2SoQZqzp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764261306; c=relaxed/simple; bh=pcPnY+ycw5GanEcyc3wlmZfHh6vRFdVFnRa3R9CCU84=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=XxZLhRa+ZEsAvPU9pfqoZB12+bjeOTIvmi2So/8tUrV2TRWh4vP5CDf6QfsY2FFNcd84CfFYpHH8oHYUKJLJzVkP8yNEt7hQgujAqoqjkmPFkVfSaTtK7Kkg5s6ppF0ba58sErSUZ8yrMvh1xUIxSD03/8VkweZLcyxr0MOG/Ls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H/yIzEHB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H/yIzEHB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7D5BC4CEF8; Thu, 27 Nov 2025 16:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764261304; bh=pcPnY+ycw5GanEcyc3wlmZfHh6vRFdVFnRa3R9CCU84=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H/yIzEHB6lHfOKelYR+OmrHt20LA1UPyz9B+YAichkI/S8UCd0LRRfNMeqlYH/Mou nr4RO+wmNtXEPDiwUL9OETfNIHDwoTukxNfK3yDcgei9YnWQeM6uz7vxc/SgkZNwR4 88pvBiNaBE7716+Lh+qqxU6knFvsbvbG+oQI+BF6Da0Q9aae2BdzhzQo17Kkz9rQ5F uZsuTiPao6s+ka2gmKUxGAvIfYqiCadNiybcAL2HqIhEHpyZfCspUBx0M3++DzbuCe NZPdgdALx9Mq50Iv5/VjzxUjcoZbLHRYRXqebfp1+15SslqYQqCEcdXSu+8cTxaT+6 Ln0eSlJa7Yncw== 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 1vOexS-00000008qt8-2eTc; Thu, 27 Nov 2025 16:35:02 +0000 Date: Thu, 27 Nov 2025 16:35:02 +0000 Message-ID: <86zf87ph6x.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Yao Yuan , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joey Gouly , Suzuki K Poulose , Zenghui Yu , Ben Horgan Subject: Re: [PATCH v2 4/5] KVM: arm64: Report optional ID register traps with a 0x18 syndrome In-Reply-To: References: <20251126155951.1146317-1-maz@kernel.org> <20251126155951.1146317-5-maz@kernel.org> 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) Precedence: bulk X-Mailing-List: kvm@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: oupton@kernel.org, yaoyuan@linux.alibaba.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, ben.horgan@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 27 Nov 2025 06:43:51 +0000, Oliver Upton wrote: > > On Thu, Nov 27, 2025 at 02:07:08PM +0800, Yao Yuan wrote: > > On Wed, Nov 26, 2025 at 03:59:50PM +0800, Marc Zyngier wrote: > > > With FEAT_IDST, unimplemented system registers in the feature ID space > > > must be reported using EC=0x18 at the closest handling EL, rather than > > > with an UNDEF. > > > > > > Most of these system registers are always implemented thanks to their > > > dependency on FEAT_AA64, except for a set of (currently) three registers: > > > GMID_EL1 (depending on MTE2), CCSIDR2_EL1 (depending on FEAT_CCIDX), > > > and SMIDR_EL1 (depending on SME). > > > > > > For these three registers, report their trap as EC=0x18 if they > > > end-up trapping into KVM and that FEAT_IDST is not implemented in the > > > guest. Otherwise, just make them UNDEF. > > > > > > Signed-off-by: Marc Zyngier > > > --- > > > arch/arm64/kvm/sys_regs.c | 16 +++++++++++++--- > > > 1 file changed, 13 insertions(+), 3 deletions(-) > > > > > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > > > index 2ca6862e935b5..7705f703e7c6d 100644 > > > --- a/arch/arm64/kvm/sys_regs.c > > > +++ b/arch/arm64/kvm/sys_regs.c > > > @@ -82,6 +82,16 @@ static bool write_to_read_only(struct kvm_vcpu *vcpu, > > > "sys_reg write to read-only register"); > > > } > > > > > > +static bool idst_access(struct kvm_vcpu *vcpu, struct sys_reg_params *p, > > > + const struct sys_reg_desc *r) > > > +{ > > > + if (kvm_has_feat_enum(vcpu->kvm, ID_AA64MMFR2_EL1, IDS, 0x0)) > > > > Hi Marc, > > > > Minor: maybe beter readability if use NI instead of 0x0, just like > > things in feat_nv2() below, but depends on you. > > +1, using the ESR value as an identifier in the sysreg tables is just > terrible. This reads like a literal. Yeah, I was a bit shocked when I found how it was encoded in the sysreg file, but kept it as is. Since there is a consensus that this is pretty lame, I'll add a patch repainting it using the usual NI/IMP identifiers. Thanks, M. -- Without deviation from the norm, progress is not possible.