[PATCH 2/2] KVM: arm64: Clarify meaning of _MASK and _nMASK for FGT registers

Mark Brown posted 2 patches 1 year, 6 months ago
There is a newer version of this series
[PATCH 2/2] KVM: arm64: Clarify meaning of _MASK and _nMASK for FGT registers
Posted by Mark Brown 1 year, 6 months ago
Since the use of _MASK to mean bits where setting the bit causes traps to
be generated is a little unusual add a clarifying comment.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/include/asm/kvm_arm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index d347483395b4..1d8745740fb1 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -343,6 +343,10 @@
  * FGT register definitions
  *
  * RES0 and polarity masks for the FGT registers.
+ *
+ * _RES0:  Bits which are RES0
+ * _MASK:  Bits which enable traps when set
+ * _nMASK: Bits which disable traps when set
  */
 #define __HFGRTR_EL2_RES0	HFGxTR_EL2_RES0
 #define __HFGRTR_EL2_MASK	GENMASK(49, 0)

-- 
2.39.2
Re: [PATCH 2/2] KVM: arm64: Clarify meaning of _MASK and _nMASK for FGT registers
Posted by Marc Zyngier 1 year, 6 months ago
On Wed, 31 Jul 2024 19:58:38 +0100,
Mark Brown <broonie@kernel.org> wrote:
> 
> Since the use of _MASK to mean bits where setting the bit causes traps to
> be generated is a little unusual add a clarifying comment.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/include/asm/kvm_arm.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
> index d347483395b4..1d8745740fb1 100644
> --- a/arch/arm64/include/asm/kvm_arm.h
> +++ b/arch/arm64/include/asm/kvm_arm.h
> @@ -343,6 +343,10 @@
>   * FGT register definitions
>   *
>   * RES0 and polarity masks for the FGT registers.
> + *
> + * _RES0:  Bits which are RES0
> + * _MASK:  Bits which enable traps when set
> + * _nMASK: Bits which disable traps when set

The rest of the code call this "negative polarity". Also, in some
cases (such as with HCRX_EL2), such bits are *enable* bits. So you
probably want to capture this as well.

	M.

-- 
Without deviation from the norm, progress is not possible.