KVM: arm64: Rename is_id_reg() to imply VM scope
authorOliver Upton <oliver.upton@linux.dev>
Thu, 2 May 2024 23:35:23 +0000 (23:35 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 9 May 2024 17:39:45 +0000 (18:39 +0100)
The naming of some of the feature ID checks is ambiguous. Rephrase the
is_id_reg() helper to make its purpose slightly clearer.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240502233529.1958459-2-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/sys_regs.c

index c9f4f387155f8cc0097f03a8366105682a81f1a0..51a6f91607e5bd1053b7b553a83cc20aa8d28f89 100644 (file)
@@ -1570,9 +1570,10 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, const struct sys_reg_desc *r
 
 /*
  * Return true if the register's (Op0, Op1, CRn, CRm, Op2) is
- * (3, 0, 0, crm, op2), where 1<=crm<8, 0<=op2<8.
+ * (3, 0, 0, crm, op2), where 1<=crm<8, 0<=op2<8, which is the range of ID
+ * registers KVM maintains on a per-VM basis.
  */
-static inline bool is_id_reg(u32 id)
+static inline bool is_vm_ftr_id_reg(u32 id)
 {
        return (sys_reg_Op0(id) == 3 && sys_reg_Op1(id) == 0 &&
                sys_reg_CRn(id) == 0 && sys_reg_CRm(id) >= 1 &&
@@ -3521,7 +3522,7 @@ static void kvm_reset_id_regs(struct kvm_vcpu *vcpu)
        lockdep_assert_held(&kvm->arch.config_lock);
 
        /* Initialize all idregs */
-       while (is_id_reg(id)) {
+       while (is_vm_ftr_id_reg(id)) {
                IDREG(kvm, id) = idreg->reset(vcpu, idreg);
 
                idreg++;
@@ -3547,7 +3548,7 @@ void kvm_reset_sys_regs(struct kvm_vcpu *vcpu)
        for (i = 0; i < ARRAY_SIZE(sys_reg_descs); i++) {
                const struct sys_reg_desc *r = &sys_reg_descs[i];
 
-               if (is_id_reg(reg_to_encoding(r)))
+               if (is_vm_ftr_id_reg(reg_to_encoding(r)))
                        continue;
 
                if (r->reset)
@@ -4014,7 +4015,7 @@ int kvm_vm_ioctl_get_reg_writable_masks(struct kvm *kvm, struct reg_mask_range *
                 * compliant with a given revision of the architecture, but the
                 * RES0/RES1 definitions allow us to do that.
                 */
-               if (is_id_reg(encoding)) {
+               if (is_vm_ftr_id_reg(encoding)) {
                        if (!reg->val ||
                            (is_aa32_id_reg(encoding) && !kvm_supports_32bit_el0()))
                                continue;