Commit Graph

153 Commits

Author SHA1 Message Date
b49471ba50 Update nixpkgs to nixos-unstable 2024-07-05 16:30:29 +02:00
b903eae7e5 Disable ftrace for now as it hangs the boot 2024-07-05 16:24:51 +02:00
7e6fdff142 Disable proactive compation
I see a lot of kcompactd0 entries in sched_switch log, so disable it for
now.
2024-07-05 15:57:18 +02:00
32f4d117db Only enable sched_switch events
As sched_stat_runtime is flooding the console.
2024-07-05 15:37:50 +02:00
bc05dc2676 Mount debugfs first 2024-07-05 15:36:42 +02:00
934b67ac0b Trace sched events from stage1
Events from the kthread that dumps the buffer to the console are
filtered, otherwise we make an infinite loop.
2024-07-05 15:36:42 +02:00
f509a0a517 Enable ftrace at boot
For now we only show init calls.
2024-07-05 15:36:37 +02:00
504c4aca3c Make the counter silent by spawning another shell 2024-07-05 12:57:10 +02:00
48688594bf Add a heartbeat counter to check the kernel 2024-07-05 12:45:32 +02:00
05898c5f85 Revert UART speed to 50MHz following vivado log
> UART Name g_UART IntfLabel m_axi_uart SyncClk {Label CLK0 Freq 50000000
> Name clk_i} BaseAddr 0x0 Number 2 AxiAddrWidth 0 AxiDataWidth 0 AxiIdWidth
> 0 AxiUserWidth 0 Mode normal IRQ uart_irq
2024-07-04 17:57:26 +02:00
7eeb16ecfb Reduce frequency of UART clock to 25 MHz 2024-07-04 17:30:57 +02:00
d541462b4c Stop in the stage 1 debug shell 2024-07-04 17:28:15 +02:00
9b37e2aed0 Use the hvc0 console for the kernel 2024-07-04 17:27:43 +02:00
eb7679f6a2 Prepare device tree to accomodate another UART 2024-07-04 17:22:43 +02:00
fcf4977a65 Extend the serial range from 0x100 to 0x1000
The AXI UART 16550 v2.0 from Xilinx only seem to require 32 bytes for
the registes, but let's reduce the changes with the original DTS.
2024-07-04 16:47:56 +02:00
d5b5cc3363 Change the order of interrupts-extended for PLIC
In the SiFive DTS they are in this order, not sure it that may cause any
difference.
2024-07-04 16:46:35 +02:00
471207c64a Allow access to all memory from userspace
> If this option is disabled, you allow userspace (root) access to all
> of memory, including kernel and userspace memory

Currently is failing:

    ~ # cat /proc/iomem
    40001000-400010ff : serial
    60000000-7fffffff : Reserved
    80000000-ffefffff : System RAM
      80201000-81fa0b87 : Kernel image
        80201000-80cb177f : Kernel code
        81400000-819fffff : Kernel rodata
        81c00000-81f18747 : Kernel data
        81f19000-81fa0b87 : Kernel bss
    100000000-1bfffffff : namespace0.0

    ~ # devmem 0x40001000
    devmem: mmap: Operation not permitted
