arch/arm64: GICv2 detection is compatible with different qemu versions

Summary:
- GICv2 cannot be detected on the golsfish platform
- Golsfish uses version 2.12.0 of qemu with a GICC_IIDR value of 0,
  read ICPIDR2 to determine the GIC version

Signed-off-by: wangming9 <wangming9@xiaomi.com>
This commit is contained in:
wangming9 2024-01-02 22:13:53 +08:00 committed by GUIDINGLI
parent a847ee1675
commit b3e640cf3f

View file

@ -786,14 +786,24 @@ static int gic_validate_dist_version(void)
if (reg == (0x2 << GIC_ICCIDR_ARCHNO_SHIFT))
{
sinfo("GICv2 detected\n");
}
else
{
sinfo("GICv2 not detected\n");
return -ENODEV;
return 0;
}
return 0;
/* Read the Peripheral ID2 Register (ICPIDR2) */
reg = getreg32(GIC_ICDPIDR(GIC_ICPIDR2)) & GICD_PIDR2_ARCH_MASK;
/* GIC Version should be 2 */
if (reg == GICD_PIDR2_ARCH_GICV2)
{
sinfo("GICv2 detected\n");
return 0;
}
sinfo("GICv2 not detected\n");
return -ENODEV;
}
/****************************************************************************