From: Antonios Motakis <antonios.mota...@huawei.com>

On AArch64 we won't need to initialize an IRQ stack; just move
the functionality to a header, so we may reuse the gic library.

Signed-off-by: Antonios Motakis <antonios.mota...@huawei.com>
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 inmates/lib/arm/gic.c         | 5 +----
 inmates/lib/arm/include/gic.h | 9 +++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/inmates/lib/arm/gic.c b/inmates/lib/arm/gic.c
index 925b348..22014d3 100644
--- a/inmates/lib/arm/gic.c
+++ b/inmates/lib/arm/gic.c
@@ -14,7 +14,6 @@
 #include <gic.h>
 
 static irq_handler_t irq_handler = (irq_handler_t)NULL;
-static __attribute__((aligned(0x1000))) u32 irq_stack[1024];
 
 /* Replaces the weak reference in header.S */
 void vector_irq(void)
@@ -38,9 +37,7 @@ void gic_setup(irq_handler_t handler)
        gic_init();
        irq_handler = handler;
 
-       asm volatile (".arch_extension virt\n");
-       asm volatile ("msr      SP_irq, %0\n" : : "r" (irq_stack));
-       asm volatile ("cpsie    i\n");
+       gic_setup_irq_stack();
 }
 
 void gic_enable_irq(unsigned int irq)
diff --git a/inmates/lib/arm/include/gic.h b/inmates/lib/arm/include/gic.h
index 96047e6..23b0e90 100644
--- a/inmates/lib/arm/include/gic.h
+++ b/inmates/lib/arm/include/gic.h
@@ -21,6 +21,15 @@
 
 #ifndef __ASSEMBLY__
 
+static inline void gic_setup_irq_stack(void)
+{
+       static __attribute__((aligned(0x1000))) u32 irq_stack[1024];
+
+       asm volatile (".arch_extension virt\n");
+       asm volatile ("msr      SP_irq, %0\n" : : "r" (irq_stack));
+       asm volatile ("cpsie    i\n");
+}
+
 int gic_init(void);
 void gic_enable(unsigned int irqn);
 void gic_write_eoi(u32 irqn);
-- 
2.1.4

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to