armv8: Port irq cap invocations
authorLukas Humbel <lukas.humbel@inf.ethz.ch>
Thu, 14 Nov 2019 16:39:46 +0000 (17:39 +0100)
committerLukas Humbel <lukas.humbel@inf.ethz.ch>
Mon, 18 Nov 2019 11:53:02 +0000 (12:53 +0100)
Signed-off-by: Lukas Humbel <lukas.humbel@inf.ethz.ch>

kernel/arch/arm/gic_v3.c
kernel/arch/arm/irq.c
kernel/arch/armv8/syscall.c
kernel/include/arch/armv8/irq.h

index cb08ac1..38e6564 100644 (file)
@@ -63,7 +63,7 @@ void gic_init(void)
         itlines = 1020;
     printk(LOG_NOTE, "gic: #INTIDs supported: %" PRIu32 "\n", itlines);
 
-    // Put all interrupts into Group 1 and enable them
+    // Put all interrupts into Group 1 and disable them
     #define MASK_32     0xffffffff
     for (int i = 0; i * 32 < itlines; i++) {
         // Clear
index 0340b15..96b23d5 100644 (file)
@@ -15,7 +15,7 @@
 #include <barrelfish_kpi/syscalls.h>
 #include <barrelfish_kpi/sys_debug.h>
 
-#include <arch/armv7/irq.h>
+#include <irq.h>
 
 #include <paging_kernel_arch.h>
 #include <dispatch.h>
@@ -99,7 +99,7 @@ errval_t irq_table_alloc_dest_cap(uint8_t dcn_level, capaddr_t dcn,
         return SYS_ERR_IRQ_INVALID;
     }
     if(vec_hint >= NDISPATCH){
-        printk(LOG_WARN, "irq: vec_hint invalid\n", vec_hint);
+        printk(LOG_WARN, "irq: vec_hint (%d) invalid\n", vec_hint);
         return SYS_ERR_IRQ_INVALID;
     }
 
index 1aae2d1..d5355b5 100644 (file)
@@ -781,26 +781,65 @@ INVOCATION_HANDLER(monitor_identify_domains_cap)
     return sys_monitor_identify_cap(root, cptr, bits, retbuf);
 }
 
-static struct sysret handle_irq_table_set( struct capability* to,
-        arch_registers_state_t* context, int argc)
+static struct sysret handle_irqsrc_get_vec_start(struct capability *to,
+        arch_registers_state_t* context,
+        int argc)
+{
+    struct sysret ret;
+    ret.error = SYS_ERR_OK;
+    ret.value = to->u.irqsrc.vec_start;
+    return ret;
+}
+
+static struct sysret handle_irqsrc_get_vec_end(struct capability *to,
+        arch_registers_state_t* context,
+        int argc)
+{
+    struct sysret ret;
+    ret.error = SYS_ERR_OK;
+    ret.value = to->u.irqsrc.vec_end;
+    return ret;
+}
+
+
+static struct sysret handle_irqdest_connect(struct capability* to,
+        arch_registers_state_t* context,
+        int argc)
+
 {
     struct registers_aarch64_syscall_args* sa = &context->syscall_args;
+    return SYSRET(irq_connect(to, sa->arg2));
+}
 
-    return SYSRET(irq_table_set(sa->arg2, sa->arg3));
+static struct sysret handle_irqdest_get_vector(struct capability *to,
+        arch_registers_state_t* context,
+        int argc)
+{
+    struct sysret ret;
+    ret.error = SYS_ERR_OK;
+    ret.value = to->u.irqdest.vector;
+    return ret;
 }
 
+static struct sysret handle_irqdest_get_cpu(struct capability *to,
+        arch_registers_state_t* context,
+        int argc)
+{
+    struct sysret ret;
+    ret.error = SYS_ERR_OK;
+    ret.value = to->u.irqdest.cpu;
+    return ret;
+}
 
-static struct sysret handle_irq_table_delete( struct capability* to,
+static struct sysret handle_irq_table_alloc_dest_cap(struct capability* to,
         arch_registers_state_t* context,
         int argc
         )
 {
     struct registers_aarch64_syscall_args* sa = &context->syscall_args;
-
-    return SYSRET(irq_table_delete(sa->arg2));
+    return SYSRET(irq_table_alloc_dest_cap(sa->arg2, sa->arg3, sa->arg4, sa->arg5));
 }
 
-
 static struct sysret dispatcher_dump_ptables(
     struct capability* to, arch_registers_state_t* context, int argc)
 {
@@ -971,9 +1010,17 @@ static invocation_t invocations[ObjType_Num][CAP_MAX_CMD] = {
         [MappingCmd_Destroy] = handle_mapping_destroy,
         [MappingCmd_Modify] = handle_mapping_modify,
     },
+       [ObjType_IRQSrc] = {
+        [IRQSrcCmd_GetVecStart] = handle_irqsrc_get_vec_start,
+        [IRQSrcCmd_GetVecEnd] = handle_irqsrc_get_vec_end
+       },
+       [ObjType_IRQDest] = {
+        [IRQDestCmd_Connect] = handle_irqdest_connect,
+        [IRQDestCmd_GetVector] = handle_irqdest_get_vector,
+        [IRQDestCmd_GetCpu] = handle_irqdest_get_cpu
+       },
     [ObjType_IRQTable] = {
-            [IRQTableCmd_Set] = handle_irq_table_set,
-            [IRQTableCmd_Delete] = handle_irq_table_delete,
+            [IRQTableCmd_AllocDestCap] = handle_irq_table_alloc_dest_cap,
         },
     [ObjType_Kernel] = {
         [KernelCmd_Cap_has_relations] = monitor_cap_has_relations,
index 7786a27..b366b7a 100644 (file)
 #define KERNEL_ARCH_ARM_IRQ_H
 
 /*
- * Interrupt controller (Cortex-A9 MPU INTC) with up to 128 interrupt requests
+ * INTIDs from exceptions to and including SPIs
  */
-#define NUM_INTR                (128+32)
+#define NUM_INTR                (1024)
 
 /// Size of hardware IRQ dispatch table == #NIDT - #NEXCEPTIONS exceptions
 #define NDISPATCH               (NUM_INTR)
 
 struct capability;
 struct idc_recv_msg;
-//struct sysret irq_table_set(struct capability *to, struct idc_recv_msg *msg);
-//struct sysret irq_table_delete(struct capability *to, struct idc_recv_msg *msg);
+
 errval_t irq_table_set(unsigned int nidt, capaddr_t endpoint);
 errval_t irq_table_delete(unsigned int nidt);
+errval_t irq_connect(struct capability *irq_dest, capaddr_t endpoint);
+errval_t irq_table_alloc_dest_cap(uint8_t dcn_vbits, capaddr_t dcn,
+        capaddr_t out_cap_addr, int vec_hint);
+
 struct kcb;
 errval_t irq_table_notify_domains(struct kcb *kcb);
 void send_user_interrupt(int irq);