All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
@ 2019-05-03 16:17 Karsten Merker
  2019-05-04  3:07 ` Anup Patel
  2019-05-04  3:54 ` Anup Patel
  0 siblings, 2 replies; 8+ messages in thread
From: Karsten Merker @ 2019-05-03 16:17 UTC (permalink / raw)
  To: u-boot

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@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@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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-03 16:17 [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine Karsten Merker
@ 2019-05-04  3:07 ` Anup Patel
  2019-05-04  3:54 ` Anup Patel
  1 sibling, 0 replies; 8+ messages in thread
From: Anup Patel @ 2019-05-04  3:07 UTC (permalink / raw)
  To: u-boot

Hi Karsten,

First of all, the 2GB case where U-Boot crashes shows that U-Boot is
trying to access memory close to 0x80000000 where OpenSBI firmware
is running hence it gets ACCESS fault. The OpenSBI protects firmware
using PMP configuration whereas BBL does not. In fact, it is very easy
to corrupt BBL from S-mode.

In fact, the U-Boot crashes with OpenSBI implies that issue in U-Boot
which OpenSBI is helping us detect by injecting ACCESS fault to S-mode.

I tries vanilla U-Boot-2019.07-rc1 (without booti support) and OpenSBI
at commit f9643f34. It worked fine for me. Here's the boot log:

anup at anup-ubuntu64:~/Work/riscv-test$ qemu-system-riscv64 -nographic
-machine virt -m 2G \
> -kernel opensbi/build/platform/qemu/virt/firmware/fw_jump.elf \
> -device loader,file=u-boot/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=./rootfs_riscv64.ext2,format=raw,id=hd0 \
> -device virtio-net-device,netdev=usernet \
> -netdev user,id=usernet,hostfwd=tcp::22222-:22

OpenSBI v0.3 (May  4 2019 08:27:41)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

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 (May 04 2019 - 07:50:53 +0530)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  2 GiB
In:    uart at 10000000
Out:   uart at 10000000
Err:   uart@10000000
Net:
Warning: virtio-net#2 using MAC address from ROM
eth0: virtio-net#2
Hit any key to stop autoboot:  0
=>
=> setenv ipaddr 10.0.2.1
=> ping 10.0.2.2
Using virtio-net#2 device
host 10.0.2.2 is alive
=>
Using virtio-net#2 device
host 10.0.2.2 is alive
=>
Using virtio-net#2 device
host 10.0.2.2 is alive
=>
Using virtio-net#2 device
host 10.0.2.2 is alive
=> <INTERRUPT>
=> QEMU 3.1.92 monitor - type 'help' for more information
(qemu) q


I also tried OpenSBI fail cases you reported but using bootm
and this worked for me as well.

Create temp.bin:
./u-boot/tools/mkimage -A riscv -O linux -T kernel -C none -a
0x80200000 -e 0x80200000 -n Linux -d
build-riscv64/arch/riscv/boot/Image
build-riscv64/arch/riscv/boot/uImage
./u-boot/tools/mkimage -A riscv -O linux -T ramdisk -C none -a
0x00000000 -n "Linux RootFS" -d rootfs_riscv64.img uRamdisk
dd if=/dev/zero of=./temp.bin bs=1M count=1
dd if=./build-riscv64/arch/riscv/boot/uImage of=./temp.bin bs=1M
seek=1 conv=nocreat,notrunc
dd if=./uRamdisk of=./temp.bin bs=1M seek=33 conv=nocreat,notrunc

Here's the log:
anup at anup-ubuntu64:~/Work/riscv-test$ qemu-system-riscv64 -nographic
-smp 2 -machine virt -m 1.9G -kernel
opensbi/build/platform/qemu/virt/firmware/fw_payload.elf -device
loader,file=./temp.bin,addr=0x80500000 -object
rng-random,filename=/dev/urandom,id=rng0 -device
virtio-rng-device,rng=rng0 -append "console=ttyS0 rw root=/dev/vda"
-device virtio-blk-device,drive=hd0 -drive
file=./rootfs_riscv64.ext2,format=raw,id=hd0 -device
virtio-net-device,netdev=usernet -netdev
user,id=usernet,hostfwd=tcp::22222-:22

OpenSBI v0.3 (May  4 2019 08:27:41)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs     : 8
Current Hart           : 0
Firmware Base          : 0x80000000
Firmware Size          : 104 KB
Runtime SBI Version    : 0.1

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)


