Skip to content

Commit

Permalink
libsel4vm: add gic_dist_is_enabled()
Browse files Browse the repository at this point in the history
This is a preparation for GICv3 support, where this function becomes
more complex.

Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
Axel Heider committed May 29, 2023
1 parent d6b0557 commit 34ae815
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions libsel4vm/src/arch/arm/vgic/gicv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ struct gic_dist_map {
uint32_t component_id[4]; /* [0xFF0, 0xFFF] */
};

static inline bool gic_dist_is_enabled(vgic_t *vgic)
{
return (0 != vgic->dist->enable);
}

static inline void vgic_dist_set_ctlr(vgic_t *vgic, uint32_t data)
{
/* ToDo: we should care about bit 0 only and ignore all the others. */
Expand Down
2 changes: 1 addition & 1 deletion libsel4vm/src/arch/arm/vgic/vdist.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int vgic_dist_set_pending_irq(vgic_t *vgic, vm_vcpu_t *vcpu, int irq)

struct virq_handle *virq_data = virq_find_irq_data(vgic, vcpu, irq);

if (!virq_data || !vgic->dist->enable || !is_enabled(vgic->dist, irq, vcpu->vcpu_id)) {
if (!virq_data || !gic_dist_is_enabled(vgic) || !is_enabled(vgic->dist, irq, vcpu->vcpu_id)) {
DDIST("IRQ not enabled (%d) on vcpu %d\n", irq, vcpu->vcpu_id);
return -1;
}
Expand Down

0 comments on commit 34ae815

Please sign in to comment.