2024-07-04 12:45:41 +02:00
4826396962 Try enabling polling in the serial console 2024-07-04 11:39:35 +02:00
6531fd678c WIP: Test M and S ext interrupt 2024-07-03 20:41:16 +02:00
b1755354d0 Add support for ftrace at boot time 2024-07-03 19:36:38 +02:00
427859818c Disable SMP
The IPI extension is being used to multiplex IPI interruptions and we
don't need it as we only have one CPU.
2024-07-03 19:31:30 +02:00
4461686e80 Add dev shell without rootfs
Makes iteration quicker.
2024-07-03 18:52:51 +02:00
0c4311e15c Remap interrupts to avoid 0 and duplicates
Let see if we can guess which is the correct number for the interrupts.
The plic should appear in the IRQ list but currently it doesn't.
2024-07-03 18:41:52 +02:00
30703d1715 Use the ttyS0 device for the console
For now it seems to be outputting the log properly, but it doesn't read
anything in the initrd input console.
2024-07-03 16:09:38 +02:00
a40414d08c Add comment about the axi timer
This timer is present and initialized in OpenSBI and seems to drive the
UART device. Not sure if we need to see it from the kernel.
2024-07-03 15:30:28 +02:00
d7669671f6 Enable 8250 console driver 2024-07-03 14:09:52 +02:00
7c25f76f8b Bake the git commit inside the uboot env file 2024-07-03 14:09:48 +02:00
2442bdf3f5 Disable lock torture test 2024-07-03 13:44:02 +02:00
93e83f52e8 Add busybox patch to see debug lines: initrd sh ok
The switch_root command seems to hang in the execv() syscall.
2024-07-03 13:43:41 +02:00
3229a3d194 Ignore misc directory 2024-07-03 13:10:06 +02:00
109dea5b4e Enable kernel and busybox debug
Continues to hang in switch_root and no luck trying to send a magic
sysrq via serial port.
2024-07-01 18:00:54 +02:00
046f017b70 Move the pmem closer to the RAM memory
Continues stuck in switch_root.
2024-07-01 15:02:20 +02:00
917cbf3439 Revert to upstream busybox 2024-07-01 14:53:08 +02:00
65c7eca2c8 Fix OpenSBI configuration for newer versions
OpenSBI 1.3 an newer require the heap_size to be specified in the
sbi_platform structure, othewise the default 0 value causes a hangg at
the start. I found the problem after bisecting OpenSBI:

  # Bisect opensbi
  version = src.shortRev;
  src = builtins.fetchGit {
    url = "file:///home/Computational/rarias/riscv/opensbi";
    #rev = "908be1b85c8ff0695ea226fbbf0ff24a779cdece"; #good
    #rev = "6bc02dede86c47f87e65293b7099e9caf3b22c29"; #good
    #rev = "bbff53fe3b6cdd3c9bc084d489640d7ee2a3f831"; #bad
    #rev = "8b99a7f7d8294be29e18a667d51e13755ed2c0e0"; #good
    #rev = "bdde2ecd27af1ac158669809f6658376fb5137ab"; #good
    #rev = "5cf9a540164a018a31a679578a27eb964af0340d"; #good
    #rev = "2a04f7037317c6c5b591b160a074c700de9b3378"; #bad
    rev = "40d36a6673131e36075b1df78af4d7ab92e8cc01"; #bad
  };
2024-07-01 13:28:32 +02:00
14f6528318 Use upstream u-boot and disable debug logs 2024-07-01 12:10:19 +02:00
67fedf4651 Remove unused dtb compilation in OpenSBI 2024-07-01 11:51:20 +02:00
869bd302a8 Find opensbi in any directory name 2024-07-01 11:47:33 +02:00
a7cc8e2611 Fix fpgactl wrong variable names 2024-07-01 11:47:16 +02:00
a7e1a6a100 Go back to default gcc for the kernel 2024-07-01 11:30:12 +02:00
763f053f01 Simplify, correct and comment DTS
Disable unused devices and try to fix the interrupt connections. The
compiler dtc doesn't report any warning now.
2024-07-01 11:29:02 +02:00
33b227f576 Hangs in swtich_root in stage1 2024-07-01 10:14:39 +02:00
975a1c0e87 Update fpga tools for MEEP 2024-07-01 09:57:05 +02:00
2cefcef63d Make busybox static
Now the problem is inside the busybox binary:

[   43.028000] Run /init as init process
[   43.033300]   with arguments:
[   43.037260]     /init
[   43.040000]   with environment:
[   43.044180]     HOME=/
[   43.047600]     TERM=linux
[   43.078020] init[1]: unhandled signal 4 code 0x1 at 0x0000000000010660 in busybox[10000+22d000]
[   43.090080] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS
[   43.097580] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT)
[   43.106480] epc : 0000000000010660 ra : 0000000000000000 sp : 0000003fd5489db0
[   43.114780]  gp : ffffffff8197ea48 tp : 0000000000000000 t0 : 0000000000000000
[   43.123080]  t1 : 0000000000000000 t2 : 0000000000000000 s0 : 0000000000000000
[   43.131340]  s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000
[   43.139620]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
[   43.147900]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
[   43.156180]  s2 : 0000000000000000 s3 : 0000000000000000 s4 : 0000000000000000
[   43.164860]  s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000
[   43.173140]  s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000000000000000
[   43.181420]  s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
[   43.189680]  t5 : 0000000000000000 t6 : 0000000000000000
[   43.196040] status: 0000000200004020 badaddr: 00000000034000ef cause: 0000000000000002
[   43.208240] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
[   43.216340] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS
[   43.222940] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT)
[   43.231100] Call Trace:
[   43.234000] [<ffffffff800070c4>] dump_backtrace+0x38/0x48
[   43.240140] [<ffffffff809f063c>] show_stack+0x50/0x68
[   43.245900] [<ffffffff809fd1f8>] dump_stack_lvl+0x60/0x84
[   43.252000] [<ffffffff809fd23c>] dump_stack+0x20/0x30
[   43.257740] [<ffffffff809f0918>] panic+0x160/0x390
[   43.263200] [<ffffffff80020184>] do_exit+0xa70/0xa78
[   43.268820] [<ffffffff800203a4>] do_group_exit+0x44/0xb0
[   43.274780] [<ffffffff80031eec>] get_signal+0x9b4/0xa00
[   43.280700] [<ffffffff80005ca0>] do_work_pending+0x18c/0x610
[   43.287020] [<ffffffff80003880>] resume_userspace_slow+0x10/0x14
[   43.293960] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]---
2024-06-28 15:08:53 +02:00
7b9eb7366e Remove unused PMEM regions
Boots until the init, then fails with:

