From 1884398e91ca77523141fe8a76c6555fb40dc425 Mon Sep 17 00:00:00 2001 From: maskedarray Date: Mon, 7 Aug 2023 18:26:10 -0400 Subject: [PATCH] working pmu interrupts in bao hypervisor --- bao-hypervisor/src/core/console.c | 4 ++++ bao-hypervisor/src/core/inc/console.h | 2 ++ bao-hypervisor/src/core/interrupts.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/bao-hypervisor/src/core/console.c b/bao-hypervisor/src/core/console.c index 5e50670..aba666c 100644 --- a/bao-hypervisor/src/core/console.c +++ b/bao-hypervisor/src/core/console.c @@ -23,6 +23,10 @@ #include #include +void pmu_v1_interrupt_handler(){ + printk("PMU interrupt in hypervisor\n\r"); +} + volatile bao_uart_t uart __attribute__((section(".devices"), aligned(PAGE_SIZE))); bool ready = false; diff --git a/bao-hypervisor/src/core/inc/console.h b/bao-hypervisor/src/core/inc/console.h index 90719b8..82973fb 100644 --- a/bao-hypervisor/src/core/inc/console.h +++ b/bao-hypervisor/src/core/inc/console.h @@ -30,6 +30,8 @@ typedef struct { extern volatile pmu_v1_global_t pmu_v1_global __attribute__((section(".devices"))); +void pmu_v1_interrupt_handler(); + void console_init(); void console_write(char const* const str); diff --git a/bao-hypervisor/src/core/interrupts.c b/bao-hypervisor/src/core/interrupts.c index 876d62d..46b97b4 100644 --- a/bao-hypervisor/src/core/interrupts.c +++ b/bao-hypervisor/src/core/interrupts.c @@ -20,6 +20,7 @@ #include #include #include +#include BITMAP_ALLOC(hyp_interrupt_bitmap, MAX_INTERRUPTS); BITMAP_ALLOC(global_interrupt_bitmap, MAX_INTERRUPTS); @@ -52,6 +53,8 @@ inline void interrupts_init() if (cpu.id == CPU_MASTER) { interrupts_reserve(IPI_CPU_MSG, cpu_msg_handler); + interrupts_reserve(143, pmu_v1_interrupt_handler); + interrupts_cpu_enable(143, true); } interrupts_cpu_enable(IPI_CPU_MSG, true);