not able to log into linux when booting with spike (rv32 linux)

273 views
Skip to first unread message

Guy Ka

unread,
Mar 19, 2021, 1:03:27 PM3/19/21
to RISC-V SW Dev
Hello,
Using spike (Spike RISC-V ISA Simulator 1.0.1-dev) + Buildroot + OpenSBI,  after booting linux, I get the login prompt but I am not able to login. I enter "root" as the login name and after that, nothing happens anymore. My root_fs is embedded into the boot image and it is mounted properly (I can see a userland program being executed properly during  init) . Using Qemu, I am able to login into linux with the same fw_payload.

Here is the command I use to start spike

riscv32-linux/riscv-isa-sim/build/spike  -m512     --isa=rv32g --bootargs "console=hvc0 earlycon=sbi"   riscv32-linux/opensbi_v.9/build_linux_new_rv32imafd_rootfs_quiet/platform/generic/firmware/fw_payload.elf

And here is the output

[    0.000000] Linux version 5.11.0-rc3-dirty  (riscv32-linux-gcc.br_real (Buildroot 2020.08-14-ge5a2a90) 10.2.0, GNU ld (GNU Binutils) 2.34) #2 SMP Fri Jan 29 14:32:54 EST 2021
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80400000
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000080400000-0x000000009fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080400000-0x000000009fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080400000-0x000000009fffffff]
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at kernel/resource.c:799 __insert_resource+0xc0/0x134
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.11.0-rc3-dirty #2
[    0.000000] epc: c0011420 ra : c00122c0 sp : c1801f50
[    0.000000]  gp : c18a16f0 tp : c1807f00 t0 : df804f60
[    0.000000]  t1 : df805024 t2 : 00000000 s0 : c1801f60
[    0.000000]  s1 : df804f40 a0 : df807f40 a1 : c1808cd8
[    0.000000]  a2 : 80ab5db7 a3 : 80401000 a4 : 80401000
[    0.000000]  a5 : c1808cd8 a6 : 80ab5db7 a7 : df807f40
[    0.000000]  s2 : c1808cd8 s3 : c180a000 s4 : c0c068ac
[    0.000000]  s5 : c1809000 s6 : c18a2000 s7 : c10d5b68
[    0.000000]  s8 : 00000fff s9 : 80000200 s10: c10d5b5c
[    0.000000]  s11: 00000000 t3 : 9fc04f80 t4 : ffffffff
[    0.000000]  t5 : c0c05c64 t6 : 00000001
[    0.000000] status: 00000100 badaddr: c0011420 cause: 00000003
[    0.000000] random: get_random_bytes called from __warn+0xd4/0x12c with crng_init=0
[    0.000000] ---[ end trace 0000000000000000 ]---
[    0.000000] Failed to add a Kernel code resource at 80401000
[    0.000000] SBI specification v0.2 detected
[    0.000000] SBI implementation ID=0x1 Version=0x9
[    0.000000] SBI v0.2 TIME extension detected
[    0.000000] SBI v0.2 IPI extension detected
[    0.000000] SBI v0.2 RFENCE extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] riscv: ISA extensions adfim
[    0.000000] riscv: ELF capabilities adfim
[    0.000000] percpu: Embedded 11 pages/cpu s21008 r0 d24048 u45056
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129032
[    0.000000] Kernel command line: console=hvc0 earlycon=sbi
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 490224K/520192K available (6867K kernel code, 6494K rwdata, 4096K rodata, 6440K init, 224K bss, 29968K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]       fixmap : 0x9dc00000 - 0x9e000000   (4096 kB)
[    0.000000]       pci io : 0x9e000000 - 0x9f000000   (  16 MB)
[    0.000000]      vmemmap : 0x9f000000 - 0x9fffffff   (  15 MB)
[    0.000000]      vmalloc : 0xa0000000 - 0xbfffffff   ( 511 MB)
[    0.000000]       lowmem : 0xc0000000 - 0xdfc00000   ( 508 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 32 local interrupts mapped
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.000015] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[    0.001230] Console: colour dummy device 80x25
[    0.001880] printk: console [hvc0] enabled
[    0.001880] printk: console [hvc0] enabled
[    0.002950] printk: bootconsole [sbi0] disabled
[    0.002950] printk: bootconsole [sbi0] disabled
[    0.004160] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[    0.005695] pid_max: default: 32768 minimum: 301
[    0.006410] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.007510] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.010675] rcu: Hierarchical SRCU implementation.
[    0.012265] smp: Bringing up secondary CPUs ...
[    0.012925] smp: Brought up 1 node, 1 CPU
[    0.013815] devtmpfs: initialized
[    0.014580] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.016070] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.023825] vgaarb: loaded
[    0.024365] SCSI subsystem initialized
[    0.025195] usbcore: registered new interface driver usbfs
[    0.026085] usbcore: registered new interface driver hub
[    0.026840] usbcore: registered new device driver usb
[    0.027755] clocksource: Switched to clocksource riscv_clocksource
[    0.035375] PCI: CLS 0 bytes, default 64
[    0.136235] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    0.141390] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    0.142430] io scheduler mq-deadline registered
[    0.143090] io scheduler kyber registered
[    0.185075] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.186680] [drm] radeon kernel modesetting enabled.
[    0.191680] loop: module loaded
[    0.192370] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.193350] ehci-pci: EHCI PCI platform driver
[    0.194015] ehci-platform: EHCI generic platform driver
[    0.194800] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.195835] ohci-pci: OHCI PCI platform driver
[    0.196500] ohci-platform: OHCI generic platform driver
[    0.197525] usbcore: registered new interface driver uas
[    0.198280] usbcore: registered new interface driver usb-storage
[    0.199210] mousedev: PS/2 mouse device common for all mice
[    0.200390] usbcore: registered new interface driver usbhid
[    0.201215] usbhid: USB HID core driver
[    0.207440] debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
[    0.212125] Freeing unused kernel memory: 6440K
[    0.219860] Run /init as init process
OK
OK
Running sysctl: OK
Saving random seed: [    0.286500] random: dd: uninitialized urandom read (512 bytes read)
OK
B.Test: hello, world OK

