feat(interrupts): initialize interrupt controller
This patch adds support for initializing interrupt controller interface
while booting hafnium.
We also provide dummy implementation of various interfaces for GICv3
interrupt controller here. The correct implementation is provided in
the following patch.
Change-Id: I40c17ca53e62abffc43b70b1c1bc538734f827b1
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/src/arch/aarch64/hypervisor/cpu.c b/src/arch/aarch64/hypervisor/cpu.c
index a75cff3..1ae0796 100644
--- a/src/arch/aarch64/hypervisor/cpu.c
+++ b/src/arch/aarch64/hypervisor/cpu.c
@@ -16,6 +16,7 @@
#include "hf/addr.h"
#include "hf/ffa.h"
+#include "hf/plat/interrupts.h"
#include "hf/std.h"
#include "hf/vm.h"
@@ -198,4 +199,6 @@
/* Initialize counter-timer virtual offset register to 0. */
write_msr(CNTVOFF_EL2, 0);
+
+ plat_interrupts_controller_hw_init(c);
}
diff --git a/src/arch/aarch64/plat/interrupts/gicv3.c b/src/arch/aarch64/plat/interrupts/gicv3.c
index 940cd18..e53ba6c 100644
--- a/src/arch/aarch64/plat/interrupts/gicv3.c
+++ b/src/arch/aarch64/plat/interrupts/gicv3.c
@@ -6,11 +6,32 @@
* https://opensource.org/licenses/BSD-3-Clause.
*/
+#include "hf/plat/interrupts.h"
#include "hf/types.h"
#include "msr.h"
+bool plat_interrupts_controller_driver_init(
+ const struct fdt *fdt, struct mm_stage1_locked stage1_locked,
+ struct mpool *ppool)
+{
+ (void)fdt;
+ (void)stage1_locked;
+ (void)ppool;
+ return true;
+}
+
+void plat_interrupts_controller_hw_init(struct cpu *c)
+{
+ (void)c;
+}
+
void plat_interrupts_set_priority_mask(uint8_t min_priority)
{
write_msr(ICC_PMR_EL1, min_priority);
}
+
+void plat_interrupts_configure_interrupt(struct interrupt_descriptor int_desc)
+{
+ (void)int_desc;
+}
diff --git a/src/arch/fake/hypervisor/cpu.c b/src/arch/fake/hypervisor/cpu.c
index 8f3a5ad..cc35dd7 100644
--- a/src/arch/fake/hypervisor/cpu.c
+++ b/src/arch/fake/hypervisor/cpu.c
@@ -50,4 +50,6 @@
{
(void)c;
(void)entry_point;
+
+ plat_interrupts_controller_hw_init(c);
}
diff --git a/src/init.c b/src/init.c
index d9cb1d7..db05ad9 100644
--- a/src/init.c
+++ b/src/init.c
@@ -27,6 +27,7 @@
#include "hf/panic.h"
#include "hf/plat/boot_flow.h"
#include "hf/plat/console.h"
+#include "hf/plat/interrupts.h"
#include "hf/plat/iommu.h"
#include "hf/std.h"
#include "hf/vm.h"
@@ -147,6 +148,11 @@
cpu_module_init(params.cpu_ids, params.cpu_count);
+ if (!plat_interrupts_controller_driver_init(&fdt, mm_stage1_locked,
+ &ppool)) {
+ panic("Could not initialize Interrupt Controller driver.");
+ }
+
/* Load all VMs. */
update.reserved_ranges_count = 0;
if (!load_vms(mm_stage1_locked, &manifest, &cpio, ¶ms, &update,
diff --git a/src/load.c b/src/load.c
index 14194ec..28e886c 100644
--- a/src/load.c
+++ b/src/load.c
@@ -175,6 +175,11 @@
infer_interrupt(interrupt, &int_desc);
vm_locked.vm->interrupt_desc[k] = int_desc;
+ /*
+ * Configure the physical interrupts allocated for this
+ * VM in its partition manifest.
+ */
+ plat_interrupts_configure_interrupt(int_desc);
k++;
CHECK(k <= VM_MANIFEST_MAX_INTERRUPTS);
}