Skip to content

Commit

Permalink
WIP trying to debug GICv3 on qemu arm
Browse files Browse the repository at this point in the history
  • Loading branch information
travisg committed Sep 4, 2024
1 parent 54fe69c commit b11ead5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions dev/interrupt/arm_gic/arm_gic.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,15 @@ void arm_gic_init(void) {
#ifdef GICBASE
arm_gics[0].gicd_vaddr = GICBASE(0) + GICD_OFFSET;
arm_gics[0].gicd_size = GICD_MIN_SIZE;
TRACEF("GICD base %#lx, size %#zx\n", arm_gics[0].gicd_vaddr, arm_gics[0].gicd_size);
#if GIC_VERSION > 2
arm_gics[0].gicr_vaddr = GICBASE(0) + GICR_OFFSET;
arm_gics[0].gicr_size = GICR_CPU_OFFSET(SMP_MAX_CPUS - 1) + GICR_MIN_SIZE;
TRACEF("GICR base %#lx, size %#zx\n", arm_gics[0].gicr_vaddr, arm_gics[0].gicr_size);
#else /* GIC_VERSION > 2 */
arm_gics[0].gicc_vaddr = GICBASE(0) + GICC_OFFSET;
arm_gics[0].gicc_size = GICC_MIN_SIZE;
TRACEF("GICC base %#lx, size %#zx\n", arm_gics[0].gicc_vaddr, arm_gics[0].gicc_size);
#endif /* GIC_VERSION > 2 */
#else
/* Platforms should define GICBASE if they want to call this */
Expand Down
5 changes: 3 additions & 2 deletions dev/interrupt/arm_gic/gic_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

#include <arch/ops.h>
#include <assert.h>
#include <bits.h>
#include <lk/macros.h>
#include <lk/bits.h>
#include <lk/trace.h>
//#include <lk/macros.h>
#include <stdint.h>

#include <dev/interrupt/arm_gic.h>
Expand Down
5 changes: 5 additions & 0 deletions platform/qemu-virt-arm/include/platform/gic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <platform/qemu-virt.h>

#define GICBASE(n) (CPUPRIV_BASE_VIRT)

#define GICD_OFFSET (0x00000)
#define GICC_OFFSET (0x10000)

#if GIC_VERSION > 2
#define GICR_OFFSET (0xa0000)
#endif

2 changes: 2 additions & 0 deletions platform/qemu-virt-arm/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ GLOBAL_DEFINES += \
CONSOLE_HAS_INPUT_BUFFER=1 \
TIMER_ARM_GENERIC_SELECTED=CNTV

GIC_VERSION := 3

GLOBAL_DEFINES += MMU_WITH_TRAMPOLINE=1

LINKER_SCRIPT += \
Expand Down
2 changes: 1 addition & 1 deletion scripts/do-qemuarm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ shift $((OPTIND-1))
if [ $DO_64BIT == 1 ]; then
QEMU="qemu-system-aarch64"
CPU="cortex-a53"
MACHINE="virt"
MACHINE="virt,gic_version=3"
if [ $DO_KVM == 1 ]; then
CPU="host"
if [ $HOST_OS == "Darwin" ]; then
Expand Down

0 comments on commit b11ead5

Please sign in to comment.