From f55d06fd5c9b1e5438c69cfb2afddc79ca745faf Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Tue, 3 Oct 2023 15:46:36 +0200 Subject: [PATCH] base-nova: allow MSI for non-PCI devices DMA remapping hardware units use MSI for fault events. However, MSI were bound to the presence of a PCI configuration space. genodelabs/genode#5002 --- repos/base-nova/patches/syscall_msi.patch | 13 +++++++++++++ repos/base-nova/ports/nova.hash | 2 +- repos/base-nova/ports/nova.port | 1 + repos/base-nova/src/core/irq_session_component.cc | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 repos/base-nova/patches/syscall_msi.patch diff --git a/repos/base-nova/patches/syscall_msi.patch b/repos/base-nova/patches/syscall_msi.patch new file mode 100644 index 0000000000..b112ab71ed --- /dev/null +++ b/repos/base-nova/patches/syscall_msi.patch @@ -0,0 +1,13 @@ +diff --git a/src/syscall.cpp b/src/syscall.cpp +index 838bfee..5619293 100644 +--- a/src/syscall.cpp ++++ b/src/syscall.cpp +@@ -1205,7 +1205,7 @@ void Ec::sys_assign_gsi() + sys_finish(); + } + +- if (EXPECT_FALSE (!Gsi::gsi_table[gsi].ioapic && (!Pd::current->Space_mem::lookup (r->dev(), phys) || ((rid = Pci::phys_to_rid (phys)) == ~0U && (rid = Hpet::phys_to_rid (phys)) == ~0U)))) { ++ if (EXPECT_FALSE (!Gsi::gsi_table[gsi].ioapic && r->dev() && (!Pd::current->Space_mem::lookup (r->dev(), phys) || ((rid = Pci::phys_to_rid (phys)) == ~0U && (rid = Hpet::phys_to_rid (phys)) == ~0U)))) { + trace (TRACE_ERROR, "%s: Non-DEV CAP (%#lx)", __func__, r->dev()); + sys_finish(); + } diff --git a/repos/base-nova/ports/nova.hash b/repos/base-nova/ports/nova.hash index 3e6a854a0e..f38e17f8b5 100644 --- a/repos/base-nova/ports/nova.hash +++ b/repos/base-nova/ports/nova.hash @@ -1 +1 @@ -e104241c249b88b6e0a4ff74bda67996dfa200c4 +851c274f32d9ba3706a20407755ce6d17139afc6 diff --git a/repos/base-nova/ports/nova.port b/repos/base-nova/ports/nova.port index 26e801c482..4a683c12b7 100644 --- a/repos/base-nova/ports/nova.port +++ b/repos/base-nova/ports/nova.port @@ -8,3 +8,4 @@ REV(nova) := 3e34fa6c35c55566ae57a1fd654262964ffcf544 DIR(nova) := src/kernel/nova PATCHES := $(sort $(wildcard $(REP_DIR)/patches/*.patch)) +PATCH_OPT := -p1 -d ${DIR(nova)} diff --git a/repos/base-nova/src/core/irq_session_component.cc b/repos/base-nova/src/core/irq_session_component.cc index 72f304886b..07db078422 100644 --- a/repos/base-nova/src/core/irq_session_component.cc +++ b/repos/base-nova/src/core/irq_session_component.cc @@ -64,6 +64,9 @@ static void deassociate(addr_t irq_sel) static bool associate_msi(addr_t irq_sel, addr_t phys_mem, addr_t &msi_addr, addr_t &msi_data, Signal_context_capability sig_cap) { + if (!phys_mem) + return irq_ctrl(irq_sel, msi_addr, msi_data, sig_cap.local_name(), Nova::Gsi_flags(), 0); + return platform().region_alloc().alloc_aligned(4096, 12).convert( [&] (void *virt_ptr) {