Running RISCV linux on qemu

2023-09-21 Thread Swedha R
Hi,
I want to run riscv64 linux on top of qemu with the machine model sifive_u.
I had a preinstalled server ubuntu-23.04.img and prebuilt u-boot image.
And in the qemu website itself they mentioned there is no PCI -bus support
or virtio-bus support for sifive_u board.

when I ran this bash script with the following qemu commands,
U_BOOT=./U-boot
QEMU=/usr/local/bin/qemu-system-riscv64
IMAGE=./ubuntu-23.04.img


$QEMU   \
 -machine sifive_u  \
 -nographic \
 -m 8192 -smp 5 \
 -kernel $U_BOOT\
 -drive file=./ubuntu-23.04.img,format=raw,if=none


It's not booting the ubuntu image. Upto the following message is booting
OpenSBI v1.2
   _  _
  / __ \  / |  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |) | |_) || |_
  \/| .__/ \___|_| |_|_/|/_|
| |
|_|

Platform Name : SiFive HiFive Unleashed A00
Platform Features : medeleg
Platform HART Count   : 5
Platform IPI Device   : aclint-mswi
Platform Timer Device : aclint-mtimer @ 100Hz
Platform Console Device   : sifive_uart
Platform HSM Device   : ---
Platform PMU Device   : ---
Platform Reboot Device: gpio-restart
Platform Shutdown Device  : ---
Firmware Base : 0x8000
Firmware Size : 244 KB
Runtime SBI Version   : 1.0

Domain0 Name  : root
Domain0 Boot HART : 3
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00  : 0x0200-0x0200 (I)
Domain0 Region01  : 0x8000-0x8003 ()
Domain0 Region02  : 0x-0x (R,W,X)
Domain0 Next Address  : 0x8020
Domain0 Next Arg1 : 0xbfe0
Domain0 Next Mode : S-mode
Domain0 SysReset  : yes

Boot HART ID  : 3
Boot HART Domain  : root
Boot HART Priv Version: v1.10
Boot HART Base ISA: rv64imafdc
Boot HART ISA Extensions  : none
Boot HART PMP Count   : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count  : 0
Boot HART MIDELEG : 0x0222
Boot HART MEDELEG : 0xb109


U-Boot 2023.07-rc2 (May 16 2023 - 12:25:28 +0530)

CPU:   rv64imafdc_zicsr_zifencei
Model: SiFive HiFive Unleashed A00
DRAM:  8 GiB
Core:  17 devices, 9 uclasses, devicetree: board
Loading Environment from nowhere... OK
In:serial@1001
Out:   serial@1001
Err:   serial@1001
Net:   No ethernet found.
Working FDT set to ff72f430
Hit any key to stop autoboot:  0

Device 0: unknown device
scanning bus for devices...

Device 0: unknown device
No ethernet found.
No ethernet found.

Please guide me on this on how to make it for sifive_u machine model



Thanks in advance

Regards,
Swedha


Re: Freebsd 12 strange disk behaviour on QEMU machine

2023-09-21 Thread Jakob Bohm
Using Linux Guests on older qemu versions, I have seen some bad disk 
speed effects of snapshot mechanisms, but not your particular scenario:


1. When creating a snapshot and until all snapshots are deleted, all 
disk writes are redirected to a delta storage area that keeps track of 
which virtual disk blocks are different from the snapshot contents and 
what that different block contents is.  Read access thus gets overhead 
from doing the lookup and occasional redirected read.  Write access gets 
much more overhead from adding delta entries and redirecting the write.  
This is inherent in the snapshot mechanism.


2. In snapshot mode I have seen general I/O (including network and/or 
basic CPU stuff) getting slowed down so hard that the outside cannot 
even ping the virtual machines, indicating that someone in the qemu team 
made the mistake of doing the disk snapshot overhead in the same 
execution thread as basic emulation tasks.  Later qemu developers get so 
focused on spitting out replies to rookies that they fail to realize the 
fundamental problem.


3. I have not seen slowdowns happen after snapshot removal, but cannot 
rule out that someone made further mistakes in I/O handling.


On 2023-09-20 15:40, Roland Giesler wrote:


Has anyone here ever has a similar occurrence?  It's quite perplexing 
and I'm surprised that I can't find anything about this on the web.


On 2023/09/18 16:03, Roland Giesler wrote:


We have a FreeBSD machine running an IRIS poller that behaves really 
strange.


We had FreeBSD 12.3 at first, then changed to 12.4.  Same result.

We also changed from BIOS to UEFI.  Same result.

The storage is ceph RBD on NVMe SSD drives, so it's fast.

The symptoms are as follows:

After installation of the OS and the script (most perl) that IRIS 
uses, the service run perflectly.  I then take a snapshot.  If the 
machine is restarted for whatever else reason everything comes up, 
but the FreeBSD processes go into a "D state", meaning they are 
waiting for the disk.


This happens very time.  It's then not possible to fix the machine, 
although all seems quite normal and not config changes took place 
that we can detect.


If I roll back the snapshot, things are normal for a while put soon 
processes go into D state again.



I'm not sure that this is a qemu problem, but we have to start 
somewhere.



Finally, I not have the VM running an a local volume (non ceph, 
standalone SSD) and there's no problem.  This is actually an 
installation that was done on ceph and then the disk volume was moved 
to the current location.



Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded