[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



Hi,

On 20/11/2018 10:18, Jianyong Wu wrote:
From: Wei Chen <wei.chen@xxxxxxx>

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
  plat/common/arm/traps.c   | 25 +++++++++++++++++++++++++
  plat/kvm/arm/exceptions.S | 10 +++++++++-
  2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/plat/common/arm/traps.c b/plat/common/arm/traps.c
index 43235be..df1b5c7 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,27 @@ 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) {
+                       _ukplat_irq_handle((unsigned long)irq);
+                       gic_eoi_irq(stat);
+                       isb();

Can you explain why you need an isb() after gic_eoi_irq?

On the previous patch the isb() was just before _ukplat_irq_handle(). The position made sense because you want to ensure that all the system registers are synchronized after receiving the interrupt (see [1]).

Cheers,

[1] https://lists.xenproject.org/archives/html/xen-devel/2018-10/msg01802.html

--
Julien Grall

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.