Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capdl: set notification on x86 IRQ handlers #103

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion crates/sel4-capdl-initializer/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<cap_type::IrqHandler>(obj_id);
if let Some(logical_nfn_cap) = notification {
let nfn = match logical_nfn_cap.badge {
Expand Down
16 changes: 16 additions & 0 deletions crates/sel4-capdl-initializer/types/src/cap_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down