From 27859a754130135d67ba7f5992c5d71c9bedfca3 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Thu, 26 Dec 2019 00:33:21 +0000 Subject: [PATCH] thermosphere: vgic: fix enabled state of virqs --- thermosphere/src/vgic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/thermosphere/src/vgic.c b/thermosphere/src/vgic.c index 206070819..359fec71f 100644 --- a/thermosphere/src/vgic.c +++ b/thermosphere/src/vgic.c @@ -265,6 +265,8 @@ static void vgicSetInterruptEnabledState(u16 id) if (vgicIsVirqPending(state)) { vgicNotifyOtherCoreList(g_irqManager.gic.gicd->itargetsr[id]); } + + g_irqManager.gic.gicd->isenabler[id / 32] |= BIT(id % 32); } static void vgicClearInterruptEnabledState(u16 id) @@ -282,7 +284,7 @@ static void vgicClearInterruptEnabledState(u16 id) vgicNotifyOtherCoreList(BIT(vgicGetVirqStateCoreId(state))); } - g_irqManager.gic.gicd->isenabler[id / 32] &= ~BIT(id % 32); + g_irqManager.gic.gicd->icenabler[id / 32] |= ~BIT(id % 32); } static inline bool vgicGetInterruptEnabledState(u16 id) @@ -671,7 +673,7 @@ static bool vgicTestInterruptEligibility(VirqState *state) return false; } - return vgicIsVirqEnabled(id) && (g_irqManager.gic.gicd->itargetsr[id] & BIT(currentCoreCtx->coreId)) != 0; + return vgicGetInterruptEnabledState(id) && (id < 32 || (g_irqManager.gic.gicd->itargetsr[id] & BIT(currentCoreCtx->coreId)) != 0); } // Returns highest priority