A GICv5 host with FEAT_GCIE_LEGACY runs GICv3 guests, but its own ID_AA64PFR0_EL1.GIC is 0. KVM sets the field to IMP for non-protected VMs on such a host, but not for protected VMs, which read it from EL2's copy of the register. The next patch computes a protected vCPU's fine-grained traps from its ID registers, and with GIC at 0, EL2 would then inject an UNDEF for the guest's ICC_IGRPEN_EL1 accesses. Set the field to IMP in EL2's copy as well. The vgic isn't probed yet when the copy is made, so test the capability the vgic itself tests. Signed-off-by: Fuad Tabba --- arch/arm64/kvm/arm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 2753686982f0b..3b4bc646d894a 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -2819,6 +2819,12 @@ static u64 get_hyp_id_aa64pfr0_el1(void) val |= FIELD_PREP(ID_AA64PFR0_EL1_CSV3, arm64_get_meltdown_state() == SPECTRE_UNAFFECTED); + /* A GICv5 host with legacy support gives its guests a GICv3. */ + if (cpus_have_final_cap(ARM64_HAS_GICV5_LEGACY)) { + val &= ~ID_AA64PFR0_EL1_GIC; + val |= SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, GIC, IMP); + } + return val; } -- 2.47.3