Welcome to Buildroot
buildroot login: root
#here the prompt never comes back

Looking at the log, it seems that the processor is waiting for an interrupt that never comes after entering the login name. Here are the last lines of the log
#--------------millions of line removed----------------------
core   0: 0xffffffffc009db60 (0xec091ce3) bnez    s2, pc - 296
core   0: 0xffffffffc009da38 (0x05c12083) lw      ra, 92(sp)
core   0: 0xffffffffc009da3c (0x05812403) lw      s0, 88(sp)
core   0: 0xffffffffc009da40 (0x05412483) lw      s1, 84(sp)
core   0: 0xffffffffc009da44 (0x05012903) lw      s2, 80(sp)
core   0: 0xffffffffc009da48 (0x04c12983) lw      s3, 76(sp)
core   0: 0xffffffffc009da4c (0x04812a03) lw      s4, 72(sp)
core   0: 0xffffffffc009da50 (0x04412a83) lw      s5, 68(sp)
core   0: 0xffffffffc009da54 (0x04012b03) lw      s6, 64(sp)
core   0: 0xffffffffc009da58 (0x03c12b83) lw      s7, 60(sp)
core   0: 0xffffffffc009da5c (0x03812c03) lw      s8, 56(sp)
core   0: 0xffffffffc009da60 (0x03412c83) lw      s9, 52(sp)
core   0: 0xffffffffc009da64 (0x03012d03) lw      s10, 48(sp)
core   0: 0xffffffffc009da68 (0x02c12d83) lw      s11, 44(sp)
core   0: 0xffffffffc009da6c (0x06010113) addi    sp, sp, 96
core   0: 0xffffffffc009da70 (0x00008067) ret
core   0: 0xffffffffc003e9b0 (0x00022783) lw      a5, 0(tp)
core   0: 0xffffffffc003e9b4 (0x0087f793) andi    a5, a5, 8
core   0: 0xffffffffc003e9b8 (0x00079a63) bnez    a5, pc + 20
core   0: 0xffffffffc003e9bc (0x54d3f0ef) jal     pc + 0x3fd4c
core   0: 0xffffffffc007e708 (0xff010113) addi    sp, sp, -16
core   0: 0xffffffffc007e70c (0x00812423) sw      s0, 8(sp)
core   0: 0xffffffffc007e710 (0x00112623) sw      ra, 12(sp)
core   0: 0xffffffffc007e714 (0x01010413) addi    s0, sp, 16
core   0: 0xffffffffc007e718 (0x0062e097) auipc   ra, 0x62e
core   0: 0xffffffffc007e71c (0x774080e7) jalr    ra, ra, 1908
core   0: 0xffffffffc06ace8c (0x01022783) lw      a5, 16(tp)
core   0: 0xffffffffc06ace90 (0xc18ce6b7) lui     a3, 0xc18ce
core   0: 0xffffffffc06ace94 (0x1d068693) addi    a3, a3, 464
core   0: 0xffffffffc06ace98 (0x00279793) slli    a5, a5, 2
core   0: 0xffffffffc06ace9c (0x00f687b3) add     a5, a3, a5
core   0: 0xffffffffc06acea0 (0x0007a603) lw      a2, 0(a5)
core   0: 0xffffffffc06acea4 (0xc0e4a737) lui     a4, 0xc0e4a
core   0: 0xffffffffc06acea8 (0x08070713) addi    a4, a4, 128
core   0: 0xffffffffc06aceac (0x00070793) mv      a5, a4
core   0: 0xffffffffc06aceb0 (0x00c787b3) add     a5, a5, a2
core   0: 0xffffffffc06aceb4 (0x0807a503) lw      a0, 128(a5)
core   0: 0xffffffffc06aceb8 (0x40000637) lui     a2, 0x40000
core   0: 0xffffffffc06acebc (0x00020593) mv      a1, tp
core   0: 0xffffffffc06acec0 (0x06c51c63) bne     a0, a2, pc + 120
core   0: 0xffffffffc06acec4 (0x07c7a603) lw      a2, 124(a5)
core   0: 0xffffffffc06acec8 (0x0807a023) sw      zero, 128(a5)
core   0: 0xffffffffc06acecc (0x04060e63) beqz    a2, pc + 92
core   0: 0xffffffffc06aced0 (0x00100513) li      a0, 1
core   0: 0xffffffffc06aced4 (0x04a61c63) bne     a2, a0, pc + 88
core   0: 0xffffffffc06aced8 (0xff010113) addi    sp, sp, -16
core   0: 0xffffffffc06acedc (0x00812423) sw      s0, 8(sp)
core   0: 0xffffffffc06acee0 (0x00112623) sw      ra, 12(sp)
core   0: 0xffffffffc06acee4 (0x01010413) addi    s0, sp, 16
core   0: 0xffffffffc06acee8 (0x0205a603) lw      a2, 32(a1)
core   0: 0xffffffffc06aceec (0x0847a783) lw      a5, 132(a5)
core   0: 0xffffffffc06acef0 (0x00267793) andi    a5, a2, 2
core   0: 0xffffffffc06acef4 (0x00079463) bnez    a5, pc + 8
core   0: 0xffffffffc06acefc (0x0105a783) lw      a5, 16(a1)
core   0: 0xffffffffc06acf00 (0x00279793) slli    a5, a5, 2
core   0: 0xffffffffc06acf04 (0x00f686b3) add     a3, a3, a5
core   0: 0xffffffffc06acf08 (0x0006a783) lw      a5, 0(a3)
core   0: 0xffffffffc06acf0c (0x00f70733) add     a4, a4, a5
core   0: 0xffffffffc06acf10 (0x06072e23) sw      zero, 124(a4)
core   0: 0xffffffffc06acf14 (0xdddff0ef) jal     pc - 0x224
core   0: 0xffffffffc06accf0 (0xff010113) addi    sp, sp, -16
core   0: 0xffffffffc06accf4 (0x00812623) sw      s0, 12(sp)
core   0: 0xffffffffc06accf8 (0x01010413) addi    s0, sp, 16
core   0: 0xffffffffc06accfc (0x01022703) lw      a4, 16(tp)
core   0: 0xffffffffc06acd00 (0xc18ce7b7) lui     a5, 0xc18ce
core   0: 0xffffffffc06acd04 (0x1d078793) addi    a5, a5, 464
core   0: 0xffffffffc06acd08 (0x00271713) slli    a4, a4, 2
core   0: 0xffffffffc06acd0c (0x00e787b3) add     a5, a5, a4
core   0: 0xffffffffc06acd10 (0x0007a783) lw      a5, 0(a5)
core   0: 0xffffffffc06acd14 (0xc0e4a737) lui     a4, 0xc0e4a
core   0: 0xffffffffc06acd18 (0x08070713) addi    a4, a4, 128
core   0: 0xffffffffc06acd1c (0x00f70733) add     a4, a4, a5
core   0: 0xffffffffc06acd20 (0x08470713) addi    a4, a4, 132
core   0: 0xffffffffc06acd24 (0x00200793) li      a5, 2
core   0: 0xffffffffc06acd28 (0x06f727af) amoadd.w a5, a5, (a4)
core   0: 0xffffffffc06acd2c (0x00278793) addi    a5, a5, 2
core   0: 0xffffffffc06acd30 (0x0027f713) andi    a4, a5, 2
core   0: 0xffffffffc06acd34 (0x00071c63) bnez    a4, pc + 24
core   0: 0xffffffffc06acd38 (0x0017f793) andi    a5, a5, 1
core   0: 0xffffffffc06acd3c (0x00079e63) bnez    a5, pc + 28
core   0: 0xffffffffc06acd40 (0x00c12403) lw      s0, 12(sp)
core   0: 0xffffffffc06acd44 (0x01010113) addi    sp, sp, 16
core   0: 0xffffffffc06acd48 (0x00008067) ret
core   0: 0xffffffffc06acf18 (0x00c12083) lw      ra, 12(sp)
core   0: 0xffffffffc06acf1c (0x00812403) lw      s0, 8(sp)
core   0: 0xffffffffc06acf20 (0x01010113) addi    sp, sp, 16
core   0: 0xffffffffc06acf24 (0x00008067) ret
core   0: 0xffffffffc007e720 (0x00c12083) lw      ra, 12(sp)
core   0: 0xffffffffc007e724 (0x00812403) lw      s0, 8(sp)
core   0: 0xffffffffc007e728 (0x01010113) addi    sp, sp, 16
core   0: 0xffffffffc007e72c (0x00008067) ret
core   0: 0xffffffffc003e9c0 (0xd71c30ef) jal     pc - 0x3c290
core   0: 0xffffffffc0002730 (0xff010113) addi    sp, sp, -16
core   0: 0xffffffffc0002734 (0x00812623) sw      s0, 12(sp)
core   0: 0xffffffffc0002738 (0x01010413) addi    s0, sp, 16
core   0: 0xffffffffc000273c (0x10500073) wfi


Thanks for any hint.
G

Jim Wilson

unread,
Mar 20, 2021, 3:17:44 PM3/20/21
to Guy Ka, RISC-V SW Dev
On Fri, Mar 19, 2021 at 10:03 AM Guy Ka <guya...@gmail.com> wrote:
Hello,
Using spike (Spike RISC-V ISA Simulator 1.0.1-dev) + Buildroot + OpenSBI,  after booting linux, I get the login prompt but I am not able to login. h

I think that is a common problem with spike and linux.  Spike has limited support for linux, and if you don't get the linux kernel config right it won't work.  I would suggest that you start with a supported tree that is known to work on spike, and then modify it to get what you want.  Try this one for instance

Jim

Reply all
Reply to author
Forward
0 new messages