From b312f075547d35c3e35a86afdca2276241dec4b8 Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Sat, 2 Mar 2024 13:56:05 +1100 Subject: [PATCH] capdl: set notification on x86 IRQ handlers Signed-off-by: Ivan Velickovic --- crates/sel4-capdl-initializer/core/src/lib.rs | 14 +++++++++++++- .../types/src/cap_table.rs | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/crates/sel4-capdl-initializer/core/src/lib.rs b/crates/sel4-capdl-initializer/core/src/lib.rs index 5a4add559..b28f66231 100644 --- a/crates/sel4-capdl-initializer/core/src/lib.rs +++ b/crates/sel4-capdl-initializer/core/src/lib.rs @@ -416,8 +416,20 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject .spec() .filter_objects::<&object::ArmIrq>() .map(|(obj_id, obj)| (obj_id, obj.notification())); + let msi_irq_notifications = self + .spec() + .filter_objects::<&object::IrqMsi>() + .map(|(obj_id, obj)| (obj_id, obj.notification())); + let ioapic_irq_notifications = self + .spec() + .filter_objects::<&object::IrqIOApic>() + .map(|(obj_id, obj)| (obj_id, obj.notification())); - for (obj_id, notification) in irq_notifications.chain(arm_irq_notifications) { + let all_irq_notifications = irq_notifications + .chain(arm_irq_notifications) + .chain(msi_irq_notifications) + .chain(ioapic_irq_notifications); + for (obj_id, notification) in all_irq_notifications { let irq_handler = self.orig_cap::(obj_id); if let Some(logical_nfn_cap) = notification { let nfn = match logical_nfn_cap.badge { diff --git a/crates/sel4-capdl-initializer/types/src/cap_table.rs b/crates/sel4-capdl-initializer/types/src/cap_table.rs index 7207fc14d..f8946eee7 100644 --- a/crates/sel4-capdl-initializer/types/src/cap_table.rs +++ b/crates/sel4-capdl-initializer/types/src/cap_table.rs @@ -104,6 +104,22 @@ impl<'a> object::ArmIrq<'a> { } } +impl<'a> object::IrqMsi<'a> { + pub const SLOT_NOTIFICATION: CapSlot = 0; + + pub fn notification(&self) -> Option<&cap::Notification> { + self.maybe_slot_as(Self::SLOT_NOTIFICATION) + } +} + +impl<'a> object::IrqIOApic<'a> { + pub const SLOT_NOTIFICATION: CapSlot = 0; + + pub fn notification(&self) -> Option<&cap::Notification> { + self.maybe_slot_as(Self::SLOT_NOTIFICATION) + } +} + // // // impl<'a> object::PageTable<'a> {