[   42.561840] Freeing unused kernel image (initmem) memory: 2448K
[   42.572360] Run /init as init process
[   42.577400]   with arguments:
[   42.581780]     /init
[   42.584520]   with environment:
[   42.589320]     HOME=/
[   42.592140]     TERM=linux
[   42.637580] init[1]: unhandled signal 4 code 0x1 at 0x0000003f966980d8 in ld-linux-riscv64-lp64d.so.1[3f96683000+23000]
[   42.650580] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS
[   42.657720] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT)
[   42.666760] epc : 0000003f966980d8 ra : 0000000000000000 sp : 0000003fe5c95db0
[   42.675040]  gp : ffffffff8197ea48 tp : 0000000000000000 t0 : 0000000000000000
[   42.683320]  t1 : 0000000000000000 t2 : 0000000000000000 s0 : 0000000000000000
[   42.691600]  s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000
[   42.699880]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
[   42.708160]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
[   42.716420]  s2 : 0000000000000000 s3 : 0000000000000000 s4 : 0000000000000000
[   42.724700]  s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000
[   42.733380]  s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000000000000000
[   42.741660]  s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
[   42.749920]  t5 : 0000000000000000 t6 : 0000000000000000
[   42.756440] status: 0000000200004020 badaddr: 0000000000010513 cause: 0000000000000002
[   42.767620] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
[   42.775720] CPU: 0 PID: 1 Comm: init Not tainted 6.1.62 #1-NixOS
[   42.782320] Hardware name: Barcelona Supercomputing Center - Lagarto Ox (NixOS) (DT)
[   42.790460] Call Trace:
[   42.793380] [<ffffffff800070c4>] dump_backtrace+0x38/0x48
[   42.799520] [<ffffffff809f063c>] show_stack+0x50/0x68
[   42.805280] [<ffffffff809fd1f8>] dump_stack_lvl+0x60/0x84
[   42.811400] [<ffffffff809fd23c>] dump_stack+0x20/0x30
[   42.817140] [<ffffffff809f0918>] panic+0x160/0x390
[   42.822620] [<ffffffff80020184>] do_exit+0xa70/0xa78
[   42.828260] [<ffffffff800203a4>] do_group_exit+0x44/0xb0
[   42.834240] [<ffffffff80031eec>] get_signal+0x9b4/0xa00
[   42.840140] [<ffffffff80005ca0>] do_work_pending+0x18c/0x610
[   42.846480] [<ffffffff80003880>] resume_userspace_slow+0x10/0x14
[   42.853420] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]---
2024-06-28 15:08:24 +02:00
fc4b8126f6 Document memory layout 2024-06-28 10:39:10 +02:00
a8f3234031 Reached working U-Boot prompt
The serial compatible string must be "ns16550" to be recognized by
U-Boot.
2024-06-27 17:58:21 +02:00
72b4788888 Reached U-Boot console with FDT parsing error 2024-06-27 16:08:30 +02:00
1bfc32e91a Working OpenSBI 1.2 2024-06-27 11:29:15 +02:00
c8efa952f9 Add configuration for Lagarto Ox 2024-06-25 11:11:05 +02:00
4344f73d87 Dump system information when entering shell 2024-06-05 14:49:51 +02:00