U-Boot 2019.07-rc1 (May 04 2019 - 07:50:53 +0530)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  1.9 GiB
In:    uart at 10000000
Out:   uart at 10000000
Err:   uart@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: 32.0 MB = 0.0 GB (65536 x 512)
... is now current device
** No partition table - virtio 0 **
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (6 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...
=> bootm 0x80600000 - ${fdtcontroladdr}
## Booting kernel from Legacy Image at 80600000 ...
   Image Name:   Linux
   Image Type:   RISC-V Linux Kernel Image (uncompressed)
   Data Size:    8433868 Bytes = 8 MiB
   Load Address: 80200000
   Entry Point:  80200000
   Verifying Checksum ... OK
## Flattened Device Tree blob at f9136f90
   Booting using the fdt blob at 0xf9136f90
   Loading Kernel Image ... OK
   Using Device Tree in place at 00000000f9136f90, end 00000000f913ad9d

Starting kernel ...

[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.1.0-rc7-00002-ge306aaec1303-dirty
(anup at anup-ubuntu64) (gcc version 8.2.0 (Buildroot
2018.11-rc2-00003-ga0787e9)) #21 SMP Thu May 2 10:02:14 IST 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 0xf3694000-0xf7694000] (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/vda
[    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: 1881684K/1990248K available (5586K kernel code,
352K rwdata, 1774K rodata, 192K init, 313K bss, 108564K 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 53 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.000115] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps
every 4398046511100ns
[    0.003035] Console: colour dummy device 80x25
[    0.004254] Calibrating delay loop (skipped), value calculated
using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[    0.004400] pid_max: default: 32768 minimum: 301
[    0.008974] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.009052] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.018034] *** VALIDATE proc ***
[    0.020619] *** VALIDATE cgroup1 ***
[    0.020677] *** VALIDATE cgroup2 ***
[    0.035733] rcu: Hierarchical SRCU implementation.
[    0.042693] smp: Bringing up secondary CPUs ...
[    0.053472] smp: Brought up 1 node, 2 CPUs
[    0.102787] devtmpfs: initialized
[    0.110755] random: get_random_u32 called from
bucket_table_alloc+0x74/0x17c with crng_init=0
[    0.114136] clocksource: jiffies: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.114449] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.118349] NET: Registered protocol family 16
[    0.168031] vgaarb: loaded
[    0.168961] SCSI subsystem initialized
[    0.171377] usbcore: registered new interface driver usbfs
[    0.171717] usbcore: registered new interface driver hub
[    0.172038] usbcore: registered new device driver usb
[    0.181523] clocksource: Switched to clocksource riscv_clocksource
[    0.243791] NET: Registered protocol family 2
[    0.259646] tcp_listen_portaddr_hash hash table entries: 1024
(order: 2, 16384 bytes)
[    0.259818] TCP established hash table entries: 16384 (order: 5,
131072 bytes)
[    0.260272] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.260561] TCP: Hash tables configured (established 16384 bind 16384)
[    0.262454] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.262735] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.264072] NET: Registered protocol family 1
[    0.267631] RPC: Registered named UNIX socket transport module.
[    0.267705] RPC: Registered udp transport module.
[    0.267750] RPC: Registered tcp transport module.
[    0.267787] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.277637] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[    0.289839] NFS: Registering the id_resolver key type
[    0.290564] Key type id_resolver registered
[    0.290630] Key type id_legacy registered
[    0.290801] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.319589] NET: Registered protocol family 38
[    0.320030] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 254)
[    0.320161] io scheduler mq-deadline registered
[    0.320275] io scheduler kyber registered
[    0.323769] pci-host-generic 30000000.pci: host bridge
/soc/pci at 30000000 ranges:
[    0.324712] pci-host-generic 30000000.pci:    IO
0x03000000..0x0300ffff -> 0x00000000
[    0.325975] pci-host-generic 30000000.pci:   MEM
0x40000000..0x7fffffff -> 0x40000000
[    0.327555] pci-host-generic 30000000.pci: ECAM at [mem
0x30000000-0x3fffffff] for [bus 00-ff]
[    0.328515] pci-host-generic 30000000.pci: PCI host bridge to bus 0000:00
[    0.328705] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.328819] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    0.328864] pci_bus 0000:00: root bus resource [mem 0x40000000-0x7fffffff]
[    0.657734] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.670254] printk: console [ttyS0] disabled
[    0.674112] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10,
base_baud = 230400) is a 16550A
[    0.706583] printk: console [ttyS0] enabled
[    0.710175] [drm] radeon kernel modesetting enabled.
[    0.776626] loop: module loaded
[    0.796027] virtio_blk virtio1: [vda] 65536 512-byte logical blocks
(33.6 MB/32.0 MiB)
[    0.911186] libphy: Fixed MDIO Bus: probed
[    0.924288] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.924673] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.926571] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.927187] ehci-pci: EHCI PCI platform driver
[    0.928301] ehci-platform: EHCI generic platform driver
[    0.929661] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.930490] ohci-pci: OHCI PCI platform driver
[    0.931560] ohci-platform: OHCI generic platform driver
[    0.939057] usbcore: registered new interface driver uas
[    0.940342] usbcore: registered new interface driver usb-storage
[    0.952450] mousedev: PS/2 mouse device common for all mice
[    0.960830] usbcore: registered new interface driver usbhid
[    0.961346] usbhid: USB HID core driver
[    0.964999] NET: Registered protocol family 10
[    0.992632] Segment Routing with IPv6
[    0.994252] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.011182] NET: Registered protocol family 17
[    1.012799] Key type dns_resolver registered
[    1.065211] EXT4-fs (vda): mounting ext2 file system using the ext4 subsystem
[    1.079749] EXT4-fs (vda): warning: mounting unchecked fs, running
e2fsck is recommended
[    1.096180] EXT4-fs (vda): mounted filesystem without journal. Opts: (null)
[    1.098008] VFS: Mounted root (ext2 filesystem) on device 254:0.
[    1.137019] Freeing unused kernel memory: 192K
[    1.137518] This architecture does not have kernel memory protection.
[    1.138165] Run /sbin/init as init process
           _  _
          | ||_|
          | | _ ____  _   _  _  _
          | || |  _ \| | | |\ \/ /
          | || | | | | |_| |/    \
          |_||_|_| |_|\____|\_/\_/

               Busybox Rootfs

