From 995b1e3848e7600abdaf1827a51f14a984933dbc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 2 Aug 2024 12:00:24 +0200 Subject: [PATCH] Delegate external interrupts to U-Boot --- JOURNAL.md | 41 ++++++++++++++++++++++++++++++++ lagarto-ox.nix | 7 ++++-- uboot-debug-ext-interrupts.patch | 31 ++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 uboot-debug-ext-interrupts.patch diff --git a/JOURNAL.md b/JOURNAL.md index 6c00508..88b4d27 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -3297,3 +3297,44 @@ I see that the MIE sets the machine mode external interrupt enable in this way: Only if the external interrupt function is not the default one. But for the PLIC, it looks like the default one is being used. So let's enable the machine mode interrupts unconditionally. + +Let's try to cause an interruption. I would need to list all the steps. + + mw 0x40802000 0x10 # Enable interrupt for source 4 (timer) + mw 0x40800010 0xff # Make source 4 priority large + md 0x40a00004 1 # Show which value should be claimed + mw 0x40a00004 0 # Claim 0 + +Nice, I can see the trap: + + Boot HART MIDELEG : 0x0000000000000022 + Boot HART MEDELEG : 0x000000000000b109 + ... + => mw 0x40802000 0x10 # Enable interrupt for source 4 (timer) + => mw 0x40800010 0xff # Make source 4 priority large + => md 0x40a00004 1 # Show which value should be claimed + 40a00004: 00000000 .... + => mw 0x40a00004 0 # Claim 0 (weird) +