golang/go

x/build/env/linux-riscv-qemu: add new RISC-V builder under qemu

Closed this issue · 9 comments

@rminnich @josharian et al want to start landing RISC-V code, so we need a builder.

@rminnich says qemu (from the sifive fork) is good now.

We can run a builder similar to what we're going to do for Fuchsia and what we previous did for a bit in https://github.com/golang/build/tree/master/env/linux-arm-qemu (but that was more emulation than we'd probably want here). We'll probably want to only run tests in qemu but do builds natively.

/cc @dmitshur @andybons

Change https://golang.org/cl/162959 mentions this issue: dashboard, buildlet: add a disabled builder with nested virt, for testing

@rminnich, on golang-dev you wrote:

tip qemu is unlikely to be the right choice.
The riscv qemu has not been all that stable. I use the fork from
sifive. We'll want to use that

Where is that fork?

Searching for [sifive qemu], one of the top hits is from April 2018 with title "RISC-V QEMU Part 2: The RISC-V QEMU port is upstream - SiFive" but I guess https://github.com/sifive/freedom-u-sdk has a risc-qemu submodule that goes to ... https://github.com/riscv/riscv-qemu/tree/ad8989a3b5359eb1afa57d7ffedeea6a3c797d9c .... so, that one? Or which branch thereof?

Thanks.

Sorry if this is already known but the Risc-V have been upstreamed into Qemu and version 3.1.0 already works.

Fedora also have a riscv64 image and multiple packages built (including gccgo). I'm running it locally and found no problems so far:

root@fedora-riscv:~ # cat /etc/os-release
NAME=Fedora
VERSION="30 (Rawhide)"
ID=fedora
VERSION_ID=30
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Rawhide)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:30"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=rawhide
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"

root@fedora-riscv:~ # uname -a
Linux fedora-riscv 5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 #1 SMP Tue Jan 15 03:14:34 UTC 2019 riscv64 riscv64 riscv64 GNU/Linux
root@fedora-riscv:~ # lscpu
Architecture:        riscv64
Byte Order:          Little Endian
CPU(s):              6
On-line CPU(s) list: 0-5
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           6

root@fedora-riscv:~ # /usr/bin/go version
go version go1.12beta2 gccgo (GCC) 9.0.1 20190209 (Red Hat 9.0.1-0.4) linux/riscv64

root@fedora-riscv:~ # gccgo --version
gccgo (GCC) 9.0.1 20190209 (Red Hat 9.0.1-0.4)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Current qemu version (I'm running on Mac right now installed with homebrew):

qemu-system-riscv64 --version
QEMU emulator version 3.1.0
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers

The Fedora docs are in https://fedoraproject.org/wiki/Architectures/RISC-V/Installing#Boot_under_QEMU and the image I used is https://dl.fedoraproject.org/pub/alt/risc-v/disk-images/fedora/rawhide/20190126.n.0/Developer/.

qemu-system-riscv64 \
    -nographic \
    -machine virt \
    -smp 6 \
    -m 4G \
    -kernel bbl-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64 \
    -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-device,rng=rng0 \
    -append "console=ttyS0 ro root=/dev/vda" \
    -device virtio-blk-device,drive=hd0 \
    -drive file=Fedora-Developer-Rawhide-20190126.n.0-sda1.raw,format=raw,id=hd0 \
    -device virtio-net-device,netdev=usernet \
    -netdev user,id=usernet,hostfwd=tcp::10000-:22 \
    -initrd initramfs-5.0.0-0.rc2.git0.1.0.riscv64.fc30.riscv64.img

I am leading Fedora/RISCV efforts and happy to answer any questions.

In general RISC-V development went upstream and the last 2-3 QEMU releases support RISC-V. Similar with libvirt.

Change https://golang.org/cl/163057 mentions this issue: buildlet: change image name for COS-with-vmx buildlet

Change https://golang.org/cl/163301 mentions this issue: env/linux-x86-vmx: add new Debian host that's like Container-Optimized OS + vmx

Change https://golang.org/cl/206639 mentions this issue: dashboard: add linux-riscv64 builder

Change https://golang.org/cl/206639 mentions this issue: dashboard, cmd/coordinator: add linux-riscv64 builder, fix bug from CL 205608

We've had linux/riscv64 builders running on real hardware since November 2019. As such, I doubt we want to bring one up on qemu any more.