[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCHv3 2/7] plat/common: Define __MAX_IRQ for different architectures



From: Wei Chen <wei.chen@xxxxxxx>

In current IRQ framework, we only support 16 irq_handlers. This is
well for x86 legacy interrupts. But for Arm, it's not enough. In
this case, we defined __MAX_IRQ 1020 for Arm and keep __MAX_IRQ 16
for x86. This will waste some space, but we can keep O(1) efficency.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Jia He <justin.he@xxxxxxx>
Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/common/include/arm/irq.h | 2 ++
 plat/common/include/x86/irq.h | 2 ++
 plat/kvm/irq.c                | 7 ++++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/plat/common/include/arm/irq.h b/plat/common/include/arm/irq.h
index ba85183..b81fa9e 100644
--- a/plat/common/include/arm/irq.h
+++ b/plat/common/include/arm/irq.h
@@ -41,4 +41,6 @@
 #error "Add irq.h for current architecture."
 #endif
 
+#define __MAX_IRQ      1020
+
 #endif /* __PLAT_CMN_ARM_IRQ_H__ */
diff --git a/plat/common/include/x86/irq.h b/plat/common/include/x86/irq.h
index a0f01f8..f2bf2d9 100644
--- a/plat/common/include/x86/irq.h
+++ b/plat/common/include/x86/irq.h
@@ -84,4 +84,6 @@ static inline int irqs_disabled(void)
 #define local_irq_disable()      __cli()
 #define local_irq_enable()       __sti()
 
+#define __MAX_IRQ      16
+
 #endif /* __PLAT_CMN_X86_IRQ_H__ */
diff --git a/plat/kvm/irq.c b/plat/kvm/irq.c
index ef95a02..32042af 100644
--- a/plat/kvm/irq.c
+++ b/plat/kvm/irq.c
@@ -29,7 +29,8 @@
 #include <uk/alloc.h>
 #include <uk/list.h>
 #include <uk/plat/lcpu.h>
-#include <x86/cpu.h>
+#include <cpu.h>
+#include <irq.h>
 #include <kvm/irq.h>
 #include <kvm/intctrl.h>
 #include <uk/assert.h>
@@ -46,14 +47,14 @@ struct irq_handler {
 };
 
 UK_SLIST_HEAD(irq_handler_head, struct irq_handler);
-static struct irq_handler_head irq_handlers[16];
+static struct irq_handler_head irq_handlers[__MAX_IRQ];
 
 int ukplat_irq_register(unsigned long irq, irq_handler_func_t func, void *arg)
 {
        struct irq_handler *h;
        unsigned long flags;
 
-       UK_ASSERT(irq < 16);
+       UK_ASSERT(irq < __MAX_IRQ);
        UK_ASSERT(allocator != NULL);
 
        h = uk_malloc(allocator, sizeof(struct irq_handler));
-- 
2.17.1


_______________________________________________
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®.