diff options
| author | Marc Zyngier <maz@kernel.org> | 2026-04-01 13:35:56 +0300 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-04-01 17:42:25 +0300 |
| commit | ecc7f02499544ae879716be837af78260a6a10f7 (patch) | |
| tree | 30d6cd313ab6860d5abfd60b7b815683da28cd52 | |
| parent | ce29261ec6482de54320c03398eb30e9615aee40 (diff) | |
| download | linux-ecc7f02499544ae879716be837af78260a6a10f7.tar.xz | |
KVM: arm64: vgic: Don't reset cpuif/redist addresses at finalize time
Although we are OK with rewriting idregs at finalize time, resetting
the guest's cpuif (GICv3) or redistributor (GICv3) addresses once
we start running the guest is a pretty bad idea.
Move back this initialisation to vgic creation time.
Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: a258a383b9177 ("KVM: arm64: gic-v5: Sanitize ID_AA64PFR2_EL1.GCIE")
Link: https://patch.msgid.link/20260323174713.3183111-1-maz@kernel.org
Link: https://patch.msgid.link/20260401103611.357092-2-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
| -rw-r--r-- | arch/arm64/kvm/vgic/vgic-init.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c index 47169604100f..34460179fb8a 100644 --- a/arch/arm64/kvm/vgic/vgic-init.c +++ b/arch/arm64/kvm/vgic/vgic-init.c @@ -147,6 +147,15 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) kvm->arch.vgic.implementation_rev = KVM_VGIC_IMP_REV_LATEST; kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF; + switch (type) { + case KVM_DEV_TYPE_ARM_VGIC_V2: + kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF; + break; + case KVM_DEV_TYPE_ARM_VGIC_V3: + INIT_LIST_HEAD(&kvm->arch.vgic.rd_regions); + break; + } + /* * We've now created the GIC. Update the system register state * to accurately reflect what we've created. @@ -684,10 +693,8 @@ void kvm_vgic_finalize_idregs(struct kvm *kvm) switch (type) { case KVM_DEV_TYPE_ARM_VGIC_V2: - kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF; break; case KVM_DEV_TYPE_ARM_VGIC_V3: - INIT_LIST_HEAD(&kvm->arch.vgic.rd_regions); aa64pfr0 |= SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, GIC, IMP); pfr1 |= SYS_FIELD_PREP_ENUM(ID_PFR1_EL1, GIC, GICv3); break; |
