diff --git a/JOURNAL.md b/JOURNAL.md index 267342b..76dbaea 100644 --- a/JOURNAL.md +++ b/JOURNAL.md @@ -3914,3 +3914,124 @@ frequency is: Assuming that it actually works well. Let's try that and see if we can have a more realistic reading for the CLINT interrupt frequency. + +Something is going on with the plictool: + + ~ # plictool + plic=0x40800000 nsources=1024 ncontexts=15872 + src=1 pend=1 prio=1 ctx=1 thre=0 <--- zero + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + src=33 pend=0 prio=0 ctx=1 thre=2 + ~ # plictool + plic=0x40800000 nsources=1024 ncontexts=15872 + src=1 pend=1 prio=1 ctx=1 thre=2 <--- now changed to 2??? + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + src=33 pend=0 prio=0 ctx=1 thre=2 + +Either the register is changing its value on its own, or the tool is causing it. + +Let's revert the threshold to 0, but writing to the threshold address, should be +at 0x40a01000. + + ~ # devmem 0x40a01000 + 0x00000002 + ~ # devmem 0x40a01000 + 0x00000002 + ~ # devmem 0x40a01000 + 0x00000002 + ~ # devmem 0x40a01000 8 0 + ~ # devmem 0x40a01000 + 0x00000000 + ~ # devmem 0x40a01000 + 0x00000000 + ~ # devmem 0x40a01000 + 0x00000000 + ~ # plictool -c 2 -s 5 <-- limiting the sources and contexts + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=1 prio=1 ctx=1 thre=0 <-- good + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + ~ # plictool -c 2 -s 5 + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=1 prio=1 ctx=1 thre=0 + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + ~ # plictool -c 2 -s 5 + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=1 prio=1 ctx=1 thre=0 <--- stable + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + ~ # cat /proc/interrupts + CPU0 + 1: 1 SiFive PLIC 1 Edge ttyS1 + 5: 195413 RISC-V INTC 5 Edge riscv-timer + ~ # cat /proc/int^Crupts + + ~ # echo a > /dev/ttyS1 + ~ # cat /proc/interrupts + CPU0 + 1: 1 SiFive PLIC 1 Edge ttyS1 + 5: 197102 RISC-V INTC 5 Edge riscv-timer + ~ # plictool -c 2 -s 5 + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=1 <--- wtf prio=1 ctx=1 thre=0 + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + ~ # devmem 0x40a01004 + 0x00000000 <--- the claim register continues to give 0 instead of 1 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 8 5 <-- try writing 5 + ~ # devmem 0x40a01004 + 0x00000000 <--- no change + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 8 1 <-- try with 1 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # devmem 0x40a01004 + 0x00000000 + ~ # plictool -c 2 -s 5 + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=0 <--- now it is gone prio=1 ctx=1 thre=0 + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + ~ # cat /proc/interrupts + CPU0 + 1: 3 <-- and we have >1 SiFive PLIC 1 Edge ttyS1 + 5: 213775 RISC-V INTC 5 Edge riscv-timer + ~ # echo a > /dev/ttyS1 + ~ # cat /proc/interrupts + CPU0 + 1: 3 <--- stuck again SiFive PLIC 1 Edge ttyS1 + 5: 214551 RISC-V INTC 5 Edge riscv-timer + ~ # plictool -c 2 -s 5 + plic=0x40800000 nsources=5 ncontexts=2 + src=1 pend=1 prio=1 ctx=1 thre=1 <--- again set to 1 + src=2 pend=0 prio=1 + src=3 pend=0 prio=1 + src=4 pend=1 prio=1 + +Clearly something is not working well in the PLIC. +