Skip to content

Commit

Permalink
arch: arm64: Fix GICv2 detection
Browse files Browse the repository at this point in the history
Summary:
- I noticed that qemu-armv8a:netnsh_smp_hv does not detect
  GICv2 on Raspi4B (ubuntu 22.04 server + qemu-8.1.2)
- According to the GIC-400 TRM, it says that the architecture
  version can be obtained from GICC_IIDR (See Table 3-7)
- This commit fixes this issue.

Impact:
- Should be none

Testing:
- Tested with qemu-armv8a:netnsh_smp_hv on
  - Raspi3B+ (ubuntu 22.04 server + qemu-8.1.2)
  - Raspi4B (ubuntu 22.04 server + qemu-8.1.2)
  - M1/MacBook Pro 2021 (macOS 13.6 + qemu-8.1.2)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
  • Loading branch information
masayuki2009 authored and xiaoxiang781216 committed Dec 21, 2023
1 parent 41a3c8a commit 40843b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/arm64/src/common/arm64_gicv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ static int gic_validate_dist_version(void)
{
uint32_t reg;

/* Read the Peripheral ID2 Register (ICPIDR2) */
/* Read the CPU Interface Implementer ID Register */

reg = getreg32(GIC_ICDPIDR(GIC_ICPIDR2)) & GICD_PIDR2_ARCH_MASK;
reg = getreg32(GIC_ICCIDR) & GIC_ICCIDR_ARCHNO_MASK;

/* GIC Version should be 2 */

if (reg == GICD_PIDR2_ARCH_GICV2)
if (reg == (0x2 << GIC_ICCIDR_ARCHNO_SHIFT))
{
sinfo("GICv2 detected\n");
}
Expand Down

0 comments on commit 40843b7

Please sign in to comment.