On Tue, May 23, 2023 at 5:15 PM Richard W.M. Jones <rjo...@redhat.com> wrote:
>
> On Tue, May 23, 2023 at 04:05:04PM +0300, David Abdurachmanov wrote:
> > We run QEMU in a similar way as any other board.
> >
> > So it's U-Boot SPL, which then loads U-Boot ITB (which typically
> > contains U-Boot proper, OpenSBI FW_DYNAMIC generic binary, and DTB).
> > U-Boot SPL transfers control to OpenSBI and tells it how to load the
> > next stage (i.e U-Boot proper).
>
> Is there any documentation on how RISC-V boots now?  And about the
> eventual goal that we're aiming for?

For QEMU or the boards?

By default QEMU ships OpenSBI FW_DYNAMIC generic image and that's
default "BIOS".

For us (Fedora/RISCV) we don't rely on what's shipped by QEMU. We
build our own OpenSBI binary, and boot in a similar way as Unmatched
boards. We don't load DTB from /boot, but take it from QEMU. That's
the only major difference.

I would expect us to switch to EDK2 once all the relevant bits land
upstream. That work is mostly done by Ventana.

>
> > > > For the benefit of the search engine gods, this works for now:
> > > >
> > > > # virt-install --import --memory 8192 -n fedora-37-riscv \
> > > >       --arch riscv64  --vcpus 8 \
> > > >       --disk fedora-37-riscv.qcow2,format=qcow2 \
> > > >       --osinfo fedora37 \
> > > >       --qemu-commandline=' -bios /path/to/u-boot-spl.bin -device 
> > > > loader,file=/path/to/u-boot.itb,addr=0x80200000 '
> >
> > This doesn't disable Sv48 and Sv57. I don't know the overall status,
> > but at least Golang 1.20 has a fix to support anything above Sv39.
> >
> > Not sure about other runtimes that do pointer tagging.
> >
> > See: https://bugs.launchpad.net/ubuntu/+source/linux-riscv/+bug/1991790
>
> Interesting and informative bug.  I guess I'm not using any golang
> binaries, as the guest totally seems to work fine.  I'm a bit confused
> how this kernel detail leaks into userspace though.  I thought
> userspace can use all 64 bits in pointers.

It's not leaked. Folks assume that N bits at the end are not used, and
thus you can store extra information in there. That's "Pointer
Tagging", but it's based on calculated assumptions. That got broken
once QEMU gained Sv57 support.

IIRC v8 and OpenJDK might also be affected, but I don't have details.

OpenJDK: https://github.com/openjdk/jdk/pull/11388
Basically you get: err_msg("Unsupported satp mode: %s. Only satp modes
up to sv48 are supported for now." ..

I think v8, has: // Note that this assumes the use of SV48, the 48-bit
virtual memory system.

Note that RISCV has a "Pointer Masking" extension (WIP), Zjpm.
>
> > Simply put, older disk images on newer QEMU versions might not work 
> > properly.
> >
> > Note that we might want to switch to EDK2 in the future for QEMU, and
> > that probably will use two 32MiB pflash devices in virt machine. I
> > have seen, but haven't tested QEMU + EDK2 patches.
>
> Rich.
>
> > Cheers,
> > david
> >
> > >
> > > Based on the information above, using
> > >
> > >   --boot kernel=/path/to/u-boot.bin
> > >
> > > should work...
> > >
> > > > 'Course you have to disable SELinux ...
> > >
> > > ... without requiring this :)
> > >
> > > --
> > > Andrea Bolognani / Red Hat / Virtualization
> > >
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-top is 'top' for virtual machines.  Tiny program with many
> powerful monitoring features, net stats, disk stats, logging, etc.
> http://people.redhat.com/~rjones/virt-top
>

Reply via email to