]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Let GICv3 save/restore honor visibility attribute
authorMarc Zyngier <maz@kernel.org>
Mon, 14 Jul 2025 12:26:28 +0000 (13:26 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Wed, 16 Jul 2025 03:24:29 +0000 (20:24 -0700)
The GICv3 save/restore code never needed any visibility attribute,
but that's about to change. Make vgic_v3_has_cpu_sysregs_attr()
check the visibility in case a register is hidden.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250714122634.3334816-6-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/vgic-sys-reg-v3.c

index 5eacb4b3250a19014f2895867245a1f6845f6b72..6f40225c4a3ff22a0bb3fe21b7cdc6321fcfc88f 100644 (file)
@@ -341,8 +341,12 @@ static u64 attr_to_id(u64 attr)
 
 int vgic_v3_has_cpu_sysregs_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr)
 {
-       if (get_reg_by_id(attr_to_id(attr->attr), gic_v3_icc_reg_descs,
-                         ARRAY_SIZE(gic_v3_icc_reg_descs)))
+       const struct sys_reg_desc *r;
+
+       r = get_reg_by_id(attr_to_id(attr->attr), gic_v3_icc_reg_descs,
+                         ARRAY_SIZE(gic_v3_icc_reg_descs));
+
+       if (r && !sysreg_hidden(vcpu, r))
                return 0;
 
        return -ENXIO;