[U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
Karsten Merker
merker at debian.org
Fri May 3 16:17:05 UTC 2019
Hello,
I'm currently testing the U-Boot patch for adding booti support
on the RISC-V architecture and the corresponding kernel patch on
a qemu riscv64 "virt" machine with OpenSBI. While performing the
tests, I have found two probably unrelated issues in U-Boot and
OpenSBI, though I'm unsure whether the actual source of the
problem is on the OpenSBI or on the U-Boot side, therefore I'm
sending this to both the U-Boot and the OpenSBI lists.
a) U-Boot crashes if the system has 2GB of RAM or more and
uses OpenSBI as the first stage:
-----8<----------8<----------8<----------8<----------8<----------8<-----
OpenSBI v0.3 (May 3 2019 16:43:55)
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 8
Current Hart : 0
Firmware Base : 0x80000000
Firmware Size : 100 KB
Runtime SBI Version : 0.1
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2019.07-rc1-00001-gc7ec976ce75 (May 03 2019 - 16:42:32 +0200)
CPU: rv64imafdcsu
Model: riscv-virtio,qemu
DRAM: 2 GiB
exception code: 7 , Store/AMO access fault , epc 8020019c , ra 8020a834
### ERROR ### Please RESET the board ###
-----8<----------8<----------8<----------8<----------8<----------8<-----
With 1.9GB or less, the combination of U-Boot and OpenSBI works
and successfully boots a Linux system:
-----8<----------8<----------8<----------8<----------8<----------8<-----
OpenSBI v0.3 (May 3 2019 16:43:55)
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 8
Current Hart : 0
Firmware Base : 0x80000000
Firmware Size : 100 KB
Runtime SBI Version : 0.1
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2019.07-rc1-00001-gc7ec976ce75 (May 03 2019 - 16:42:32 +0200)
CPU: rv64imafdcsu
Model: riscv-virtio,qemu
DRAM: 1.9 GiB
In: uart at 10000000
Out: uart at 10000000
Err: uart at 10000000
Net:
Warning: virtio-net#2 using MAC address from ROM
eth0: virtio-net#2
Hit any key to stop autoboot: 0
Device 0: QEMU VirtIO Block Device
Type: Hard Disk
Capacity: 102400.0 MB = 100.0 GB (209715200 x 512)
... is now current device
Scanning virtio 0:1...
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (2 ms)
Using virtio-net#2 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x82100000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (0 ms)
Using virtio-net#2 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x81000000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
=> load virtio 0:1 ${kernel_addr_r} /boot/Image
8949964 bytes read in 4 ms (2.1 GiB/s)
=> booti ${kernel_addr_r} - ${fdtcontroladdr}
## Flattened Device Tree blob at f91353d0
Booting using the fdt blob at 0xf91353d0
Using Device Tree in place at 00000000f91353d0, end 00000000f9138d9c
Starting kernel ...
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 5.1.0-rc7-00001-g988141059a7b (build at localhost) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 SMP Fri May 3 16:36:57 CEST 2019
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] software IO TLB: mapped [mem 0xf3693000-0xf7693000] (64MB)
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] percpu: Embedded 17 pages/cpu s29592 r8192 d31848 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 490759
[ 0.000000] Kernel command line: console=ttyS0 rw root=/dev/vda1
[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 1885148K/1990248K available (5585K kernel code, 353K rwdata, 1774K rodata, 192K init, 817K bss, 105100K reserved, 0K cma-reserved)
[ 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 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: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] plic: mapped 10 interrupts with 1 handlers for 2 contexts.
[ 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.000143] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.003179] Console: colour dummy device 80x25
[ 0.004455] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[ 0.004621] pid_max: default: 32768 minimum: 301
[ 0.008318] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.008401] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.017492] *** VALIDATE proc ***
[ 0.020416] *** VALIDATE cgroup1 ***
[ 0.020497] *** VALIDATE cgroup2 ***
[ 0.036125] rcu: Hierarchical SRCU implementation.
[ 0.042919] smp: Bringing up secondary CPUs ...
[ 0.043035] smp: Brought up 1 node, 1 CPU
[ 0.072780] devtmpfs: initialized
[ 0.079512] random: get_random_u32 called from bucket_table_alloc+0x74/0x17e with crng_init=0
[ 0.082192] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.082401] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.085393] NET: Registered protocol family 16
[ 0.125870] vgaarb: loaded
[ 0.126829] SCSI subsystem initialized
[ 0.129467] usbcore: registered new interface driver usbfs
[ 0.129835] usbcore: registered new interface driver hub
[ 0.130123] usbcore: registered new device driver usb
[ 0.138302] clocksource: Switched to clocksource riscv_clocksource
[ 0.167279] NET: Registered protocol family 2
[ 0.172632] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes)
[ 0.172800] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.173132] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.173460] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.175256] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[ 0.175540] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[ 0.176873] NET: Registered protocol family 1
[ 0.182094] RPC: Registered named UNIX socket transport module.
[ 0.182178] RPC: Registered udp transport module.
[ 0.182233] RPC: Registered tcp transport module.
[ 0.182281] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.191507] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[ 0.211649] NFS: Registering the id_resolver key type
[ 0.212365] Key type id_resolver registered
[ 0.212443] Key type id_legacy registered
[ 0.212605] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.231889] NET: Registered protocol family 38
[ 0.232328] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[ 0.232459] io scheduler mq-deadline registered
[ 0.232587] io scheduler kyber registered
[ 0.398596] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.406334] printk: console [ttyS0] disabled
[ 0.407204] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10, base_baud = 230400) is a 16550A
[ 0.436823] printk: console [ttyS0] enabled
[ 0.438885] [drm] radeon kernel modesetting enabled.
[ 0.455080] loop: module loaded
[ 0.464327] virtio_blk virtio1: [vda] 209715200 512-byte logical blocks (107 GB/100 GiB)
[ 0.479351] vda: vda1
[ 0.486713] libphy: Fixed MDIO Bus: probed
[ 0.492479] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[ 0.492890] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[ 0.493724] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.494421] ehci-pci: EHCI PCI platform driver
[ 0.494972] ehci-platform: EHCI generic platform driver
[ 0.495552] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.496019] ohci-pci: OHCI PCI platform driver
[ 0.496550] ohci-platform: OHCI generic platform driver
[ 0.497528] usbcore: registered new interface driver uas
[ 0.498349] usbcore: registered new interface driver usb-storage
[ 0.500395] mousedev: PS/2 mouse device common for all mice
[ 0.502373] usbcore: registered new interface driver usbhid
[ 0.502770] usbhid: USB HID core driver
[ 0.505389] NET: Registered protocol family 10
[ 0.513282] Segment Routing with IPv6
[ 0.514392] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 0.517555] NET: Registered protocol family 17
[ 0.518822] Key type dns_resolver registered
[ 0.674492] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
[ 0.675365] VFS: Mounted root (ext4 filesystem) on device 254:1.
[ 0.698263] Freeing unused kernel memory: 192K
[ 0.698619] This architecture does not have kernel memory protection.
[ 0.699121] Run /sbin/init as init process
[ 1.029598] systemd[1]: System time before build time, advancing clock.
[ 1.292164] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[ 1.295396] systemd[1]: Detected architecture riscv64.
Welcome to Debian GNU/Linux 10 (buster)!
[rest of the output snipped]
-----8<----------8<----------8<----------8<----------8<----------8<-----
The same U-Boot image works fine when loaded from BBL, even
with more than 2GB of RAM, so the source of the issue is
probably either somewhere in OpenSBI or in the interaction
between OpenSBI and U-Boot.
b) The second issue is a problem with running on an SMP system,
i.e. if qemu-system-riscv64 is called with "-smp 2". U-Boot
commit d0a8fd3e4d2a5ab19b8f2d27d40dacb4942ba5a4 has enabled
SMP for the qemu riscv64 "virt" platform, but when booting a
kernel from U-Boot on a 2-CPU "virt" machine, the kernel boots,
but the system hangs as soon as the kernel executes init.
This happens both when U-Boot uses OpenSBI as its first stage
as well as when U-Boot uses BBL as its first stage. If one
loads a kernel directly from BBL instead without U-Boot in
between, the same 2-CPU configuration works without problems
and the kernel uses both CPUs.
-----8<----------8<----------8<----------8<----------8<----------8<-----
OpenSBI v0.3 (May 3 2019 16:43:55)
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 8
Current Hart : 0
Firmware Base : 0x80000000
Firmware Size : 100 KB
Runtime SBI Version : 0.1
PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
U-Boot 2019.07-rc1-00001-gc7ec976ce75 (May 03 2019 - 16:42:32 +0200)
CPU: rv64imafdcsu
Model: riscv-virtio,qemu
DRAM: 1.9 GiB
In: uart at 10000000
Out: uart at 10000000
Err: uart at 10000000
Net:
Warning: virtio-net#2 using MAC address from ROM
eth0: virtio-net#2
Hit any key to stop autoboot: 0
Device 0: QEMU VirtIO Block Device
Type: Hard Disk
Capacity: 102400.0 MB = 100.0 GB (209715200 x 512)
... is now current device
Scanning virtio 0:1...
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (2 ms)
Using virtio-net#2 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x82100000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (1 ms)
Using virtio-net#2 device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x81000000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
=> load virtio 0:1 ${kernel_addr_r} /boot/Image
8949964 bytes read in 4 ms (2.1 GiB/s)
=> booti ${kernel_addr_r} - ${fdtcontroladdr}
## Flattened Device Tree blob at f9135290
Booting using the fdt blob at 0xf9135290
Using Device Tree in place at 00000000f9135290, end 00000000f9138d90
Starting kernel ...
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 5.1.0-rc7-00001-g988141059a7b (build at localhost) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 SMP Fri May 3 16:36:57 CEST 2019
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000f9999fff]
[ 0.000000] software IO TLB: mapped [mem 0xf3693000-0xf7693000] (64MB)
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] percpu: Embedded 17 pages/cpu s29592 r8192 d31848 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 490759
[ 0.000000] Kernel command line: console=ttyS0 rw root=/dev/vda1
[ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 1885080K/1990248K available (5585K kernel code, 353K rwdata, 1774K rodata, 192K init, 817K bss, 105168K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[ 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=2
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] plic: mapped 10 interrupts with 2 handlers for 4 contexts.
[ 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.000128] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.003244] Console: colour dummy device 80x25
[ 0.004537] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[ 0.004705] pid_max: default: 32768 minimum: 301
[ 0.008359] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.008448] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.017588] *** VALIDATE proc ***
[ 0.020562] *** VALIDATE cgroup1 ***
[ 0.020642] *** VALIDATE cgroup2 ***
[ 0.036206] rcu: Hierarchical SRCU implementation.
[ 0.043364] smp: Bringing up secondary CPUs ...
[ 1.189706] CPU1: failed to come online
[ 1.193384] smp: Brought up 1 node, 1 CPU
[ 1.226036] devtmpfs: initialized
[ 1.233190] random: get_random_u32 called from bucket_table_alloc+0x74/0x17e with crng_init=0
[ 1.236015] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 1.236219] futex hash table entries: 512 (order: 3, 32768 bytes)
[ 1.239157] NET: Registered protocol family 16
[ 1.279385] vgaarb: loaded
[ 1.280386] SCSI subsystem initialized
[ 1.283149] usbcore: registered new interface driver usbfs
[ 1.283513] usbcore: registered new interface driver hub
[ 1.283836] usbcore: registered new device driver usb
[ 1.292222] clocksource: Switched to clocksource riscv_clocksource
[ 1.321240] NET: Registered protocol family 2
[ 1.326640] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes)
[ 1.326817] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[ 1.327134] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 1.327463] TCP: Hash tables configured (established 16384 bind 16384)
[ 1.329413] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[ 1.329700] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[ 1.331117] NET: Registered protocol family 1
[ 1.335211] RPC: Registered named UNIX socket transport module.
[ 1.335294] RPC: Registered udp transport module.
[ 1.335351] RPC: Registered tcp transport module.
[ 1.335399] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.345021] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[ 1.364785] NFS: Registering the id_resolver key type
[ 1.365517] Key type id_resolver registered
[ 1.365598] Key type id_legacy registered
[ 1.365758] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 1.384982] NET: Registered protocol family 38
[ 1.385417] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[ 1.385555] io scheduler mq-deadline registered
[ 1.385677] io scheduler kyber registered
[ 1.554529] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 1.562310] printk: console [ttyS0] disabled
[ 1.563227] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10, base_baud = 230400) is a 16550A
[ 1.584928] printk: console [ttyS0] enabled
[ 1.586712] [drm] radeon kernel modesetting enabled.
[ 1.604232] loop: module loaded
[ 1.612382] virtio_blk virtio1: [vda] 209715200 512-byte logical blocks (107 GB/100 GiB)
[ 1.626389] vda: vda1
[ 1.633906] libphy: Fixed MDIO Bus: probed
[ 1.639565] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[ 1.640237] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[ 1.641167] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.641678] ehci-pci: EHCI PCI platform driver
[ 1.642245] ehci-platform: EHCI generic platform driver
[ 1.642865] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.643343] ohci-pci: OHCI PCI platform driver
[ 1.644355] ohci-platform: OHCI generic platform driver
[ 1.645341] usbcore: registered new interface driver uas
[ 1.645827] usbcore: registered new interface driver usb-storage
[ 1.647782] mousedev: PS/2 mouse device common for all mice
[ 1.649594] usbcore: registered new interface driver usbhid
[ 1.649892] usbhid: USB HID core driver
[ 1.652825] NET: Registered protocol family 10
[ 1.660591] Segment Routing with IPv6
[ 1.661325] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.664603] NET: Registered protocol family 17
[ 1.665506] Key type dns_resolver registered
[ 1.735438] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts: (null)
[ 1.736452] VFS: Mounted root (ext4 filesystem) on device 254:1.
[ 1.759374] Freeing unused kernel memory: 192K
[ 1.759662] This architecture does not have kernel memory protection.
[ 1.760452] Run /sbin/init as init process
<system hangs, qemu uses 100% CPU time>
-----8<----------8<----------8<----------8<----------8<----------8<-----
Steps to reproduce the issues
-----------------------------
# Build the kernel
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
git checkout v5.1-rc7
git checkout -b riscv-image-header-test
wget -O /tmp/kernel-RISC-V-Add-a-PE-COFF-compliant-Image-header.patch https://patchwork.kernel.org/patch/10925543/mbox/
git am /tmp/kernel-RISC-V-Add-a-PE-COFF-compliant-Image-header.patch
cd ..
mkdir build-kernel-riscv-image-header-test
cd build-kernel-riscv-image-header-test
make -C ../linux/ O=$(pwd) ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig
make -C ../linux/ O=$(pwd) ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j4
cd ..
# Build U-Boot
git clone https://git.denx.de/u-boot.git
cd u-boot
git checkout v2019.07-rc1
git checkout -b riscv-booti-support-test
wget -O /tmp/u-boot-RISCV-image-Add-booti-support.patch http://patchwork.ozlabs.org/patch/1093817/mbox/
git am /tmp/u-boot-RISCV-image-Add-booti-support.patch
---> this fails due to a malformed patch, requires manual application
cd ..
mkdir build-u-boot-riscv-booti-support-test
cd build-u-boot-riscv-booti-support-test
make -C ../u-boot/ O=$(pwd) ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- qemu-riscv64_smode_defconfig
make -C ../u-boot/ O=$(pwd) ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
cd ..
# Build OpenSBI
git clone https://github.com/riscv/opensbi
git checkout f9643f3472199f01e8eecdd6d50a379989646f03
cd ..
mkdir build-opensbi
cd build-opensbi
make -C ../opensbi O=$(pwd) CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=qemu/virt
cd ..
# Build BBL with the kernel
git clone https://github.com/riscv/riscv-pk
git checkout 9239d63942b92c3568ebda26258e49d2acacd229
cd ..
mkdir build-bbl-kernel
cd build-bbl-kernel
../riscv-pk/configure --prefix=/tmp --host=riscv64-linux-gnu --with-payload=../build-kernel-riscv-image-header-test/arch/riscv/boot/Image
make
cd ..
# Build BBL with U-Boot
mkdir build-bbl-u-boot
cd build-bbl-u-boot
../riscv-pk/configure --prefix=/tmp --host=riscv64-linux-gnu --with-payload=../build-u-boot-riscv-booti-support-test/u-boot.bin
make
cd ..
# Copy the kernel image into the riscv64 disk image
# (the image has a partition table, the rootfs in in the first partition)
IMG_MOUNT_DIR=$(mktemp -d)
LOOPDEV=$(sudo losetup -P -f --show /tmp/riscv64-disk.img)
sudo mount -o loop ${LOOPDEV}p1 ${IMG_MOUNT_DIR}
sudo cp build-kernel-riscv-image-header-test/arch/riscv/boot/Image ${IMG_MOUNT_DIR}/boot/
sudo umount ${IMG_MOUNT_DIR}
# Test OpenSBI + U-Boot with 2GB (fails):
qemu-system-riscv64 -nographic -machine virt -m 2G \
-kernel build-opensbi/platform/qemu/virt/firmware/fw_jump.elf \
-device loader,file=build-u-boot-riscv-booti-support-test/u-boot.bin,addr=0x80200000 \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 \
-drive file=/tmp/riscv64-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::22222-:22
# Test OpenSBI + U-Boot with less than 2GB (works):
qemu-system-riscv64 -nographic -machine virt -m 1.9G \
-kernel build-opensbi/platform/qemu/virt/firmware/fw_jump.elf \
-device loader,file=build-u-boot-riscv-booti-support-test/u-boot.bin,addr=0x80200000 \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 \
-drive file=/tmp/riscv64-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::22222-:22
# Test BBL + U-Boot with 2GB (works):
qemu-system-riscv64 -nographic -machine virt -m 2G \
-kernel build-bbl-u-boot/bbl \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 \
-drive file=/tmp/riscv64-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::22222-:22
# Test OpenSBI + U-Boot with less than 2GB but SMP (hangs on init):
qemu-system-riscv64 -nographic -smp 2 -machine virt -m 1.9G \
-kernel build-opensbi/platform/qemu/virt/firmware/fw_jump.elf \
-device loader,file=build-u-boot-riscv-booti-support-test/u-boot.bin,addr=0x80200000 \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 \
-drive file=/tmp/riscv64-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::22222-:22
# Test BBL + U-Boot with less than 2GB but SMP (hangs on init):
qemu-system-riscv64 -nographic -smp 2 -machine virt -m 1.9G \
-kernel build-bbl-u-boot/bbl \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 \
-drive file=/tmp/riscv64-disk.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::22222-:22
Regards,
Karsten
--
Ich widerspreche hiermit ausdrücklich der Nutzung sowie der
Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung
sowie der Markt- oder Meinungsforschung.
More information about the U-Boot
mailing list