Please press Enter to activate this console.
/ # cat /proc/interrupts
           CPU0       CPU1
  6:          0          0  SiFive PLIC   6  virtio2
  7:         45          0  SiFive PLIC   7  virtio1
 10:         58          0  SiFive PLIC  10  ttyS0
IPI0:       641        656  Rescheduling interrupts
IPI1:         0          6  Function call interrupts
IPI2:         0          0  CPU stop interrupts
/ # QEMU 3.1.92 monitor - type 'help' for more information
(qemu) q

Regards,
Anup

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-03 16:17 [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine Karsten Merker
  2019-05-04  3:07 ` Anup Patel
@ 2019-05-04  3:54 ` Anup Patel
       [not found]   ` <20190504150758.w7apms3dj3bmpnsf@excalibur.cnev.de>
  1 sibling, 1 reply; 8+ messages in thread
From: Anup Patel @ 2019-05-04  3:54 UTC (permalink / raw)
  To: u-boot

Hi Karsten,

I tried again with image header changes applied to u-boot and
Linux kernel but still not able to reproduce the issues.

Either you might have more local changes or debian toolchain
is causing issue for u-boot.

Here are the logs....

anup at anup-ubuntu64:~/Work/riscv-test$ qemu-system-riscv64 -nographic
-machine virt -m 2G \
> -kernel opensbi/build/platform/qemu/virt/firmware/fw_jump.elf \
> -device loader,file=u-boot/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=./rootfs_riscv64.ext2,format=raw,id=hd0 \
> -device virtio-net-device,netdev=usernet \
> -netdev user,id=usernet,hostfwd=tcp::22222-:22

OpenSBI v0.3 (May  4 2019 09:17:54)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

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-g93789509a3 (May 04 2019 - 08:58:04 +0530)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  2 GiB
In:    uart at 10000000
Out:   uart at 10000000
Err:   uart@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: 32.0 MB = 0.0 GB (65536 x 512)
... is now current device
** No partition table - virtio 0 **
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (3 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 (3 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...
=>
=>
=> QEMU 3.1.92 monitor - type 'help' for more information
(qemu) q




anup at anup-ubuntu64:~/Work/riscv-test$ qemu-system-riscv64 -nographic
-smp 2 -machine virt -m 1.9G -kernel
opensbi/build/platform/qemu/virt/firmware/fw_payload.elf -device
loader,file=build-riscv64/arch/riscv/boot/Image,addr=0x81000000
-object rng-random,filename=/dev/urandom,id=rng0 -device
virtio-rng-device,rng=rng0 -append "console=ttyS0 rw root=/dev/vda"
-device virtio-blk-device,drive=hd0 -drive
file=./rootfs_riscv64.ext2,format=raw,id=hd0 -device
virtio-net-device,netdev=usernet -netdev
user,id=usernet,hostfwd=tcp::22222-:22

OpenSBI v0.3 (May  4 2019 09:17:54)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs     : 8
Current Hart           : 0
Firmware Base          : 0x80000000
Firmware Size          : 104 KB
Runtime SBI Version    : 0.1

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)


U-Boot 2019.07-rc1-00001-g93789509a3 (May 04 2019 - 08:58:04 +0530)

CPU:   rv64imafdcsu
Model: riscv-virtio,qemu
DRAM:  1.9 GiB
In:    uart at 10000000
Out:   uart at 10000000
Err:   uart@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: 32.0 MB = 0.0 GB (65536 x 512)
... is now current device
** No partition table - virtio 0 **
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (7 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...
=>
=>
=> booti ${kernel_addr_r} - ${fdtcontroladdr}
## Flattened Device Tree blob at f9134f90
   Booting using the fdt blob at 0xf9134f90
   Using Device Tree in place at 00000000f9134f90, end 00000000f9138d9d

Starting kernel ...

[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.1.0-rc7-00001-g2448469727e9
(anup at anup-ubuntu64) (gcc version 8.2.0 (Buildroot
2018.11-rc2-00003-ga0787e9)) #1 SMP Sat May 4 09:03:40 IST 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 0xf3692000-0xf7692000] (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/vda
[    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: 1885076K/1990248K available (5586K kernel code,
352K rwdata, 1774K rodata, 192K init, 817K bss, 105172K 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 53 interrupts with 2 handlers for 4 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask:
0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120
ns
[    0.000116] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps
every 4398046511100ns
[    0.003029] Console: colour dummy device 80x25
[    0.004259] Calibrating delay loop (skipped), value calculated
using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[    0.004403] pid_max: default: 32768 minimum: 301
[    0.008473] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.008543] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.017452] *** VALIDATE proc ***
[    0.019957] *** VALIDATE cgroup1 ***
[    0.020007] *** VALIDATE cgroup2 ***
[    0.049945] rcu: Hierarchical SRCU implementation.
[    0.056260] smp: Bringing up secondary CPUs ...
[    0.063030] smp: Brought up 1 node, 2 CPUs
[    0.097027] devtmpfs: initialized
[    0.102825] random: get_random_u32 called from
bucket_table_alloc+0x74/0x17c with crng_init=0
[    0.107079] clocksource: jiffies: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.108535] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.112706] NET: Registered protocol family 16
[    0.150745] vgaarb: loaded
[    0.151570] SCSI subsystem initialized
[    0.153772] usbcore: registered new interface driver usbfs
[    0.154033] usbcore: registered new interface driver hub
[    0.154327] usbcore: registered new device driver usb
[    0.164363] clocksource: Switched to clocksource riscv_clocksource
[    0.217528] NET: Registered protocol family 2
[    0.225491] tcp_listen_portaddr_hash hash table entries: 1024
(order: 2, 16384 bytes)
[    0.225632] TCP established hash table entries: 16384 (order: 5,
131072 bytes)
[    0.225976] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.226237] TCP: Hash tables configured (established 16384 bind 16384)
[    0.227526] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.227749] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.229436] NET: Registered protocol family 1
[    0.233122] RPC: Registered named UNIX socket transport module.
[    0.233183] RPC: Registered udp transport module.
[    0.233219] RPC: Registered tcp transport module.
[    0.233248] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.243061] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[    0.260156] NFS: Registering the id_resolver key type
[    0.261137] Key type id_resolver registered
[    0.261196] Key type id_legacy registered
[    0.261324] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.280092] NET: Registered protocol family 38
[    0.281005] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 254)
[    0.281113] io scheduler mq-deadline registered
[    0.281214] io scheduler kyber registered
[    0.283298] pci-host-generic 30000000.pci: host bridge
/soc/pci at 30000000 ranges:
[    0.283770] pci-host-generic 30000000.pci:    IO
0x03000000..0x0300ffff -> 0x00000000
[    0.284978] pci-host-generic 30000000.pci:   MEM
0x40000000..0x7fffffff -> 0x40000000
[    0.286325] pci-host-generic 30000000.pci: ECAM at [mem
0x30000000-0x3fffffff] for [bus 00-ff]
[    0.287292] pci-host-generic 30000000.pci: PCI host bridge to bus 0000:00
[    0.287472] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.287597] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    0.287639] pci_bus 0000:00: root bus resource [mem 0x40000000-0x7fffffff]
[    0.676815] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.684832] printk: console [ttyS0] disabled
[    0.685828] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10,
base_baud = 230400) is a 16550A
[    0.719729] printk: console [ttyS0] enabled
[    0.722810] [drm] radeon kernel modesetting enabled.
[    0.750455] loop: module loaded
[    0.758478] virtio_blk virtio1: [vda] 65536 512-byte logical blocks
(33.6 MB/32.0 MiB)
[    0.793933] libphy: Fixed MDIO Bus: probed
[    0.801214] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.801565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.803142] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.804015] ehci-pci: EHCI PCI platform driver
[    0.805783] ehci-platform: EHCI generic platform driver
[    0.806998] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.807380] ohci-pci: OHCI PCI platform driver
[    0.807842] ohci-platform: OHCI generic platform driver
[    0.809318] usbcore: registered new interface driver uas
[    0.810013] usbcore: registered new interface driver usb-storage
[    0.825451] mousedev: PS/2 mouse device common for all mice
[    0.832491] usbcore: registered new interface driver usbhid
[    0.833527] usbhid: USB HID core driver
[    0.837848] NET: Registered protocol family 10
[    0.850345] Segment Routing with IPv6
[    0.850922] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.853623] NET: Registered protocol family 17
[    0.854370] Key type dns_resolver registered
[    0.885848] EXT4-fs (vda): mounting ext2 file system using the ext4 subsystem
[    0.901519] EXT4-fs (vda): warning: mounting unchecked fs, running
e2fsck is recommended
[    0.922309] EXT4-fs (vda): mounted filesystem without journal. Opts: (null)
[    0.923053] VFS: Mounted root (ext2 filesystem) on device 254:0.
[    0.963165] Freeing unused kernel memory: 192K
[    0.963671] This architecture does not have kernel memory protection.
[    0.964881] Run /sbin/init as init process
           _  _
          | ||_|
          | | _ ____  _   _  _  _
          | || |  _ \| | | |\ \/ /
          | || | | | | |_| |/    \
          |_||_|_| |_|\____|\_/\_/

               Busybox Rootfs

Please press Enter to activate this console.
/ #
/ # cat /proc/interrupts
           CPU0       CPU1
  6:          0          0  SiFive PLIC   6  virtio2
  7:         45          0  SiFive PLIC   7  virtio1
 10:         82          0  SiFive PLIC  10  ttyS0
IPI0:       660        692  Rescheduling interrupts
IPI1:         0          4  Function call interrupts
IPI2:         0          0  CPU stop interrupts
/ #
/ #
/ # QEMU 3.1.92 monitor - type 'help' for more information
(qemu) q




Regards,
Anup

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
       [not found]   ` <20190504150758.w7apms3dj3bmpnsf@excalibur.cnev.de>
@ 2019-05-04 16:19     ` Anup Patel
  2019-05-04 16:28       ` David Abdurachmanov
  0 siblings, 1 reply; 8+ messages in thread
From: Anup Patel @ 2019-05-04 16:19 UTC (permalink / raw)
  To: u-boot

On Sat, May 4, 2019 at 8:38 PM Karsten Merker <merker@debian.org> wrote:
>
> On Sat, May 04, 2019 at 09:24:15AM +0530, Anup Patel wrote:
>
> [U-Boot+OpenSBI crash with more than 2GB RAM in qemu-system-riscv64]
> > I tried again with image header changes applied to u-boot and
> > Linux kernel but still not able to reproduce the issues.
> >
> > Either you might have more local changes or debian toolchain
> > is causing issue for u-boot.
>
> Hello,
>
> I hadn't made any local changes besides the ones described in my
> original email, i.e. the application of the booti patches.  To
> check for a toolchain-related problem I have rebuilt everything
> with both the gcc8-based and the gcc7-based buildroot toolchains,
> but the problem remained in all cases, regardless of whether I
> used the branch with the booti patch or the plain v2019.07-rc1
> tag, so the problem is definitely not specific to the Debian
> toolchain.  As a new qemu release has happend just a few days
> ago, I have now tried to upgrade qemu from the previous release
> version 3.1.0 to the freshly released version 4.0.0, and indeed
> with qemu 4.0.0 both the 2GB problem and the hang of init in SMP
> configurations with OpenSBI+U-Boot are gone.  Which qemu version
> had you been using in your tests?

I am using QEMU 4.0.0-rc2.

Like mentioned in previous email, BBL has limitation that it allows
full memory access to S-mode software. This means S-mode software
can actually corrupt BBL too. This is not possible in OpenSBI because
we use PMP configuration to protect firmware and critical memory
regions.

With QEMU 3.x, OpenSBI+U-Boot is failing for you because there
were bugs in QEMU PMP checks.

>
> What makes this interesting is that I'm running qemu 3.1.0 with
> BBL and Linux in a 4-core SMP configuration and with 8GB of RAM
> since months and never had any problems with it, so
> OpenSBI+U-Boot seems to do something differently from BBL.

That's because BBL is buggy. It allows complete RAM access to
S-mode software so QEMU PMP checks did not matter.

Regards,
Anup

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-04 16:19     ` Anup Patel
@ 2019-05-04 16:28       ` David Abdurachmanov
  2019-05-20 17:25         ` Björn Töpel
  0 siblings, 1 reply; 8+ messages in thread
From: David Abdurachmanov @ 2019-05-04 16:28 UTC (permalink / raw)
  To: u-boot

On Sat, May 4, 2019 at 7:20 PM Anup Patel <anup@brainfault.org> wrote:
>
> On Sat, May 4, 2019 at 8:38 PM Karsten Merker <merker@debian.org> wrote:
> >
> > On Sat, May 04, 2019 at 09:24:15AM +0530, Anup Patel wrote:
> >
> > [U-Boot+OpenSBI crash with more than 2GB RAM in qemu-system-riscv64]
> > > I tried again with image header changes applied to u-boot and
> > > Linux kernel but still not able to reproduce the issues.
> > >
> > > Either you might have more local changes or debian toolchain
> > > is causing issue for u-boot.
> >
> > Hello,
> >
> > I hadn't made any local changes besides the ones described in my
> > original email, i.e. the application of the booti patches.  To
> > check for a toolchain-related problem I have rebuilt everything
> > with both the gcc8-based and the gcc7-based buildroot toolchains,
> > but the problem remained in all cases, regardless of whether I
> > used the branch with the booti patch or the plain v2019.07-rc1
> > tag, so the problem is definitely not specific to the Debian
> > toolchain.  As a new qemu release has happend just a few days
> > ago, I have now tried to upgrade qemu from the previous release
> > version 3.1.0 to the freshly released version 4.0.0, and indeed
> > with qemu 4.0.0 both the 2GB problem and the hang of init in SMP
> > configurations with OpenSBI+U-Boot are gone.  Which qemu version
> > had you been using in your tests?
>
> I am using QEMU 4.0.0-rc2.
>

If you want to use SMP with U-Boot you need to use QEMU 4.0.0 +
Kernel 5.1 + U-Boot v2019.07-rc1. At least that's what I recall.

david

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-04 16:28       ` David Abdurachmanov
@ 2019-05-20 17:25         ` Björn Töpel
  2019-05-20 20:01           ` Atish Patra
  0 siblings, 1 reply; 8+ messages in thread
From: Björn Töpel @ 2019-05-20 17:25 UTC (permalink / raw)
  To: u-boot

Waking this thread up, because I'm seeing similar behavior as Karsten
-- i.e. the system hangs when launching init.

Software:
QEMU emulator version 4.0.50 (v4.0.0-576-g6d8e75d41c58)
Linux kernel v5.2-rc1, defconfig
OpenSBI commit 392749f6338a ("docs: Add documentation about dynamic firmware")

Toolchain-wise: Ubuntu/Debian:
  riscv64-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0

Launching the VM with:
~/pkg/qemu/bin/qemu-system-riscv64 \
  -nographic      \
XXXX
  -machine virt      \
  -smp 2      \
  -m 8G      \
  -object rng-random,filename=/dev/urandom,id=rng0      \
  -device virtio-rng-device,rng=rng0      \
  -append "console=ttyS0 selinux=0 apparmor=0 loglevel=7 rw
root=/dev/vda2"      \
  -device virtio-blk-device,drive=hd0      \
  -drive file=~/rv/play/debian-sid-sda.raw,format=raw,id=hd0      \
  -device virtio-net,mac=36:8c:88:13:10:d2,netdev=network0      \
  -netdev tap,id=network0,fd=3 3<>/dev/tap5

Where XXXX:
  -kernel ~/src/rv/opensbi/build/platform/qemu/virt/firmware/fw_jump.elf \
  -device loader,file=/home/btopel/build/rv/arch/riscv/boot/Image,addr=0x80200000
\

or
  -kernel bbl \ # riscv-pk HEAD

* When riscv-pk carries the payload, the kernel boots and succeeds to
  launch init.
* Using OpenSBI commit 392749f6338a ("docs: Add documentation about
  dynamic firmware"), the kernel boots, but hangs/spins ("info
  registers" says it's "rdcycle").

Bisecting OpenSBI, it looks like commit 90cb4917b584 ("lib: Implement
sfence.vma correctly.") broke something. At least prior that, the VM
launches correctly.

I haven't looked further -- any ideas?


Thanks,
Björn

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-20 17:25         ` Björn Töpel
@ 2019-05-20 20:01           ` Atish Patra
  2019-05-21  5:54             ` Björn Töpel
  0 siblings, 1 reply; 8+ messages in thread
From: Atish Patra @ 2019-05-20 20:01 UTC (permalink / raw)
  To: u-boot

On 5/20/19 10:26 AM, Björn Töpel wrote:
> Waking this thread up, because I'm seeing similar behavior as Karsten
> -- i.e. the system hangs when launching init.
> 
> Software:
> QEMU emulator version 4.0.50 (v4.0.0-576-g6d8e75d41c58)
> Linux kernel v5.2-rc1, defconfig
> OpenSBI commit 392749f6338a ("docs: Add documentation about dynamic firmware")
> 
> Toolchain-wise: Ubuntu/Debian:
>    riscv64-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
> 
> Launching the VM with:
> ~/pkg/qemu/bin/qemu-system-riscv64 \
>    -nographic      \
> XXXX
>    -machine virt      \
>    -smp 2      \
>    -m 8G      \
>    -object rng-random,filename=/dev/urandom,id=rng0      \
>    -device virtio-rng-device,rng=rng0      \
>    -append "console=ttyS0 selinux=0 apparmor=0 loglevel=7 rw
> root=/dev/vda2"      \
>    -device virtio-blk-device,drive=hd0      \
>    -drive file=~/rv/play/debian-sid-sda.raw,format=raw,id=hd0      \
>    -device virtio-net,mac=36:8c:88:13:10:d2,netdev=network0      \
>    -netdev tap,id=network0,fd=3 3<>/dev/tap5
> 
> Where XXXX:
>    -kernel ~/src/rv/opensbi/build/platform/qemu/virt/firmware/fw_jump.elf \
>    -device loader,file=/home/btopel/build/rv/arch/riscv/boot/Image,addr=0x80200000
> \
> 
> or
>    -kernel bbl \ # riscv-pk HEAD
> 
> * When riscv-pk carries the payload, the kernel boots and succeeds to
>    launch init.
> * Using OpenSBI commit 392749f6338a ("docs: Add documentation about
>    dynamic firmware"), the kernel boots, but hangs/spins ("info
>    registers" says it's "rdcycle").
> 
> Bisecting OpenSBI, it looks like commit 90cb4917b584 ("lib: Implement
> sfence.vma correctly.") broke something. At least prior that, the VM
> launches correctly.
> 
> I haven't looked further -- any ideas?
> 
> 
> Thanks,
> Björn
> 
> _______________________________________________
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
> 

Try this patch. This should solve this issue.

http://lists.infradead.org/pipermail/opensbi/2019-May/000118.html


-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine
  2019-05-20 20:01           ` Atish Patra
@ 2019-05-21  5:54             ` Björn Töpel
  0 siblings, 0 replies; 8+ messages in thread
From: Björn Töpel @ 2019-05-21  5:54 UTC (permalink / raw)
  To: u-boot

On Mon, 20 May 2019 at 22:03, Atish Patra <atish.patra@wdc.com> wrote:
>
[...]
> Try this patch. This should solve this issue.
>
> http://lists.infradead.org/pipermail/opensbi/2019-May/000118.html
>

Yup, it does solve it. Thank you!


Björn

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-21  5:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 16:17 [U-Boot] RISC-V: Crashes with OpenSBI+U-Boot on the qemu "virt" machine Karsten Merker
2019-05-04  3:07 ` Anup Patel
2019-05-04  3:54 ` Anup Patel
     [not found]   ` <20190504150758.w7apms3dj3bmpnsf@excalibur.cnev.de>
2019-05-04 16:19     ` Anup Patel
2019-05-04 16:28       ` David Abdurachmanov
2019-05-20 17:25         ` Björn Töpel
2019-05-20 20:01           ` Atish Patra
2019-05-21  5:54             ` Björn Töpel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.