[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT RFC PATCH 2/2] plat/common: Add a trap function to handle Arm64 irq trap
On 11/10/18 2:02 PM, Jianyong Wu (Arm Technology China) wrote: Hi, Hi, -----Original Message----- From: Julien Grall <julien.grall@xxxxxxx> Sent: Saturday, November 10, 2018 1:56 AM To: Jianyong Wu (Arm Technology China) <Jianyong.Wu@xxxxxxx>; minios- devel@xxxxxxxxxxxxxxxxxxxx; simon.kuenzer@xxxxxxxxx Cc: Kaly Xin (Arm Technology China) <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>; Wei Chen (Arm Technology China) <Wei.Chen@xxxxxxx> Subject: Re: [Minios-devel] [UNIKRAFT RFC PATCH 2/2] plat/common: Add a trap function to handle Arm64 irq trap Hi, On 09/11/2018 09:02, Jianyong Wu wrote:From: Wei Chen <wei.chen@xxxxxxx> Change-Id: I3652599f8385fc67a29ab2d9e67861590c0f9f6c Signed-off-by: Wei Chen <wei.chen@xxxxxxx> --- plat/common/arm/traps.c | 27 +++++++++++++++++++++++++++ plat/kvm/arm/exceptions.S | 10 +++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/plat/common/arm/traps.c b/plat/common/arm/traps.c index 43235be..257106b 100644 --- a/plat/common/arm/traps.c +++ b/plat/common/arm/traps.c @@ -23,6 +23,7 @@ #include <string.h> #include <uk/print.h> #include <uk/assert.h> +#include <arm/gic-v2.h> static const char *exception_modes[]= { "Synchronous Abort", @@ -68,3 +69,29 @@ void trap_el1_sync(struct __regs *regs, uint64_t far) dump_registers(regs, far); ukplat_crash(); } + +void trap_el1_irq(struct __regs *regs, uint64_t far) { + uint32_t stat, irq; + + do { + stat = gic_ack_irq(); + irq = stat & GICC_IAR_INTID_MASK; + + uk_printd(DLVL_CRIT, "Unikraft: EL1 IRQ#%d trap caught\n",irq);+ + /* + * TODO: Hanle IPI&SGI interrupts here + */ + if (irq < GIC_MAX_IRQ) { + gic_eoi_irq(stat); + isb(); + _ukplat_irq_handle((unsigned long)irq); + continue; + }Looking again at this code, could you explain why you EOI the interrupt before handling it?I just copy this from freebsd, but I don't know why. Do you know why bsd does that? I guess you mean you copied from sys/arm/arm/gic.c? I took a look at it and also at sys/arm64/arm64/gic_v3.c. FreeBSD is EOIing the interrupt early (i.e before the handler is called) only for edge-interrupt and IPI. For level interrupt, they will be acknowledge later. This is because as soon as you EOI a level interrupt, it can possibly fire again because the interrupt line is still high/low. For simplicity, I would always EOI the interrupt after _ukplat_irq_handle(...) is called. Cheers, -- Julien Grall _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |