From 066a9e7a5db574e45d365809b7dae2c80a43b2cf Mon Sep 17 00:00:00 2001 From: Michalis Pappas Date: Sun, 10 Sep 2023 23:59:12 +0200 Subject: [PATCH] plat/kvm: Remove IRQ acknowledgment from uk_intctlr_handle_irq The method of interrupt acknowledgment varies between interrupt controllers. On GIC interupts are implicitly ACKed when reading the interrupt id from GICC_IAR before passing control to the interrupt handler, and completion is signaled post handling via the GICC_EOIR. On x86 controllers acknowledgment happens after interrupt handling is complete. Remove the explicit interrupt acknledgment from `uk_intctlr_handle_irq()` as it causes duplicate acknowledgment on Arm, and move it to `ops->handle_irq()` of the xPIC driver. Notice: Picking individual commits in this PR will break the build. Signed-off-by: Michalis Pappas Reviewed-by: Marco Schlumpp Reviewed-by: Sergiu Moga Approved-by: Razvan Deaconescu GitHub-Closes: #1103 --- lib/ukintctlr/ukintctlr.c | 7 +++---- plat/kvm/x86/cpu_vectors_x86_64.S | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ukintctlr/ukintctlr.c b/lib/ukintctlr/ukintctlr.c index 668bd796e..fd477c44e 100644 --- a/lib/ukintctlr/ukintctlr.c +++ b/lib/ukintctlr/ukintctlr.c @@ -125,7 +125,7 @@ void uk_intctlr_irq_handle(struct __regs *regs, unsigned int irq) /* Skip all normal handlers if an event handler handled the * event */ - goto exit_ack; + goto exit; } for (i = 0; i < MAX_HANDLERS_PER_IRQ; i++) { @@ -146,7 +146,7 @@ void uk_intctlr_irq_handle(struct __regs *regs, unsigned int irq) __uk_test_and_set_bit(0, &sched_have_pending_events); if (h->func(h->arg) == 1) - goto exit_ack; + goto exit; } /* * Acknowledge interrupts even in the case when there was no handler for @@ -156,11 +156,10 @@ void uk_intctlr_irq_handle(struct __regs *regs, unsigned int irq) */ trace_uk_intctlr_unhandled_irq(irq); -exit_ack: +exit: #if CONFIG_LIBUKINTCTLR_ISR_ECTX_ASSERTIONS ukarch_ectx_assert_equal(ectx); #endif /* CONFIG_LIBUKINTCTLR_ISR_ECTX_ASSERTIONS */ - intctrl_ack_irq(irq); return; } diff --git a/plat/kvm/x86/cpu_vectors_x86_64.S b/plat/kvm/x86/cpu_vectors_x86_64.S index de7887c7b..9a9bab9d4 100644 --- a/plat/kvm/x86/cpu_vectors_x86_64.S +++ b/plat/kvm/x86/cpu_vectors_x86_64.S @@ -26,6 +26,7 @@ #include #include +#include #define ENTRY(X) .global X ; .type X, @function ; X: @@ -143,7 +144,7 @@ ENTRY(cpu_irq_\irqno) movq %rsp, %rdi movq $\irqno, %rsi - call _ukplat_irq_handle + call uk_intctlr_xpic_handle_irq addq $__REGS_PAD_SIZE, %rsp /* we have some padding */ .cfi_adjust_cfa_offset -__REGS_PAD_SIZE -- 2.39.5