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 0E97138D; Mon, 4 Aug 2025 13:11:41 +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=1754313102; cv=none; b=C15+HzKd39RFFo0P+qw/jZ0CKCdNRKAu1pKY7aT5q/NUu6s5NmoCXHugpFkBcHbW/WP88ytc8z2Bd9eEFQ0LzSlbL7cbciu1YuDGd8yYAjIUxBovP1Jz9ERlcJnwnhO87wFQknIStt+so3EBjc/HFZ/EIktyTDXEk/eNKwjkNv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754313102; c=relaxed/simple; bh=TR4IynGlqh3xuGAPqNvGejeGuOim0a/t/2+l2ojuG3M=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=JaJGSMTtS87IIePzDP3HeIX3OqBlAq/4rqzDcSeY5KystyjTiqY0vPG6moIy+sgYE7T5m6aCudx0datV2GIS6pjWZxRAeTwjUhFPNex6lQSSYT0k3HEKDRi+ysyK6mmKp8kl/b9/64Tp/wWL0axAjEUkNXXOUUFvzLmE3sLq3rs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FWnA14Zr; 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="FWnA14Zr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A357C4CEE7; Mon, 4 Aug 2025 13:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754313101; bh=TR4IynGlqh3xuGAPqNvGejeGuOim0a/t/2+l2ojuG3M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FWnA14Zr+PO8Dc7S1vSMyr5HSOBsd3ONJedoyeUL31soQ4u+qdF5zlJ1L+KssxKyX LGYOymZPSgU8XUqapDrdI4ABN9R2cYEl/PQn019vZhYuOfz7cXmJIKIQaMZrOKifAT QKWf3bPnPaG275SPQkSHQfbIr5kEkAMeHnsjdSS+Q7dd3fzzEpGS3zEJ19xdhuUjDk v+Qukmu9YNkJJ8hujmpT3ASfyqbFY3ilbA7GbhcFcgKJh/bbCkUx9ZiryFzE1FzBS7 X/hZIXq32mN7o9PtTTdeSuSKeoA/6QTgn4e2nvO12g1nU5CsZTv1QgKffDNJZYMjcu Kq9udbFUKHq/g== 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 1uiuyY-003oWR-Ss; Mon, 04 Aug 2025 14:11:39 +0100 Date: Mon, 04 Aug 2025 14:11:38 +0100 Message-ID: <86pldb6xkl.wl-maz@kernel.org> From: Marc Zyngier To: Yeoreum Yun Cc: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, oliver.upton@linux.dev, anshuman.khandual@arm.com, robh@kernel.org, james.morse@arm.com, mark.rutland@arm.com, joey.gouly@arm.com, ry111@xry111.site, Dave.Martin@arm.com, ahmed.genidi@arm.com, kevin.brodsky@arm.com, scott@os.amperecomputing.com, mbenes@suse.cz, james.clark@linaro.org, frederic@kernel.org, rafael@kernel.org, pavel@kernel.org, ryan.roberts@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH 10/11] KVM: arm64: nv: support SCTLR2_ELx on nv In-Reply-To: <20250804121724.3681531-11-yeoreum.yun@arm.com> References: <20250804121724.3681531-1-yeoreum.yun@arm.com> <20250804121724.3681531-11-yeoreum.yun@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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-pm@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: yeoreum.yun@arm.com, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, oliver.upton@linux.dev, anshuman.khandual@arm.com, robh@kernel.org, james.morse@arm.com, mark.rutland@arm.com, joey.gouly@arm.com, ry111@xry111.site, Dave.Martin@arm.com, ahmed.genidi@arm.com, kevin.brodsky@arm.com, scott@os.amperecomputing.com, mbenes@suse.cz, james.clark@linaro.org, frederic@kernel.org, rafael@kernel.org, pavel@kernel.org, ryan.roberts@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 04 Aug 2025 13:17:23 +0100, Yeoreum Yun wrote: [...] > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > index dc1d26559bfa..a4d3b2d2fd80 100644 > --- a/arch/arm64/kvm/nested.c > +++ b/arch/arm64/kvm/nested.c > @@ -1704,6 +1704,19 @@ int kvm_init_nv_sysregs(struct kvm_vcpu *vcpu) > TCR2_EL2_AMEC1 | TCR2_EL2_DisCH0 | TCR2_EL2_DisCH1); > set_sysreg_masks(kvm, TCR2_EL2, res0, res1); > > + /* > + * SCTLR2_EL2 - until explicit support for each feature, set all as RES0. > + */ > + res0 = SCTLR2_EL2_RES0 | SCTLR2_EL2_EMEC; > + res0 |= SCTLR2_EL2_EASE; > + res0 |= SCTLR2_EL2_NMEA; > + res0 |= (SCTLR2_EL2_EnADERR | SCTLR2_EL2_EnANERR); > + res0 |= SCTLR2_EL2_EnIDCP128; > + res0 |= (SCTLR2_EL2_CPTA | SCTLR2_EL2_CPTA0 | > + SCTLR2_EL2_CPTM | SCTLR2_EL2_CPTM0); > + res1 = SCTLR2_EL2_RES1; > + set_sysreg_masks(kvm, SCTLR2_EL2, res0, res1); This patch is obsolete, but I'd like to point out that this is not the way we describe these things. Each bit of the register needs to be tracked against the feature it is part of, and not blindly added to the RES0 set. See https://lore.kernel.org/all/20250708172532.1699409-15-oliver.upton@linux.dev/ for the equivalent change. You should *NEVER* describe a functional bit as RESx without considering whether the feature is exposed to the guest, irrespective of what the kernel supports. Thanks, M. -- Without deviation from the norm, progress is not possible.