Skip to content

Commit

Permalink
Adjust vIRQ code for library restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Velickovic committed Jul 10, 2023
1 parent afff508 commit bff182a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/arch/aarch64/vgic/vdist.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include "fault.h"
#include "../../util/util.h"
#include "util.h"

/* GIC Distributor register access utilities */
#define GIC_DIST_REGN(offset, reg) ((offset-reg)/sizeof(uint32_t))
Expand Down
2 changes: 1 addition & 1 deletion src/arch/aarch64/vgic/vgic.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool handle_vgic_maintenance(size_t vcpu_id)
}

// @ivanv: maybe this shouldn't be here?
bool vgic_register_irq(uint64_t vcpu_id, int virq_num, irq_ack_fn_t ack_fn, void *ack_data) {
bool vgic_register_irq(size_t vcpu_id, int virq_num, virq_ack_fn_t ack_fn, void *ack_data) {
assert(virq_num >= 0 && virq_num != VIRQ_INVALID);
struct virq_handle virq = {
.virq = virq_num,
Expand Down
5 changes: 3 additions & 2 deletions src/arch/aarch64/vgic/vgic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
#include <sel4cp.h>
#include <stdbool.h>
#include <stdint.h>
#include "../../../virq.h"

// @ivanv: this should all come from the DTS!
// @ivanv: either this should all be compile time or all runtime
// as in initialising the vgic should depend on the runtime values
#if defined(BOARD_qemu_arm_virt_hyp)
#define GIC_V2
#define GIC_DIST_PADDR 0x8000000
Expand Down Expand Up @@ -55,8 +58,6 @@
#define LOG_DIST(...) do{}while(0)
#endif

typedef void (*virq_ack_fn_t)(uint64_t vcpu_id, int irq, void *cookie);

void vgic_init();
bool handle_vgic_maintenance(size_t vcpu_id);
bool handle_vgic_dist_fault(size_t vcpu_id, uint64_t fault_addr, uint64_t fsr, seL4_UserContext *regs);
Expand Down
1 change: 1 addition & 0 deletions src/arch/aarch64/vgic/vgic_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "vdist.h"
#include "../../util/util.h"
#include "fault.h"
#include "../../../virq.h"

vgic_t vgic;
struct gic_dist_map dist;
Expand Down
2 changes: 1 addition & 1 deletion src/arch/aarch64/vgic/vgic_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma once

#include <stdint.h>
#include "../../util/util.h"
#include "util.h"

#define GIC_ENABLED 1

Expand Down
4 changes: 1 addition & 3 deletions src/arch/aarch64/vgic/virq.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <stdint.h>
#include <stdbool.h>
#include "../../util/util.h"
#include "util.h"

/* The ARM GIC architecture defines 16 SGIs (0 - 7 is recommended for non-secure
* state, 8 - 15 for secure state), 16 PPIs (interrupt 16 - 31) and 988 SPIs
Expand All @@ -30,8 +30,6 @@

#define VIRQ_INVALID -1

typedef void (*irq_ack_fn_t)(size_t vcpu_id, int irq, void *cookie);

struct virq_handle {
int virq;
virq_ack_fn_t ack_fn;
Expand Down
1 change: 1 addition & 0 deletions src/arch/aarch64/virq.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ static void sgi_ack(size_t vcpu_id, int irq, void *cookie) {}

bool virq_controller_init(size_t boot_vcpu_id) {
vgic_init();
// @ivanv: todo, do this dynamically instead of compile time?
#if defined(GIC_V2)
LOG_VMM("initialised virtual GICv2 driver\n");
#elif defined(GIC_V3)
Expand Down
4 changes: 3 additions & 1 deletion src/virq.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <stddef.h>
#include <sel4cp.h>
#include <stdbool.h>

typedef void (*virq_ack_fn_t)(size_t vcpu_id, int irq, void *cookie);

bool virq_controller_init(size_t boot_vcpu_id);
bool virq_register(size_t vcpu_id, size_t virq_num, virq_ack_fn_t ack_fn, void *ack_data);
Expand Down

0 comments on commit bff182a

Please sign in to comment.